openfox 1.6.21 → 1.6.25

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.
Files changed (29) hide show
  1. package/README.md +46 -13
  2. package/dist/{auto-compaction-U75EINMB.js → auto-compaction-7LK3QGPI.js} +4 -3
  3. package/dist/{chat-handler-JEMPI5UF.js → chat-handler-ZU74RXED.js} +6 -5
  4. package/dist/{chunk-HWOYZ245.js → chunk-2V7VPPBP.js} +6 -6
  5. package/dist/{chunk-HZP2V5Z6.js → chunk-4O3C2JMB.js} +5 -9
  6. package/dist/{chunk-SJVEX2NR.js → chunk-7LPL774T.js} +19 -19
  7. package/dist/{chunk-AU33PQAB.js → chunk-BOEXJCOD.js} +2 -2
  8. package/dist/{chunk-6NPMZFMP.js → chunk-CJNQGEYG.js} +2 -2
  9. package/dist/{chunk-XYD5JXRM.js → chunk-D4ZLSV6P.js} +292 -1
  10. package/dist/{chunk-FX4SUY2S.js → chunk-KSASIV4B.js} +10 -287
  11. package/dist/{chunk-XRGMFOVG.js → chunk-P6GUT2QQ.js} +3 -3
  12. package/dist/{chunk-WINI5HX7.js → chunk-PYBB34ZK.js} +3 -3
  13. package/dist/cli/dev.js +1 -1
  14. package/dist/cli/index.js +1 -1
  15. package/dist/{config-SWDAJMQ3.js → config-ACVEHBKG.js} +5 -5
  16. package/dist/{orchestrator-T2IPRZ7B.js → orchestrator-OE7WFEW6.js} +5 -4
  17. package/dist/package.json +3 -3
  18. package/dist/{processor-VKFEOK46.js → processor-GAOK7TPI.js} +2 -2
  19. package/dist/{provider-CDM4LQAC.js → provider-RLQMVV2Z.js} +7 -7
  20. package/dist/{serve-X3PKC27B.js → serve-3L3HLUVT.js} +9 -9
  21. package/dist/server/index.js +7 -7
  22. package/dist/{tools-4ODVFMW7.js → tools-CSV7G554.js} +4 -3
  23. package/dist/{vision-fallback-VXGCQKLA.js → vision-fallback-QJ26DCEF.js} +2 -2
  24. package/dist/web/assets/index-VCGZnpy0.js +153 -0
  25. package/dist/web/assets/{index-B9-lT3Kc.css → index-y9uYQYP-.css} +1 -1
  26. package/dist/web/index.html +2 -2
  27. package/dist/web/sw.js +1 -1
  28. package/package.json +3 -3
  29. package/dist/web/assets/index-DHP3d5Cl.js +0 -151
@@ -0,0 +1,153 @@
1
+ var B1=Object.defineProperty;var z1=(e,r,i)=>r in e?B1(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i;var ar=(e,r,i)=>z1(e,typeof r!="symbol"?r+"":r,i);function H1(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 Vl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wd={exports:{}},Aa={};/**
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 ux;function P1(){if(ux)return Aa;ux=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 Aa.Fragment=r,Aa.jsx=i,Aa.jsxs=i,Aa}var dx;function F1(){return dx||(dx=1,wd.exports=P1()),wd.exports}var o=F1(),Cd={exports:{}},Ge={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var hx;function U1(){if(hx)return Ge;hx=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"),v=Symbol.iterator;function _(I){return I===null||typeof I!="object"?null:(I=v&&I[v]||I["@@iterator"],typeof I=="function"?I:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,y={};function x(I,V,F){this.props=I,this.context=V,this.refs=y,this.updater=F||E}x.prototype.isReactComponent={},x.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")},x.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function b(){}b.prototype=x.prototype;function S(I,V,F){this.props=I,this.context=V,this.refs=y,this.updater=F||E}var j=S.prototype=new b;j.constructor=S,C(j,x.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 Ge.Activity=m,Ge.Children=L,Ge.Component=x,Ge.Fragment=i,Ge.Profiler=l,Ge.PureComponent=S,Ge.StrictMode=s,Ge.Suspense=d,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(I){return D.H.useMemoCache(I)}},Ge.cache=function(I){return function(){return I.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.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)},Ge.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},Ge.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)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(I){return{$$typeof:c,render:I}},Ge.isValidElement=W,Ge.lazy=function(I){return{$$typeof:g,_payload:{_status:-1,_result:I},_init:Z}},Ge.memo=function(I,V){return{$$typeof:p,type:I,compare:V===void 0?null:V}},Ge.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}},Ge.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Ge.use=function(I){return D.H.use(I)},Ge.useActionState=function(I,V,F){return D.H.useActionState(I,V,F)},Ge.useCallback=function(I,V){return D.H.useCallback(I,V)},Ge.useContext=function(I){return D.H.useContext(I)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(I,V){return D.H.useDeferredValue(I,V)},Ge.useEffect=function(I,V){return D.H.useEffect(I,V)},Ge.useEffectEvent=function(I){return D.H.useEffectEvent(I)},Ge.useId=function(){return D.H.useId()},Ge.useImperativeHandle=function(I,V,F){return D.H.useImperativeHandle(I,V,F)},Ge.useInsertionEffect=function(I,V){return D.H.useInsertionEffect(I,V)},Ge.useLayoutEffect=function(I,V){return D.H.useLayoutEffect(I,V)},Ge.useMemo=function(I,V){return D.H.useMemo(I,V)},Ge.useOptimistic=function(I,V){return D.H.useOptimistic(I,V)},Ge.useReducer=function(I,V,F){return D.H.useReducer(I,V,F)},Ge.useRef=function(I){return D.H.useRef(I)},Ge.useState=function(I){return D.H.useState(I)},Ge.useSyncExternalStore=function(I,V,F){return D.H.useSyncExternalStore(I,V,F)},Ge.useTransition=function(){return D.H.useTransition()},Ge.version="19.2.4",Ge}var fx;function Kl(){return fx||(fx=1,Cd.exports=U1()),Cd.exports}var P=Kl();const dn=Vl(P),$1=H1({__proto__:null,default:dn},[P]);var kd={exports:{}},Da={},Ed={exports:{}},jd={};/**
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 px;function q1(){return px||(px=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,v=3,_=!1,E=!1,C=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,b=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),!E)if(i(d)!==null)E=!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 y?!0:!(e.unstable_now()-B<T)}function W(){if(y=!1,N){var M=e.unstable_now();B=M;var Y=!0;try{e:{E=!1,C&&(C=!1,b(D),D=-1),_=!0;var Z=v;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,v=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,v=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(){x(W,0)};function U(M,Y){D=x(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 v},e.unstable_next=function(M){switch(v){case 1:case 2:case 3:var Y=3;break;default:Y=v}var Z=v;v=Y;try{return M()}finally{v=Z}},e.unstable_requestPaint=function(){y=!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=v;v=M;try{return Y()}finally{v=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?(b(D),D=-1):C=!0,U(A,Z-z))):(M.sortIndex=L,r(d,M),E||_||(E=!0,N||(N=!0,K()))),M},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(M){var Y=v;return function(){var Z=v;v=Y;try{return M.apply(this,arguments)}finally{v=Z}}}})(jd)),jd}var mx;function W1(){return mx||(mx=1,Ed.exports=q1()),Ed.exports}var Nd={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 gx;function G1(){if(gx)return cn;gx=1;var e=Kl();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),v=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:v,fetchPriority:_}):g==="script"&&s.d.X(d,{crossOrigin:m,integrity:v,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 xx;function hb(){if(xx)return Nd.exports;xx=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(),Nd.exports=G1(),Nd.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 vx;function V1(){if(vx)return Da;vx=1;var e=W1(),r=Kl(),i=hb();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 k=w.alternate;if(k===null){if(h=w.return,h!==null){a=h;continue}break}if(w.child===k.child){for(k=w.child;k;){if(k===a)return d(w),t;if(k===h)return d(w),n;k=k.sibling}throw Error(s(188))}if(a.return!==h.return)a=w,h=k;else{for(var O=!1,G=w.child;G;){if(G===a){O=!0,a=w,h=k;break}if(G===h){O=!0,h=w,a=k;break}G=G.sibling}if(!O){for(G=k.child;G;){if(G===a){O=!0,a=k,h=w;break}if(G===h){O=!0,h=k,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,v=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),b=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 x:return"Profiler";case y:return"StrictMode";case A:return"Suspense";case N:return"SuspenseList";case B:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case E:return"Portal";case S:return t.displayName||"Context";case b: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)?Rg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Rg(n),t=Og(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=Og(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),Ea._currentValue=Z)}var be,Le;function Ie(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 k=h.DetermineComponentFrameRoot(),O=k[0],G=k[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:"")?Ie(a):""}function je(t,n){switch(t.tag){case 26:case 27:case 5:return Ie(t.type);case 16:return Ie("Lazy");case 13:return t.child!==n&&n!==null?Ie("Suspense Fallback"):Ie("Suspense");case 19:return Ie("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 Ie("Activity");default:return""}}function me(t){try{var n="",a=null;do n+=je(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,_e=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,Oe=e.unstable_LowPriority,qe=e.unstable_IdlePriority,Nt=e.log,Ze=e.unstable_setDisableYieldValue,Ot=null,Tt=null;function Yt(t){if(typeof Nt=="function"&&Ze(t),Tt&&typeof Tt.setStrictMode=="function")try{Tt.setStrictMode(Ot,t)}catch{}}var lt=Math.clz32?Math.clz32:Ps,Bn=Math.log,Xt=Math.LN2;function Ps(t){return t>>>=0,t===0?32:31-(Bn(t)/Xt|0)|0}var pe=256,ye=262144,we=4194304;function We(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Qe(t,n,a){var h=t.pendingLanes;if(h===0)return 0;var w=0,k=t.suspendedLanes,O=t.pingedLanes;t=t.warmLanes;var G=h&134217727;return G!==0?(h=G&~k,h!==0?w=We(h):(O&=G,O!==0?w=We(O):a||(a=G&~t,a!==0&&(w=We(a))))):(G=h&~k,G!==0?w=We(G):O!==0?w=We(O):a||(a=h&~t,a!==0&&(w=We(a)))),w===0?0:n!==0&&n!==w&&(n&k)===0&&(k=w&-w,a=n&-n,k>=a||k===32&&(a&4194048)!==0)?n:w}function te(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Ee(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 Re(){var t=we;return we<<=1,(we&62914560)===0&&(we=4194304),t}function Ve(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function Mt(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function gn(t,n,a,h,w,k){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&&hr(t,h,0),k!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=k&~(O&~n))}function hr(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 Fi(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 Mr(t,n){var a=n&-n;return a=(a&42)!==0?1:hc(a),(a&(t.suspendedLanes|n))!==0?0:a}function hc(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 fc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function vf(){var t=Y.p;return t!==0?t:(t=window.event,t===void 0?32:rx(t.type))}function bf(t,n){var a=Y.p;try{return Y.p=t,n()}finally{Y.p=a}}var Ir=Math.random().toString(36).slice(2),tn="__reactFiber$"+Ir,xn="__reactProps$"+Ir,Ui="__reactContainer$"+Ir,pc="__reactEvents$"+Ir,E0="__reactListeners$"+Ir,j0="__reactHandles$"+Ir,yf="__reactResources$"+Ir,Fs="__reactMarker$"+Ir;function mc(t){delete t[tn],delete t[xn],delete t[pc],delete t[E0],delete t[j0]}function $i(t){var n=t[tn];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Ui]||a[tn]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=Fg(t);t!==null;){if(a=t[tn])return a;t=Fg(t)}return n}t=a,a=t.parentNode}return null}function qi(t){if(t=t[tn]||t[Ui]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Us(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function Wi(t){var n=t[yf];return n||(n=t[yf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Zt(t){t[Fs]=!0}var _f=new Set,Sf={};function di(t,n){Gi(t,n),Gi(t+"Capture",n)}function Gi(t,n){for(Sf[t]=n,t=0;t<n.length;t++)_f.add(n[t])}var N0=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]*$"),wf={},Cf={};function T0(t){return Te.call(Cf,t)?!0:Te.call(wf,t)?!1:N0.test(t)?Cf[t]=!0:(wf[t]=!0,!1)}function ho(t,n,a){if(T0(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 fo(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 fr(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 zn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function kf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function A0(t,n,a){var h=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var w=h.get,k=h.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return w.call(this)},set:function(O){a=""+O,k.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 gc(t){if(!t._valueTracker){var n=kf(t)?"checked":"value";t._valueTracker=A0(t,n,""+t[n])}}function Ef(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),h="";return t&&(h=kf(t)?t.checked?"true":"false":t.value),t=h,t!==a?(n.setValue(t),!0):!1}function po(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 D0=/[\n"\\]/g;function Hn(t){return t.replace(D0,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function xc(t,n,a,h,w,k,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=""+zn(n)):t.value!==""+zn(n)&&(t.value=""+zn(n)):O!=="submit"&&O!=="reset"||t.removeAttribute("value"),n!=null?vc(t,O,zn(n)):a!=null?vc(t,O,zn(a)):h!=null&&t.removeAttribute("value"),w==null&&k!=null&&(t.defaultChecked=!!k),w!=null&&(t.checked=w&&typeof w!="function"&&typeof w!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?t.name=""+zn(G):t.removeAttribute("name")}function jf(t,n,a,h,w,k,O,G){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(t.type=k),n!=null||a!=null){if(!(k!=="submit"&&k!=="reset"||n!=null)){gc(t);return}a=a!=null?""+zn(a):"",n=n!=null?""+zn(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),gc(t)}function vc(t,n,a){n==="number"&&po(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Vi(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=""+zn(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 Nf(t,n,a){if(n!=null&&(n=""+zn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+zn(a):""}function Tf(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=zn(n),t.defaultValue=a,h=t.textContent,h===a&&h!==""&&h!==null&&(t.value=h),gc(t)}function Ki(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var L0=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 Af(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||L0.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function Df(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&&Af(t,w,h)}else for(var k in n)n.hasOwnProperty(k)&&Af(t,k,n[k])}function bc(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 R0=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"]]),O0=/^[\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 mo(t){return O0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function pr(){}var yc=null;function _c(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Yi=null,Xi=null;function Lf(t){var n=qi(t);if(n&&(t=n.stateNode)){var a=t[xn]||null;e:switch(t=n.stateNode,n.type){case"input":if(xc(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="'+Hn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var h=a[n];if(h!==t&&h.form===t.form){var w=h[xn]||null;if(!w)throw Error(s(90));xc(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&&Ef(h)}break e;case"textarea":Nf(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Vi(t,!!a.multiple,n,!1)}}}var Sc=!1;function Rf(t,n,a){if(Sc)return t(n,a);Sc=!0;try{var h=t(n);return h}finally{if(Sc=!1,(Yi!==null||Xi!==null)&&(nl(),Yi&&(n=Yi,t=Xi,Xi=Yi=null,Lf(n),t)))for(n=0;n<t.length;n++)Lf(t[n])}}function $s(t,n){var a=t.stateNode;if(a===null)return null;var h=a[xn]||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 mr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wc=!1;if(mr)try{var qs={};Object.defineProperty(qs,"passive",{get:function(){wc=!0}}),window.addEventListener("test",qs,qs),window.removeEventListener("test",qs,qs)}catch{wc=!1}var Br=null,Cc=null,go=null;function Of(){if(go)return go;var t,n=Cc,a=n.length,h,w="value"in Br?Br.value:Br.textContent,k=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[k-h];h++);return go=w.slice(t,1<h?1-h:void 0)}function xo(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 vo(){return!0}function Mf(){return!1}function vn(t){function n(a,h,w,k,O){this._reactName=a,this._targetInst=w,this.type=h,this.nativeEvent=k,this.target=O,this.currentTarget=null;for(var G in t)t.hasOwnProperty(G)&&(a=t[G],this[G]=a?a(k):k[G]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?vo:Mf,this.isPropagationStopped=Mf,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=vo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=vo)},persist:function(){},isPersistent:vo}),n}var hi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bo=vn(hi),Ws=m({},hi,{view:0,detail:0}),M0=vn(Ws),kc,Ec,Gs,yo=m({},Ws,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nc,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!==Gs&&(Gs&&t.type==="mousemove"?(kc=t.screenX-Gs.screenX,Ec=t.screenY-Gs.screenY):Ec=kc=0,Gs=t),kc)},movementY:function(t){return"movementY"in t?t.movementY:Ec}}),If=vn(yo),I0=m({},yo,{dataTransfer:0}),B0=vn(I0),z0=m({},Ws,{relatedTarget:0}),jc=vn(z0),H0=m({},hi,{animationName:0,elapsedTime:0,pseudoElement:0}),P0=vn(H0),F0=m({},hi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),U0=vn(F0),$0=m({},hi,{data:0}),Bf=vn($0),q0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},W0={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"},G0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function V0(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=G0[t])?!!n[t]:!1}function Nc(){return V0}var K0=m({},Ws,{key:function(t){if(t.key){var n=q0[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=xo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?W0[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nc,charCode:function(t){return t.type==="keypress"?xo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?xo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Y0=vn(K0),X0=m({},yo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zf=vn(X0),Z0=m({},Ws,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nc}),Q0=vn(Z0),J0=m({},hi,{propertyName:0,elapsedTime:0,pseudoElement:0}),e_=vn(J0),t_=m({},yo,{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}),n_=vn(t_),r_=m({},hi,{newState:0,oldState:0}),i_=vn(r_),s_=[9,13,27,32],Tc=mr&&"CompositionEvent"in window,Vs=null;mr&&"documentMode"in document&&(Vs=document.documentMode);var a_=mr&&"TextEvent"in window&&!Vs,Hf=mr&&(!Tc||Vs&&8<Vs&&11>=Vs),Pf=" ",Ff=!1;function Uf(t,n){switch(t){case"keyup":return s_.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $f(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Zi=!1;function o_(t,n){switch(t){case"compositionend":return $f(n);case"keypress":return n.which!==32?null:(Ff=!0,Pf);case"textInput":return t=n.data,t===Pf&&Ff?null:t;default:return null}}function l_(t,n){if(Zi)return t==="compositionend"||!Tc&&Uf(t,n)?(t=Of(),go=Cc=Br=null,Zi=!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 Hf&&n.locale!=="ko"?null:n.data;default:return null}}var c_={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function qf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!c_[t.type]:n==="textarea"}function Wf(t,n,a,h){Yi?Xi?Xi.push(h):Xi=[h]:Yi=h,n=cl(n,"onChange"),0<n.length&&(a=new bo("onChange","change",null,a,h),t.push({event:a,listeners:n}))}var Ks=null,Ys=null;function u_(t){jg(t,0)}function _o(t){var n=Us(t);if(Ef(n))return t}function Gf(t,n){if(t==="change")return n}var Vf=!1;if(mr){var Ac;if(mr){var Dc="oninput"in document;if(!Dc){var Kf=document.createElement("div");Kf.setAttribute("oninput","return;"),Dc=typeof Kf.oninput=="function"}Ac=Dc}else Ac=!1;Vf=Ac&&(!document.documentMode||9<document.documentMode)}function Yf(){Ks&&(Ks.detachEvent("onpropertychange",Xf),Ys=Ks=null)}function Xf(t){if(t.propertyName==="value"&&_o(Ys)){var n=[];Wf(n,Ys,t,_c(t)),Rf(u_,n)}}function d_(t,n,a){t==="focusin"?(Yf(),Ks=n,Ys=a,Ks.attachEvent("onpropertychange",Xf)):t==="focusout"&&Yf()}function h_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return _o(Ys)}function f_(t,n){if(t==="click")return _o(n)}function p_(t,n){if(t==="input"||t==="change")return _o(n)}function m_(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var En=typeof Object.is=="function"?Object.is:m_;function Xs(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 Zf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Qf(t,n){var a=Zf(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=Zf(a)}}function Jf(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Jf(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function ep(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=po(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=po(t.document)}return n}function Lc(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 g_=mr&&"documentMode"in document&&11>=document.documentMode,Qi=null,Rc=null,Zs=null,Oc=!1;function tp(t,n,a){var h=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Oc||Qi==null||Qi!==po(h)||(h=Qi,"selectionStart"in h&&Lc(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}),Zs&&Xs(Zs,h)||(Zs=h,h=cl(Rc,"onSelect"),0<h.length&&(n=new bo("onSelect","select",null,n,a),t.push({event:n,listeners:h}),n.target=Qi)))}function fi(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var Ji={animationend:fi("Animation","AnimationEnd"),animationiteration:fi("Animation","AnimationIteration"),animationstart:fi("Animation","AnimationStart"),transitionrun:fi("Transition","TransitionRun"),transitionstart:fi("Transition","TransitionStart"),transitioncancel:fi("Transition","TransitionCancel"),transitionend:fi("Transition","TransitionEnd")},Mc={},np={};mr&&(np=document.createElement("div").style,"AnimationEvent"in window||(delete Ji.animationend.animation,delete Ji.animationiteration.animation,delete Ji.animationstart.animation),"TransitionEvent"in window||delete Ji.transitionend.transition);function pi(t){if(Mc[t])return Mc[t];if(!Ji[t])return t;var n=Ji[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in np)return Mc[t]=n[a];return t}var rp=pi("animationend"),ip=pi("animationiteration"),sp=pi("animationstart"),x_=pi("transitionrun"),v_=pi("transitionstart"),b_=pi("transitioncancel"),ap=pi("transitionend"),op=new Map,Ic="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(" ");Ic.push("scrollEnd");function Xn(t,n){op.set(t,n),di(n,[t])}var So=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)},Pn=[],es=0,Bc=0;function wo(){for(var t=es,n=Bc=es=0;n<t;){var a=Pn[n];Pn[n++]=null;var h=Pn[n];Pn[n++]=null;var w=Pn[n];Pn[n++]=null;var k=Pn[n];if(Pn[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}k!==0&&lp(a,w,k)}}function Co(t,n,a,h){Pn[es++]=t,Pn[es++]=n,Pn[es++]=a,Pn[es++]=h,Bc|=h,t.lanes|=h,t=t.alternate,t!==null&&(t.lanes|=h)}function zc(t,n,a,h){return Co(t,n,a,h),ko(t)}function mi(t,n){return Co(t,null,null,n),ko(t)}function lp(t,n,a){t.lanes|=a;var h=t.alternate;h!==null&&(h.lanes|=a);for(var w=!1,k=t.return;k!==null;)k.childLanes|=a,h=k.alternate,h!==null&&(h.childLanes|=a),k.tag===22&&(t=k.stateNode,t===null||t._visibility&1||(w=!0)),t=k,k=k.return;return t.tag===3?(k=t.stateNode,w&&n!==null&&(w=31-lt(a),t=k.hiddenUpdates,h=t[w],h===null?t[w]=[n]:h.push(n),n.lane=a|536870912),k):null}function ko(t){if(50<ba)throw ba=0,Vu=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var ts={};function y_(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 y_(t,n,a,h)}function Hc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function gr(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 cp(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 Eo(t,n,a,h,w,k){var O=0;if(h=t,typeof t=="function")Hc(t)&&(O=1);else if(typeof t=="string")O=k1(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=k,t;case C:return gi(a.children,w,k,n);case y:O=8,w|=24;break;case x:return t=jn(12,a,n,w|2),t.elementType=x,t.lanes=k,t;case A:return t=jn(13,a,n,w),t.elementType=A,t.lanes=k,t;case N:return t=jn(19,a,n,w),t.elementType=N,t.lanes=k,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case S:O=10;break e;case b: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=k,n}function gi(t,n,a,h){return t=jn(7,t,h,n),t.lanes=a,t}function Pc(t,n,a){return t=jn(6,t,null,n),t.lanes=a,t}function up(t){var n=jn(18,null,null,0);return n.stateNode=t,n}function Fc(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 dp=new WeakMap;function Fn(t,n){if(typeof t=="object"&&t!==null){var a=dp.get(t);return a!==void 0?a:(n={value:t,source:n,stack:me(n)},dp.set(t,n),n)}return{value:t,source:n,stack:me(n)}}var ns=[],rs=0,jo=null,Qs=0,Un=[],$n=0,zr=null,nr=1,rr="";function xr(t,n){ns[rs++]=Qs,ns[rs++]=jo,jo=t,Qs=n}function hp(t,n,a){Un[$n++]=nr,Un[$n++]=rr,Un[$n++]=zr,zr=t;var h=nr;t=rr;var w=32-lt(h)-1;h&=~(1<<w),a+=1;var k=32-lt(n)+w;if(30<k){var O=w-w%5;k=(h&(1<<O)-1).toString(32),h>>=O,w-=O,nr=1<<32-lt(n)+w|a<<w|h,rr=k+t}else nr=1<<k|a<<w|h,rr=t}function Uc(t){t.return!==null&&(xr(t,1),hp(t,1,0))}function $c(t){for(;t===jo;)jo=ns[--rs],ns[rs]=null,Qs=ns[--rs],ns[rs]=null;for(;t===zr;)zr=Un[--$n],Un[$n]=null,rr=Un[--$n],Un[$n]=null,nr=Un[--$n],Un[$n]=null}function fp(t,n){Un[$n++]=nr,Un[$n++]=rr,Un[$n++]=zr,nr=n.id,rr=n.overflow,zr=t}var nn=null,_t=null,st=!1,Hr=null,qn=!1,qc=Error(s(519));function Pr(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Js(Fn(n,t)),qc}function pp(t){var n=t.stateNode,a=t.type,h=t.memoizedProps;switch(n[tn]=t,n[xn]=h,a){case"dialog":et("cancel",n),et("close",n);break;case"iframe":case"object":case"embed":et("load",n);break;case"video":case"audio":for(a=0;a<_a.length;a++)et(_a[a],n);break;case"source":et("error",n);break;case"img":case"image":case"link":et("error",n),et("load",n);break;case"details":et("toggle",n);break;case"input":et("invalid",n),jf(n,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":et("invalid",n);break;case"textarea":et("invalid",n),Tf(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||Dg(n.textContent,a)?(h.popover!=null&&(et("beforetoggle",n),et("toggle",n)),h.onScroll!=null&&et("scroll",n),h.onScrollEnd!=null&&et("scrollend",n),h.onClick!=null&&(n.onclick=pr),n=!0):n=!1,n||Pr(t,!0)}function mp(t){for(nn=t.return;nn;)switch(nn.tag){case 5:case 31:case 13:qn=!1;return;case 27:case 3:qn=!0;return;default:nn=nn.return}}function is(t){if(t!==nn)return!1;if(!st)return mp(t),st=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||ld(t.type,t.memoizedProps)),a=!a),a&&_t&&Pr(t),mp(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));_t=Pg(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));_t=Pg(t)}else n===27?(n=_t,ei(t.type)?(t=fd,fd=null,_t=t):_t=n):_t=nn?Gn(t.stateNode.nextSibling):null;return!0}function xi(){_t=nn=null,st=!1}function Wc(){var t=Hr;return t!==null&&(Sn===null?Sn=t:Sn.push.apply(Sn,t),Hr=null),t}function Js(t){Hr===null?Hr=[t]:Hr.push(t)}var Gc=I(null),vi=null,vr=null;function Fr(t,n,a){F(Gc,n._currentValue),n._currentValue=a}function br(t){t._currentValue=Gc.current,V(Gc)}function Vc(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 Kc(t,n,a,h){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var k=w.dependencies;if(k!==null){var O=w.child;k=k.firstContext;e:for(;k!==null;){var G=k;k=w;for(var J=0;J<n.length;J++)if(G.context===n[J]){k.lanes|=a,G=k.alternate,G!==null&&(G.lanes|=a),Vc(k.return,a,t),h||(O=null);break e}k=G.next}}else if(w.tag===18){if(O=w.return,O===null)throw Error(s(341));O.lanes|=a,k=O.alternate,k!==null&&(k.lanes|=a),Vc(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 ss(t,n,a,h){t=null;for(var w=n,k=!1;w!==null;){if(!k){if((w.flags&524288)!==0)k=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var 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(Ea):t=[Ea])}w=w.return}t!==null&&Kc(n,t,a,h),n.flags|=262144}function No(t){for(t=t.firstContext;t!==null;){if(!En(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function bi(t){vi=t,vr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function rn(t){return gp(vi,t)}function To(t,n){return vi===null&&bi(t),gp(t,n)}function gp(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},vr===null){if(t===null)throw Error(s(308));vr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else vr=vr.next=n;return a}var __=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()})}},S_=e.unstable_scheduleCallback,w_=e.unstable_NormalPriority,Ht={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Yc(){return{controller:new __,data:new Map,refCount:0}}function ea(t){t.refCount--,t.refCount===0&&S_(w_,function(){t.controller.abort()})}var ta=null,Xc=0,as=0,os=null;function C_(t,n){if(ta===null){var a=ta=[];Xc=0,as=Ju(),os={status:"pending",value:void 0,then:function(h){a.push(h)}}}return Xc++,n.then(xp,xp),n}function xp(){if(--Xc===0&&ta!==null){os!==null&&(os.status="fulfilled");var t=ta;ta=null,as=0,os=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function k_(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 vp=M.S;M.S=function(t,n){tg=Be(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&C_(t,n),vp!==null&&vp(t,n)};var yi=I(null);function Zc(){var t=yi.current;return t!==null?t:vt.pooledCache}function Ao(t,n){n===null?F(yi,yi.current):F(yi,n.pool)}function bp(){var t=Zc();return t===null?null:{parent:Ht._currentValue,pool:t}}var ls=Error(s(460)),Qc=Error(s(474)),Do=Error(s(542)),Lo={then:function(){}};function yp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function _p(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(pr,pr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,wp(t),t;default:if(typeof n.status=="string")n.then(pr,pr);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,wp(t),t}throw Si=n,ls}}function _i(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Si=a,ls):a}}var Si=null;function Sp(){if(Si===null)throw Error(s(459));var t=Si;return Si=null,t}function wp(t){if(t===ls||t===Do)throw Error(s(483))}var cs=null,na=0;function Ro(t){var n=na;return na+=1,cs===null&&(cs=[]),_p(cs,t,n)}function ra(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Oo(t,n){throw n.$$typeof===v?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function Cp(t){function n(se,ne){if(t){var ae=se.deletions;ae===null?(se.deletions=[ne],se.flags|=16):ae.push(ne)}}function a(se,ne){if(!t)return null;for(;ne!==null;)n(se,ne),ne=ne.sibling;return null}function h(se){for(var ne=new Map;se!==null;)se.key!==null?ne.set(se.key,se):ne.set(se.index,se),se=se.sibling;return ne}function w(se,ne){return se=gr(se,ne),se.index=0,se.sibling=null,se}function k(se,ne,ae){return se.index=ae,t?(ae=se.alternate,ae!==null?(ae=ae.index,ae<ne?(se.flags|=67108866,ne):ae):(se.flags|=67108866,ne)):(se.flags|=1048576,ne)}function O(se){return t&&se.alternate===null&&(se.flags|=67108866),se}function G(se,ne,ae,ge){return ne===null||ne.tag!==6?(ne=Pc(ae,se.mode,ge),ne.return=se,ne):(ne=w(ne,ae),ne.return=se,ne)}function J(se,ne,ae,ge){var ze=ae.type;return ze===C?he(se,ne,ae.props.children,ge,ae.key):ne!==null&&(ne.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===T&&_i(ze)===ne.type)?(ne=w(ne,ae.props),ra(ne,ae),ne.return=se,ne):(ne=Eo(ae.type,ae.key,ae.props,null,se.mode,ge),ra(ne,ae),ne.return=se,ne)}function le(se,ne,ae,ge){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==ae.containerInfo||ne.stateNode.implementation!==ae.implementation?(ne=Fc(ae,se.mode,ge),ne.return=se,ne):(ne=w(ne,ae.children||[]),ne.return=se,ne)}function he(se,ne,ae,ge,ze){return ne===null||ne.tag!==7?(ne=gi(ae,se.mode,ge,ze),ne.return=se,ne):(ne=w(ne,ae),ne.return=se,ne)}function xe(se,ne,ae){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ne=Pc(""+ne,se.mode,ae),ne.return=se,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case _:return ae=Eo(ne.type,ne.key,ne.props,null,se.mode,ae),ra(ae,ne),ae.return=se,ae;case E:return ne=Fc(ne,se.mode,ae),ne.return=se,ne;case T:return ne=_i(ne),xe(se,ne,ae)}if(U(ne)||K(ne))return ne=gi(ne,se.mode,ae,null),ne.return=se,ne;if(typeof ne.then=="function")return xe(se,Ro(ne),ae);if(ne.$$typeof===S)return xe(se,To(se,ne),ae);Oo(se,ne)}return null}function ce(se,ne,ae,ge){var ze=ne!==null?ne.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return ze!==null?null:G(se,ne,""+ae,ge);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case _:return ae.key===ze?J(se,ne,ae,ge):null;case E:return ae.key===ze?le(se,ne,ae,ge):null;case T:return ae=_i(ae),ce(se,ne,ae,ge)}if(U(ae)||K(ae))return ze!==null?null:he(se,ne,ae,ge,null);if(typeof ae.then=="function")return ce(se,ne,Ro(ae),ge);if(ae.$$typeof===S)return ce(se,ne,To(se,ae),ge);Oo(se,ae)}return null}function de(se,ne,ae,ge,ze){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return se=se.get(ae)||null,G(ne,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(ne,se,ge,ze);case E:return se=se.get(ge.key===null?ae:ge.key)||null,le(ne,se,ge,ze);case T:return ge=_i(ge),de(se,ne,ae,ge,ze)}if(U(ge)||K(ge))return se=se.get(ae)||null,he(ne,se,ge,ze,null);if(typeof ge.then=="function")return de(se,ne,ae,Ro(ge),ze);if(ge.$$typeof===S)return de(se,ne,ae,To(ne,ge),ze);Oo(ne,ge)}return null}function De(se,ne,ae,ge){for(var ze=null,ct=null,Me=ne,Ye=ne=0,it=null;Me!==null&&Ye<ae.length;Ye++){Me.index>Ye?(it=Me,Me=null):it=Me.sibling;var ut=ce(se,Me,ae[Ye],ge);if(ut===null){Me===null&&(Me=it);break}t&&Me&&ut.alternate===null&&n(se,Me),ne=k(ut,ne,Ye),ct===null?ze=ut:ct.sibling=ut,ct=ut,Me=it}if(Ye===ae.length)return a(se,Me),st&&xr(se,Ye),ze;if(Me===null){for(;Ye<ae.length;Ye++)Me=xe(se,ae[Ye],ge),Me!==null&&(ne=k(Me,ne,Ye),ct===null?ze=Me:ct.sibling=Me,ct=Me);return st&&xr(se,Ye),ze}for(Me=h(Me);Ye<ae.length;Ye++)it=de(Me,se,Ye,ae[Ye],ge),it!==null&&(t&&it.alternate!==null&&Me.delete(it.key===null?Ye:it.key),ne=k(it,ne,Ye),ct===null?ze=it:ct.sibling=it,ct=it);return t&&Me.forEach(function(si){return n(se,si)}),st&&xr(se,Ye),ze}function Fe(se,ne,ae,ge){if(ae==null)throw Error(s(151));for(var ze=null,ct=null,Me=ne,Ye=ne=0,it=null,ut=ae.next();Me!==null&&!ut.done;Ye++,ut=ae.next()){Me.index>Ye?(it=Me,Me=null):it=Me.sibling;var si=ce(se,Me,ut.value,ge);if(si===null){Me===null&&(Me=it);break}t&&Me&&si.alternate===null&&n(se,Me),ne=k(si,ne,Ye),ct===null?ze=si:ct.sibling=si,ct=si,Me=it}if(ut.done)return a(se,Me),st&&xr(se,Ye),ze;if(Me===null){for(;!ut.done;Ye++,ut=ae.next())ut=xe(se,ut.value,ge),ut!==null&&(ne=k(ut,ne,Ye),ct===null?ze=ut:ct.sibling=ut,ct=ut);return st&&xr(se,Ye),ze}for(Me=h(Me);!ut.done;Ye++,ut=ae.next())ut=de(Me,se,Ye,ut.value,ge),ut!==null&&(t&&ut.alternate!==null&&Me.delete(ut.key===null?Ye:ut.key),ne=k(ut,ne,Ye),ct===null?ze=ut:ct.sibling=ut,ct=ut);return t&&Me.forEach(function(I1){return n(se,I1)}),st&&xr(se,Ye),ze}function xt(se,ne,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;ne!==null;){if(ne.key===ze){if(ze=ae.type,ze===C){if(ne.tag===7){a(se,ne.sibling),ge=w(ne,ae.props.children),ge.return=se,se=ge;break e}}else if(ne.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===T&&_i(ze)===ne.type){a(se,ne.sibling),ge=w(ne,ae.props),ra(ge,ae),ge.return=se,se=ge;break e}a(se,ne);break}else n(se,ne);ne=ne.sibling}ae.type===C?(ge=gi(ae.props.children,se.mode,ge,ae.key),ge.return=se,se=ge):(ge=Eo(ae.type,ae.key,ae.props,null,se.mode,ge),ra(ge,ae),ge.return=se,se=ge)}return O(se);case E:e:{for(ze=ae.key;ne!==null;){if(ne.key===ze)if(ne.tag===4&&ne.stateNode.containerInfo===ae.containerInfo&&ne.stateNode.implementation===ae.implementation){a(se,ne.sibling),ge=w(ne,ae.children||[]),ge.return=se,se=ge;break e}else{a(se,ne);break}else n(se,ne);ne=ne.sibling}ge=Fc(ae,se.mode,ge),ge.return=se,se=ge}return O(se);case T:return ae=_i(ae),xt(se,ne,ae,ge)}if(U(ae))return De(se,ne,ae,ge);if(K(ae)){if(ze=K(ae),typeof ze!="function")throw Error(s(150));return ae=ze.call(ae),Fe(se,ne,ae,ge)}if(typeof ae.then=="function")return xt(se,ne,Ro(ae),ge);if(ae.$$typeof===S)return xt(se,ne,To(se,ae),ge);Oo(se,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,ne!==null&&ne.tag===6?(a(se,ne.sibling),ge=w(ne,ae),ge.return=se,se=ge):(a(se,ne),ge=Pc(ae,se.mode,ge),ge.return=se,se=ge),O(se)):a(se,ne)}return function(se,ne,ae,ge){try{na=0;var ze=xt(se,ne,ae,ge);return cs=null,ze}catch(Me){if(Me===ls||Me===Do)throw Me;var ct=jn(29,Me,null,se.mode);return ct.lanes=ge,ct.return=se,ct}finally{}}}var wi=Cp(!0),kp=Cp(!1),Ur=!1;function Jc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eu(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 $r(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function qr(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=ko(t),lp(t,null,a),n}return Co(t,h,n,a),ko(t)}function ia(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,Fi(t,a)}}function tu(t,n){var a=t.updateQueue,h=t.alternate;if(h!==null&&(h=h.updateQueue,a===h)){var w=null,k=null;if(a=a.firstBaseUpdate,a!==null){do{var O={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};k===null?w=k=O:k=k.next=O,a=a.next}while(a!==null);k===null?w=k=n:k=k.next=n}else w=k=n;a={baseState:h.baseState,firstBaseUpdate:w,lastBaseUpdate:k,shared:h.shared,callbacks:h.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var nu=!1;function sa(){if(nu){var t=os;if(t!==null)throw t}}function aa(t,n,a,h){nu=!1;var w=t.updateQueue;Ur=!1;var k=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?k=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(k!==null){var xe=w.baseState;O=0,he=le=J=null,G=k;do{var ce=G.lane&-536870913,de=ce!==G.lane;if(de?(rt&ce)===ce:(h&ce)===ce){ce!==0&&ce===as&&(nu=!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:Ur=!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,k===null&&(w.shared.lanes=0),Yr|=O,t.lanes=O,t.memoizedState=xe}}function Ep(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function jp(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)Ep(a[t],n)}var us=I(null),Mo=I(0);function Np(t,n){t=Nr,F(Mo,t),F(us,n),Nr=t|n.baseLanes}function ru(){F(Mo,Nr),F(us,us.current)}function iu(){Nr=Mo.current,V(us),V(Mo)}var Nn=I(null),Wn=null;function Wr(t){var n=t.alternate;F(It,It.current&1),F(Nn,t),Wn===null&&(n===null||us.current!==null||n.memoizedState!==null)&&(Wn=t)}function su(t){F(It,It.current),F(Nn,t),Wn===null&&(Wn=t)}function Tp(t){t.tag===22?(F(It,It.current),F(Nn,t),Wn===null&&(Wn=t)):Gr()}function Gr(){F(It,It.current),F(Nn,Nn.current)}function Tn(t){V(Nn),Wn===t&&(Wn=null),V(It)}var It=I(0);function Io(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||dd(a)||hd(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 yr=0,Ke=null,mt=null,Pt=null,Bo=!1,ds=!1,Ci=!1,zo=0,oa=0,hs=null,E_=0;function Dt(){throw Error(s(321))}function au(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 ou(t,n,a,h,w,k){return yr=k,Ke=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,M.H=t===null||t.memoizedState===null?hm:Su,Ci=!1,k=a(h,w),Ci=!1,ds&&(k=Dp(n,a,h,w)),Ap(t),k}function Ap(t){M.H=ua;var n=mt!==null&&mt.next!==null;if(yr=0,Pt=mt=Ke=null,Bo=!1,oa=0,hs=null,n)throw Error(s(300));t===null||Ft||(t=t.dependencies,t!==null&&No(t)&&(Ft=!0))}function Dp(t,n,a,h){Ke=t;var w=0;do{if(ds&&(hs=null),oa=0,ds=!1,25<=w)throw Error(s(301));if(w+=1,Pt=mt=null,t.updateQueue!=null){var k=t.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}M.H=fm,k=n(a,h)}while(ds);return k}function j_(){var t=M.H,n=t.useState()[0];return n=typeof n.then=="function"?la(n):n,t=t.useState()[0],(mt!==null?mt.memoizedState:null)!==t&&(Ke.flags|=1024),n}function lu(){var t=zo!==0;return zo=0,t}function cu(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function uu(t){if(Bo){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Bo=!1}yr=0,Pt=mt=Ke=null,ds=!1,oa=zo=0,hs=null}function pn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?Ke.memoizedState=Pt=t:Pt=Pt.next=t,Pt}function Bt(){if(mt===null){var t=Ke.alternate;t=t!==null?t.memoizedState:null}else t=mt.next;var n=Pt===null?Ke.memoizedState:Pt.next;if(n!==null)Pt=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},Pt===null?Ke.memoizedState=Pt=t:Pt=Pt.next=t}return Pt}function Ho(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function la(t){var n=oa;return oa+=1,hs===null&&(hs=[]),t=_p(hs,t,n),n=Ke,(Pt===null?n.memoizedState:Pt.next)===null&&(n=n.alternate,M.H=n===null||n.memoizedState===null?hm:Su),t}function Po(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return la(t);if(t.$$typeof===S)return rn(t)}throw Error(s(438,String(t)))}function du(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=Ho(),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 _r(t,n){return typeof n=="function"?n(t):n}function Fo(t){var n=Bt();return hu(n,mt,t)}function hu(t,n,a){var h=t.queue;if(h===null)throw Error(s(311));h.lastRenderedReducer=a;var w=t.baseQueue,k=h.pending;if(k!==null){if(w!==null){var O=w.next;w.next=k.next,k.next=O}n.baseQueue=w=k,h.pending=null}if(k=t.baseState,w===null)t.memoizedState=k;else{n=w.next;var G=O=null,J=null,le=n,he=!1;do{var xe=le.lane&-536870913;if(xe!==le.lane?(rt&xe)===xe:(yr&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===as&&(he=!0);else if((yr&ce)===ce){le=le.next,ce===as&&(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=k):J=J.next=xe,Ke.lanes|=ce,Yr|=ce;xe=le.action,Ci&&a(k,xe),k=le.hasEagerState?le.eagerState:a(k,xe)}else ce={lane:xe,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(G=J=ce,O=k):J=J.next=ce,Ke.lanes|=xe,Yr|=xe;le=le.next}while(le!==null&&le!==n);if(J===null?O=k:J.next=G,!En(k,t.memoizedState)&&(Ft=!0,he&&(a=os,a!==null)))throw a;t.memoizedState=k,t.baseState=O,t.baseQueue=J,h.lastRenderedState=k}return w===null&&(h.lanes=0),[t.memoizedState,h.dispatch]}function fu(t){var n=Bt(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var h=a.dispatch,w=a.pending,k=n.memoizedState;if(w!==null){a.pending=null;var O=w=w.next;do k=t(k,O.action),O=O.next;while(O!==w);En(k,n.memoizedState)||(Ft=!0),n.memoizedState=k,n.baseQueue===null&&(n.baseState=k),a.lastRenderedState=k}return[k,h]}function Lp(t,n,a){var h=Ke,w=Bt(),k=st;if(k){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,Ft=!0),w=w.queue,gu(Mp.bind(null,h,w,t),[t]),w.getSnapshot!==n||O||Pt!==null&&Pt.memoizedState.tag&1){if(h.flags|=2048,fs(9,{destroy:void 0},Op.bind(null,h,w,a,n),null),vt===null)throw Error(s(349));k||(yr&127)!==0||Rp(h,n,a)}return a}function Rp(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=Ke.updateQueue,n===null?(n=Ho(),Ke.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function Op(t,n,a,h){n.value=a,n.getSnapshot=h,Ip(n)&&Bp(t)}function Mp(t,n,a){return a(function(){Ip(n)&&Bp(t)})}function Ip(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!En(t,a)}catch{return!0}}function Bp(t){var n=mi(t,2);n!==null&&wn(n,t,2)}function pu(t){var n=pn();if(typeof t=="function"){var a=t;if(t=a(),Ci){Yt(!0);try{a()}finally{Yt(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_r,lastRenderedState:t},n}function zp(t,n,a,h){return t.baseState=a,hu(t,mt,typeof h=="function"?h:_r)}function N_(t,n,a,h,w){if(qo(t))throw Error(s(485));if(t=n.action,t!==null){var k={payload:w,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){k.listeners.push(O)}};M.T!==null?a(!0):k.isTransition=!1,h(k),a=n.pending,a===null?(k.next=n.pending=k,Hp(n,k)):(k.next=a.next,n.pending=a.next=k)}}function Hp(t,n){var a=n.action,h=n.payload,w=t.state;if(n.isTransition){var k=M.T,O={};M.T=O;try{var G=a(w,h),J=M.S;J!==null&&J(O,G),Pp(t,n,G)}catch(le){mu(t,n,le)}finally{k!==null&&O.types!==null&&(k.types=O.types),M.T=k}}else try{k=a(w,h),Pp(t,n,k)}catch(le){mu(t,n,le)}}function Pp(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(h){Fp(t,n,h)},function(h){return mu(t,n,h)}):Fp(t,n,a)}function Fp(t,n,a){n.status="fulfilled",n.value=a,Up(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,Hp(t,a)))}function mu(t,n,a){var h=t.pending;if(t.pending=null,h!==null){h=h.next;do n.status="rejected",n.reason=a,Up(n),n=n.next;while(n!==h)}t.action=null}function Up(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function $p(t,n){return n}function qp(t,n){if(st){var a=vt.formState;if(a!==null){e:{var h=Ke;if(st){if(_t){t:{for(var w=_t,k=qn;w.nodeType!==8;){if(!k){w=null;break t}if(w=Gn(w.nextSibling),w===null){w=null;break t}}k=w.data,w=k==="F!"||k==="F"?w:null}if(w){_t=Gn(w.nextSibling),h=w.data==="F!";break e}}Pr(h)}h=!1}h&&(n=a[0])}}return a=pn(),a.memoizedState=a.baseState=n,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$p,lastRenderedState:n},a.queue=h,a=cm.bind(null,Ke,h),h.dispatch=a,h=pu(!1),k=_u.bind(null,Ke,!1,h.queue),h=pn(),w={state:n,dispatch:null,action:t,pending:null},h.queue=w,a=N_.bind(null,Ke,w,k,a),w.dispatch=a,h.memoizedState=t,[n,a,!1]}function Wp(t){var n=Bt();return Gp(n,mt,t)}function Gp(t,n,a){if(n=hu(t,n,$p)[0],t=Fo(_r)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var h=la(n)}catch(O){throw O===ls?Do:O}else h=n;n=Bt();var w=n.queue,k=w.dispatch;return a!==n.memoizedState&&(Ke.flags|=2048,fs(9,{destroy:void 0},T_.bind(null,w,a),null)),[h,k,t]}function T_(t,n){t.action=n}function Vp(t){var n=Bt(),a=mt;if(a!==null)return Gp(n,a,t);Bt(),n=n.memoizedState,a=Bt();var h=a.queue.dispatch;return a.memoizedState=t,[n,h,!1]}function fs(t,n,a,h){return t={tag:t,create:a,deps:h,inst:n,next:null},n=Ke.updateQueue,n===null&&(n=Ho(),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 Kp(){return Bt().memoizedState}function Uo(t,n,a,h){var w=pn();Ke.flags|=t,w.memoizedState=fs(1|n,{destroy:void 0},a,h===void 0?null:h)}function $o(t,n,a,h){var w=Bt();h=h===void 0?null:h;var k=w.memoizedState.inst;mt!==null&&h!==null&&au(h,mt.memoizedState.deps)?w.memoizedState=fs(n,k,a,h):(Ke.flags|=t,w.memoizedState=fs(1|n,k,a,h))}function Yp(t,n){Uo(8390656,8,t,n)}function gu(t,n){$o(2048,8,t,n)}function A_(t){Ke.flags|=4;var n=Ke.updateQueue;if(n===null)n=Ho(),Ke.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Xp(t){var n=Bt().memoizedState;return A_({ref:n,nextImpl:t}),function(){if((dt&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Zp(t,n){return $o(4,2,t,n)}function Qp(t,n){return $o(4,4,t,n)}function Jp(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 em(t,n,a){a=a!=null?a.concat([t]):null,$o(4,4,Jp.bind(null,n,t),a)}function xu(){}function tm(t,n){var a=Bt();n=n===void 0?null:n;var h=a.memoizedState;return n!==null&&au(n,h[1])?h[0]:(a.memoizedState=[t,n],t)}function nm(t,n){var a=Bt();n=n===void 0?null:n;var h=a.memoizedState;if(n!==null&&au(n,h[1]))return h[0];if(h=t(),Ci){Yt(!0);try{t()}finally{Yt(!1)}}return a.memoizedState=[h,n],h}function vu(t,n,a){return a===void 0||(yr&1073741824)!==0&&(rt&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=rg(),Ke.lanes|=t,Yr|=t,a)}function rm(t,n,a,h){return En(a,n)?a:us.current!==null?(t=vu(t,a,h),En(t,n)||(Ft=!0),t):(yr&42)===0||(yr&1073741824)!==0&&(rt&261930)===0?(Ft=!0,t.memoizedState=a):(t=rg(),Ke.lanes|=t,Yr|=t,n)}function im(t,n,a,h,w){var k=Y.p;Y.p=k!==0&&8>k?k:8;var O=M.T,G={};M.T=G,_u(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=k_(J,h);ca(t,n,he,Ln(t))}else ca(t,n,h,Ln(t))}catch(xe){ca(t,n,{then:function(){},status:"rejected",reason:xe},Ln())}finally{Y.p=k,O!==null&&G.types!==null&&(O.types=G.types),M.T=O}}function D_(){}function bu(t,n,a,h){if(t.tag!==5)throw Error(s(476));var w=sm(t).queue;im(t,w,n,Z,a===null?D_:function(){return am(t),a(h)})}function sm(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:_r,lastRenderedState:Z},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_r,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function am(t){var n=sm(t);n.next===null&&(n=t.alternate.memoizedState),ca(t,n.next.queue,{},Ln())}function yu(){return rn(Ea)}function om(){return Bt().memoizedState}function lm(){return Bt().memoizedState}function L_(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=Ln();t=$r(a);var h=qr(n,t,a);h!==null&&(wn(h,n,a),ia(h,n,a)),n={cache:Yc()},t.payload=n;return}n=n.return}}function R_(t,n,a){var h=Ln();a={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},qo(t)?um(n,a):(a=zc(t,n,a,h),a!==null&&(wn(a,t,h),dm(a,n,h)))}function cm(t,n,a){var h=Ln();ca(t,n,a,h)}function ca(t,n,a,h){var w={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(qo(t))um(n,w);else{var k=t.alternate;if(t.lanes===0&&(k===null||k.lanes===0)&&(k=n.lastRenderedReducer,k!==null))try{var O=n.lastRenderedState,G=k(O,a);if(w.hasEagerState=!0,w.eagerState=G,En(G,O))return Co(t,n,w,0),vt===null&&wo(),!1}catch{}finally{}if(a=zc(t,n,w,h),a!==null)return wn(a,t,h),dm(a,n,h),!0}return!1}function _u(t,n,a,h){if(h={lane:2,revertLane:Ju(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},qo(t)){if(n)throw Error(s(479))}else n=zc(t,a,h,2),n!==null&&wn(n,t,2)}function qo(t){var n=t.alternate;return t===Ke||n!==null&&n===Ke}function um(t,n){ds=Bo=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function dm(t,n,a){if((a&4194048)!==0){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,Fi(t,a)}}var ua={readContext:rn,use:Po,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};ua.useEffectEvent=Dt;var hm={readContext:rn,use:Po,useCallback:function(t,n){return pn().memoizedState=[t,n===void 0?null:n],t},useContext:rn,useEffect:Yp,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Uo(4194308,4,Jp.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Uo(4194308,4,t,n)},useInsertionEffect:function(t,n){Uo(4,2,t,n)},useMemo:function(t,n){var a=pn();n=n===void 0?null:n;var h=t();if(Ci){Yt(!0);try{t()}finally{Yt(!1)}}return a.memoizedState=[h,n],h},useReducer:function(t,n,a){var h=pn();if(a!==void 0){var w=a(n);if(Ci){Yt(!0);try{a(n)}finally{Yt(!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=R_.bind(null,Ke,t),[h.memoizedState,t]},useRef:function(t){var n=pn();return t={current:t},n.memoizedState=t},useState:function(t){t=pu(t);var n=t.queue,a=cm.bind(null,Ke,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:xu,useDeferredValue:function(t,n){var a=pn();return vu(a,t,n)},useTransition:function(){var t=pu(!1);return t=im.bind(null,Ke,t.queue,!0,!1),pn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var h=Ke,w=pn();if(st){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),vt===null)throw Error(s(349));(rt&127)!==0||Rp(h,n,a)}w.memoizedState=a;var k={value:a,getSnapshot:n};return w.queue=k,Yp(Mp.bind(null,h,k,t),[t]),h.flags|=2048,fs(9,{destroy:void 0},Op.bind(null,h,k,a,n),null),a},useId:function(){var t=pn(),n=vt.identifierPrefix;if(st){var a=rr,h=nr;a=(h&~(1<<32-lt(h)-1)).toString(32)+a,n="_"+n+"R_"+a,a=zo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=E_++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:yu,useFormState:qp,useActionState:qp,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=_u.bind(null,Ke,!0,a),a.dispatch=n,[t,n]},useMemoCache:du,useCacheRefresh:function(){return pn().memoizedState=L_.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)}}},Su={readContext:rn,use:Po,useCallback:tm,useContext:rn,useEffect:gu,useImperativeHandle:em,useInsertionEffect:Zp,useLayoutEffect:Qp,useMemo:nm,useReducer:Fo,useRef:Kp,useState:function(){return Fo(_r)},useDebugValue:xu,useDeferredValue:function(t,n){var a=Bt();return rm(a,mt.memoizedState,t,n)},useTransition:function(){var t=Fo(_r)[0],n=Bt().memoizedState;return[typeof t=="boolean"?t:la(t),n]},useSyncExternalStore:Lp,useId:om,useHostTransitionStatus:yu,useFormState:Wp,useActionState:Wp,useOptimistic:function(t,n){var a=Bt();return zp(a,mt,t,n)},useMemoCache:du,useCacheRefresh:lm};Su.useEffectEvent=Xp;var fm={readContext:rn,use:Po,useCallback:tm,useContext:rn,useEffect:gu,useImperativeHandle:em,useInsertionEffect:Zp,useLayoutEffect:Qp,useMemo:nm,useReducer:fu,useRef:Kp,useState:function(){return fu(_r)},useDebugValue:xu,useDeferredValue:function(t,n){var a=Bt();return mt===null?vu(a,t,n):rm(a,mt.memoizedState,t,n)},useTransition:function(){var t=fu(_r)[0],n=Bt().memoizedState;return[typeof t=="boolean"?t:la(t),n]},useSyncExternalStore:Lp,useId:om,useHostTransitionStatus:yu,useFormState:Vp,useActionState:Vp,useOptimistic:function(t,n){var a=Bt();return mt!==null?zp(a,mt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:du,useCacheRefresh:lm};fm.useEffectEvent=Xp;function wu(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 Cu={enqueueSetState:function(t,n,a){t=t._reactInternals;var h=Ln(),w=$r(h);w.payload=n,a!=null&&(w.callback=a),n=qr(t,w,h),n!==null&&(wn(n,t,h),ia(n,t,h))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var h=Ln(),w=$r(h);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=qr(t,w,h),n!==null&&(wn(n,t,h),ia(n,t,h))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=Ln(),h=$r(a);h.tag=2,n!=null&&(h.callback=n),n=qr(t,h,a),n!==null&&(wn(n,t,a),ia(n,t,a))}};function pm(t,n,a,h,w,k,O){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(h,k,O):n.prototype&&n.prototype.isPureReactComponent?!Xs(a,h)||!Xs(w,k):!0}function mm(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&&Cu.enqueueReplaceState(n,n.state,null)}function ki(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 gm(t){So(t)}function xm(t){console.error(t)}function vm(t){So(t)}function Wo(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(h){setTimeout(function(){throw h})}}function bm(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 ku(t,n,a){return a=$r(a),a.tag=3,a.payload={element:null},a.callback=function(){Wo(t,n)},a}function ym(t){return t=$r(t),t.tag=3,t}function _m(t,n,a,h){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var k=h.value;t.payload=function(){return w(k)},t.callback=function(){bm(n,a,h)}}var O=a.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(t.callback=function(){bm(n,a,h),typeof w!="function"&&(Xr===null?Xr=new Set([this]):Xr.add(this));var G=h.stack;this.componentDidCatch(h.value,{componentStack:G!==null?G:""})})}function O_(t,n,a,h,w){if(a.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(n=a.alternate,n!==null&&ss(n,a,w,!0),a=Nn.current,a!==null){switch(a.tag){case 31:case 13:return Wn===null?rl():a.alternate===null&&Lt===0&&(Lt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,h===Lo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([h]):n.add(h),Xu(t,h,w)),!1;case 22:return a.flags|=65536,h===Lo?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)),Xu(t,h,w)),!1}throw Error(s(435,a.tag))}return Xu(t,h,w),rl(),!1}if(st)return n=Nn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,h!==qc&&(t=Error(s(422),{cause:h}),Js(Fn(t,a)))):(h!==qc&&(n=Error(s(423),{cause:h}),Js(Fn(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,h=Fn(h,a),w=ku(t.stateNode,h,w),tu(t,w),Lt!==4&&(Lt=2)),!1;var k=Error(s(520),{cause:h});if(k=Fn(k,a),va===null?va=[k]:va.push(k),Lt!==4&&(Lt=2),n===null)return!0;h=Fn(h,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=ku(a.stateNode,h,t),tu(a,t),!1;case 1:if(n=a.type,k=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Xr===null||!Xr.has(k))))return a.flags|=65536,w&=-w,a.lanes|=w,w=ym(w),_m(w,t,a,h),tu(a,w),!1}a=a.return}while(a!==null);return!1}var Eu=Error(s(461)),Ft=!1;function sn(t,n,a,h){n.child=t===null?kp(n,null,a,h):wi(n,t.child,a,h)}function Sm(t,n,a,h,w){a=a.render;var k=n.ref;if("ref"in h){var O={};for(var G in h)G!=="ref"&&(O[G]=h[G])}else O=h;return bi(n),h=ou(t,n,a,O,k,w),G=lu(),t!==null&&!Ft?(cu(t,n,w),Sr(t,n,w)):(st&&G&&Uc(n),n.flags|=1,sn(t,n,h,w),n.child)}function wm(t,n,a,h,w){if(t===null){var k=a.type;return typeof k=="function"&&!Hc(k)&&k.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=k,Cm(t,n,k,h,w)):(t=Eo(a.type,null,h,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(k=t.child,!Ou(t,w)){var O=k.memoizedProps;if(a=a.compare,a=a!==null?a:Xs,a(O,h)&&t.ref===n.ref)return Sr(t,n,w)}return n.flags|=1,t=gr(k,h),t.ref=n.ref,t.return=n,n.child=t}function Cm(t,n,a,h,w){if(t!==null){var k=t.memoizedProps;if(Xs(k,h)&&t.ref===n.ref)if(Ft=!1,n.pendingProps=h=k,Ou(t,w))(t.flags&131072)!==0&&(Ft=!0);else return n.lanes=t.lanes,Sr(t,n,w)}return ju(t,n,a,h,w)}function km(t,n,a,h){var w=h.children,k=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((n.flags&128)!==0){if(k=k!==null?k.baseLanes|a:a,t!==null){for(h=n.child=t.child,w=0;h!==null;)w=w|h.lanes|h.childLanes,h=h.sibling;h=w&~k}else h=0,n.child=null;return Em(t,n,k,a,h)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Ao(n,k!==null?k.cachePool:null),k!==null?Np(n,k):ru(),Tp(n);else return h=n.lanes=536870912,Em(t,n,k!==null?k.baseLanes|a:a,a,h)}else k!==null?(Ao(n,k.cachePool),Np(n,k),Gr(),n.memoizedState=null):(t!==null&&Ao(n,null),ru(),Gr());return sn(t,n,w,a),n.child}function da(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Em(t,n,a,h,w){var k=Zc();return k=k===null?null:{parent:Ht._currentValue,pool:k},n.memoizedState={baseLanes:a,cachePool:k},t!==null&&Ao(n,null),ru(),Tp(n),t!==null&&ss(t,n,h,!0),n.childLanes=w,null}function Go(t,n){return n=Ko({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function jm(t,n,a){return wi(n,t.child,null,a),t=Go(n,n.pendingProps),t.flags|=2,Tn(n),n.memoizedState=null,t}function M_(t,n,a){var h=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(st){if(h.mode==="hidden")return t=Go(n,h),n.lanes=536870912,da(null,t);if(su(n),(t=_t)?(t=Hg(t,qn),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:zr!==null?{id:nr,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},a=up(t),a.return=n,n.child=a,nn=n,_t=null)):t=null,t===null)throw Pr(n);return n.lanes=536870912,null}return Go(n,h)}var k=t.memoizedState;if(k!==null){var O=k.dehydrated;if(su(n),w)if(n.flags&256)n.flags&=-257,n=jm(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(Ft||ss(t,n,a,!1),w=(a&t.childLanes)!==0,Ft||w){if(h=vt,h!==null&&(O=Mr(h,a),O!==0&&O!==k.retryLane))throw k.retryLane=O,mi(t,O),wn(h,t,O),Eu;rl(),n=jm(t,n,a)}else t=k.treeContext,_t=Gn(O.nextSibling),nn=n,st=!0,Hr=null,qn=!1,t!==null&&fp(n,t),n=Go(n,h),n.flags|=4096;return n}return t=gr(t.child,{mode:h.mode,children:h.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Vo(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 ju(t,n,a,h,w){return bi(n),a=ou(t,n,a,h,void 0,w),h=lu(),t!==null&&!Ft?(cu(t,n,w),Sr(t,n,w)):(st&&h&&Uc(n),n.flags|=1,sn(t,n,a,w),n.child)}function Nm(t,n,a,h,w,k){return bi(n),n.updateQueue=null,a=Dp(n,h,a,w),Ap(t),h=lu(),t!==null&&!Ft?(cu(t,n,k),Sr(t,n,k)):(st&&h&&Uc(n),n.flags|=1,sn(t,n,a,k),n.child)}function Tm(t,n,a,h,w){if(bi(n),n.stateNode===null){var k=ts,O=a.contextType;typeof O=="object"&&O!==null&&(k=rn(O)),k=new a(h,k),n.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=Cu,n.stateNode=k,k._reactInternals=n,k=n.stateNode,k.props=h,k.state=n.memoizedState,k.refs={},Jc(n),O=a.contextType,k.context=typeof O=="object"&&O!==null?rn(O):ts,k.state=n.memoizedState,O=a.getDerivedStateFromProps,typeof O=="function"&&(wu(n,a,O,h),k.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(O=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),O!==k.state&&Cu.enqueueReplaceState(k,k.state,null),aa(n,h,k,w),sa(),k.state=n.memoizedState),typeof k.componentDidMount=="function"&&(n.flags|=4194308),h=!0}else if(t===null){k=n.stateNode;var G=n.memoizedProps,J=ki(a,G);k.props=J;var le=k.context,he=a.contextType;O=ts,typeof he=="object"&&he!==null&&(O=rn(he));var xe=a.getDerivedStateFromProps;he=typeof xe=="function"||typeof k.getSnapshotBeforeUpdate=="function",G=n.pendingProps!==G,he||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(G||le!==O)&&mm(n,k,h,O),Ur=!1;var ce=n.memoizedState;k.state=ce,aa(n,h,k,w),sa(),le=n.memoizedState,G||ce!==le||Ur?(typeof xe=="function"&&(wu(n,a,xe,h),le=n.memoizedState),(J=Ur||pm(n,a,J,h,ce,le,O))?(he||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(n.flags|=4194308)):(typeof k.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=h,n.memoizedState=le),k.props=h,k.state=le,k.context=O,h=J):(typeof k.componentDidMount=="function"&&(n.flags|=4194308),h=!1)}else{k=n.stateNode,eu(t,n),O=n.memoizedProps,he=ki(a,O),k.props=he,xe=n.pendingProps,ce=k.context,le=a.contextType,J=ts,typeof le=="object"&&le!==null&&(J=rn(le)),G=a.getDerivedStateFromProps,(le=typeof G=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(O!==xe||ce!==J)&&mm(n,k,h,J),Ur=!1,ce=n.memoizedState,k.state=ce,aa(n,h,k,w),sa();var de=n.memoizedState;O!==xe||ce!==de||Ur||t!==null&&t.dependencies!==null&&No(t.dependencies)?(typeof G=="function"&&(wu(n,a,G,h),de=n.memoizedState),(he=Ur||pm(n,a,he,h,ce,de,J)||t!==null&&t.dependencies!==null&&No(t.dependencies))?(le||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(h,de,J),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(h,de,J)),typeof k.componentDidUpdate=="function"&&(n.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof k.componentDidUpdate!="function"||O===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||O===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),n.memoizedProps=h,n.memoizedState=de),k.props=h,k.state=de,k.context=J,h=he):(typeof k.componentDidUpdate!="function"||O===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||O===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),h=!1)}return k=h,Vo(t,n),h=(n.flags&128)!==0,k||h?(k=n.stateNode,a=h&&typeof a.getDerivedStateFromError!="function"?null:k.render(),n.flags|=1,t!==null&&h?(n.child=wi(n,t.child,null,w),n.child=wi(n,null,a,w)):sn(t,n,a,w),n.memoizedState=k.state,t=n.child):t=Sr(t,n,w),t}function Am(t,n,a,h){return xi(),n.flags|=256,sn(t,n,a,h),n.child}var Nu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Tu(t){return{baseLanes:t,cachePool:bp()}}function Au(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=Dn),t}function Dm(t,n,a){var h=n.pendingProps,w=!1,k=(n.flags&128)!==0,O;if((O=k)||(O=t!==null&&t.memoizedState===null?!1:(It.current&2)!==0),O&&(w=!0,n.flags&=-129),O=(n.flags&32)!==0,n.flags&=-33,t===null){if(st){if(w?Wr(n):Gr(),(t=_t)?(t=Hg(t,qn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:zr!==null?{id:nr,overflow:rr}:null,retryLane:536870912,hydrationErrors:null},a=up(t),a.return=n,n.child=a,nn=n,_t=null)):t=null,t===null)throw Pr(n);return hd(t)?n.lanes=32:n.lanes=536870912,null}var G=h.children;return h=h.fallback,w?(Gr(),w=n.mode,G=Ko({mode:"hidden",children:G},w),h=gi(h,w,a,null),G.return=n,h.return=n,G.sibling=h,n.child=G,h=n.child,h.memoizedState=Tu(a),h.childLanes=Au(t,O,a),n.memoizedState=Nu,da(null,h)):(Wr(n),Du(n,G))}var J=t.memoizedState;if(J!==null&&(G=J.dehydrated,G!==null)){if(k)n.flags&256?(Wr(n),n.flags&=-257,n=Lu(t,n,a)):n.memoizedState!==null?(Gr(),n.child=t.child,n.flags|=128,n=null):(Gr(),G=h.fallback,w=n.mode,h=Ko({mode:"visible",children:h.children},w),G=gi(G,w,a,null),G.flags|=2,h.return=n,G.return=n,h.sibling=G,n.child=h,wi(n,t.child,null,a),h=n.child,h.memoizedState=Tu(a),h.childLanes=Au(t,O,a),n.memoizedState=Nu,n=da(null,h));else if(Wr(n),hd(G)){if(O=G.nextSibling&&G.nextSibling.dataset,O)var le=O.dgst;O=le,h=Error(s(419)),h.stack="",h.digest=O,Js({value:h,source:null,stack:null}),n=Lu(t,n,a)}else if(Ft||ss(t,n,a,!1),O=(a&t.childLanes)!==0,Ft||O){if(O=vt,O!==null&&(h=Mr(O,a),h!==0&&h!==J.retryLane))throw J.retryLane=h,mi(t,h),wn(O,t,h),Eu;dd(G)||rl(),n=Lu(t,n,a)}else dd(G)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,_t=Gn(G.nextSibling),nn=n,st=!0,Hr=null,qn=!1,t!==null&&fp(n,t),n=Du(n,h.children),n.flags|=4096);return n}return w?(Gr(),G=h.fallback,w=n.mode,J=t.child,le=J.sibling,h=gr(J,{mode:"hidden",children:h.children}),h.subtreeFlags=J.subtreeFlags&65011712,le!==null?G=gr(le,G):(G=gi(G,w,a,null),G.flags|=2),G.return=n,h.return=n,h.sibling=G,n.child=h,da(null,h),h=n.child,G=t.child.memoizedState,G===null?G=Tu(a):(w=G.cachePool,w!==null?(J=Ht._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=bp(),G={baseLanes:G.baseLanes|a,cachePool:w}),h.memoizedState=G,h.childLanes=Au(t,O,a),n.memoizedState=Nu,da(t.child,h)):(Wr(n),a=t.child,t=a.sibling,a=gr(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 Du(t,n){return n=Ko({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Ko(t,n){return t=jn(22,t,null,n),t.lanes=0,t}function Lu(t,n,a){return wi(n,t.child,null,a),t=Du(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Lm(t,n,a){t.lanes|=n;var h=t.alternate;h!==null&&(h.lanes|=n),Vc(t.return,n,a)}function Ru(t,n,a,h,w,k){var O=t.memoizedState;O===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:h,tail:a,tailMode:w,treeForkCount:k}:(O.isBackwards=n,O.rendering=null,O.renderingStartTime=0,O.last=h,O.tail=a,O.tailMode=w,O.treeForkCount=k)}function Rm(t,n,a){var h=n.pendingProps,w=h.revealOrder,k=h.tail;h=h.children;var O=It.current,G=(O&2)!==0;if(G?(O=O&1|2,n.flags|=128):O&=1,F(It,O),sn(t,n,h,a),h=st?Qs:0,!G&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Lm(t,a,n);else if(t.tag===19)Lm(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&&Io(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),Ru(n,!1,w,a,k,h);break;case"backwards":case"unstable_legacy-backwards":for(a=null,w=n.child,n.child=null;w!==null;){if(t=w.alternate,t!==null&&Io(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}Ru(n,!0,a,null,k,h);break;case"together":Ru(n,!1,null,null,void 0,h);break;default:n.memoizedState=null}return n.child}function Sr(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),Yr|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(ss(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=gr(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=gr(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function Ou(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&No(t)))}function I_(t,n,a){switch(n.tag){case 3:$(n,n.stateNode.containerInfo),Fr(n,Ht,t.memoizedState.cache),xi();break;case 27:case 5:re(n);break;case 4:$(n,n.stateNode.containerInfo);break;case 10:Fr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,su(n),null;break;case 13:var h=n.memoizedState;if(h!==null)return h.dehydrated!==null?(Wr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Dm(t,n,a):(Wr(n),t=Sr(t,n,a),t!==null?t.sibling:null);Wr(n);break;case 19:var w=(t.flags&128)!==0;if(h=(a&n.childLanes)!==0,h||(ss(t,n,a,!1),h=(a&n.childLanes)!==0),w){if(h)return Rm(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),F(It,It.current),h)break;return null;case 22:return n.lanes=0,km(t,n,a,n.pendingProps);case 24:Fr(n,Ht,t.memoizedState.cache)}return Sr(t,n,a)}function Om(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)Ft=!0;else{if(!Ou(t,a)&&(n.flags&128)===0)return Ft=!1,I_(t,n,a);Ft=(t.flags&131072)!==0}else Ft=!1,st&&(n.flags&1048576)!==0&&hp(n,Qs,n.index);switch(n.lanes=0,n.tag){case 16:e:{var h=n.pendingProps;if(t=_i(n.elementType),n.type=t,typeof t=="function")Hc(t)?(h=ki(t,h),n.tag=1,n=Tm(null,n,t,h,a)):(n.tag=0,n=ju(null,n,t,h,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=Sm(null,n,t,h,a);break e}else if(w===D){n.tag=14,n=wm(null,n,t,h,a);break e}}throw n=R(t)||t,Error(s(306,n,""))}}return n;case 0:return ju(t,n,n.type,n.pendingProps,a);case 1:return h=n.type,w=ki(h,n.pendingProps),Tm(t,n,h,w,a);case 3:e:{if($(n,n.stateNode.containerInfo),t===null)throw Error(s(387));h=n.pendingProps;var k=n.memoizedState;w=k.element,eu(t,n),aa(n,h,null,a);var O=n.memoizedState;if(h=O.cache,Fr(n,Ht,h),h!==k.cache&&Kc(n,[Ht],a,!0),sa(),h=O.element,k.isDehydrated)if(k={element:h,isDehydrated:!1,cache:O.cache},n.updateQueue.baseState=k,n.memoizedState=k,n.flags&256){n=Am(t,n,h,a);break e}else if(h!==w){w=Fn(Error(s(424)),n),Js(w),n=Am(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=Gn(t.firstChild),nn=n,st=!0,Hr=null,qn=!0,a=kp(n,null,h,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(xi(),h===w){n=Sr(t,n,a);break e}sn(t,n,h,a)}n=n.child}return n;case 26:return Vo(t,n),t===null?(a=Wg(n.type,null,n.pendingProps,null))?n.memoizedState=a:st||(a=n.type,t=n.pendingProps,h=ul(ee.current).createElement(a),h[tn]=n,h[xn]=t,an(h,a,t),Zt(h),n.stateNode=h):n.memoizedState=Wg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return re(n),t===null&&st&&(h=n.stateNode=Ug(n.type,n.pendingProps,ee.current),nn=n,qn=!0,w=_t,ei(n.type)?(fd=w,_t=Gn(h.firstChild)):_t=w),sn(t,n,n.pendingProps.children,a),Vo(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&st&&((w=h=_t)&&(h=h1(h,n.type,n.pendingProps,qn),h!==null?(n.stateNode=h,nn=n,_t=Gn(h.firstChild),qn=!1,w=!0):w=!1),w||Pr(n)),re(n),w=n.type,k=n.pendingProps,O=t!==null?t.memoizedProps:null,h=k.children,ld(w,k)?h=null:O!==null&&ld(w,O)&&(n.flags|=32),n.memoizedState!==null&&(w=ou(t,n,j_,null,null,a),Ea._currentValue=w),Vo(t,n),sn(t,n,h,a),n.child;case 6:return t===null&&st&&((t=a=_t)&&(a=f1(a,n.pendingProps,qn),a!==null?(n.stateNode=a,nn=n,_t=null,t=!0):t=!1),t||Pr(n)),null;case 13:return Dm(t,n,a);case 4:return $(n,n.stateNode.containerInfo),h=n.pendingProps,t===null?n.child=wi(n,null,h,a):sn(t,n,h,a),n.child;case 11:return Sm(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,Fr(n,n.type,h.value),sn(t,n,h.children,a),n.child;case 9:return w=n.type._context,h=n.pendingProps.children,bi(n),w=rn(w),h=h(w),n.flags|=1,sn(t,n,h,a),n.child;case 14:return wm(t,n,n.type,n.pendingProps,a);case 15:return Cm(t,n,n.type,n.pendingProps,a);case 19:return Rm(t,n,a);case 31:return M_(t,n,a);case 22:return km(t,n,a,n.pendingProps);case 24:return bi(n),h=rn(Ht),t===null?(w=Zc(),w===null&&(w=vt,k=Yc(),w.pooledCache=k,k.refCount++,k!==null&&(w.pooledCacheLanes|=a),w=k),n.memoizedState={parent:h,cache:w},Jc(n),Fr(n,Ht,w)):((t.lanes&a)!==0&&(eu(t,n),aa(n,null,null,a),sa()),w=t.memoizedState,k=n.memoizedState,w.parent!==h?(w={parent:h,cache:h},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),Fr(n,Ht,h)):(h=k.cache,Fr(n,Ht,h),h!==w.cache&&Kc(n,[Ht],a,!0))),sn(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function wr(t){t.flags|=4}function Mu(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(og())t.flags|=8192;else throw Si=Lo,Qc}else t.flags&=-16777217}function Mm(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Xg(n))if(og())t.flags|=8192;else throw Si=Lo,Qc}function Yo(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?Re():536870912,t.lanes|=n,xs|=n)}function ha(t,n){if(!st)switch(t.tailMode){case"hidden":n=t.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var h=null;a!==null;)a.alternate!==null&&(h=a),a=a.sibling;h===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:h.sibling=null}}function 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 B_(t,n,a){var h=n.pendingProps;switch($c(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),br(Ht),oe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(is(n)?wr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Wc())),St(n),null;case 26:var w=n.type,k=n.memoizedState;return t===null?(wr(n),k!==null?(St(n),Mm(n,k)):(St(n),Mu(n,w,null,h,a))):k?k!==t.memoizedState?(wr(n),St(n),Mm(n,k)):(St(n),n.flags&=-16777217):(t=t.memoizedProps,t!==h&&wr(n),St(n),Mu(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&&wr(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return St(n),null}t=ie.current,is(n)?pp(n):(t=Ug(w,h,a),n.stateNode=t,wr(n))}return St(n),null;case 5:if(ve(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&wr(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return St(n),null}if(k=ie.current,is(n))pp(n);else{var O=ul(ee.current);switch(k){case 1:k=O.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:k=O.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":k=O.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":k=O.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":k=O.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof h.is=="string"?O.createElement("select",{is:h.is}):O.createElement("select"),h.multiple?k.multiple=!0:h.size&&(k.size=h.size);break;default:k=typeof h.is=="string"?O.createElement(w,{is:h.is}):O.createElement(w)}}k[tn]=n,k[xn]=h;e:for(O=n.child;O!==null;){if(O.tag===5||O.tag===6)k.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=k;e:switch(an(k,w,h),w){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&wr(n)}}return St(n),Mu(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==h&&wr(n);else{if(typeof h!="string"&&n.stateNode===null)throw Error(s(166));if(t=ee.current,is(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||Dg(t.nodeValue,a)),t||Pr(n,!0)}else t=ul(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=is(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 xi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),t=!1}else a=Wc(),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=is(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 xi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),w=!1}else w=Wc(),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),k=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(k=h.memoizedState.cachePool.pool),k!==w&&(h.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),Yo(n,n.updateQueue),St(n),null);case 4:return oe(),t===null&&rd(n.stateNode.containerInfo),St(n),null;case 10:return br(n.type),St(n),null;case 19:if(V(It),h=n.memoizedState,h===null)return St(n),null;if(w=(n.flags&128)!==0,k=h.rendering,k===null)if(w)ha(h,!1);else{if(Lt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(k=Io(t),k!==null){for(n.flags|=128,ha(h,!1),t=k.updateQueue,n.updateQueue=t,Yo(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)cp(a,t),a=a.sibling;return F(It,It.current&1|2),st&&xr(n,h.treeForkCount),n.child}t=t.sibling}h.tail!==null&&Be()>el&&(n.flags|=128,w=!0,ha(h,!1),n.lanes=4194304)}else{if(!w)if(t=Io(k),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,Yo(n,t),ha(h,!0),h.tail===null&&h.tailMode==="hidden"&&!k.alternate&&!st)return St(n),null}else 2*Be()-h.renderingStartTime>el&&a!==536870912&&(n.flags|=128,w=!0,ha(h,!1),n.lanes=4194304);h.isBackwards?(k.sibling=n.child,n.child=k):(t=h.last,t!==null?t.sibling=k:n.child=k,h.last=k)}return h.tail!==null?(t=h.tail,h.rendering=t,h.tail=t.sibling,h.renderingStartTime=Be(),t.sibling=null,a=It.current,F(It,w?a&1|2:a&1),st&&xr(n,h.treeForkCount),t):(St(n),null);case 22:case 23:return Tn(n),iu(),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&&Yo(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(yi),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),br(Ht),St(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function z_(t,n){switch($c(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return br(Ht),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));xi()}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));xi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return V(It),null;case 4:return oe(),null;case 10:return br(n.type),null;case 22:case 23:return Tn(n),iu(),t!==null&&V(yi),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return br(Ht),null;case 25:return null;default:return null}}function Im(t,n){switch($c(n),n.tag){case 3:br(Ht),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(It);break;case 10:br(n.type);break;case 22:case 23:Tn(n),iu(),t!==null&&V(yi);break;case 24:br(Ht)}}function fa(t,n){try{var a=n.updateQueue,h=a!==null?a.lastEffect:null;if(h!==null){var w=h.next;a=w;do{if((a.tag&t)===t){h=void 0;var k=a.create,O=a.inst;h=k(),O.destroy=h}a=a.next}while(a!==w)}}catch(G){ft(n,n.return,G)}}function Vr(t,n,a){try{var h=n.updateQueue,w=h!==null?h.lastEffect:null;if(w!==null){var k=w.next;h=k;do{if((h.tag&t)===t){var 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!==k)}}catch(he){ft(n,n.return,he)}}function Bm(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{jp(n,a)}catch(h){ft(t,t.return,h)}}}function zm(t,n,a){a.props=ki(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(h){ft(t,n,h)}}function pa(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 ir(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 Hm(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 Iu(t,n,a){try{var h=t.stateNode;a1(h,t.type,a,n),h[xn]=n}catch(w){ft(t,t.return,w)}}function Pm(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ei(t.type)||t.tag===4}function Bu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Pm(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&&ei(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 zu(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=pr));else if(h!==4&&(h===27&&ei(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(zu(t,n,a),t=t.sibling;t!==null;)zu(t,n,a),t=t.sibling}function Xo(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&&ei(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Xo(t,n,a),t=t.sibling;t!==null;)Xo(t,n,a),t=t.sibling}function Fm(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[xn]=a}catch(k){ft(t,t.return,k)}}var Cr=!1,Ut=!1,Hu=!1,Um=typeof WeakSet=="function"?WeakSet:Set,Qt=null;function H_(t,n){if(t=t.containerInfo,ad=xl,t=ep(t),Lc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var h=a.getSelection&&a.getSelection();if(h&&h.rangeCount!==0){a=h.anchorNode;var w=h.anchorOffset,k=h.focusNode;h=h.focusOffset;try{a.nodeType,k.nodeType}catch{a=null;break e}var 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!==k||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===k&&++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(od={focusedElem:t,selectionRange:a},xl=!1,Qt=n;Qt!==null;)if(n=Qt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Qt=t;else for(;Qt!==null;){switch(n=Qt,k=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)w=t[a],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&k!==null){t=void 0,a=n,w=k.memoizedProps,k=k.memoizedState,h=a.stateNode;try{var De=ki(a.type,w);t=h.getSnapshotBeforeUpdate(De,k),h.__reactInternalSnapshotBeforeUpdate=t}catch(Fe){ft(a,a.return,Fe)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)ud(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":ud(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,Qt=t;break}Qt=n.return}}function $m(t,n,a){var h=a.flags;switch(a.tag){case 0:case 11:case 15:Er(t,a),h&4&&fa(5,a);break;case 1:if(Er(t,a),h&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(O){ft(a,a.return,O)}else{var w=ki(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(O){ft(a,a.return,O)}}h&64&&Bm(a),h&512&&pa(a,a.return);break;case 3:if(Er(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{jp(t,n)}catch(O){ft(a,a.return,O)}}break;case 27:n===null&&h&4&&Fm(a);case 26:case 5:Er(t,a),n===null&&h&4&&Hm(a),h&512&&pa(a,a.return);break;case 12:Er(t,a);break;case 31:Er(t,a),h&4&&Gm(t,a);break;case 13:Er(t,a),h&4&&Vm(t,a),h&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=K_.bind(null,a),p1(t,a))));break;case 22:if(h=a.memoizedState!==null||Cr,!h){n=n!==null&&n.memoizedState!==null||Ut,w=Cr;var k=Ut;Cr=h,(Ut=n)&&!k?jr(t,a,(a.subtreeFlags&8772)!==0):Er(t,a),Cr=w,Ut=k}break;case 30:break;default:Er(t,a)}}function qm(t){var n=t.alternate;n!==null&&(t.alternate=null,qm(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&mc(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,bn=!1;function kr(t,n,a){for(a=a.child;a!==null;)Wm(t,n,a),a=a.sibling}function Wm(t,n,a){if(Tt&&typeof Tt.onCommitFiberUnmount=="function")try{Tt.onCommitFiberUnmount(Ot,a)}catch{}switch(a.tag){case 26:Ut||ir(a,n),kr(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ut||ir(a,n);var h=wt,w=bn;ei(a.type)&&(wt=a.stateNode,bn=!1),kr(t,n,a),wa(a.stateNode),wt=h,bn=w;break;case 5:Ut||ir(a,n);case 6:if(h=wt,w=bn,wt=null,kr(t,n,a),wt=h,bn=w,wt!==null)if(bn)try{(wt.nodeType===9?wt.body:wt.nodeName==="HTML"?wt.ownerDocument.body:wt).removeChild(a.stateNode)}catch(k){ft(a,n,k)}else try{wt.removeChild(a.stateNode)}catch(k){ft(a,n,k)}break;case 18:wt!==null&&(bn?(t=wt,Bg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),ks(t)):Bg(wt,a.stateNode));break;case 4:h=wt,w=bn,wt=a.stateNode.containerInfo,bn=!0,kr(t,n,a),wt=h,bn=w;break;case 0:case 11:case 14:case 15:Vr(2,a,n),Ut||Vr(4,a,n),kr(t,n,a);break;case 1:Ut||(ir(a,n),h=a.stateNode,typeof h.componentWillUnmount=="function"&&zm(a,n,h)),kr(t,n,a);break;case 21:kr(t,n,a);break;case 22:Ut=(h=Ut)||a.memoizedState!==null,kr(t,n,a),Ut=h;break;default:kr(t,n,a)}}function Gm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ks(t)}catch(a){ft(n,n.return,a)}}}function Vm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ks(t)}catch(a){ft(n,n.return,a)}}function P_(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Um),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Um),n;default:throw Error(s(435,t.tag))}}function Zo(t,n){var a=P_(t);n.forEach(function(h){if(!a.has(h)){a.add(h);var w=Y_.bind(null,t,h);h.then(w,w)}})}function yn(t,n){var a=n.deletions;if(a!==null)for(var h=0;h<a.length;h++){var w=a[h],k=t,O=n,G=O;e:for(;G!==null;){switch(G.tag){case 27:if(ei(G.type)){wt=G.stateNode,bn=!1;break e}break;case 5:wt=G.stateNode,bn=!1;break e;case 3:case 4:wt=G.stateNode.containerInfo,bn=!0;break e}G=G.return}if(wt===null)throw Error(s(160));Wm(k,O,w),wt=null,bn=!1,k=w.alternate,k!==null&&(k.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Km(n,t),n=n.sibling}var Zn=null;function Km(t,n){var a=t.alternate,h=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:yn(n,t),_n(t),h&4&&(Vr(3,t,t.return),fa(3,t),Vr(5,t,t.return));break;case 1:yn(n,t),_n(t),h&512&&(Ut||a===null||ir(a,a.return)),h&64&&Cr&&(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=Zn;if(yn(n,t),_n(t),h&512&&(Ut||a===null||ir(a,a.return)),h&4){var k=a!==null?a.memoizedState:null;if(h=t.memoizedState,a===null)if(h===null)if(t.stateNode===null){e:{h=t.type,a=t.memoizedProps,w=w.ownerDocument||w;t:switch(h){case"title":k=w.getElementsByTagName("title")[0],(!k||k[Fs]||k[tn]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=w.createElement(h),w.head.insertBefore(k,w.querySelector("head > title"))),an(k,h,a),k[tn]=t,Zt(k),h=k;break e;case"link":var O=Kg("link","href",w).get(h+(a.href||""));if(O){for(var G=0;G<O.length;G++)if(k=O[G],k.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&k.getAttribute("rel")===(a.rel==null?null:a.rel)&&k.getAttribute("title")===(a.title==null?null:a.title)&&k.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){O.splice(G,1);break t}}k=w.createElement(h),an(k,h,a),w.head.appendChild(k);break;case"meta":if(O=Kg("meta","content",w).get(h+(a.content||""))){for(G=0;G<O.length;G++)if(k=O[G],k.getAttribute("content")===(a.content==null?null:""+a.content)&&k.getAttribute("name")===(a.name==null?null:a.name)&&k.getAttribute("property")===(a.property==null?null:a.property)&&k.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&k.getAttribute("charset")===(a.charSet==null?null:a.charSet)){O.splice(G,1);break t}}k=w.createElement(h),an(k,h,a),w.head.appendChild(k);break;default:throw Error(s(468,h))}k[tn]=t,Zt(k),h=k}t.stateNode=h}else Yg(w,t.type,t.stateNode);else t.stateNode=Vg(w,h,t.memoizedProps);else k!==h?(k===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):k.count--,h===null?Yg(w,t.type,t.stateNode):Vg(w,h,t.memoizedProps)):h===null&&t.stateNode!==null&&Iu(t,t.memoizedProps,a.memoizedProps)}break;case 27:yn(n,t),_n(t),h&512&&(Ut||a===null||ir(a,a.return)),a!==null&&h&4&&Iu(t,t.memoizedProps,a.memoizedProps);break;case 5:if(yn(n,t),_n(t),h&512&&(Ut||a===null||ir(a,a.return)),t.flags&32){w=t.stateNode;try{Ki(w,"")}catch(De){ft(t,t.return,De)}}h&4&&t.stateNode!=null&&(w=t.memoizedProps,Iu(t,w,a!==null?a.memoizedProps:w)),h&1024&&(Hu=!0);break;case 6:if(yn(n,t),_n(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(fl=null,w=Zn,Zn=dl(n.containerInfo),yn(n,t),Zn=w,_n(t),h&4&&a!==null&&a.memoizedState.isDehydrated)try{ks(n.containerInfo)}catch(De){ft(t,t.return,De)}Hu&&(Hu=!1,Ym(t));break;case 4:h=Zn,Zn=dl(t.stateNode.containerInfo),yn(n,t),_n(t),Zn=h;break;case 12:yn(n,t),_n(t);break;case 31:yn(n,t),_n(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Zo(t,h)));break;case 13:yn(n,t),_n(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Jo=Be()),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Zo(t,h)));break;case 22:w=t.memoizedState!==null;var J=a!==null&&a.memoizedState!==null,le=Cr,he=Ut;if(Cr=le||w,Ut=he||J,yn(n,t),Ut=he,Cr=le,_n(t),h&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||J||Cr||Ut||Ei(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(k=J.stateNode,w)O=k.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?zg(de,!0):zg(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,Zo(t,a))));break;case 19:yn(n,t),_n(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Zo(t,h)));break;case 30:break;case 21:break;default:yn(n,t),_n(t)}}function _n(t){var n=t.flags;if(n&2){try{for(var a,h=t.return;h!==null;){if(Pm(h)){a=h;break}h=h.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var w=a.stateNode,k=Bu(t);Xo(t,k,w);break;case 5:var O=a.stateNode;a.flags&32&&(Ki(O,""),a.flags&=-33);var G=Bu(t);Xo(t,G,O);break;case 3:case 4:var J=a.stateNode.containerInfo,le=Bu(t);zu(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 Ym(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Ym(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function Er(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)$m(t,n.alternate,n),n=n.sibling}function Ei(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Vr(4,n,n.return),Ei(n);break;case 1:ir(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&zm(n,n.return,a),Ei(n);break;case 27:wa(n.stateNode);case 26:case 5:ir(n,n.return),Ei(n);break;case 22:n.memoizedState===null&&Ei(n);break;case 30:Ei(n);break;default:Ei(n)}t=t.sibling}}function jr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var h=n.alternate,w=t,k=n,O=k.flags;switch(k.tag){case 0:case 11:case 15:jr(w,k,a),fa(4,k);break;case 1:if(jr(w,k,a),h=k,w=h.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(le){ft(h,h.return,le)}if(h=k,w=h.updateQueue,w!==null){var G=h.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)Ep(J[w],G)}catch(le){ft(h,h.return,le)}}a&&O&64&&Bm(k),pa(k,k.return);break;case 27:Fm(k);case 26:case 5:jr(w,k,a),a&&h===null&&O&4&&Hm(k),pa(k,k.return);break;case 12:jr(w,k,a);break;case 31:jr(w,k,a),a&&O&4&&Gm(w,k);break;case 13:jr(w,k,a),a&&O&4&&Vm(w,k);break;case 22:k.memoizedState===null&&jr(w,k,a),pa(k,k.return);break;case 30:break;default:jr(w,k,a)}n=n.sibling}}function Pu(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&&ea(a))}function Fu(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&ea(t))}function Qn(t,n,a,h){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Xm(t,n,a,h),n=n.sibling}function Xm(t,n,a,h){var w=n.flags;switch(n.tag){case 0:case 11:case 15:Qn(t,n,a,h),w&2048&&fa(9,n);break;case 1:Qn(t,n,a,h);break;case 3:Qn(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&&ea(t)));break;case 12:if(w&2048){Qn(t,n,a,h),t=n.stateNode;try{var k=n.memoizedProps,O=k.id,G=k.onPostCommit;typeof G=="function"&&G(O,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(J){ft(n,n.return,J)}}else Qn(t,n,a,h);break;case 31:Qn(t,n,a,h);break;case 13:Qn(t,n,a,h);break;case 23:break;case 22:k=n.stateNode,O=n.alternate,n.memoizedState!==null?k._visibility&2?Qn(t,n,a,h):ma(t,n):k._visibility&2?Qn(t,n,a,h):(k._visibility|=2,ps(t,n,a,h,(n.subtreeFlags&10256)!==0||!1)),w&2048&&Pu(O,n);break;case 24:Qn(t,n,a,h),w&2048&&Fu(n.alternate,n);break;default:Qn(t,n,a,h)}}function ps(t,n,a,h,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var k=t,O=n,G=a,J=h,le=O.flags;switch(O.tag){case 0:case 11:case 15:ps(k,O,G,J,w),fa(8,O);break;case 23:break;case 22:var he=O.stateNode;O.memoizedState!==null?he._visibility&2?ps(k,O,G,J,w):ma(k,O):(he._visibility|=2,ps(k,O,G,J,w)),w&&le&2048&&Pu(O.alternate,O);break;case 24:ps(k,O,G,J,w),w&&le&2048&&Fu(O.alternate,O);break;default:ps(k,O,G,J,w)}n=n.sibling}}function ma(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:ma(a,h),w&2048&&Pu(h.alternate,h);break;case 24:ma(a,h),w&2048&&Fu(h.alternate,h);break;default:ma(a,h)}n=n.sibling}}var ga=8192;function ms(t,n,a){if(t.subtreeFlags&ga)for(t=t.child;t!==null;)Zm(t,n,a),t=t.sibling}function Zm(t,n,a){switch(t.tag){case 26:ms(t,n,a),t.flags&ga&&t.memoizedState!==null&&E1(a,Zn,t.memoizedState,t.memoizedProps);break;case 5:ms(t,n,a);break;case 3:case 4:var h=Zn;Zn=dl(t.stateNode.containerInfo),ms(t,n,a),Zn=h;break;case 22:t.memoizedState===null&&(h=t.alternate,h!==null&&h.memoizedState!==null?(h=ga,ga=16777216,ms(t,n,a),ga=h):ms(t,n,a));break;default:ms(t,n,a)}}function Qm(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 xa(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];Qt=h,eg(h,t)}Qm(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Jm(t),t=t.sibling}function Jm(t){switch(t.tag){case 0:case 11:case 15:xa(t),t.flags&2048&&Vr(9,t,t.return);break;case 3:xa(t);break;case 12:xa(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Qo(t)):xa(t);break;default:xa(t)}}function Qo(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];Qt=h,eg(h,t)}Qm(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Vr(8,n,n.return),Qo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Qo(n));break;default:Qo(n)}t=t.sibling}}function eg(t,n){for(;Qt!==null;){var a=Qt;switch(a.tag){case 0:case 11:case 15:Vr(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:ea(a.memoizedState.cache)}if(h=a.child,h!==null)h.return=a,Qt=h;else e:for(a=t;Qt!==null;){h=Qt;var w=h.sibling,k=h.return;if(qm(h),h===a){Qt=null;break e}if(w!==null){w.return=k,Qt=w;break e}Qt=k}}}var F_={getCacheForType:function(t){var n=rn(Ht),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return rn(Ht).controller.signal}},U_=typeof WeakMap=="function"?WeakMap:Map,dt=0,vt=null,Je=null,rt=0,ht=0,An=null,Kr=!1,gs=!1,Uu=!1,Nr=0,Lt=0,Yr=0,ji=0,$u=0,Dn=0,xs=0,va=null,Sn=null,qu=!1,Jo=0,tg=0,el=1/0,tl=null,Xr=null,Gt=0,Zr=null,vs=null,Tr=0,Wu=0,Gu=null,ng=null,ba=0,Vu=null;function Ln(){return(dt&2)!==0&&rt!==0?rt&-rt:M.T!==null?Ju():vf()}function rg(){if(Dn===0)if((rt&536870912)===0||st){var t=ye;ye<<=1,(ye&3932160)===0&&(ye=262144),Dn=t}else Dn=536870912;return t=Nn.current,t!==null&&(t.flags|=32),Dn}function wn(t,n,a){(t===vt&&(ht===2||ht===9)||t.cancelPendingCommit!==null)&&(bs(t,0),Qr(t,rt,Dn,!1)),Mt(t,a),((dt&2)===0||t!==vt)&&(t===vt&&((dt&2)===0&&(ji|=a),Lt===4&&Qr(t,rt,Dn,!1)),sr(t))}function ig(t,n,a){if((dt&6)!==0)throw Error(s(327));var h=!a&&(n&127)===0&&(n&t.expiredLanes)===0||te(t,n),w=h?W_(t,n):Yu(t,n,!0),k=h;do{if(w===0){gs&&!h&&Qr(t,n,0,!1);break}else{if(a=t.current.alternate,k&&!$_(a)){w=Yu(t,n,!1),k=!1;continue}if(w===2){if(k=n,t.errorRecoveryDisabledLanes&k)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=va;var J=G.current.memoizedState.isDehydrated;if(J&&(bs(G,O).flags|=256),O=Yu(G,O,!1),O!==2){if(Uu&&!J){G.errorRecoveryDisabledLanes|=k,ji|=k,w=4;break e}k=Sn,Sn=w,k!==null&&(Sn===null?Sn=k:Sn.push.apply(Sn,k))}w=O}if(k=!1,w!==2)continue}}if(w===1){bs(t,0),Qr(t,n,0,!0);break}e:{switch(h=t,k=w,k){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Qr(h,n,Dn,!Kr);break e;case 2:Sn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(w=Jo+300-Be(),10<w)){if(Qr(h,n,Dn,!Kr),Qe(h,0,!0)!==0)break e;Tr=n,h.timeoutHandle=Mg(sg.bind(null,h,a,Sn,tl,qu,n,Dn,ji,xs,Kr,k,"Throttled",-0,0),w);break e}sg(h,a,Sn,tl,qu,n,Dn,ji,xs,Kr,k,null,-0,0)}}break}while(!0);sr(t)}function sg(t,n,a,h,w,k,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:pr},Zm(n,k,xe);var De=(k&62914560)===k?Jo-Be():(k&4194048)===k?tg-Be():0;if(De=j1(xe,De),De!==null){Tr=k,t.cancelPendingCommit=De(fg.bind(null,t,n,k,a,h,w,O,G,J,he,xe,null,ce,de)),Qr(t,k,O,!le);return}}fg(t,n,k,a,h,w,O,G,J)}function $_(t){for(var n=t;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var h=0;h<a.length;h++){var w=a[h],k=w.getSnapshot;w=w.value;try{if(!En(k(),w))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Qr(t,n,a,h){n&=~$u,n&=~ji,t.suspendedLanes|=n,t.pingedLanes&=~n,h&&(t.warmLanes|=n),h=t.expirationTimes;for(var w=n;0<w;){var k=31-lt(w),O=1<<k;h[k]=-1,w&=~O}a!==0&&hr(t,a,n)}function nl(){return(dt&6)===0?(ya(0),!1):!0}function Ku(){if(Je!==null){if(ht===0)var t=Je.return;else t=Je,vr=vi=null,uu(t),cs=null,na=0,t=Je;for(;t!==null;)Im(t.alternate,t),t=t.return;Je=null}}function bs(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,c1(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Tr=0,Ku(),vt=t,Je=a=gr(t.current,null),rt=n,ht=0,An=null,Kr=!1,gs=te(t,n),Uu=!1,xs=Dn=$u=ji=Yr=Lt=0,Sn=va=null,qu=!1,(n&8)!==0&&(n|=n&32);var h=t.entangledLanes;if(h!==0)for(t=t.entanglements,h&=n;0<h;){var w=31-lt(h),k=1<<w;n|=t[w],h&=~k}return Nr=n,wo(),a}function ag(t,n){Ke=null,M.H=ua,n===ls||n===Do?(n=Sp(),ht=3):n===Qc?(n=Sp(),ht=4):ht=n===Eu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,An=n,Je===null&&(Lt=1,Wo(t,Fn(n,t.current)))}function og(){var t=Nn.current;return t===null?!0:(rt&4194048)===rt?Wn===null:(rt&62914560)===rt||(rt&536870912)!==0?t===Wn:!1}function lg(){var t=M.H;return M.H=ua,t===null?ua:t}function cg(){var t=M.A;return M.A=F_,t}function rl(){Lt=4,Kr||(rt&4194048)!==rt&&Nn.current!==null||(gs=!0),(Yr&134217727)===0&&(ji&134217727)===0||vt===null||Qr(vt,rt,Dn,!1)}function Yu(t,n,a){var h=dt;dt|=2;var w=lg(),k=cg();(vt!==t||rt!==n)&&(tl=null,bs(t,n)),n=!1;var O=Lt;e:do try{if(ht!==0&&Je!==null){var G=Je,J=An;switch(ht){case 8:Ku(),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,ys(t,G,J,le),a&&gs){O=0;break e}break;default:le=ht,ht=0,An=null,ys(t,G,J,le)}}q_(),O=Lt;break}catch(he){ag(t,he)}while(!0);return n&&t.shellSuspendCounter++,vr=vi=null,dt=h,M.H=w,M.A=k,Je===null&&(vt=null,rt=0,wo()),O}function q_(){for(;Je!==null;)ug(Je)}function W_(t,n){var a=dt;dt|=2;var h=lg(),w=cg();vt!==t||rt!==n?(tl=null,el=Be()+500,bs(t,n)):gs=te(t,n);e:do try{if(ht!==0&&Je!==null){n=Je;var k=An;t:switch(ht){case 1:ht=0,An=null,ys(t,n,k,1);break;case 2:case 9:if(yp(k)){ht=0,An=null,dg(n);break}n=function(){ht!==2&&ht!==9||vt!==t||(ht=7),sr(t)},k.then(n,n);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:yp(k)?(ht=0,An=null,dg(n)):(ht=0,An=null,ys(t,n,k,7));break;case 5:var O=null;switch(Je.tag){case 26:O=Je.memoizedState;case 5:case 27:var G=Je;if(O?Xg(O):G.stateNode.complete){ht=0,An=null;var J=G.sibling;if(J!==null)Je=J;else{var le=G.return;le!==null?(Je=le,il(le)):Je=null}break t}}ht=0,An=null,ys(t,n,k,5);break;case 6:ht=0,An=null,ys(t,n,k,6);break;case 8:Ku(),Lt=6;break e;default:throw Error(s(462))}}G_();break}catch(he){ag(t,he)}while(!0);return vr=vi=null,M.H=h,M.A=w,dt=a,Je!==null?0:(vt=null,rt=0,wo(),Lt)}function G_(){for(;Je!==null&&!fe();)ug(Je)}function ug(t){var n=Om(t.alternate,t,Nr);t.memoizedProps=t.pendingProps,n===null?il(t):Je=n}function dg(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=Nm(a,n,n.pendingProps,n.type,void 0,rt);break;case 11:n=Nm(a,n,n.pendingProps,n.type.render,n.ref,rt);break;case 5:uu(n);default:Im(a,n),n=Je=cp(n,Nr),n=Om(a,n,Nr)}t.memoizedProps=t.pendingProps,n===null?il(t):Je=n}function ys(t,n,a,h){vr=vi=null,uu(n),cs=null,na=0;var w=n.return;try{if(O_(t,w,n,a,rt)){Lt=1,Wo(t,Fn(a,t.current)),Je=null;return}}catch(k){if(w!==null)throw Je=w,k;Lt=1,Wo(t,Fn(a,t.current)),Je=null;return}n.flags&32768?(st||h===1?t=!0:gs||(rt&536870912)!==0?t=!1:(Kr=t=!0,(h===2||h===9||h===3||h===6)&&(h=Nn.current,h!==null&&h.tag===13&&(h.flags|=16384))),hg(n,t)):il(n)}function il(t){var n=t;do{if((n.flags&32768)!==0){hg(n,Kr);return}t=n.return;var a=B_(n.alternate,n,Nr);if(a!==null){Je=a;return}if(n=n.sibling,n!==null){Je=n;return}Je=n=t}while(n!==null);Lt===0&&(Lt=5)}function hg(t,n){do{var a=z_(t.alternate,t);if(a!==null){a.flags&=32767,Je=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Je=t;return}Je=t=a}while(t!==null);Lt=6,Je=null}function fg(t,n,a,h,w,k,O,G,J){t.cancelPendingCommit=null;do sl();while(Gt!==0);if((dt&6)!==0)throw Error(s(327));if(n!==null){if(n===t.current)throw Error(s(177));if(k=n.lanes|n.childLanes,k|=Bc,gn(t,a,k,O,G,J),t===vt&&(Je=vt=null,rt=0),vs=n,Zr=t,Tr=a,Wu=k,Gu=w,ng=h,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,X_(Ne,function(){return vg(),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{H_(t,n,a)}finally{dt=O,Y.p=w,M.T=h}}Gt=1,pg(),mg(),gg()}}function pg(){if(Gt===1){Gt=0;var t=Zr,n=vs,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{Km(n,t);var k=od,O=ep(t.containerInfo),G=k.focusedElem,J=k.selectionRange;if(O!==G&&G&&G.ownerDocument&&Jf(G.ownerDocument.documentElement,G)){if(J!==null&&Lc(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=Qf(G,Fe),ne=Qf(G,xt);if(se&&ne&&(de.rangeCount!==1||de.anchorNode!==se.node||de.anchorOffset!==se.offset||de.focusNode!==ne.node||de.focusOffset!==ne.offset)){var ae=xe.createRange();ae.setStart(se.node,se.offset),de.removeAllRanges(),Fe>xt?(de.addRange(ae),de.extend(ne.node,ne.offset)):(ae.setEnd(ne.node,ne.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}}xl=!!ad,od=ad=null}finally{dt=w,Y.p=h,M.T=a}}t.current=n,Gt=2}}function mg(){if(Gt===2){Gt=0;var t=Zr,n=vs,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{$m(t,n.alternate,n)}finally{dt=w,Y.p=h,M.T=a}}Gt=3}}function gg(){if(Gt===4||Gt===3){Gt=0,Ae();var t=Zr,n=vs,a=Tr,h=ng;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Gt=5:(Gt=0,vs=Zr=null,xg(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&(Xr=null),fc(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 k=t.onRecoverableError,O=0;O<h.length;O++){var G=h[O];k(G.value,{componentStack:G.stack})}}finally{M.T=n,Y.p=w}}(Tr&3)!==0&&sl(),sr(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===Vu?ba++:(ba=0,Vu=t):ba=0,ya(0)}}function xg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,ea(n)))}function sl(){return pg(),mg(),gg(),vg()}function vg(){if(Gt!==5)return!1;var t=Zr,n=Wu;Wu=0;var a=fc(Tr),h=M.T,w=Y.p;try{Y.p=32>a?32:a,M.T=null,a=Gu,Gu=null;var k=Zr,O=Tr;if(Gt=0,vs=Zr=null,Tr=0,(dt&6)!==0)throw Error(s(331));var G=dt;if(dt|=4,Jm(k.current),Xm(k,k.current,O,a),dt=G,ya(0,!1),Tt&&typeof Tt.onPostCommitFiberRoot=="function")try{Tt.onPostCommitFiberRoot(Ot,k)}catch{}return!0}finally{Y.p=w,M.T=h,xg(t,n)}}function bg(t,n,a){n=Fn(a,n),n=ku(t.stateNode,n,2),t=qr(t,n,2),t!==null&&(Mt(t,2),sr(t))}function ft(t,n,a){if(t.tag===3)bg(t,t,a);else for(;n!==null;){if(n.tag===3){bg(n,t,a);break}else if(n.tag===1){var h=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Xr===null||!Xr.has(h))){t=Fn(a,t),a=ym(2),h=qr(n,a,2),h!==null&&(_m(a,h,n,t),Mt(h,2),sr(h));break}}n=n.return}}function Xu(t,n,a){var h=t.pingCache;if(h===null){h=t.pingCache=new U_;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)||(Uu=!0,w.add(a),t=V_.bind(null,t,n,a),n.then(t,t))}function V_(t,n,a){var h=t.pingCache;h!==null&&h.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,vt===t&&(rt&a)===a&&(Lt===4||Lt===3&&(rt&62914560)===rt&&300>Be()-Jo?(dt&2)===0&&bs(t,0):$u|=a,xs===rt&&(xs=0)),sr(t)}function yg(t,n){n===0&&(n=Re()),t=mi(t,n),t!==null&&(Mt(t,n),sr(t))}function K_(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),yg(t,a)}function Y_(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),yg(t,a)}function X_(t,n){return $e(t,n)}var al=null,_s=null,Zu=!1,ol=!1,Qu=!1,Jr=0;function sr(t){t!==_s&&t.next===null&&(_s===null?al=_s=t:_s=_s.next=t),ol=!0,Zu||(Zu=!0,Q_())}function ya(t,n){if(!Qu&&ol){Qu=!0;do for(var a=!1,h=al;h!==null;){if(t!==0){var w=h.pendingLanes;if(w===0)var k=0;else{var O=h.suspendedLanes,G=h.pingedLanes;k=(1<<31-lt(42|t)+1)-1,k&=w&~(O&~G),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(a=!0,Cg(h,k))}else k=rt,k=Qe(h,h===vt?k:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(k&3)===0||te(h,k)||(a=!0,Cg(h,k));h=h.next}while(a);Qu=!1}}function Z_(){_g()}function _g(){ol=Zu=!1;var t=0;Jr!==0&&l1()&&(t=Jr);for(var n=Be(),a=null,h=al;h!==null;){var w=h.next,k=Sg(h,n);k===0?(h.next=null,a===null?al=w:a.next=w,w===null&&(_s=a)):(a=h,(t!==0||(k&3)!==0)&&(ol=!0)),h=w}Gt!==0&&Gt!==5||ya(t),Jr!==0&&(Jr=0)}function Sg(t,n){for(var a=t.suspendedLanes,h=t.pingedLanes,w=t.expirationTimes,k=t.pendingLanes&-62914561;0<k;){var O=31-lt(k),G=1<<O,J=w[O];J===-1?((G&a)===0||(G&h)!==0)&&(w[O]=Ee(G,n)):J<=n&&(t.expiredLanes|=G),k&=~G}if(n=vt,a=rt,a=Qe(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h=t.callbackNode,a===0||t===n&&(ht===2||ht===9)||t.cancelPendingCommit!==null)return h!==null&&h!==null&&Rt(h),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||te(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(h!==null&&Rt(h),fc(a)){case 2:case 8:a=_e;break;case 32:a=Ne;break;case 268435456:a=qe;break;default:a=Ne}return h=wg.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 wg(t,n){if(Gt!==0&&Gt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(sl()&&t.callbackNode!==a)return null;var h=rt;return h=Qe(t,t===vt?h:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h===0?null:(ig(t,h,n),Sg(t,Be()),t.callbackNode!=null&&t.callbackNode===a?wg.bind(null,t):null)}function Cg(t,n){if(sl())return null;ig(t,n,!0)}function Q_(){u1(function(){(dt&6)!==0?$e(ue,Z_):_g()})}function Ju(){if(Jr===0){var t=as;t===0&&(t=pe,pe<<=1,(pe&261888)===0&&(pe=256)),Jr=t}return Jr}function kg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:mo(""+t)}function Eg(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 J_(t,n,a,h,w){if(n==="submit"&&a&&a.stateNode===w){var k=kg((w[xn]||null).action),O=h.submitter;O&&(n=(n=O[xn]||null)?kg(n.formAction):O.getAttribute("formAction"),n!==null&&(k=n,O=null));var G=new bo("action","action",null,h,w);t.push({event:G,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Jr!==0){var J=O?Eg(w,O):new FormData(w);bu(a,{pending:!0,data:J,method:w.method,action:k},null,J)}}else typeof k=="function"&&(G.preventDefault(),J=O?Eg(w,O):new FormData(w),bu(a,{pending:!0,data:J,method:w.method,action:k},k,J))},currentTarget:w}]})}}for(var ed=0;ed<Ic.length;ed++){var td=Ic[ed],e1=td.toLowerCase(),t1=td[0].toUpperCase()+td.slice(1);Xn(e1,"on"+t1)}Xn(rp,"onAnimationEnd"),Xn(ip,"onAnimationIteration"),Xn(sp,"onAnimationStart"),Xn("dblclick","onDoubleClick"),Xn("focusin","onFocus"),Xn("focusout","onBlur"),Xn(x_,"onTransitionRun"),Xn(v_,"onTransitionStart"),Xn(b_,"onTransitionCancel"),Xn(ap,"onTransitionEnd"),Gi("onMouseEnter",["mouseout","mouseover"]),Gi("onMouseLeave",["mouseout","mouseover"]),Gi("onPointerEnter",["pointerout","pointerover"]),Gi("onPointerLeave",["pointerout","pointerover"]),di("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),di("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),di("onBeforeInput",["compositionend","keypress","textInput","paste"]),di("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),di("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),di("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _a="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(" "),n1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(_a));function jg(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var h=t[a],w=h.event;h=h.listeners;e:{var k=void 0;if(n)for(var O=h.length-1;0<=O;O--){var G=h[O],J=G.instance,le=G.currentTarget;if(G=G.listener,J!==k&&w.isPropagationStopped())break e;k=G,w.currentTarget=le;try{k(w)}catch(he){So(he)}w.currentTarget=null,k=J}else for(O=0;O<h.length;O++){if(G=h[O],J=G.instance,le=G.currentTarget,G=G.listener,J!==k&&w.isPropagationStopped())break e;k=G,w.currentTarget=le;try{k(w)}catch(he){So(he)}w.currentTarget=null,k=J}}}}function et(t,n){var a=n[pc];a===void 0&&(a=n[pc]=new Set);var h=t+"__bubble";a.has(h)||(Ng(n,t,2,!1),a.add(h))}function nd(t,n,a){var h=0;n&&(h|=4),Ng(a,t,h,n)}var ll="_reactListening"+Math.random().toString(36).slice(2);function rd(t){if(!t[ll]){t[ll]=!0,_f.forEach(function(a){a!=="selectionchange"&&(n1.has(a)||nd(a,!1,t),nd(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[ll]||(n[ll]=!0,nd("selectionchange",!1,n))}}function Ng(t,n,a,h){switch(rx(n)){case 2:var w=A1;break;case 8:w=D1;break;default:w=vd}a=w.bind(null,n,a,t),w=void 0,!wc||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 id(t,n,a,h,w){var k=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=$i(G),O===null)return;if(J=O.tag,J===5||J===6||J===26||J===27){h=k=O;continue e}G=G.parentNode}}h=h.return}Rf(function(){var le=k,he=_c(a),xe=[];e:{var ce=op.get(t);if(ce!==void 0){var de=bo,De=t;switch(t){case"keypress":if(xo(a)===0)break e;case"keydown":case"keyup":de=Y0;break;case"focusin":De="focus",de=jc;break;case"focusout":De="blur",de=jc;break;case"beforeblur":case"afterblur":de=jc;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=If;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=B0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=Q0;break;case rp:case ip:case sp:de=P0;break;case ap:de=e_;break;case"scroll":case"scrollend":de=M0;break;case"wheel":de=n_;break;case"copy":case"cut":case"paste":de=U0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=zf;break;case"toggle":case"beforetoggle":de=i_}var Fe=(n&4)!==0,xt=!Fe&&(t==="scroll"||t==="scrollend"),se=Fe?ce!==null?ce+"Capture":null:ce;Fe=[];for(var ne=le,ae;ne!==null;){var ge=ne;if(ae=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||ae===null||se===null||(ge=$s(ne,se),ge!=null&&Fe.push(Sa(ne,ge,ae))),xt)break;ne=ne.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!==yc&&(De=a.relatedTarget||a.fromElement)&&($i(De)||De[Ui]))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?$i(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=If,ge="onMouseLeave",se="onMouseEnter",ne="mouse",(t==="pointerout"||t==="pointerover")&&(Fe=zf,ge="onPointerLeave",se="onPointerEnter",ne="pointer"),xt=de==null?ce:Us(de),ae=De==null?ce:Us(De),ce=new Fe(ge,ne+"leave",de,a,he),ce.target=xt,ce.relatedTarget=ae,ge=null,$i(he)===le&&(Fe=new Fe(se,ne+"enter",De,a,he),Fe.target=ae,Fe.relatedTarget=xt,ge=Fe),xt=ge,de&&De)t:{for(Fe=r1,se=de,ne=De,ae=0,ge=se;ge;ge=Fe(ge))ae++;ge=0;for(var ze=ne;ze;ze=Fe(ze))ge++;for(;0<ae-ge;)se=Fe(se),ae--;for(;0<ge-ae;)ne=Fe(ne),ge--;for(;ae--;){if(se===ne||ne!==null&&se===ne.alternate){Fe=se;break t}se=Fe(se),ne=Fe(ne)}Fe=null}else Fe=null;de!==null&&Tg(xe,ce,de,Fe,!1),De!==null&&xt!==null&&Tg(xe,xt,De,Fe,!0)}}e:{if(ce=le?Us(le):window,de=ce.nodeName&&ce.nodeName.toLowerCase(),de==="select"||de==="input"&&ce.type==="file")var ct=Gf;else if(qf(ce))if(Vf)ct=p_;else{ct=h_;var Me=d_}else de=ce.nodeName,!de||de.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&bc(le.elementType)&&(ct=Gf):ct=f_;if(ct&&(ct=ct(t,le))){Wf(xe,ct,a,he);break e}Me&&Me(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&vc(ce,"number",ce.value)}switch(Me=le?Us(le):window,t){case"focusin":(qf(Me)||Me.contentEditable==="true")&&(Qi=Me,Rc=le,Zs=null);break;case"focusout":Zs=Rc=Qi=null;break;case"mousedown":Oc=!0;break;case"contextmenu":case"mouseup":case"dragend":Oc=!1,tp(xe,a,he);break;case"selectionchange":if(g_)break;case"keydown":case"keyup":tp(xe,a,he)}var Ye;if(Tc)e:{switch(t){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else Zi?Uf(t,a)&&(it="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(it="onCompositionStart");it&&(Hf&&a.locale!=="ko"&&(Zi||it!=="onCompositionStart"?it==="onCompositionEnd"&&Zi&&(Ye=Of()):(Br=he,Cc="value"in Br?Br.value:Br.textContent,Zi=!0)),Me=cl(le,it),0<Me.length&&(it=new Bf(it,t,null,a,he),xe.push({event:it,listeners:Me}),Ye?it.data=Ye:(Ye=$f(a),Ye!==null&&(it.data=Ye)))),(Ye=a_?o_(t,a):l_(t,a))&&(it=cl(le,"onBeforeInput"),0<it.length&&(Me=new Bf("onBeforeInput","beforeinput",null,a,he),xe.push({event:Me,listeners:it}),Me.data=Ye)),J_(xe,t,le,a,he)}jg(xe,n)})}function Sa(t,n,a){return{instance:t,listener:n,currentTarget:a}}function cl(t,n){for(var a=n+"Capture",h=[];t!==null;){var w=t,k=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||k===null||(w=$s(t,a),w!=null&&h.unshift(Sa(t,w,k)),w=$s(t,n),w!=null&&h.push(Sa(t,w,k))),t.tag===3)return h;t=t.return}return[]}function r1(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Tg(t,n,a,h,w){for(var k=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=$s(a,k),le!=null&&O.unshift(Sa(a,le,J))):w||(le=$s(a,k),le!=null&&O.push(Sa(a,le,J)))),a=a.return}O.length!==0&&t.push({event:n,listeners:O})}var i1=/\r\n?/g,s1=/\u0000|\uFFFD/g;function Ag(t){return(typeof t=="string"?t:""+t).replace(i1,`
49
+ `).replace(s1,"")}function Dg(t,n){return n=Ag(n),Ag(t)===n}function gt(t,n,a,h,w,k){switch(a){case"children":typeof h=="string"?n==="body"||n==="textarea"&&h===""||Ki(t,h):(typeof h=="number"||typeof h=="bigint")&&n!=="body"&&Ki(t,""+h);break;case"className":fo(t,"class",h);break;case"tabIndex":fo(t,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":fo(t,a,h);break;case"style":Df(t,h,k);break;case"data":if(n!=="object"){fo(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=mo(""+h),t.setAttribute(a,h);break;case"action":case"formAction":if(typeof h=="function"){t.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof k=="function"&&(a==="formAction"?(n!=="input"&&gt(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=mo(""+h),t.setAttribute(a,h);break;case"onClick":h!=null&&(t.onclick=pr);break;case"onScroll":h!=null&&et("scroll",t);break;case"onScrollEnd":h!=null&&et("scrollend",t);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(s(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"multiple":t.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":t.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){t.removeAttribute("xlink:href");break}a=mo(""+h),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,""+h):t.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":h===!0?t.setAttribute(a,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,h):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?t.setAttribute(a,h):t.removeAttribute(a);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?t.removeAttribute(a):t.setAttribute(a,h);break;case"popover":et("beforetoggle",t),et("toggle",t),ho(t,"popover",h);break;case"xlinkActuate":fr(t,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":fr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":fr(t,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":fr(t,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":fr(t,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":fr(t,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":fr(t,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":fr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":fr(t,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":ho(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=R0.get(a)||a,ho(t,a,h))}}function sd(t,n,a,h,w,k){switch(a){case"style":Df(t,h,k);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"?Ki(t,h):(typeof h=="number"||typeof h=="bigint")&&Ki(t,""+h);break;case"onScroll":h!=null&&et("scroll",t);break;case"onScrollEnd":h!=null&&et("scrollend",t);break;case"onClick":h!=null&&(t.onclick=pr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sf.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(w=a.endsWith("Capture"),n=a.slice(2,w?a.length-7:void 0),k=t[xn]||null,k=k!=null?k[a]:null,typeof k=="function"&&t.removeEventListener(n,k,w),typeof h=="function")){typeof k!="function"&&k!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,h,w);break e}a in t?t[a]=h:h===!0?t.setAttribute(a,""):ho(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":et("error",t),et("load",t);var h=!1,w=!1,k;for(k in a)if(a.hasOwnProperty(k)){var O=a[k];if(O!=null)switch(k){case"src":h=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:gt(t,n,k,O,a,null)}}w&&gt(t,n,"srcSet",a.srcSet,a,null),h&&gt(t,n,"src",a.src,a,null);return;case"input":et("invalid",t);var G=k=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":k=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)}}jf(t,k,G,J,le,O,w,!1);return;case"select":et("invalid",t),h=O=k=null;for(w in a)if(a.hasOwnProperty(w)&&(G=a[w],G!=null))switch(w){case"value":k=G;break;case"defaultValue":O=G;break;case"multiple":h=G;default:gt(t,n,w,G,a,null)}n=k,a=O,t.multiple=!!h,n!=null?Vi(t,!!h,n,!1):a!=null&&Vi(t,!!h,a,!0);return;case"textarea":et("invalid",t),k=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":k=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(91));break;default:gt(t,n,O,G,a,null)}Tf(t,h,w,k);return;case"option":for(J in a)if(a.hasOwnProperty(J)&&(h=a[J],h!=null))switch(J){case"selected":t.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:gt(t,n,J,h,a,null)}return;case"dialog":et("beforetoggle",t),et("toggle",t),et("cancel",t),et("close",t);break;case"iframe":case"object":et("load",t);break;case"video":case"audio":for(h=0;h<_a.length;h++)et(_a[h],t);break;case"image":et("error",t),et("load",t);break;case"details":et("toggle",t);break;case"embed":case"source":case"link":et("error",t),et("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(le in a)if(a.hasOwnProperty(le)&&(h=a[le],h!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:gt(t,n,le,h,a,null)}return;default:if(bc(n)){for(he in a)a.hasOwnProperty(he)&&(h=a[he],h!==void 0&&sd(t,n,he,h,a,void 0));return}}for(G in a)a.hasOwnProperty(G)&&(h=a[G],h!=null&&gt(t,n,G,h,a,null))}function a1(t,n,a,h){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,k=null,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":k=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&&gt(t,n,ce,de,h,xe)}}xc(t,O,G,J,le,he,k,w);return;case"select":de=O=G=ce=null;for(k in a)if(J=a[k],a.hasOwnProperty(k)&&J!=null)switch(k){case"value":break;case"multiple":de=J;default:h.hasOwnProperty(k)||gt(t,n,k,null,h,J)}for(w in h)if(k=h[w],J=a[w],h.hasOwnProperty(w)&&(k!=null||J!=null))switch(w){case"value":ce=k;break;case"defaultValue":G=k;break;case"multiple":O=k;default:k!==J&&gt(t,n,w,k,h,J)}n=G,a=O,h=de,ce!=null?Vi(t,!!a,ce,!1):!!h!=!!a&&(n!=null?Vi(t,!!a,n,!0):Vi(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],k=a[O],h.hasOwnProperty(O)&&(w!=null||k!=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!==k&&gt(t,n,O,w,h,k)}Nf(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)&&gt(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(bc(n)){for(var xt in a)ce=a[xt],a.hasOwnProperty(xt)&&ce!==void 0&&!h.hasOwnProperty(xt)&&sd(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||sd(t,n,he,ce,h,de);return}}for(var se in a)ce=a[se],a.hasOwnProperty(se)&&ce!=null&&!h.hasOwnProperty(se)&&gt(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 Lg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function o1(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),h=0;h<a.length;h++){var w=a[h],k=w.transferSize,O=w.initiatorType,G=w.duration;if(k&&G&&Lg(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&&Lg(xe)&&(J=J.responseEnd,O+=he*(J<G?1:(G-le)/(J-le)))}if(--h,n+=8*(k+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 ad=null,od=null;function ul(t){return t.nodeType===9?t:t.ownerDocument}function Rg(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 Og(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 ld(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 cd=null;function l1(){var t=window.event;return t&&t.type==="popstate"?t===cd?!1:(cd=t,!0):(cd=null,!1)}var Mg=typeof setTimeout=="function"?setTimeout:void 0,c1=typeof clearTimeout=="function"?clearTimeout:void 0,Ig=typeof Promise=="function"?Promise:void 0,u1=typeof queueMicrotask=="function"?queueMicrotask:typeof Ig<"u"?function(t){return Ig.resolve(null).then(t).catch(d1)}:Mg;function d1(t){setTimeout(function(){throw t})}function ei(t){return t==="head"}function Bg(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),ks(n);return}h--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")h++;else if(a==="html")wa(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,wa(a);for(var k=a.firstChild;k;){var O=k.nextSibling,G=k.nodeName;k[Fs]||G==="SCRIPT"||G==="STYLE"||G==="LINK"&&k.rel.toLowerCase()==="stylesheet"||a.removeChild(k),k=O}}else a==="body"&&wa(t.ownerDocument.body);a=w}while(a);ks(n)}function zg(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 ud(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":ud(a),mc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function h1(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[Fs])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(k=t.getAttribute("rel"),k==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(k!==w.rel||t.getAttribute("href")!==(w.href==null||w.href===""?null:w.href)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin)||t.getAttribute("title")!==(w.title==null?null:w.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(k=t.getAttribute("src"),(k!==(w.src==null?null:w.src)||t.getAttribute("type")!==(w.type==null?null:w.type)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&k&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var k=w.name==null?null:""+w.name;if(w.type==="hidden"&&t.getAttribute("name")===k)return t}else return t;if(t=Gn(t.nextSibling),t===null)break}return null}function f1(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Gn(t.nextSibling),t===null))return null;return t}function Hg(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Gn(t.nextSibling),t===null))return null;return t}function dd(t){return t.data==="$?"||t.data==="$~"}function hd(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function p1(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 Gn(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 fd=null;function Pg(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Gn(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function Fg(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 Ug(t,n,a){switch(n=ul(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 wa(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);mc(t)}var Vn=new Map,$g=new Set;function dl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Ar=Y.d;Y.d={f:m1,r:g1,D:x1,C:v1,L:b1,m:y1,X:S1,S:_1,M:w1};function m1(){var t=Ar.f(),n=nl();return t||n}function g1(t){var n=qi(t);n!==null&&n.tag===5&&n.type==="form"?am(n):Ar.r(t)}var Ss=typeof document>"u"?null:document;function qg(t,n,a){var h=Ss;if(h&&typeof n=="string"&&n){var w=Hn(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),$g.has(w)||($g.add(w),t={rel:t,crossOrigin:a,href:n},h.querySelector(w)===null&&(n=h.createElement("link"),an(n,"link",t),Zt(n),h.head.appendChild(n)))}}function x1(t){Ar.D(t),qg("dns-prefetch",t,null)}function v1(t,n){Ar.C(t,n),qg("preconnect",t,n)}function b1(t,n,a){Ar.L(t,n,a);var h=Ss;if(h&&t&&n){var w='link[rel="preload"][as="'+Hn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(w+='[imagesrcset="'+Hn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(w+='[imagesizes="'+Hn(a.imageSizes)+'"]')):w+='[href="'+Hn(t)+'"]';var k=w;switch(n){case"style":k=ws(t);break;case"script":k=Cs(t)}Vn.has(k)||(t=m({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),Vn.set(k,t),h.querySelector(w)!==null||n==="style"&&h.querySelector(Ca(k))||n==="script"&&h.querySelector(ka(k))||(n=h.createElement("link"),an(n,"link",t),Zt(n),h.head.appendChild(n)))}}function y1(t,n){Ar.m(t,n);var a=Ss;if(a&&t){var h=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+Hn(h)+'"][href="'+Hn(t)+'"]',k=w;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=Cs(t)}if(!Vn.has(k)&&(t=m({rel:"modulepreload",href:t},n),Vn.set(k,t),a.querySelector(w)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ka(k)))return}h=a.createElement("link"),an(h,"link",t),Zt(h),a.head.appendChild(h)}}}function _1(t,n,a){Ar.S(t,n,a);var h=Ss;if(h&&t){var w=Wi(h).hoistableStyles,k=ws(t);n=n||"default";var O=w.get(k);if(!O){var G={loading:0,preload:null};if(O=h.querySelector(Ca(k)))G.loading=5;else{t=m({rel:"stylesheet",href:t,"data-precedence":n},a),(a=Vn.get(k))&&pd(t,a);var J=O=h.createElement("link");Zt(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,hl(O,n,h)}O={type:"stylesheet",instance:O,count:1,state:G},w.set(k,O)}}}function S1(t,n){Ar.X(t,n);var a=Ss;if(a&&t){var h=Wi(a).hoistableScripts,w=Cs(t),k=h.get(w);k||(k=a.querySelector(ka(w)),k||(t=m({src:t,async:!0},n),(n=Vn.get(w))&&md(t,n),k=a.createElement("script"),Zt(k),an(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},h.set(w,k))}}function w1(t,n){Ar.M(t,n);var a=Ss;if(a&&t){var h=Wi(a).hoistableScripts,w=Cs(t),k=h.get(w);k||(k=a.querySelector(ka(w)),k||(t=m({src:t,async:!0,type:"module"},n),(n=Vn.get(w))&&md(t,n),k=a.createElement("script"),Zt(k),an(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},h.set(w,k))}}function Wg(t,n,a,h){var w=(w=ee.current)?dl(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=ws(a.href),a=Wi(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=ws(a.href);var k=Wi(w).hoistableStyles,O=k.get(t);if(O||(w=w.ownerDocument||w,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(t,O),(k=w.querySelector(Ca(t)))&&!k._p&&(O.instance=k,O.state.loading=5),Vn.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},Vn.set(t,a),k||C1(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=Cs(a),a=Wi(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 ws(t){return'href="'+Hn(t)+'"'}function Ca(t){return'link[rel="stylesheet"]['+t+"]"}function Gg(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function C1(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),Zt(n),t.head.appendChild(n))}function Cs(t){return'[src="'+Hn(t)+'"]'}function ka(t){return"script[async]"+t}function Vg(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var h=t.querySelector('style[data-href~="'+Hn(a.href)+'"]');if(h)return n.instance=h,Zt(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"),Zt(h),an(h,"style",w),hl(h,a.precedence,t),n.instance=h;case"stylesheet":w=ws(a.href);var k=t.querySelector(Ca(w));if(k)return n.state.loading|=4,n.instance=k,Zt(k),k;h=Gg(a),(w=Vn.get(w))&&pd(h,w),k=(t.ownerDocument||t).createElement("link"),Zt(k);var O=k;return O._p=new Promise(function(G,J){O.onload=G,O.onerror=J}),an(k,"link",h),n.state.loading|=4,hl(k,a.precedence,t),n.instance=k;case"script":return k=Cs(a.src),(w=t.querySelector(ka(k)))?(n.instance=w,Zt(w),w):(h=a,(w=Vn.get(k))&&(h=m({},a),md(h,w)),t=t.ownerDocument||t,w=t.createElement("script"),Zt(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,hl(h,a.precedence,t));return n.instance}function hl(t,n,a){for(var h=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=h.length?h[h.length-1]:null,k=w,O=0;O<h.length;O++){var G=h[O];if(G.dataset.precedence===n)k=G;else if(k!==w)break}k?k.parentNode.insertBefore(t,k.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(t,n.firstChild))}function pd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function md(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var fl=null;function Kg(t,n,a){if(fl===null){var h=new Map,w=fl=new Map;w.set(a,h)}else w=fl,h=w.get(a),h||(h=new Map,w.set(a,h));if(h.has(t))return h;for(h.set(t,null),a=a.getElementsByTagName(t),w=0;w<a.length;w++){var k=a[w];if(!(k[Fs]||k[tn]||t==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var O=k.getAttribute(n)||"";O=t+O;var G=h.get(O);G?G.push(k):h.set(O,[k])}}return h}function Yg(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function k1(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 Xg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function E1(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=ws(h.href),k=n.querySelector(Ca(w));if(k){n=k._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=pl.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=k,Zt(k);return}k=n.ownerDocument||n,h=Gg(h),(w=Vn.get(w))&&pd(h,w),k=k.createElement("link"),Zt(k);var O=k;O._p=new Promise(function(G,J){O.onload=G,O.onerror=J}),an(k,"link",h),a.instance=k}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=pl.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var gd=0;function j1(t,n){return t.stylesheets&&t.count===0&&gl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var h=setTimeout(function(){if(t.stylesheets&&gl(t,t.stylesheets),t.unsuspend){var k=t.unsuspend;t.unsuspend=null,k()}},6e4+n);0<t.imgBytes&&gd===0&&(gd=62500*o1());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&gl(t,t.stylesheets),t.unsuspend)){var k=t.unsuspend;t.unsuspend=null,k()}},(t.imgBytes>gd?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(h),clearTimeout(w)}}:null}function pl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var ml=null;function gl(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,ml=new Map,n.forEach(N1,t),ml=null,pl.call(t))}function N1(t,n){if(!(n.state.loading&4)){var a=ml.get(t);if(a)var h=a.get(null);else{a=new Map,ml.set(t,a);for(var w=t.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<w.length;k++){var O=w[k];(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"),k=a.get(O)||h,k===h&&a.set(null,w),a.set(O,w),this.count++,h=pl.bind(this),w.addEventListener("load",h),w.addEventListener("error",h),k?k.parentNode.insertBefore(w,k.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(w,t.firstChild)),n.state.loading|=4}}var Ea={$$typeof:S,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function T1(t,n,a,h,w,k,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=Ve(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ve(0),this.hiddenUpdates=Ve(null),this.identifierPrefix=h,this.onUncaughtError=w,this.onCaughtError=k,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function Zg(t,n,a,h,w,k,O,G,J,le,he,xe){return t=new T1(t,n,a,O,J,le,he,xe,G),n=1,k===!0&&(n|=24),k=jn(3,null,null,n),t.current=k,k.stateNode=t,n=Yc(),n.refCount++,t.pooledCache=n,n.refCount++,k.memoizedState={element:h,isDehydrated:a,cache:n},Jc(k),t}function Qg(t){return t?(t=ts,t):ts}function Jg(t,n,a,h,w,k){w=Qg(w),h.context===null?h.context=w:h.pendingContext=w,h=$r(n),h.payload={element:a},k=k===void 0?null:k,k!==null&&(h.callback=k),a=qr(t,h,n),a!==null&&(wn(a,t,n),ia(a,t,n))}function ex(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function xd(t,n){ex(t,n),(t=t.alternate)&&ex(t,n)}function tx(t){if(t.tag===13||t.tag===31){var n=mi(t,67108864);n!==null&&wn(n,t,67108864),xd(t,67108864)}}function nx(t){if(t.tag===13||t.tag===31){var n=Ln();n=hc(n);var a=mi(t,n);a!==null&&wn(a,t,n),xd(t,n)}}var xl=!0;function A1(t,n,a,h){var w=M.T;M.T=null;var k=Y.p;try{Y.p=2,vd(t,n,a,h)}finally{Y.p=k,M.T=w}}function D1(t,n,a,h){var w=M.T;M.T=null;var k=Y.p;try{Y.p=8,vd(t,n,a,h)}finally{Y.p=k,M.T=w}}function vd(t,n,a,h){if(xl){var w=bd(h);if(w===null)id(t,n,h,vl,a),ix(t,h);else if(R1(w,t,n,a,h))h.stopPropagation();else if(ix(t,h),n&4&&-1<L1.indexOf(t)){for(;w!==null;){var k=qi(w);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var O=We(k.pendingLanes);if(O!==0){var G=k;for(G.pendingLanes|=2,G.entangledLanes|=2;O;){var J=1<<31-lt(O);G.entanglements[1]|=J,O&=~J}sr(k),(dt&6)===0&&(el=Be()+500,ya(0))}}break;case 31:case 13:G=mi(k,2),G!==null&&wn(G,k,2),nl(),xd(k,2)}if(k=bd(h),k===null&&id(t,n,h,vl,a),k===w)break;w=k}w!==null&&h.stopPropagation()}else id(t,n,h,null,a)}}function bd(t){return t=_c(t),yd(t)}var vl=null;function yd(t){if(vl=null,t=$i(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 vl=t,null}function rx(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ot()){case ue:return 2;case _e:return 8;case Ne:case Oe:return 32;case qe:return 268435456;default:return 32}default:return 32}}var _d=!1,ti=null,ni=null,ri=null,ja=new Map,Na=new Map,ii=[],L1="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 ix(t,n){switch(t){case"focusin":case"focusout":ti=null;break;case"dragenter":case"dragleave":ni=null;break;case"mouseover":case"mouseout":ri=null;break;case"pointerover":case"pointerout":ja.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Na.delete(n.pointerId)}}function Ta(t,n,a,h,w,k){return t===null||t.nativeEvent!==k?(t={blockedOn:n,domEventName:a,eventSystemFlags:h,nativeEvent:k,targetContainers:[w]},n!==null&&(n=qi(n),n!==null&&tx(n)),t):(t.eventSystemFlags|=h,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function R1(t,n,a,h,w){switch(n){case"focusin":return ti=Ta(ti,t,n,a,h,w),!0;case"dragenter":return ni=Ta(ni,t,n,a,h,w),!0;case"mouseover":return ri=Ta(ri,t,n,a,h,w),!0;case"pointerover":var k=w.pointerId;return ja.set(k,Ta(ja.get(k)||null,t,n,a,h,w)),!0;case"gotpointercapture":return k=w.pointerId,Na.set(k,Ta(Na.get(k)||null,t,n,a,h,w)),!0}return!1}function sx(t){var n=$i(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,bf(t.priority,function(){nx(a)});return}}else if(n===31){if(n=c(a),n!==null){t.blockedOn=n,bf(t.priority,function(){nx(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 bl(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=bd(t.nativeEvent);if(a===null){a=t.nativeEvent;var h=new a.constructor(a.type,a);yc=h,a.target.dispatchEvent(h),yc=null}else return n=qi(a),n!==null&&tx(n),t.blockedOn=a,!1;n.shift()}return!0}function ax(t,n,a){bl(t)&&a.delete(n)}function O1(){_d=!1,ti!==null&&bl(ti)&&(ti=null),ni!==null&&bl(ni)&&(ni=null),ri!==null&&bl(ri)&&(ri=null),ja.forEach(ax),Na.forEach(ax)}function yl(t,n){t.blockedOn===n&&(t.blockedOn=null,_d||(_d=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,O1)))}var _l=null;function ox(t){_l!==t&&(_l=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){_l===t&&(_l=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(yd(h||a)===null)continue;break}var k=qi(a);k!==null&&(t.splice(n,3),n-=3,bu(k,{pending:!0,data:w,method:a.method,action:h},h,w))}}))}function ks(t){function n(J){return yl(J,t)}ti!==null&&yl(ti,t),ni!==null&&yl(ni,t),ri!==null&&yl(ri,t),ja.forEach(n),Na.forEach(n);for(var a=0;a<ii.length;a++){var h=ii[a];h.blockedOn===t&&(h.blockedOn=null)}for(;0<ii.length&&(a=ii[0],a.blockedOn===null);)sx(a),a.blockedOn===null&&ii.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(h=0;h<a.length;h+=3){var w=a[h],k=a[h+1],O=w[xn]||null;if(typeof k=="function")O||ox(a);else if(O){var G=null;if(k&&k.hasAttribute("formAction")){if(w=k,O=k[xn]||null)G=O.formAction;else if(yd(w)!==null)continue}else G=O.action;typeof G=="function"?a[h+1]=G:(a.splice(h,3),h-=3),ox(a)}}}function lx(){function t(k){k.canIntercept&&k.info==="react-transition"&&k.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 k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,w=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){h=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),w!==null&&(w(),w=null)}}}function Sd(t){this._internalRoot=t}Sl.prototype.render=Sd.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,h=Ln();Jg(a,h,t,n,null,null)},Sl.prototype.unmount=Sd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Jg(t.current,2,null,t,null,null),nl(),n[Ui]=null}};function Sl(t){this._internalRoot=t}Sl.prototype.unstable_scheduleHydration=function(t){if(t){var n=vf();t={blockedOn:null,target:t,priority:n};for(var a=0;a<ii.length&&n!==0&&n<ii[a].priority;a++);ii.splice(a,0,t),a===0&&sx(t)}};var cx=r.version;if(cx!=="19.2.4")throw Error(s(527,cx,"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 M1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var wl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wl.isDisabled&&wl.supportsFiber)try{Ot=wl.inject(M1),Tt=wl}catch{}}return Da.createRoot=function(t,n){if(!l(t))throw Error(s(299));var a=!1,h="",w=gm,k=xm,O=vm;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(h=n.identifierPrefix),n.onUncaughtError!==void 0&&(w=n.onUncaughtError),n.onCaughtError!==void 0&&(k=n.onCaughtError),n.onRecoverableError!==void 0&&(O=n.onRecoverableError)),n=Zg(t,1,!1,null,null,a,h,null,w,k,O,lx),t[Ui]=n.current,rd(t),new Sd(n)},Da.hydrateRoot=function(t,n,a){if(!l(t))throw Error(s(299));var h=!1,w="",k=gm,O=xm,G=vm,J=null;return a!=null&&(a.unstable_strictMode===!0&&(h=!0),a.identifierPrefix!==void 0&&(w=a.identifierPrefix),a.onUncaughtError!==void 0&&(k=a.onUncaughtError),a.onCaughtError!==void 0&&(O=a.onCaughtError),a.onRecoverableError!==void 0&&(G=a.onRecoverableError),a.formState!==void 0&&(J=a.formState)),n=Zg(t,1,!0,n,a??null,h,w,J,k,O,G,lx),n.context=Qg(null),a=n.current,h=Ln(),h=hc(h),w=$r(h),w.callback=null,qr(a,w,h),a=h,n.current.lanes=a,Mt(n,a),sr(n),t[Ui]=n.current,rd(t),new Sl(n)},Da.version="19.2.4",Da}var bx;function K1(){if(bx)return kd.exports;bx=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(),kd.exports=V1(),kd.exports}var Y1=K1();const X1=Vl(Y1);function Z1(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 Td={exports:{}},Ad={};/**
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 yx;function Q1(){if(yx)return Ad;yx=1;var e=Kl();function r(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var i=typeof Object.is=="function"?Object.is:r,s=e.useState,l=e.useEffect,u=e.useLayoutEffect,f=e.useDebugValue;function c(m,v){var _=v(),E=s({inst:{value:_,getSnapshot:v}}),C=E[0].inst,y=E[1];return u(function(){C.value=_,C.getSnapshot=v,d(C)&&y({inst:C})},[m,_,v]),l(function(){return d(C)&&y({inst:C}),m(function(){d(C)&&y({inst:C})})},[m]),f(_),_}function d(m){var v=m.getSnapshot;m=m.value;try{var _=v();return!i(m,_)}catch{return!0}}function p(m,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:c;return Ad.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Ad}var _x;function J1(){return _x||(_x=1,Td.exports=Q1()),Td.exports}var eS=J1();const tS=$1.useInsertionEffect,nS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",rS=nS?P.useLayoutEffect:P.useEffect,iS=tS||rS,fb=e=>{const r=P.useRef([e,(...i)=>r[0](...i)]).current;return iS(()=>{r[0]=e}),r[1]},sS="popstate",Sh="pushState",wh="replaceState",aS="hashchange",Sx=[sS,Sh,wh,aS],oS=e=>{for(const r of Sx)addEventListener(r,e);return()=>{for(const r of Sx)removeEventListener(r,e)}},pb=(e,r)=>eS.useSyncExternalStore(oS,e,r),wx=()=>location.search,lS=({ssrSearch:e}={})=>pb(wx,e!=null?()=>e:wx),Cx=()=>location.pathname,cS=({ssrPath:e}={})=>pb(Cx,e!=null?()=>e:Cx),uS=(e,{replace:r=!1,state:i=null}={})=>history[r?wh:Sh](i,"",e),dS=(e={})=>[cS(e),uS],kx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[kx]>"u"){for(const e of[Sh,wh]){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,kx,{value:!0})}const hS=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",mb=(e="")=>e==="/"?"":e,fS=(e,r)=>e[0]==="~"?e.slice(1):mb(r)+e,pS=(e="",r)=>hS(Ex(mb(e)),Ex(r)),Ex=e=>{try{return decodeURI(e)}catch{return e}},gb={hook:dS,searchHook:lS,parser:Z1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,i)=>e(r,i)},xb=P.createContext(gb),Is=()=>P.useContext(xb),vb={},bb=P.createContext(vb),mS=()=>P.useContext(bb),Yl=e=>{const[r,i]=e.hook(e);return[pS(e.base,r),fb((s,l)=>e.aroundNav(i,fS(s,e.base),l))]},ur=()=>Yl(Is()),Ch=(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,v)=>[m,d[v]])):f.groups;let g={...d};return p&&Object.assign(g,p),g})(),...s?[c]:[]]:[!1,null]},kh=e=>Ch(Is().parser,e,ur()[0]),gS=({children:e,...r})=>{var g,m,v;const i=Is(),s=r.hook?gb: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??((v=r.hook)==null?void 0:v.searchHook);let c=P.useRef({}),d=c.current,p=d;for(let _ in s){const E=_==="base"?s[_]+(r[_]??""):r[_]??s[_];d===p&&E!==p[_]&&(c.current=p={...p}),p[_]=E,(E!==s[_]||E!==l[_])&&(l=p)}return P.createElement(xb.Provider,{value:l,children:e})},jx=({children:e,component:r},i)=>r?P.createElement(r,{params:i}):typeof e=="function"?e(i):e,xS=e=>{let r=P.useRef(vb);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},La=({path:e,nest:r,match:i,...s})=>{const l=Is(),[u]=Yl(l),[f,c,d]=i??Ch(l.parser,e,u,r),p=xS({...mS(),...c});if(!f)return null;const g=d?P.createElement(gS,{base:d},jx(s,p)):jx(s,p);return P.createElement(bb.Provider,{value:p,children:g})},Mn=P.forwardRef((e,r)=>{const i=Is(),[s,l]=Yl(i),{to:u="",href:f=u,onClick:c,asChild:d,children:p,className:g,replace:m,state:v,transition:_,...E}=e,C=fb(x=>{x.ctrlKey||x.metaKey||x.altKey||x.shiftKey||x.button!==0||(c==null||c(x),x.defaultPrevented||(x.preventDefault(),l(f,e)))}),y=i.hrefs(f[0]==="~"?f.slice(1):i.base+f,i);return d&&P.isValidElement(p)?P.cloneElement(p,{onClick:C,href:y}):P.createElement("a",{...E,onClick:C,href:y,className:g!=null&&g.call?g(s===f):g,children:p,ref:r})}),yb=e=>Array.isArray(e)?e.flatMap(r=>yb(r&&r.type===P.Fragment?r.props.children:r)):[e],vS=({children:e,location:r})=>{const i=Is(),[s]=Yl(i);for(const l of yb(e)){let u=0;if(P.isValidElement(l)&&(u=Ch(i.parser,l.props.path,r||s,l.props.nest))[0])return P.cloneElement(l,{match:u})}return null},Nx=e=>{let r;const i=new Set,s=(p,g)=>{const m=typeof p=="function"?p(r):p;if(!Object.is(m,r)){const v=r;r=g??(typeof m!="object"||m===null)?m:Object.assign({},r,m),i.forEach(_=>_(r,v))}},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},bS=(e=>e?Nx(e):Nx),yS=e=>e;function _S(e,r=yS){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 Tx=e=>{const r=bS(e),i=s=>_S(r,s);return Object.assign(i,r),i},Yn=(e=>e?Tx(e):Tx);async function Ce(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 SS(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function _b(){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 wS{constructor(r){ar(this,"ws",null);ar(this,"handlers",new Set);ar(this,"statusHandler",null);ar(this,"baseUrl");ar(this,"isReconnecting",!1);ar(this,"connectingPromise",null);ar(this,"lastCloseCode",0);ar(this,"reconnectAttempts",0);ar(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);SS(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=_b(),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 CS=`ws://${window.location.hostname}:${window.location.port||"10469"}/ws`,qt=new wS(CS),ci=async(e,r,i)=>{try{const s=await Ce(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 Sb(e){let r=null;function i(){r===null&&(r=requestAnimationFrame(()=>{r=null,e()}))}return i}let Cl=[];const cr=Yn()((e,r)=>{function i(){if(Cl.length===0)return;const l=Cl;Cl=[],e(u=>({logs:[...u.logs,...l]}))}const s=Sb(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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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;Cl.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 kS(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 Ax(e,r,i){const s=await Ce(`/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 Dx(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 ES=3e4;function jS(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=Yn((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 Ce("/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 Ce("/api/model/refresh",{method:"POST"});if(!i.ok)throw new Error("Failed to refresh model");const s=await i.json(),u=ke.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 Ce(`/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 Ax(i,s,{contextWindow:l}),{providers:f}=r();return e({providers:Dx(f,i,s,{contextWindow:l}),activating:!1}),u.contextState&&ke.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 Ax(i,s,l),{providers:f}=r(),c={...l.contextWindow!==void 0&&{contextWindow:l.contextWindow},...kS({temperature:l.temperature??void 0,topP:l.topP??void 0,topK:l.topK??void 0,maxTokens:l.maxTokens??void 0})};return e({providers:Dx(f,i,s,c),activating:!1}),u.contextState&&ke.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 Ce(`/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()},ES);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}})),Vt=Yn((e,r)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await Ce("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch{e({loading:!1})}},createProject:async(i,s)=>{try{const l=await Ce("/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 Ce(`/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 Ce(`/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 Ce(`/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 kl=[];const Wa=Yn()((e,r)=>{function i(){if(kl.length===0)return;const l=kl;kl=[],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=Sb(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 Ce(`/api/sessions/${u}/background-process/${l}/stop`,{method:"POST"})).ok&&r().removeProcess(l)}catch{}},appendLog:(l,u,f)=>{kl.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 El(e,r){return i=>({loading:{...i.loading,[e]:r}})}function Lx(e,r){return i=>({settings:{...i.settings,[e]:r},loading:{...i.loading,[e]:!1}})}const NS=[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 wb(){return{showThinking:en(e=>e.settings[Et.DISPLAY_SHOW_THINKING]??"true")==="true",showVerboseToolOutput:en(e=>e.settings[Et.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT]??"true")==="true",showStats:en(e=>e.settings[Et.DISPLAY_SHOW_STATS]??"true")==="true",showAgentDefinitions:en(e=>e.settings[Et.DISPLAY_SHOW_AGENT_DEFINITIONS]??"true")==="true",showWorkflowBars:en(e=>e.settings[Et.DISPLAY_SHOW_WORKFLOW_BARS]??"true")==="true"}}const en=Yn(e=>({settings:{},loading:{},getSetting:async r=>{e(El(r,!0));try{const s=await(await Ce(`/api/settings/${r}`)).json();return e(Lx(r,s.value??"")),s.value}catch{return e(El(r,!1)),null}},setSetting:async(r,i)=>{e(El(r,!0));try{const l=await(await Ce(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:i})})).json();e(Lx(r,l.value??""))}catch{e(El(r,!1))}}})),TS=[{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"}],AS=[{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"}],Cb={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"},oi={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},kb={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},ih={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...oi},waiting_for_user:{...oi},phase_done:{...oi},phase_blocked:{...oi},new_message:{...kb}},agentOverrides:{}};function Eb(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 Li=Yn((e,r)=>({settings:ih,loaded:!1,load:()=>{en.getState().getSetting(Et.NOTIFICATION_SETTINGS);const s=en.subscribe(u=>{const f=u.settings[Et.NOTIFICATION_SETTINGS];if(f!==void 0)try{const c=JSON.parse(f);e({settings:Rx(c),loaded:!0})}catch{e({loaded:!0})}}),l=en.getState().settings[Et.NOTIFICATION_SETTINGS];if(l)try{const u=JSON.parse(l);e({settings:Rx(u),loaded:!0})}catch{e({loaded:!0})}return s},update:i=>{e({settings:i}),Dd(i)},updateEvent:(i,s)=>{const l=r().settings,u={...l,events:{...l.events,[i]:{...l.events[i],...s}}};e({settings:u}),Dd(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}),Dd(c)}}));function Dd(e){en.getState().setSetting(Et.NOTIFICATION_SETTINGS,JSON.stringify(e))}function Rx(e){var r,i,s,l,u;return{soundEnabled:e.soundEnabled??ih.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??ih.browserNotificationEnabled,events:{complete:{...oi,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...oi,...(i=e.events)==null?void 0:i.waiting_for_user},phase_done:{...oi,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...oi,...(l=e.events)==null?void 0:l.phase_blocked},new_message:{...kb,...(u=e.events)==null?void 0:u.new_message}},agentOverrides:e.agentOverrides??{}}}const Ox=new Map;function DS(e){let r=Ox.get(e);return r||(r=new Audio(e),r.volume=.5,Ox.set(e,r)),r}let jb=typeof Notification<"u"?Notification.permission:"denied";function LS(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(jb=e,e))}const RS={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},OS={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 MS(e){typeof Notification>"u"||jb==="granted"&&(document.hasFocus()||new Notification(RS[e],{body:OS[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function so(e,r){const{settings:i}=Li.getState(),s=Eb(i,e,r);if(i.soundEnabled&&s.soundEnabled){const l=s.customSoundUrl??Cb[e],u=DS(l);u.currentTime=0,u.play().catch(()=>{})}i.browserNotificationEnabled&&s.browserNotification&&MS(e)}const IS=e=>so("complete",e),BS=e=>so("phase_done",e),zS=e=>so("phase_blocked",e),Mx=e=>so("waiting_for_user",e),HS=e=>so("new_message",e);let Ra=!1,or=null;const Ld=new Set,$t={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Rs=null,un=null;function Rd(){Rs===null&&(Rs=requestAnimationFrame(()=>{Rs=null,un==null||un()}))}function Ni(){Rs!==null&&(cancelAnimationFrame(Rs),Rs=null)}function zt(e,r){return r!==null&&e.sessionId===r}function PS(e,r,i){return e.id!==void 0||zt(e,r)||i===!0&&e.sessionId!==void 0}function FS(e,r){return e.includes(r)?e:[...e,r]}function Oa(e,r){return e.filter(i=>i!==r)}function US(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 $S(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 Ix=new Map;function $a(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 qS(e,r){if(e.type==="chat.done"){const i=e.payload,s=$a(r,e.sessionId),l=i.agentType??s;i.reason==="complete"&&IS(l),i.reason==="waiting_for_user"&&Mx(l);return}if(e.type==="chat.path_confirmation"){const i=$a(r,e.sessionId);Mx(i);return}if(e.type==="task.completed"){const i=$a(r,e.sessionId);BS(i);return}if(e.type==="phase.changed"&&e.sessionId){const i=e.payload,s=Ix.get(e.sessionId)??null;if(Ix.set(e.sessionId,i.phase),s===i.phase)return;const l=$a(r,e.sessionId);i.phase==="blocked"&&zS(l)}}const ke=Yn((e,r)=>(un=()=>{const i=$t;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 v={...g};if(s&&(v.content=v.content+f),l&&(v.thinkingContent=(v.thinkingContent??"")+c),u){const _=new Set;v.toolCalls=(m=v.toolCalls)==null?void 0:m.map(C=>{const y=d.filter(x=>x.callId===C.id);return y.length===0?C:(_.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...y.map(x=>({stream:x.stream,content:x.content}))]})});const E=d.filter(C=>!_.has(C.callId));E.length>0&&$t.toolOutput.push(...E)}return{streamingMessage:v}}if(u){const v=new Set,_=p.messages.map(C=>{var x;if(C.id!==i.messageId)return C;const y=(x=C.toolCalls)==null?void 0:x.map(b=>{const S=d.filter(j=>j.callId===b.id);return S.length===0?b:(v.add(b.id),{...b,streamingOutput:[...b.streamingOutput??[],...S.map(j=>({stream:j.stream,content:j.content}))]})});return{...C,toolCalls:y}}),E=d.filter(C=>!v.has(C.callId));return E.length>0&&$t.toolOutput.push(...E),{messages:_}}return p})},{connectionStatus:"disconnected",showPasswordModal:!1,passwordModalRetry:!1,sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,subAgentContextStates:{},pendingPathConfirmation:null,pendingQuestion:null,visionFallbackByMessage:{},queuedMessages:[],abortInProgress:!1,error:null,sessionsHasMore:!0,sessionsPaginationLoading:!1,pendingSessionCreate:!1,connect:async()=>{const i=r().connectionStatus;if(i==="connected"||i==="reconnecting")return;e({connectionStatus:"reconnecting"});let s=!1;try{s=(await(await Ce("/api/auth")).json()).requiresAuth}catch{}if(s&&!qt.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}qt.onStatusChange(l=>{e({connectionStatus:l}),l==="connected"&&r().listSessions(void 0)});try{if(await qt.connect(),!Ra){Ra=!0;const l=r().handleServerMessage;or=qt.subscribe(l)}}catch(l){console.error("Failed to connect:",l);const u=qt.getLastCloseCode();if(!qt.hasToken()&&(u===1006||u===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}or&&(or(),or=null),Ra=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{qt.disconnect(),or&&(or(),or=null),Ra=!1,e({connectionStatus:"reconnecting"}),r().connect()},disconnect:()=>{qt.disconnect(),or&&(or(),or=null),Ra=!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();qt.setToken(l),e({showPasswordModal:!1}),r().connect();const{listProjects:u}=Vt.getState(),{fetchConfig:f}=At.getState();u(),f(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{qt.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(i,s)=>{try{e({pendingSessionCreate:!0});const l=await Ce("/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 qt.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?(Ni(),e({currentSession:null,unreadSessionIds:Oa(r().unreadSessionIds,i),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:Oa(r().unreadSessionIds,i)});const l=await Ce(`/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??[]}),qt.send("session.load",{sessionId:i});try{const f=await Ce(`/api/sessions/${i}/background-processes`);if(f.ok){const c=await f.json();Wa.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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/api/projects/${i}/sessions`,{method:"DELETE"})).ok?(await r().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{Ni(),e(i=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:i.currentSession?Oa(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 Ce(`/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){Ni(),un==null||un(),e({abortInProgress:!0});try{await Ce(`/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 Ce(`/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),qt.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 Ce(`/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 Ce(`/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),qt.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 Ce(`/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:()=>{qt.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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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,v,_,E,C,y,x,b,S,j,A,N,D,T,B,H,W,K,q;const s=r();qS(i,s);const l=((f=s.currentSession)==null?void 0:f.id)??null,u=()=>{const R=i.sessionId;!R||R===l||e(U=>({unreadSessionIds:FS(U.unreadSessionIds,R)}))};switch(i.type){case"session.state":{const R=i.payload;if(!PS(i,l,s.pendingSessionCreate))break;Ni();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:US(r().sessions,R.session),unreadSessionIds:Oa(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:$S(R.sessions,U.sessions,U.currentSession)}));break}case"session.deleted":{const R=i.payload;e(U=>({unreadSessionIds:Oa(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(!zt(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(!zt(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&&(Ni(),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(!zt(i,((g=r().currentSession)==null?void 0:g.id)??null)){u();break}const R=i.payload;if(!Ld.has(R.messageId)){Ld.add(R.messageId);const U=$a(r(),i.sessionId);HS(U)}$t.messageId=R.messageId,$t.deltaContent+=R.content,Rd();break}case"chat.thinking":{if(!zt(i,((m=r().currentSession)==null?void 0:m.id)??null)){u();break}const R=i.payload;$t.messageId=R.messageId,$t.thinkingContent+=R.content,Rd();break}case"chat.tool_preparing":{if(!zt(i,((v=r().currentSession)==null?void 0:v.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(!zt(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=$t.toolOutput.filter(L=>L.callId===R.callId);return Z.length>0&&($t.toolOutput=$t.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(!zt(i,((E=r().currentSession)==null?void 0:E.id)??null)){u();break}const R=i.payload;$t.messageId=R.messageId,$t.toolOutput.push({messageId:R.messageId,callId:R.callId,stream:R.stream,content:R.output}),Rd();break}case"chat.tool_result":{if(!zt(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(!zt(i,((y=r().currentSession)==null?void 0:y.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(!zt(i,((x=r().currentSession)==null?void 0:x.id)??null)){u();break}const R=i.payload;e({currentTodos:R.todos});break}case"chat.summary":{if(!zt(i,((b=r().currentSession)==null?void 0:b.id)??null)){u();break}const R=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,summary:R.summary}:null}));break}case"chat.progress":{if(!zt(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(!zt(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(!zt(i,((A=r().currentSession)==null?void 0:A.id)??null)){u();break}Ni(),un==null||un();const R=i.payload,U=R.stats;$t.messageId=null,$t.deltaContent="",$t.thinkingContent="",$t.toolOutput=[],Ld.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(!zt(i,((N=r().currentSession)==null?void 0:N.id)??null)){u();break}Ni(),un==null||un();const R=i.payload;console.error("Chat error:",R.error,"recoverable:",R.recoverable),R.recoverable||($t.messageId=null,$t.deltaContent="",$t.thinkingContent="",$t.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(!zt(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(!zt(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(!zt(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(!zt(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=zt(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":{cr.getState().handleMessage(i);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{Wa.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 Nb(){return ke(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function WS(){return ke(e=>e.queuedMessages)}function GS(){return ke(e=>e.abortInProgress)}function VS(){const e=ke(s=>s.connect),r=ke(s=>s.connectionStatus),i=Li(s=>s.load);return P.useEffect(()=>{e()},[e]),P.useEffect(()=>{r==="connected"&&i()},[r,i]),{connectionStatus:r}}function sh(){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 Bx(e,r){const i=qt.ws;!i||i.readyState!==WebSocket.OPEN||i.send(JSON.stringify({id:sh(),type:e,payload:r}))}const Jn=Yn((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 Ce("/api/terminals");if(i.ok){const s=await i.json();e({sessions:s});const l=qt.ws;if(l&&l.readyState===WebSocket.OPEN)for(const u of s)l.send(JSON.stringify({id:sh(),type:"terminal.subscribe",payload:{sessionId:u.id}}))}}catch(i){console.error("Failed to fetch terminals:",i)}},createSession:async i=>{try{const s=await Ce("/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=qt.ws;u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({id:sh(),type:"terminal.subscribe",payload:{sessionId:l.id}}))}}catch(s){console.error("Failed to create terminal:",s)}},writeSession:(i,s)=>{Bx("terminal.write",{sessionId:i,data:s})},resizeSession:(i,s,l)=>{Bx("terminal.resize",{sessionId:i,cols:s,rows:l})},killSession:async i=>{try{(await Ce(`/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}}}}));qt.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&Jn.getState().handleMessage(e)});var Xl=hb();const Eh=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})})}));Eh.displayName="IconButton";const KS="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",Bs=P.forwardRef((e,r)=>o.jsx(Eh,{ref:r,icon:KS,title:"Edit",...e}));Bs.displayName="EditButton";const YS="M6 18L18 6M6 6l12 12",jh=P.forwardRef((e,r)=>o.jsx(Eh,{ref:r,icon:YS,...e}));jh.displayName="CloseButton";const XS={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[v,_]=P.useState(!1),E=d!==void 0,C=E?d:v,y=P.useCallback(()=>{E||_(!0)},[E]),x=P.useCallback(()=>{E||_(!1),c==null||c()},[E,c]);P.useEffect(()=>{if(!C||!g)return;const S=j=>{j.key==="Escape"&&x()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[C,x,g]);const b=e&&(typeof e=="string"?o.jsx("button",{type:"button",onClick:y,className:f,children:e}):o.jsx("span",{onClick:y,className:f,style:{cursor:"pointer"},children:e}));return o.jsxs(o.Fragment,{children:[b,C&&(typeof document<"u"?Xl.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:p?x:void 0}),o.jsxs("div",{className:`relative w-full ${XS[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(jh,{onClick:x,className:"ml-auto","aria-label":"Close"})]}),o.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",style:s?{minHeight:s}:void 0,children:l}),u&&o.jsx("div",{className:"px-4 py-3 border-t border-border",children:u})]})]}),document.body):null)]})}const nt=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})});nt.displayName="Button";function ZS({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:AS.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 zx=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function QS(){const e=Li(d=>d.settings),r=Li(d=>d.update),i=Li(d=>d.updateEvent),s=Li(d=>d.updateAgentOverride),l=Li(d=>d.load);P.useEffect(()=>{l()},[l]);const u=async()=>{await LS()==="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(Hx,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>r({...e,soundEnabled:d})}),o.jsx(Hx,{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"}),zx.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:TS.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})}),zx.map(p=>{const g=Eb(e,d.key,p.key==="general"?void 0:p.key),m=Cb[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:v=>f(p.key,d.key,"soundEnabled",v.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:v=>f(p.key,d.key,"browserNotification",v.target.checked),disabled:!e.browserNotificationEnabled,className:"rounded border-border",title:"Browser"})})]}),g.soundEnabled&&e.soundEnabled&&o.jsx(ZS,{value:g.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:v=>c(p.key,d.key,v)})]})},p.key)})]},d.key))})]})})]})]})}function Hx({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 Nh(e,r){r({loading:!0});try{const s=await(await Ce(e)).json();r({defaults:s.defaults??[],userItems:s.userItems??[],loading:!1})}catch{r({loading:!1})}}const Dr=Yn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchSkills:async()=>{await Nh("/api/skills",e)},toggleSkill:async i=>{try{const l=await(await Ce(`/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 Ce(`/api/skills/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/skills/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createSkill:async i=>{const s=await ci("POST","/api/skills",i);return s.success&&await r().fetchSkills(),s},updateSkill:async(i,s)=>{const l=await ci("PUT",`/api/skills/${i}`,s);return l.success&&await r().fetchSkills(),l},deleteSkill:async i=>{try{const s=await Ce(`/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 Ce(`/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 Th(){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 Ah({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 Dh({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 Xa({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 Ri({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 JS({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(nt,{variant:"secondary",onClick:e,children:"Cancel"}),o.jsx(nt,{variant:"primary",onClick:r,disabled:i||s,children:i?"Saving...":"Save"})]})}function Lh({message:e}){return o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function Tb({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(nt,{variant:"primary",size:"sm",onClick:r,children:i})})]})}function Ab({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(Xa,{onClick:l}),!e&&s&&o.jsx(Bs,{onClick:s}),!e&&(r?o.jsx(Ah,{onConfirm:()=>{u==null||u()},onCancel:()=>{}}):o.jsx(Dh,{onClick:()=>u==null?void 0:u()}))]})]})}function ew({id:e,name:r,description:i,isBuiltIn:s,isConfirmingDelete:l,onView:u,onEdit:f,onDuplicate:c,onDelete:d}){return o.jsxs(Ab,{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 Db({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 Lb({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(Ri,{label:i,value:e,onChange:p,placeholder:l,hint:f}),o.jsx(Ri,{label:s,value:r,onChange:g,readOnly:c,placeholder:u,hint:c?d:void 0,mono:!0})]})}function Rb(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),v=P.useCallback(()=>{m(r),c(""),u(null)},[r]),_=P.useCallback(x=>{s(x),x==="list"&&v()},[v]),E=P.useCallback(x=>{m(b=>typeof x=="function"?x(b):x)},[]),C=P.useCallback((x,b={})=>{u(x),s("edit"),m({...b}),c("")},[]),y=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:E,setSaving:p,resetForm:v,startEditing:C,startNew:y}}function Rh(){return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 mt-3 bg-accent-warning/10 border border-accent-warning/30 rounded text-xs",children:[o.jsx("span",{children:"⚠️"}),o.jsx("p",{className:"text-text-secondary",children:"Editing this value now will have the side-effect of invalidating KV-cache, causing your next message in current sessions to take a long time to process. Consider doing this between sessions."})]})}function Px({skill:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:l,onDuplicate:u,onDelete:f}){return o.jsx(ew,{id:e.id,name:e.name,description:e.description,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:l,onDuplicate:u,onDelete:f})}function tw({isOpen:e}){const r=Dr(R=>R.defaults),i=Dr(R=>R.userItems),s=Dr(R=>R.loading),l=Dr(R=>R.fetchSkills),u=Dr(R=>R.fetchSkill),f=Dr(R=>R.fetchDefaultContent),c=Dr(R=>R.createSkill),d=Dr(R=>R.updateSkill),p=Dr(R=>R.deleteSkill),{view:g,editingId:m,formError:v,saving:_,formData:E,setView:C,setEditingId:y,setFormError:x,setFormData:b,setSaving:S}=Rb(),{clearConfirm:j}=Th();P.useEffect(()=>{e&&(l(),C("list"),y(null),j())},[e,l,j]);const A=(R,U,M,Y)=>{b({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),y(R),x(""),C("edit")}else{const M=await u(R);if(!M)return;A(M,!0),y(R),x(""),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)`),y(null),x(""),C("edit")},T=()=>{b({name:"",id:"",description:"",version:"1.0.0",prompt:"",isReadOnly:!1}),C("edit")},B=async R=>{const U=await u(R);U&&(A(U,!1),y(R),x(""),C("edit"))},H=async R=>{await p(R),j()},W=async()=>{const R=m??E.id;if(!R||!E.name||!E.prompt){x("Name, ID, and prompt are required.");return}S(!0),x("");const U={metadata:{id:R,name:E.name,description:E.description,version:E.version},prompt:E.prompt},M=m?await d(m,U):await c(U);if(S(!1),!M.success){x(M.error??"Failed to save skill.");return}C("list")},K=R=>{b(U=>({...U,name:R})),m||b(U=>({...U,id:R.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))},q=E.isReadOnly;return g==="edit"?o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex justify-between items-center mb-3",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:q?E.name:m?"Edit Skill":"New Skill"}),o.jsx("button",{onClick:()=>C("list"),className:"text-text-muted hover:text-text-primary",children:"Cancel"})]}),v&&o.jsx(Lh,{message:v}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(Lb,{name:E.name,id:E.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(Ri,{label:"Description",value:E.description,onChange:R=>b(U=>({...U,description:R})),placeholder:"What this skill does...",readOnly:q}),o.jsx(Ri,{label:"Version",value:E.version,onChange:R=>b(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:E.prompt,onChange:R=>b(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.jsx(Rh,{}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-border flex-shrink-0",children:[o.jsx(nt,{variant:"secondary",onClick:()=>C("list"),children:"Cancel"}),q?o.jsx(nt,{variant:"primary",onClick:()=>{b(R=>({...R,name:R.name+" (copy)",id:`${m}-copy-${Date.now()}`,isReadOnly:!1})),y(null)},children:"Duplicate & Customize"}):o.jsx(nt,{variant:"primary",onClick:W,disabled:_||!E.name||!E.id||!E.prompt,children:_?"Saving...":"Save"})]})]}):o.jsxs("div",{children:[o.jsx(Tb,{description:"Skills provide domain-specific knowledge that agents can load on demand.",onNew:T}),o.jsxs(Db,{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(Px,{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(Px,{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 nw({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(Ma,{label:"Instructions",active:i==="instructions",onClick:()=>s("instructions")}),o.jsx(Ma,{label:"Skills",active:i==="skills",onClick:()=>s("skills")}),o.jsx(Ma,{label:"Notifications",active:i==="notifications",onClick:()=>s("notifications")}),o.jsx(Ma,{label:"Display",active:i==="display",onClick:()=>s("display")}),o.jsx(Ma,{label:"Advanced",active:i==="advanced",onClick:()=>s("advanced")})]}),i==="instructions"&&o.jsx(sw,{isOpen:e}),i==="skills"&&o.jsx(tw,{isOpen:e}),i==="notifications"&&o.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:o.jsx(QS,{})}),i==="display"&&o.jsx(iw,{}),i==="advanced"&&o.jsx(rw,{onClose:r})]})})}function rw({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(nt,{variant:"secondary",onClick:i,children:"Launch Onboarding"})]})})}function iw(){const e=en(g=>g.settings),r=en(g=>g.loading),i=en(g=>g.getSetting),s=en(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(v=>({...v,[g]:!v[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:v})=>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:v})]}),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 Ma({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 sw({isOpen:e}){const r=en(y=>y.settings),i=en(y=>y.loading),s=en(y=>y.getSetting),l=en(y=>y.setSetting),u=r[Et.GLOBAL_INSTRUCTIONS]??"",f=i[Et.GLOBAL_INSTRUCTIONS]??!1,[c,d]=P.useState(u),[p,g]=P.useState(!1),[m,v]=P.useState(!1);P.useEffect(()=>{e&&s(Et.GLOBAL_INSTRUCTIONS)},[e,s]),P.useEffect(()=>{d(u),g(!1)},[u]);const _=async()=>{v(!0),l(Et.GLOBAL_INSTRUCTIONS,c),v(!1),g(!1)},E=()=>{d(u),g(!1)},C=f||m;return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),o.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),o.jsx("textarea",{value:c,onChange:y=>{d(y.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})]}),p&&o.jsx(Rh,{}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(nt,{variant:"secondary",onClick:E,disabled:!p,children:"Discard"}),o.jsx(nt,{variant:"primary",onClick:_,disabled:!p||C,children:m?"Saving...":"Save"})]})]})}var Od={exports:{}},Fx;function aw(){return Fx||(Fx=1,(function(e,r){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(f,c,d){var p=this&&this.__decorate||function(b,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(b,S,j,A);else for(var B=b.length-1;B>=0;B--)(N=b[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(b,S){return function(j,A){S(j,A,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const m=d(9042),v=d(9924),_=d(844),E=d(4725),C=d(2585),y=d(3656);let x=c.AccessibilityManager=class extends _.Disposable{constructor(b,S,j,A){super(),this._terminal=b,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 v.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
58
+ `)))),this.register(this._terminal.onA11yTab((N=>this._handleTab(N)))),this.register(this._terminal.onKey((N=>this._handleKey(N.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,y.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,_.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(b){for(let S=0;S<b;S++)this._handleChar(" ")}_handleChar(b){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==b&&(this._charsToAnnounce+=b):this._charsToAnnounce+=b,b===`
59
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(b){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(b)||this._charsToConsume.push(b)}_refreshRows(b,S){this._liveRegionDebouncer.refresh(b,S,this._terminal.rows)}_renderRows(b,S){const j=this._terminal.buffer,A=j.lines.length.toString();for(let N=b;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(b,S){const j=b.target,A=this._rowElements[S===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||b.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(),b.preventDefault(),b.stopImmediatePropagation()}_handleSelectionChange(){var B;if(this._rowElements.length===0)return;const b=document.getSelection();if(!b)return;if(b.isCollapsed)return void(this._rowContainer.contains(b.anchorNode)&&this._terminal.clearSelection());if(!b.anchorNode||!b.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:b.anchorNode,offset:b.anchorOffset},j={node:b.focusNode,offset:b.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(b){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>b;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const b=this._coreBrowserService.mainDocument.createElement("div");return b.setAttribute("role","listitem"),b.tabIndex=-1,this._refreshRowDimensions(b),b}_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 b=0;b<this._terminal.rows;b++)this._refreshRowDimensions(this._rowElements[b])}}_refreshRowDimensions(b){b.style.height=`${this._renderService.dimensions.css.cell.height}px`}};c.AccessibilityManager=x=p([g(1,C.IInstantiationService),g(2,E.ICoreBrowserService),g(3,E.IRenderService)],x)},3614:(f,c)=>{function d(v){return v.replace(/\r?\n/g,"\r")}function p(v,_){return _?"\x1B[200~"+v+"\x1B[201~":v}function g(v,_,E,C){v=p(v=d(v),E.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),E.triggerDataEvent(v,!0),_.value=""}function m(v,_,E){const C=E.getBoundingClientRect(),y=v.clientX-C.left-10,x=v.clientY-C.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${y}px`,_.style.top=`${x}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(v,_){v.clipboardData&&v.clipboardData.setData("text/plain",_.selectionText),v.preventDefault()},c.handlePasteEvent=function(v,_,E,C){v.stopPropagation(),v.clipboardData&&g(v.clipboardData.getData("text/plain"),_,E,C)},c.paste=g,c.moveTextAreaUnderMouseCursor=m,c.rightClickHandler=function(v,_,E,C,y){m(v,_,E),y&&C.rightClickSelect(v),_.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,v){this._css.set(g,m,v)}getCss(g,m){return this._css.get(g,m)}setColor(g,m,v){this._color.set(g,m,v)}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 v=!1;return{dispose:()=>{v||(v=!0,d.removeEventListener(p,g,m))}}}},3551:function(f,c,d){var p=this&&this.__decorate||function(x,b,S,j){var A,N=arguments.length,D=N<3?b:j===null?j=Object.getOwnPropertyDescriptor(b,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(x,b,S,j);else for(var T=x.length-1;T>=0;T--)(A=x[T])&&(D=(N<3?A(D):N>3?A(b,S,D):A(b,S))||D);return N>3&&D&&Object.defineProperty(b,S,D),D},g=this&&this.__param||function(x,b){return function(S,j){b(S,j,x)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const m=d(3656),v=d(8460),_=d(844),E=d(2585),C=d(4725);let y=c.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(x,b,S,j,A){super(),this._element=x,this._mouseService=b,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 v.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new v.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(x){this._lastMouseEvent=x;const b=this._positionFromMouseEvent(x,this._element,this._mouseService);if(!b)return;this._isMouseOut=!1;const S=x.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&&b.x===this._lastBufferCell.x&&b.y===this._lastBufferCell.y||(this._handleHover(b),this._lastBufferCell=b)}_handleHover(x){if(this._activeLine!==x.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(x,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,x)||(this._clearCurrentLink(),this._askForLink(x,!0))}_askForLink(x,b){var j,A;this._activeProviderReplies&&b||((j=this._activeProviderReplies)==null||j.forEach((N=>{N==null||N.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=x.y);let S=!1;for(const[N,D]of this._linkProviderService.linkProviders.entries())b?(A=this._activeProviderReplies)!=null&&A.get(N)&&(S=this._checkLinkProviderResult(N,x,S)):D.provideLinks(x.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,x,S),((W=this._activeProviderReplies)==null?void 0:W.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(x.y,this._activeProviderReplies)}))}_removeIntersectingLinks(x,b){const S=new Set;for(let j=0;j<b.size;j++){const A=b.get(j);if(A)for(let N=0;N<A.length;N++){const D=A[N],T=D.link.range.start.y<x?0:D.link.range.start.x,B=D.link.range.end.y>x?this._bufferService.cols:D.link.range.end.x;for(let H=T;H<=B;H++){if(S.has(H)){A.splice(N--,1);break}S.add(H)}}}}_checkLinkProviderResult(x,b,S){var N;if(!this._activeProviderReplies)return S;const j=this._activeProviderReplies.get(x);let A=!1;for(let D=0;D<x;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(A=!0);if(!A&&j){const D=j.find((T=>this._linkAtPosition(T.link,b)));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,b)));if(T){S=!0,this._handleNewLink(T);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(x){if(!this._currentLink)return;const b=this._positionFromMouseEvent(x,this._element,this._mouseService);b&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,b)&&this._currentLink.link.activate(x,this._currentLink.link.text)}_clearCurrentLink(x,b){this._currentLink&&this._lastMouseEvent&&(!x||!b||this._currentLink.link.range.start.y>=x&&this._currentLink.link.range.end.y<=b)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(x){if(!this._lastMouseEvent)return;const b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._linkAtPosition(x.link,b)&&(this._currentLink=x,this._currentLink.state={decorations:{underline:x.link.decorations===void 0||x.link.decorations.underline,pointerCursor:x.link.decorations===void 0||x.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,x.link,this._lastMouseEvent),x.link.decorations={},Object.defineProperties(x.link.decorations,{pointerCursor:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.pointerCursor},set:S=>{var j;(j=this._currentLink)!=null&&j.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.underline},set:S=>{var j,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(x.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const j=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,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(x,b,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(b,!0),this._currentLink.state.decorations.pointerCursor&&x.classList.add("xterm-cursor-pointer")),b.hover&&b.hover(S,b.text)}_fireUnderlineEvent(x,b){const S=x.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);(b?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(x,b,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(b,!1),this._currentLink.state.decorations.pointerCursor&&x.classList.remove("xterm-cursor-pointer")),b.leave&&b.leave(S,b.text)}_linkAtPosition(x,b){const S=x.range.start.y*this._bufferService.cols+x.range.start.x,j=x.range.end.y*this._bufferService.cols+x.range.end.x,A=b.y*this._bufferService.cols+b.x;return S<=A&&A<=j}_positionFromMouseEvent(x,b,S){const j=S.getCoords(x,b,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(x,b,S,j,A){return{x1:x,y1:b,x2:S,y2:j,cols:this._bufferService.cols,fg:A}}};c.Linkifier=y=p([g(1,C.IMouseService),g(2,C.IRenderService),g(3,E.IBufferService),g(4,C.ILinkProviderService)],y)},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,y,x,b){var S,j=arguments.length,A=j<3?y:b===null?b=Object.getOwnPropertyDescriptor(y,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,y,x,b);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(y,x,A):S(y,x))||A);return j>3&&A&&Object.defineProperty(y,x,A),A},g=this&&this.__param||function(C,y){return function(x,b){y(x,b,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const m=d(511),v=d(2585);let _=c.OscLinkProvider=class{constructor(C,y,x){this._bufferService=C,this._optionsService=y,this._oscLinkService=x}provideLinks(C,y){var B;const x=this._bufferService.buffer.lines.get(C-1);if(!x)return void y(void 0);const b=[],S=this._optionsService.rawOptions.linkHandler,j=new m.CellData,A=x.getTrimmedLength();let N=-1,D=-1,T=!1;for(let H=0;H<A;H++)if(D!==-1||x.hasContent(H)){if(x.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||b.push({text:W,range:K,activate:(R,U)=>S?S.activate(R,U,K):E(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)}}y(b)}};function E(C,y){if(confirm(`Do you want to navigate to ${y}?
60
+
61
+ WARNING: This link could potentially be dangerous`)){const x=window.open();if(x){try{x.opener=null}catch{}x.location.href=y}else console.warn("Opening link blocked as opener could not be cleared")}}c.OscLinkProvider=_=p([g(0,v.IBufferService),g(1,v.IOptionsService),g(2,v.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),v=d(9042),_=d(3730),E=d(1680),C=d(3107),y=d(5744),x=d(2950),b=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,Ie=oe*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Ie+"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",v.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(x.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N.MouseService),this._instantiationService.setService(B.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild($);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(E.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((re=>this.scrollLines(re.amount,re.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(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(y.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(re=>{!this._overviewRulerRenderer&&re&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(b.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 Ie,He;switch(be.overrideType||be.type){case"mousemove":He=32,be.buttons===void 0?(Ie=3,be.button!==void 0&&(Ie=be.button<3?be.button:3)):Ie=1&be.buttons?0:4&be.buttons?1:2&be.buttons?2:3;break;case"mouseup":He=0,Ie=be.button<3?be.button:3;break;case"mousedown":He=1,Ie=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,Ie=4;break;default:return!1}return!(He===void 0||Ie===void 0||Ie>4)&&X.coreMouseService.triggerMouseEvent({col:Le.col,row:Le.row,x:Le.x,y:Le.y,button:Ie,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 Ie=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+=Ie;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 v=m-this._lastRefreshMs,_=this._debounceThresholdMS-v;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(x,b,S,j){var A,N=arguments.length,D=N<3?b:j===null?j=Object.getOwnPropertyDescriptor(b,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(x,b,S,j);else for(var T=x.length-1;T>=0;T--)(A=x[T])&&(D=(N<3?A(D):N>3?A(b,S,D):A(b,S))||D);return N>3&&D&&Object.defineProperty(b,S,D),D},g=this&&this.__param||function(x,b){return function(S,j){b(S,j,x)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const m=d(3656),v=d(4725),_=d(8460),E=d(844),C=d(2585);let y=c.Viewport=class extends E.Disposable{constructor(x,b,S,j,A,N,D,T){super(),this._viewportElement=x,this._scrollArea=b,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(x){this._viewportElement.style.backgroundColor=x.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(x){if(x)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const b=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==b&&(this._lastRecordedBufferHeight=b,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const x=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==x&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=x),this._refreshAnimationFrame=null}syncScrollArea(x=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(x);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(x)}_handleScroll(x){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const b=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:b,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const x=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(x*(this._smoothScrollState.target-this._smoothScrollState.origin)),x<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(x,b){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(b<0&&this._viewportElement.scrollTop!==0||b>0&&S<this._lastRecordedBufferHeight)||(x.cancelable&&x.preventDefault(),!1)}handleWheel(x){const b=this._getPixelsScrolled(x);return b!==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+b:this._smoothScrollState.target+=b,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=b,this._bubbleScroll(x,b))}scrollLines(x){if(x!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const b=x*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+b,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!1})}_getPixelsScrolled(x){if(x.deltaY===0||x.shiftKey)return 0;let b=this._applyScrollModifier(x.deltaY,x);return x.deltaMode===WheelEvent.DOM_DELTA_LINE?b*=this._currentRowHeight:x.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(b*=this._currentRowHeight*this._bufferService.rows),b}getBufferElements(x,b){var T;let S,j="";const A=[],N=b??this._bufferService.buffer.lines.length,D=this._bufferService.buffer.lines;for(let B=x;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(x){if(x.deltaY===0||x.shiftKey)return 0;let b=this._applyScrollModifier(x.deltaY,x);return x.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(b/=this._currentRowHeight+0,this._wheelPartialScroll+=b,b=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):x.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(b*=this._bufferService.rows),b}_applyScrollModifier(x,b){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&b.altKey||S==="ctrl"&&b.ctrlKey||S==="shift"&&b.shiftKey?x*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:x*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(x){this._lastTouchY=x.touches[0].pageY}handleTouchMove(x){const b=this._lastTouchY-x.touches[0].pageY;return this._lastTouchY=x.touches[0].pageY,b!==0&&(this._viewportElement.scrollTop+=b,this._bubbleScroll(x,b))}};c.Viewport=y=p([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,v.ICharSizeService),g(5,v.IRenderService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],y)},3107:function(f,c,d){var p=this&&this.__decorate||function(C,y,x,b){var S,j=arguments.length,A=j<3?y:b===null?b=Object.getOwnPropertyDescriptor(y,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,y,x,b);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(y,x,A):S(y,x))||A);return j>3&&A&&Object.defineProperty(y,x,A),A},g=this&&this.__param||function(C,y){return function(x,b){y(x,b,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const m=d(4725),v=d(844),_=d(2585);let E=c.BufferDecorationRenderer=class extends v.Disposable{constructor(C,y,x,b,S){super(),this._screenElement=C,this._bufferService=y,this._coreBrowserService=x,this._decorationService=b,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,v.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 b;const y=this._coreBrowserService.mainDocument.createElement("div");y.classList.add("xterm-decoration"),y.classList.toggle("xterm-decoration-top-layer",((b=C==null?void 0:C.options)==null?void 0:b.layer)==="top"),y.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,y.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",y.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",y.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const x=C.options.x??0;return x&&x>this._bufferService.cols&&(y.style.display="none"),this._refreshXPosition(C,y),y}_refreshStyle(C){const y=C.marker.line-this._bufferService.buffers.active.ydisp;if(y<0||y>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let x=this._decorationElements.get(C);x||(x=this._createElement(C),C.element=x,this._decorationElements.set(C,x),this._container.appendChild(x),C.onDispose((()=>{this._decorationElements.delete(C),x.remove()}))),x.style.top=y*this._renderService.dimensions.css.cell.height+"px",x.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(x)}}_refreshXPosition(C,y=C.element){if(!y)return;const x=C.options.x??0;(C.options.anchor||"left")==="right"?y.style.right=x?x*this._renderService.dimensions.css.cell.width+"px":"":y.style.left=x?x*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var y;(y=this._decorationElements.get(C))==null||y.remove(),this._decorationElements.delete(C),C.dispose()}};c.BufferDecorationRenderer=E=p([g(1,_.IBufferService),g(2,m.ICoreBrowserService),g(3,_.IDecorationService),g(4,m.IRenderService)],E)},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),v=d(4725),_=d(844),E=d(2585),C={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0},x={full:0,left:0,center:0,right:0};let b=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);y.full=this._canvas.width,y.left=S,y.center=j,y.right=S,this._refreshDrawHeightConstants(),x.full=0,x.left=0,x.center=y.left,x.right=y.left+y.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const S=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);C.left=j,C.center=j,C.right=j}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const j of this._decorationService.decorations)this._colorZoneStore.addDecoration(j);this._ctx.lineWidth=1;const S=this._colorZoneStore.zones;for(const j of S)j.position!=="full"&&this._renderColorZone(j);for(const j of S)j.position==="full"&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(x[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-C[S.position||"full"]/2),y[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[S.position||"full"]))}_queueRefresh(S,j){this._shouldUpdateDimensions=S||this._shouldUpdateDimensions,this._shouldUpdateAnchor=j||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};c.OverviewRulerRenderer=b=p([g(2,E.IBufferService),g(3,E.IDecorationService),g(4,v.IRenderService),g(5,E.IOptionsService),g(6,v.ICoreBrowserService)],b)},2950:function(f,c,d){var p=this&&this.__decorate||function(C,y,x,b){var S,j=arguments.length,A=j<3?y:b===null?b=Object.getOwnPropertyDescriptor(y,x):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,y,x,b);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(y,x,A):S(y,x))||A);return j>3&&A&&Object.defineProperty(y,x,A),A},g=this&&this.__param||function(C,y){return function(x,b){y(x,b,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const m=d(4725),v=d(2585),_=d(2584);let E=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,y,x,b,S,j){this._textarea=C,this._compositionView=y,this._bufferService=x,this._optionsService=b,this._coreService=S,this._renderService=j,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const y={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let x;this._isSendingComposition=!1,y.start+=this._dataAlreadySent.length,x=this._isComposing?this._textarea.value.substring(y.start,y.end):this._textarea.value.substring(y.start),x.length>0&&this._coreService.triggerDataEvent(x,!0)}}),0)}else{this._isSendingComposition=!1;const y=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(y,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const y=this._textarea.value,x=y.replace(C,"");this._dataAlreadySent=x,y.length>C.length?this._coreService.triggerDataEvent(x,!0):y.length<C.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):y.length===C.length&&y!==C&&this._coreService.triggerDataEvent(y,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const y=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),x=this._renderService.dimensions.css.cell.height,b=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,S=y*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=S+"px",this._compositionView.style.top=b+"px",this._compositionView.style.height=x+"px",this._compositionView.style.lineHeight=x+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const j=this._compositionView.getBoundingClientRect();this._textarea.style.left=S+"px",this._textarea.style.top=b+"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=E=p([g(2,v.IBufferService),g(3,v.IOptionsService),g(4,v.ICoreService),g(5,m.IRenderService)],E)},9806:(f,c)=>{function d(p,g,m){const v=m.getBoundingClientRect(),_=p.getComputedStyle(m),E=parseInt(_.getPropertyValue("padding-left")),C=parseInt(_.getPropertyValue("padding-top"));return[g.clientX-v.left-E,g.clientY-v.top-C]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=d,c.getCoords=function(p,g,m,v,_,E,C,y,x){if(!E)return;const b=d(p,g,m);return b?(b[0]=Math.ceil((b[0]+(x?C/2:0))/C),b[1]=Math.ceil(b[1]/y),b[0]=Math.min(Math.max(b[0],1),v+(x?1:0)),b[1]=Math.min(Math.max(b[1],1),_),b):void 0}},9504:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const p=d(2584);function g(y,x,b,S){const j=y-m(y,b),A=x-m(x,b),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=v(D,T)==="A"?-1:1,U=B.buffer.lines.get(W+R*q);U!=null&&U.isWrapped&&H++}return H})(y,x,b);return C(N,E(v(y,x),S))}function m(y,x){let b=0,S=x.buffer.lines.get(y),j=S==null?void 0:S.isWrapped;for(;j&&y>=0&&y<x.rows;)b++,S=x.buffer.lines.get(--y),j=S==null?void 0:S.isWrapped;return b}function v(y,x){return y>x?"A":"B"}function _(y,x,b,S,j,A){let N=y,D=x,T="";for(;N!==b||D!==S;)N+=j?1:-1,j&&N>A.cols-1?(T+=A.buffer.translateBufferLineToString(D,!1,y,N),N=0,y=0,D++):!j&&N<0&&(T+=A.buffer.translateBufferLineToString(D,!1,0,y+1),N=A.cols-1,y=N,D--);return T+A.buffer.translateBufferLineToString(D,!1,y,N)}function E(y,x){const b=x?"O":"[";return p.C0.ESC+b+y}function C(y,x){y=Math.floor(y);let b="";for(let S=0;S<y;S++)b+=x;return b}c.moveToCellSequence=function(y,x,b,S){const j=b.buffer.x,A=b.buffer.y;if(!b.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,E("D",q))})(j,A,0,x,b,S)+g(A,x,b,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,E(M,q))})(j,A,y,x,b,S);let N;if(A===x)return N=j>y?"D":"C",C(Math.abs(j-y),E(N,S));N=A>x?"D":"C";const D=Math.abs(A-x);return C((function(T,B){return B.cols-T})(A>x?y:j,b)+(D-1)*b.cols+1+((A>x?j:y)-1),E(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),v=d(2550),_=d(2223),E=d(6171),C=d(6052),y=d(4725),x=d(8055),b=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 b.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,E.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ee=>this._injectCss(ee)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(m.DomRendererRowFactory,document),this._element.classList.add(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 v.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: ${x.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: ${x.color.multiplyOpacity(z,.5).css}; }${this._terminalSelector} .${T}${Z} { background-color: ${z.css}; }`;R+=`${this._terminalSelector} .${D}${_.INVERTED_DEFAULT_COLOR} { color: ${x.color.opaque(q.background).css}; }${this._terminalSelector} .${D}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${x.color.multiplyOpacity(x.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,y.ICharSizeService),g(9,j.IOptionsService),g(10,j.IBufferService),g(11,y.ICoreBrowserService),g(12,y.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),v=d(643),_=d(511),E=d(2585),C=d(8055),y=d(4725),x=d(4269),b=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 Ie=this._workCell.getWidth();if(Ie===0)continue;let He=!1,Ue=Le,je=this._workCell;if(Z.length>0&&Le===Z[0][0]){He=!0;const Ze=Z.shift();je=new x.JoinedCellData(this._workCell,N.translateToString(!0,Ze[0],Ze[1]),Ze[1]-Ze[0]),Ue=Ze[1]-1,Ie=je.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=je.getChars()||v.WHITESPACE_CELL_CHAR;if(fe===" "&&(je.isUnderline()||je.isOverline())&&(fe=" "),re=Ie*q-R.get(fe,je.isBold(),je.isItalic()),L){if(V&&(me&&oe||!me&&!oe&&je.bg===ie)&&(me&&oe&&z.selectionForeground||je.fg===Q)&&je.extended.ext===ee&&$e===X&&re===$&&!Te&&!He&&!Rt){je.isInvisible()?F+=v.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=je.bg,Q=je.fg,ee=je.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(je.isBold()&&ve.push("xterm-bold"),je.isItalic()&&ve.push("xterm-italic"),je.isDim()&&ve.push("xterm-dim"),F=je.isInvisible()?v.WHITESPACE_CELL_CHAR:je.getChars()||v.WHITESPACE_CELL_CHAR,je.isUnderline()&&(ve.push(`xterm-underline-${je.extended.underlineStyle}`),F===" "&&(F=" "),!je.isUnderlineColorDefault()))if(je.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(je.getUnderlineColor()).join(",")})`;else{let Ze=je.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&je.isBold()&&Ze<8&&(Ze+=8),L.style.textDecorationColor=z.ansi[Ze].css}je.isOverline()&&(ve.push("xterm-overline"),F===" "&&(F=" ")),je.isStrikethrough()&&ve.push("xterm-strikethrough"),$e&&(L.style.textDecoration="underline");let Ae=je.getFgColor(),Be=je.getFgColorMode(),ot=je.getBgColor(),ue=je.getBgColorMode();const _e=!!je.isInverse();if(_e){const Ze=Ae;Ae=ot,ot=Ze;const Ot=Be;Be=ue,ue=Ot}let Ne,Oe,qe,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,Ne=Ze.backgroundColorRGB),Ze.foregroundColorRGB&&(Be=50331648,Ae=Ze.foregroundColorRGB.rgba>>8&16777215,Oe=Ze.foregroundColorRGB),Nt=Ze.options.layer==="top")})),!Nt&&me&&(Ne=this._coreBrowserService.isFocused?z.selectionBackgroundOpaque:z.selectionInactiveBackgroundOpaque,ot=Ne.rgba>>8&16777215,ue=50331648,Nt=!0,z.selectionForeground&&(Be=50331648,Ae=z.selectionForeground.rgba>>8&16777215,Oe=z.selectionForeground)),Nt&&ve.push("xterm-decoration-top"),ue){case 16777216:case 33554432:qe=z.ansi[ot],ve.push(`xterm-bg-${ot}`);break;case 50331648:qe=C.channels.toColor(ot>>16,ot>>8&255,255&ot),this._addStyle(L,`background-color:#${A((ot>>>0).toString(16),"0",6)}`);break;default:_e?(qe=z.foreground,ve.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):qe=z.background}switch(Ne||je.isDim()&&(Ne=C.color.multiplyOpacity(qe,.5)),Be){case 16777216:case 33554432:je.isBold()&&Ae<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ae+=8),this._applyMinimumContrast(L,qe,z.ansi[Ae],je,Ne,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,qe,Ze,je,Ne,Oe)||this._addStyle(L,`color:#${A(Ae.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,qe,z.foreground,je,Ne,Oe)||_e&&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,b.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,y.ICharacterJoinerService),g(2,E.IOptionsService),g(3,y.ICoreBrowserService),g(4,E.ICoreService),g(5,E.IDecorationService),g(6,y.IThemeService)],j)},2550:(f,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 v=d.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontStyle="italic";const _=d.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[g,m,v,_],this._container.appendChild(g),this._container.appendChild(m),this._container.appendChild(v),this._container.appendChild(_),p.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(d,p,g,m){d===this._font&&p===this._fontSize&&g===this._weight&&m===this._weightBold||(this._font=d,this._fontSize=p,this._weight=g,this._weightBold=m,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${m}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${m}`,this.clear())}get(d,p,g){let m=0;if(!p&&!g&&d.length===1&&(m=d.charCodeAt(0))<256){if(this._flat[m]!==-9999)return this._flat[m];const E=this._measure(d,0);return E>0&&(this._flat[m]=E),E}let v=d;p&&(v+="B"),g&&(v+="I");let _=this._holey.get(v);if(_===void 0){let E=0;p&&(E|=1),g&&(E|=2),_=this._measure(d,E),_>0&&this._holey.set(v,_)}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,v,_){return m===1&&v>Math.ceil(1.5*_)&&g!==void 0&&g>255&&!p(g)&&!d(g)&&!(function(E){return 57344<=E&&E<=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,v=0){return(g-(2*Math.round(m)-v))%(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,v,_=!1){if(this.selectionStart=m,this.selectionEnd=v,!m||!v||m[0]===v[0]&&m[1]===v[1])return void this.clear();const E=g.buffers.active.ydisp,C=m[1]-E,y=v[1]-E,x=Math.max(C,0),b=Math.min(y,g.rows-1);x>=g.rows||b<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=C,this.viewportEndRow=y,this.viewportCappedStartRow=x,this.viewportCappedEndRow=b,this.startCol=m[0],this.endCol=v[0])}isCellSelected(g,m,v){return!!this.hasSelection&&(v-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&v>=this.viewportCappedStartRow&&m<this.endCol&&v<=this.viewportCappedEndRow:m<this.startCol&&v>=this.viewportCappedStartRow&&m>=this.endCol&&v<=this.viewportCappedEndRow:v>this.viewportStartRow&&v<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&v===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===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(b,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(b,S,j,A);else for(var B=b.length-1;B>=0;B--)(N=b[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(b,S){return function(j,A){S(j,A,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const m=d(2585),v=d(8460),_=d(844);let E=c.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(b,S,j){super(),this._optionsService=j,this.width=0,this.height=0,this._onCharSizeChange=this.register(new v.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new x(this._optionsService))}catch{this._measureStrategy=this.register(new y(b,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const b=this._measureStrategy.measure();b.width===this.width&&b.height===this.height||(this.width=b.width,this.height=b.height,this._onCharSizeChange.fire())}};c.CharSizeService=E=p([g(2,m.IOptionsService)],E);class C extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,j){S!==void 0&&S>0&&j!==void 0&&j>0&&(this._result.width=S,this._result.height=j)}}class y extends C{constructor(S,j,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 x extends C{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const j=this._ctx.measureText("W");if(!("width"in j&&"fontBoundingBoxAscent"in j&&"fontBoundingBoxDescent"in j))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(f,c,d){var p=this&&this.__decorate||function(x,b,S,j){var A,N=arguments.length,D=N<3?b:j===null?j=Object.getOwnPropertyDescriptor(b,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(x,b,S,j);else for(var T=x.length-1;T>=0;T--)(A=x[T])&&(D=(N<3?A(D):N>3?A(b,S,D):A(b,S))||D);return N>3&&D&&Object.defineProperty(b,S,D),D},g=this&&this.__param||function(x,b){return function(S,j){b(S,j,x)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const m=d(3734),v=d(643),_=d(511),E=d(2585);class C extends m.AttributeData{constructor(b,S,j){super(),this.content=0,this.combinedData="",this.fg=b.fg,this.bg=b.bg,this.combinedData=S,this._width=j}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(b){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.JoinedCellData=C;let y=c.CharacterJoinerService=class Ob{constructor(b){this._bufferService=b,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(b){const S={id:this._nextCharacterJoinerId++,handler:b};return this._characterJoiners.push(S),S.id}deregister(b){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===b)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(b){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(b);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||v.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(b,S,j,A,N){const D=b.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++)Ob._mergeRanges(T,H[W])}catch(H){console.error(H)}return this._stringRangesToCellRanges(T,A,N),T}_stringRangesToCellRanges(b,S,j){let A=0,N=!1,D=0,T=b[A];if(T){for(let B=j;B<this._bufferService.cols;B++){const H=S.getWidth(B),W=S.getString(B).length||v.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=b[++A],!T)break;T[0]<=D?(T[0]=B,N=!0):N=!1}D+=W}}T&&(T[1]=this._bufferService.cols)}}static _mergeRanges(b,S){let j=!1;for(let A=0;A<b.length;A++){const N=b[A];if(j){if(S[1]<=N[0])return b[A-1][1]=S[1],b;if(S[1]<=N[1])return b[A-1][1]=Math.max(S[1],N[1]),b.splice(A,1),b;b.splice(A,1),A--}else{if(S[1]<=N[0])return b.splice(A,0,S),b;if(S[1]<=N[1])return N[0]=Math.min(S[0],N[0]),b;S[0]<N[1]&&(N[0]=Math.min(S[0],N[0]),j=!0)}}return j?b[b.length-1][1]=S[1]:b.push(S),b}};c.CharacterJoinerService=y=p([g(0,E.IBufferService)],y)},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 v extends p.Disposable{constructor(C,y,x){super(),this._textarea=C,this._window=y,this.mainDocument=x,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((b=>this._screenDprMonitor.setWindow(b)))),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=v;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(v){return this.linkProviders.push(v),{dispose:()=>{const _=this.linkProviders.indexOf(v);_!==-1&&this.linkProviders.splice(_,1)}}}}c.LinkProviderService=g},8934:function(f,c,d){var p=this&&this.__decorate||function(E,C,y,x){var b,S=arguments.length,j=S<3?C:x===null?x=Object.getOwnPropertyDescriptor(C,y):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(E,C,y,x);else for(var A=E.length-1;A>=0;A--)(b=E[A])&&(j=(S<3?b(j):S>3?b(C,y,j):b(C,y))||j);return S>3&&j&&Object.defineProperty(C,y,j),j},g=this&&this.__param||function(E,C){return function(y,x){C(y,x,E)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const m=d(4725),v=d(9806);let _=c.MouseService=class{constructor(E,C){this._renderService=E,this._charSizeService=C}getCoords(E,C,y,x,b){return(0,v.getCoords)(window,E,C,y,x,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,b)}getMouseReportCoords(E,C){const y=(0,v.getCoordsRelativeToElement)(window,E,C);if(this._charSizeService.hasValidSize)return y[0]=Math.min(Math.max(y[0],0),this._renderService.dimensions.css.canvas.width-1),y[1]=Math.min(Math.max(y[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(y[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(y[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(y[0]),y:Math.floor(y[1])}}};c.MouseService=_=p([g(0,m.IRenderService),g(1,m.ICharSizeService)],_)},3230:function(f,c,d){var p=this&&this.__decorate||function(b,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(b,S,j,A);else for(var B=b.length-1;B>=0;B--)(N=b[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(b,S){return function(j,A){S(j,A,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const m=d(6193),v=d(4725),_=d(8460),E=d(844),C=d(7226),y=d(2585);let x=c.RenderService=class extends E.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(b,S,j,A,N,D,T,B){super(),this._rowCount=b,this._charSizeService=A,this._renderer=this.register(new E.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new E.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer(((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(b,S){if("IntersectionObserver"in b){const j=new b.IntersectionObserver((A=>this._handleIntersectionChange(A[A.length-1])),{threshold:0});j.observe(S),this._observerDisposable.value=(0,E.toDisposable)((()=>j.disconnect()))}}_handleIntersectionChange(b){this._isPaused=b.isIntersecting===void 0?b.intersectionRatio===0:!b.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(b,S,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(b,S,this._rowCount))}_renderRows(b,S){this._renderer.value&&(b=Math.min(b,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(b,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:b,end:S}),this._onRender.fire({start:b,end:S}),this._isNextRenderRedrawOnly=!0)}resize(b,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(b){this._renderer.value=b,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(b){return this._renderDebouncer.addRefreshCallback(b)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var b,S;this._renderer.value&&((S=(b=this._renderer.value).clearTextureAtlas)==null||S.call(b),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(b,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(b,S)})):this._renderer.value.handleResize(b,S),this._fullRefresh())}handleCharSizeChanged(){var b;(b=this._renderer.value)==null||b.handleCharSizeChanged()}handleBlur(){var b;(b=this._renderer.value)==null||b.handleBlur()}handleFocus(){var b;(b=this._renderer.value)==null||b.handleFocus()}handleSelectionChanged(b,S,j){var A;this._selectionState.start=b,this._selectionState.end=S,this._selectionState.columnSelectMode=j,(A=this._renderer.value)==null||A.handleSelectionChanged(b,S,j)}handleCursorMove(){var b;(b=this._renderer.value)==null||b.handleCursorMove()}clear(){var b;(b=this._renderer.value)==null||b.clear()}};c.RenderService=x=p([g(2,y.IOptionsService),g(3,v.ICharSizeService),g(4,y.IDecorationService),g(5,y.IBufferService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],x)},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),v=d(9504),_=d(456),E=d(4725),C=d(8460),y=d(844),x=d(6114),b=d(4841),S=d(511),j=d(2585),A=" ",N=new RegExp(A,"g");let D=c.SelectionService=class extends y.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,y.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const 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(x.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()))),x.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,b.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 x.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&&!(x.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,v.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,b.getRangeLength)(H,this._bufferService.cols)}};c.SelectionService=D=p([g(3,j.IBufferService),g(4,j.ICoreService),g(5,E.IMouseService),g(6,j.IOptionsService),g(7,E.IRenderService),g(8,E.ICoreBrowserService)],D)},4725:(f,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),v=d(8055),_=d(8460),E=d(844),C=d(2585),y=v.css.toColor("#ffffff"),x=v.css.toColor("#000000"),b=v.css.toColor("#ffffff"),S=v.css.toColor("#000000"),j={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[v.css.toColor("#2e3436"),v.css.toColor("#cc0000"),v.css.toColor("#4e9a06"),v.css.toColor("#c4a000"),v.css.toColor("#3465a4"),v.css.toColor("#75507b"),v.css.toColor("#06989a"),v.css.toColor("#d3d7cf"),v.css.toColor("#555753"),v.css.toColor("#ef2929"),v.css.toColor("#8ae234"),v.css.toColor("#fce94f"),v.css.toColor("#729fcf"),v.css.toColor("#ad7fa8"),v.css.toColor("#34e2e2"),v.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:v.channels.toCss(H,W,K),rgba:v.channels.toRgba(H,W,K)})}for(let B=0;B<24;B++){const H=8+10*B;D.push({css:v.channels.toCss(H,H,H),rgba:v.channels.toRgba(H,H,H)})}return D})());let A=c.ThemeService=class extends E.Disposable{get colors(){return this._colors}constructor(D){super(),this._optionsService=D,this._contrastCache=new m.ColorContrastCache,this._halfContrastCache=new m.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:y,background:x,cursor:b,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:v.color.blend(x,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:v.color.blend(x,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,y),T.background=N(D.background,x),T.cursor=N(D.cursor,b),T.cursorAccent=N(D.cursorAccent,S),T.selectionBackgroundTransparent=N(D.selectionBackground,j),T.selectionBackgroundOpaque=v.color.blend(T.background,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundTransparent=N(D.selectionInactiveBackground,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundOpaque=v.color.blend(T.background,T.selectionInactiveBackgroundTransparent),T.selectionForeground=D.selectionForeground?N(D.selectionForeground,v.NULL_COLOR):void 0,T.selectionForeground===v.NULL_COLOR&&(T.selectionForeground=void 0),v.color.isOpaque(T.selectionBackgroundTransparent)&&(T.selectionBackgroundTransparent=v.color.opacity(T.selectionBackgroundTransparent,.3)),v.color.isOpaque(T.selectionInactiveBackgroundTransparent)&&(T.selectionInactiveBackgroundTransparent=v.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 v.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 E=new Array(_);for(let C=0;C<Math.min(_,this.length);C++)E[C]=this._array[this._getCyclicIndex(C)];this._array=E,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let E=this._length;E<_;E++)this._array[E]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,E){this._array[this._getCyclicIndex(_)]=E}push(_){this._array[this._getCyclicIndex(this._length)]=_,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(_,E,...C){if(E){for(let y=_;y<this._length-E;y++)this._array[this._getCyclicIndex(y)]=this._array[this._getCyclicIndex(y+E)];this._length-=E,this.onDeleteEmitter.fire({index:_,amount:E})}for(let y=this._length-1;y>=_;y--)this._array[this._getCyclicIndex(y+C.length)]=this._array[this._getCyclicIndex(y)];for(let y=0;y<C.length;y++)this._array[this._getCyclicIndex(_+y)]=C[y];if(C.length&&this.onInsertEmitter.fire({index:_,amount:C.length}),this._length+C.length>this._maxLength){const y=this._length+C.length-this._maxLength;this._startIndex+=y,this._length=this._maxLength,this.onTrimEmitter.fire(y)}else this._length+=C.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,E,C){if(!(E<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let x=E-1;x>=0;x--)this.set(_+x+C,this.get(_+x));const y=_+E+C-this._length;if(y>0)for(this._length+=y;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let y=0;y<E;y++)this.set(_+y+C,this.get(_+y))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}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 v in p)m[v]=g<=1?p[v]:p[v]&&d(p[v],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 v,_,E,C,y;function x(S){const j=S.toString(16);return j.length<2?"0"+j:j}function b(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?`#${x(j)}${x(A)}${x(N)}${x(D)}`:`#${x(j)}${x(A)}${x(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)}}})(v||(c.channels=v={})),(function(S){function j(A,N){return m=Math.round(255*N),[d,p,g]=y.toChannels(A.rgba),{css:v.toCss(d,p,g,m),rgba:v.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:v.toCss(d,p,g),rgba:v.toRgba(d,p,g)}},S.isOpaque=function(A){return(255&A.rgba)==255},S.ensureContrastRatio=function(A,N,D){const T=y.ensureContrastRatio(A.rgba,N.rgba,D);if(T)return v.toColor(T>>24&255,T>>16&255,T>>8&255)},S.opaque=function(A){const N=(255|A.rgba)>>>0;return[d,p,g]=y.toChannels(N),{css:v.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),v.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),v.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]))),v.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:v.toRgba(d,p,g,m),css:N}}})(E||(c.css=E={})),(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=b(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=b(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=b(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=b(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),v.toRgba(d,p,g)},S.ensureContrastRatio=function(N,D,T){const B=C.relativeLuminance(N>>8),H=C.relativeLuminance(D>>8);if(b(B,H)<T){if(H<B){const q=j(N,D,T),R=b(B,C.relativeLuminance(q>>8));if(R<T){const U=A(N,D,T);return R>b(B,C.relativeLuminance(U>>8))?q:U}return q}const W=A(N,D,T),K=b(B,C.relativeLuminance(W>>8));if(K<T){const q=j(N,D,T);return K>b(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]}})(y||(c.rgba=y={})),c.toPaddedHex=x,c.contrastRatio=b},8969:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const p=d(844),g=d(2585),m=d(4348),v=d(7866),_=d(744),E=d(7302),C=d(6975),y=d(8460),x=d(1753),b=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 y.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 y.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new y.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new y.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new y.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new y.EventEmitter),this._instantiationService=new m.InstantiationService,this.optionsService=this.register(new E.OptionsService(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(v.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(x.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(b.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,y.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,y.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,y.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,y.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((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,y.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),v=d(7116),_=d(2015),E=d(844),C=d(482),y=d(8437),x=d(8460),b=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 E.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=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new x.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new x.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new x.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new x.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new x.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new x.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new x.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new x.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new x.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new x.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new x.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new x.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new x.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new 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 v.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 Ie=N.UnicodeService.extractShouldJoin(Le),He=Ie?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 je=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 y.BufferLine&&re.copyCellsFrom(Ue,je,0,He,!1);je<ee;)Ue.setCellFromCodepoint(je++,0,1,oe)}else if(this._activeBuffer.x=ee-1,F===2)continue}if(Ie&&this._activeBuffer.x){const Ue=re.getWidth(this._activeBuffer.x-1)?1:2;re.addCodepointToCell(this._activeBuffer.x-Ue,V,F);for(let je=F-He;--je>=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,b.NULL_CELL_CODE,b.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(y.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const 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,v.DEFAULT_CHARSET),this._charsetService.setgCharset(1,v.DEFAULT_CHARSET),this._charsetService.setgCharset(2,v.DEFAULT_CHARSET),this._charsetService.setgCharset(3,v.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=Ie=>Ie?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=y.DEFAULT_ATTR_DATA.fg,z.bg=y.DEFAULT_ATTR_DATA.bg,z.extended=z.extended.clone(),z.extended.underlineStyle=0,z.extended.underlineColor&=-67108864,z.updateExtended()}charAttributes(z){if(z.length===1&&z.params[0]===0)return this._processSGR0(this._curAttrData),!0;const 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&y.DEFAULT_ATTR_DATA.fg):I===49?(V.bg&=-67108864,V.bg|=16777215&y.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&y.DEFAULT_ATTR_DATA.fg,V.bg&=-67108864,V.bg|=16777215&y.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=y.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(z){const 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,v.DEFAULT_CHARSET),!0}selectCharset(z){return z.length!==2?(this.selectDefaultCharset(),!0):(z[0]==="/"||this._charsetService.setgCharset(H[z[0]],v.CHARSETS[z[1]]||v.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const z=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,z,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(z){return this._charsetService.setgLevel(z),!0}screenAlignmentPattern(){const z=new S.CellData;z.content=4194373,z.fg=this._curAttrData.fg,z.bg=this._curAttrData.bg,this._setCursor(0,0);for(let 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,v){this._data[g]||(this._data[g]={}),this._data[g][m]=v}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,v,_){this._data.get(p,g)||this._data.set(p,g,new d),this._data.get(p,g).set(m,v,_)}get(p,g,m,v){var _;return(_=this._data.get(p,g))==null?void 0:_.get(m,v)}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 v=g+m>>1;const _=this._getKey(this._array[v]);if(_>p)m=v-1;else{if(!(_<p)){for(;v>0&&this._getKey(this._array[v-1])===p;)v--;return v}g=v+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 E=0,C=0,y=_.timeRemaining(),x=0;for(;this._i<this._tasks.length;){if(E=Date.now(),this._tasks[this._i]()||this._i++,E=Math.max(1,Date.now()-E),C=Math.max(E,C),x=_.timeRemaining(),1.5*C>x)return y-E<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(y-E))}ms`),void this._start();y=x}this.clear()}}class m extends g{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const E=Date.now()+_;return{timeRemaining:()=>Math.max(0,E-Date.now())}}}c.PriorityTaskQueue=m,c.IdleTaskQueue=!p.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(v){return requestIdleCallback(v)}_cancelCallback(v){cancelIdleCallback(v)}}:m,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(v){this._queue.clear(),this._queue.enqueue(v)}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),v=m==null?void 0:m.get(g.cols-1),_=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);_&&v&&(_.isWrapped=v[p.CHAR_DATA_CODE_INDEX]!==p.NULL_CELL_CODE&&v[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,v=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=v}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),v=d(8437),_=d(4634),E=d(511),C=d(643),y=d(4863),x=d(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(b,S,j){this._hasScrollback=b,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=v.DEFAULT_ATTR_DATA.clone(),this.savedCharset=x.DEFAULT_CHARSET,this.markers=[],this._nullCell=E.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=E.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new p.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(b){return b?(this._nullCell.fg=b.fg,this._nullCell.bg=b.bg,this._nullCell.extended=b.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(b){return b?(this._whitespaceCell.fg=b.fg,this._whitespaceCell.bg=b.bg,this._whitespaceCell.extended=b.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(b,S){return new v.BufferLine(this._bufferService.cols,this.getNullCell(b),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const b=this.ybase+this.y-this.ydisp;return b>=0&&b<this._rows}_getCorrectBufferLength(b){if(!this._hasScrollback)return b;const S=b+this._optionsService.rawOptions.scrollback;return S>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:S}fillViewportRows(b){if(this.lines.length===0){b===void 0&&(b=v.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(b))}}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(b,S){const j=this.getNullCell(v.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<b)for(let T=0;T<this.lines.length;T++)A+=+this.lines.get(T).resize(b,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 v.BufferLine(b,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 v.BufferLine(b,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,b-1),this.y=Math.min(this.y,S-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,b-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(b,S),this._cols>b))for(let D=0;D<this.lines.length;D++)A+=+this.lines.get(D).resize(b,j);this._cols=b,this._rows=S,this._memoryCleanupQueue.clear(),A>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let b=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,b=!1);let S=0;for(;this._memoryCleanupPosition<this.lines.length;)if(S+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),S>100)return!0;return b}get _isReflowEnabled(){const b=this._optionsService.rawOptions.windowsPty;return b&&b.buildNumber?this._hasScrollback&&b.backend==="conpty"&&b.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(b,S){this._cols!==b&&(b>this._cols?this._reflowLarger(b,S):this._reflowSmaller(b,S))}_reflowLarger(b,S){const j=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,b,this.ybase+this.y,this.getNullCell(v.DEFAULT_ATTR_DATA));if(j.length>0){const A=(0,_.reflowLargerCreateNewLayout)(this.lines,j);(0,_.reflowLargerApplyNewLayout)(this.lines,A.layout),this._reflowLargerAdjustViewport(b,S,A.countRemoved)}}_reflowLargerAdjustViewport(b,S,j){const A=this.getNullCell(v.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 v.BufferLine(b,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(b,S){const j=this.getNullCell(v.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()<=b)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,b),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(v.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]<b&&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(b,S,j=0,A){const N=this.lines.get(b);return N?N.translateToString(S,j,A):""}getWrappedRangeForLine(b){let S=b,j=b;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(b){for(b!=null?this.tabs[b]||(b=this.prevStop(b)):(this.tabs={},b=0);b<this._cols;b+=this._optionsService.rawOptions.tabStopWidth)this.tabs[b]=!0}prevStop(b){for(b==null&&(b=this.x);!this.tabs[--b]&&b>0;);return b>=this._cols?this._cols-1:b<0?0:b}nextStop(b){for(b==null&&(b=this.x);!this.tabs[++b]&&b<this._cols;);return b>=this._cols?this._cols-1:b<0?0:b}clearMarkers(b){this._isClearing=!0;for(let S=0;S<this.markers.length;S++)this.markers[S].line===b&&(this.markers[S].dispose(),this.markers.splice(S--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let b=0;b<this.markers.length;b++)this.markers[b].dispose(),this.markers.splice(b--,1);this._isClearing=!1}addMarker(b){const S=new y.Marker(b);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(b){this._isClearing||this.markers.splice(this.markers.indexOf(b),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),v=d(482);c.DEFAULT_ATTR_DATA=Object.freeze(new p.AttributeData);let _=0;class E{constructor(y,x,b=!1){this.isWrapped=b,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*y);const S=x||g.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let j=0;j<y;++j)this.setCell(j,S);this.length=y}get(y){const x=this._data[3*y+0],b=2097151&x;return[this._data[3*y+1],2097152&x?this._combined[y]:b?(0,v.stringFromCodePoint)(b):"",x>>22,2097152&x?this._combined[y].charCodeAt(this._combined[y].length-1):b]}set(y,x){this._data[3*y+1]=x[m.CHAR_DATA_ATTR_INDEX],x[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[y]=x[1],this._data[3*y+0]=2097152|y|x[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*y+0]=x[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(y){return this._data[3*y+0]>>22}hasWidth(y){return 12582912&this._data[3*y+0]}getFg(y){return this._data[3*y+1]}getBg(y){return this._data[3*y+2]}hasContent(y){return 4194303&this._data[3*y+0]}getCodePoint(y){const x=this._data[3*y+0];return 2097152&x?this._combined[y].charCodeAt(this._combined[y].length-1):2097151&x}isCombined(y){return 2097152&this._data[3*y+0]}getString(y){const x=this._data[3*y+0];return 2097152&x?this._combined[y]:2097151&x?(0,v.stringFromCodePoint)(2097151&x):""}isProtected(y){return 536870912&this._data[3*y+2]}loadCell(y,x){return _=3*y,x.content=this._data[_+0],x.fg=this._data[_+1],x.bg=this._data[_+2],2097152&x.content&&(x.combinedData=this._combined[y]),268435456&x.bg&&(x.extended=this._extendedAttrs[y]),x}setCell(y,x){2097152&x.content&&(this._combined[y]=x.combinedData),268435456&x.bg&&(this._extendedAttrs[y]=x.extended),this._data[3*y+0]=x.content,this._data[3*y+1]=x.fg,this._data[3*y+2]=x.bg}setCellFromCodepoint(y,x,b,S){268435456&S.bg&&(this._extendedAttrs[y]=S.extended),this._data[3*y+0]=x|b<<22,this._data[3*y+1]=S.fg,this._data[3*y+2]=S.bg}addCodepointToCell(y,x,b){let S=this._data[3*y+0];2097152&S?this._combined[y]+=(0,v.stringFromCodePoint)(x):2097151&S?(this._combined[y]=(0,v.stringFromCodePoint)(2097151&S)+(0,v.stringFromCodePoint)(x),S&=-2097152,S|=2097152):S=x|4194304,b&&(S&=-12582913,S|=b<<22),this._data[3*y+0]=S}insertCells(y,x,b){if((y%=this.length)&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,b),x<this.length-y){const S=new g.CellData;for(let j=this.length-y-x-1;j>=0;--j)this.setCell(y+x+j,this.loadCell(y+j,S));for(let j=0;j<x;++j)this.setCell(y+j,b)}else for(let S=y;S<this.length;++S)this.setCell(S,b);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,b)}deleteCells(y,x,b){if(y%=this.length,x<this.length-y){const S=new g.CellData;for(let j=0;j<this.length-y-x;++j)this.setCell(y+j,this.loadCell(y+x+j,S));for(let j=this.length-x;j<this.length;++j)this.setCell(j,b)}else for(let S=y;S<this.length;++S)this.setCell(S,b);y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,b),this.getWidth(y)!==0||this.hasContent(y)||this.setCellFromCodepoint(y,0,1,b)}replaceCells(y,x,b,S=!1){if(S)for(y&&this.getWidth(y-1)===2&&!this.isProtected(y-1)&&this.setCellFromCodepoint(y-1,0,1,b),x<this.length&&this.getWidth(x-1)===2&&!this.isProtected(x)&&this.setCellFromCodepoint(x,0,1,b);y<x&&y<this.length;)this.isProtected(y)||this.setCell(y,b),y++;else for(y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,b),x<this.length&&this.getWidth(x-1)===2&&this.setCellFromCodepoint(x,0,1,b);y<x&&y<this.length;)this.setCell(y++,b)}resize(y,x){if(y===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const b=3*y;if(y>this.length){if(this._data.buffer.byteLength>=4*b)this._data=new Uint32Array(this._data.buffer,0,b);else{const S=new Uint32Array(b);S.set(this._data),this._data=S}for(let S=this.length;S<y;++S)this.setCell(S,x)}else{this._data=this._data.subarray(0,b);const S=Object.keys(this._combined);for(let A=0;A<S.length;A++){const N=parseInt(S[A],10);N>=y&&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>=y&&delete this._extendedAttrs[N]}}return this.length=y,4*b*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const y=new Uint32Array(this._data.length);return y.set(this._data),this._data=y,1}return 0}fill(y,x=!1){if(x)for(let b=0;b<this.length;++b)this.isProtected(b)||this.setCell(b,y);else{this._combined={},this._extendedAttrs={};for(let b=0;b<this.length;++b)this.setCell(b,y)}}copyFrom(y){this.length!==y.length?this._data=new Uint32Array(y._data):this._data.set(y._data),this.length=y.length,this._combined={};for(const x in y._combined)this._combined[x]=y._combined[x];this._extendedAttrs={};for(const x in y._extendedAttrs)this._extendedAttrs[x]=y._extendedAttrs[x];this.isWrapped=y.isWrapped}clone(){const y=new E(0);y._data=new Uint32Array(this._data),y.length=this.length;for(const x in this._combined)y._combined[x]=this._combined[x];for(const x in this._extendedAttrs)y._extendedAttrs[x]=this._extendedAttrs[x];return y.isWrapped=this.isWrapped,y}getTrimmedLength(){for(let y=this.length-1;y>=0;--y)if(4194303&this._data[3*y+0])return y+(this._data[3*y+0]>>22);return 0}getNoBgTrimmedLength(){for(let y=this.length-1;y>=0;--y)if(4194303&this._data[3*y+0]||50331648&this._data[3*y+2])return y+(this._data[3*y+0]>>22);return 0}copyCellsFrom(y,x,b,S,j){const A=y._data;if(j)for(let D=S-1;D>=0;D--){for(let T=0;T<3;T++)this._data[3*(b+D)+T]=A[3*(x+D)+T];268435456&A[3*(x+D)+2]&&(this._extendedAttrs[b+D]=y._extendedAttrs[x+D])}else for(let D=0;D<S;D++){for(let T=0;T<3;T++)this._data[3*(b+D)+T]=A[3*(x+D)+T];268435456&A[3*(x+D)+2]&&(this._extendedAttrs[b+D]=y._extendedAttrs[x+D])}const N=Object.keys(y._combined);for(let D=0;D<N.length;D++){const T=parseInt(N[D],10);T>=x&&(this._combined[T-x+b]=y._combined[T])}}translateToString(y,x,b,S){x=x??0,b=b??this.length,y&&(b=Math.min(b,this.getTrimmedLength())),S&&(S.length=0);let j="";for(;x<b;){const A=this._data[3*x+0],N=2097151&A,D=2097152&A?this._combined[x]:N?(0,v.stringFromCodePoint)(N):m.WHITESPACE_CELL_CHAR;if(j+=D,S)for(let T=0;T<D.length;++T)S.push(x);x+=A>>22||1}return S&&S.push(x),j}}c.BufferLine=E},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 v=!p[g].hasContent(m-1)&&p[g].getWidth(m-1)===1,_=p[g+1].getWidth(0)===2;return v&&_?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,v,_){const E=[];for(let C=0;C<p.length-1;C++){let y=C,x=p.get(++y);if(!x.isWrapped)continue;const b=[p.get(C)];for(;y<p.length&&x.isWrapped;)b.push(x),x=p.get(++y);if(v>=C&&v<y){C+=b.length-1;continue}let S=0,j=d(b,S,g),A=1,N=0;for(;A<b.length;){const T=d(b,A,g),B=T-N,H=m-j,W=Math.min(B,H);b[S].copyCellsFrom(b[A],N,j,W,!1),j+=W,j===m&&(S++,j=0),N+=W,N===T&&(A++,N=0),j===0&&S!==0&&b[S-1].getWidth(m-1)===2&&(b[S].copyCellsFrom(b[S-1],m-1,j++,1,!1),b[S-1].setCell(m-1,_))}b[S].replaceCells(j,m,_);let D=0;for(let T=b.length-1;T>0&&(T>S||b[T].getTrimmedLength()===0);T--)D++;D>0&&(E.push(C+b.length-D),E.push(D)),C+=b.length-1}return E},c.reflowLargerCreateNewLayout=function(p,g){const m=[];let v=0,_=g[v],E=0;for(let C=0;C<p.length;C++)if(_===C){const y=g[++v];p.onDeleteEmitter.fire({index:C-E,amount:y}),C+=y-1,E+=y,_=g[++v]}else m.push(C);return{layout:m,countRemoved:E}},c.reflowLargerApplyNewLayout=function(p,g){const m=[];for(let v=0;v<g.length;v++)m.push(p.get(g[v]));for(let v=0;v<m.length;v++)p.set(v,m[v]);p.length=g.length},c.reflowSmallerGetNewLineLengths=function(p,g,m){const v=[],_=p.map(((x,b)=>d(p,b,g))).reduce(((x,b)=>x+b));let E=0,C=0,y=0;for(;y<_;){if(_-y<m){v.push(_-y);break}E+=m;const x=d(p,C,g);E>x&&(E-=x,C++);const b=p[C].getWidth(E-1)===2;b&&E--;const S=b?m-1:m;v.push(S),y+=S}return v},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 v extends g.Disposable{constructor(E,C){super(),this._optionsService=E,this._bufferService=C,this._onBufferActivate=this.register(new p.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new m.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new m.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(E){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(E),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(E,C){this._normal.resize(E,C),this._alt.resize(E,C),this.setupTabStops(E)}setupTabStops(E){this._normal.setupTabStops(E),this._alt.setupTabStops(E)}}c.BufferSet=v},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 v extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(E){const C=new v;return C.setFromCharData(E),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,p.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(E){this.fg=E[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(E[g.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(E[g.CHAR_DATA_CHAR_INDEX].length===2){const y=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=y&&y<=56319){const x=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=x&&x<=57343?this.content=1024*(y-55296)+x-56320+65536|E[g.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|E[g.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=E[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|E[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.CellData=v},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,v,_,E){const C={type:0,cancel:!1,key:void 0},y=(m.shiftKey?1:0)|(m.altKey?2:0)|(m.ctrlKey?4:0)|(m.metaKey?8:0);switch(m.keyCode){case 0:m.key==="UIKeyInputUpArrow"?C.key=v?p.C0.ESC+"OA":p.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?C.key=v?p.C0.ESC+"OD":p.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?C.key=v?p.C0.ESC+"OC":p.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(C.key=v?p.C0.ESC+"OB":p.C0.ESC+"[B");break;case 8:C.key=m.ctrlKey?"\b":p.C0.DEL,m.altKey&&(C.key=p.C0.ESC+C.key);break;case 9:if(m.shiftKey){C.key=p.C0.ESC+"[Z";break}C.key=p.C0.HT,C.cancel=!0;break;case 13:C.key=m.altKey?p.C0.ESC+p.C0.CR:p.C0.CR,C.cancel=!0;break;case 27:C.key=p.C0.ESC,m.altKey&&(C.key=p.C0.ESC+p.C0.ESC),C.cancel=!0;break;case 37:if(m.metaKey)break;y?(C.key=p.C0.ESC+"[1;"+(y+1)+"D",C.key===p.C0.ESC+"[1;3D"&&(C.key=p.C0.ESC+(_?"b":"[1;5D"))):C.key=v?p.C0.ESC+"OD":p.C0.ESC+"[D";break;case 39:if(m.metaKey)break;y?(C.key=p.C0.ESC+"[1;"+(y+1)+"C",C.key===p.C0.ESC+"[1;3C"&&(C.key=p.C0.ESC+(_?"f":"[1;5C"))):C.key=v?p.C0.ESC+"OC":p.C0.ESC+"[C";break;case 38:if(m.metaKey)break;y?(C.key=p.C0.ESC+"[1;"+(y+1)+"A",_||C.key!==p.C0.ESC+"[1;3A"||(C.key=p.C0.ESC+"[1;5A")):C.key=v?p.C0.ESC+"OA":p.C0.ESC+"[A";break;case 40:if(m.metaKey)break;y?(C.key=p.C0.ESC+"[1;"+(y+1)+"B",_||C.key!==p.C0.ESC+"[1;3B"||(C.key=p.C0.ESC+"[1;5B")):C.key=v?p.C0.ESC+"OB":p.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(C.key=p.C0.ESC+"[2~");break;case 46:C.key=y?p.C0.ESC+"[3;"+(y+1)+"~":p.C0.ESC+"[3~";break;case 36:C.key=y?p.C0.ESC+"[1;"+(y+1)+"H":v?p.C0.ESC+"OH":p.C0.ESC+"[H";break;case 35:C.key=y?p.C0.ESC+"[1;"+(y+1)+"F":v?p.C0.ESC+"OF":p.C0.ESC+"[F";break;case 33:m.shiftKey?C.type=2:m.ctrlKey?C.key=p.C0.ESC+"[5;"+(y+1)+"~":C.key=p.C0.ESC+"[5~";break;case 34:m.shiftKey?C.type=3:m.ctrlKey?C.key=p.C0.ESC+"[6;"+(y+1)+"~":C.key=p.C0.ESC+"[6~";break;case 112:C.key=y?p.C0.ESC+"[1;"+(y+1)+"P":p.C0.ESC+"OP";break;case 113:C.key=y?p.C0.ESC+"[1;"+(y+1)+"Q":p.C0.ESC+"OQ";break;case 114:C.key=y?p.C0.ESC+"[1;"+(y+1)+"R":p.C0.ESC+"OR";break;case 115:C.key=y?p.C0.ESC+"[1;"+(y+1)+"S":p.C0.ESC+"OS";break;case 116:C.key=y?p.C0.ESC+"[15;"+(y+1)+"~":p.C0.ESC+"[15~";break;case 117:C.key=y?p.C0.ESC+"[17;"+(y+1)+"~":p.C0.ESC+"[17~";break;case 118:C.key=y?p.C0.ESC+"[18;"+(y+1)+"~":p.C0.ESC+"[18~";break;case 119:C.key=y?p.C0.ESC+"[19;"+(y+1)+"~":p.C0.ESC+"[19~";break;case 120:C.key=y?p.C0.ESC+"[20;"+(y+1)+"~":p.C0.ESC+"[20~";break;case 121:C.key=y?p.C0.ESC+"[21;"+(y+1)+"~":p.C0.ESC+"[21~";break;case 122:C.key=y?p.C0.ESC+"[23;"+(y+1)+"~":p.C0.ESC+"[23~";break;case 123:C.key=y?p.C0.ESC+"[24;"+(y+1)+"~":p.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(_&&!E||!m.altKey||m.metaKey)!_||m.altKey||m.ctrlKey||m.shiftKey||!m.metaKey?m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.keyCode>=48&&m.key.length===1?C.key=m.key:m.key&&m.ctrlKey&&(m.key==="_"&&(C.key=p.C0.US),m.key==="@"&&(C.key=p.C0.NUL)):m.keyCode===65&&(C.type=1);else{const x=g[m.keyCode],b=x==null?void 0:x[m.shiftKey?1:0];if(b)C.key=p.C0.ESC+b;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 v=p;v<g;++v){let _=d[v];_>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,v=0;if(this._interim){const _=d.charCodeAt(v++);56320<=_&&_<=57343?p[m++]=1024*(this._interim-55296)+_-56320+65536:(p[m++]=this._interim,p[m++]=_),this._interim=0}for(let _=v;_<g;++_){const E=d.charCodeAt(_);if(55296<=E&&E<=56319){if(++_>=g)return this._interim=E,m;const C=d.charCodeAt(_);56320<=C&&C<=57343?p[m++]=1024*(E-55296)+C-56320+65536:(p[m++]=E,p[m++]=C)}else E!==65279&&(p[m++]=E)}return m}},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,v,_,E,C=0,y=0,x=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(;x<B;){if(x>=g)return 0;if(N=d[x++],(192&N)!=128){x--,j=!0;break}this.interim[D++]=N,A<<=6,A|=63&N}j||(T===2?A<128?x--: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 b=g-4;let S=x;for(;S<g;){for(;!(!(S<b)||128&(m=d[S])||128&(v=d[S+1])||128&(_=d[S+2])||128&(E=d[S+3]));)p[C++]=m,p[C++]=v,p[C++]=_,p[C++]=E,S+=4;if(m=d[S++],m<128)p[C++]=m;else if((224&m)==192){if(S>=g)return this.interim[0]=m,C;if(v=d[S++],(192&v)!=128){S--;continue}if(y=(31&m)<<6|63&v,y<128){S--;continue}p[C++]=y}else if((240&m)==224){if(S>=g)return this.interim[0]=m,C;if(v=d[S++],(192&v)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=v,C;if(_=d[S++],(192&_)!=128){S--;continue}if(y=(15&m)<<12|(63&v)<<6|63&_,y<2048||y>=55296&&y<=57343||y===65279)continue;p[C++]=y}else if((248&m)==240){if(S>=g)return this.interim[0]=m,C;if(v=d[S++],(192&v)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=v,C;if(_=d[S++],(192&_)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=v,this.interim[2]=_,C;if(E=d[S++],(192&E)!=128){S--;continue}if(y=(7&m)<<18|(63&v)<<12|(63&_)<<6|63&E,y<65536||y>1114111)continue;p[C++]=y}}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 v;c.UnicodeV6=class{constructor(){if(this.version="6",!v){v=new Uint8Array(65536),v.fill(1),v[0]=0,v.fill(0,1,32),v.fill(0,127,160),v.fill(2,4352,4448),v[9001]=2,v[9002]=2,v.fill(2,11904,42192),v[12351]=1,v.fill(2,44032,55204),v.fill(2,63744,64256),v.fill(2,65040,65050),v.fill(2,65072,65136),v.fill(2,65280,65377),v.fill(2,65504,65511);for(let _=0;_<g.length;++_)v.fill(0,g[_][0],g[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?v[_]:(function(E,C){let y,x=0,b=C.length-1;if(E<C[0][0]||E>C[b][1])return!1;for(;b>=x;)if(y=x+b>>1,E>C[y][1])x=y+1;else{if(!(E<C[y][0]))return!0;b=y-1}return!1})(_,m)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,E){let C=this.wcwidth(_),y=C===0&&E!==0;if(y){const x=p.UnicodeService.extractWidth(E);x===0?y=!1:x>C&&(C=x)}return p.UnicodeService.createPropertyValue(0,C,y)}}},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(_,E){if(E!==void 0&&this._syncCalls>E)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const y=this._callbacks.shift();y&&y()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(_,E){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(E),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(E)}_innerWrite(_=0,E=!0){const C=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const y=this._writeBuffer[this._bufferOffset],x=this._action(y,E);if(x){const S=j=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,j))):this._innerWrite(C,j);return void x.catch((j=>(queueMicrotask((()=>{throw j})),Promise.resolve(!1)))).then(S)}const b=this._callbacks[this._bufferOffset];if(b&&b(),this._bufferOffset++,this._pendingData-=y.length,Date.now()-C>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}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,v){const _=m.toString(16),E=_.length<2?"0"+_:_;switch(v){case 4:return _[0];case 8:return E;case 12:return(E+E).slice(0,3);default:return E+E}}c.parseColor=function(m){if(!m)return;let v=m.toLowerCase();if(v.indexOf("rgb:")===0){v=v.slice(4);const _=d.exec(v);if(_){const E=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/E*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/E*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/E*255)]}}else if(v.indexOf("#")===0&&(v=v.slice(1),p.exec(v)&&[3,6,9,12].includes(v.length))){const _=v.length/3,E=[0,0,0];for(let C=0;C<3;++C){const y=parseInt(v.slice(_*C,_*C+_),16);E[C]=_===1?y<<4:_===2?y:_===3?y>>4:y>>8}return E}},c.toRgbString=function(m,v=16){const[_,E,C]=m;return`rgb:${g(_,v)}/${g(E,v)}/${g(C,v)}`}},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),v=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=v,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=v}registerHandler(E,C){this._handlers[E]===void 0&&(this._handlers[E]=[]);const y=this._handlers[E];return y.push(C),{dispose:()=>{const x=y.indexOf(C);x!==-1&&y.splice(x,1)}}}clearHandler(E){this._handlers[E]&&delete this._handlers[E]}setHandlerFallback(E){this._handlerFb=E}reset(){if(this._active.length)for(let E=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;E>=0;--E)this._active[E].unhook(!1);this._stack.paused=!1,this._active=v,this._ident=0}hook(E,C){if(this.reset(),this._ident=E,this._active=this._handlers[E]||v,this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(E,C,y){if(this._active.length)for(let x=this._active.length-1;x>=0;x--)this._active[x].put(E,C,y);else this._handlerFb(this._ident,"PUT",(0,p.utf32ToString)(E,C,y))}unhook(E,C=!0){if(this._active.length){let y=!1,x=this._active.length-1,b=!1;if(this._stack.paused&&(x=this._stack.loopPosition-1,y=C,b=this._stack.fallThrough,this._stack.paused=!1),!b&&y===!1){for(;x>=0&&(y=this._active[x].unhook(E),y!==!0);x--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!1,y;x--}for(;x>=0;x--)if(y=this._active[x].unhook(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!0,y}else this._handlerFb(this._ident,"UNHOOK",E);this._active=v,this._ident=0}};const _=new g.Params;_.addParam(0),c.DcsHandler=class{constructor(E){this._handler=E,this._data="",this._params=_,this._hitLimit=!1}hook(E){this._params=E.length>1||E.params[0]?E.clone():_,this._data="",this._hitLimit=!1}put(E,C,y){this._hitLimit||(this._data+=(0,p.utf32ToString)(E,C,y),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(E){let C=!1;if(this._hitLimit)C=!1;else if(E&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((y=>(this._params=_,this._data="",this._hitLimit=!1,y)));return this._params=_,this._data="",this._hitLimit=!1,C}}},2015:(f,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),v=d(6351);class _{constructor(x){this.table=new Uint8Array(x)}setDefault(x,b){this.table.fill(x<<4|b)}add(x,b,S,j){this.table[b<<8|x]=S<<4|j}addMany(x,b,S,j){for(let A=0;A<x.length;A++)this.table[b<<8|x[A]]=S<<4|j}}c.TransitionTable=_;const E=160;c.VT500_TRANSITION_TABLE=(function(){const y=new _(4095),x=Array.apply(null,Array(256)).map(((D,T)=>T)),b=(D,T)=>x.slice(D,T),S=b(32,127),j=b(0,24);j.push(25),j.push.apply(j,b(28,32));const A=b(0,14);let N;for(N in y.setDefault(1,0),y.addMany(S,0,2,0),A)y.addMany([24,26,153,154],N,3,0),y.addMany(b(128,144),N,3,0),y.addMany(b(144,152),N,3,0),y.add(156,N,0,0),y.add(27,N,11,1),y.add(157,N,4,8),y.addMany([152,158,159],N,0,7),y.add(155,N,11,3),y.add(144,N,11,9);return y.addMany(j,0,3,0),y.addMany(j,1,3,1),y.add(127,1,0,1),y.addMany(j,8,0,8),y.addMany(j,3,3,3),y.add(127,3,0,3),y.addMany(j,4,3,4),y.add(127,4,0,4),y.addMany(j,6,3,6),y.addMany(j,5,3,5),y.add(127,5,0,5),y.addMany(j,2,3,2),y.add(127,2,0,2),y.add(93,1,4,8),y.addMany(S,8,5,8),y.add(127,8,5,8),y.addMany([156,27,24,26,7],8,6,0),y.addMany(b(28,32),8,0,8),y.addMany([88,94,95],1,0,7),y.addMany(S,7,0,7),y.addMany(j,7,0,7),y.add(156,7,0,0),y.add(127,7,0,7),y.add(91,1,11,3),y.addMany(b(64,127),3,7,0),y.addMany(b(48,60),3,8,4),y.addMany([60,61,62,63],3,9,4),y.addMany(b(48,60),4,8,4),y.addMany(b(64,127),4,7,0),y.addMany([60,61,62,63],4,0,6),y.addMany(b(32,64),6,0,6),y.add(127,6,0,6),y.addMany(b(64,127),6,0,0),y.addMany(b(32,48),3,9,5),y.addMany(b(32,48),5,9,5),y.addMany(b(48,64),5,0,6),y.addMany(b(64,127),5,7,0),y.addMany(b(32,48),4,9,5),y.addMany(b(32,48),1,9,2),y.addMany(b(32,48),2,9,2),y.addMany(b(48,127),2,10,0),y.addMany(b(48,80),1,10,0),y.addMany(b(81,88),1,10,0),y.addMany([89,90,92],1,10,0),y.addMany(b(96,127),1,10,0),y.add(80,1,11,9),y.addMany(j,9,0,9),y.add(127,9,0,9),y.addMany(b(28,32),9,0,9),y.addMany(b(32,48),9,9,12),y.addMany(b(48,60),9,8,10),y.addMany([60,61,62,63],9,9,10),y.addMany(j,11,0,11),y.addMany(b(32,128),11,0,11),y.addMany(b(28,32),11,0,11),y.addMany(j,10,0,10),y.add(127,10,0,10),y.addMany(b(28,32),10,0,10),y.addMany(b(48,60),10,8,10),y.addMany([60,61,62,63],10,0,11),y.addMany(b(32,48),10,9,12),y.addMany(j,12,0,12),y.add(127,12,0,12),y.addMany(b(28,32),12,0,12),y.addMany(b(32,48),12,9,12),y.addMany(b(48,64),12,0,11),y.addMany(b(64,127),12,12,13),y.addMany(b(64,127),10,12,13),y.addMany(b(64,127),9,12,13),y.addMany(j,13,13,13),y.addMany(S,13,13,13),y.add(127,13,0,13),y.addMany([27,156,24,26],13,14,0),y.add(E,0,2,0),y.add(E,8,5,8),y.add(E,6,0,6),y.add(E,11,0,11),y.add(E,13,13,13),y})();class C extends p.Disposable{constructor(x=c.VT500_TRANSITION_TABLE){super(),this._transitions=x,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(b,S,j)=>{},this._executeHandlerFb=b=>{},this._csiHandlerFb=(b,S)=>{},this._escHandlerFb=b=>{},this._errorHandlerFb=b=>b,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 v.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(x,b=[64,126]){let S=0;if(x.prefix){if(x.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=x.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(x.intermediates){if(x.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let A=0;A<x.intermediates.length;++A){const N=x.intermediates.charCodeAt(A);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=N}}if(x.final.length!==1)throw new Error("final must be a single byte");const j=x.final.charCodeAt(0);if(b[0]>j||j>b[1])throw new Error(`final must be in range ${b[0]} .. ${b[1]}`);return S<<=8,S|=j,S}identToString(x){const b=[];for(;x;)b.push(String.fromCharCode(255&x)),x>>=8;return b.reverse().join("")}setPrintHandler(x){this._printHandler=x}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(x,b){const S=this._identifier(x,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const j=this._escHandlers[S];return j.push(b),{dispose:()=>{const A=j.indexOf(b);A!==-1&&j.splice(A,1)}}}clearEscHandler(x){this._escHandlers[this._identifier(x,[48,126])]&&delete this._escHandlers[this._identifier(x,[48,126])]}setEscHandlerFallback(x){this._escHandlerFb=x}setExecuteHandler(x,b){this._executeHandlers[x.charCodeAt(0)]=b}clearExecuteHandler(x){this._executeHandlers[x.charCodeAt(0)]&&delete this._executeHandlers[x.charCodeAt(0)]}setExecuteHandlerFallback(x){this._executeHandlerFb=x}registerCsiHandler(x,b){const S=this._identifier(x);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const j=this._csiHandlers[S];return j.push(b),{dispose:()=>{const A=j.indexOf(b);A!==-1&&j.splice(A,1)}}}clearCsiHandler(x){this._csiHandlers[this._identifier(x)]&&delete this._csiHandlers[this._identifier(x)]}setCsiHandlerFallback(x){this._csiHandlerFb=x}registerDcsHandler(x,b){return this._dcsParser.registerHandler(this._identifier(x),b)}clearDcsHandler(x){this._dcsParser.clearHandler(this._identifier(x))}setDcsHandlerFallback(x){this._dcsParser.setHandlerFallback(x)}registerOscHandler(x,b){return this._oscParser.registerHandler(x,b)}clearOscHandler(x){this._oscParser.clearHandler(x)}setOscHandlerFallback(x){this._oscParser.setHandlerFallback(x)}setErrorHandler(x){this._errorHandler=x}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(x,b,S,j,A){this._parseStack.state=x,this._parseStack.handlers=b,this._parseStack.handlerPos=S,this._parseStack.transition=j,this._parseStack.chunkPos=A}parse(x,b,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=x[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=x[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<b;++T){switch(A=x[T],N=this._transitions.table[this.currentState<<8|(A<160?A:E)],N>>4){case 2:for(let q=T+1;;++q){if(q>=b||(A=x[q])<32||A>126&&A<E){this._printHandler(x,T,q),T=q-1;break}if(++q>=b||(A=x[q])<32||A>126&&A<E){this._printHandler(x,T,q),T=q-1;break}if(++q>=b||(A=x[q])<32||A>126&&A<E){this._printHandler(x,T,q),T=q-1;break}if(++q>=b||(A=x[q])<32||A>126&&A<E){this._printHandler(x,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<b&&(A=x[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>=b||(A=x[q])===24||A===26||A===27||A>127&&A<E){this._dcsParser.put(x,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>=b||(A=x[q])<32||A>127&&A<E){this._oscParser.put(x,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(v,_){this._handlers[v]===void 0&&(this._handlers[v]=[]);const E=this._handlers[v];return E.push(_),{dispose:()=>{const C=E.indexOf(_);C!==-1&&E.splice(C,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].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 v=this._active.length-1;v>=0;v--)this._active[v].start();else this._handlerFb(this._id,"START")}_put(v,_,E){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(v,_,E);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(v,_,E))}start(){this.reset(),this._state=1}put(v,_,E){if(this._state!==3){if(this._state===1)for(;_<E;){const C=v[_++];if(C===59){this._state=2,this._start();break}if(C<48||57<C)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+C-48}this._state===2&&E-_>0&&this._put(v,_,E)}}end(v,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let E=!1,C=this._active.length-1,y=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,E=_,y=this._stack.fallThrough,this._stack.paused=!1),!y&&E===!1){for(;C>=0&&(E=this._active[C].end(v),E!==!0);C--)if(E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,E;C--}for(;C>=0;C--)if(E=this._active[C].end(!1),E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,E}else this._handlerFb(this._id,"END",v);this._active=m,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(v){this._handler=v,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(v,_,E){this._hitLimit||(this._data+=(0,g.utf32ToString)(v,_,E),this._data.length>p.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(v){let _=!1;if(this._hitLimit)_=!1;else if(v&&(_=this._handler(this._data),_ instanceof Promise))return _.then((E=>(this._data="",this._hitLimit=!1,E)));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 v=new p;if(!m.length)return v;for(let _=Array.isArray(m[0])?1:0;_<m.length;++_){const E=m[_];if(Array.isArray(E))for(let C=0;C<E.length;++C)v.addSubParam(E[C]);else v.addParam(E)}return v}constructor(m=32,v=32){if(this.maxLength=m,this.maxSubParamsLength=v,v>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(v),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 v=0;v<this.length;++v){m.push(this.params[v]);const _=this._subParamsIdx[v]>>8,E=255&this._subParamsIdx[v];E-_>0&&m.push(Array.prototype.slice.call(this._subParams,_,E))}return m}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(m){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=m>d?d:m}}addSubParam(m){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=m>d?d:m,this._subParamsIdx[this.length-1]++}}hasSubParams(m){return(255&this._subParamsIdx[m])-(this._subParamsIdx[m]>>8)>0}getSubParams(m){const v=this._subParamsIdx[m]>>8,_=255&this._subParamsIdx[m];return _-v>0?this._subParams.subarray(v,_):null}getSubParamsAll(){const m={};for(let v=0;v<this.length;++v){const _=this._subParamsIdx[v]>>8,E=255&this._subParamsIdx[v];E-_>0&&(m[v]=this._subParams.slice(_,E))}return m}addDigit(m){let v;if(this._rejectDigits||!(v=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,E=_[v-1];_[v-1]=~E?Math.min(10*E+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,v){this._buffer=m,this.type=v}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 v=this._buffer.lines.get(m);if(v)return new p.BufferLineApiView(v)}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,v){return this._line.translateToString(g,m,v)}}},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 v extends m.Disposable{constructor(E){super(),this._core=E,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new p.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new p.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}c.BufferNamespaceApi=v},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(y,x,b,S){var j,A=arguments.length,N=A<3?x:S===null?S=Object.getOwnPropertyDescriptor(x,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(y,x,b,S);else for(var D=y.length-1;D>=0;D--)(j=y[D])&&(N=(A<3?j(N):A>3?j(x,b,N):j(x,b))||N);return A>3&&N&&Object.defineProperty(x,b,N),N},g=this&&this.__param||function(y,x){return function(b,S){x(b,S,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const m=d(8460),v=d(844),_=d(5295),E=d(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let C=c.BufferService=class extends v.Disposable{get buffer(){return this.buffers.active}constructor(y){super(),this.isUserScrolling=!1,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(y.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(y.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(y,this))}resize(y,x){this.cols=y,this.rows=x,this.buffers.resize(y,x),this._onResize.fire({cols:y,rows:x})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(y,x=!1){const b=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===y.fg&&S.getBg(0)===y.bg||(S=b.getBlankLine(y,x),this._cachedBlankLine=S),S.isWrapped=x;const j=b.ybase+b.scrollTop,A=b.ybase+b.scrollBottom;if(b.scrollTop===0){const N=b.lines.isFull;A===b.lines.length-1?N?b.lines.recycle().copyFrom(S):b.lines.push(S.clone()):b.lines.splice(A+1,0,S.clone()),N?this.isUserScrolling&&(b.ydisp=Math.max(b.ydisp-1,0)):(b.ybase++,this.isUserScrolling||b.ydisp++)}else{const N=A-j+1;b.lines.shiftElements(j+1,N-1,-1),b.lines.set(A,S.clone())}this.isUserScrolling||(b.ydisp=b.ybase),this._onScroll.fire(b.ydisp)}scrollLines(y,x,b){const S=this.buffer;if(y<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else y+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);const j=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+y,S.ybase),0),j!==S.ydisp&&(x||this._onScroll.fire(S.ydisp))}};c.BufferService=C=p([g(0,E.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),v=d(8460),_=d(844),E={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:S=>S.button!==4&&S.action===1&&(S.ctrl=!1,S.alt=!1,S.shift=!1,!0)},VT200:{events:19,restrict:S=>S.action!==32},DRAG:{events:23,restrict:S=>S.action!==32||S.button!==3},ANY:{events:31,restrict:S=>!0}};function C(S,j){let 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 y=String.fromCharCode,x={DEFAULT:S=>{const j=[C(S,!1)+32,S.col+32,S.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`\x1B[M${y(j[0])}${y(j[1])}${y(j[2])}`},SGR:S=>{const j=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${C(S,!0)};${S.col};${S.row}${j}`},SGR_PIXELS:S=>{const j=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${C(S,!0)};${S.x};${S.y}${j}`}};let b=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 v.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const A of Object.keys(E))this.addProtocol(A,E[A]);for(const A of Object.keys(x))this.addEncoding(A,x[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=b=p([g(0,m.IBufferService),g(1,m.ICoreService)],b)},6975:function(f,c,d){var p=this&&this.__decorate||function(b,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(b,S,j,A);else for(var B=b.length-1;B>=0;B--)(N=b[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(b,S){return function(j,A){S(j,A,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const m=d(1439),v=d(8460),_=d(844),E=d(2585),C=Object.freeze({insertMode:!1}),y=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let x=c.CoreService=class extends _.Disposable{constructor(b,S,j){super(),this._bufferService=b,this._logService=S,this._optionsService=j,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new v.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new v.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(y)}reset(){this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(y)}triggerDataEvent(b,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 "${b}"`,(()=>b.split("").map((A=>A.charCodeAt(0))))),this._onData.fire(b)}triggerBinaryEvent(b){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${b}"`,(()=>b.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(b))}};c.CoreService=x=p([g(0,E.IBufferService),g(1,E.ILogService),g(2,E.IOptionsService)],x)},9074:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const p=d(8055),g=d(8460),m=d(844),v=d(6106);let _=0,E=0;class C extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new v.SortedList((b=>b==null?void 0:b.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(b){if(b.marker.isDisposed)return;const S=new y(b);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 b of this._decorations.values())b.dispose();this._decorations.clear()}*getDecorationsAtCell(b,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),b>=A&&b<N&&(!j||(D.options.layer??"bottom")===j)&&(yield D)}forEachDecorationAtCell(b,S,j,A){this._decorations.forEachByKey(S,(N=>{_=N.options.x??0,E=_+(N.options.width??1),b>=_&&b<E&&(!j||(N.options.layer??"bottom")===j)&&A(N)}))}}c.DecorationService=C;class y extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=p.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=p.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(b){super(),this.options=b,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=b.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[E,C]of _)this.set(E,C)}set(_,E){const C=this._entries.get(_);return this._entries.set(_,E),C}forEach(_){for(const[E,C]of this._entries.entries())_(E,C)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}c.ServiceCollection=m,c.InstantiationService=class{constructor(){this._services=new m,this._services.set(p.IInstantiationService,this)}setService(v,_){this._services.set(v,_)}getService(v){return this._services.get(v)}createInstance(v,..._){const E=(0,g.getServiceDependencies)(v).sort(((x,b)=>x.index-b.index)),C=[];for(const x of E){const b=this._services.get(x.id);if(!b)throw new Error(`[createInstance] ${v.name} depends on UNKNOWN service ${x.id}.`);C.push(b)}const y=E.length>0?E[0].index:_.length;if(_.length!==y)throw new Error(`[createInstance] First service dependency of ${v.name} at position ${y+1} conflicts with ${_.length} static arguments`);return new v(..._,...C)}}},7866:function(f,c,d){var p=this&&this.__decorate||function(y,x,b,S){var j,A=arguments.length,N=A<3?x:S===null?S=Object.getOwnPropertyDescriptor(x,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(y,x,b,S);else for(var D=y.length-1;D>=0;D--)(j=y[D])&&(N=(A<3?j(N):A>3?j(x,b,N):j(x,b))||N);return A>3&&N&&Object.defineProperty(x,b,N),N},g=this&&this.__param||function(y,x){return function(b,S){x(b,S,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const m=d(844),v=d(2585),_={trace:v.LogLevelEnum.TRACE,debug:v.LogLevelEnum.DEBUG,info:v.LogLevelEnum.INFO,warn:v.LogLevelEnum.WARN,error:v.LogLevelEnum.ERROR,off:v.LogLevelEnum.OFF};let E,C=c.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(y){super(),this._optionsService=y,this._logLevel=v.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),E=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(y){for(let x=0;x<y.length;x++)typeof y[x]=="function"&&(y[x]=y[x]())}_log(y,x,b){this._evalLazyOptionalParams(b),y.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+x,...b)}trace(y,...x){var b;this._logLevel<=v.LogLevelEnum.TRACE&&this._log(((b=this._optionsService.options.logger)==null?void 0:b.trace.bind(this._optionsService.options.logger))??console.log,y,x)}debug(y,...x){var b;this._logLevel<=v.LogLevelEnum.DEBUG&&this._log(((b=this._optionsService.options.logger)==null?void 0:b.debug.bind(this._optionsService.options.logger))??console.log,y,x)}info(y,...x){var b;this._logLevel<=v.LogLevelEnum.INFO&&this._log(((b=this._optionsService.options.logger)==null?void 0:b.info.bind(this._optionsService.options.logger))??console.info,y,x)}warn(y,...x){var b;this._logLevel<=v.LogLevelEnum.WARN&&this._log(((b=this._optionsService.options.logger)==null?void 0:b.warn.bind(this._optionsService.options.logger))??console.warn,y,x)}error(y,...x){var b;this._logLevel<=v.LogLevelEnum.ERROR&&this._log(((b=this._optionsService.options.logger)==null?void 0:b.error.bind(this._optionsService.options.logger))??console.error,y,x)}};c.LogService=C=p([g(0,v.IOptionsService)],C),c.setTraceLogger=function(y){E=y},c.traceCall=function(y,x,b){if(typeof b.value!="function")throw new Error("not supported");const S=b.value;b.value=function(...j){if(E.logLevel!==v.LogLevelEnum.TRACE)return S.apply(this,j);E.trace(`GlyphRenderer#${S.name}(${j.map((N=>JSON.stringify(N))).join(", ")})`);const A=S.apply(this,j);return E.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 v=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends g.Disposable{constructor(C){super(),this._onOptionChange=this.register(new p.EventEmitter),this.onOptionChange=this._onOptionChange.event;const y={...c.DEFAULT_OPTIONS};for(const x in C)if(x in y)try{const b=C[x];y[x]=this._sanitizeAndValidateOption(x,b)}catch(b){console.error(b)}this.rawOptions=y,this.options={...y},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,y){return this.onOptionChange((x=>{x===C&&y(this.rawOptions[C])}))}onMultipleOptionChange(C,y){return this.onOptionChange((x=>{C.indexOf(x)!==-1&&y()}))}_setupOptions(){const C=x=>{if(!(x in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${x}"`);return this.rawOptions[x]},y=(x,b)=>{if(!(x in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${x}"`);b=this._sanitizeAndValidateOption(x,b),this.rawOptions[x]!==b&&(this.rawOptions[x]=b,this._onOptionChange.fire(x))};for(const x in this.rawOptions){const b={get:C.bind(this,x),set:y.bind(this,x)};Object.defineProperty(this.options,x,b)}}_sanitizeAndValidateOption(C,y){switch(C){case"cursorStyle":if(y||(y=c.DEFAULT_OPTIONS[C]),!(function(x){return x==="block"||x==="underline"||x==="bar"})(y))throw new Error(`"${y}" is not a valid value for ${C}`);break;case"wordSeparator":y||(y=c.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof y=="number"&&1<=y&&y<=1e3)break;y=v.includes(y)?y:c.DEFAULT_OPTIONS[C];break;case"cursorWidth":y=Math.floor(y);case"lineHeight":case"tabStopWidth":if(y<1)throw new Error(`${C} cannot be less than 1, value: ${y}`);break;case"minimumContrastRatio":y=Math.max(1,Math.min(21,Math.round(10*y)/10));break;case"scrollback":if((y=Math.min(y,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${y}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(y<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${y}`);break;case"rows":case"cols":if(!y&&y!==0)throw new Error(`${C} must be numeric, value: ${y}`);break;case"windowsPty":y=y??{}}return y}}c.OptionsService=_},2660:function(f,c,d){var p=this&&this.__decorate||function(_,E,C,y){var x,b=arguments.length,S=b<3?E:y===null?y=Object.getOwnPropertyDescriptor(E,C):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,E,C,y);else for(var j=_.length-1;j>=0;j--)(x=_[j])&&(S=(b<3?x(S):b>3?x(E,C,S):x(E,C))||S);return b>3&&S&&Object.defineProperty(E,C,S),S},g=this&&this.__param||function(_,E){return function(C,y){E(C,y,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const m=d(2585);let v=c.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const E=this._bufferService.buffer;if(_.id===void 0){const j=E.addMarker(E.ybase+E.y),A={data:_,id:this._nextId++,lines:[j]};return j.onDispose((()=>this._removeMarkerFromLink(A,j))),this._dataByLinkId.set(A.id,A),A.id}const C=_,y=this._getEntryIdKey(C),x=this._entriesWithId.get(y);if(x)return this.addLineToLink(x.id,E.ybase+E.y),x.id;const b=E.addMarker(E.ybase+E.y),S={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[b]};return b.onDispose((()=>this._removeMarkerFromLink(S,b))),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.id}addLineToLink(_,E){const C=this._dataByLinkId.get(_);if(C&&C.lines.every((y=>y.line!==E))){const y=this._bufferService.buffer.addMarker(E);C.lines.push(y),y.onDispose((()=>this._removeMarkerFromLink(C,y)))}}getLinkData(_){var E;return(E=this._dataByLinkId.get(_))==null?void 0:E.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,E){const C=_.lines.indexOf(E);C!==-1&&(_.lines.splice(C,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};c.OscLinkService=v=p([g(0,m.IBufferService)],v)},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(v,_,E){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,y,x){y[d]===y?y[p].push({id:C,index:x}):(y[p]=[{id:C,index:x}],y[d]=y)})(m,v,E)};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(_,E,C=!1){return(16777215&_)<<3|(3&E)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new p.EventEmitter,this.onChange=this._onChange.event;const _=new g.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let E=0,C=0;const y=_.length;for(let x=0;x<y;++x){let b=_.charCodeAt(x);if(55296<=b&&b<=56319){if(++x>=y)return E+this.wcwidth(b);const A=_.charCodeAt(x);56320<=A&&A<=57343?b=1024*(b-55296)+A-56320+65536:E+=this.wcwidth(A)}const S=this.charProperties(b,C);let j=m.extractWidth(S);m.extractShouldJoin(S)&&(j-=m.extractWidth(C)),E+=j,C=S}return E}charProperties(_,E){return this._activeProvider.charProperties(_,E)}}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),v=l(7975),_=l(7090),E=["cols","rows"];class C extends p.Disposable{constructor(x){super(),this._core=this.register(new d.Terminal(x)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const b=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:b.bind(this,j),set:S.bind(this,j)};Object.defineProperty(this._publicOptions,j,A)}}_checkReadonlyOptions(x){if(E.includes(x))throw new Error(`Option "${x}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new v.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new m.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const x=this._core.coreService.decPrivateModes;let b="none";switch(this._core.coreMouseService.activeProtocol){case"X10":b="x10";break;case"VT200":b="vt200";break;case"DRAG":b="drag";break;case"ANY":b="any"}return{applicationCursorKeysMode:x.applicationCursorKeys,applicationKeypadMode:x.applicationKeypad,bracketedPasteMode:x.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:b,originMode:x.origin,reverseWraparoundMode:x.reverseWraparound,sendFocusMode:x.sendFocus,wraparoundMode:x.wraparound}}get options(){return this._publicOptions}set options(x){for(const b in x)this._publicOptions[b]=x[b]}blur(){this._core.blur()}focus(){this._core.focus()}input(x,b=!0){this._core.input(x,b)}resize(x,b){this._verifyIntegers(x,b),this._core.resize(x,b)}open(x){this._core.open(x)}attachCustomKeyEventHandler(x){this._core.attachCustomKeyEventHandler(x)}attachCustomWheelEventHandler(x){this._core.attachCustomWheelEventHandler(x)}registerLinkProvider(x){return this._core.registerLinkProvider(x)}registerCharacterJoiner(x){return this._checkProposedApi(),this._core.registerCharacterJoiner(x)}deregisterCharacterJoiner(x){this._checkProposedApi(),this._core.deregisterCharacterJoiner(x)}registerMarker(x=0){return this._verifyIntegers(x),this._core.registerMarker(x)}registerDecoration(x){return this._checkProposedApi(),this._verifyPositiveIntegers(x.x??0,x.width??0,x.height??0),this._core.registerDecoration(x)}hasSelection(){return this._core.hasSelection()}select(x,b,S){this._verifyIntegers(x,b,S),this._core.select(x,b,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(x,b){this._verifyIntegers(x,b),this._core.selectLines(x,b)}dispose(){super.dispose()}scrollLines(x){this._verifyIntegers(x),this._core.scrollLines(x)}scrollPages(x){this._verifyIntegers(x),this._core.scrollPages(x)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(x){this._verifyIntegers(x),this._core.scrollToLine(x)}clear(){this._core.clear()}write(x,b){this._core.write(x,b)}writeln(x,b){this._core.write(x),this._core.write(`\r
65
+ `,b)}paste(x){this._core.paste(x)}refresh(x,b){this._verifyIntegers(x,b),this._core.refresh(x,b)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(x){this._addonManager.loadAddon(this,x)}static get strings(){return c}_verifyIntegers(...x){for(const b of x)if(b===1/0||isNaN(b)||b%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...x){for(const b of x)if(b&&(b===1/0||isNaN(b)||b%1!=0||b<0))throw new Error("This API only accepts positive integers")}}f.Terminal=C})(),u})()))})(Od)),Od.exports}var ow=aw();/**
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 lw=2,cw=1,uw=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let r=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var m;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let r=this._terminal.options.scrollback===0?0:((m=this._terminal.options.overviewRuler)==null?void 0:m.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),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(lw,Math.floor(g/e.css.cell.width)),rows:Math.max(cw,Math.floor(p/e.css.cell.height))}}};function dw({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=Jn(g=>g.writeSession),p=Jn(g=>g.resizeSession);return P.useEffect(()=>{u.current=e},[e]),P.useEffect(()=>{if(!i)return;const g=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),i())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i]),P.useEffect(()=>{if(!l.current)return;const g=new ow.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new uw;g.loadAddon(m),f.current={term:g,fitAddon:m},l.current.addEventListener("keydown",C=>{C.key==="Escape"&&i&&(C.preventDefault(),C.stopPropagation(),i())}),g.open(l.current);const v=l.current.querySelector(".xterm");v&&(v.style.padding="8px"),m.fit(),s&&setTimeout(()=>{g.focus()},150);const _=new ResizeObserver(()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{requestAnimationFrame(()=>{var y;m.fit&&m.fit();const C=(y=f.current)==null?void 0:y.term;C&&C.cols>0&&C.rows>0&&p(u.current,C.cols,C.rows)})},100)});_.observe(l.current),g.onData(C=>{if(C==="\x1B"&&i){i();return}d(u.current,C)}),g.onKey(C=>{C.key==="\x1B"&&i&&(C.domEvent.stopPropagation(),i())});const E=qt.subscribe(C=>{var y,x;if(C.type==="terminal.output"&&((y=C.payload)==null?void 0:y.sessionId)===u.current){const b=(x=C.payload)==null?void 0:x.data;b&&g.write(b)}});return()=>{E(),_.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==="Escape"&&i&&(g.preventDefault(),g.stopPropagation(),i())}})]})}function hw(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 fw({isOpen:e,onClose:r,onFocusChat:i}){const s=Jn(C=>C.createSession),l=Jn(C=>C.killSession),u=Jn(C=>C.sessions),f=Jn(C=>C.setWorkdir),c=Jn(C=>C.fetchSessions),d=Vt(C=>C.currentProject),[p,g]=P.useState(!0),m=P.useRef(null),v=P.useRef(!1),_=P.useRef(!1),E=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?(v.current=!0,setTimeout(()=>{var C;(C=m.current)==null||C.focus(),setTimeout(()=>{v.current=!1},200)},100)):_.current=!1},[e]),P.useEffect(()=>{if(!e)return;const C=y=>{v.current||y.key==="Escape"&&(y.preventDefault(),r(),i())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,r,i]),e?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-x-0 top-[50vh] bottom-0 z-[100] bg-black/40",style:{pointerEvents:"auto"},onClick:E}),o.jsxs("div",{ref:m,tabIndex:-1,className:"fixed inset-x-0 top-0 z-[100] h-[50vh] bg-bg-primary border-b border-border flex flex-col animate-slide-down outline-none",onClick:C=>C.stopPropagation(),onKeyDown:C=>{C.key==="Escape"&&(C.preventDefault(),E())},children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Terminal"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>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 ${hw(u.length)} gap-2 h-full auto-rows-fr`,children:u.map(C=>o.jsx(dw,{sessionId:C.id,onClose:()=>l(C.id),onEscape:E,autoFocus:u.length===1},C.id))})})]})]}):null}function ao({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 v(_){d.current&&!d.current.contains(_.target)&&l(!1)}return s&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[s]);const p=P.useCallback(()=>{if(!c.current)return;const v=c.current.getBoundingClientRect(),_=200,C=window.innerHeight-v.bottom<_;f({top:C?v.top-_-4:v.bottom+4,left:v.left,alignToTop:C})},[]),g=v=>{v.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((v,_)=>{const E=o.jsxs(o.Fragment,{children:[v.icon&&o.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:v.icon}),v.label]});return v.href?o.jsx(Mn,{href:v.href,onClick:C=>{var y;(y=v.onClick)==null||y.call(v,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 ${v.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${_!==e.length-1?"border-b border-border":""}`,children:E},_):o.jsx("button",{onClick:C=>{var y;(y=v.onClick)==null||y.call(v,C),v.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 ${v.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${_!==e.length-1?"border-b border-border":""}`,children:E},_)})});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative",children:o.jsx("div",{ref:c,onClick:g,children:r})}),s&&Xl.createPortal(m,document.body)]})}function Mb({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 Zl({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 Ib(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 Ql(e){const r=new Date(e),i=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0");return`${i}:${s}`}function pw(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=Ql(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 Bb(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 mw(e){const{year:r,month:i,day:s}=Bb(e);return`${r}-${i}-${s}`}function zb(e){const r=new Map;for(const l of e){const u=mw(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 Ux=()=>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 gw({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 xw({projects:e,currentProject:r}){const i=Vt(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(Zl,{}):void 0,href:`/p/${u.id}`,onClick:()=>{i(u.id)}}));return o.jsx(ao,{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(Mb,{})]}),minWidth:"250px"})}function vw({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(gw,{items:u,trigger:o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function bw({sessions:e,currentProject:r,currentSession:i}){var d;const s=ke(p=>p.loadSession),l=e.filter(p=>p.projectId===r.id).slice(0,15),u=zb(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:Ib(m.updatedAt)}),onClick:()=>{}});for(const v of g)f.push({label:o.jsxs("div",{className:"min-w-[160px]",children:[o.jsx("div",{className:"truncate text-sm",children:v.title??v.id.slice(0,8)}),o.jsx("div",{className:"text-text-muted text-xs",children:Ql(v.updatedAt)})]}),icon:v.id===(i==null?void 0:i.id)?o.jsx(Zl,{}):void 0,href:`/p/${r.id}/s/${v.id}`,onClick:()=>{s(v.id)}})}}const c=i?((d=i.metadata)==null?void 0:d.title)??i.id.slice(0,8):"No session selected";return o.jsx(ao,{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(Mb,{})]}),minWidth:"280px"})}function yw({onMenuClick:e,onCriteriaToggle:r}){const[i,s]=P.useState(!1),[l]=ur(),u=l.startsWith("/p/"),f=/^\/p\/[^/]+\/s\/[^/]+$/.test(l),c=ke(x=>x.currentSession),d=ke(x=>x.sessions),p=Vt(x=>x.currentProject),g=Vt(x=>x.projects),m=At(x=>x.startAutoRefresh),v=At(x=>x.stopAutoRefresh),_=Jn(x=>x.setOpen),E=Jn(x=>x.isOpen),C=P.useCallback(()=>{const x=document.querySelector('textarea[placeholder*="What would you like to build"], textarea[placeholder*="Send a message"]');x&&x.focus()},[]),y=P.useRef(0);return P.useEffect(()=>{const x=b=>{if(b.key==="Control"&&!b.shiftKey&&!b.metaKey&&!b.altKey){const S=Date.now();S-y.current<300?(b.preventDefault(),b.stopPropagation(),Jn.getState().toggleOpen(),y.current=0):y.current=S}};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[]),P.useEffect(()=>(m(),()=>v()),[m,v]),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(Ux,{})}),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(xw,{projects:g,currentProject:p})}),o.jsx("span",{className:"md:hidden",children:o.jsx(vw,{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(bw,{sessions:d,currentProject:p,currentSession:c})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u&&o.jsx("button",{onClick:()=>_(!E),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${E?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (double 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(Ux,{})})]}),o.jsx(nw,{isOpen:i,onClose:()=>s(!1)}),o.jsx(fw,{isOpen:E,onClose:()=>_(!1),onFocusChat:C})]})}function _w({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,v]=P.useState(!1),[_,E]=P.useState(!1);P.useEffect(()=>{g(f),v(!1)},[f]);const C=S=>{g(S.target.value),v(!0)},y=async()=>{E(!0),await d(p),E(!1),v(!1),r()},x=()=>{g(f),v(!1),r()},b=c||_;return o.jsx(jt,{isOpen:e,onClose:x,title:i,size:"lg",children:o.jsxs("div",{className:"flex flex-col h-full -mt-1",children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:s}),o.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children: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:b})}),m&&o.jsx(Rh,{}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border flex-shrink-0",children:[o.jsx(nt,{variant:"secondary",onClick:x,children:"Cancel"}),o.jsx(nt,{variant:"primary",onClick:y,disabled:!m||b,children:_?"Saving...":"Save"})]})]})})}function Sw({isOpen:e,onClose:r,project:i}){const s=Vt(u=>u.updateProject),l=async u=>{s(i.id,{customInstructions:u||null}),await new Promise(f=>setTimeout(f,100))};return o.jsx(_w,{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 ww={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"};function Za({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:ww[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 Hb({projectId:e,isOpen:r=!0,onClose:i}){const[,s]=ur(),[l,u]=P.useState(!1),f=ke(j=>j.sessions),c=ke(j=>j.currentSession),d=ke(j=>j.unreadSessionIds),p=ke(j=>j.deleteSession),g=ke(j=>j.deleteAllSessions),m=ke(j=>j.loadMoreSessions),v=ke(j=>j.sessionsHasMore),_=ke(j=>j.sessionsPaginationLoading),E=Vt(j=>j.currentProject),C=P.useRef(null),y=P.useCallback(()=>{v&&!_&&E&&m(E.id)},[v,_,E,m]);P.useEffect(()=>{if(!C.current||!v)return;const j=new IntersectionObserver(A=>{const N=A[0];N&&N.isIntersecting&&y()},{threshold:.1});return j.observe(C.current),()=>j.disconnect()},[v,y]);const x=f.filter(j=>j.projectId===(E==null?void 0:E.id)),b=(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(ao,{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(Za,{onClick:i,className:"md:hidden",variant:"sidebar",size:"md"})]}),E&&o.jsx(Sw,{isOpen:l,onClose:()=>u(!1),project:E}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:x.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"divide-y divide-border",children:Cw(x,c,d,b,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 Cw(e,r,i,s,l){const u=zb(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:Ib(d.updatedAt)}),c.map(p=>{const g=(r==null?void 0:r.id)===p.id,m=i.includes(p.id),v=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(ao,{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:[v?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:Ql(p.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[p.messageCount," messages"]})]})]})},p.id)})]},f):null})}const $x=["⠋","⠙","⠹","⠸","⠼","⠴"];function kw(){var c;const e=Vt(d=>d.currentProject),r=ke(d=>d.currentSession),i=Nb(),s=!1,l=P.useRef(0),u=P.useRef(null);P.useEffect(()=>(i?(u.current=window.setInterval(()=>{l.current=(l.current+1)%$x.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?`${$x[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 Jl=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}));Jl.displayName="Input";function Ew({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(nt,{variant:"secondary",onClick:r,children:"Cancel"}),o.jsx(nt,{variant:"danger",onClick:l,children:"Delete"})]})]})})}function jw(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 Nw({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&&(Ce("/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 v=P.useCallback(async C=>{C.preventDefault();const y=jw(s);if(!y.valid){f(y.error);return}d(!0),f(null);const x=`${p}/${s}`;try{const b=await Ce("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:x})});if(!b.ok){const A=await b.json().catch(()=>({}));throw new Error(A.error||"Failed to create project")}const j=(await b.json()).project;r(),i(`/p/${j.id}`)}catch(b){f(b instanceof Error?b.message:"Failed to create project"),d(!1)}},[s,i,r,p]),_=P.useCallback(()=>{l(""),f(null),r()},[r]),E=s?`${p}/${s}`:"";return o.jsx(jt,{isOpen:e,onClose:_,title:"Create New Project",size:"sm",children:o.jsxs("form",{onSubmit:v,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(Jl,{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:E})]}),u&&o.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:u})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(nt,{type:"button",variant:"secondary",onClick:_,disabled:c,children:"Cancel"}),o.jsx(nt,{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 Tw={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function ec({size:e="md",className:r=""}){return o.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${Tw[e]} ${r}`})}function Aw({text:e,...r}){return o.jsxs("div",{className:"text-center",children:[o.jsx(ec,{...r,className:"mx-auto mb-4"}),e&&o.jsx("div",{className:"text-text-secondary",children:e})]})}function Pb({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",v=await(await Ce(g)).json();l(v)}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(ec,{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 Md(e,r){let i="/api/directories";return e?i=`/api/directories?path=${encodeURIComponent(e)}`:r&&(i=`/api/directories?path=${encodeURIComponent(r)}`),(await Ce(i)).json()}function Dw({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,v]=P.useState(null),_=Vt(Z=>Z.projects),E=Vt(Z=>Z.createProject),C=Vt(Z=>Z.listProjects),y=Vt(Z=>Z.deleteProject),[x,b]=P.useState(null),[S,j]=P.useState(-1),[A,N]=P.useState(null),[D,T]=P.useState(!1),B=P.useRef([]);P.useEffect(()=>{Ce("/api/config").then(Z=>Z.json()).then(Z=>{Z.workdir&&v(Z.workdir)})},[]);const H=P.useCallback(async Z=>{g(!0);try{const z=await Md(Z,m??void 0);d(z)}catch(z){console.error("Failed to load directories:",z)}finally{g(!1)}},[m]);P.useEffect(()=>{e&&m&&(Md(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&&(y(A.id),N(null))},M=Z=>{const z=Z.split("/").filter(Boolean).pop()??"";E(z,Z),C(),b(Z)};P.useEffect(()=>{if(x){const Z=_.find(z=>z.workdir===x);Z&&(i(`/p/${Z.id}`),r(),b(null))}},[_,x,i,r]),P.useEffect(()=>{j(K.length>0?0:-1)},[u,K.length]);const Y=Z=>{f(""),Md(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(nt,{variant:"secondary",onClick:()=>l(!0),children:"Create Project"}),o.jsx(nt,{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(Jl,{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(Nw,{isOpen:s,onClose:()=>l(!1)}),A&&o.jsx(Ew,{isOpen:!0,onClose:()=>N(null),projectName:A.name,onConfirm:U}),D&&o.jsx(Pb,{initialPath:m??void 0,onSelect:Z=>{M(Z),T(!1)},onClose:()=>T(!1)})]}):null}function Lw(){const[e,r]=P.useState(!1),i=ke(g=>g.sessions),s=Vt(g=>g.projects),l=Vt(g=>g.listProjects),u=ke(g=>g.listSessions),f=ke(g=>g.connectionStatus);P.useEffect(()=>{f==="connected"&&(l(),u())},[f,l,u]);const c=[...s].sort((g,m)=>{const v=i.filter(y=>y.workdir.startsWith(g.workdir)),_=i.filter(y=>y.workdir.startsWith(m.workdir)),E=v.length>0?new Date(v.reduce((y,x)=>new Date(x.updatedAt)>new Date(y.updatedAt)?x:y).updatedAt).getTime():new Date(g.updatedAt).getTime();return(_.length>0?new Date(_.reduce((y,x)=>new Date(x.updatedAt)>new Date(y.updatedAt)?x:y).updatedAt).getTime():new Date(m.updatedAt).getTime())-E}),d=g=>{const m=s.find(v=>v.id===g);return m?i.filter(v=>v.workdir.startsWith(m.workdir)).sort((v,_)=>new Date(_.updatedAt).getTime()-new Date(v.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(nt,{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(v=>{const _=s.find(C=>v.workdir.startsWith(C.workdir)),E=_?`/p/${_.id}/s/${v.id}`:"#";return o.jsx(Mn,{href:E,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm text-text-muted truncate",children:v.title??v.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:pw(v.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs",children:[v.messageCount," msgs"]})]})]})},v.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(Dw,{isOpen:e,onClose:()=>r(!1)})]})}function Rw(){const[,e]=kh("/p/:projectId/new"),[,r]=ur(),i=e==null?void 0:e.projectId,s=ke(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(ec,{})})}function Ow(){const e=Vt(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 Ia=e=>Math.round(e*10)/10;function ah(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function Mw(e){return`${e.providerId}::${e.model}`}function Iw(e){return`${e.providerName} > ${e.model}`}function qx(e){let r=0,i=0,s=0,l=0,u=0,f=0;const c=[],d=[];let p=0;for(const[v,_]of e.entries()){const E=_.stats,C=ah(E);r+=E.totalTime,i+=E.toolTime,s+=E.prefillTokens,l+=E.generationTokens;const y=E.prefillSpeed>0?E.prefillTokens/E.prefillSpeed:0,x=E.generationSpeed>0?E.generationTokens/E.generationSpeed:0;u+=y,f+=x,c.push({messageId:_.id,timestamp:_.timestamp,...C,mode:E.mode,responseIndex:v+1,prefillTokens:E.prefillTokens,generationTokens:E.generationTokens,prefillSpeed:E.prefillSpeed,generationSpeed:E.generationSpeed,totalTime:E.totalTime,aiTime:E.totalTime-E.toolTime,toolTime:E.toolTime});const b=E.llmCalls??[];for(const S of b)p+=1,d.push({messageId:_.id,timestamp:S.timestamp??_.timestamp,providerId:S.providerId,providerName:S.providerName,backend:S.backend,model:S.model,mode:E.mode,responseIndex:v+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?Ia(s/u):0,m=f>0?Ia(l/f):0;return{totalTime:Ia(r),aiTime:Ia(r-i),toolTime:Ia(i),prefillTokens:s,generationTokens:l,avgPrefillSpeed:g,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:d.length,dataPoints:c,callDataPoints:d}}function Bw(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=Mw(ah(l.stats)),f=i.get(u)??[];i.set(u,[...f,l])}const s=Array.from(i.entries()).map(([l,u])=>{const f=ah(u[0].stats),c=qx(u);return{...f,key:l,label:Iw(f),...c}});return{...qx(r),modelGroups:s}}function zw(e){return P.useMemo(()=>Bw(e),[e])}function Hw(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 v=await(await Ce(`/api/branch?workdir=${encodeURIComponent(c)}`)).json();d&&(i(v.branch),f(v.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 Hl(e){return e.toLocaleString("en-US").replace(/,/g," ")}function Wx(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Pw(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 Fw="modulepreload",Uw=function(e){return"/"+e},Gx={},$w=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=Uw(p),p in Gx)return;Gx[p]=!0;const g=p.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const v=document.createElement("link");if(v.rel=g?"stylesheet":Fw,g||(v.as="script"),v.crossOrigin="",v.href=p,d&&v.setAttribute("nonce",d),document.head.appendChild(v),g)return new Promise((_,E)=>{v.addEventListener("load",_),v.addEventListener("error",()=>E(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)})},Vx=["▁","▂","▃","▄","▅","▆","▇","█"];function qw(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 Ww(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 Gw(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const i=[...e].sort((m,v)=>m.x-v.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}=Ww(u,f),p=Array.from({length:r},()=>" "),g=new Map;for(const m of i){const v=l===s?0:Math.round((m.x-s)/(l-s)*(r-1)),_=g.get(v)??[];g.set(v,[..._,m.y])}for(const[m,v]of g){const _=Math.max(...v);p[m]=Vx[qw(_,c,d)]??Vx[0]}return{blocks:p.join(""),minX:s,maxX:l,minY:c,maxY:d}}function Kx(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Yx({data:e,width:r=60,height:i=78,label:s,xLabel:l,yLabel:u,showAxes:f=!0,formatY:c=Kx,formatX:d=Kx}){const p=P.useMemo(()=>{const g=Gw(e,r),m=Math.max(r*6,240),v=10,_=8,C=[...e].sort((S,j)=>S.x-j.x).map(S=>{const j=g.maxX===g.minX?m/2:v+(S.x-g.minX)/(g.maxX-g.minX)*(m-v*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}}),y=C.map((S,j)=>`${j===0?"M":"L"} ${S.cx.toFixed(1)} ${S.cy.toFixed(1)}`).join(" "),b=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(S=>({value:S,y:g.maxY===g.minY?i/2:_+(g.maxY-S)/(g.maxY-g.minY)*(i-_*2)}));return{...g,chartWidth:m,points:C,path:y,gridLines:b}},[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 Vw({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(Yx,{data:u,width:l,label:r,xLabel:s}),o.jsx(Yx,{data:f,width:l,label:i,xLabel:s})]})}function Kw(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 Yw(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 Xw(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 Zw(e){return e.callDataPoints.length>0?Xw(e):Yw(e)}function Id(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 Oi(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function qa(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Qw(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),i=Math.max(...e);return r===i?`${Oi(r)} ctx`:`${Oi(r)}-${Oi(i)} ctx`}function Pl(e){return`${qa(e)} t/s`}function Fb(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function Jw(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 eC({isOpen:e,onClose:r,stats:i}){const s=P.useRef(null),[l,u]=P.useState({}),[f,c]=P.useState(()=>{var E;return((E=i.modelGroups[0])==null?void 0:E.key)??""});P.useEffect(()=>{var E;i.modelGroups.some(C=>C.key===f)||c(((E=i.modelGroups[0])==null?void 0:E.key)??"")},[f,i.modelGroups]);const d=P.useMemo(()=>i.modelGroups.find(E=>E.key===f)??i.modelGroups[0],[f,i.modelGroups]),p=P.useMemo(()=>d?Kw(d):[],[d]),g=P.useMemo(()=>d?Zw(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),m=P.useCallback(E=>{u(C=>({...C,[E]:!C[E]}))},[]),v=P.useCallback(()=>{if(!d)return;const E=Jw(d);navigator.clipboard.writeText(JSON.stringify(E,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),_=P.useCallback(async()=>{if(s.current)try{const E=(await $w(async()=>{const{default:x}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:x}},[])).default,C=await E(s.current,{backgroundColor:"#1a1a1a",scale:2}),y=document.createElement("a");y.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,y.href=C.toDataURL("image/png"),y.click()}catch(E){console.error("Failed to export PNG:",E),v()}},[v]);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(E=>o.jsx("button",{onClick:()=>c(E.key),className:`px-3 py-1.5 rounded border text-xs transition-colors ${E.key===(d==null?void 0:d.key)?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border text-text-muted hover:text-text-primary hover:bg-bg-tertiary/40"}`,title:E.label,children:E.label},E.key))})}),d&&o.jsxs("section",{children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:"Summary"}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[o.jsx(Lr,{label:"AI Time",value:Id(d.aiTime)}),o.jsx(Lr,{label:"Total Time",value:Id(d.totalTime)}),o.jsx(Lr,{label:"Tool Time",value:Id(d.toolTime)}),o.jsx(Lr,{label:"Responses",value:d.responseCount.toString()}),o.jsx(Lr,{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(Lr,{label:"Prefill Tokens",value:Oi(d.prefillTokens),subValue:`@ ${qa(d.avgPrefillSpeed)} tok/s`}),o.jsx(Lr,{label:"Gen Tokens",value:Oi(d.generationTokens),subValue:`@ ${qa(d.avgGenerationSpeed)} tok/s`}),o.jsx(Lr,{label:"Avg PP Speed",value:`${qa(d.avgPrefillSpeed)}`,subValue:"tok/s"}),o.jsx(Lr,{label:"Avg TG Speed",value:`${qa(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:v,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(Vw,{data:g.points,width:50,prefillLabel:g.prefillLabel,generationLabel:g.generationLabel,xLabel:g.xLabel})})]}),d&&o.jsxs("section",{children:[o.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",d.responseCount," responses)"]}),o.jsx("div",{className:"overflow-y-auto bg-bg-tertiary/30 rounded",children:o.jsxs("table",{className:"w-full table-fixed border-separate border-spacing-0 text-xs",children:[o.jsxs("colgroup",{children:[o.jsx("col",{className:"w-[7%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[10%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[11%]"}),o.jsx("col",{className:"w-[2%]"})]}),o.jsx("thead",{children:o.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted/80",children:[o.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"#"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"At"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Time"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Context"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"PP t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"TG t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Calls"}),o.jsx("th",{className:"px-2 py-2"})]})}),o.jsx("tbody",{children:p.map((E,C)=>o.jsxs(P.Fragment,{children:[o.jsx(tC,{row:E,index:C,isExpanded:l[E.messageId]??!1,onToggle:E.isExpandable?()=>m(E.messageId):void 0}),(l[E.messageId]??!1)&&E.calls.map((y,x)=>o.jsx(nC,{dataPoint:y,index:x},`${y.messageId}-${y.callIndex}`))]},E.messageId))})]})})]})]})})}function Lr({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 tC({row:e,index:r,isExpanded:i,onToggle:s}){const l=e.calls.length>0?Qw(e.calls.map(u=>u.promptTokens)):`${Oi(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:Fb(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:Pl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Pl(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 nC({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:Fb(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:Oi(e.promptTokens)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Pl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Pl(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 rC={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"}},iC=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=rC[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 sC({isOpen:e,onClose:r}){const i=cr(_=>_.config),s=cr(_=>_.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 v=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:v,disabled:g||!l.trim()||!f.trim(),children:g?"Saving...":"Save"})]})]})})}const Xx={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"},aC={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"},Zx={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},oC="text-text-primary";function lC(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=Xx[p];g&&d.push(g)}else if(p>=40&&p<=47){const g=aC[p];g&&d.push(g)}else if(p>=90&&p<=97){const g=Xx[p];g&&d.push(g)}else if(p in Zx){const g=Zx[p];g&&d.push(g)}else p===39?d.push(oC):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:cC(e),className:"text-text-primary"}]}}function cC(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function Qa(e){const r=lC(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 uC=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:Qa(f.content)},c))})})}),dC=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:Qa(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}),hC=P.memo(function({workdir:r}){const i=cr(H=>H.setWorkdir),s=cr(H=>H.status),l=cr(H=>H.config),u=cr(H=>H.logs),f=cr(H=>H.start),c=cr(H=>H.stop),d=cr(H=>H.fetchLogs),[p,g]=P.useState(!1),[m,v]=P.useState(!1),[_,E]=P.useState(!1),[C,y]=P.useState(!1),x=P.useRef(null),b=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:()=>{b.current&&clearTimeout(b.current),x.current=setTimeout(()=>{E(!0),y(!1)},500)},onMouseLeave:()=>{x.current&&clearTimeout(x.current),y(!0),b.current=setTimeout(()=>E(!1),150)},children:[o.jsx("pre",{ref:S,className:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border",children:u.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):u.map((H,W)=>o.jsx("span",{className:H.stream==="stderr"?"text-accent-warning":"",children:Qa(H.content)},W))}),(_||C)&&j.current&&Xl.createPortal(o.jsx(dC,{logs:u,anchorRef:j,isHiding:C,onExpand:()=>v(!0),onClose:()=>E(!1)}),document.body)]})]}):o.jsx("button",{onClick:()=>g(!0),className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-muted hover:bg-border transition-colors",children:"Configure"}),o.jsx(sC,{isOpen:p,onClose:()=>g(!1)}),m&&o.jsx(uC,{title:"Dev Server Logs",logs:u,onClose:()=>v(!1)})]})});function fC({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 pC=P.memo(function({sessionId:r}){var _;const i=Wa(E=>E.processes),s=Wa(E=>E.stopProcess),[l,u]=P.useState(null),[f,c]=P.useState([]),d=i.filter(E=>E.status!=="exited"),p=d.filter(E=>E.status==="running").length;if(i.length===0)return null;const g=E=>{switch(E){case"running":return"bg-accent-success";case"starting":return"bg-accent-warning";case"stopping":return"bg-accent-warning";case"exited":return"bg-text-muted";default:return"bg-text-muted"}},m=E=>{const C=Wa.getState().logs[E]??[];c(C.map(y=>({content:y.content,stream:y.stream}))),u(E)},v=E=>{r&&s(E,r)};return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 bg-accent-primary"}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Background"}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",p," running)"]})]})}),o.jsx("div",{className:"space-y-2",children:d.map(E=>o.jsx("div",{className:"border border-border rounded p-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${g(E.status)}`}),o.jsx("span",{className:"text-sm text-text-primary truncate",title:E.name,children:E.name}),o.jsxs("span",{className:"text-xs text-text-muted",children:["[",E.status,"]"]})]}),o.jsxs("div",{className:"flex gap-1 ml-2",children:[o.jsx("button",{onClick:()=>m(E.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-border text-text-secondary transition-colors",title:"View logs",children:"Logs"}),o.jsx("button",{onClick:()=>v(E.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-accent-error/20 text-text-secondary hover:text-accent-error transition-colors",title:"Stop process",children:"Stop"})]})]})},E.id))}),l&&o.jsx(fC,{isOpen:!!l,onClose:()=>{u(null),c([])},processName:((_=d.find(E=>E.id===l))==null?void 0:_.name)??"",logs:f})]})});function Qx({summary:e,messages:r,workdir:i}){const[s,l]=P.useState(!1),u=zw(r),{branch:f}=Hw(i),c=At(p=>p.version),d=ke(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:Pw(u.aiTime)}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Wx(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:Wx(u.avgGenerationSpeed)}),o.jsx("span",{children:"tg"})]})}),o.jsx(eC,{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(iC,{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(hC,{workdir:i}),o.jsx(pC,{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 mC({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:i,messages:s}){const l=ke(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(Qx,{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(Qx,{summary:(l==null?void 0:l.summary)??null,messages:s,workdir:l==null?void 0:l.workdir})})]})]})}function gC(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function Ub({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 ${gC(e,r)}`,style:{width:`${Math.min(e,100)}%`}})})}function xC({dangerZone:e,size:r="md"}){return e?o.jsx("span",{className:"text-accent-error animate-pulse text-[10px] font-medium",children:"Low!"}):null}function Jx(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function vC(){const e=ke(p=>p.contextState),r=ke(p=>p.currentSession),i=ke(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:Jx(c,f),children:[Hl(s)," / ",Hl(l)]}),o.jsxs("span",{className:Jx(c,f),children:["(",c,"%)"]})]}),o.jsx(Ub,{percent:c,dangerZone:f}),o.jsx(xC,{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(nt,{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 ev(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 bC(e,r){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const yC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_C=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,SC={};function tv(e,r){return(SC.jsx?_C:yC).test(e)}const wC=/[ \t\n\f\r]/g;function CC(e){return typeof e=="object"?e.type==="text"?nv(e.value):!1:nv(e)}function nv(e){return e.replace(wC,"")===""}class oo{constructor(r,i,s){this.normal=i,this.property=r,s&&(this.space=s)}}oo.prototype.normal={};oo.prototype.property={};oo.prototype.space=void 0;function $b(e,r){const i={},s={};for(const l of e)Object.assign(i,l.property),Object.assign(s,l.normal);return new oo(i,s,r)}function Ja(e){return e.toLowerCase()}class kn{constructor(r,i){this.attribute=i,this.property=r}}kn.prototype.attribute="";kn.prototype.booleanish=!1;kn.prototype.boolean=!1;kn.prototype.commaOrSpaceSeparated=!1;kn.prototype.commaSeparated=!1;kn.prototype.defined=!1;kn.prototype.mustUseProperty=!1;kn.prototype.number=!1;kn.prototype.overloadedBoolean=!1;kn.prototype.property="";kn.prototype.spaceSeparated=!1;kn.prototype.space=void 0;let kC=0;const Xe=Bi(),Wt=Bi(),oh=Bi(),Se=Bi(),yt=Bi(),Os=Bi(),On=Bi();function Bi(){return 2**++kC}const lh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:Wt,commaOrSpaceSeparated:On,commaSeparated:Os,number:Se,overloadedBoolean:oh,spaceSeparated:yt},Symbol.toStringTag,{value:"Module"})),Bd=Object.keys(lh);class Oh extends kn{constructor(r,i,s,l){let u=-1;if(super(r,i),rv(this,"space",l),typeof s=="number")for(;++u<Bd.length;){const f=Bd[u];rv(this,Bd[u],(s&lh[f])===lh[f])}}}Oh.prototype.defined=!0;function rv(e,r,i){i&&(e[r]=i)}function zs(e){const r={},i={};for(const[s,l]of Object.entries(e.properties)){const u=new Oh(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),r[s]=u,i[Ja(s)]=s,i[Ja(u.attribute)]=s}return new oo(r,i,e.space)}const qb=zs({properties:{ariaActiveDescendant:null,ariaAtomic:Wt,ariaAutoComplete:null,ariaBusy:Wt,ariaChecked:Wt,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:yt,ariaCurrent:null,ariaDescribedBy:yt,ariaDetails:null,ariaDisabled:Wt,ariaDropEffect:yt,ariaErrorMessage:null,ariaExpanded:Wt,ariaFlowTo:yt,ariaGrabbed:Wt,ariaHasPopup:null,ariaHidden:Wt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:yt,ariaLevel:Se,ariaLive:null,ariaModal:Wt,ariaMultiLine:Wt,ariaMultiSelectable:Wt,ariaOrientation:null,ariaOwns:yt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:Wt,ariaReadOnly:Wt,ariaRelevant:null,ariaRequired:Wt,ariaRoleDescription:yt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:Wt,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function Wb(e,r){return r in e?e[r]:r}function Gb(e,r){return Wb(e,r.toLowerCase())}const EC=zs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Os,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:Se,colSpan:null,content:null,contentEditable:Wt,controls:Xe,controlsList:yt,coords:Se|Os,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xe,defer:Xe,dir:null,dirName:null,disabled:Xe,download:oh,draggable:Wt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:yt,height:Se,hidden:oh,high:Se,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:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,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:Se,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:Se,rowSpan:Se,sandbox:yt,scope:null,scoped:Xe,seamless:Xe,selected:Xe,shadowRootClonable:Xe,shadowRootDelegatesFocus:Xe,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:Wt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Xe,useMap:null,value:Wt,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:yt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xe,declare:Xe,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Xe,noHref:Xe,noShade:Xe,noWrap:Xe,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:Wt,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Xe,disableRemotePlayback:Xe,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:Gb}),jC=zs({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:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className: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:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:Xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Os,g2:Os,glyphName:Os,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:On,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:yt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,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:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:On,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:On,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:On,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Wb}),Vb=zs({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()}}),Kb=zs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Gb}),Yb=zs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),NC={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"},TC=/[A-Z]/g,iv=/-[a-z]/g,AC=/^data[-\w.:]+$/i;function Xb(e,r){const i=Ja(r);let s=r,l=kn;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&AC.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(iv,LC);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!iv.test(u)){let f=u.replace(TC,DC);f.charAt(0)!=="-"&&(f="-"+f),r="data"+f}}l=Oh}return new l(s,r)}function DC(e){return"-"+e.toLowerCase()}function LC(e){return e.charAt(1).toUpperCase()}const Zb=$b([qb,EC,Vb,Kb,Yb],"html"),tc=$b([qb,jC,Vb,Kb,Yb],"svg");function sv(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function RC(e){return e.join(" ").trim()}var Es={},zd,av;function OC(){if(av)return zd;av=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="",v="comment",_="declaration";function E(y,x){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];x=x||{};var b=1,S=1;function j(R){var U=R.match(r);U&&(b+=U.length);var M=R.lastIndexOf(d);S=~M?R.length-M:S+R.length}function A(){var R={line:b,column:S};return function(U){return U.position=new N(R),B(),U}}function N(R){this.start=R,this.end={line:b,column:S},this.source=x.source}N.prototype.content=y;function D(R){var U=new Error(x.source+":"+b+":"+S+": "+R);if(U.reason=R,U.filename=x.source,U.line=b,U.column=S,U.source=y,!x.silent)throw U}function T(R){var U=R.exec(y);if(U){var M=U[0];return j(M),y=y.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!=y.charAt(0)||g!=y.charAt(1))){for(var U=2;m!=y.charAt(U)&&(g!=y.charAt(U)||p!=y.charAt(U+1));)++U;if(U+=2,m===y.charAt(U-1))return D("End of comment missing");var M=y.slice(2,U-2);return S+=2,j(M),y=y.slice(U),S+=2,R({type:v,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(y){return y?y.replace(c,m):m}return zd=E,zd}var ov;function MC(){if(ov)return Es;ov=1;var e=Es&&Es.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Es,"__esModule",{value:!0}),Es.default=i;const r=e(OC());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 Es}var Ba={},lv;function IC(){if(lv)return Ba;lv=1,Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.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 Ba.camelCase=d,Ba}var za,cv;function BC(){if(cv)return za;cv=1;var e=za&&za.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},r=e(MC()),i=IC();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,za=s,za}var zC=BC();const HC=Vl(zC),Qb=Jb("end"),Mh=Jb("start");function Jb(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 PC(e){const r=Mh(e),i=Qb(e);if(r&&i)return{start:r,end:i}}function Ga(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?uv(e.position):"start"in e||"end"in e?uv(e):"line"in e||"column"in e?ch(e):""}function ch(e){return dv(e&&e.line)+":"+dv(e&&e.column)}function uv(e){return ch(e&&e.start)+"-"+ch(e&&e.end)}function dv(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=Ga(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 Ih={}.hasOwnProperty,FC=new Map,UC=/[A-Z]/g,$C=new Set(["table","tbody","thead","tfoot","tr"]),qC=new Set(["td","th"]),ey="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function WC(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=JC(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=QC(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"?tc:Zb,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=ty(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function ty(e,r,i){if(r.type==="element")return GC(e,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return VC(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return YC(e,r,i);if(r.type==="mdxjsEsm")return KC(e,r);if(r.type==="root")return XC(e,r,i);if(r.type==="text")return ZC(e,r)}function GC(e,r,i){const s=e.schema;let l=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=tc,e.schema=l),e.ancestors.push(r);const u=ry(e,r.tagName,!1),f=e2(e,r);let c=zh(e,r);return $C.has(r.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!CC(d):!0})),ny(e,f,u,r),Bh(f,c),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function VC(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)}eo(e,r.position)}function KC(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);eo(e,r.position)}function YC(e,r,i){const s=e.schema;let l=s;r.name==="svg"&&s.space==="html"&&(l=tc,e.schema=l),e.ancestors.push(r);const u=r.name===null?e.Fragment:ry(e,r.name,!0),f=t2(e,r),c=zh(e,r);return ny(e,f,u,r),Bh(f,c),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function XC(e,r,i){const s={};return Bh(s,zh(e,r)),e.create(r,e.Fragment,s,i)}function ZC(e,r){return r.value}function ny(e,r,i,s){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(r.node=s)}function Bh(e,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(e.children=i)}}function QC(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 JC(e,r){return i;function i(s,l,u,f){const c=Array.isArray(u.children),d=Mh(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 e2(e,r){const i={};let s,l;for(l in r.properties)if(l!=="children"&&Ih.call(r.properties,l)){const u=n2(e,l,r.properties[l]);if(u){const[f,c]=u;e.tableCellAlignToStyle&&f==="align"&&typeof c=="string"&&qC.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 t2(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 eo(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 eo(e,r.position);else u=s.value===null?!0:s.value;i[l]=u}return i}function zh(e,r){const i=[];let s=-1;const l=e.passKeys?new Map:FC;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=ty(e,u,f);c!==void 0&&i.push(c)}return i}function n2(e,r,i){const s=Xb(e.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?bC(i):RC(i)),s.property==="style"){let l=typeof i=="object"?i:r2(e,String(i));return e.stylePropertyNameCase==="css"&&(l=i2(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?NC[s.property]||s.property:s.attribute,i]}}function r2(e,r){try{return HC(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=ey+"#cannot-parse-style-attribute",l}}function ry(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=tv(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=tv(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const l=s.value;return Ih.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);eo(e)}function eo(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=ey+"#cannot-handle-mdx-estrees-without-createevaluater",i}function i2(e){const r={};let i;for(i in e)Ih.call(e,i)&&(r[s2(i)]=e[i]);return r}function s2(e){let r=e.replace(UC,a2);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function a2(e){return"-"+e.toLowerCase()}const Hd={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"]},o2={};function Hh(e,r){const i=o2,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,l=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return iy(e,s,l)}function iy(e,r,i){if(l2(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 hv(e.children,r,i)}return Array.isArray(e)?hv(e,r,i):""}function hv(e,r,i){const s=[];let l=-1;for(;++l<e.length;)s[l]=iy(e[l],r,i);return s.join("")}function l2(e){return!!(e&&typeof e=="object")}const fv=document.createElement("i");function to(e){const r="&"+e+";";fv.innerHTML=r;const i=fv.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 Kn(e,r){return e.length>0?(In(e,e.length,0,r),e):r}const pv={}.hasOwnProperty;function sy(e){const r={};let i=-1;for(;++i<e.length;)c2(r,e[i]);return r}function c2(e,r){let i;for(i in r){const l=(pv.call(e,i)?e[i]:void 0)||(e[i]={}),u=r[i];let f;if(u)for(f in u){pv.call(l,f)||(l[f]=[]);const c=u[f];u2(l[f],Array.isArray(c)?c:c?[c]:[])}}}function u2(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 ay(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 tr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const mn=ui(/[A-Za-z]/),hn=ui(/[\dA-Za-z]/),d2=ui(/[#-'*+\--9=?A-Z^-~]/);function Fl(e){return e!==null&&(e<32||e===127)}const uh=ui(/\d/),h2=ui(/[\dA-Fa-f]/),f2=ui(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function bt(e){return e!==null&&(e<0||e===32)}function tt(e){return e===-2||e===-1||e===32}const nc=ui(new RegExp("\\p{P}|\\p{S}","u")),Ii=ui(/\s/);function ui(e){return r;function r(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function Hs(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 tt(d)?(e.enter(i),c(d)):r(d)}function c(d){return tt(d)&&u++<l?(e.consume(d),c):(e.exit(i),r(d))}}const p2={tokenize:m2};function m2(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 g2={tokenize:x2},mv={tokenize:v2};function x2(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&&b();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}x(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 v(S);if(l.currentConstruct&&l.currentConstruct.concrete)return E(S);r.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(mv,g,m)(S)}function g(S){return l&&b(),x(s),v(S)}function m(S){return r.parser.lazy[r.now().line]=s!==i.length,f=r.now().offset,E(S)}function v(S){return r.containerState={},e.attempt(mv,_,E)(S)}function _(S){return s++,i.push([r.currentConstruct,r.containerState]),v(S)}function E(S){if(S===null){l&&b(),x(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){y(e.exit("chunkFlow"),!0),x(0),e.consume(S);return}return Pe(S)?(e.consume(S),y(e.exit("chunkFlow")),s=0,r.interrupt=void 0,c):(e.consume(S),C)}function y(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(x(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 x(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 b(){l.write([null]),u=void 0,l=void 0,r.containerState._closeFlow=void 0}}function v2(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 Ms(e){if(e===null||bt(e)||Ii(e))return 1;if(nc(e))return 2}function rc(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 dh={name:"attention",resolveAll:b2,tokenize:y2};function b2(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},v={...e[i][1].start};gv(m,-d),gv(v,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:v},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=Kn(p,[["enter",e[s][1],r],["exit",e[s][1],r]])),p=Kn(p,[["enter",l,r],["enter",f,r],["exit",f,r],["enter",u,r]]),p=Kn(p,rc(r.parser.constructs.insideSpan.null,e.slice(s+1,i),r)),p=Kn(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=Kn(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 y2(e,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,l=Ms(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=Ms(d),m=!g||g===2&&l||i.includes(d),v=!l||l===2&&g||i.includes(s);return p._open=!!(u===42?m:m&&(l||!v)),p._close=!!(u===42?v:v&&(g||!m)),r(d)}}function gv(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const _2={name:"autolink",tokenize:S2};function S2(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||Fl(_)?i(_):(e.consume(_),d)}function p(_){return _===64?(e.consume(_),g):d2(_)?(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):v(_)}function v(_){if((_===45||hn(_))&&s++<63){const E=_===45?v:m;return e.consume(_),E}return i(_)}}const lo={partial:!0,tokenize:w2};function w2(e,r,i){return s;function s(u){return tt(u)?at(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Pe(u)?r(u):i(u)}}const oy={continuation:{tokenize:k2},exit:E2,name:"blockQuote",tokenize:C2};function C2(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 tt(f)?(e.enter("blockQuotePrefixWhitespace"),e.consume(f),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(f))}}function k2(e,r,i){const s=this;return l;function l(f){return tt(f)?at(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return e.attempt(oy,r,i)(f)}}function E2(e){e.exit("blockQuote")}const ly={name:"characterEscape",tokenize:j2};function j2(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 f2(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):i(u)}}const cy={name:"characterReference",tokenize:N2};function N2(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=h2,g):(e.enter("characterReferenceValue"),u=7,f=uh,g(m))}function g(m){if(m===59&&l){const v=e.exit("characterReferenceValue");return f===hn&&!to(s.sliceSerialize(v))?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 xv={partial:!0,tokenize:A2},vv={concrete:!0,name:"codeFenced",tokenize:T2};function T2(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"),tt(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(xv,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(N))}function v(N){return N===null||Pe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(N)):tt(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),at(e,_,"whitespace")(N)):N===96&&N===c?i(N):(e.consume(N),v)}function _(N){return N===null||Pe(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),E(N))}function E(N){return N===null||Pe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(N)):N===96&&N===c?i(N):(e.consume(N),E)}function C(N){return e.attempt(l,j,y)(N)}function y(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),x}function x(N){return u>0&&tt(N)?at(e,b,"linePrefix",u+1)(N):b(N)}function b(N){return N===null||Pe(N)?e.check(xv,C,j)(N):(e.enter("codeFlowValue"),S(N))}function S(N){return N===null||Pe(N)?(e.exit("codeFlowValue"),b(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"),tt(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"),tt(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 A2(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 Pd={name:"codeIndented",tokenize:L2},D2={partial:!0,tokenize:R2};function L2(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(D2,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 R2(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 O2={name:"codeText",previous:I2,resolve:M2,tokenize:B2};function M2(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 I2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function B2(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 z2{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&&Ha(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),Ha(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Ha(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);Ha(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Ha(this.left,i.reverse())}}}function Ha(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 uy(e){const r={};let i=-1,s,l,u,f,c,d,p;const g=new z2(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,H2(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 H2(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,v=-1,_=i,E=0,C=0;const y=[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;++v<c.length;)c[v][0]==="exit"&&c[v-1][0]==="enter"&&c[v][1].type===c[v-1][1].type&&c[v][1].start.line!==c[v][1].end.line&&(C=v+1,y.push(C),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(f.events=[],_?(_._tokenizer=void 0,_.previous=void 0):y.pop(),v=y.length;v--;){const x=c.slice(y[v],y[v+1]),b=u.pop();d.push([b,b+x.length-1]),e.splice(b,2,x)}for(d.reverse(),v=-1;++v<d.length;)p[E+d[v][0]]=E+d[v][1],E+=d[v][1]-d[v][0]-1;return p}const P2={resolve:U2,tokenize:$2},F2={partial:!0,tokenize:q2};function U2(e){return uy(e),e}function $2(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(F2,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 q2(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 dy(e,r,i,s,l,u,f,c,d){const p=d||Number.POSITIVE_INFINITY;let g=0;return m;function m(x){return x===60?(e.enter(s),e.enter(l),e.enter(u),e.consume(x),e.exit(u),v):x===null||x===32||x===41||Fl(x)?i(x):(e.enter(s),e.enter(f),e.enter(c),e.enter("chunkString",{contentType:"string"}),C(x))}function v(x){return x===62?(e.enter(u),e.consume(x),e.exit(u),e.exit(l),e.exit(s),r):(e.enter(c),e.enter("chunkString",{contentType:"string"}),_(x))}function _(x){return x===62?(e.exit("chunkString"),e.exit(c),v(x)):x===null||x===60||Pe(x)?i(x):(e.consume(x),x===92?E:_)}function E(x){return x===60||x===62||x===92?(e.consume(x),_):_(x)}function C(x){return!g&&(x===null||x===41||bt(x))?(e.exit("chunkString"),e.exit(c),e.exit(f),e.exit(s),r(x)):g<p&&x===40?(e.consume(x),g++,C):x===41?(e.consume(x),g--,C):x===null||x===32||x===40||Fl(x)?i(x):(e.consume(x),x===92?y:C)}function y(x){return x===40||x===41||x===92?(e.consume(x),C):C(x)}}function hy(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=!tt(_)),_===92?v:m)}function v(_){return _===91||_===92||_===93?(e.consume(_),c++,m):m(_)}}function fy(e,r,i,s,l,u){let f;return c;function c(v){return v===34||v===39||v===40?(e.enter(s),e.enter(l),e.consume(v),e.exit(l),f=v===40?41:v,d):i(v)}function d(v){return v===f?(e.enter(l),e.consume(v),e.exit(l),e.exit(s),r):(e.enter(u),p(v))}function p(v){return v===f?(e.exit(u),d(f)):v===null?i(v):Pe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),at(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===f||v===null||Pe(v)?(e.exit("chunkString"),p(v)):(e.consume(v),v===92?m:g)}function m(v){return v===f||v===92?(e.consume(v),g):g(v)}}function Va(e,r){let i;return s;function s(l){return Pe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i=!0,s):tt(l)?at(e,s,i?"linePrefix":"lineSuffix")(l):r(l)}}const W2={name:"definition",tokenize:V2},G2={partial:!0,tokenize:K2};function V2(e,r,i){const s=this;let l;return u;function u(_){return e.enter("definition"),f(_)}function f(_){return hy.call(s,e,c,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function c(_){return l=tr(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(_)?Va(e,p)(_):p(_)}function p(_){return dy(e,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function g(_){return e.attempt(G2,m,m)(_)}function m(_){return tt(_)?at(e,v,"whitespace")(_):v(_)}function v(_){return _===null||Pe(_)?(e.exit("definition"),s.parser.defined.push(l),r(_)):i(_)}}function K2(e,r,i){return s;function s(c){return bt(c)?Va(e,l)(c):i(c)}function l(c){return fy(e,u,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function u(c){return tt(c)?at(e,f,"whitespace")(c):f(c)}function f(c){return c===null||Pe(c)?r(c):i(c)}}const Y2={name:"hardBreakEscape",tokenize:X2};function X2(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 Z2={name:"headingAtx",resolve:Q2,tokenize:J2};function Q2(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 J2(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)):tt(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 ek=["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"],bv=["pre","script","style","textarea"],tk={concrete:!0,name:"htmlFlow",resolveTo:ik,tokenize:sk},nk={partial:!0,tokenize:ok},rk={partial:!0,tokenize:ak};function ik(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 sk(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),v):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),y):i(F)}function v(F){return F===45?(e.consume(F),l=2,_):F===91?(e.consume(F),l=5,c=0,E):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 E(F){const ie="CDATA[";return F===ie.charCodeAt(c++)?(e.consume(F),c===ie.length?s.interrupt?r:K:E):i(F)}function C(F){return mn(F)?(e.consume(F),f=String.fromCharCode(F),y):i(F)}function y(F){if(F===null||F===47||F===62||bt(F)){const ie=F===47,Q=f.toLowerCase();return!ie&&!u&&bv.includes(Q)?(l=1,s.interrupt?r(F):K(F)):ek.includes(f.toLowerCase())?(l=6,ie?(e.consume(F),x):s.interrupt?r(F):K(F)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(F):u?b(F):S(F))}return F===45||hn(F)?(e.consume(F),f+=String.fromCharCode(F),y):i(F)}function x(F){return F===62?(e.consume(F),s.interrupt?r:K):i(F)}function b(F){return tt(F)?(e.consume(F),b):H(F)}function S(F){return F===47?(e.consume(F),H):F===58||F===95||mn(F)?(e.consume(F),j):tt(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):tt(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):tt(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||tt(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):tt(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(nk,V,q)(F)):F===null||Pe(F)?(e.exit("htmlFlowData"),q(F)):(e.consume(F),K)}function q(F){return e.check(rk,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 bv.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 ak(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 ok(e,r,i){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(lo,r,i)}}const lk={name:"htmlText",tokenize:ck};function ck(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,E):mn(L)?(e.consume(L),b):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),v):Pe(L)?(f=m,Y(L)):(e.consume(L),m)}function v(L){return L===45?(e.consume(L),_):m(L)}function _(L){return L===62?M(L):L===45?v(L):m(L)}function E(L){const I="CDATA[";return L===I.charCodeAt(u++)?(e.consume(L),u===I.length?C:E):i(L)}function C(L){return L===null?i(L):L===93?(e.consume(L),y):Pe(L)?(f=C,Y(L)):(e.consume(L),C)}function y(L){return L===93?(e.consume(L),x):C(L)}function x(L){return L===62?M(L):L===93?(e.consume(L),x):C(L)}function b(L){return L===null||L===62?M(L):Pe(L)?(f=b,Y(L)):(e.consume(L),b)}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)):tt(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)):tt(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)):tt(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)):tt(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 tt(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 Ph={name:"labelEnd",resolveAll:fk,resolveTo:pk,tokenize:mk},uk={tokenize:gk},dk={tokenize:xk},hk={tokenize:vk};function fk(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 pk(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=Kn(c,e.slice(u+1,u+s+3)),c=Kn(c,[["enter",g,r]]),c=Kn(c,rc(r.parser.constructs.insideSpan.null,e.slice(u+s+4,f-3),r)),c=Kn(c,[["exit",g,r],e[f-2],e[f-1],["exit",p,r]]),c=Kn(c,e.slice(f+1)),c=Kn(c,[["exit",d,r]]),In(e,u,e.length,c),e}function mk(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(v){return u?u._inactive?m(v):(f=s.parser.defined.includes(tr(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),d):i(v)}function d(v){return v===40?e.attempt(uk,g,f?g:m)(v):v===91?e.attempt(dk,g,f?p:m)(v):f?g(v):m(v)}function p(v){return e.attempt(hk,g,m)(v)}function g(v){return r(v)}function m(v){return u._balanced=!0,i(v)}}function gk(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)?Va(e,u)(m):u(m)}function u(m){return m===41?g(m):dy(e,f,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function f(m){return bt(m)?Va(e,d)(m):g(m)}function c(m){return i(m)}function d(m){return m===34||m===39||m===40?fy(e,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function p(m){return bt(m)?Va(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),r):i(m)}}function xk(e,r,i){const s=this;return l;function l(c){return hy.call(s,e,u,f,"reference","referenceMarker","referenceString")(c)}function u(c){return s.parser.defined.includes(tr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(c):i(c)}function f(c){return i(c)}}function vk(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 bk={name:"labelStartImage",resolveAll:Ph.resolveAll,tokenize:yk};function yk(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 _k={name:"labelStartLink",resolveAll:Ph.resolveAll,tokenize:Sk};function Sk(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 Fd={name:"lineEnding",tokenize:wk};function wk(e,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),at(e,r,"linePrefix")}}const Ml={name:"thematicBreak",tokenize:Ck};function Ck(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"),tt(p)?at(e,c,"whitespace")(p):c(p))}}const Cn={continuation:{tokenize:Nk},exit:Ak,name:"list",tokenize:jk},kk={partial:!0,tokenize:Dk},Ek={partial:!0,tokenize:Tk};function jk(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 E=s.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!s.containerState.marker||_===s.containerState.marker:uh(_)){if(s.containerState.type||(s.containerState.type=E,e.enter(E,{_container:!0})),E==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(Ml,i,p)(_):p(_);if(!s.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(_)}return i(_)}function d(_){return uh(_)&&++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(lo,s.interrupt?i:g,e.attempt(kk,v,m))}function g(_){return s.containerState.initialBlankLine=!0,u++,v(_)}function m(_){return tt(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),v):i(_)}function v(_){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(_)}}function Nk(e,r,i){const s=this;return s.containerState._closeFlow=void 0,e.check(lo,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||!tt(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(Ek,r,f)(c))}function f(c){return s.containerState._closeFlow=!0,s.interrupt=void 0,at(e,e.attempt(Cn,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function Tk(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 Ak(e){e.exit(this.containerState.type)}function Dk(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!tt(u)&&f&&f[1].type==="listItemPrefixWhitespace"?r(u):i(u)}}const yv={name:"setextUnderline",resolveTo:Lk,tokenize:Rk};function Lk(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 Rk(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"),tt(p)?at(e,d,"lineSuffix")(p):d(p))}function d(p){return p===null||Pe(p)?(e.exit("setextHeadingLine"),r(p)):i(p)}}const Ok={tokenize:Mk};function Mk(e){const r=this,i=e.attempt(lo,s,e.attempt(this.parser.constructs.flowInitial,l,at(e,e.attempt(this.parser.constructs.flow,l,e.attempt(P2,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 Ik={resolveAll:my()},Bk=py("string"),zk=py("text");function py(e){return{resolveAll:my(e==="text"?Hk: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 v=-1;if(m)for(;++v<m.length;){const _=m[v];if(!_.previous||_.previous.call(s,s.previous))return!0}return!1}}}function my(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 Hk(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 Pk={42:Cn,43:Cn,45:Cn,48:Cn,49:Cn,50:Cn,51:Cn,52:Cn,53:Cn,54:Cn,55:Cn,56:Cn,57:Cn,62:oy},Fk={91:W2},Uk={[-2]:Pd,[-1]:Pd,32:Pd},$k={35:Z2,42:Ml,45:[yv,Ml],60:tk,61:yv,95:Ml,96:vv,126:vv},qk={38:cy,92:ly},Wk={[-5]:Fd,[-4]:Fd,[-3]:Fd,33:bk,38:cy,42:dh,60:[_2,lk],91:_k,92:[Y2,ly],93:Ph,95:dh,96:O2},Gk={null:[dh,Ik]},Vk={null:[42,95]},Kk={null:[]},Yk=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Vk,contentInitial:Fk,disable:Kk,document:Pk,flow:$k,flowInitial:Uk,insideSpan:Gk,string:qk,text:Wk},Symbol.toStringTag,{value:"Module"}));function Xk(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:b,enter:S,exit:j,interrupt:D(N,{interrupt:!0})},p={code:null,containerState:{},defineSkip:C,events:[],now:E,parser:e,previous:null,sliceSerialize:v,sliceStream:_,write:m};let g=r.tokenize.call(p,d);return r.resolveAll&&u.push(r),p;function m(W){return f=Kn(f,W),y(),f[f.length-1]!==null?[]:(T(r,0),p.events=rc(u,p.events,p),p.events)}function v(W,K){return Qk(_(W),K)}function _(W){return Zk(f,W)}function E(){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 y(){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;)x(K.charCodeAt(s._bufferIndex));else x(K)}}function x(W){g=g(W)}function b(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=E(),p.events.push(["enter",q,p]),c.push(q),q}function j(W){const K=c.pop();return K.end=E(),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=E(),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 Zk(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 Qk(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 Jk(e){const s={constructs:sy([Yk,...(e||{}).extensions||[]]),content:l(p2),defined:[],document:l(g2),flow:l(Ok),lazy:{},string:l(Bk),text:l(zk)};return s;function l(u){return f;function f(c){return Xk(s,u,c)}}}function eE(e){for(;!uy(e););return e}const _v=/[\0\t\n\r]/g;function tE(){let e=1,r="",i=!0,s;return l;function l(u,f,c){const d=[];let p,g,m,v,_;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(_v.lastIndex=m,p=_v.exec(u),v=p&&p.index!==void 0?p.index:u.length,_=u.charCodeAt(v),!p){r=u.slice(m);break}if(_===10&&m===v&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),m<v&&(d.push(u.slice(m,v)),e+=v-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=v+1}return c&&(s&&d.push(-5),r&&d.push(r),d.push(null)),d}}const nE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function rE(e){return e.replace(nE,iE)}function iE(e,r,i){if(r)return r;if(i.charCodeAt(0)===35){const l=i.charCodeAt(1),u=l===120||l===88;return ay(i.slice(u?2:1),u?16:10)}return to(i)||e}const gy={}.hasOwnProperty;function sE(e,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),aE(i)(eE(Jk(i).document().write(tE()(e,r,!0))))}function aE(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(Ie),hardBreakEscape:u(Ue),hardBreakTrailing:u(Ue),htmlFlow:u(je,f),htmlFlowData:B,htmlText:u(je,f),htmlTextData:B,image:u(me),label:f,link:u(Te),listItem:u(Rt),listItemValue:v,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(y),codeFencedFence:C,codeFencedFenceInfo:_,codeFencedFenceMeta:E,codeFlowValue:H,codeIndented:d(x),codeText:d(U),codeTextData:H,data:H,definition:d(),definitionDestinationString:j,definitionLabelString:b,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()}};xy(r,(e||{}).mdastExtensions||[]);const i={};return s;function s(ue){let _e={type:"root",children:[]};const Ne={stack:[_e],tokenStack:[],config:r,enter:c,exit:p,buffer:f,resume:g,data:i},Oe=[];let qe=-1;for(;++qe<ue.length;)if(ue[qe][1].type==="listOrdered"||ue[qe][1].type==="listUnordered")if(ue[qe][0]==="enter")Oe.push(qe);else{const Nt=Oe.pop();qe=l(ue,Nt,qe)}for(qe=-1;++qe<ue.length;){const Nt=r[ue[qe][0]];gy.call(Nt,ue[qe][1].type)&&Nt[ue[qe][1].type].call(Object.assign({sliceSerialize:ue[qe][2].sliceSerialize},Ne),ue[qe][1])}if(Ne.tokenStack.length>0){const Nt=Ne.tokenStack[Ne.tokenStack.length-1];(Nt[1]||Sv).call(Ne,void 0,Nt[0])}for(_e.position={start:ai(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:ai(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},qe=-1;++qe<r.transforms.length;)_e=r.transforms[qe](_e)||_e;return _e}function l(ue,_e,Ne){let Oe=_e-1,qe=-1,Nt=!1,Ze,Ot,Tt,Yt;for(;++Oe<=Ne;){const lt=ue[Oe];switch(lt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{lt[0]==="enter"?qe++:qe--,Yt=void 0;break}case"lineEndingBlank":{lt[0]==="enter"&&(Ze&&!Yt&&!qe&&!Tt&&(Tt=Oe),Yt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Yt=void 0}if(!qe&&lt[0]==="enter"&&lt[1].type==="listItemPrefix"||qe===-1&&lt[0]==="exit"&&(lt[1].type==="listUnordered"||lt[1].type==="listOrdered")){if(Ze){let Bn=Oe;for(Ot=void 0;Bn--;){const Xt=ue[Bn];if(Xt[1].type==="lineEnding"||Xt[1].type==="lineEndingBlank"){if(Xt[0]==="exit")continue;Ot&&(ue[Ot][1].type="lineEndingBlank",Nt=!0),Xt[1].type="lineEnding",Ot=Bn}else if(!(Xt[1].type==="linePrefix"||Xt[1].type==="blockQuotePrefix"||Xt[1].type==="blockQuotePrefixWhitespace"||Xt[1].type==="blockQuoteMarker"||Xt[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||Oe,0,["exit",Ze,lt[2]]),Oe++,Ne++}if(lt[1].type==="listItemPrefix"){const Bn={type:"listItem",_spread:!1,start:Object.assign({},lt[1].start),end:void 0};Ze=Bn,ue.splice(Oe,0,["enter",Bn,lt[2]]),Oe++,Ne++,Tt=void 0,Yt=!0}}}return ue[_e][1]._spread=Nt,Ne}function u(ue,_e){return Ne;function Ne(Oe){c.call(this,ue(Oe),Oe),_e&&_e.call(this,Oe)}}function f(){this.stack.push({type:"fragment",children:[]})}function c(ue,_e,Ne){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([_e,Ne||void 0]),ue.position={start:ai(_e.start),end:void 0}}function d(ue){return _e;function _e(Ne){ue&&ue.call(this,Ne),p.call(this,Ne)}}function p(ue,_e){const Ne=this.stack.pop(),Oe=this.tokenStack.pop();if(Oe)Oe[0].type!==ue.type&&(_e?_e.call(this,ue,Oe[0]):(Oe[1]||Sv).call(this,ue,Oe[0]));else throw new Error("Cannot close `"+ue.type+"` ("+Ga({start:ue.start,end:ue.end})+"): it’s not open");Ne.position.end=ai(ue.end)}function g(){return Hh(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function v(ue){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function _(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=ue}function E(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=ue}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue.replace(/(\r?\n|\r)$/g,"")}function b(ue){const _e=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=_e,Ne.identifier=tr(this.sliceSerialize(ue)).toLowerCase()}function S(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ue}function j(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ue}function A(ue){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Ne=this.sliceSerialize(ue).length;_e.depth=Ne}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function D(ue){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function B(ue){const Ne=this.stack[this.stack.length-1].children;let Oe=Ne[Ne.length-1];(!Oe||Oe.type!=="text")&&(Oe=Be(),Oe.position={start:ai(ue.start),end:void 0},Ne.push(Oe)),this.stack.push(Oe)}function H(ue){const _e=this.stack.pop();_e.value+=this.sliceSerialize(ue),_e.position.end=ai(ue.end)}function W(ue){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ne=_e.children[_e.children.length-1];Ne.position.end=ai(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(_e.type)&&(B.call(this,ue),H.call(this,ue))}function K(){this.data.atHardBreak=!0}function q(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function R(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function U(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function M(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=_e,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function Y(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=_e,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function Z(ue){const _e=this.sliceSerialize(ue),Ne=this.stack[this.stack.length-2];Ne.label=rE(_e),Ne.identifier=tr(_e).toLowerCase()}function z(){const ue=this.stack[this.stack.length-1],_e=this.resume(),Ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ne.type==="link"){const Oe=ue.children;Ne.children=Oe}else Ne.alt=_e}function L(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ue}function I(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ue}function V(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function ie(ue){const _e=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=_e,Ne.identifier=tr(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function Q(ue){this.data.characterReferenceType=ue.type}function ee(ue){const _e=this.sliceSerialize(ue),Ne=this.data.characterReferenceType;let Oe;Ne?(Oe=ay(_e,Ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Oe=to(_e);const qe=this.stack[this.stack.length-1];qe.value+=Oe}function X(ue){const _e=this.stack.pop();_e.position.end=ai(ue.end)}function $(ue){H.call(this,ue);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(ue)}function oe(ue){H.call(this,ue);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(ue)}function re(){return{type:"blockquote",children:[]}}function ve(){return{type:"code",lang:null,meta:null,value:""}}function be(){return{type:"inlineCode",value:""}}function Le(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ie(){return{type:"emphasis",children:[]}}function He(){return{type:"heading",depth:0,children:[]}}function Ue(){return{type:"break"}}function je(){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 ai(e){return{line:e.line,column:e.column,offset:e.offset}}function xy(e,r){let i=-1;for(;++i<r.length;){const s=r[i];Array.isArray(s)?xy(e,s):oE(e,s)}}function oE(e,r){let i;for(i in r)if(gy.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 Sv(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Ga({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Ga({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Ga({start:r.start,end:r.end})+") is still open")}function lE(e){const r=this;r.parser=i;function i(s){return sE(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function cE(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 uE(e,r){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,i),[e.applyData(r,i),{type:"text",value:`
95
+ `}]}function dE(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 hE(e,r){const i={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function fE(e,r){const i={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function pE(e,r){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),l=Hs(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 mE(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 gE(e,r){if(e.options.allowDangerousHtml){const i={type:"raw",value:r.value};return e.patch(r,i),e.applyData(r,i)}}function vy(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 xE(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return vy(e,r);const l={src:Hs(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 vE(e,r){const i={src:Hs(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 bE(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 yE(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return vy(e,r);const l={href:Hs(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 _E(e,r){const i={href:Hs(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 SE(e,r,i){const s=e.all(r),l=i?wE(i):by(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 wE(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=by(i[s])}return r}function by(e){const r=e.spread;return r??e.children.length>1}function CE(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 kE(e,r){const i={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function EE(e,r){const i={type:"root",children:e.wrap(e.all(r))};return e.patch(r,i),e.applyData(r,i)}function jE(e,r){const i={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function NE(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=Mh(r.children[1]),d=Qb(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 TE(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],v={},_=f?f[d]:void 0;_&&(v.align=_);let E={type:"element",tagName:u,properties:v,children:[]};m&&(E.children=e.all(m),e.patch(m,E),E=e.applyData(m,E)),p.push(E)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(r,g),e.applyData(r,g)}function AE(e,r){const i={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}const wv=9,Cv=32;function DE(e){const r=String(e),i=/\r?\n|\r/g;let s=i.exec(r),l=0;const u=[];for(;s;)u.push(kv(r.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=i.exec(r);return u.push(kv(r.slice(l),l>0,!1)),u.join("")}function kv(e,r,i){let s=0,l=e.length;if(r){let u=e.codePointAt(s);for(;u===wv||u===Cv;)s++,u=e.codePointAt(s)}if(i){let u=e.codePointAt(l-1);for(;u===wv||u===Cv;)l--,u=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function LE(e,r){const i={type:"text",value:DE(String(r.value))};return e.patch(r,i),e.applyData(r,i)}function RE(e,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,i),e.applyData(r,i)}const OE={blockquote:cE,break:uE,code:dE,delete:hE,emphasis:fE,footnoteReference:pE,heading:mE,html:gE,imageReference:xE,image:vE,inlineCode:bE,linkReference:yE,link:_E,listItem:SE,list:CE,paragraph:kE,root:EE,strong:jE,table:NE,tableCell:AE,tableRow:TE,text:LE,thematicBreak:RE,toml:jl,yaml:jl,definition:jl,footnoteDefinition:jl};function jl(){}const yy=-1,ic=0,Ka=1,Ul=2,Fh=3,Uh=4,$h=5,qh=6,_y=7,Sy=8,Ev=typeof self=="object"?self:globalThis,ME=(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 ic:case yy:return i(f,l);case Ka:{const c=i([],l);for(const d of f)c.push(s(d));return c}case Ul:{const c=i({},l);for(const[d,p]of f)c[s(d)]=s(p);return c}case Fh:return i(new Date(f),l);case Uh:{const{source:c,flags:d}=f;return i(new RegExp(c,d),l)}case $h:{const c=i(new Map,l);for(const[d,p]of f)c.set(s(d),s(p));return c}case qh:{const c=i(new Set,l);for(const d of f)c.add(s(d));return c}case _y:{const{name:c,message:d}=f;return i(new Ev[c](d),l)}case Sy: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 Ev[u](f),l)};return s},jv=e=>ME(new Map,e)(0),js="",{toString:IE}={},{keys:BE}=Object,Pa=e=>{const r=typeof e;if(r!=="object"||!e)return[ic,r];const i=IE.call(e).slice(8,-1);switch(i){case"Array":return[Ka,js];case"Object":return[Ul,js];case"Date":return[Fh,js];case"RegExp":return[Uh,js];case"Map":return[$h,js];case"Set":return[qh,js];case"DataView":return[Ka,i]}return i.includes("Array")?[Ka,i]:i.includes("Error")?[_y,i]:[Ul,i]},Nl=([e,r])=>e===ic&&(r==="function"||r==="symbol"),zE=(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]=Pa(f);switch(c){case ic:{let g=f;switch(d){case"bigint":c=Sy,g=f.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return l([yy],f)}return l([c,g],f)}case Ka:{if(d){let v=f;return d==="DataView"?v=new Uint8Array(f.buffer):d==="ArrayBuffer"&&(v=new Uint8Array(f)),l([d,[...v]],f)}const g=[],m=l([c,g],f);for(const v of f)g.push(u(v));return m}case Ul:{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 v of BE(f))(e||!Nl(Pa(f[v])))&&g.push([u(v),u(f[v])]);return m}case Fh:return l([c,f.toISOString()],f);case Uh:{const{source:g,flags:m}=f;return l([c,{source:g,flags:m}],f)}case $h:{const g=[],m=l([c,g],f);for(const[v,_]of f)(e||!(Nl(Pa(v))||Nl(Pa(_))))&&g.push([u(v),u(_)]);return m}case qh:{const g=[],m=l([c,g],f);for(const v of f)(e||!Nl(Pa(v)))&&g.push(u(v));return m}}const{message:p}=f;return l([c,{name:d,message:p}],f)};return u},Nv=(e,{json:r,lossy:i}={})=>{const s=[];return zE(!(r||i),!!r,new Map,s)(e),s},$l=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?jv(Nv(e,r)):structuredClone(e):(e,r)=>jv(Nv(e,r));function HE(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 PE(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function FE(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||HE,s=e.options.footnoteBackLabel||PE,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(),v=Hs(m.toLowerCase());let _=0;const E=[],C=e.footnoteCounts.get(m);for(;C!==void 0&&++_<=C;){E.length>0&&E.push({type:"text",value:" "});let b=typeof i=="string"?i:i(d,_);typeof b=="string"&&(b={type:"text",value:b}),E.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+v+(_>1?"-"+_:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,_),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const y=g[g.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const b=y.children[y.children.length-1];b&&b.type==="text"?b.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...E)}else g.push(...E);const x={type:"element",tagName:"li",properties:{id:r+"fn-"+v},children:e.wrap(g,!0)};e.patch(p,x),c.push(x)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...$l(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 sc=(function(e){if(e==null)return WE;if(typeof e=="function")return ac(e);if(typeof e=="object")return Array.isArray(e)?UE(e):$E(e);if(typeof e=="string")return qE(e);throw new Error("Expected function, string, or object as test")});function UE(e){const r=[];let i=-1;for(;++i<e.length;)r[i]=sc(e[i]);return ac(s);function s(...l){let u=-1;for(;++u<r.length;)if(r[u].apply(this,l))return!0;return!1}}function $E(e){const r=e;return ac(i);function i(s){const l=s;let u;for(u in e)if(l[u]!==r[u])return!1;return!0}}function qE(e){return ac(r);function r(i){return i&&i.type===e}}function ac(e){return r;function r(i,s,l){return!!(GE(i)&&e.call(this,i,typeof s=="number"?s:void 0,l||void 0))}}function WE(){return!0}function GE(e){return e!==null&&typeof e=="object"&&"type"in e}const wy=[],VE=!0,hh=!1,KE="skip";function Cy(e,r,i,s){let l;typeof r=="function"&&typeof i!="function"?(s=i,i=r):l=r;const u=sc(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(v,"name",{value:"node ("+(d.type+(_?"<"+_+">":""))+")"})}return v;function v(){let _=wy,E,C,y;if((!r||u(d,p,g[g.length-1]||void 0))&&(_=YE(i(d,g)),_[0]===hh))return _;if("children"in d&&d.children){const x=d;if(x.children&&_[0]!==KE)for(C=(s?x.children.length:-1)+f,y=g.concat(x);C>-1&&C<x.children.length;){const b=x.children[C];if(E=c(b,C,y)(),E[0]===hh)return E;C=typeof E[1]=="number"?E[1]:C+f}}return _}}}function YE(e){return Array.isArray(e)?e:typeof e=="number"?[VE,e]:e==null?wy:[e]}function Wh(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),Cy(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 fh={}.hasOwnProperty,XE={};function ZE(e,r){const i=r||XE,s=new Map,l=new Map,u=new Map,f={...OE,...i.handlers},c={all:p,applyData:JE,definitionById:s,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:f,one:d,options:i,patch:QE,wrap:tj};return Wh(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?s:l,v=String(g.identifier).toUpperCase();m.has(v)||m.set(v,g)}}),c;function d(g,m){const v=g.type,_=c.handlers[v];if(fh.call(c.handlers,v)&&_)return _(c,g,m);if(c.options.passThrough&&c.options.passThrough.includes(v)){if("children"in g){const{children:C,...y}=g,x=$l(y);return x.children=c.all(g),x}return $l(g)}return(c.options.unknownHandler||ej)(c,g,m)}function p(g){const m=[];if("children"in g){const v=g.children;let _=-1;for(;++_<v.length;){const E=c.one(v[_],g);if(E){if(_&&v[_-1].type==="break"&&(!Array.isArray(E)&&E.type==="text"&&(E.value=Tv(E.value)),!Array.isArray(E)&&E.type==="element")){const C=E.children[0];C&&C.type==="text"&&(C.value=Tv(C.value))}Array.isArray(E)?m.push(...E):m.push(E)}}}return m}}function QE(e,r){e.position&&(r.position=PC(e))}function JE(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,$l(u)),"children"in i&&i.children&&l!==null&&l!==void 0&&(i.children=l)}return i}function ej(e,r){const i=r.data||{},s="value"in r&&!(fh.call(i,"hProperties")||fh.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 tj(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 Tv(e){let r=0,i=e.charCodeAt(r);for(;i===9||i===32;)r++,i=e.charCodeAt(r);return e.slice(r)}function Av(e,r){const i=ZE(e,r),s=i.one(e,void 0),l=FE(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 nj(e,r){return e&&"run"in e?async function(i,s){const l=Av(i,{file:s,...r});await e.run(l,s)}:function(i,s){return Av(i,{file:s,...e||r})}}function Dv(e){if(e)throw e}var Ud,Lv;function rj(){if(Lv)return Ud;Lv=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 v;for(v in p);return typeof v>"u"||e.call(p,v)},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 Ud=function d(){var p,g,m,v,_,E,C=arguments[0],y=1,x=arguments.length,b=!1;for(typeof C=="boolean"&&(b=C,C=arguments[1]||{},y=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});y<x;++y)if(p=arguments[y],p!=null)for(g in p)m=c(C,g),v=c(p,g),C!==v&&(b&&v&&(u(v)||(_=l(v)))?(_?(_=!1,E=m&&l(m)?m:[]):E=m&&u(m)?m:{},f(C,{name:g,newValue:d(b,E,v)})):typeof v<"u"&&f(C,{name:g,newValue:v}));return C},Ud}var ij=rj();const $d=Vl(ij);function ph(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 sj(){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?aj(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 aj(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 lr={basename:oj,dirname:lj,extname:cj,join:uj,sep:"/"};function oj(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');co(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 lj(e){if(co(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 cj(e){co(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 uj(...e){let r=-1,i;for(;++r<e.length;)co(e[r]),e[r]&&(i=i===void 0?e[r]:i+"/"+e[r]);return i===void 0?".":dj(i)}function dj(e){co(e);const r=e.codePointAt(0)===47;let i=hj(e,!r);return i.length===0&&!r&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),r?"/"+i:i}function hj(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 co(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const fj={cwd:pj};function pj(){return"/"}function mh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function mj(e){if(typeof e=="string")e=new URL(e);else if(!mh(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 gj(e)}function gj(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 qd=["history","path","basename","stem","extname","dirname"];class ky{constructor(r){let i;r?mh(r)?i={path:r}:typeof r=="string"||xj(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":fj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<qd.length;){const u=qd[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)qd.includes(l)||(this[l]=i[l])}get basename(){return typeof this.path=="string"?lr.basename(this.path):void 0}set basename(r){Gd(r,"basename"),Wd(r,"basename"),this.path=lr.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?lr.dirname(this.path):void 0}set dirname(r){Rv(this.basename,"dirname"),this.path=lr.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?lr.extname(this.path):void 0}set extname(r){if(Wd(r,"extname"),Rv(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=lr.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){mh(r)&&(r=mj(r)),Gd(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?lr.basename(this.path,this.extname):void 0}set stem(r){Gd(r,"stem"),Wd(r,"stem"),this.path=lr.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 Wd(e,r){if(e&&e.includes(lr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+lr.sep+"`")}function Gd(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function Rv(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function xj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const vj=(function(e){const s=this.constructor.prototype,l=s[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),bj={}.hasOwnProperty;class Gh extends vj{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=sj()}copy(){const r=new Gh;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data($d(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(Yd("data",this.frozen),this.namespace[r]=i,this):bj.call(this.namespace,r)&&this.namespace[r]||void 0:r?(Yd("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=Tl(r),s=this.parser||this.Parser;return Vd("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),Vd("process",this.parser||this.Parser),Kd("process",this.compiler||this.Compiler),i?l(void 0,i):new Promise(l);function l(u,f){const c=Tl(r),d=s.parse(c);s.run(d,c,function(g,m,v){if(g||!m||!v)return p(g);const _=m,E=s.stringify(_,v);Sj(E)?v.value=E:v.result=E,p(g,v)});function p(g,m){g||!m?f(g):u?u(m):i(void 0,m)}}}processSync(r){let i=!1,s;return this.freeze(),Vd("processSync",this.parser||this.Parser),Kd("processSync",this.compiler||this.Compiler),this.process(r,l),Mv("processSync","process",i),s;function l(u,f){i=!0,Dv(u),s=f}}run(r,i,s){Ov(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=Tl(i);l.run(r,d,p);function p(g,m,v){const _=m||r;g?c(g):f?f(_):s(void 0,_,v)}}}runSync(r,i){let s=!1,l;return this.run(r,i,u),Mv("runSync","run",s),l;function u(f,c){Dv(f),l=c,s=!0}}stringify(r,i){this.freeze();const s=Tl(i),l=this.compiler||this.Compiler;return Kd("stringify",l),Ov(r),l(r,s)}use(r,...i){const s=this.attachers,l=this.namespace;if(Yd("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=$d(!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,v=-1;for(;++m<s.length;)if(s[m][0]===p){v=m;break}if(v===-1)s.push([p,...g]);else if(g.length>0){let[_,...E]=g;const C=s[v][1];ph(C)&&ph(_)&&(_=$d(!0,C,_)),s[v]=[p,_,...E]}}}}const yj=new Gh().freeze();function Vd(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Kd(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yd(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 Ov(e){if(!ph(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Mv(e,r,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Tl(e){return _j(e)?e:new ky(e)}function _j(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Sj(e){return typeof e=="string"||wj(e)}function wj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Cj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Iv=[],Bv={allowDangerousHtml:!0},kj=/^(https?|ircs?|mailto|xmpp)$/i,Ej=[{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 jj(e){const r=Nj(e),i=Tj(e);return Aj(r.runSync(r.parse(i),i),e)}function Nj(e){const r=e.rehypePlugins||Iv,i=e.remarkPlugins||Iv,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Bv}:Bv;return yj().use(lE).use(i).use(nj,s).use(r)}function Tj(e){const r=e.children||"",i=new ky;return typeof r=="string"&&(i.value=r),i}function Aj(e,r){const i=r.allowedElements,s=r.allowElement,l=r.components,u=r.disallowedElements,f=r.skipHtml,c=r.unwrapDisallowed,d=r.urlTransform||Dj;for(const g of Ej)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+Cj+g.id,void 0);return Wh(e,p),WC(e,{Fragment:o.Fragment,components:l,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function p(g,m,v){if(g.type==="raw"&&v&&typeof m=="number")return f?v.children.splice(m,1):v.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let _;for(_ in Hd)if(Object.hasOwn(Hd,_)&&Object.hasOwn(g.properties,_)){const E=g.properties[_],C=Hd[_];(C===null||C.includes(g.tagName))&&(g.properties[_]=d(String(E||""),_,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,v)),_&&v&&typeof m=="number")return c&&g.children?v.children.splice(m,1,...g.children):v.children.splice(m,1),m}}}function Dj(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||kj.test(e.slice(0,r))?e:""}function zv(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 Lj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Rj(e,r,i){const l=sc((i||{}).ignore||[]),u=Oj(r);let f=-1;for(;++f<u.length;)Cy(e,"text",c);function c(p,g){let m=-1,v;for(;++m<g.length;){const _=g[m],E=v?v.children:void 0;if(l(_,E?E.indexOf(_):void 0,v))return;v=_}if(v)return d(p,g)}function d(p,g){const m=g[g.length-1],v=u[f][0],_=u[f][1];let E=0;const y=m.children.indexOf(p);let x=!1,b=[];v.lastIndex=0;let S=v.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?v.lastIndex=j+1:(E!==j&&b.push({type:"text",value:p.value.slice(E,j)}),Array.isArray(N)?b.push(...N):N&&b.push(N),E=j+S[0].length,x=!0),!v.global)break;S=v.exec(p.value)}return x?(E<p.value.length&&b.push({type:"text",value:p.value.slice(E)}),m.children.splice(y,1,...b)):b=[p],y+b.length}}function Oj(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([Mj(l[0]),Ij(l[1])])}return r}function Mj(e){return typeof e=="string"?new RegExp(Lj(e),"g"):e}function Ij(e){return typeof e=="function"?e:function(){return e}}const Xd="phrasing",Zd=["autolink","link","image","label"];function Bj(){return{transforms:[qj],enter:{literalAutolink:Hj,literalAutolinkEmail:Qd,literalAutolinkHttp:Qd,literalAutolinkWww:Qd},exit:{literalAutolink:$j,literalAutolinkEmail:Uj,literalAutolinkHttp:Pj,literalAutolinkWww:Fj}}}function zj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Xd,notInConstruct:Zd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Xd,notInConstruct:Zd},{character:":",before:"[ps]",after:"\\/",inConstruct:Xd,notInConstruct:Zd}]}}function Hj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Qd(e){this.config.enter.autolinkProtocol.call(this,e)}function Pj(e){this.config.exit.autolinkProtocol.call(this,e)}function Fj(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 Uj(e){this.config.exit.autolinkEmail.call(this,e)}function $j(e){this.exit(e)}function qj(e){Rj(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Wj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Gj]],{ignore:["link","linkReference"]})}function Wj(e,r,i,s,l){let u="";if(!Ey(l)||(/^w/i.test(r)&&(i=r+i,r="",u="http://"),!Vj(i)))return!1;const f=Kj(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 Gj(e,r,i,s){return!Ey(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function Vj(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 Kj(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=zv(e,"(");let u=zv(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 Ey(e,r){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Ii(i)||nc(i))&&(!r||i!==47)}jy.peek=rN;function Yj(){this.buffer()}function Xj(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Zj(){this.buffer()}function Qj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Jj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=tr(this.sliceSerialize(e)).toLowerCase(),i.label=r}function eN(e){this.exit(e)}function tN(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=tr(this.sliceSerialize(e)).toLowerCase(),i.label=r}function nN(e){this.exit(e)}function rN(){return"["}function jy(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 iN(){return{enter:{gfmFootnoteCallString:Yj,gfmFootnoteCall:Xj,gfmFootnoteDefinitionLabelString:Zj,gfmFootnoteDefinition:Qj},exit:{gfmFootnoteCallString:Jj,gfmFootnoteCall:eN,gfmFootnoteDefinitionLabelString:tN,gfmFootnoteDefinition:nN}}}function sN(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:jy},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?Ny:aN))),p(),d}}function aN(e,r,i){return r===0?e:Ny(e,r,i)}function Ny(e,r,i){return(i?"":" ")+e}const oN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ty.peek=hN;function lN(){return{canContainEols:["delete"],enter:{strikethrough:uN},exit:{strikethrough:dN}}}function cN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:oN}],handlers:{delete:Ty}}}function uN(e){this.enter({type:"delete",children:[]},e)}function dN(e){this.exit(e)}function Ty(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 hN(){return"~"}function fN(e){return e.length}function pN(e,r){const i=r||{},s=(i.align||[]).concat(),l=i.stringLength||fN,u=[],f=[],c=[],d=[];let p=0,g=-1;for(;++g<e.length;){const C=[],y=[];let x=-1;for(e[g].length>p&&(p=e[g].length);++x<e[g].length;){const b=mN(e[g][x]);if(i.alignDelimiters!==!1){const S=l(b);y[x]=S,(d[x]===void 0||S>d[x])&&(d[x]=S)}C.push(b)}f[g]=C,c[g]=y}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<p;)u[m]=Hv(s[m]);else{const C=Hv(s);for(;++m<p;)u[m]=C}m=-1;const v=[],_=[];for(;++m<p;){const C=u[m];let y="",x="";C===99?(y=":",x=":"):C===108?y=":":C===114&&(x=":");let b=i.alignDelimiters===!1?1:Math.max(1,d[m]-y.length-x.length);const S=y+"-".repeat(b)+x;i.alignDelimiters!==!1&&(b=y.length+b+x.length,b>d[m]&&(d[m]=b),_[m]=b),v[m]=S}f.splice(1,0,v),c.splice(1,0,_),g=-1;const E=[];for(;++g<f.length;){const C=f[g],y=c[g];m=-1;const x=[];for(;++m<p;){const b=C[m]||"";let S="",j="";if(i.alignDelimiters!==!1){const A=d[m]-(y[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&&x.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&b==="")&&(i.delimiterStart!==!1||m)&&x.push(" "),i.alignDelimiters!==!1&&x.push(S),x.push(b),i.alignDelimiters!==!1&&x.push(j),i.padding!==!1&&x.push(" "),(i.delimiterEnd!==!1||m!==p-1)&&x.push("|")}E.push(i.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return E.join(`
106
+ `)}function mN(e){return e==null?"":String(e)}function Hv(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 gN(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()),xN);return l(),f}function xN(e,r,i){return">"+(i?"":" ")+e}function vN(e,r){return Pv(e,r.inConstruct,!0)&&!Pv(e,r.notInConstruct,!1)}function Pv(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 Fv(e,r,i,s){let l=-1;for(;++l<i.unsafe.length;)if(i.unsafe[l].character===`
107
+ `&&vN(i.stack,i.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
108
+ `}function bN(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 yN(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 _N(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 SN(e,r,i,s){const l=_N(i),u=e.value||"",f=l==="`"?"GraveAccent":"Tilde";if(yN(e,i)){const m=i.enter("codeIndented"),v=i.indentLines(u,wN);return m(),v}const c=i.createTracker(s),d=l.repeat(Math.max(bN(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 wN(e,r,i){return(i?"":" ")+e}function Vh(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 CN(e,r,i,s){const l=Vh(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 kN(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 no(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ql(e,r,i){const s=Ms(e),l=Ms(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}}Ay.peek=EN;function Ay(e,r,i,s){const l=kN(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=ql(s.before.charCodeAt(s.before.length-1),p,l);g.inside&&(d=no(p)+d.slice(1));const m=d.charCodeAt(d.length-1),v=ql(s.after.charCodeAt(0),m,l);v.inside&&(d=d.slice(0,-1)+no(m));const _=f.move(l);return u(),i.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},c+d+_}function EN(e,r,i){return i.options.emphasis||"*"}function jN(e,r){let i=!1;return Wh(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return i=!0,hh}),!!((!e.depth||e.depth<3)&&Hh(e)&&(r.options.setext||i))}function NN(e,r,i,s){const l=Math.max(Math.min(6,e.depth||1),1),u=i.createTracker(s);if(jN(e,i)){const g=i.enter("headingSetext"),m=i.enter("phrasing"),v=i.containerPhrasing(e,{...u.current(),before:`
113
+ `,after:`
114
+ `});return m(),g(),v+`
115
+ `+(l===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.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=no(p.charCodeAt(0))+p.slice(1)),p=p?f+" "+p:f,i.options.closeAtx&&(p+=" "+f),d(),c(),p}Dy.peek=TN;function Dy(e){return e.value||""}function TN(){return"<"}Ly.peek=AN;function Ly(e,r,i,s){const l=Vh(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 AN(){return"!"}Ry.peek=DN;function Ry(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 DN(){return"!"}Oy.peek=LN;function Oy(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 LN(){return"`"}function My(e,r){const i=Hh(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))}Iy.peek=RN;function Iy(e,r,i,s){const l=Vh(i),u=l==='"'?"Quote":"Apostrophe",f=i.createTracker(s);let c,d;if(My(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 RN(e,r,i){return My(e,i)?"<":"["}By.peek=ON;function By(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 ON(){return"["}function Kh(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 MN(e){const r=Kh(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 IN(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 zy(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 BN(e,r,i,s){const l=i.enter("list"),u=i.bulletCurrent;let f=e.ordered?IN(i):Kh(i);const c=e.ordered?f==="."?")":".":MN(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),zy(i)===f&&g){let m=-1;for(;++m<e.children.length;){const v=e.children[m];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.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 zN(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 HN(e,r,i,s){const l=zN(i);let u=i.bulletCurrent||Kh(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,v,_){return v?(_?"":" ".repeat(f))+m:(_?u:u+" ".repeat(f-u.length))+m}}function PN(e,r,i,s){const l=i.enter("paragraph"),u=i.enter("phrasing"),f=i.containerPhrasing(e,s);return u(),l(),f}const FN=sc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function UN(e,r,i,s){return(e.children.some(function(f){return FN(f)})?i.containerPhrasing:i.containerFlow).call(i,e,s)}function $N(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}Hy.peek=qN;function Hy(e,r,i,s){const l=$N(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=ql(s.before.charCodeAt(s.before.length-1),p,l);g.inside&&(d=no(p)+d.slice(1));const m=d.charCodeAt(d.length-1),v=ql(s.after.charCodeAt(0),m,l);v.inside&&(d=d.slice(0,-1)+no(m));const _=f.move(l+l);return u(),i.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},c+d+_}function qN(e,r,i){return i.options.strong||"*"}function WN(e,r,i,s){return i.safe(e.value,s)}function GN(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 VN(e,r,i){const s=(zy(i)+(i.options.ruleSpaces?" ":"")).repeat(GN(i));return i.options.ruleSpaces?s.slice(0,-1):s}const Py={blockquote:gN,break:Fv,code:SN,definition:CN,emphasis:Ay,hardBreak:Fv,heading:NN,html:Dy,image:Ly,imageReference:Ry,inlineCode:Oy,link:Iy,linkReference:By,list:BN,listItem:HN,paragraph:PN,root:UN,strong:Hy,text:WN,thematicBreak:VN};function KN(){return{enter:{table:YN,tableData:Uv,tableHeader:Uv,tableRow:ZN},exit:{codeText:QN,table:XN,tableData:Jd,tableHeader:Jd,tableRow:Jd}}}function YN(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 XN(e){this.exit(e),this.data.inTable=void 0}function ZN(e){this.enter({type:"tableRow",children:[]},e)}function Jd(e){this.exit(e)}function Uv(e){this.enter({type:"tableCell",children:[]},e)}function QN(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,JN));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(e)}function JN(e,r){return r==="|"?r:e}function eT(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:v,table:f,tableCell:d,tableRow:c}};function f(_,E,C,y){return p(g(_,C,y),_.align)}function c(_,E,C,y){const x=m(_,C,y),b=p([x]);return b.slice(0,b.indexOf(`
119
+ `))}function d(_,E,C,y){const x=C.enter("tableCell"),b=C.enter("phrasing"),S=C.containerPhrasing(_,{...y,before:u,after:u});return b(),x(),S}function p(_,E){return pN(_,{align:E,alignDelimiters:s,padding:i,stringLength:l})}function g(_,E,C){const y=_.children;let x=-1;const b=[],S=E.enter("table");for(;++x<y.length;)b[x]=m(y[x],E,C);return S(),b}function m(_,E,C){const y=_.children;let x=-1;const b=[],S=E.enter("tableRow");for(;++x<y.length;)b[x]=d(y[x],_,E,C);return S(),b}function v(_,E,C){let y=Py.inlineCode(_,E,C);return C.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function tT(){return{exit:{taskListCheckValueChecked:$v,taskListCheckValueUnchecked:$v,paragraph:rT}}}function nT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:iT}}}function $v(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function rT(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 iT(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=Py.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 sT(){return[Bj(),iN(),lN(),KN(),tT()]}function aT(e){return{extensions:[zj(),sN(e),cN(),eT(e),nT()]}}const oT={tokenize:fT,partial:!0},Fy={tokenize:pT,partial:!0},Uy={tokenize:mT,partial:!0},$y={tokenize:gT,partial:!0},lT={tokenize:xT,partial:!0},qy={name:"wwwAutolink",tokenize:dT,previous:Gy},Wy={name:"protocolAutolink",tokenize:hT,previous:Vy},Or={name:"emailAutolink",tokenize:uT,previous:Ky},dr={};function cT(){return{text:dr}}let Ti=48;for(;Ti<123;)dr[Ti]=Or,Ti++,Ti===58?Ti=65:Ti===91&&(Ti=97);dr[43]=Or;dr[45]=Or;dr[46]=Or;dr[95]=Or;dr[72]=[Or,Wy];dr[104]=[Or,Wy];dr[87]=[Or,qy];dr[119]=[Or,qy];function uT(e,r,i){const s=this;let l,u;return f;function f(m){return!gh(m)||!Ky.call(s,s.previous)||Yh(s.events)?i(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(m))}function c(m){return gh(m)?(e.consume(m),c):m===64?(e.consume(m),d):i(m)}function d(m){return m===46?e.check(lT,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 dT(e,r,i){const s=this;return l;function l(f){return f!==87&&f!==119||!Gy.call(s,s.previous)||Yh(s.events)?i(f):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(oT,e.attempt(Fy,e.attempt(Uy,u),i),i)(f))}function u(f){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(f)}}function hT(e,r,i){const s=this;let l="",u=!1;return f;function f(m){return(m===72||m===104)&&Vy.call(s,s.previous)&&!Yh(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 v=l.toLowerCase();if(v==="http"||v==="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||Fl(m)||bt(m)||Ii(m)||nc(m)?i(m):e.attempt(Fy,e.attempt(Uy,g),i)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function fT(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 pT(e,r,i){let s,l,u;return f;function f(p){return p===46||p===95?e.check($y,d,c)(p):p===null||bt(p)||Ii(p)||p!==45&&nc(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 mT(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($y,r,u)(f):f===null||bt(f)||Ii(f)?r(f):(e.consume(f),l)}function u(f){return f===41&&s++,e.consume(f),l}}function gT(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)||Ii(c)?r(c):i(c)}function l(c){return c===null||c===40||c===91||bt(c)||Ii(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 xT(e,r,i){return s;function s(u){return e.consume(u),l}function l(u){return hn(u)?i(u):r(u)}}function Gy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||bt(e)}function Vy(e){return!mn(e)}function Ky(e){return!(e===47||gh(e))}function gh(e){return e===43||e===45||e===46||e===95||hn(e)}function Yh(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 vT={tokenize:ET,partial:!0};function bT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:wT,continuation:{tokenize:CT},exit:kT}},text:{91:{name:"gfmFootnoteCall",tokenize:ST},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:yT,resolveTo:_T}}}}function yT(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=tr(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 _T(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 ST(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 v=e.exit("gfmFootnoteCallString");return l.includes(tr(s.sliceSerialize(v)))?(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 wT(e,r,i){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,f=0,c;return d;function d(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(E){return E===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):i(E)}function g(E){if(f>999||E===93&&!c||E===null||E===91||bt(E))return i(E);if(E===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=tr(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return bt(E)||(c=!0),f++,e.consume(E),E===92?m:g}function m(E){return E===91||E===92||E===93?(e.consume(E),f++,g):g(E)}function v(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),l.includes(u)||l.push(u),at(e,_,"gfmFootnoteDefinitionWhitespace")):i(E)}function _(E){return r(E)}}function CT(e,r,i){return e.check(lo,r,e.attempt(vT,r,i))}function kT(e){e.exit("gfmFootnoteDefinition")}function ET(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 jT(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)},v=[["enter",g,c],["enter",f[p][1],c],["exit",f[p][1],c],["enter",m,c]],_=c.parser.constructs.insideSpan.null;_&&In(v,v.length,0,rc(_,f.slice(p+1,d),c)),In(v,v.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,v),d=p+v.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 v;function v(E){return p===126&&g[g.length-1][1].type!=="characterEscape"?d(E):(f.enter("strikethroughSequenceTemporary"),_(E))}function _(E){const C=Ms(p);if(E===126)return m>1?d(E):(f.consume(E),m++,_);if(m<2&&!i)return d(E);const y=f.exit("strikethroughSequenceTemporary"),x=Ms(E);return y._open=!x||x===2&&!!C,y._close=!C||C===2&&!!x,c(E)}}}class NT{constructor(){this.map=[]}add(r,i,s){TT(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 TT(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 AT(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 DT(){return{flow:{null:{name:"table",tokenize:LT,resolveAll:RT}}}}function LT(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):tt(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?v:m)}function v(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,tt(H)?at(e,E,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):E(H))}function E(H){return H===45||H===58?y(H):H===124?(f=!0,e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),C):A(H)}function C(H){return tt(H)?at(e,y,"whitespace")(H):y(H)}function y(H){return H===58?(u+=1,f=!0,e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),x):H===45?(u+=1,x(H)):H===null||Pe(H)?j(H):A(H)}function x(H){return H===45?(e.enter("tableDelimiterFiller"),b(H)):A(H)}function b(H){return H===45?(e.consume(H),b):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 tt(H)?at(e,j,"whitespace")(H):j(H)}function j(H){return H===124?E(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)):tt(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 RT(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 v=new NT;for(;++i<e.length;){const _=e[i],E=_[1];_[0]==="enter"?E.type==="tableHead"?(c=!1,d!==0&&(qv(v,r,d,p,g),g=void 0,d=0),p={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(i,0,[["enter",p,r]])):E.type==="tableRow"||E.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({},E.start),end:Object.assign({},E.end)},v.add(i,0,[["enter",g,r]])),l=E.type==="tableDelimiterRow"?2:g?3:1):l&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(s=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],m=Al(v,r,u,l,void 0,m),u=[0,0,0,0]),f[2]=i)):E.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(f[0]=f[1],m=Al(v,r,u,l,void 0,m)),u=f,f=[u[1],i,0,0])):E.type==="tableHead"?(c=!0,d=i):E.type==="tableRow"||E.type==="tableDelimiterRow"?(d=i,u[1]!==0?(f[0]=f[1],m=Al(v,r,u,l,i,m)):f[1]!==0&&(m=Al(v,r,f,l,i,m)),l=0):l&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(f[3]=i)}for(d!==0&&qv(v,r,d,p,g),v.consume(r.events),i=-1;++i<r.events.length;){const _=r.events[i];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=AT(r.events,i))}return e}function Al(e,r,i,s,l,u){const f=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",c="tableContent";i[0]!==0&&(u.end=Object.assign({},Ds(r.events,i[0])),e.add(i[0],0,[["exit",u,r]]));const d=Ds(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=Ds(r.events,i[2]),g=Ds(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 v=r.events[i[2]],_=r.events[i[3]];if(v[1].end=Object.assign({},_[1].end),v[1].type="chunkText",v[1].contentType="text",i[3]>i[2]+1){const E=i[2]+1,C=i[3]-i[2]-1;e.add(E,C,[])}}e.add(i[3]+1,0,[["exit",m,r]])}return l!==void 0&&(u.end=Object.assign({},Ds(r.events,l)),e.add(l,0,[["exit",u,r]]),u=void 0),u}function qv(e,r,i,s,l){const u=[],f=Ds(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 Ds(e,r){const i=e[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const OT={name:"tasklistCheck",tokenize:IT};function MT(){return{text:{91:OT}}}function IT(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):tt(d)?e.check({tokenize:BT},r,i)(d):i(d)}}function BT(e,r,i){return at(e,s,"whitespace");function s(l){return l===null?i(l):r(l)}}function zT(e){return sy([cT(),bT(),jT(e),DT(),MT()])}const HT={};function PT(e){const r=this,i=e||HT,s=r.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),f=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(zT(i)),u.push(sT()),f.push(aT(i))}function FT(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 UT(e,r){if(e==null)return{};var i,s,l=FT(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 xh(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 $T(e){if(Array.isArray(e))return xh(e)}function qT(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function WT(e,r){if(e){if(typeof e=="string")return xh(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)?xh(e,r):void 0}}function GT(){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 vh(e){return $T(e)||qT(e)||WT(e)||GT()}function ro(e){"@babel/helpers - typeof";return ro=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},ro(e)}function VT(e,r){if(ro(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var s=i.call(e,r);if(ro(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function KT(e){var r=VT(e,"string");return ro(r)=="symbol"?r:r+""}function Yy(e,r,i){return(r=KT(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function bh(){return bh=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},bh.apply(null,arguments)}function Wv(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 Ls(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Wv(Object(i),!0).forEach(function(s){Yy(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Wv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}function YT(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 eh={};function XT(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return eh[r]||(eh[r]=YT(e)),eh[r]}function ZT(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=XT(s);return l.reduce(function(u,f){return Ls(Ls({},u),i[f])},r)}function Gv(e){return e.join(" ")}function QT(e,r){var i=0;return function(s){return i+=1,s.map(function(l,u){return Xy({node:l,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(i,"-").concat(u)})})}}function Xy(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=QT(i,u),v;if(!u)v=Ls(Ls({},c),{},{className:Gv(c.className)});else{var _=Object.keys(i).reduce(function(x,b){return b.split(".").forEach(function(S){x.includes(S)||x.push(S)}),x},[]),E=c.className&&c.className.includes("token")?["token"]:[],C=c.className&&E.concat(c.className.filter(function(x){return!_.includes(x)}));v=Ls(Ls({},c),{},{className:Gv(C)||void 0,style:ZT(c.className,Object.assign({},c.style,l),i)})}var y=m(r.children);return dn.createElement(p,bh({key:f},v),y)}}const JT=(function(e,r){var i=e.listLanguages();return i.indexOf(r)!==-1});var e3=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function Vv(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 li(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Vv(Object(i),!0).forEach(function(s){Yy(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Vv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var t3=/\n/g;function n3(e){return e.match(t3)}function r3(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 i3(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)},r3({lines:r.replace(/\n$/,"").split(`
122
+ `),style:f,startingLineNumber:c}))}function s3(e){return"".concat(e.toString().length,".25em")}function Zy(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 Qy(e,r,i){var s={display:"inline-block",minWidth:s3(i),paddingRight:"1em",textAlign:"right",userSelect:"none"},l=typeof e=="function"?e(r):e,u=li(li({},s),l);return u}function Il(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,v=e.wrapLines,_=v===void 0?!1:v,E=_?li({},typeof c=="function"?c(i):c):{};if(E.className=E.className?[].concat(vh(E.className.trim().split(/\s+/)),vh(p)):p,i&&u){var C=Qy(s,i,l);r.unshift(Zy(i,C))}return m&g&&(E.style=li({display:"flex"},E.style)),{type:"element",tagName:"span",properties:E,children:r}}function Jy(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(Il({children:[l],className:vh(new Set(r))}));else if(l.children){var u,f=r.concat(((u=l.properties)===null||u===void 0?void 0:u.className)||[]);Jy(l.children,f).forEach(function(c){return i.push(c)})}}return i}function a3(e,r,i,s,l,u,f,c,d){var p,g=Jy(e.value),m=[],v=-1,_=0;function E(A,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Il({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=Qy(c,N,f);A.unshift(Zy(N,D))}return A}function y(A,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return r||D.length>0?E(A,N,D):C(A,N)}for(var x=function(){var N=g[_],D=N.children[0].value,T=n3(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(v+1,_).concat(Il({children:[q],className:N.properties.className})),U=y(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=Il({children:[Y],className:N.properties.className});g.splice(_+1,0,Z)}else{var z=[Y],L=y(z,K,N.properties.className);m.push(L)}}else{var I=[q],V=y(I,K,N.properties.className);m.push(V)}}),v=_}_++};_<g.length;)x();if(v!==g.length-1){var b=g.slice(v+1,g.length);if(b&&b.length){var S=s&&m.length+u,j=y(b,S);m.push(j)}}return r?m:(p=[]).concat.apply(p,m)}function o3(e){var r=e.rows,i=e.stylesheet,s=e.useInlineStyles;return r.map(function(l,u){return Xy({node:l,stylesheet:i,useInlineStyles:s,key:"code-segment-".concat(u)})})}function e0(e){return e&&typeof e.highlightAuto<"u"}function l3(e){var r=e.astGenerator,i=e.language,s=e.code,l=e.defaultCodeValue;if(e0(r)){var u=JT(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 c3(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,v=s.codeTagProps,_=v===void 0?{className:f?"language-".concat(f):void 0,style:li(li({},p['code[class*="language-"]']),p['code[class*="language-'.concat(f,'"]')])}:v,E=s.useInlineStyles,C=E===void 0?!0:E,y=s.showLineNumbers,x=y===void 0?!1:y,b=s.showInlineLineNumbers,S=b===void 0?!0:b,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=UT(s,e3);I=I||e;var F=x?dn.createElement(i3,{containerStyle:N,codeStyle:_.style||{},numberStyle:T,startingLineNumber:A,codeString:L}):null,ie=p.hljs||p['pre[class*="language-"]']||{backgroundColor:"#fff"},Q=e0(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=li({whiteSpace:"pre-wrap"},_.style):_.style=li({whiteSpace:"pre"},_.style),!I)return dn.createElement(M,ee,F,dn.createElement(Z,_,L));(B===void 0&&R||W)&&(B=!0),R=R||o3;var X=[{type:"text",value:L}],$=l3({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=a3($,B,q,x,S,A,re,T,W);return dn.createElement(M,ee,dn.createElement(Z,_,!S&&F,R({rows:ve,stylesheet:p,useInlineStyles:C})))}}const Kv=/[#.]/g;function u3(e,r){const i=e||"",s={};let l=0,u,f;for(;l<i.length;){Kv.lastIndex=l;const c=Kv.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 t0(e,r,i){const s=i?p3(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=u3(u,r);const p=d.tagName.toLowerCase(),g=s?s.get(p):void 0;if(d.tagName=g||p,d3(f))c.unshift(f);else for(const[m,v]of Object.entries(f))h3(e,d.properties,m,v)}for(const p of c)yh(d.children,p);return d.type==="element"&&d.tagName==="template"&&(d.content={type:"root",children:d.children},d.children=[]),d}return l}function d3(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 h3(e,r,i,s){const l=Xb(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=sv(s):l.commaSeparated?u=ev(s):l.commaOrSpaceSeparated?u=sv(ev(s).join(" ")):u=Yv(l,l.property,s):Array.isArray(s)?u=[...s]:u=l.property==="style"?f3(s):String(s);if(Array.isArray(u)){const f=[];for(const c of u)f.push(Yv(l,l.property,c));u=f}l.property==="className"&&Array.isArray(r.className)&&(u=r.className.concat(u)),r[l.property]=u}}function yh(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)yh(e,i);else if(typeof r=="object"&&"type"in r)r.type==="root"?yh(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function Yv(e,r,i){if(typeof i=="string"){if(e.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((e.boolean||e.overloadedBoolean)&&(i===""||Ja(i)===Ja(r)))return!0}return i}function f3(e){const r=[];for(const[i,s]of Object.entries(e))r.push([i,s].join(": "));return r.join("; ")}function p3(e){const r=new Map;for(const i of e)r.set(i.toLowerCase(),i);return r}const m3=["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"],g3=t0(Zb,"div");t0(tc,"g",m3);const x3=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Xv={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 n0(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function v3(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function b3(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function Zv(e){return b3(e)||n0(e)}const y3=["","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 _3(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,v=E(),_;for(u--;++u<=e.length;)if(_===10&&(m=(p?p[f]:0)||1),_=e.charCodeAt(u),_===38){const x=e.charCodeAt(u+1);if(x===9||x===10||x===12||x===32||x===38||x===60||Number.isNaN(x)||s&&x===s){c+=String.fromCharCode(_),m++;continue}const b=u+1;let S=b,j=b,A;if(x===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"?Zv:A==="decimal"?n0:v3;for(j--;++j<=e.length;){const q=e.charCodeAt(j);if(!B(q))break;T+=String.fromCharCode(q),A==="named"&&x3.includes(T)&&(N=T,D=to(T))}let H=e.charCodeAt(j)===59;if(H){j++;const q=A==="named"?to(T):!1;q&&(N=T,D=q)}let W=1+j-b,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=""):Zv(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(S3(q))C(7,W),K="�";else if(q in Xv)C(6,W),K=Xv[q];else{let R="";w3(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){y(),v=E(),u=j-1,m+=j-b+1,l.push(K);const q=E();q.offset++,i.reference&&i.reference.call(i.referenceContext||void 0,K,{start:v,end:q},e.slice(b-1,j)),v=q}else T=e.slice(b-1,j),c+=T,m+=T.length,u=j-1}else _===10&&(g++,f++,m=0),Number.isNaN(_)?y():(c+=String.fromCharCode(_),m++);return l.join("");function E(){return{line:g,column:m,offset:u+((d?d.offset:0)||0)}}function C(x,b){let S;i.warning&&(S=E(),S.column+=b,S.offset+=b,i.warning.call(i.warningContext||void 0,y3[x],S,x))}function y(){c&&(l.push(c),i.text&&i.text.call(i.textContext||void 0,c,{start:v,end:E()}),c="")}}function S3(e){return e>=55296&&e<=57343||e>1114111}function w3(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 C3=0,Dl={},Jt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++C3}),e.__id},clone:function e(r,i){i=i||{};var s,l;switch(Jt.util.type(r)){case"Object":if(l=Jt.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=Jt.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:Dl,plaintext:Dl,text:Dl,txt:Dl,extend:function(e,r){var i=Jt.util.clone(Jt.languages[e]);for(var s in r)i[s]=r[s];return i},insertBefore:function(e,r,i,s){s=s||Jt.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,Jt.languages.DFS(Jt.languages,function(p,g){g===d&&p!=e&&(this[p]=u)}),u},DFS:function e(r,i,s,l){l=l||{};var u=Jt.util.objId;for(var f in r)if(r.hasOwnProperty(f)){i.call(r,f,r[f],s||f);var c=r[f],d=Jt.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(Jt.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=Jt.tokenize(s.code,s.grammar),Jt.hooks.run("after-tokenize",s),Ya.stringify(Jt.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 k3;return Bl(l,l.head,e),r0(e,l,r,l.head,0),j3(l)},hooks:{all:{},add:function(e,r){var i=Jt.hooks.all;i[e]=i[e]||[],i[e].push(r)},run:function(e,r){var i=Jt.hooks.all[e];if(!(!i||!i.length))for(var s=0,l;l=i[s++];)l(r)}},Token:Ya};function Ya(e,r,i,s){this.type=e,this.content=r,this.alias=i,this.length=(s||"").length|0}function Qv(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 r0(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,v=!!p.greedy,_=p.alias;if(v&&!p.pattern.global){var E=p.pattern.toString().match(/[imsuy]*$/)[0];p.pattern=RegExp(p.pattern.source,E+"g")}for(var C=p.pattern||p,y=s.next,x=l;y!==r.tail&&!(u&&x>=u.reach);x+=y.value.length,y=y.next){var b=y.value;if(r.length>e.length)return;if(!(b instanceof Ya)){var S=1,j;if(v){if(j=Qv(C,x,e,m),!j||j.index>=e.length)break;var T=j.index,A=j.index+j[0].length,N=x;for(N+=y.value.length;T>=N;)y=y.next,N+=y.value.length;if(N-=y.value.length,x=N,y.value instanceof Ya)continue;for(var D=y;D!==r.tail&&(N<A||typeof D.value=="string");D=D.next)S++,N+=D.value.length;S--,b=e.slice(x,N),j.index-=x}else if(j=Qv(C,0,b,m),!j)continue;var T=j.index,B=j[0],H=b.slice(0,T),W=b.slice(T+B.length),K=x+b.length;u&&K>u.reach&&(u.reach=K);var q=y.prev;H&&(q=Bl(r,q,H),x+=H.length),E3(r,q,S);var R=new Ya(f,g?Jt.tokenize(B,g):B,_,B);if(y=Bl(r,q,R),W&&Bl(r,y,W),S>1){var U={cause:f+","+d,reach:K};r0(e,r,i,y.prev,x,U),u&&U.reach>u.reach&&(u.reach=U.reach)}}}}}}function k3(){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 Bl(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 E3(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 j3(e){for(var r=[],i=e.head.next;i!==e.tail;)r.push(i.value),i=i.next;return r}const i0=Jt;function s0(){}s0.prototype=i0;const Kt=new s0;Kt.highlight=N3;Kt.register=T3;Kt.alias=A3;Kt.registered=D3;Kt.listLanguages=L3;Kt.util.encode=R3;Kt.Token.stringify=_h;function N3(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(Kt.languages,s))i=Kt.languages[s];else throw new Error("Unknown language: `"+s+"` is not registered")}return{type:"root",children:i0.highlight.call(Kt,e,i,s)}}function T3(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(Kt.languages,e.displayName)||e(Kt)}function A3(e,r){const i=Kt.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 D3(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(Kt.languages,e)}function L3(){const e=Kt.languages,r=[];let i;for(i in e)Object.hasOwn(e,i)&&typeof e[i]=="object"&&r.push(i);return r}function _h(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(_h(e[l],r));return s}const i={attributes:{},classes:["token",e.type],content:_h(e.content,r),language:r,tag:"span",type:e.type};return e.alias&&i.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),Kt.hooks.run("wrap",i),g3(i.tag+"."+i.classes.join("."),O3(i.attributes),i.content)}function R3(e){return e}function O3(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=_3(e[r]));return e}var pt=c3(Kt,{});pt.registerLanguage=function(e,r){return Kt.register(r)};pt.alias=function(e,r){return Kt.alias(e,r)};zi.displayName="markup";zi.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function zi(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.value.replace(/&amp;/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(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}oc.displayName="css";oc.aliases=[];function oc(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)}Hi.displayName="clike";Hi.aliases=[];function Hi(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:/[{}[\];(),.:]/}}uo.displayName="javascript";uo.aliases=["js"];function uo(e){e.register(Hi),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}Xh.displayName="sql";Xh.aliases=[];function Xh(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:/[;[\]()`,.]/}}lc.displayName="c";lc.aliases=[];function lc(e){e.register(Hi),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}Zh.displayName="cpp";Zh.aliases=[];function Zh(e){e.register(lc),(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)}Qh.displayName="bash";Qh.aliases=["sh","shell"];function Qh(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)}Jh.displayName="yaml";Jh.aliases=["yml"];function Jh(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)}ef.displayName="markdown";ef.aliases=["md"];function ef(e){e.register(zi),(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 v=p[g];if(v.type!=="code"){d(v.content);continue}var _=v.content[1],E=v.content[3];if(_&&E&&_.type==="code-language"&&E.type==="code-block"&&typeof _.content=="string"){var C=_.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");C=(/[a-z][\w-]*/i.exec(C)||[""])[0].toLowerCase();var y="language-"+C;E.alias?typeof E.alias=="string"?E.alias=[E.alias,y]:E.alias.push(y):E.alias=[y]}}}d(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],v=/language-(.+)/.exec(m);if(v){d=v[1];break}}var _=r.languages[d];if(_)c.content=r.highlight(c.content.value,_,d);else if(d&&d!=="none"&&r.plugins.autoloader){var E="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);c.attributes.id=E,r.plugins.autoloader.loadLanguages(d,function(){var C=document.getElementById(E);C&&(C.innerHTML=r.highlight(C.textContent,r.languages[d],d))})}}}),RegExp(r.languages.markup.tag.pattern.source,"gi"),r.languages.md=r.languages.markdown})(e)}tf.displayName="ruby";tf.aliases=["rb"];function tf(e){e.register(Hi),(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)}nf.displayName="diff";nf.aliases=[];function nf(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)}rf.displayName="docker";rf.aliases=["dockerfile"];function rf(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)}sf.displayName="go";sf.aliases=[];function sf(e){e.register(Hi),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"]}af.displayName="graphql";af.aliases=[];function af(e){e.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:e.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},e.hooks.add("after-tokenize",function(i){if(i.language!=="graphql")return;var s=i.tokens.filter(function(y){return typeof y!="string"&&y.type!=="comment"&&y.type!=="scalar"}),l=0;function u(y){return s[l+y]}function f(y,x){x=x||0;for(var b=0;b<y.length;b++){var S=u(b+x);if(!S||S.type!==y[b])return!1}return!0}function c(y,x){for(var b=1,S=l;S<s.length;S++){var j=s[S],A=j.content;if(j.type==="punctuation"&&typeof A=="string"){if(y.test(A))b++;else if(x.test(A)&&(b--,b===0))return S}}return-1}function d(y,x){var b=y.alias;b?Array.isArray(b)||(y.alias=b=[b]):y.alias=b=[],b.push(x)}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 v=u(0);v.type==="variable"&&(d(v,"variable-input"),g.push(v.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 E=l;E<_;E++){var C=s[E];C.type==="variable"&&g.indexOf(C.content)>=0&&d(C,"variable-input")}}}}})}of.displayName="scss";of.aliases=[];function of(e){e.register(oc),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}lf.displayName="json";lf.aliases=["webmanifest"];function lf(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}cf.displayName="java";cf.aliases=[];function cf(e){e.register(Hi),(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)}cc.displayName="typescript";cc.aliases=["ts"];function cc(e){e.register(uo),(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)}uf.displayName="python";uf.aliases=["py"];function uf(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}uc.displayName="jsx";uc.aliases=[];function uc(e){e.register(uo),e.register(zi),(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 v=p[m],_=!1;if(typeof v!="string"&&(v.type==="tag"&&v.content[0]&&v.content[0].type==="tag"?v.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===c(v.content[0].content[1])&&g.pop():v.content[v.content.length-1].content==="/>"||g.push({tagName:c(v.content[0].content[1]),openedBraces:0}):g.length>0&&v.type==="punctuation"&&v.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&v.type==="punctuation"&&v.content==="}"?g[g.length-1].openedBraces--:_=!0),(_||typeof v=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var E=c(v);m<p.length-1&&(typeof p[m+1]=="string"||p[m+1].type==="plain-text")&&(E+=c(p[m+1]),p.splice(m+1,1)),m>0&&(typeof p[m-1]=="string"||p[m-1].type==="plain-text")&&(E=c(p[m-1])+E,p.splice(m-1,1),m--),p[m]=new r.Token("plain-text",E,null,E)}v.content&&typeof v.content!="string"&&d(v.content)}};r.hooks.add("after-tokenize",function(p){p.language!=="jsx"&&p.language!=="tsx"||d(p.tokens)})})(e)}df.displayName="tsx";df.aliases=[];function df(e){e.register(uc),e.register(cc),(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)}hf.displayName="rust";hf.aliases=[];function hf(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)}ff.displayName="toml";ff.aliases=[];function ff(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 zl={'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",cc);pt.registerLanguage("javascript",uo);pt.registerLanguage("tsx",df);pt.registerLanguage("jsx",uc);pt.registerLanguage("python",uf);pt.registerLanguage("bash",Qh);pt.registerLanguage("json",lf);pt.registerLanguage("css",oc);pt.registerLanguage("html",zi);pt.registerLanguage("markup",zi);pt.registerLanguage("xml",zi);pt.registerLanguage("sql",Xh);pt.registerLanguage("yaml",Jh);pt.registerLanguage("markdown",ef);pt.registerLanguage("diff",nf);pt.registerLanguage("rust",hf);pt.registerLanguage("go",sf);pt.registerLanguage("java",cf);pt.registerLanguage("c",lc);pt.registerLanguage("cpp",Zh);pt.registerLanguage("ruby",tf);pt.registerLanguage("toml",ff);pt.registerLanguage("scss",of);pt.registerLanguage("graphql",af);pt.registerLanguage("docker",rf);function a0(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 M3={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}=a0();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(Zl,{}):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:zl,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})}},Pi=P.memo(function({content:r,className:i=""}){const s=P.useMemo(()=>{let l=I3(r);return l=B3(l),l},[r]);return o.jsx("div",{className:`markdown-content [&_li>p]:inline ${i}`,children:o.jsx(jj,{remarkPlugins:[PT],components:M3,children:s})})});function I3(e){let r=e.replace(/^(\s*)•\s/gm,"$1- ");return r=r.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),r}function B3(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 z3=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(Pi,{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 o0({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 H3={...zl,'pre[class*="language-"]':{...zl['pre[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflowX:"hidden"},'code[class*="language-"]':{...zl['code[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},P3={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 dc(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?P3[s]??"text":"text"}const l0={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},F3={...l0,display:"inline"},U3={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},io=P.memo(function({code:r,language:i,variant:s}){const l=s==="inline"?"span":s==="block-nowrap"?"div":"pre",u=s==="inline"?F3:s==="block-nowrap"?l0:U3;return o.jsx(pt,{style:H3,language:i,PreTag:l,customStyle:u,children:r})});function c0({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 $3=P.memo(function({oldString:r,newString:i,filePath:s}){const l=P.useMemo(()=>dc(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(io,{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(io,{code:i,language:l,variant:"block-nowrap"})})]})]})}),q3=P.memo(function({content:r,filePath:i}){const s=P.useMemo(()=>dc(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(io,{code:r,language:s,variant:"block"})})]})})}),W3=P.memo(function({regions:r,filePath:i}){const s=P.useMemo(()=>dc(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(G3,{region:l,language:s},u))})}),G3=P.memo(function({region:r,language:i}){const s=V3(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(K3,{item:f,language:i,lineNumWidth:u},c))})});function V3(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 K3=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(io,{code:r.content||" ",language:i,variant:"inline"})})]})}),Y3=P.memo(function({result:r,metadata:i,filePath:s,heightExpanded:l=!1}){const[u,f]=P.useState(!1),c=P.useMemo(()=>dc(s),[s]),d=i==null?void 0:i.mimeType,p=i==null?void 0:i.base64Data;if(d!=null&&d.startsWith("image/")&&p){const v=`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:v,alt:s,className:"max-w-full max-h-[45vh] object-contain"})}),o.jsx(c0,{src:v,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(v=>!v.startsWith(`
135
+ [`)&&!v.startsWith("[")).map(v=>v.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(v=>!v.startsWith(`
137
+ [`)&&!v.startsWith("[")).map((v,_)=>{const E=v.match(/^(\d+): /);return o.jsx("div",{className:"leading-[1.5rem]",children:E?E[1]:_+1},_)})}),o.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:o.jsx(io,{code:m,language:c,variant:"block"})})]})})}),X3={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"}},Jv=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=X3[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)})})]})}),Z3=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 v=i/1e3,_=u==="pending"?g/1e3:(d??0)/1e3,E=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 / ",v,"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)}%`}})}),(E||u==="pending")&&o.jsx("pre",{ref:p,className:`text-xs bg-bg-primary p-2 rounded max-h-64 overflow-y-auto ${u==="pending"?"border border-accent-warning/30":""}`,style:{overflowX:"hidden",whiteSpace:"normal"},children:u==="pending"&&l?l.map((C,y)=>o.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:Qa(C.content)},y)):Qa(E)}),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 Q3(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 J3({confirmation:e}){const r=ke(g=>g.confirmPath),i=ke(g=>g.currentSession),s=ke(g=>g.switchDangerLevel),{title:l,description:u}=Q3(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 e5(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 eb(e,r,i){return e5(e,r)}function t5(e){return JSON.stringify(e,null,2)}const n5={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}},r5=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:v,metadata:_,callId:E}){const C=r==="edit_file"||r==="write_file",y=r==="run_command"&&s==="pending",x=r==="read_file",S=u?!1:C||y||r==="return_value",[j,A]=P.useState(S),N=n5[s],D=ke(B=>B.pendingPathConfirmation),T=s==="pending"&&D&&E&&D.callId===E?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(o0,{tool:r}),o.jsx("span",{className:"text-accent-primary font-medium",children:r}),o.jsx("span",{className:"text-text-muted truncate flex-1",children:eb(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:eb(r,i)}),o.jsx("span",{className:"text-text-muted text-xs",children:j?"▼":"▶"})]}),T&&o.jsx(J3,{confirmation:T}),(j||x)&&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(Z3,{command:String(i.command??""),timeout:i.timeout??12e4,startedAt:m,streamingOutput:v,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(W3,{regions:g.regions,filePath:String(i.path??"")}):o.jsx($3,{oldString:String(i.old_string??""),newString:String(i.new_string??""),filePath:String(i.path??"")}),p&&p.length>0&&o.jsx(Jv,{diagnostics:p})]}),r==="write_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(q3,{content:String(i.content??""),filePath:String(i.path??"")}),p&&p.length>0&&o.jsx(Jv,{diagnostics:p})]}),r==="read_file"&&s==="success"&&o.jsx(Y3,{result:f,metadata:_,filePath:String(i.path??""),heightExpanded:j}),r==="return_value"&&(()=>{const B=(v==null?void 0:v.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(Pi,{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:t5(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})]})]})]})}),i5={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 s5(e){return i5[e]??`Preparing ${e}`}const a5=P.memo(function({name:r}){const i=s5(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(o0,{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,"..."]})]})})}),o5={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},l5=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=o5[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"})}),tb={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"}},u0=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(Pi,{content:`[${c.id}] ${c.description}`})})]},c.id??d))}catch{return r.map((f,c)=>o.jsx(nb,{tc:f,index:c,criteriaMap:s},f.id??c))}})():r.map((u,f)=>o.jsx(nb,{tc:u,index:f,criteriaMap:s},u.id??f))})]})});function nb({tc:e,index:r,criteriaMap:i}){const s=e.arguments.action,l=s&&tb[s]?tb[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,v=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(Pi,{content:g})}),m&&o.jsxs("div",{className:`mt-1 text-sm ${v?"text-accent-error":"text-text-muted"}`,children:[o.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function c5(e){return e==="criterion"}const u5="#6b7280";function Wl(e,r){var i;return((i=e.find(s=>s.id===r))==null?void 0:i.color)??u5}const kt=Yn(e=>{const r=async()=>{await Nh("/api/agents",e)};return{defaults:[],userItems:[],loading:!1,fetchAgents:r,fetchAgent:async i=>{try{const s=await Ce(`/api/agents/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/agents/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createAgent:async i=>{const s=await ci("POST","/api/agents",i);return s.success&&await r(),s},updateAgent:async(i,s)=>{const l=await ci("PUT",`/api/agents/${i}`,s);return l.success&&await r(),l},deleteAgent:async i=>{try{const s=await Ce(`/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 Ce(`/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 d5(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"&&c5(l.toolCall.name)?i.push(l.toolCall):(s(),r.push(l));return s(),r}function h5(e,r){if(e.segments&&e.segments.length>0)return f5(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 f5(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 pf=P.memo(function({message:r,showStats:i=!0,showThinking:s=!0,showVerboseToolOutput:l=!0}){const u=ke(v=>{var _;return(_=v.currentSession)==null?void 0:_.criteria}),f=kt(v=>v.defaults),c=kt(v=>v.userItems),d=[...f,...c],p=h5(r,i),g=s?p:p.filter(v=>v.type!=="thinking"),m=d5(g);return m.length===0?null:o.jsx("div",{className:"feed-item",children:o.jsxs("div",{className:"min-w-0",children:[m.map((v,_)=>{var E,C;switch(v.type){case"thinking":return o.jsx(z3,{content:v.content},_);case"text":return o.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:o.jsx(Pi,{content:v.content})},_);case"preparing_tool_call":return o.jsx(a5,{name:v.preparing.name},`preparing-${v.preparing.index}`);case"tool_call":{const y=v.toolCall,x=y.result;if(y.name==="todo_write"){const j=y.arguments.todos,A=Array.isArray(j)?j:[];return o.jsx(l5,{todos:A},_)}const b=(E=x==null?void 0:x.output)==null?void 0:E.includes("[interrupted by user]"),S=x?b?"interrupted":x.success?"success":"error":"pending";return o.jsx(r5,{tool:y.name,args:y.arguments,status:S,variant:"expandable",forceCompact:!l,result:x==null?void 0:x.output,error:x==null?void 0:x.error,durationMs:x==null?void 0:x.durationMs,diagnostics:x==null?void 0:x.diagnostics,editContext:x==null?void 0:x.editContext,startedAt:y.startedAt,streamingOutput:y.streamingOutput,metadata:x==null?void 0:x.metadata,callId:y.id},_)}case"criteria_group":return o.jsx(u0,{toolCalls:v.toolCalls,criteria:u},_);case"stats":{const y=v.stats,x=((C=y.model.split("/").pop())==null?void 0:C.split("-").slice(0,2).join("-"))??y.model,b=Wl(d,y.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:x}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("span",{style:{color:b},children:y.mode}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[y.totalTime.toFixed(1),"s"]}),y.toolTime>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[y.toolTime.toFixed(1),"s tools"]})]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[S(y.prefillTokens)," @ ",j(y.prefillSpeed)," pp"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[S(y.generationTokens)," @ ",j(y.generationSpeed)," tg"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("button",{type:"button",className:"text-text-muted hover:text-text-secondary transition-colors",title:"View detailed stats",onClick:()=>{const A=new CustomEvent("open-turn-stats",{detail:{stats:y}});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=Yn((e,r)=>({defaults:[],userItems:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await Ce("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await Ce("/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 Ce(`/api/workflows/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/workflows/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async i=>{const s=await ci("POST","/api/workflows",i);return s.success&&await r().fetchWorkflows(),s},updateWorkflow:async(i,s)=>{const l=await ci("PUT",`/api/workflows/${i}`,s);return l.success&&await r().fetchWorkflows(),l},deleteWorkflow:async i=>{try{const s=await Ce(`/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 Ce(`/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 Gl(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 p5(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 m5(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}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??"#8b949e";return o.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:Gl(u,.3),backgroundColor:Gl(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(Fa,{label:"Iterations",value:String(r.iterations)}),o.jsx(Fa,{label:"Total time",value:p5(r.totalTimeSeconds)}),o.jsx(Fa,{label:"Tool calls",value:String(r.totalToolCalls)}),o.jsx(Fa,{label:"Tokens",value:m5(r.totalTokensGenerated)}),o.jsx(Fa,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function Fa({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 x5=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:Gl(u,.3),backgroundColor:Gl(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 v5({attachments:e,messageId:r}){const[i,s]=P.useState(null),l=ke(g=>g.visionFallbackByMessage),u=ke(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 v=u[m];if(v&&v.role==="assistant")return v.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 v=`${f}-${g}`;return l[v]}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(c0,{src:i,alt:"Attached image",isOpen:!0,onClose:d})]})}function b5({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(Ns,{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(Ns,{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(Ns,{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(Ns,{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(Ns,{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(y5,{file:f,expanded:s[`file-${c}`]??!1,onToggle:()=>u(`file-${c}`)},c))})}),o.jsx(Ns,{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 y5({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 Ns({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 _5({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 v=_=>{p.current&&!p.current.contains(_.target)&&l(!1)};return s&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]);const g=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const v=document.createElement("textarea");v.value=e,v.style.position="fixed",v.style.left="-999999px",document.body.appendChild(v),v.select(),document.execCommand("copy"),document.body.removeChild(v)}d(!0),l(!1),window.setTimeout(()=>d(!1),1500)}catch(v){console.error("Failed to copy:",v)}},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(b5,{isOpen:u,onClose:()=>f(!1),promptContext:r})]})}function S5({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 w5({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(_5,{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(v5,{attachments:e.attachments,messageId:e.id})]})]})}const d0=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(pf,{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(x5,{data:d})}catch{}if(r.messageKind==="task-completed")try{const d=JSON.parse(r.content);return o.jsx(g5,{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(S5,{message:r}):l?o.jsx(w5,{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(Pi,{content:r.content})})})});function C5({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(Ll,{label:"Total Time",value:`${e.totalTime.toFixed(1)}s`}),o.jsx(Ll,{label:"Prefill",value:e.prefillTokens>=1e3?`${(e.prefillTokens/1e3).toFixed(1)}k`:String(e.prefillTokens)}),o.jsx(Ll,{label:"Generated",value:e.generationTokens>=1e3?`${(e.generationTokens/1e3).toFixed(1)}k`:String(e.generationTokens)}),o.jsx(Ll,{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(Rl,{label:"temp",value:s.temperature.toFixed(2)}),s.topP!==void 0&&o.jsx(Rl,{label:"topP",value:s.topP.toFixed(2)}),s.topK!==void 0&&o.jsx(Rl,{label:"topK",value:String(s.topK)}),s.maxTokens!==void 0&&o.jsx(Rl,{label:"maxTok",value:String(s.maxTokens)})]})]})]},l))]})]})})}function Ll({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 Rl({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 h0=(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()}}},k5={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function E5(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function rb(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function j5({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:rb(u,l),children:[Hl(r),"/",Hl(i)]}),o.jsxs("span",{className:rb(u,l),children:["(",u,"%)"]}),o.jsx(Ub,{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 N5=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],v=ke(D=>D.subAgentContextStates[s]),{showThinking:_,showVerboseToolOutput:E}=wb(),{isAutoScrollActive:C,setAutoScroll:y}=h0(f,null);P.useEffect(()=>{l||y(!0)},[l]);const x=P.useCallback(()=>{const D=!c;d(D),D&&setTimeout(()=>{var T;(T=u.current)==null||T.scrollIntoView({block:"start",behavior:"smooth"})},220)},[c]),b=m.find(D=>D.id===i),S=(b==null?void 0:b.name)??k5[i]??i,j=Wl(m,i),A=E5(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:v&&o.jsx(j5,{contextState:v})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5",onClick:()=>y(!C),children:[o.jsx("span",{className:`w-1 h-1 rounded-full ${C?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsxs("button",{type:"button",className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary",onClick:x,children:[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(pf,{message:D,showStats:!0,showThinking:_,showVerboseToolOutput:E},D.id):o.jsx(d0,{message:D,isLastAssistantMessage:!1},D.id))})]})});function T5(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function A5({agent:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:l,onDuplicate:u,onDelete:f}){return o.jsxs(Ab,{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 ib({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(A5,{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 D5({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),[v,_]=P.useState("list"),[E,C]=P.useState(null),[y,x]=P.useState(!1),[b,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),Ne=Be.slice(ot+1).split(",").filter(Boolean);Ae.set(ue,new Set(Ne))}}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),x(!1),_("edit")},oe=(fe,Ae)=>{X(fe),C(Ae),x(!0),_("edit")};P.useEffect(()=>{e&&(f(),Ce("/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),x(!1),_("edit"))}):(_("list"),C(null),x(!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(""),x(!1),_("edit")},Le=async fe=>{const Ae=await c(fe);Ae&&(X(Ae),C(fe),x(!1),_("edit"))},Ie=async fe=>{await m(fe)},He=async()=>{const fe=E??j;if(!fe||!b||!R){Y("Name and prompt are required.");return}z(!0),Y("");const Ae={metadata:{id:fe,name:b,description:N,subagent:T,allowedTools:H,color:K},prompt:R},Be=E?await g(E,Ae):await p(Ae);if(z(!1),!Be.success){Y(Be.error??"Failed to save agent.");return}i?r():_("list")},Ue=()=>{i?r():(_("list"),x(!1))},je=fe=>{S(fe),E||A(T5(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 v==="edit"?o.jsx(jt,{isOpen:e,onClose:Ue,title:y?`${b}`:E?"Edit Agent":"New Agent",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3",children:[M&&o.jsx(Lh,{message:M}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ri,{label:"Name",value:b,onChange:je,placeholder:"My Agent",readOnly:y}),o.jsx(Ri,{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(Ri,{label:"Description",value:N,onChange:D,placeholder:"What this agent does",readOnly:y}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Type"}),o.jsxs("div",{className:"flex items-center gap-3 h-[34px]",children:[o.jsx("button",{onClick:()=>!y&&B(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${T?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"} ${y?"pointer-events-none opacity-60":""}`,children:"Sub-agent"}),o.jsx("button",{onClick:()=>!y&&B(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${T?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"} ${y?"pointer-events-none opacity-60":""}`,children:"Top-level"}),o.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[o.jsx("label",{className:"text-xs text-text-secondary",children:"Color"}),o.jsx("input",{type:"color",value:K,onChange:fe=>!y&&q(fe.target.value),disabled:y,className:"w-6 h-6 rounded cursor-pointer border border-border bg-transparent"})]})]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),o.jsx("div",{className:"flex flex-wrap gap-1.5 p-2 bg-bg-tertiary border border-border rounded max-h-32 overflow-y-auto",children:L.map(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?y?o.jsxs("button",{className:"px-1.5 py-0.5 rounded text-xs font-mono flex items-center gap-1 bg-bg-primary text-text-muted pointer-events-none opacity-60",children:[o.jsx("span",{children:fe.name}),o.jsx("span",{className:"text-[10px]",children:"*"})]},fe.name):o.jsx(ao,{trigger:ue,minWidth:"160px",items:[...fe.actions.map(_e=>({label:o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${fe.name}-${_e}`,children:[o.jsx("input",{type:"checkbox",id:`${fe.name}-${_e}`,checked:ot.has(_e),onChange:()=>Q(fe.name,_e),disabled:y,className:"w-3 h-3 rounded accent-accent-primary"}),o.jsx("span",{children:_e})]}),closeOnClick:!1})),{label:Ae?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(Ae)ee(fe.name);else{const _e=new Map(ie);_e.set(fe.name,new Set(fe.actions)),W(F(_e))}}}]},fe.name):o.jsx("button",{onClick:()=>!y&&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"} ${y?"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=>!y&&U(fe.target.value),readOnly:y,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 ${y?"opacity-60":""}`})]}),o.jsx(JS,{onCancel:Ue,onSave:He,saving:Z,saveDisabled:!b||!R||y}),y&&o.jsx("div",{className:"flex justify-end mt-2",children:o.jsx(nt,{variant:"primary",onClick:()=>{S(b+" (copy)"),A(`${E}-copy-${Date.now()}`),C(null),x(!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(nt,{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(ib,{title:"Built-in",agents:Te,subagents:me,isBuiltIn:!0,onView:re,onDuplicate:ve}),l.length>0&&o.jsx(ib,{title:"Custom",agents:Rt,subagents:$e,isBuiltIn:!1,onView:re,onDuplicate:ve,onEdit:Le,onDelete:Ie})]})]})}function L5(){const e=ke(x=>{var b;return(b=x.currentSession)==null?void 0:b.mode}),r=ke(x=>x.switchMode),i=kt(x=>x.defaults),s=kt(x=>x.userItems),l=kt(x=>x.fetchAgents),u=[...i,...s],[f,c]=P.useState(!1),[d,p]=P.useState(!1),[g,m]=P.useState(null),v=P.useRef(null);if(P.useEffect(()=>{l()},[l]),P.useEffect(()=>{function x(b){v.current&&!v.current.contains(b.target)&&c(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]),!e)return null;const _=u.filter(x=>!x.subagent),E=_.find(x=>x.id===e),C=(E==null?void 0:E.name)??e,y=Wl(u,e);return o.jsxs("div",{className:"relative",ref:v,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:y},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((x,b)=>{const S=x.id===e,j=Wl(u,x.id),A=b<4?`Ctrl+${b+1}`:null;return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${S?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[o.jsxs("button",{type:"button",onClick:()=>{S||r(x.id),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:x.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+",b+1]})]},x.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(D5,{isOpen:d,onClose:()=>{p(!1),m(null)},initialEditId:g})]})}function R5(){const e=ke(s=>s.currentSession),r=ke(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 O5({question:e}){const r=ke(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(nt,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),o.jsx(nt,{variant:"primary",size:"sm",onClick:l,children:"Send Answer"})]})]})})}function M5(){const e=ke(s=>s.connectionStatus),r=ke(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 I5(){const e=GS(),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 B5({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(Za,{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 z5({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=Yn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchCommands:async()=>{await Nh("/api/commands",e)},fetchCommand:async i=>{try{const s=await Ce(`/api/commands/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/commands/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createCommand:async i=>{const s=await ci("POST","/api/commands",i);return s.success&&await r().fetchCommands(),s},updateCommand:async(i,s)=>{const l=await ci("PUT",`/api/commands/${i}`,s);return l.success&&await r().fetchCommands(),l},deleteCommand:async i=>{try{const s=await Ce(`/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 Ce(`/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"}}}})),H5={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function P5(e,r={}){const i={...H5,...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=V5(l),f=`data:${e.type};base64,${u}`,c=await f0(f);return{dataUrl:f,mimeType:e.type,size:e.size,width:c.width,height:c.height}}return await F5(e,i)}async function F5(e,r){const i=await $5(e),s=await f0(i),{width:l,height:u}=U5(s.width,s.height,r.maxWidth,r.maxHeight),f=q5();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),sb(p)<=r.maxSizeBytes||d<=.3)break;d-=.1}while(!0);const g=sb(p);return{dataUrl:p,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:l,height:u}}function U5(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 $5(e){return new Promise((r,i)=>{const s=G5(),l=new s;l.onload=()=>r(l.result),l.onerror=()=>i(new Error("Failed to read file")),l.readAsDataURL(e)})}function f0(e){return new Promise((r,i)=>{const s=W5(),l=new s;l.onload=()=>r(l),l.onerror=()=>i(new Error("Failed to load image")),l.src=e})}function q5(){var r;const e=mf();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function W5(){const e=mf();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function G5(){const e=mf();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function mf(){return globalThis}function V5(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 sb(e){const i=e.split(",")[1];return i?Math.round(i.length*3/4):0}function K5(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function Y5(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${ab(e.size)}). Maximum size is ${ab(r)}.`}:{valid:!0}}function ab(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function th(e,r,i,s={}){const{maxSizeBytes:l=50*1024*1024,filename:u}=s;if(!K5(e)){i(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const f=Y5(e,l);if(!f.valid){i(f.error??"Image file is too large");return}try{const c=await P5(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),d={id:_b(),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 X5(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 nh(e){return{contextWindow:e.contextWindow,temperature:e.temperature??null,topP:e.topP??null,topK:e.topK??null,maxTokens:e.maxTokens??null}}function Z5({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 Ua({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 v=E=>{if(p(E),E==="")i(null);else{const C=parseFloat(E);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:E=>v(E.target.value),onClick:()=>g&&_(),placeholder:g?"Using profile default (click to edit)":"",className:`w-full bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary focus:outline-none focus:border-accent-primary ${g?"opacity-50 cursor-pointer":""}`}),f&&o.jsx("p",{className:"text-xs text-text-muted mt-1",children:f})]})}function Q5({isOpen:e,onClose:r,providerId:i,model:s}){const[l,u]=P.useState(()=>nh(s)),[f,c]=P.useState(!1),d=At(m=>m.updateModelSettings);P.useEffect(()=>{u(nh(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(nh(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(nt,{variant:"secondary",onClick:g,disabled:f,children:"Cancel"}),o.jsx(nt,{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(Ua,{label:"Context Window",value:l.contextWindow,onChange:m=>m!==null&&u(v=>({...v,contextWindow:m})),min:1024,max:1e7,helpText:"Range: 1,024 - 10,000,000 tokens"}),o.jsxs(Z5,{label:"Sampling Parameters",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ua,{label:"Temperature",value:l.temperature,onChange:m=>u(v=>({...v,temperature:m})),min:0,max:2,step:.1,helpText:"0.0 - 2.0",defaultValue:1}),o.jsx(Ua,{label:"Top P",value:l.topP,onChange:m=>u(v=>({...v,topP:m})),min:0,max:1,step:.05,helpText:"0.0 - 1.0",defaultValue:1})]}),o.jsx(Ua,{label:"Top K",value:l.topK,onChange:m=>u(v=>({...v,topK:m})),min:1,max:200,helpText:"1 - 200 (leave as default if not supported)"})]}),o.jsx(Ua,{label:"Max Tokens",value:l.maxTokens,onChange:m=>u(v=>({...v,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 J5(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function eA(){var U;const[,e]=ur(),r=ke(M=>M.currentSession),i=ke(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),v=P.useRef(new Set),_=At(M=>M.providers),E=At(M=>M.activeProviderId),C=At(M=>M.model);At(M=>M.backend);const y=At(M=>M.llmStatus),x=At(M=>M.activating),b=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([]),v.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=>{v.current.has(Y)||(v.current.add(Y),D(Y))})}},[s,_]),_.find(M=>M.id===E);const A=y==="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===E){T(M);return}r?(i(M.id,void 0),At.getState().syncFromSession(M.id,""),l(!1),f([])):await b(M.id)&&(l(!1),f([]))},H=M=>{T(M)},W=async(M,Y)=>{M.stopPropagation(),v.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 Ce(`/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===E?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${x?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[o.jsxs("div",{onClick:()=>!x&&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===E?"text-accent-primary":"text-text-primary"}`,children:M.name}),o.jsx("span",{className:"text-xs text-text-muted truncate",children:M.backend!=="auto"&&jS(M.backend)})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[M.id===E?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===E?"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===E?"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:J5(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(Q5,{isOpen:!0,onClose:q,providerId:g.providerId,model:g.model})]})}function tA(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}const nA="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 rA({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:nA})})})}function p0({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),[v,_]=P.useState(null),[E,C]=P.useState(null),{view:y,editingId:x,formError:b,saving:S,formData:j,setView:A,setEditingId:N,setFormError:D,setFormData:T,setSaving:B}=Rb(),{requestDelete:H,clearConfirm:W,isConfirming:K}=Th(),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=x??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=x?await g(x,Te):await p(Te);if(B(!1),!$e.success){D($e.error??"Failed to save command.");return}i?r():A("list")},Ie=()=>{i?r():(A("list"),_(null),C(null))},He=me=>{T(Te=>({...Te,name:me})),(!x||j.isDefault)&&T(Te=>({...Te,id:tA(me)}))},Ue=()=>{_(null),C(null),A("list")},je=()=>{v&&(_(null),A("edit"),N(v),d(v).then(me=>{me&&T({name:`${me.metadata.name} (copy)`,id:`${v}-copy-${Date.now()}`,prompt:me.prompt,agentMode:me.metadata.agentMode??"",isDefault:!0})}))};if(v){const me=s.find(Te=>Te.id===v);return o.jsx(jt,{isOpen:e,onClose:Ue,title:`Default: ${(me==null?void 0:me.name)??v}`,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:v})]}),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:E??"",readOnly:!0,placeholder:"...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none opacity-60"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(nt,{variant:"secondary",onClick:Ue,children:"Close"}),o.jsx(nt,{variant:"primary",onClick:je,children:"Duplicate & Customize"})]})]})})}return y==="edit"?o.jsx(jt,{isOpen:e,onClose:Ie,title:x?"Edit Command":"New Command",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[b&&o.jsx(Lh,{message:b}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(Lb,{name:j.name,id:j.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Command",idPlaceholder:"my-command",readOnlyId:!!x&&!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(nt,{variant:"secondary",onClick:Ie,children:"Cancel"}),o.jsx(nt,{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(Tb,{description:"Commands are pre-defined messages you can send with a single click.",onNew:re}),o.jsxs(Db,{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(rA,{onClick:()=>$(me.id)}),o.jsx(Xa,{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(Bs,{onClick:()=>ve(me.id)}),o.jsx(Xa,{onClick:()=>oe(me.id)}),K(me.id,"delete")?o.jsx(Ah,{onConfirm:()=>be(me.id),onCancel:W}):o.jsx(Dh,{onClick:()=>H(me.id)})]})]},me.id))})]})]})]})}function m0({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 y;return(y=g.current)==null?void 0:y.focus()}))},[r]),P.useEffect(()=>{if(!r)return;const y=x=>{p.current&&!p.current.contains(x.target)&&s()};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[r,s]);const m=P.useCallback(()=>{r?s():i()},[r,i,s]),v=P.useCallback(y=>{f(y),d(0)},[]),_=P.useCallback(y=>{const x=e.filter(b=>l(b,u));switch(y.key){case"ArrowDown":y.preventDefault(),d(b=>Math.min(b+1,x.length-1));break;case"ArrowUp":y.preventDefault(),d(b=>Math.max(b-1,0));break;case"Enter":y.preventDefault();break;case"Escape":y.preventDefault(),s();break}},[e,u,l,s]),E=P.useCallback(()=>{d(0)},[]),C=e.filter(y=>l(y,u));return{isOpen:r,search:u,selectedIndex:c,filtered:C,containerRef:p,searchRef:g,handleToggle:m,handleSearchChange:v,handleKeyDown:_,setSelectedIndex:d,resetSelection:E}}function g0({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 x0({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 v0({children:e,maxHeight:r="max-h-64"}){return o.jsx("div",{className:`overflow-y-auto ${r} p-1`,children:e})}function b0({hasItems:e,message:r}){return o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:e?"No matches":r})}function y0({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 iA({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:v,search:_,selectedIndex:E,filtered:C,containerRef:y,searchRef:x,handleToggle:b,handleSearchChange:S,handleKeyDown:j}=m0({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:y,className:"relative",children:[o.jsx(g0,{label:"Commands",isOpen:v,onClick:b}),v&&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(x0,{value:_,onChange:S,onKeyDown:j,ref:x,placeholder:"Search commands..."}),o.jsx(v0,{children:C.length===0?o.jsx(b0,{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===E?"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(Bs,{className:"opacity-0 group-hover:opacity-100",onClick:B=>{B.stopPropagation(),u(!1),c(D.id)}})]},D.id))}),o.jsx(y0,{label:"Manage Commands...",onClick:N})]}),o.jsx(p0,{isOpen:!!f,onClose:()=>c(null),initialEditId:f})]})}function sA(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function aA(e){let r=1;for(;e.some(i=>i.id===`s${r}`);)r++;return`s${r}`}const oA=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],_0={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"},S0=[{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)"}],Ai=150,Rr=54,Ts=80,Rn=30,As=70,ob=100,Di=50,Ol=50,lb=4;function gf(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 lA(e,r,i,s){const l=Ol+Di+Ai+ob+Ai+Di+Ol,u=l/2,f=Ol+Di+Ai/2,c=Ol+Di+Ai+ob+Ai/2,d=[],p=[],g=new Map,m=e.filter(R=>R.type==="agent"||R.type==="shell"),v=e.filter(R=>R.type==="sub_agent"),_=v.length>0,E=_?f:u,C=m.length>0?c:u,y=Di+Rn/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:E,cy:y,w:Ts,h:Rn}),g.set("$start",{cx:E,cy:y,w:Ts,h:Rn}),e.length===0){const R=y+Rn/2+As*2+Rn/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:R,w:Ts,h:Rn}),g.set("$done",{cx:E,cy:R,w:Ts,h:Rn}),{nodes:d,edges:p,width:l,height:R+Rn/2+Di,posMap:g}}const x=y+Rn/2+As,b=(R,U)=>{R.forEach((M,Y)=>{const Z=x+Y*(Rr+As)+Rr/2,{name:z,color:L}=gf(M,s);d.push({id:M.id,type:"step",label:z,color:L,cx:U,cy:Z,w:Ai,h:Rr}),g.set(M.id,{cx:U,cy:Z,w:Ai,h:Rr})})};b(m,E),b(v,C);const S=m.length>0?x+(m.length-1)*(Rr+As)+Rr/2:y,j=_?x+(v.length-1)*(Rr+As)+Rr/2:y,A=Math.max(S,j)+Rr/2+As+Rn/2;d.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:A,w:Ts,h:Rn}),g.set("$done",{cx:E,cy:A,w:Ts,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}`:_0[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+Di,posMap:g}}function cA({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:v,onDeleteTransition:_}){const E=P.useRef(null),C=P.useRef(!1),[y,x]=P.useState(null),[b,S]=P.useState(null),[j,A]=P.useState(null),{nodes:N,edges:D,width:T,height:B,posMap:H}=P.useMemo(()=>lA(e,r,l,u),[e,r,l,u]),W=P.useCallback(Q=>{var re;const ee=E.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||!b||Q==="$start"?!1:b.type==="reconnect-from"?Q!=="$done":!0,[b]),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(!b)return;const ee=W(Q);S(X=>X?{...X,mouseX:ee.x,mouseY:ee.y}:null)},[b,W]),Y=P.useCallback(()=>{b&&(C.current=!0,j&&K(j)&&(b.type==="new"?g(b.fromNodeId,j):b.type==="reconnect-to"?m(b.edgeKey,j):b.type==="reconnect-from"&&v(b.edgeKey,j)),S(null),A(null))},[b,j,K,g,m,v]),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 Ie=ee.cx+Q.fromPort*(ee.w/2-10),He=ee.cy+ee.h/2,Ue=X.cx+Q.toPort*(X.w/2-10),je=X.cy-X.h/2,me=je-He,Te=Ue-Ie;$=`M ${Ie} ${He} C ${Ie} ${He+me*.4}, ${Ue-Te*.2} ${je-me*.1}, ${Ue} ${je}`,oe=Ie+(Ue-Ie)*.5,re=He+me*.6,be={x:Ie,y:He},Le={x:Ue,y:je}}else if(Q.direction==="back"){const Ie=Q.from===Q.to,He=ee.cx>=T/2,Ue=Q.backEdgeIndex*16,je=He?T-20-Ue:20+Ue;if(Ie){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 ${je} ${ee.cy} L ${je} ${$e} L ${Te} ${$e} L ${Te} ${X.cy-X.h/2}`,oe=je,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 Ie=X.cx>ee.cx,He=Q.sameEdgeIndex===0?-12:12,Ue=Ie?ee.cx+ee.w/2:ee.cx-ee.w/2,je=Ie?X.cx-X.w/2:X.cx+X.w/2,me=ee.cy+He,Te=X.cy+He,$e=(Ue+je)/2;$=`M ${Ue} ${me} C ${$e} ${me}, ${$e} ${Te}, ${je} ${Te}`,oe=$e,re=(me+Te)/2-6,be={x:Ue,y:me},Le={x:je,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:Ie=>{Ie.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||b)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(!b)return null;let Q,ee,X,$;if(b.type==="reconnect-from"){const ve=H.get(b.fixedTargetId);if(!ve)return null;Q=b.mouseX,ee=b.mouseY,X=ve.cx,$=ve.cy-ve.h/2}else{const ve=H.get(b.fromNodeId);if(!ve)return null;Q=ve.cx,ee=ve.cy+ve.h/2,X=b.mouseX,$=b.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=(b==null?void 0:b.fromNodeId)===Q.id;return o.jsx("circle",{cx:Q.cx,cy:ee,r:lb,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=b&&j===Q.id&&K(Q.id);return o.jsx("circle",{cx:Q.cx,cy:ee,r:lb,fill:X?"#3fb950":"#1c2128",stroke:X?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:X?1:.5})};return o.jsxs("svg",{ref:E,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=y===Q.id,re=b&&j===Q.id&&K(Q.id);if(Q.type==="terminal"){const be=Q.id==="$start",Le=be?"#58a6ff":"#3fb950",Ie=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}),Ie&&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:()=>x(Q.id),onMouseLeave:()=>x(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&&!b&&!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)}),b&&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 er="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",Mi="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 uA({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:Mi,children:S0.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:Mi,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:er})]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function rh({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 dA({step:e,isEntry:r,agentTypes:i,transitionCount:s,templateVariables:l,onUpdate:u,onRemove:f,onSetEntry:c}){const{color:d,name:p}=gf(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,v=m==="sub_agent"?"verification":"build";if(m==="agent"){const _=i.find(E=>!E.subagent);u({...e,type:m,phase:v,toolMode:(_==null?void 0:_.id)??"builder",name:(_==null?void 0:_.name)??"Agent"})}else if(m==="sub_agent"){const _=i.find(E=>E.subagent);u({...e,type:m,phase:v,subAgentType:(_==null?void 0:_.id)??"",name:(_==null?void 0:_.name)??"Sub-Agent"})}else u({...e,type:m,phase:v,name:"Shell"})},className:Mi,children:oA.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(v=>v.id===g.target.value);u({...e,toolMode:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Mi,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(v=>v.id===g.target.value);u({...e,subAgentType:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Mi,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:`${er} resize-y text-xs`,placeholder:"Injected on first entry..."}),o.jsx(rh,{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:`${er} resize-y text-xs`,placeholder:"Injected on re-entry..."}),o.jsx(rh,{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:`${er} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),o.jsx(rh,{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:`${er} 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:`${er} 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 cb=[];function w0({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),v=Ct(pe=>pe.updateWorkflow),_=Ct(pe=>pe.deleteWorkflow),{requestDelete:E,clearConfirm:C,isConfirming:y}=Th(),[x,b]=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(cb),[X,$]=P.useState({type:"always"}),[oe,re]=P.useState(""),[ve,be]=P.useState(!1),[Le,Ie]=P.useState([]),[He]=P.useState(null);P.useEffect(()=>{e&&(c(),g(),Ce("/api/agents").then(pe=>pe.json()).then(pe=>Ie(pe.agents??[])).catch(()=>{}),T(null),H(null),i?s.some(ye=>ye.id===i)?p(i).then(ye=>{ye&&(K(ye.metadata.name+" (copy)"),R(`${i}-copy-${Date.now()}`),M(ye.metadata.description),Z(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),V(ye.entryStep),ie(ye.settings.maxIterations),ee(ye.steps),$(ye.startCondition??{type:"always"}),re(""),j(null),N(!1),b("edit"))}):d(i).then(ye=>{ye&&(K(ye.metadata.name),R(ye.metadata.id),M(ye.metadata.description),Z(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),V(ye.entryStep),ie(ye.settings.maxIterations),ee(ye.steps),$(ye.startCondition??{type:"always"}),re(""),j(i),N(!1),b("edit"))}):(b("list"),j(null),N(!1)))},[e,c,d,p,g,i]);const Ue=async pe=>{const ye=await d(pe);ye&&(j(pe),K(ye.metadata.name),R(ye.metadata.id),M(ye.metadata.description),Z(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),V(ye.entryStep),ie(ye.settings.maxIterations),ee(ye.steps),$(ye.startCondition??{type:"always"}),re(""),T(null),H(null),b("edit"))},je=async()=>{var Qe;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 ye=I;if(!ye||!Q.some(te=>te.id===ye)){if(ye=((Qe=Q.find(te=>te.id))==null?void 0:Qe.id)??"",!ye)return re("All steps need an ID."),!1;V(ye)}be(!0),re("");const we={metadata:{id:pe,name:W,description:U,version:Y||"1.0.0",color:z},entryStep:ye,settings:{maxIterations:F},steps:Q,startCondition:X},We=S?await v(S,we):await m(we);return be(!1),We.success?(S||j(pe),!0):(re(We.error??"Failed to save."),!1)},me=async()=>{await je()},Te=async()=>{await je()&&(i?r():b("list"))},$e=()=>{i?r():b("list")},Rt=pe=>{K(pe),S||R(sA(pe))},fe=async pe=>{if(s.some(we=>we.id===pe)){const we=await p(pe);if(!we)return;K(we.metadata.name),R(we.metadata.id),M(we.metadata.description),Z(we.metadata.version),L(we.metadata.color??"#3b82f6"),V(we.entryStep),ie(we.settings.maxIterations),ee(we.steps),$(we.startCondition??{type:"always"}),re(""),j(pe),N(!0)}else{const we=await d(pe);if(!we)return;K(we.metadata.name),R(we.metadata.id),M(we.metadata.description),Z(we.metadata.version),L(we.metadata.color??"#3b82f6"),V(we.entryStep),ie(we.settings.maxIterations),ee(we.steps),$(we.startCondition??{type:"always"}),re(""),j(pe),N(!0)}b("edit")},Ae=async pe=>{const we=s.some(We=>We.id===pe)?await p(pe):await d(pe);we&&(K(we.metadata.name+" (copy)"),R(`${pe}-copy-${Date.now()}`),M(we.metadata.description),Z(we.metadata.version),L(we.metadata.color??"#3b82f6"),V(we.entryStep),ie(we.settings.maxIterations),ee(we.steps),$(we.startCondition??{type:"always"}),re(""),j(null),N(!1),b("edit"))},Be=()=>{j(null),K(""),R(""),M(""),Z("1.0.0"),L("#3b82f6"),V(""),ie(50),ee(structuredClone(cb)),$({type:"always"}),re(""),T(null),H(null),N(!1),b("edit")},ot=async pe=>{await _(pe),C()},ue=P.useCallback(pe=>{T(pe),H(null)},[]),_e=P.useCallback(pe=>{H(pe),T(null)},[]),Ne=D!==null?Number(D):-1,Oe=Ne>=0?Q[Ne]??null:null,qe=P.useCallback(pe=>{ee(ye=>ye.map((we,We)=>We===Ne?pe:we))},[Ne]),Nt=X.type==="step_result"?`${X.result}`:_0[X.type]??X.type,Ze=()=>{const pe=Q.length,ye=aA(Q),we=Le.find(We=>!We.subagent);ee([...Q,{id:ye,name:(we==null?void 0:we.name)??"Agent",type:"agent",phase:"build",toolMode:(we==null?void 0:we.id)??"builder",transitions:[]}]),I||V(ye),ue(String(pe))},Ot=P.useCallback((pe,ye)=>{pe==="$start"?(V(ye),_e("start")):ee(we=>{const We=we.find(te=>te.id===pe),Qe=We?We.transitions.length:0;return _e(`${pe}:${Qe}`),we.map(te=>te.id===pe?{...te,transitions:[...te.transitions,{when:{type:"always"},goto:ye}]}:te)})},[_e]),Tt=P.useCallback((pe,ye)=>{if(pe==="start")V(ye);else{const we=pe.lastIndexOf(":"),We=pe.slice(0,we),Qe=parseInt(pe.slice(we+1));ee(te=>te.map(Ee=>Ee.id===We?{...Ee,transitions:Ee.transitions.map((Re,Ve)=>Ve===Qe?{...Re,goto:ye}:Re)}:Ee))}},[]),Yt=P.useCallback((pe,ye)=>{const we=pe.lastIndexOf(":"),We=pe.slice(0,we),Qe=parseInt(pe.slice(we+1));ee(te=>{const Ee=te.find(Ve=>Ve.id===We);if(!Ee)return te;const Re=Ee.transitions[Qe];return Re?te.map(Ve=>Ve.id===We?{...Ve,transitions:Ve.transitions.filter((Mt,gn)=>gn!==Qe)}:Ve.id===ye?{...Ve,transitions:[...Ve.transitions,Re]}:Ve):te}),H(null)},[]),lt=P.useCallback(pe=>{if(pe==="start")V("");else{const ye=pe.lastIndexOf(":"),we=pe.slice(0,ye),We=parseInt(pe.slice(ye+1));ee(Qe=>Qe.map(te=>te.id===we?{...te,transitions:te.transitions.filter((Ee,Re)=>Re!==We)}:te))}H(null)},[]),Bn=P.useCallback((pe,ye)=>{if(pe==="start")$(ye);else{const we=pe.lastIndexOf(":"),We=pe.slice(0,we),Qe=parseInt(pe.slice(we+1));ee(te=>te.map(Ee=>Ee.id===We?{...Ee,transitions:Ee.transitions.map((Re,Ve)=>Ve===Qe?{...Re,when:ye}:Re)}:Ee))}},[]),Xt=pe=>gf(pe,Le).name,Ps=()=>{if(!B)return null;if(B==="start"){const Re=Q.find(Ve=>Ve.id===I);return{type:"start",fromLabel:"Start",toLabel:Re?Xt(Re):"(none)",condition:X}}const pe=B.lastIndexOf(":"),ye=B.slice(0,pe),we=parseInt(B.slice(pe+1)),We=Q.find(Re=>Re.id===ye);if(!We)return null;const Qe=We.transitions[we];if(!Qe)return null;const te=Q.find(Re=>Re.id===Qe.goto),Ee=Qe.goto==="$done"?"Done":te?Xt(te):Qe.goto;return{type:"step",fromLabel:Xt(We),toLabel:Ee,condition:Qe.when}};if(x==="edit"){const pe=Ps();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:ye=>Rt(ye.target.value),placeholder:"Workflow name",className:`${er} ${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:`${er} 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:ye=>!A&&M(ye.target.value),readOnly:A,placeholder:"What does this workflow do?",className:`${er} ${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:ye=>!A&&ie(Number(ye.target.value)),readOnly:A,className:`${er} font-mono ${A?"opacity-50":""}`})]}),o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Color"}),o.jsx("input",{type:"color",value:z,onChange:ye=>!A&&L(ye.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(cA,{steps:Q,entryStep:I,selectedNodeId:(Oe==null?void 0:Oe.id)??null,selectedEdgeKey:B,startConditionLabel:Nt,agentTypes:Le,isReadOnly:A,onSelectNode:ye=>{if(ye===null){ue(null);return}const we=Q.findIndex(We=>We.id===ye);ue(we>=0?String(we):null)},onSelectEdge:_e,onRemoveStep:ye=>{var We;const we=Q.findIndex(Qe=>Qe.id===ye);if(ee(Qe=>Qe.filter(te=>te.id!==ye)),Ne===we&&ue(null),I===ye){const Qe=Q.filter(te=>te.id!==ye);V(((We=Qe[0])==null?void 0:We.id)??"")}},onCreateTransition:Ot,onReconnectTo:Tt,onReconnectFrom:Yt,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||Oe)?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:ye=>$(ye.target.value==="step_result"?{type:"step_result",result:"success"}:{type:ye.target.value}),className:Mi,children:S0.map(ye=>o.jsx("option",{value:ye.value,children:ye.label},ye.value))})]}),X.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Result"}),I&&(()=>{const ye=Q.find(te=>te.id===I),we=ye&&(ye.type==="sub_agent"||ye.type==="agent")?Le.find(te=>te.id===(ye.type==="sub_agent"?ye.subAgentType:ye.toolMode)):void 0,We=(we==null?void 0:we.results)&&we.results.length>0,Qe=(we==null?void 0:we.results)??[];return We?o.jsx("select",{value:X.result??Qe[0],onChange:te=>$({type:"step_result",result:te.target.value}),className:Mi,children:Qe.map(te=>o.jsx("option",{value:te,children:te},te))}):o.jsx("input",{type:"text",value:X.result??"success",onChange:te=>$({type:"step_result",result:te.target.value}),placeholder:"e.g. success, passed, failed",className:er})})()]}),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(uA,{fromLabel:pe.fromLabel,toLabel:pe.toLabel,condition:pe.condition,fromStep:pe.type==="step"?Q.find(ye=>ye.id===pe.fromLabel):void 0,agentTypes:Le,onUpdateCondition:ye=>Bn(B,ye),onDelete:()=>lt(B)}):Oe?o.jsx(dA,{step:Oe,isEntry:Oe.id===I,agentTypes:Le,transitionCount:Oe.transitions.length,templateVariables:f,onUpdate:qe,onRemove:()=>{var ye;if(Oe&&(ee(Q.filter((we,We)=>We!==Ne)),ue(null),I===Oe.id)){const we=Q.filter((We,Qe)=>Qe!==Ne);V(((ye=we[0])==null?void 0:ye.id)??"")}},onSetEntry:()=>V(Oe.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(nt,{variant:"secondary",onClick:$e,children:"Close"}),A?o.jsx(nt,{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(nt,{variant:"secondary",onClick:me,disabled:ve||!W,children:ve?"Saving...":"Save"}),o.jsx(nt,{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(nt,{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(Xa,{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(Xa,{onClick:()=>Ae(pe.id)}),o.jsx(Bs,{onClick:()=>Ue(pe.id)}),y(pe.id,"delete")?o.jsx(Ah,{onConfirm:()=>ot(pe.id),onCancel:()=>{}}):o.jsx(Dh,{onClick:()=>E(pe.id)})]})]},pe.id))})]})]})]})}function hA(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 fA({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:v,selectedIndex:_,filtered:E,containerRef:C,searchRef:y,handleToggle:x,handleSearchChange:b,handleKeyDown:S}=m0({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(g0,{label:"Workflows",isOpen:m,onClick:x}),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(x0,{value:v,onChange:b,onKeyDown:S,ref:y,placeholder:"Search workflows..."}),o.jsx(v0,{children:E.length===0?o.jsx(b0,{hasItems:g.length>0,message:"No workflows yet"}):E.map((N,D)=>{const T=hA(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(Bs,{className:"opacity-0 group-hover:opacity-100",onClick:H=>{H.stopPropagation(),l(!1),f(N.id)}})]},N.id)})}),o.jsx(y0,{label:"Manage Workflows...",onClick:A})]}),o.jsx(w0,{isOpen:!!u,onClose:()=>f(null),initialEditId:u})]})}function pA({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),v=kt(M=>M.defaults),_=kt(M=>M.userItems),E=kt(M=>M.fetchAgents),C=ke(M=>{var Y;return(Y=M.currentSession)==null?void 0:Y.mode}),y=ke(M=>M.switchMode),[x,b]=P.useState(""),[S,j]=P.useState(0),A=P.useRef(null);P.useEffect(()=>{e&&(d(),m(),E(),b(""),j(0),setTimeout(()=>{var M;return(M=A.current)==null?void 0:M.focus()},50))},[e,d,m,E]),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=[...v,..._].filter(M=>!M.subagent&&M.id!==C&&N(M.name,x)).map(M=>({kind:"agent",id:M.id,name:M.name})),T=[...f,...c].filter(M=>N(M.name,x)).map(M=>({kind:"command",id:M.id,name:M.name})),B=[...p,...g].filter(M=>N(M.name,x)).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"?y(M.id):M.kind==="command"?s(M.id,u):l(M.id),r())},R=M=>{b(M),j(0)},U=M=>M==="agent"?"Agent > Switch to":M==="command"?"Command > Launch":"Workflow > Run";return e?Xl.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:x,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(jh,{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 mA(e){return e==="criterion"}function gA(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=>mA(s.name))}function xA(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,y)=>{var x;return C.id===((x=l[y])==null?void 0:x.id)})?i.push(_):i.push({type:"criteria-batch",toolCalls:[...l]}),g++,l=[]}},v=()=>{if(!s)return;const _=s,E=d.get(_.subAgentId);E&&E.type==="subagent"&&E.messages.length===_.messages.length&&E.messages.every((y,x)=>y===_.messages[x])?i.push(E):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(),v(),f++,i.push({type:"context-divider",windowSequence:f})),u=_.contextWindowId,gA(_)){v();for(const E of _.toolCalls)l.push(E);continue}if(m(),_.subAgentId&&_.subAgentType)s&&s.subAgentId===_.subAgentId?s.messages.push(_):(v(),s={subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:[_]});else{v();const E=c.get(_.id);E&&E.type==="message"&&E.message===_?i.push(E):i.push({type:"message",message:_})}}return m(),v(),i}function vA(e){const{year:r,month:i,day:s}=Bb(e);return`${r}/${i}/${s} ${Ql(e)}`}function bA(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const yA=10,_A=150;function SA(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 wA(e){return[...e].sort((s,l)=>new Date(l.timestamp).getTime()-new Date(s.timestamp).getTime()).slice(0,yA).reverse().map(s=>({id:s.id,content:s.content,timestamp:s.timestamp,formattedTimestamp:vA(s.timestamp),trimmedContent:bA(s.content,_A),sessionId:s.sessionId,sessionName:s.sessionName}))}function CA(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(...SA(u));return wA(s)}function kA(e,r=[],i=null){const[s,l]=P.useState(0),[u,f]=P.useState(!1),c=P.useMemo(()=>CA(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]),v=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:v}}function EA({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,v]=P.useState(!1),[_,E]=P.useState(!1),[C,y]=P.useState(!1),[x,b]=P.useState(null),S=P.useRef(null),j=P.useRef(null),A=P.useRef(null),N=ke(te=>te.currentSession),D=ke(te=>te.messages),T=ke(te=>te.streamingMessage),B=ke(te=>te.sessions),H=ke(te=>te.error),W=ke(te=>te.pendingQuestion),K=Nb(),q=ke(te=>te.sendMessage),R=ke(te=>te.clearError),U=ke(te=>te.acceptAndBuild),M=ke(te=>te.stopGeneration),Y=ke(te=>te.launchRunner),Z=ke(te=>te.cancelQueued),z=WS(),{showThinking:L,showVerboseToolOutput:I,showStats:V,showAgentDefinitions:F,showWorkflowBars:ie}=wb(),Q=Ct(te=>te.defaults),ee=Ct(te=>te.userItems),X=[...Q,...ee],$=Ct(te=>te.fetchWorkflows),oe=kt(te=>te.defaults),re=kt(te=>te.userItems),ve=[...oe,...re].filter(te=>!te.subagent);P.useEffect(()=>{$()},[$]);const{history:be,selectedIndex:Le,showHistory:Ie,openHistory:He,closeHistory:Ue,navigateUp:je,navigateDown:me,selectCurrent:Te}=kA(D,B,N==null?void 0:N.id);P.useEffect(()=>{const te=Ee=>{b(Ee.detail.stats)};return window.addEventListener("open-turn-stats",te),()=>window.removeEventListener("open-turn-stats",te)},[]);const $e=P.useMemo(()=>T?D.map(te=>te.id===T.id?T:te):D,[D,T]),Rt=P.useRef([]),fe=P.useMemo(()=>{const te=xA($e,Rt.current);return Rt.current=te,te},[$e]),Ae=P.useMemo(()=>X5(D),[D]),{force_scroll_to_bottom:Be,isAutoScrollActive:ot,setAutoScroll:ue}=h0(S,N),_e=P.useCallback(()=>{const te=j.current;if(!te)return;te.style.height="auto";const Ee=Math.min(200,te.scrollHeight);te.style.height=`${Ee}px`},[]);P.useEffect(()=>{if(!(N!=null&&N.id))return;const te=`openfox:draft:${N.id}`,Ee=localStorage.getItem(te);Ee!==null&&l(Ee)},[N==null?void 0:N.id]),P.useEffect(()=>{var te;(te=j.current)==null||te.focus(),_e()},[N==null?void 0:N.id,_e]),P.useEffect(()=>{if(!(N!=null&&N.id))return;const te=`openfox:draft:${N.id}`,Ee=setTimeout(()=>{s?localStorage.setItem(te,s):localStorage.removeItem(te)},500);return()=>clearTimeout(Ee)},[N==null?void 0:N.id,s]),P.useEffect(()=>{_e()},[s,_e]),P.useEffect(()=>{const te=Ee=>{Ee.key==="Escape"&&K&&M(),Ee.key==="ScrollLock"&&ue(!ot)};return window.addEventListener("keydown",te),()=>window.removeEventListener("keydown",te)},[K,M,ot]);const Ne=P.useRef(0);P.useEffect(()=>{const te=Ee=>{if(Ee.key==="Shift"&&!Ee.ctrlKey&&!Ee.metaKey&&!Ee.altKey){const Re=Date.now();Re-Ne.current<300?(Ee.preventDefault(),y(!0),Ne.current=0):Ne.current=Re}};return window.addEventListener("keydown",te),()=>window.removeEventListener("keydown",te)},[]),P.useEffect(()=>{const te=j.current;if(!te)return;const Ee=async Re=>{var Mt;if(document.activeElement!==te)return;const Ve=(Mt=Re.clipboardData)==null?void 0:Mt.items;if(Ve){for(const gn of Array.from(Ve))if(gn.type.startsWith("image/")){Re.preventDefault();const hr=gn.getAsFile();if(!hr)continue;await th(hr,Fi=>f(Mr=>[...Mr,Fi]),g,{filename:"pasted-image"})}}};return te.addEventListener("paste",Ee),()=>te.removeEventListener("paste",Ee)},[]);const Oe=()=>{l(""),f([]),N!=null&&N.id&&localStorage.removeItem(`openfox:draft:${N.id}`)},qe=async te=>{te.preventDefault(),!(!s.trim()&&u.length===0)&&(Be(),q(s,u.length>0?u:void 0),Oe())},Nt=te=>{if((te.ctrlKey||te.metaKey)&&te.code.startsWith("Digit")){const Re=parseInt(te.code.slice(-1),10)-1,Ve=ve[Re];Ve&&(te.preventDefault(),ke.getState().switchMode(Ve.id));return}if(Ie)switch(te.key){case"Enter":te.preventDefault();const Ee=Te();Ee&&(l(Ee),Ue());return;case"Escape":te.preventDefault(),Ue(),K&&M();return;case"ArrowUp":te.preventDefault(),je();return;case"ArrowDown":te.preventDefault(),me();return}if(te.key==="ArrowUp"&&s.trim()===""&&!Ie){te.preventDefault(),He();return}te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),qe(te))},Ze=P.useCallback(async te=>{const Ee=te.target.files;if(!(!Ee||Ee.length===0)){g(null);for(const Re of Array.from(Ee))await th(Re,Ve=>f(Mt=>[...Mt,Ve]),g);A.current&&(A.current.value="")}},[]),Ot=P.useCallback(te=>{te.preventDefault(),te.stopPropagation(),d(!0)},[]),Tt=P.useCallback(te=>{te.preventDefault(),te.stopPropagation(),d(!1)},[]),Yt=P.useCallback(async te=>{te.preventDefault(),te.stopPropagation(),d(!1),g(null);const Ee=te.dataTransfer.files;if(!(!Ee||Ee.length===0))for(const Re of Array.from(Ee))await th(Re,Ve=>f(Mt=>[...Mt,Ve]),g)},[]),lt=P.useCallback(te=>{f(Ee=>Ee.filter(Re=>Re.id!==te))},[]),Bn=P.useCallback(()=>{var te;(te=A.current)==null||te.click()},[]),Xt=(N==null?void 0:N.mode)==="planner",Ps=(N==null?void 0:N.mode)==="builder",pe=((N==null?void 0:N.criteria.length)??0)>0,ye=(N==null?void 0:N.phase)==="done",we=fe.some(te=>te.type==="message"&&te.message.role==="assistant"),We=Xt&&pe&&!K&&we&&!ye,Qe=te=>{const Ee=s.trim()?s:void 0,Re=u.length>0?u:void 0;Xt?U(te,Ee,Re):Ps&&Y(Ee,Re,te),Oe()};return o.jsxs(mC,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:r,messages:$e,children:[W&&o.jsx(O5,{question:W}),o.jsx(vC,{}),x&&o.jsx(C5,{stats:x,onClose:()=>b(null)}),o.jsx(M5,{}),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((te,Ee)=>{if(te.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"})]},Ee);if(te.type==="subagent"){const gn=te.messages.some(hr=>hr.isStreaming);return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(N5,{messages:te.messages,subAgentType:te.subAgentType,subAgentId:te.subAgentId,isStreaming:gn})},Ee)}if(te.type==="criteria-batch")return o.jsx("div",{className:"feed-item px-2 md:px-4",children:o.jsx(u0,{toolCalls:te.toolCalls,criteria:N==null?void 0:N.criteria})},Ee);const Re=te.message;if(Re.role==="assistant")return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(pf,{message:Re,showStats:V,showThinking:L,showVerboseToolOutput:I})},Ee);const Ve=!F&&Re.messageKind==="auto-prompt",Mt=!ie&&(Re.messageKind==="workflow-started"||Re.messageKind==="task-completed");return Ve||Mt?null:o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(d0,{message:Re,isLastAssistantMessage:!1,promptContext:Re.role==="user"?Ae[Re.id]:void 0})},Ee)})}),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(Za,{onClick:R,className:"text-red-400 hover:text-red-300 p-0.5",size:"sm"})]})}),We&&o.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:X.map(te=>{const Ee=te.color??"#3b82f6",Re=parseInt(Ee.slice(1,3),16),Ve=parseInt(Ee.slice(3,5),16),Mt=parseInt(Ee.slice(5,7),16),gn=`rgba(${Re},${Ve},${Mt},0.12)`,hr=`rgba(${Re},${Ve},${Mt},0.22)`,Fi=`rgba(${Re},${Ve},${Mt},0.25)`;return o.jsxs("button",{onClick:()=>U(te.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:gn,color:Ee,border:`1px solid ${Fi}`},onMouseEnter:Mr=>{Mr.currentTarget.style.backgroundColor=hr},onMouseLeave:Mr=>{Mr.currentTarget.style.backgroundColor=gn},children:["▶ ",te.name]},te.id)})}),K&&o.jsx(I5,{})]})]}),o.jsxs("form",{onSubmit:qe,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:Ze,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(te=>o.jsx(B5,{attachment:te,onRemove:lt},te.id))}),Ie&&o.jsx(z5,{history:be,selectedIndex:Le,onSelect:te=>{l(te),Ue()},onEscape:Ue,onNavigate:te=>{te==="up"?je():me()}}),z.length>0&&o.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:z.map(te=>o.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${te.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:[te.mode==="asap"?"ASAP":"Queue",":"]}),o.jsx("span",{className:"truncate max-w-[200px]",children:te.content}),o.jsx(Za,{onClick:()=>Z(te.queueId),size:"sm"})]},te.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:Ot,onDragLeave:Tt,onDrop:Yt,children:[o.jsx("button",{type:"button",onClick:Bn,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:te=>{l(te.target.value),Ie&&Ue()},onKeyDown:Nt,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(iA,{onSendCommand:(te,Ee,Re,Ve)=>{var gn;Ee&&(N==null?void 0:N.mode)!==Ee&&ke.getState().switchMode(Ee);const Mt=Re&&Re.trim()?`${Re.trim()}
150
+
151
+ ${te}`:te;(gn=S.current)==null||gn.scrollTo({top:S.current.scrollHeight,behavior:"smooth"}),q(Mt,Ve!=null&&Ve.length?Ve:void 0,{messageKind:"command",isSystemGenerated:!0}),Oe()},onOpenManager:()=>v(!0),textareaContent:s,attachments:u.length>0?u:void 0}),o.jsx(fA,{onSelectWorkflow:Qe,onOpenManager:()=>E(!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 te;!s.trim()&&u.length===0||((te=S.current)==null||te.scrollTo({top:S.current.scrollHeight,behavior:"smooth"}),q(s,u),Oe())},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(L5,{}),o.jsx(R5,{})]}),o.jsx(eA,{})]})]}),o.jsx(p0,{isOpen:m,onClose:()=>v(!1)}),o.jsx(w0,{isOpen:_,onClose:()=>E(!1)}),o.jsx(pA,{isOpen:C,onClose:()=>y(!1),textareaContent:s,onCloseComplete:()=>{var te;return(te=j.current)==null?void 0:te.focus()},onSelectCommand:async(te,Ee)=>{const Re=await on.getState().fetchCommand(te);if(Re){const Ve=Ee!=null&&Ee.trim()?`${Ee.trim()}
152
+
153
+ ${Re.prompt}`:Re.prompt;Re.metadata.agentMode&&ke.getState().switchMode(Re.metadata.agentMode),q(Ve,u!=null&&u.length?u:void 0,{messageKind:"command",isSystemGenerated:!0}),Oe()}},onSelectWorkflow:te=>{const Ee=s.trim()||void 0,Re=u.length>0?u:void 0;(N==null?void 0:N.mode)==="planner"?ke.getState().acceptAndBuild(te,Ee,Re):ke.getState().launchRunner(Ee,Re,te),Oe()}})]})}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(Pi,{content:r.description})})]})]})});function ub({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(Jl,{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(nt,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),o.jsx(nt,{type:"submit",disabled:!l.trim(),children:r?"Try Again":"Connect"})]})]})})}const jA=[8e3,11434,8080],NA=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function db(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 C0({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 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:"M12 4v16m8-8H4"})})}function AA(){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 DA({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 LA({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,v]=P.useState(""),[_,E]=P.useState("auto"),[C,y]=P.useState(!1),[x,b]=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 Ce("/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){y(!0),b(null);const M=_!=="auto";try{const Z=await(await Ce("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:U,skipBackendDetection:M})})).json();Z.success?(M||E(Z.backend??"auto"),b({success:!0,model:Z.model??void 0})):b({success:!1,error:Z.error??"Connection failed"})}catch(Y){b({success:!1,error:Y instanceof Error?Y.message:"Connection failed"})}y(!1)}function W(){if(!p)return;const U=c||`Provider ${s.length+1}`,M={id:`temp-${Date.now()}`,name:U,url:p,backend:x!=null&&x.success?_:"auto",model:x!=null&&x.success?x.model??null:null,apiKey:m||void 0};l([...s,M]),d(""),g(""),v(""),b(null)}function K(U){j(U),r.some(Y=>Y.id===U)?Ce(`/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 Ce("/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:db(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(AA,{})})]},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:NA.map(U=>o.jsx("button",{type:"button",onClick:()=>{d(U.name),g(U.url),E(U.backend),b(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:jA.map(U=>o.jsxs("button",{type:"button",onClick:()=>{d(""),g(`http://localhost:${U}`),E("auto"),b(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),b(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=>v(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"})]}),x&&o.jsx("div",{className:`p-3 rounded-lg ${x.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:x.success?o.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",db(_),x.model&&` (${x.model})`]}):o.jsx("p",{className:"text-red-500",children:x.error})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{type:"button",onClick:()=>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(C0,{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:x!=null&&x.success?"Add Provider ✓":"Add Provider"})]}),o.jsx("button",{type:"button",onClick:()=>{f(!1),d(""),g(""),b(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(TA,{}),"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 RA({onNext:e}){const[r,i]=P.useState(""),[s,l]=P.useState(!1);return P.useEffect(()=>{Ce("/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(Pb,{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 OA({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}=a0();P.useEffect(()=>{Ce("/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(Zl,{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 MA({onComplete:e}){const[r,i]=P.useState(1),[s,l]=P.useState(!1),[u,f]=P.useState({});async function c(m){f(v=>({...v,providers:m.providers})),i(2)}async function d(m){f(v=>({...v,...m})),i(3)}async function p(m){l(!0);try{if(!(await Ce("/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(v){console.error("Failed to save onboarding data:",v),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(Za,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),o.jsx(DA,{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(C0,{size:"md"}),o.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):o.jsxs(o.Fragment,{children:[r===1&&o.jsx(LA,{onNext:c}),r===2&&o.jsx(RA,{onNext:d}),r===3&&o.jsx(OA,{onNext:p})]})})]})}function xf(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function k0(){return o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(ec,{})})}function IA({sidebarOpen:e,onSidebarToggle:r}){const[,i]=kh("/p/:projectId"),s=i==null?void 0:i.projectId,l=ke(m=>m.connectionStatus),u=ke(m=>m.listSessions),f=ke(m=>m.clearSession),c=Vt(m=>m.currentProject),d=Vt(m=>m.loadProject),p=xf(),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(k0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Hb,{projectId:s,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(Ow,{})})]})}function BA({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:i,onRightSidebarToggle:s}){const[,l]=kh("/p/:projectId/s/:sessionId"),u=l==null?void 0:l.projectId,f=l==null?void 0:l.sessionId,[,c]=ur(),d=ke(S=>S.connectionStatus),p=ke(S=>S.currentSession),g=ke(S=>S.loadSession),m=ke(S=>S.listSessions),v=ke(S=>S.pendingSessionCreate),_=ke(S=>S.error),E=ke(S=>S.clearError),C=Vt(S=>S.currentProject),y=Vt(S=>S.loadProject),x=xf(),b=d==="connected"||x;return P.useEffect(()=>{b&&u&&(C==null?void 0:C.id)!==u&&y(u)},[b,u,C==null?void 0:C.id,y]),P.useEffect(()=>{b&&f&&(p==null?void 0:p.id)!==f&&!v&&g(f),b&&u&&m(u)},[b,f,p==null?void 0:p.id,g,m,v,u]),P.useEffect(()=>{(_==null?void 0:_.code)==="NOT_FOUND"&&u&&(E(),c(`/p/${u}`))},[_,u,E,c]),!C||C.id!==u?o.jsx(k0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Hb,{projectId:u,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(EA,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:s})})]})}function zA(){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(MA,{onComplete:r})})}function HA(){const{connectionStatus:e}=VS(),r=At(R=>R.fetchConfig),i=At(R=>R.refreshProviderModels),s=en(R=>R.getSetting),l=At(R=>R.providers),u=At(R=>R.activeProviderId),[,f]=ur(),c=xf(),[d,p]=P.useState(!1);P.useEffect(()=>{(e==="connected"||c)&&r().then(()=>{p(!0);for(const R of NS)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},[v,_]=P.useState(g),[E,C]=P.useState(m),[y,x]=P.useState(!1),[b,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?y:v,D=j?b:E,T=()=>{j?x(!y):_(!v)},B=()=>{j?S(!b):C(!E)};P.useEffect(()=>{j||localStorage.setItem("openfox:leftSidebar",String(v))},[v,j]),P.useEffect(()=>{j||localStorage.setItem("openfox:rightSidebar",String(E))},[E,j]),P.useEffect(()=>{(e==="connected"||c)&&r()},[e,r,c]);const H=ke(R=>R.showPasswordModal),W=ke(R=>R.passwordModalRetry),K=ke(R=>R.submitPassword),q=ke(R=>R.cancelPassword);return e!=="connected"&&!H&&!c?o.jsxs(o.Fragment,{children:[o.jsx(ub,{isOpen:!0,isRetry:W,onSubmit:K,onCancel:q}),o.jsx("div",{className:"h-screen flex items-center justify-center",children:o.jsx(Aw,{text:"Connecting to server..."})})]}):o.jsxs(o.Fragment,{children:[o.jsx(ub,{isOpen:H,isRetry:W,onSubmit:K,onCancel:q}),o.jsxs("div",{className:"h-screen flex flex-col",children:[o.jsx(kw,{}),o.jsx(yw,{onMenuClick:T,onCriteriaToggle:B}),o.jsx("div",{className:"flex-1 flex overflow-hidden",children:o.jsxs(vS,{children:[o.jsx(La,{path:"/onboarding",children:o.jsx(zA,{})}),o.jsx(La,{path:"/p/:projectId/s/:sessionId",children:o.jsx(BA,{sidebarOpen:N,onSidebarToggle:T,rightSidebarOpen:D,onRightSidebarToggle:B})}),o.jsx(La,{path:"/p/:projectId/new",children:o.jsx(Rw,{})}),o.jsx(La,{path:"/p/:projectId",children:o.jsx(IA,{sidebarOpen:N,onSidebarToggle:T})}),o.jsx(La,{path:"/",children:o.jsx(Lw,{})})]})})]})]})}X1.createRoot(document.getElementById("root")).render(o.jsx(dn.StrictMode,{children:o.jsx(HA,{})}));