openfox 1.4.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{auto-compaction-C7URGBG3.js → auto-compaction-MNK2FZ6E.js} +2 -2
- package/dist/{chat-handler-BUCN7QJG.js → chat-handler-Y7KR2RLL.js} +4 -4
- package/dist/{chunk-NJ24TM3O.js → chunk-6PV24MJB.js} +6 -6
- package/dist/{chunk-7POE2HLF.js → chunk-F7PUG5WA.js} +2 -2
- package/dist/{chunk-G5U2OBHQ.js → chunk-GXVA5W7Q.js} +5 -21
- package/dist/{chunk-UZ6LHPX7.js → chunk-ICPQDI4L.js} +3 -3
- package/dist/{chunk-JVAYCY76.js → chunk-LJRH7ICU.js} +2 -2
- package/dist/{chunk-TXTPA76S.js → chunk-PJRARONG.js} +26 -5
- package/dist/{chunk-M6HB2O3B.js → chunk-UBWZDTZ4.js} +19 -19
- package/dist/{chunk-L46YMTF2.js → chunk-UNCPQRFP.js} +12 -6
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{config-ONC2MTDE.js → config-NITYYKDA.js} +4 -4
- package/dist/{orchestrator-L3MBTPG2.js → orchestrator-QGFC5QB6.js} +3 -3
- package/dist/package.json +1 -1
- package/dist/{processor-77Z5BZPK.js → processor-BFTXIEDV.js} +2 -2
- package/dist/{protocol-BZ6OIASP.d.ts → protocol-CLWtTnMd.d.ts} +3 -1
- package/dist/{provider-K4HAXILY.js → provider-ES2JTHXK.js} +6 -6
- package/dist/{serve-6QG3HSOL.js → serve-JJLKBQXS.js} +9 -9
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +6 -6
- package/dist/shared/index.d.ts +2 -2
- package/dist/{tools-G6PT5NJO.js → tools-MY4TPRP4.js} +2 -2
- package/dist/{vision-fallback-P7WM3UGQ.js → vision-fallback-KM6LRAXF.js} +2 -2
- package/dist/web/assets/{index-BBtTirUQ.css → index-BnJ4NNAw.css} +1 -1
- package/dist/web/assets/index-xs6xUYKs.js +142 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-D8PVAl5p.js +0 -142
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
var Q_=Object.defineProperty;var J_=(e,r,i)=>r in e?Q_(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i;var kr=(e,r,i)=>J_(e,typeof r!="symbol"?r+"":r,i);function e1(e,r){for(var i=0;i<r.length;i++){const s=r[i];if(typeof s!="string"&&!Array.isArray(s)){for(const c in s)if(c!=="default"&&!(c in e)){const d=Object.getOwnPropertyDescriptor(s,c);d&&Object.defineProperty(e,c,d.get?d:{enumerable:!0,get:()=>s[c]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))s(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const p of d.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&s(p)}).observe(document,{childList:!0,subtree:!0});function i(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function s(c){if(c.ep)return;c.ep=!0;const d=i(c);fetch(c.href,d)}})();function Dl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var id={exports:{}},wa={};/**
|
|
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 Vg;function t1(){if(Vg)return wa;Vg=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(s,c,d){var p=null;if(d!==void 0&&(p=""+d),c.key!==void 0&&(p=""+c.key),"key"in c){d={};for(var l in c)l!=="key"&&(d[l]=c[l])}else d=c;return c=d.ref,{$$typeof:e,type:s,key:p,ref:c!==void 0?c:null,props:d}}return wa.Fragment=r,wa.jsx=i,wa.jsxs=i,wa}var Yg;function n1(){return Yg||(Yg=1,id.exports=t1()),id.exports}var o=n1(),sd={exports:{}},Pe={};/**
|
|
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 Kg;function r1(){if(Kg)return Pe;Kg=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),p=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),b=Symbol.iterator;function S(O){return O===null||typeof O!="object"?null:(O=b&&O[b]||O["@@iterator"],typeof O=="function"?O:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,x={};function _(O,q,F){this.props=O,this.context=q,this.refs=x,this.updater=F||E}_.prototype.isReactComponent={},_.prototype.setState=function(O,q){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,q,"setState")},_.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function v(){}v.prototype=_.prototype;function y(O,q,F){this.props=O,this.context=q,this.refs=x,this.updater=F||E}var j=y.prototype=new v;j.constructor=y,C(j,_.prototype),j.isPureReactComponent=!0;var A=Array.isArray;function N(){}var L={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function B(O,q,F){var K=F.ref;return{$$typeof:e,type:O,key:q,ref:K!==void 0?K:null,props:F}}function H(O,q){return B(O.type,q,O.props)}function W(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function Y(O){var q={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(F){return q[F]})}var $=/\/+/g;function I(O,q){return typeof O=="object"&&O!==null&&O.key!=null?Y(""+O.key):q.toString(36)}function P(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(N,N):(O.status="pending",O.then(function(q){O.status==="pending"&&(O.status="fulfilled",O.value=q)},function(q){O.status==="pending"&&(O.status="rejected",O.reason=q)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function V(O,q,F,K,te){var Q=typeof O;(Q==="undefined"||Q==="boolean")&&(O=null);var X=!1;if(O===null)X=!0;else switch(Q){case"bigint":case"string":case"number":X=!0;break;case"object":switch(O.$$typeof){case e:case r:X=!0;break;case g:return X=O._init,V(X(O._payload),q,F,K,te)}}if(X)return te=te(O),X=K===""?"."+I(O,0):K,A(te)?(F="",X!=null&&(F=X.replace($,"$&/")+"/"),V(te,q,F,"",function(se){return se})):te!=null&&(W(te)&&(te=H(te,F+(te.key==null||O&&O.key===te.key?"":(""+te.key).replace($,"$&/")+"/")+X)),q.push(te)),1;X=0;var z=K===""?".":K+":";if(A(O))for(var ae=0;ae<O.length;ae++)K=O[ae],Q=z+I(K,ae),X+=V(K,q,F,Q,te);else if(ae=S(O),typeof ae=="function")for(O=ae.call(O),ae=0;!(K=O.next()).done;)K=K.value,Q=z+I(K,ae++),X+=V(K,q,F,Q,te);else if(Q==="object"){if(typeof O.then=="function")return V(P(O),q,F,K,te);throw q=String(O),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return X}function Z(O,q,F){if(O==null)return O;var K=[],te=0;return V(O,K,"","",function(Q){return q.call(F,Q,te++)}),K}function ee(O){if(O._status===-1){var q=O._result;q=q(),q.then(function(F){(O._status===0||O._status===-1)&&(O._status=1,O._result=F)},function(F){(O._status===0||O._status===-1)&&(O._status=2,O._result=F)}),O._status===-1&&(O._status=0,O._result=q)}if(O._status===1)return O._result.default;throw O._result}var R=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},D={map:Z,forEach:function(O,q,F){Z(O,function(){q.apply(this,arguments)},F)},count:function(O){var q=0;return Z(O,function(){q++}),q},toArray:function(O){return Z(O,function(q){return q})||[]},only:function(O){if(!W(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return Pe.Activity=m,Pe.Children=D,Pe.Component=_,Pe.Fragment=i,Pe.Profiler=c,Pe.PureComponent=y,Pe.StrictMode=s,Pe.Suspense=h,Pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Pe.__COMPILER_RUNTIME={__proto__:null,c:function(O){return L.H.useMemoCache(O)}},Pe.cache=function(O){return function(){return O.apply(null,arguments)}},Pe.cacheSignal=function(){return null},Pe.cloneElement=function(O,q,F){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var K=C({},O.props),te=O.key;if(q!=null)for(Q in q.key!==void 0&&(te=""+q.key),q)!T.call(q,Q)||Q==="key"||Q==="__self"||Q==="__source"||Q==="ref"&&q.ref===void 0||(K[Q]=q[Q]);var Q=arguments.length-2;if(Q===1)K.children=F;else if(1<Q){for(var X=Array(Q),z=0;z<Q;z++)X[z]=arguments[z+2];K.children=X}return B(O.type,te,K)},Pe.createContext=function(O){return O={$$typeof:p,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:d,_context:O},O},Pe.createElement=function(O,q,F){var K,te={},Q=null;if(q!=null)for(K in q.key!==void 0&&(Q=""+q.key),q)T.call(q,K)&&K!=="key"&&K!=="__self"&&K!=="__source"&&(te[K]=q[K]);var X=arguments.length-2;if(X===1)te.children=F;else if(1<X){for(var z=Array(X),ae=0;ae<X;ae++)z[ae]=arguments[ae+2];te.children=z}if(O&&O.defaultProps)for(K in X=O.defaultProps,X)te[K]===void 0&&(te[K]=X[K]);return B(O,Q,te)},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(O){return{$$typeof:l,render:O}},Pe.isValidElement=W,Pe.lazy=function(O){return{$$typeof:g,_payload:{_status:-1,_result:O},_init:ee}},Pe.memo=function(O,q){return{$$typeof:f,type:O,compare:q===void 0?null:q}},Pe.startTransition=function(O){var q=L.T,F={};L.T=F;try{var K=O(),te=L.S;te!==null&&te(F,K),typeof K=="object"&&K!==null&&typeof K.then=="function"&&K.then(N,R)}catch(Q){R(Q)}finally{q!==null&&F.types!==null&&(q.types=F.types),L.T=q}},Pe.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Pe.use=function(O){return L.H.use(O)},Pe.useActionState=function(O,q,F){return L.H.useActionState(O,q,F)},Pe.useCallback=function(O,q){return L.H.useCallback(O,q)},Pe.useContext=function(O){return L.H.useContext(O)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(O,q){return L.H.useDeferredValue(O,q)},Pe.useEffect=function(O,q){return L.H.useEffect(O,q)},Pe.useEffectEvent=function(O){return L.H.useEffectEvent(O)},Pe.useId=function(){return L.H.useId()},Pe.useImperativeHandle=function(O,q,F){return L.H.useImperativeHandle(O,q,F)},Pe.useInsertionEffect=function(O,q){return L.H.useInsertionEffect(O,q)},Pe.useLayoutEffect=function(O,q){return L.H.useLayoutEffect(O,q)},Pe.useMemo=function(O,q){return L.H.useMemo(O,q)},Pe.useOptimistic=function(O,q){return L.H.useOptimistic(O,q)},Pe.useReducer=function(O,q,F){return L.H.useReducer(O,q,F)},Pe.useRef=function(O){return L.H.useRef(O)},Pe.useState=function(O){return L.H.useState(O)},Pe.useSyncExternalStore=function(O,q,F){return L.H.useSyncExternalStore(O,q,F)},Pe.useTransition=function(){return L.H.useTransition()},Pe.version="19.2.4",Pe}var Xg;function Ll(){return Xg||(Xg=1,sd.exports=r1()),sd.exports}var U=Ll();const ln=Dl(U),i1=e1({__proto__:null,default:ln},[U]);var ad={exports:{}},Ca={},od={exports:{}},ld={};/**
|
|
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 Zg;function s1(){return Zg||(Zg=1,(function(e){function r(V,Z){var ee=V.length;V.push(Z);e:for(;0<ee;){var R=ee-1>>>1,D=V[R];if(0<c(D,Z))V[R]=Z,V[ee]=D,ee=R;else break e}}function i(V){return V.length===0?null:V[0]}function s(V){if(V.length===0)return null;var Z=V[0],ee=V.pop();if(ee!==Z){V[0]=ee;e:for(var R=0,D=V.length,O=D>>>1;R<O;){var q=2*(R+1)-1,F=V[q],K=q+1,te=V[K];if(0>c(F,ee))K<D&&0>c(te,F)?(V[R]=te,V[K]=ee,R=K):(V[R]=F,V[q]=ee,R=q);else if(K<D&&0>c(te,ee))V[R]=te,V[K]=ee,R=K;else break e}}return Z}function c(V,Z){var ee=V.sortIndex-Z.sortIndex;return ee!==0?ee:V.id-Z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;e.unstable_now=function(){return d.now()}}else{var p=Date,l=p.now();e.unstable_now=function(){return p.now()-l}}var h=[],f=[],g=1,m=null,b=3,S=!1,E=!1,C=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function j(V){for(var Z=i(f);Z!==null;){if(Z.callback===null)s(f);else if(Z.startTime<=V)s(f),Z.sortIndex=Z.expirationTime,r(h,Z);else break;Z=i(f)}}function A(V){if(C=!1,j(V),!E)if(i(h)!==null)E=!0,N||(N=!0,Y());else{var Z=i(f);Z!==null&&P(A,Z.startTime-V)}}var N=!1,L=-1,T=5,B=-1;function H(){return x?!0:!(e.unstable_now()-B<T)}function W(){if(x=!1,N){var V=e.unstable_now();B=V;var Z=!0;try{e:{E=!1,C&&(C=!1,v(L),L=-1),S=!0;var ee=b;try{t:{for(j(V),m=i(h);m!==null&&!(m.expirationTime>V&&H());){var R=m.callback;if(typeof R=="function"){m.callback=null,b=m.priorityLevel;var D=R(m.expirationTime<=V);if(V=e.unstable_now(),typeof D=="function"){m.callback=D,j(V),Z=!0;break t}m===i(h)&&s(h),j(V)}else s(h);m=i(h)}if(m!==null)Z=!0;else{var O=i(f);O!==null&&P(A,O.startTime-V),Z=!1}}break e}finally{m=null,b=ee,S=!1}Z=void 0}}finally{Z?Y():N=!1}}}var Y;if(typeof y=="function")Y=function(){y(W)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,I=$.port2;$.port1.onmessage=W,Y=function(){I.postMessage(null)}}else Y=function(){_(W,0)};function P(V,Z){L=_(function(){V(e.unstable_now())},Z)}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(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(V){switch(b){case 1:case 2:case 3:var Z=3;break;default:Z=b}var ee=b;b=Z;try{return V()}finally{b=ee}},e.unstable_requestPaint=function(){x=!0},e.unstable_runWithPriority=function(V,Z){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var ee=b;b=V;try{return Z()}finally{b=ee}},e.unstable_scheduleCallback=function(V,Z,ee){var R=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?R+ee:R):ee=R,V){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=ee+D,V={id:g++,callback:Z,priorityLevel:V,startTime:ee,expirationTime:D,sortIndex:-1},ee>R?(V.sortIndex=ee,r(f,V),i(h)===null&&V===i(f)&&(C?(v(L),L=-1):C=!0,P(A,ee-R))):(V.sortIndex=D,r(h,V),E||S||(E=!0,N||(N=!0,Y()))),V},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(V){var Z=b;return function(){var ee=b;b=Z;try{return V.apply(this,arguments)}finally{b=ee}}}})(ld)),ld}var Qg;function a1(){return Qg||(Qg=1,od.exports=s1()),od.exports}var cd={exports:{}},tn={};/**
|
|
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 Jg;function o1(){if(Jg)return tn;Jg=1;var e=Ll();function r(h){var f="https://react.dev/errors/"+h;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)f+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+h+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var s={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},c=Symbol.for("react.portal");function d(h,f,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:m==null?null:""+m,children:h,containerInfo:f,implementation:g}}var p=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(h,f){if(h==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return tn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,tn.createPortal=function(h,f){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(r(299));return d(h,f,null,g)},tn.flushSync=function(h){var f=p.T,g=s.p;try{if(p.T=null,s.p=2,h)return h()}finally{p.T=f,s.p=g,s.d.f()}},tn.preconnect=function(h,f){typeof h=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,s.d.C(h,f))},tn.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},tn.preinit=function(h,f){if(typeof h=="string"&&f&&typeof f.as=="string"){var g=f.as,m=l(g,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,S=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;g==="style"?s.d.S(h,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:b,fetchPriority:S}):g==="script"&&s.d.X(h,{crossOrigin:m,integrity:b,fetchPriority:S,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},tn.preinitModule=function(h,f){if(typeof h=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var g=l(f.as,f.crossOrigin);s.d.M(h,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&s.d.M(h)},tn.preload=function(h,f){if(typeof h=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var g=f.as,m=l(g,f.crossOrigin);s.d.L(h,g,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},tn.preloadModule=function(h,f){if(typeof h=="string")if(f){var g=l(f.as,f.crossOrigin);s.d.m(h,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else s.d.m(h)},tn.requestFormReset=function(h){s.d.r(h)},tn.unstable_batchedUpdates=function(h,f){return h(f)},tn.useFormState=function(h,f,g){return p.H.useFormState(h,f,g)},tn.useFormStatus=function(){return p.H.useHostTransitionStatus()},tn.version="19.2.4",tn}var ex;function Gv(){if(ex)return cd.exports;ex=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),cd.exports=o1(),cd.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 tx;function l1(){if(tx)return Ca;tx=1;var e=a1(),r=Ll(),i=Gv();function s(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function d(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 p(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function l(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function h(t){if(d(t)!==t)throw Error(s(188))}function f(t){var n=t.alternate;if(!n){if(n=d(t),n===null)throw Error(s(188));return n!==t?null:t}for(var a=t,u=n;;){var w=a.return;if(w===null)break;var k=w.alternate;if(k===null){if(u=w.return,u!==null){a=u;continue}break}if(w.child===k.child){for(k=w.child;k;){if(k===a)return h(w),t;if(k===u)return h(w),n;k=k.sibling}throw Error(s(188))}if(a.return!==u.return)a=w,u=k;else{for(var M=!1,G=w.child;G;){if(G===a){M=!0,a=w,u=k;break}if(G===u){M=!0,u=w,a=k;break}G=G.sibling}if(!M){for(G=k.child;G;){if(G===a){M=!0,a=k,u=w;break}if(G===u){M=!0,u=k,a=w;break}G=G.sibling}if(!M)throw Error(s(189))}}if(a.alternate!==u)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?t:n}function g(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=g(t),n!==null)return n;t=t.sibling}return null}var m=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),y=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),L=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 Y(t){return t===null||typeof t!="object"?null:(t=W&&t[W]||t["@@iterator"],typeof t=="function"?t:null)}var $=Symbol.for("react.client.reference");function I(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===$?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case _:return"Profiler";case x: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 y:return t.displayName||"Context";case v:return(t._context.displayName||"Context")+".Consumer";case j:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case L:return n=t.displayName||null,n!==null?n:I(t.type)||"Memo";case T:n=t._payload,t=t._init;try{return I(t(n))}catch{}}return null}var P=Array.isArray,V=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},R=[],D=-1;function O(t){return{current:t}}function q(t){0>D||(t.current=R[D],R[D]=null,D--)}function F(t,n){D++,R[D]=t.current,t.current=n}var K=O(null),te=O(null),Q=O(null),X=O(null);function z(t,n){switch(F(Q,n),F(te,t),F(K,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?gg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=gg(n),t=xg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}q(K),F(K,t)}function ae(){q(K),q(te),q(Q)}function se(t){t.memoizedState!==null&&F(X,t);var n=K.current,a=xg(n,t.type);n!==a&&(F(te,t),F(K,a))}function ge(t){te.current===t&&(q(K),q(te)),X.current===t&&(q(X),ba._currentValue=ee)}var ve,Ne;function De(t){if(ve===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);ve=n&&n[1]||"",Ne=-1<a.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+ve+t+Ne}var Oe=!1;function Fe(t,n){if(!t||Oe)return"";Oe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={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(ue){var ce=ue}Reflect.construct(t,[],xe)}else{try{xe.call()}catch(ue){ce=ue}t.call(xe.prototype)}}else{try{throw Error()}catch(ue){ce=ue}(xe=t())&&typeof xe.catch=="function"&&xe.catch(function(){})}}catch(ue){if(ue&&ce&&typeof ue.stack=="string")return[ue.stack,ce.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=u.DetermineComponentFrameRoot(),M=k[0],G=k[1];if(M&&G){var J=M.split(`
|
|
44
|
-
`),le=G.split(`
|
|
45
|
-
`);for(w=u=0;u<J.length&&!J[u].includes("DetermineComponentFrameRoot");)u++;for(;w<le.length&&!le[w].includes("DetermineComponentFrameRoot");)w++;if(u===J.length||w===le.length)for(u=J.length-1,w=le.length-1;1<=u&&0<=w&&J[u]!==le[w];)w--;for(;1<=u&&0<=w;u--,w--)if(J[u]!==le[w]){if(u!==1||w!==1)do if(u--,w--,0>w||J[u]!==le[w]){var he=`
|
|
46
|
-
`+J[u].replace(" at new "," at ");return t.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",t.displayName)),he}while(1<=u&&0<=w);break}}}finally{Oe=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?De(a):""}function ke(t,n){switch(t.tag){case 26:case 27:case 5:return De(t.type);case 16:return De("Lazy");case 13:return t.child!==n&&n!==null?De("Suspense Fallback"):De("Suspense");case 19:return De("SuspenseList");case 0:case 15:return Fe(t.type,!1);case 11:return Fe(t.type.render,!1);case 1:return Fe(t.type,!0);case 31:return De("Activity");default:return""}}function lt(t){try{var n="",a=null;do n+=ke(t,a),a=t,t=t.return;while(t);return n}catch(u){return`
|
|
47
|
-
Error generating stack: `+u.message+`
|
|
48
|
-
`+u.stack}}var ht=Object.prototype.hasOwnProperty,fe=e.unstable_scheduleCallback,Re=e.unstable_cancelCallback,Je=e.unstable_shouldYield,et=e.unstable_requestPaint,Ge=e.unstable_now,ct=e.unstable_getCurrentPriorityLevel,de=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,re=e.unstable_NormalPriority,Se=e.unstable_LowPriority,Ce=e.unstable_IdlePriority,He=e.log,Ae=e.unstable_setDisableYieldValue,st=null,it=null;function Ct(t){if(typeof He=="function"&&Ae(t),it&&typeof it.setStrictMode=="function")try{it.setStrictMode(st,t)}catch{}}var $e=Math.clz32?Math.clz32:we,Ln=Math.log,pe=Math.LN2;function we(t){return t>>>=0,t===0?32:31-(Ln(t)/pe|0)|0}var ze=256,Ve=262144,tt=4194304;function Be(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 Lt(t,n,a){var u=t.pendingLanes;if(u===0)return 0;var w=0,k=t.suspendedLanes,M=t.pingedLanes;t=t.warmLanes;var G=u&134217727;return G!==0?(u=G&~k,u!==0?w=Be(u):(M&=G,M!==0?w=Be(M):a||(a=G&~t,a!==0&&(w=Be(a))))):(G=u&~k,G!==0?w=Be(G):M!==0?w=Be(M):a||(a=u&~t,a!==0&&(w=Be(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 Et(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Yt(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Gl(){var t=tt;return tt<<=1,(tt&62914560)===0&&(tt=4194304),t}function Ls(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function Rs(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function P0(t,n,a,u,w,k){var M=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var G=t.entanglements,J=t.expirationTimes,le=t.hiddenUpdates;for(a=M&~a;0<a;){var he=31-$e(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 ue=ce[he];ue!==null&&(ue.lane&=-536870913)}a&=~xe}u!==0&&Zh(t,u,0),k!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=k&~(M&~n))}function Zh(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var u=31-$e(n);t.entangledLanes|=n,t.entanglements[u]=t.entanglements[u]|1073741824|a&261930}function Qh(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var u=31-$e(a),w=1<<u;w&n|t[u]&n&&(t[u]|=n),a&=~w}}function Jh(t,n){var a=n&-n;return a=(a&42)!==0?1:Vl(a),(a&(t.suspendedLanes|n))!==0?0:a}function Vl(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 Yl(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function ef(){var t=Z.p;return t!==0?t:(t=window.event,t===void 0?32:Pg(t.type))}function tf(t,n){var a=Z.p;try{return Z.p=t,n()}finally{Z.p=a}}var Tr=Math.random().toString(36).slice(2),Kt="__reactFiber$"+Tr,dn="__reactProps$"+Tr,Ri="__reactContainer$"+Tr,Kl="__reactEvents$"+Tr,F0="__reactListeners$"+Tr,U0="__reactHandles$"+Tr,nf="__reactResources$"+Tr,Ms="__reactMarker$"+Tr;function Xl(t){delete t[Kt],delete t[dn],delete t[Kl],delete t[F0],delete t[U0]}function Mi(t){var n=t[Kt];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Ri]||a[Kt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=Cg(t);t!==null;){if(a=t[Kt])return a;t=Cg(t)}return n}t=a,a=t.parentNode}return null}function Oi(t){if(t=t[Kt]||t[Ri]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Os(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function Bi(t){var n=t[nf];return n||(n=t[nf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function qt(t){t[Ms]=!0}var rf=new Set,sf={};function si(t,n){Ii(t,n),Ii(t+"Capture",n)}function Ii(t,n){for(sf[t]=n,t=0;t<n.length;t++)rf.add(n[t])}var $0=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]*$"),af={},of={};function q0(t){return ht.call(of,t)?!0:ht.call(af,t)?!1:$0.test(t)?of[t]=!0:(af[t]=!0,!1)}function Za(t,n,a){if(q0(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var u=n.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function Qa(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 or(t,n,a,u){if(u===null)t.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+u)}}function Rn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function lf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function W0(t,n,a){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var w=u.get,k=u.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return w.call(this)},set:function(M){a=""+M,k.call(this,M)}}),Object.defineProperty(t,n,{enumerable:u.enumerable}),{getValue:function(){return a},setValue:function(M){a=""+M},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Zl(t){if(!t._valueTracker){var n=lf(t)?"checked":"value";t._valueTracker=W0(t,n,""+t[n])}}function cf(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),u="";return t&&(u=lf(t)?t.checked?"true":"false":t.value),t=u,t!==a?(n.setValue(t),!0):!1}function Ja(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 G0=/[\n"\\]/g;function Mn(t){return t.replace(G0,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Ql(t,n,a,u,w,k,M,G){t.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?t.type=M:t.removeAttribute("type"),n!=null?M==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Rn(n)):t.value!==""+Rn(n)&&(t.value=""+Rn(n)):M!=="submit"&&M!=="reset"||t.removeAttribute("value"),n!=null?Jl(t,M,Rn(n)):a!=null?Jl(t,M,Rn(a)):u!=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=""+Rn(G):t.removeAttribute("name")}function uf(t,n,a,u,w,k,M,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)){Zl(t);return}a=a!=null?""+Rn(a):"",n=n!=null?""+Rn(n):a,G||n===t.value||(t.value=n),t.defaultValue=n}u=u??w,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=G?t.checked:!!u,t.defaultChecked=!!u,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(t.name=M),Zl(t)}function Jl(t,n,a){n==="number"&&Ja(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function zi(t,n,a,u){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&&u&&(t[a].defaultSelected=!0)}else{for(a=""+Rn(a),n=null,w=0;w<t.length;w++){if(t[w].value===a){t[w].selected=!0,u&&(t[w].defaultSelected=!0);return}n!==null||t[w].disabled||(n=t[w])}n!==null&&(n.selected=!0)}}function df(t,n,a){if(n!=null&&(n=""+Rn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+Rn(a):""}function hf(t,n,a,u){if(n==null){if(u!=null){if(a!=null)throw Error(s(92));if(P(u)){if(1<u.length)throw Error(s(93));u=u[0]}a=u}a==null&&(a=""),n=a}a=Rn(n),t.defaultValue=a,u=t.textContent,u===a&&u!==""&&u!==null&&(t.value=u),Zl(t)}function Hi(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var V0=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 ff(t,n,a){var u=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?u?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":u?t.setProperty(n,a):typeof a!="number"||a===0||V0.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function pf(t,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(t=t.style,a!=null){for(var u in a)!a.hasOwnProperty(u)||n!=null&&n.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var w in n)u=n[w],n.hasOwnProperty(w)&&a[w]!==u&&ff(t,w,u)}else for(var k in n)n.hasOwnProperty(k)&&ff(t,k,n[k])}function ec(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Y0=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"]]),K0=/^[\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 eo(t){return K0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function lr(){}var tc=null;function nc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Pi=null,Fi=null;function mf(t){var n=Oi(t);if(n&&(t=n.stateNode)){var a=t[dn]||null;e:switch(t=n.stateNode,n.type){case"input":if(Ql(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="'+Mn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var u=a[n];if(u!==t&&u.form===t.form){var w=u[dn]||null;if(!w)throw Error(s(90));Ql(u,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(n=0;n<a.length;n++)u=a[n],u.form===t.form&&cf(u)}break e;case"textarea":df(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&zi(t,!!a.multiple,n,!1)}}}var rc=!1;function gf(t,n,a){if(rc)return t(n,a);rc=!0;try{var u=t(n);return u}finally{if(rc=!1,(Pi!==null||Fi!==null)&&(Uo(),Pi&&(n=Pi,t=Fi,Fi=Pi=null,mf(n),t)))for(n=0;n<t.length;n++)mf(t[n])}}function Bs(t,n){var a=t.stateNode;if(a===null)return null;var u=a[dn]||null;if(u===null)return null;a=u[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":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var cr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ic=!1;if(cr)try{var Is={};Object.defineProperty(Is,"passive",{get:function(){ic=!0}}),window.addEventListener("test",Is,Is),window.removeEventListener("test",Is,Is)}catch{ic=!1}var Ar=null,sc=null,to=null;function xf(){if(to)return to;var t,n=sc,a=n.length,u,w="value"in Ar?Ar.value:Ar.textContent,k=w.length;for(t=0;t<a&&n[t]===w[t];t++);var M=a-t;for(u=1;u<=M&&n[a-u]===w[k-u];u++);return to=w.slice(t,1<u?1-u:void 0)}function no(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 ro(){return!0}function vf(){return!1}function hn(t){function n(a,u,w,k,M){this._reactName=a,this._targetInst=w,this.type=u,this.nativeEvent=k,this.target=M,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)?ro:vf,this.isPropagationStopped=vf,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=ro)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ro)},persist:function(){},isPersistent:ro}),n}var ai={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},io=hn(ai),zs=m({},ai,{view:0,detail:0}),X0=hn(zs),ac,oc,Hs,so=m({},zs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:cc,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!==Hs&&(Hs&&t.type==="mousemove"?(ac=t.screenX-Hs.screenX,oc=t.screenY-Hs.screenY):oc=ac=0,Hs=t),ac)},movementY:function(t){return"movementY"in t?t.movementY:oc}}),bf=hn(so),Z0=m({},so,{dataTransfer:0}),Q0=hn(Z0),J0=m({},zs,{relatedTarget:0}),lc=hn(J0),ey=m({},ai,{animationName:0,elapsedTime:0,pseudoElement:0}),ty=hn(ey),ny=m({},ai,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),ry=hn(ny),iy=m({},ai,{data:0}),yf=hn(iy),sy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ay={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"},oy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ly(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=oy[t])?!!n[t]:!1}function cc(){return ly}var cy=m({},zs,{key:function(t){if(t.key){var n=sy[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=no(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?ay[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:cc,charCode:function(t){return t.type==="keypress"?no(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?no(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),uy=hn(cy),dy=m({},so,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_f=hn(dy),hy=m({},zs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:cc}),fy=hn(hy),py=m({},ai,{propertyName:0,elapsedTime:0,pseudoElement:0}),my=hn(py),gy=m({},so,{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}),xy=hn(gy),vy=m({},ai,{newState:0,oldState:0}),by=hn(vy),yy=[9,13,27,32],uc=cr&&"CompositionEvent"in window,Ps=null;cr&&"documentMode"in document&&(Ps=document.documentMode);var _y=cr&&"TextEvent"in window&&!Ps,Sf=cr&&(!uc||Ps&&8<Ps&&11>=Ps),wf=" ",Cf=!1;function kf(t,n){switch(t){case"keyup":return yy.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ef(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ui=!1;function Sy(t,n){switch(t){case"compositionend":return Ef(n);case"keypress":return n.which!==32?null:(Cf=!0,wf);case"textInput":return t=n.data,t===wf&&Cf?null:t;default:return null}}function wy(t,n){if(Ui)return t==="compositionend"||!uc&&kf(t,n)?(t=xf(),to=sc=Ar=null,Ui=!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 Sf&&n.locale!=="ko"?null:n.data;default:return null}}var Cy={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 jf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!Cy[t.type]:n==="textarea"}function Nf(t,n,a,u){Pi?Fi?Fi.push(u):Fi=[u]:Pi=u,n=Ko(n,"onChange"),0<n.length&&(a=new io("onChange","change",null,a,u),t.push({event:a,listeners:n}))}var Fs=null,Us=null;function ky(t){ug(t,0)}function ao(t){var n=Os(t);if(cf(n))return t}function Tf(t,n){if(t==="change")return n}var Af=!1;if(cr){var dc;if(cr){var hc="oninput"in document;if(!hc){var Df=document.createElement("div");Df.setAttribute("oninput","return;"),hc=typeof Df.oninput=="function"}dc=hc}else dc=!1;Af=dc&&(!document.documentMode||9<document.documentMode)}function Lf(){Fs&&(Fs.detachEvent("onpropertychange",Rf),Us=Fs=null)}function Rf(t){if(t.propertyName==="value"&&ao(Us)){var n=[];Nf(n,Us,t,nc(t)),gf(ky,n)}}function Ey(t,n,a){t==="focusin"?(Lf(),Fs=n,Us=a,Fs.attachEvent("onpropertychange",Rf)):t==="focusout"&&Lf()}function jy(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ao(Us)}function Ny(t,n){if(t==="click")return ao(n)}function Ty(t,n){if(t==="input"||t==="change")return ao(n)}function Ay(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var yn=typeof Object.is=="function"?Object.is:Ay;function $s(t,n){if(yn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),u=Object.keys(n);if(a.length!==u.length)return!1;for(u=0;u<a.length;u++){var w=a[u];if(!ht.call(n,w)||!yn(t[w],n[w]))return!1}return!0}function Mf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Of(t,n){var a=Mf(t);t=0;for(var u;a;){if(a.nodeType===3){if(u=t+a.textContent.length,t<=n&&u>=n)return{node:a,offset:n-t};t=u}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Mf(a)}}function Bf(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Bf(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function If(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=Ja(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=Ja(t.document)}return n}function fc(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 Dy=cr&&"documentMode"in document&&11>=document.documentMode,$i=null,pc=null,qs=null,mc=!1;function zf(t,n,a){var u=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;mc||$i==null||$i!==Ja(u)||(u=$i,"selectionStart"in u&&fc(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),qs&&$s(qs,u)||(qs=u,u=Ko(pc,"onSelect"),0<u.length&&(n=new io("onSelect","select",null,n,a),t.push({event:n,listeners:u}),n.target=$i)))}function oi(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var qi={animationend:oi("Animation","AnimationEnd"),animationiteration:oi("Animation","AnimationIteration"),animationstart:oi("Animation","AnimationStart"),transitionrun:oi("Transition","TransitionRun"),transitionstart:oi("Transition","TransitionStart"),transitioncancel:oi("Transition","TransitionCancel"),transitionend:oi("Transition","TransitionEnd")},gc={},Hf={};cr&&(Hf=document.createElement("div").style,"AnimationEvent"in window||(delete qi.animationend.animation,delete qi.animationiteration.animation,delete qi.animationstart.animation),"TransitionEvent"in window||delete qi.transitionend.transition);function li(t){if(gc[t])return gc[t];if(!qi[t])return t;var n=qi[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in Hf)return gc[t]=n[a];return t}var Pf=li("animationend"),Ff=li("animationiteration"),Uf=li("animationstart"),Ly=li("transitionrun"),Ry=li("transitionstart"),My=li("transitioncancel"),$f=li("transitionend"),qf=new Map,xc="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(" ");xc.push("scrollEnd");function qn(t,n){qf.set(t,n),si(n,[t])}var oo=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)},On=[],Wi=0,vc=0;function lo(){for(var t=Wi,n=vc=Wi=0;n<t;){var a=On[n];On[n++]=null;var u=On[n];On[n++]=null;var w=On[n];On[n++]=null;var k=On[n];if(On[n++]=null,u!==null&&w!==null){var M=u.pending;M===null?w.next=w:(w.next=M.next,M.next=w),u.pending=w}k!==0&&Wf(a,w,k)}}function co(t,n,a,u){On[Wi++]=t,On[Wi++]=n,On[Wi++]=a,On[Wi++]=u,vc|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function bc(t,n,a,u){return co(t,n,a,u),uo(t)}function ci(t,n){return co(t,null,null,n),uo(t)}function Wf(t,n,a){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a);for(var w=!1,k=t.return;k!==null;)k.childLanes|=a,u=k.alternate,u!==null&&(u.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-$e(a),t=k.hiddenUpdates,u=t[w],u===null?t[w]=[n]:u.push(n),n.lane=a|536870912),k):null}function uo(t){if(50<ha)throw ha=0,Nu=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Gi={};function Oy(t,n,a,u){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=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _n(t,n,a,u){return new Oy(t,n,a,u)}function yc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ur(t,n){var a=t.alternate;return a===null?(a=_n(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 Gf(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 ho(t,n,a,u,w,k){var M=0;if(u=t,typeof t=="function")yc(t)&&(M=1);else if(typeof t=="string")M=P_(t,a,K.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case B:return t=_n(31,a,n,w),t.elementType=B,t.lanes=k,t;case C:return ui(a.children,w,k,n);case x:M=8,w|=24;break;case _:return t=_n(12,a,n,w|2),t.elementType=_,t.lanes=k,t;case A:return t=_n(13,a,n,w),t.elementType=A,t.lanes=k,t;case N:return t=_n(19,a,n,w),t.elementType=N,t.lanes=k,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case y:M=10;break e;case v:M=9;break e;case j:M=11;break e;case L:M=14;break e;case T:M=16,u=null;break e}M=29,a=Error(s(130,t===null?"null":typeof t,"")),u=null}return n=_n(M,a,n,w),n.elementType=t,n.type=u,n.lanes=k,n}function ui(t,n,a,u){return t=_n(7,t,u,n),t.lanes=a,t}function _c(t,n,a){return t=_n(6,t,null,n),t.lanes=a,t}function Vf(t){var n=_n(18,null,null,0);return n.stateNode=t,n}function Sc(t,n,a){return n=_n(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var Yf=new WeakMap;function Bn(t,n){if(typeof t=="object"&&t!==null){var a=Yf.get(t);return a!==void 0?a:(n={value:t,source:n,stack:lt(n)},Yf.set(t,n),n)}return{value:t,source:n,stack:lt(n)}}var Vi=[],Yi=0,fo=null,Ws=0,In=[],zn=0,Dr=null,Zn=1,Qn="";function dr(t,n){Vi[Yi++]=Ws,Vi[Yi++]=fo,fo=t,Ws=n}function Kf(t,n,a){In[zn++]=Zn,In[zn++]=Qn,In[zn++]=Dr,Dr=t;var u=Zn;t=Qn;var w=32-$e(u)-1;u&=~(1<<w),a+=1;var k=32-$e(n)+w;if(30<k){var M=w-w%5;k=(u&(1<<M)-1).toString(32),u>>=M,w-=M,Zn=1<<32-$e(n)+w|a<<w|u,Qn=k+t}else Zn=1<<k|a<<w|u,Qn=t}function wc(t){t.return!==null&&(dr(t,1),Kf(t,1,0))}function Cc(t){for(;t===fo;)fo=Vi[--Yi],Vi[Yi]=null,Ws=Vi[--Yi],Vi[Yi]=null;for(;t===Dr;)Dr=In[--zn],In[zn]=null,Qn=In[--zn],In[zn]=null,Zn=In[--zn],In[zn]=null}function Xf(t,n){In[zn++]=Zn,In[zn++]=Qn,In[zn++]=Dr,Zn=n.id,Qn=n.overflow,Dr=t}var Xt=null,St=null,nt=!1,Lr=null,Hn=!1,kc=Error(s(519));function Rr(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gs(Bn(n,t)),kc}function Zf(t){var n=t.stateNode,a=t.type,u=t.memoizedProps;switch(n[Kt]=t,n[dn]=u,a){case"dialog":Ke("cancel",n),Ke("close",n);break;case"iframe":case"object":case"embed":Ke("load",n);break;case"video":case"audio":for(a=0;a<pa.length;a++)Ke(pa[a],n);break;case"source":Ke("error",n);break;case"img":case"image":case"link":Ke("error",n),Ke("load",n);break;case"details":Ke("toggle",n);break;case"input":Ke("invalid",n),uf(n,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Ke("invalid",n);break;case"textarea":Ke("invalid",n),hf(n,u.value,u.defaultValue,u.children)}a=u.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||u.suppressHydrationWarning===!0||pg(n.textContent,a)?(u.popover!=null&&(Ke("beforetoggle",n),Ke("toggle",n)),u.onScroll!=null&&Ke("scroll",n),u.onScrollEnd!=null&&Ke("scrollend",n),u.onClick!=null&&(n.onclick=lr),n=!0):n=!1,n||Rr(t,!0)}function Qf(t){for(Xt=t.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:Hn=!1;return;case 27:case 3:Hn=!0;return;default:Xt=Xt.return}}function Ki(t){if(t!==Xt)return!1;if(!nt)return Qf(t),nt=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||$u(t.type,t.memoizedProps)),a=!a),a&&St&&Rr(t),Qf(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));St=wg(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));St=wg(t)}else n===27?(n=St,Vr(t.type)?(t=Yu,Yu=null,St=t):St=n):St=Xt?Fn(t.stateNode.nextSibling):null;return!0}function di(){St=Xt=null,nt=!1}function Ec(){var t=Lr;return t!==null&&(gn===null?gn=t:gn.push.apply(gn,t),Lr=null),t}function Gs(t){Lr===null?Lr=[t]:Lr.push(t)}var jc=O(null),hi=null,hr=null;function Mr(t,n,a){F(jc,n._currentValue),n._currentValue=a}function fr(t){t._currentValue=jc.current,q(jc)}function Nc(t,n,a){for(;t!==null;){var u=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,u!==null&&(u.childLanes|=n)):u!==null&&(u.childLanes&n)!==n&&(u.childLanes|=n),t===a)break;t=t.return}}function Tc(t,n,a,u){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var k=w.dependencies;if(k!==null){var M=w.child;k=k.firstContext;e:for(;k!==null;){var 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),Nc(k.return,a,t),u||(M=null);break e}k=G.next}}else if(w.tag===18){if(M=w.return,M===null)throw Error(s(341));M.lanes|=a,k=M.alternate,k!==null&&(k.lanes|=a),Nc(M,a,t),M=null}else M=w.child;if(M!==null)M.return=w;else for(M=w;M!==null;){if(M===t){M=null;break}if(w=M.sibling,w!==null){w.return=M.return,M=w;break}M=M.return}w=M}}function Xi(t,n,a,u){t=null;for(var w=n,k=!1;w!==null;){if(!k){if((w.flags&524288)!==0)k=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var M=w.alternate;if(M===null)throw Error(s(387));if(M=M.memoizedProps,M!==null){var G=w.type;yn(w.pendingProps.value,M.value)||(t!==null?t.push(G):t=[G])}}else if(w===X.current){if(M=w.alternate,M===null)throw Error(s(387));M.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(ba):t=[ba])}w=w.return}t!==null&&Tc(n,t,a,u),n.flags|=262144}function po(t){for(t=t.firstContext;t!==null;){if(!yn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function fi(t){hi=t,hr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Zt(t){return Jf(hi,t)}function mo(t,n){return hi===null&&fi(t),Jf(t,n)}function Jf(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},hr===null){if(t===null)throw Error(s(308));hr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else hr=hr.next=n;return a}var By=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,u){t.push(u)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},Iy=e.unstable_scheduleCallback,zy=e.unstable_NormalPriority,Rt={$$typeof:y,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ac(){return{controller:new By,data:new Map,refCount:0}}function Vs(t){t.refCount--,t.refCount===0&&Iy(zy,function(){t.controller.abort()})}var Ys=null,Dc=0,Zi=0,Qi=null;function Hy(t,n){if(Ys===null){var a=Ys=[];Dc=0,Zi=Mu(),Qi={status:"pending",value:void 0,then:function(u){a.push(u)}}}return Dc++,n.then(ep,ep),n}function ep(){if(--Dc===0&&Ys!==null){Qi!==null&&(Qi.status="fulfilled");var t=Ys;Ys=null,Zi=0,Qi=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function Py(t,n){var a=[],u={status:"pending",value:null,reason:null,then:function(w){a.push(w)}};return t.then(function(){u.status="fulfilled",u.value=n;for(var w=0;w<a.length;w++)(0,a[w])(n)},function(w){for(u.status="rejected",u.reason=w,w=0;w<a.length;w++)(0,a[w])(void 0)}),u}var tp=V.S;V.S=function(t,n){zm=Ge(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Hy(t,n),tp!==null&&tp(t,n)};var pi=O(null);function Lc(){var t=pi.current;return t!==null?t:bt.pooledCache}function go(t,n){n===null?F(pi,pi.current):F(pi,n.pool)}function np(){var t=Lc();return t===null?null:{parent:Rt._currentValue,pool:t}}var Ji=Error(s(460)),Rc=Error(s(474)),xo=Error(s(542)),vo={then:function(){}};function rp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function ip(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(lr,lr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,ap(t),t;default:if(typeof n.status=="string")n.then(lr,lr);else{if(t=bt,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=n,t.status="pending",t.then(function(u){if(n.status==="pending"){var w=n;w.status="fulfilled",w.value=u}},function(u){if(n.status==="pending"){var w=n;w.status="rejected",w.reason=u}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,ap(t),t}throw gi=n,Ji}}function mi(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(gi=a,Ji):a}}var gi=null;function sp(){if(gi===null)throw Error(s(459));var t=gi;return gi=null,t}function ap(t){if(t===Ji||t===xo)throw Error(s(483))}var es=null,Ks=0;function bo(t){var n=Ks;return Ks+=1,es===null&&(es=[]),ip(es,t,n)}function Xs(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function yo(t,n){throw n.$$typeof===b?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function op(t){function n(ie,ne){if(t){var oe=ie.deletions;oe===null?(ie.deletions=[ne],ie.flags|=16):oe.push(ne)}}function a(ie,ne){if(!t)return null;for(;ne!==null;)n(ie,ne),ne=ne.sibling;return null}function u(ie){for(var ne=new Map;ie!==null;)ie.key!==null?ne.set(ie.key,ie):ne.set(ie.index,ie),ie=ie.sibling;return ne}function w(ie,ne){return ie=ur(ie,ne),ie.index=0,ie.sibling=null,ie}function k(ie,ne,oe){return ie.index=oe,t?(oe=ie.alternate,oe!==null?(oe=oe.index,oe<ne?(ie.flags|=67108866,ne):oe):(ie.flags|=67108866,ne)):(ie.flags|=1048576,ne)}function M(ie){return t&&ie.alternate===null&&(ie.flags|=67108866),ie}function G(ie,ne,oe,me){return ne===null||ne.tag!==6?(ne=_c(oe,ie.mode,me),ne.return=ie,ne):(ne=w(ne,oe),ne.return=ie,ne)}function J(ie,ne,oe,me){var Le=oe.type;return Le===C?he(ie,ne,oe.props.children,me,oe.key):ne!==null&&(ne.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===T&&mi(Le)===ne.type)?(ne=w(ne,oe.props),Xs(ne,oe),ne.return=ie,ne):(ne=ho(oe.type,oe.key,oe.props,null,ie.mode,me),Xs(ne,oe),ne.return=ie,ne)}function le(ie,ne,oe,me){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==oe.containerInfo||ne.stateNode.implementation!==oe.implementation?(ne=Sc(oe,ie.mode,me),ne.return=ie,ne):(ne=w(ne,oe.children||[]),ne.return=ie,ne)}function he(ie,ne,oe,me,Le){return ne===null||ne.tag!==7?(ne=ui(oe,ie.mode,me,Le),ne.return=ie,ne):(ne=w(ne,oe),ne.return=ie,ne)}function xe(ie,ne,oe){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ne=_c(""+ne,ie.mode,oe),ne.return=ie,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:return oe=ho(ne.type,ne.key,ne.props,null,ie.mode,oe),Xs(oe,ne),oe.return=ie,oe;case E:return ne=Sc(ne,ie.mode,oe),ne.return=ie,ne;case T:return ne=mi(ne),xe(ie,ne,oe)}if(P(ne)||Y(ne))return ne=ui(ne,ie.mode,oe,null),ne.return=ie,ne;if(typeof ne.then=="function")return xe(ie,bo(ne),oe);if(ne.$$typeof===y)return xe(ie,mo(ie,ne),oe);yo(ie,ne)}return null}function ce(ie,ne,oe,me){var Le=ne!==null?ne.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return Le!==null?null:G(ie,ne,""+oe,me);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:return oe.key===Le?J(ie,ne,oe,me):null;case E:return oe.key===Le?le(ie,ne,oe,me):null;case T:return oe=mi(oe),ce(ie,ne,oe,me)}if(P(oe)||Y(oe))return Le!==null?null:he(ie,ne,oe,me,null);if(typeof oe.then=="function")return ce(ie,ne,bo(oe),me);if(oe.$$typeof===y)return ce(ie,ne,mo(ie,oe),me);yo(ie,oe)}return null}function ue(ie,ne,oe,me,Le){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return ie=ie.get(oe)||null,G(ne,ie,""+me,Le);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case S:return ie=ie.get(me.key===null?oe:me.key)||null,J(ne,ie,me,Le);case E:return ie=ie.get(me.key===null?oe:me.key)||null,le(ne,ie,me,Le);case T:return me=mi(me),ue(ie,ne,oe,me,Le)}if(P(me)||Y(me))return ie=ie.get(oe)||null,he(ne,ie,me,Le,null);if(typeof me.then=="function")return ue(ie,ne,oe,bo(me),Le);if(me.$$typeof===y)return ue(ie,ne,oe,mo(ne,me),Le);yo(ne,me)}return null}function je(ie,ne,oe,me){for(var Le=null,at=null,Te=ne,qe=ne=0,Qe=null;Te!==null&&qe<oe.length;qe++){Te.index>qe?(Qe=Te,Te=null):Qe=Te.sibling;var ot=ce(ie,Te,oe[qe],me);if(ot===null){Te===null&&(Te=Qe);break}t&&Te&&ot.alternate===null&&n(ie,Te),ne=k(ot,ne,qe),at===null?Le=ot:at.sibling=ot,at=ot,Te=Qe}if(qe===oe.length)return a(ie,Te),nt&&dr(ie,qe),Le;if(Te===null){for(;qe<oe.length;qe++)Te=xe(ie,oe[qe],me),Te!==null&&(ne=k(Te,ne,qe),at===null?Le=Te:at.sibling=Te,at=Te);return nt&&dr(ie,qe),Le}for(Te=u(Te);qe<oe.length;qe++)Qe=ue(Te,ie,qe,oe[qe],me),Qe!==null&&(t&&Qe.alternate!==null&&Te.delete(Qe.key===null?qe:Qe.key),ne=k(Qe,ne,qe),at===null?Le=Qe:at.sibling=Qe,at=Qe);return t&&Te.forEach(function(Qr){return n(ie,Qr)}),nt&&dr(ie,qe),Le}function Ie(ie,ne,oe,me){if(oe==null)throw Error(s(151));for(var Le=null,at=null,Te=ne,qe=ne=0,Qe=null,ot=oe.next();Te!==null&&!ot.done;qe++,ot=oe.next()){Te.index>qe?(Qe=Te,Te=null):Qe=Te.sibling;var Qr=ce(ie,Te,ot.value,me);if(Qr===null){Te===null&&(Te=Qe);break}t&&Te&&Qr.alternate===null&&n(ie,Te),ne=k(Qr,ne,qe),at===null?Le=Qr:at.sibling=Qr,at=Qr,Te=Qe}if(ot.done)return a(ie,Te),nt&&dr(ie,qe),Le;if(Te===null){for(;!ot.done;qe++,ot=oe.next())ot=xe(ie,ot.value,me),ot!==null&&(ne=k(ot,ne,qe),at===null?Le=ot:at.sibling=ot,at=ot);return nt&&dr(ie,qe),Le}for(Te=u(Te);!ot.done;qe++,ot=oe.next())ot=ue(Te,ie,qe,ot.value,me),ot!==null&&(t&&ot.alternate!==null&&Te.delete(ot.key===null?qe:ot.key),ne=k(ot,ne,qe),at===null?Le=ot:at.sibling=ot,at=ot);return t&&Te.forEach(function(Z_){return n(ie,Z_)}),nt&&dr(ie,qe),Le}function vt(ie,ne,oe,me){if(typeof oe=="object"&&oe!==null&&oe.type===C&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:e:{for(var Le=oe.key;ne!==null;){if(ne.key===Le){if(Le=oe.type,Le===C){if(ne.tag===7){a(ie,ne.sibling),me=w(ne,oe.props.children),me.return=ie,ie=me;break e}}else if(ne.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===T&&mi(Le)===ne.type){a(ie,ne.sibling),me=w(ne,oe.props),Xs(me,oe),me.return=ie,ie=me;break e}a(ie,ne);break}else n(ie,ne);ne=ne.sibling}oe.type===C?(me=ui(oe.props.children,ie.mode,me,oe.key),me.return=ie,ie=me):(me=ho(oe.type,oe.key,oe.props,null,ie.mode,me),Xs(me,oe),me.return=ie,ie=me)}return M(ie);case E:e:{for(Le=oe.key;ne!==null;){if(ne.key===Le)if(ne.tag===4&&ne.stateNode.containerInfo===oe.containerInfo&&ne.stateNode.implementation===oe.implementation){a(ie,ne.sibling),me=w(ne,oe.children||[]),me.return=ie,ie=me;break e}else{a(ie,ne);break}else n(ie,ne);ne=ne.sibling}me=Sc(oe,ie.mode,me),me.return=ie,ie=me}return M(ie);case T:return oe=mi(oe),vt(ie,ne,oe,me)}if(P(oe))return je(ie,ne,oe,me);if(Y(oe)){if(Le=Y(oe),typeof Le!="function")throw Error(s(150));return oe=Le.call(oe),Ie(ie,ne,oe,me)}if(typeof oe.then=="function")return vt(ie,ne,bo(oe),me);if(oe.$$typeof===y)return vt(ie,ne,mo(ie,oe),me);yo(ie,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,ne!==null&&ne.tag===6?(a(ie,ne.sibling),me=w(ne,oe),me.return=ie,ie=me):(a(ie,ne),me=_c(oe,ie.mode,me),me.return=ie,ie=me),M(ie)):a(ie,ne)}return function(ie,ne,oe,me){try{Ks=0;var Le=vt(ie,ne,oe,me);return es=null,Le}catch(Te){if(Te===Ji||Te===xo)throw Te;var at=_n(29,Te,null,ie.mode);return at.lanes=me,at.return=ie,at}finally{}}}var xi=op(!0),lp=op(!1),Or=!1;function Mc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Oc(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 Br(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Ir(t,n,a){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(ut&2)!==0){var w=u.pending;return w===null?n.next=n:(n.next=w.next,w.next=n),u.pending=n,n=uo(t),Wf(t,null,a),n}return co(t,u,n,a),uo(t)}function Zs(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var u=n.lanes;u&=t.pendingLanes,a|=u,n.lanes=a,Qh(t,a)}}function Bc(t,n){var a=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,a===u)){var w=null,k=null;if(a=a.firstBaseUpdate,a!==null){do{var M={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};k===null?w=k=M:k=k.next=M,a=a.next}while(a!==null);k===null?w=k=n:k=k.next=n}else w=k=n;a={baseState:u.baseState,firstBaseUpdate:w,lastBaseUpdate:k,shared:u.shared,callbacks:u.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var Ic=!1;function Qs(){if(Ic){var t=Qi;if(t!==null)throw t}}function Js(t,n,a,u){Ic=!1;var w=t.updateQueue;Or=!1;var k=w.firstBaseUpdate,M=w.lastBaseUpdate,G=w.shared.pending;if(G!==null){w.shared.pending=null;var J=G,le=J.next;J.next=null,M===null?k=le:M.next=le,M=J;var he=t.alternate;he!==null&&(he=he.updateQueue,G=he.lastBaseUpdate,G!==M&&(G===null?he.firstBaseUpdate=le:G.next=le,he.lastBaseUpdate=J))}if(k!==null){var xe=w.baseState;M=0,he=le=J=null,G=k;do{var ce=G.lane&-536870913,ue=ce!==G.lane;if(ue?(Ze&ce)===ce:(u&ce)===ce){ce!==0&&ce===Zi&&(Ic=!0),he!==null&&(he=he.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var je=t,Ie=G;ce=n;var vt=a;switch(Ie.tag){case 1:if(je=Ie.payload,typeof je=="function"){xe=je.call(vt,xe,ce);break e}xe=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Ie.payload,ce=typeof je=="function"?je.call(vt,xe,ce):je,ce==null)break e;xe=m({},xe,ce);break e;case 2:Or=!0}}ce=G.callback,ce!==null&&(t.flags|=64,ue&&(t.flags|=8192),ue=w.callbacks,ue===null?w.callbacks=[ce]:ue.push(ce))}else ue={lane:ce,tag:G.tag,payload:G.payload,callback:G.callback,next:null},he===null?(le=he=ue,J=xe):he=he.next=ue,M|=ce;if(G=G.next,G===null){if(G=w.shared.pending,G===null)break;ue=G,G=ue.next,ue.next=null,w.lastBaseUpdate=ue,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),Ur|=M,t.lanes=M,t.memoizedState=xe}}function cp(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function up(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)cp(a[t],n)}var ts=O(null),_o=O(0);function dp(t,n){t=Sr,F(_o,t),F(ts,n),Sr=t|n.baseLanes}function zc(){F(_o,Sr),F(ts,ts.current)}function Hc(){Sr=_o.current,q(ts),q(_o)}var Sn=O(null),Pn=null;function zr(t){var n=t.alternate;F(Tt,Tt.current&1),F(Sn,t),Pn===null&&(n===null||ts.current!==null||n.memoizedState!==null)&&(Pn=t)}function Pc(t){F(Tt,Tt.current),F(Sn,t),Pn===null&&(Pn=t)}function hp(t){t.tag===22?(F(Tt,Tt.current),F(Sn,t),Pn===null&&(Pn=t)):Hr()}function Hr(){F(Tt,Tt.current),F(Sn,Sn.current)}function wn(t){q(Sn),Pn===t&&(Pn=null),q(Tt)}var Tt=O(0);function So(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Gu(a)||Vu(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 pr=0,Ue=null,gt=null,Mt=null,wo=!1,ns=!1,vi=!1,Co=0,ea=0,rs=null,Fy=0;function jt(){throw Error(s(321))}function Fc(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!yn(t[a],n[a]))return!1;return!0}function Uc(t,n,a,u,w,k){return pr=k,Ue=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,V.H=t===null||t.memoizedState===null?Kp:ru,vi=!1,k=a(u,w),vi=!1,ns&&(k=pp(n,a,u,w)),fp(t),k}function fp(t){V.H=ra;var n=gt!==null&>.next!==null;if(pr=0,Mt=gt=Ue=null,wo=!1,ea=0,rs=null,n)throw Error(s(300));t===null||Ot||(t=t.dependencies,t!==null&&po(t)&&(Ot=!0))}function pp(t,n,a,u){Ue=t;var w=0;do{if(ns&&(rs=null),ea=0,ns=!1,25<=w)throw Error(s(301));if(w+=1,Mt=gt=null,t.updateQueue!=null){var k=t.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}V.H=Xp,k=n(a,u)}while(ns);return k}function Uy(){var t=V.H,n=t.useState()[0];return n=typeof n.then=="function"?ta(n):n,t=t.useState()[0],(gt!==null?gt.memoizedState:null)!==t&&(Ue.flags|=1024),n}function $c(){var t=Co!==0;return Co=0,t}function qc(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function Wc(t){if(wo){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}wo=!1}pr=0,Mt=gt=Ue=null,ns=!1,ea=Co=0,rs=null}function on(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?Ue.memoizedState=Mt=t:Mt=Mt.next=t,Mt}function At(){if(gt===null){var t=Ue.alternate;t=t!==null?t.memoizedState:null}else t=gt.next;var n=Mt===null?Ue.memoizedState:Mt.next;if(n!==null)Mt=n,gt=t;else{if(t===null)throw Ue.alternate===null?Error(s(467)):Error(s(310));gt=t,t={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},Mt===null?Ue.memoizedState=Mt=t:Mt=Mt.next=t}return Mt}function ko(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ta(t){var n=ea;return ea+=1,rs===null&&(rs=[]),t=ip(rs,t,n),n=Ue,(Mt===null?n.memoizedState:Mt.next)===null&&(n=n.alternate,V.H=n===null||n.memoizedState===null?Kp:ru),t}function Eo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ta(t);if(t.$$typeof===y)return Zt(t)}throw Error(s(438,String(t)))}function Gc(t){var n=null,a=Ue.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var u=Ue.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(n={data:u.data.map(function(w){return w.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=ko(),Ue.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),u=0;u<t;u++)a[u]=H;return n.index++,a}function mr(t,n){return typeof n=="function"?n(t):n}function jo(t){var n=At();return Vc(n,gt,t)}function Vc(t,n,a){var u=t.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=a;var w=t.baseQueue,k=u.pending;if(k!==null){if(w!==null){var M=w.next;w.next=k.next,k.next=M}n.baseQueue=w=k,u.pending=null}if(k=t.baseState,w===null)t.memoizedState=k;else{n=w.next;var G=M=null,J=null,le=n,he=!1;do{var xe=le.lane&-536870913;if(xe!==le.lane?(Ze&xe)===xe:(pr&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===Zi&&(he=!0);else if((pr&ce)===ce){le=le.next,ce===Zi&&(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,M=k):J=J.next=xe,Ue.lanes|=ce,Ur|=ce;xe=le.action,vi&&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,M=k):J=J.next=ce,Ue.lanes|=xe,Ur|=xe;le=le.next}while(le!==null&&le!==n);if(J===null?M=k:J.next=G,!yn(k,t.memoizedState)&&(Ot=!0,he&&(a=Qi,a!==null)))throw a;t.memoizedState=k,t.baseState=M,t.baseQueue=J,u.lastRenderedState=k}return w===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function Yc(t){var n=At(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var u=a.dispatch,w=a.pending,k=n.memoizedState;if(w!==null){a.pending=null;var M=w=w.next;do k=t(k,M.action),M=M.next;while(M!==w);yn(k,n.memoizedState)||(Ot=!0),n.memoizedState=k,n.baseQueue===null&&(n.baseState=k),a.lastRenderedState=k}return[k,u]}function mp(t,n,a){var u=Ue,w=At(),k=nt;if(k){if(a===void 0)throw Error(s(407));a=a()}else a=n();var M=!yn((gt||w).memoizedState,a);if(M&&(w.memoizedState=a,Ot=!0),w=w.queue,Zc(vp.bind(null,u,w,t),[t]),w.getSnapshot!==n||M||Mt!==null&&Mt.memoizedState.tag&1){if(u.flags|=2048,is(9,{destroy:void 0},xp.bind(null,u,w,a,n),null),bt===null)throw Error(s(349));k||(pr&127)!==0||gp(u,n,a)}return a}function gp(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=Ue.updateQueue,n===null?(n=ko(),Ue.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function xp(t,n,a,u){n.value=a,n.getSnapshot=u,bp(n)&&yp(t)}function vp(t,n,a){return a(function(){bp(n)&&yp(t)})}function bp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!yn(t,a)}catch{return!0}}function yp(t){var n=ci(t,2);n!==null&&xn(n,t,2)}function Kc(t){var n=on();if(typeof t=="function"){var a=t;if(t=a(),vi){Ct(!0);try{a()}finally{Ct(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:t},n}function _p(t,n,a,u){return t.baseState=a,Vc(t,gt,typeof u=="function"?u:mr)}function $y(t,n,a,u,w){if(Ao(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(M){k.listeners.push(M)}};V.T!==null?a(!0):k.isTransition=!1,u(k),a=n.pending,a===null?(k.next=n.pending=k,Sp(n,k)):(k.next=a.next,n.pending=a.next=k)}}function Sp(t,n){var a=n.action,u=n.payload,w=t.state;if(n.isTransition){var k=V.T,M={};V.T=M;try{var G=a(w,u),J=V.S;J!==null&&J(M,G),wp(t,n,G)}catch(le){Xc(t,n,le)}finally{k!==null&&M.types!==null&&(k.types=M.types),V.T=k}}else try{k=a(w,u),wp(t,n,k)}catch(le){Xc(t,n,le)}}function wp(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(u){Cp(t,n,u)},function(u){return Xc(t,n,u)}):Cp(t,n,a)}function Cp(t,n,a){n.status="fulfilled",n.value=a,kp(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,Sp(t,a)))}function Xc(t,n,a){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do n.status="rejected",n.reason=a,kp(n),n=n.next;while(n!==u)}t.action=null}function kp(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Ep(t,n){return n}function jp(t,n){if(nt){var a=bt.formState;if(a!==null){e:{var u=Ue;if(nt){if(St){t:{for(var w=St,k=Hn;w.nodeType!==8;){if(!k){w=null;break t}if(w=Fn(w.nextSibling),w===null){w=null;break t}}k=w.data,w=k==="F!"||k==="F"?w:null}if(w){St=Fn(w.nextSibling),u=w.data==="F!";break e}}Rr(u)}u=!1}u&&(n=a[0])}}return a=on(),a.memoizedState=a.baseState=n,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ep,lastRenderedState:n},a.queue=u,a=Gp.bind(null,Ue,u),u.dispatch=a,u=Kc(!1),k=nu.bind(null,Ue,!1,u.queue),u=on(),w={state:n,dispatch:null,action:t,pending:null},u.queue=w,a=$y.bind(null,Ue,w,k,a),w.dispatch=a,u.memoizedState=t,[n,a,!1]}function Np(t){var n=At();return Tp(n,gt,t)}function Tp(t,n,a){if(n=Vc(t,n,Ep)[0],t=jo(mr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var u=ta(n)}catch(M){throw M===Ji?xo:M}else u=n;n=At();var w=n.queue,k=w.dispatch;return a!==n.memoizedState&&(Ue.flags|=2048,is(9,{destroy:void 0},qy.bind(null,w,a),null)),[u,k,t]}function qy(t,n){t.action=n}function Ap(t){var n=At(),a=gt;if(a!==null)return Tp(n,a,t);At(),n=n.memoizedState,a=At();var u=a.queue.dispatch;return a.memoizedState=t,[n,u,!1]}function is(t,n,a,u){return t={tag:t,create:a,deps:u,inst:n,next:null},n=Ue.updateQueue,n===null&&(n=ko(),Ue.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(u=a.next,a.next=t,t.next=u,n.lastEffect=t),t}function Dp(){return At().memoizedState}function No(t,n,a,u){var w=on();Ue.flags|=t,w.memoizedState=is(1|n,{destroy:void 0},a,u===void 0?null:u)}function To(t,n,a,u){var w=At();u=u===void 0?null:u;var k=w.memoizedState.inst;gt!==null&&u!==null&&Fc(u,gt.memoizedState.deps)?w.memoizedState=is(n,k,a,u):(Ue.flags|=t,w.memoizedState=is(1|n,k,a,u))}function Lp(t,n){No(8390656,8,t,n)}function Zc(t,n){To(2048,8,t,n)}function Wy(t){Ue.flags|=4;var n=Ue.updateQueue;if(n===null)n=ko(),Ue.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Rp(t){var n=At().memoizedState;return Wy({ref:n,nextImpl:t}),function(){if((ut&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Mp(t,n){return To(4,2,t,n)}function Op(t,n){return To(4,4,t,n)}function Bp(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 Ip(t,n,a){a=a!=null?a.concat([t]):null,To(4,4,Bp.bind(null,n,t),a)}function Qc(){}function zp(t,n){var a=At();n=n===void 0?null:n;var u=a.memoizedState;return n!==null&&Fc(n,u[1])?u[0]:(a.memoizedState=[t,n],t)}function Hp(t,n){var a=At();n=n===void 0?null:n;var u=a.memoizedState;if(n!==null&&Fc(n,u[1]))return u[0];if(u=t(),vi){Ct(!0);try{t()}finally{Ct(!1)}}return a.memoizedState=[u,n],u}function Jc(t,n,a){return a===void 0||(pr&1073741824)!==0&&(Ze&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=Pm(),Ue.lanes|=t,Ur|=t,a)}function Pp(t,n,a,u){return yn(a,n)?a:ts.current!==null?(t=Jc(t,a,u),yn(t,n)||(Ot=!0),t):(pr&42)===0||(pr&1073741824)!==0&&(Ze&261930)===0?(Ot=!0,t.memoizedState=a):(t=Pm(),Ue.lanes|=t,Ur|=t,n)}function Fp(t,n,a,u,w){var k=Z.p;Z.p=k!==0&&8>k?k:8;var M=V.T,G={};V.T=G,nu(t,!1,n,a);try{var J=w(),le=V.S;if(le!==null&&le(G,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var he=Py(J,u);na(t,n,he,En(t))}else na(t,n,u,En(t))}catch(xe){na(t,n,{then:function(){},status:"rejected",reason:xe},En())}finally{Z.p=k,M!==null&&G.types!==null&&(M.types=G.types),V.T=M}}function Gy(){}function eu(t,n,a,u){if(t.tag!==5)throw Error(s(476));var w=Up(t).queue;Fp(t,w,n,ee,a===null?Gy:function(){return $p(t),a(u)})}function Up(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:ee},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function $p(t){var n=Up(t);n.next===null&&(n=t.alternate.memoizedState),na(t,n.next.queue,{},En())}function tu(){return Zt(ba)}function qp(){return At().memoizedState}function Wp(){return At().memoizedState}function Vy(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=En();t=Br(a);var u=Ir(n,t,a);u!==null&&(xn(u,n,a),Zs(u,n,a)),n={cache:Ac()},t.payload=n;return}n=n.return}}function Yy(t,n,a){var u=En();a={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ao(t)?Vp(n,a):(a=bc(t,n,a,u),a!==null&&(xn(a,t,u),Yp(a,n,u)))}function Gp(t,n,a){var u=En();na(t,n,a,u)}function na(t,n,a,u){var w={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ao(t))Vp(n,w);else{var k=t.alternate;if(t.lanes===0&&(k===null||k.lanes===0)&&(k=n.lastRenderedReducer,k!==null))try{var M=n.lastRenderedState,G=k(M,a);if(w.hasEagerState=!0,w.eagerState=G,yn(G,M))return co(t,n,w,0),bt===null&&lo(),!1}catch{}finally{}if(a=bc(t,n,w,u),a!==null)return xn(a,t,u),Yp(a,n,u),!0}return!1}function nu(t,n,a,u){if(u={lane:2,revertLane:Mu(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ao(t)){if(n)throw Error(s(479))}else n=bc(t,a,u,2),n!==null&&xn(n,t,2)}function Ao(t){var n=t.alternate;return t===Ue||n!==null&&n===Ue}function Vp(t,n){ns=wo=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function Yp(t,n,a){if((a&4194048)!==0){var u=n.lanes;u&=t.pendingLanes,a|=u,n.lanes=a,Qh(t,a)}}var ra={readContext:Zt,use:Eo,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};ra.useEffectEvent=jt;var Kp={readContext:Zt,use:Eo,useCallback:function(t,n){return on().memoizedState=[t,n===void 0?null:n],t},useContext:Zt,useEffect:Lp,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,No(4194308,4,Bp.bind(null,n,t),a)},useLayoutEffect:function(t,n){return No(4194308,4,t,n)},useInsertionEffect:function(t,n){No(4,2,t,n)},useMemo:function(t,n){var a=on();n=n===void 0?null:n;var u=t();if(vi){Ct(!0);try{t()}finally{Ct(!1)}}return a.memoizedState=[u,n],u},useReducer:function(t,n,a){var u=on();if(a!==void 0){var w=a(n);if(vi){Ct(!0);try{a(n)}finally{Ct(!1)}}}else w=n;return u.memoizedState=u.baseState=w,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:w},u.queue=t,t=t.dispatch=Yy.bind(null,Ue,t),[u.memoizedState,t]},useRef:function(t){var n=on();return t={current:t},n.memoizedState=t},useState:function(t){t=Kc(t);var n=t.queue,a=Gp.bind(null,Ue,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:Qc,useDeferredValue:function(t,n){var a=on();return Jc(a,t,n)},useTransition:function(){var t=Kc(!1);return t=Fp.bind(null,Ue,t.queue,!0,!1),on().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var u=Ue,w=on();if(nt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),bt===null)throw Error(s(349));(Ze&127)!==0||gp(u,n,a)}w.memoizedState=a;var k={value:a,getSnapshot:n};return w.queue=k,Lp(vp.bind(null,u,k,t),[t]),u.flags|=2048,is(9,{destroy:void 0},xp.bind(null,u,k,a,n),null),a},useId:function(){var t=on(),n=bt.identifierPrefix;if(nt){var a=Qn,u=Zn;a=(u&~(1<<32-$e(u)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Co++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Fy++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:tu,useFormState:jp,useActionState:jp,useOptimistic:function(t){var n=on();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=nu.bind(null,Ue,!0,a),a.dispatch=n,[t,n]},useMemoCache:Gc,useCacheRefresh:function(){return on().memoizedState=Vy.bind(null,Ue)},useEffectEvent:function(t){var n=on(),a={impl:t};return n.memoizedState=a,function(){if((ut&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},ru={readContext:Zt,use:Eo,useCallback:zp,useContext:Zt,useEffect:Zc,useImperativeHandle:Ip,useInsertionEffect:Mp,useLayoutEffect:Op,useMemo:Hp,useReducer:jo,useRef:Dp,useState:function(){return jo(mr)},useDebugValue:Qc,useDeferredValue:function(t,n){var a=At();return Pp(a,gt.memoizedState,t,n)},useTransition:function(){var t=jo(mr)[0],n=At().memoizedState;return[typeof t=="boolean"?t:ta(t),n]},useSyncExternalStore:mp,useId:qp,useHostTransitionStatus:tu,useFormState:Np,useActionState:Np,useOptimistic:function(t,n){var a=At();return _p(a,gt,t,n)},useMemoCache:Gc,useCacheRefresh:Wp};ru.useEffectEvent=Rp;var Xp={readContext:Zt,use:Eo,useCallback:zp,useContext:Zt,useEffect:Zc,useImperativeHandle:Ip,useInsertionEffect:Mp,useLayoutEffect:Op,useMemo:Hp,useReducer:Yc,useRef:Dp,useState:function(){return Yc(mr)},useDebugValue:Qc,useDeferredValue:function(t,n){var a=At();return gt===null?Jc(a,t,n):Pp(a,gt.memoizedState,t,n)},useTransition:function(){var t=Yc(mr)[0],n=At().memoizedState;return[typeof t=="boolean"?t:ta(t),n]},useSyncExternalStore:mp,useId:qp,useHostTransitionStatus:tu,useFormState:Ap,useActionState:Ap,useOptimistic:function(t,n){var a=At();return gt!==null?_p(a,gt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Gc,useCacheRefresh:Wp};Xp.useEffectEvent=Rp;function iu(t,n,a,u){n=t.memoizedState,a=a(u,n),a=a==null?n:m({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var su={enqueueSetState:function(t,n,a){t=t._reactInternals;var u=En(),w=Br(u);w.payload=n,a!=null&&(w.callback=a),n=Ir(t,w,u),n!==null&&(xn(n,t,u),Zs(n,t,u))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var u=En(),w=Br(u);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=Ir(t,w,u),n!==null&&(xn(n,t,u),Zs(n,t,u))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=En(),u=Br(a);u.tag=2,n!=null&&(u.callback=n),n=Ir(t,u,a),n!==null&&(xn(n,t,a),Zs(n,t,a))}};function Zp(t,n,a,u,w,k,M){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,k,M):n.prototype&&n.prototype.isPureReactComponent?!$s(a,u)||!$s(w,k):!0}function Qp(t,n,a,u){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,u),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,u),n.state!==t&&su.enqueueReplaceState(n,n.state,null)}function bi(t,n){var a=n;if("ref"in n){a={};for(var u in n)u!=="ref"&&(a[u]=n[u])}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 Jp(t){oo(t)}function em(t){console.error(t)}function tm(t){oo(t)}function Do(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(u){setTimeout(function(){throw u})}}function nm(t,n,a){try{var u=t.onCaughtError;u(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function au(t,n,a){return a=Br(a),a.tag=3,a.payload={element:null},a.callback=function(){Do(t,n)},a}function rm(t){return t=Br(t),t.tag=3,t}function im(t,n,a,u){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var k=u.value;t.payload=function(){return w(k)},t.callback=function(){nm(n,a,u)}}var M=a.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(t.callback=function(){nm(n,a,u),typeof w!="function"&&($r===null?$r=new Set([this]):$r.add(this));var G=u.stack;this.componentDidCatch(u.value,{componentStack:G!==null?G:""})})}function Ky(t,n,a,u,w){if(a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(n=a.alternate,n!==null&&Xi(n,a,w,!0),a=Sn.current,a!==null){switch(a.tag){case 31:case 13:return Pn===null?$o():a.alternate===null&&Nt===0&&(Nt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,u===vo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([u]):n.add(u),Du(t,u,w)),!1;case 22:return a.flags|=65536,u===vo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([u])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([u]):a.add(u)),Du(t,u,w)),!1}throw Error(s(435,a.tag))}return Du(t,u,w),$o(),!1}if(nt)return n=Sn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,u!==kc&&(t=Error(s(422),{cause:u}),Gs(Bn(t,a)))):(u!==kc&&(n=Error(s(423),{cause:u}),Gs(Bn(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,u=Bn(u,a),w=au(t.stateNode,u,w),Bc(t,w),Nt!==4&&(Nt=2)),!1;var k=Error(s(520),{cause:u});if(k=Bn(k,a),da===null?da=[k]:da.push(k),Nt!==4&&(Nt=2),n===null)return!0;u=Bn(u,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=au(a.stateNode,u,t),Bc(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"&&($r===null||!$r.has(k))))return a.flags|=65536,w&=-w,a.lanes|=w,w=rm(w),im(w,t,a,u),Bc(a,w),!1}a=a.return}while(a!==null);return!1}var ou=Error(s(461)),Ot=!1;function Qt(t,n,a,u){n.child=t===null?lp(n,null,a,u):xi(n,t.child,a,u)}function sm(t,n,a,u,w){a=a.render;var k=n.ref;if("ref"in u){var M={};for(var G in u)G!=="ref"&&(M[G]=u[G])}else M=u;return fi(n),u=Uc(t,n,a,M,k,w),G=$c(),t!==null&&!Ot?(qc(t,n,w),gr(t,n,w)):(nt&&G&&wc(n),n.flags|=1,Qt(t,n,u,w),n.child)}function am(t,n,a,u,w){if(t===null){var k=a.type;return typeof k=="function"&&!yc(k)&&k.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=k,om(t,n,k,u,w)):(t=ho(a.type,null,u,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(k=t.child,!mu(t,w)){var M=k.memoizedProps;if(a=a.compare,a=a!==null?a:$s,a(M,u)&&t.ref===n.ref)return gr(t,n,w)}return n.flags|=1,t=ur(k,u),t.ref=n.ref,t.return=n,n.child=t}function om(t,n,a,u,w){if(t!==null){var k=t.memoizedProps;if($s(k,u)&&t.ref===n.ref)if(Ot=!1,n.pendingProps=u=k,mu(t,w))(t.flags&131072)!==0&&(Ot=!0);else return n.lanes=t.lanes,gr(t,n,w)}return lu(t,n,a,u,w)}function lm(t,n,a,u){var w=u.children,k=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((n.flags&128)!==0){if(k=k!==null?k.baseLanes|a:a,t!==null){for(u=n.child=t.child,w=0;u!==null;)w=w|u.lanes|u.childLanes,u=u.sibling;u=w&~k}else u=0,n.child=null;return cm(t,n,k,a,u)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&go(n,k!==null?k.cachePool:null),k!==null?dp(n,k):zc(),hp(n);else return u=n.lanes=536870912,cm(t,n,k!==null?k.baseLanes|a:a,a,u)}else k!==null?(go(n,k.cachePool),dp(n,k),Hr(),n.memoizedState=null):(t!==null&&go(n,null),zc(),Hr());return Qt(t,n,w,a),n.child}function ia(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function cm(t,n,a,u,w){var k=Lc();return k=k===null?null:{parent:Rt._currentValue,pool:k},n.memoizedState={baseLanes:a,cachePool:k},t!==null&&go(n,null),zc(),hp(n),t!==null&&Xi(t,n,u,!0),n.childLanes=w,null}function Lo(t,n){return n=Mo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function um(t,n,a){return xi(n,t.child,null,a),t=Lo(n,n.pendingProps),t.flags|=2,wn(n),n.memoizedState=null,t}function Xy(t,n,a){var u=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(nt){if(u.mode==="hidden")return t=Lo(n,u),n.lanes=536870912,ia(null,t);if(Pc(n),(t=St)?(t=Sg(t,Hn),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Dr!==null?{id:Zn,overflow:Qn}:null,retryLane:536870912,hydrationErrors:null},a=Vf(t),a.return=n,n.child=a,Xt=n,St=null)):t=null,t===null)throw Rr(n);return n.lanes=536870912,null}return Lo(n,u)}var k=t.memoizedState;if(k!==null){var M=k.dehydrated;if(Pc(n),w)if(n.flags&256)n.flags&=-257,n=um(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(Ot||Xi(t,n,a,!1),w=(a&t.childLanes)!==0,Ot||w){if(u=bt,u!==null&&(M=Jh(u,a),M!==0&&M!==k.retryLane))throw k.retryLane=M,ci(t,M),xn(u,t,M),ou;$o(),n=um(t,n,a)}else t=k.treeContext,St=Fn(M.nextSibling),Xt=n,nt=!0,Lr=null,Hn=!1,t!==null&&Xf(n,t),n=Lo(n,u),n.flags|=4096;return n}return t=ur(t.child,{mode:u.mode,children:u.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Ro(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 lu(t,n,a,u,w){return fi(n),a=Uc(t,n,a,u,void 0,w),u=$c(),t!==null&&!Ot?(qc(t,n,w),gr(t,n,w)):(nt&&u&&wc(n),n.flags|=1,Qt(t,n,a,w),n.child)}function dm(t,n,a,u,w,k){return fi(n),n.updateQueue=null,a=pp(n,u,a,w),fp(t),u=$c(),t!==null&&!Ot?(qc(t,n,k),gr(t,n,k)):(nt&&u&&wc(n),n.flags|=1,Qt(t,n,a,k),n.child)}function hm(t,n,a,u,w){if(fi(n),n.stateNode===null){var k=Gi,M=a.contextType;typeof M=="object"&&M!==null&&(k=Zt(M)),k=new a(u,k),n.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=su,n.stateNode=k,k._reactInternals=n,k=n.stateNode,k.props=u,k.state=n.memoizedState,k.refs={},Mc(n),M=a.contextType,k.context=typeof M=="object"&&M!==null?Zt(M):Gi,k.state=n.memoizedState,M=a.getDerivedStateFromProps,typeof M=="function"&&(iu(n,a,M,u),k.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(M=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),M!==k.state&&su.enqueueReplaceState(k,k.state,null),Js(n,u,k,w),Qs(),k.state=n.memoizedState),typeof k.componentDidMount=="function"&&(n.flags|=4194308),u=!0}else if(t===null){k=n.stateNode;var G=n.memoizedProps,J=bi(a,G);k.props=J;var le=k.context,he=a.contextType;M=Gi,typeof he=="object"&&he!==null&&(M=Zt(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!==M)&&Qp(n,k,u,M),Or=!1;var ce=n.memoizedState;k.state=ce,Js(n,u,k,w),Qs(),le=n.memoizedState,G||ce!==le||Or?(typeof xe=="function"&&(iu(n,a,xe,u),le=n.memoizedState),(J=Or||Zp(n,a,J,u,ce,le,M))?(he||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(n.flags|=4194308)):(typeof k.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=u,n.memoizedState=le),k.props=u,k.state=le,k.context=M,u=J):(typeof k.componentDidMount=="function"&&(n.flags|=4194308),u=!1)}else{k=n.stateNode,Oc(t,n),M=n.memoizedProps,he=bi(a,M),k.props=he,xe=n.pendingProps,ce=k.context,le=a.contextType,J=Gi,typeof le=="object"&&le!==null&&(J=Zt(le)),G=a.getDerivedStateFromProps,(le=typeof G=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(M!==xe||ce!==J)&&Qp(n,k,u,J),Or=!1,ce=n.memoizedState,k.state=ce,Js(n,u,k,w),Qs();var ue=n.memoizedState;M!==xe||ce!==ue||Or||t!==null&&t.dependencies!==null&&po(t.dependencies)?(typeof G=="function"&&(iu(n,a,G,u),ue=n.memoizedState),(he=Or||Zp(n,a,he,u,ce,ue,J)||t!==null&&t.dependencies!==null&&po(t.dependencies))?(le||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(u,ue,J),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(u,ue,J)),typeof k.componentDidUpdate=="function"&&(n.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof k.componentDidUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),n.memoizedProps=u,n.memoizedState=ue),k.props=u,k.state=ue,k.context=J,u=he):(typeof k.componentDidUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),u=!1)}return k=u,Ro(t,n),u=(n.flags&128)!==0,k||u?(k=n.stateNode,a=u&&typeof a.getDerivedStateFromError!="function"?null:k.render(),n.flags|=1,t!==null&&u?(n.child=xi(n,t.child,null,w),n.child=xi(n,null,a,w)):Qt(t,n,a,w),n.memoizedState=k.state,t=n.child):t=gr(t,n,w),t}function fm(t,n,a,u){return di(),n.flags|=256,Qt(t,n,a,u),n.child}var cu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function uu(t){return{baseLanes:t,cachePool:np()}}function du(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=kn),t}function pm(t,n,a){var u=n.pendingProps,w=!1,k=(n.flags&128)!==0,M;if((M=k)||(M=t!==null&&t.memoizedState===null?!1:(Tt.current&2)!==0),M&&(w=!0,n.flags&=-129),M=(n.flags&32)!==0,n.flags&=-33,t===null){if(nt){if(w?zr(n):Hr(),(t=St)?(t=Sg(t,Hn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Dr!==null?{id:Zn,overflow:Qn}:null,retryLane:536870912,hydrationErrors:null},a=Vf(t),a.return=n,n.child=a,Xt=n,St=null)):t=null,t===null)throw Rr(n);return Vu(t)?n.lanes=32:n.lanes=536870912,null}var G=u.children;return u=u.fallback,w?(Hr(),w=n.mode,G=Mo({mode:"hidden",children:G},w),u=ui(u,w,a,null),G.return=n,u.return=n,G.sibling=u,n.child=G,u=n.child,u.memoizedState=uu(a),u.childLanes=du(t,M,a),n.memoizedState=cu,ia(null,u)):(zr(n),hu(n,G))}var J=t.memoizedState;if(J!==null&&(G=J.dehydrated,G!==null)){if(k)n.flags&256?(zr(n),n.flags&=-257,n=fu(t,n,a)):n.memoizedState!==null?(Hr(),n.child=t.child,n.flags|=128,n=null):(Hr(),G=u.fallback,w=n.mode,u=Mo({mode:"visible",children:u.children},w),G=ui(G,w,a,null),G.flags|=2,u.return=n,G.return=n,u.sibling=G,n.child=u,xi(n,t.child,null,a),u=n.child,u.memoizedState=uu(a),u.childLanes=du(t,M,a),n.memoizedState=cu,n=ia(null,u));else if(zr(n),Vu(G)){if(M=G.nextSibling&&G.nextSibling.dataset,M)var le=M.dgst;M=le,u=Error(s(419)),u.stack="",u.digest=M,Gs({value:u,source:null,stack:null}),n=fu(t,n,a)}else if(Ot||Xi(t,n,a,!1),M=(a&t.childLanes)!==0,Ot||M){if(M=bt,M!==null&&(u=Jh(M,a),u!==0&&u!==J.retryLane))throw J.retryLane=u,ci(t,u),xn(M,t,u),ou;Gu(G)||$o(),n=fu(t,n,a)}else Gu(G)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,St=Fn(G.nextSibling),Xt=n,nt=!0,Lr=null,Hn=!1,t!==null&&Xf(n,t),n=hu(n,u.children),n.flags|=4096);return n}return w?(Hr(),G=u.fallback,w=n.mode,J=t.child,le=J.sibling,u=ur(J,{mode:"hidden",children:u.children}),u.subtreeFlags=J.subtreeFlags&65011712,le!==null?G=ur(le,G):(G=ui(G,w,a,null),G.flags|=2),G.return=n,u.return=n,u.sibling=G,n.child=u,ia(null,u),u=n.child,G=t.child.memoizedState,G===null?G=uu(a):(w=G.cachePool,w!==null?(J=Rt._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=np(),G={baseLanes:G.baseLanes|a,cachePool:w}),u.memoizedState=G,u.childLanes=du(t,M,a),n.memoizedState=cu,ia(t.child,u)):(zr(n),a=t.child,t=a.sibling,a=ur(a,{mode:"visible",children:u.children}),a.return=n,a.sibling=null,t!==null&&(M=n.deletions,M===null?(n.deletions=[t],n.flags|=16):M.push(t)),n.child=a,n.memoizedState=null,a)}function hu(t,n){return n=Mo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Mo(t,n){return t=_n(22,t,null,n),t.lanes=0,t}function fu(t,n,a){return xi(n,t.child,null,a),t=hu(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function mm(t,n,a){t.lanes|=n;var u=t.alternate;u!==null&&(u.lanes|=n),Nc(t.return,n,a)}function pu(t,n,a,u,w,k){var M=t.memoizedState;M===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:u,tail:a,tailMode:w,treeForkCount:k}:(M.isBackwards=n,M.rendering=null,M.renderingStartTime=0,M.last=u,M.tail=a,M.tailMode=w,M.treeForkCount=k)}function gm(t,n,a){var u=n.pendingProps,w=u.revealOrder,k=u.tail;u=u.children;var M=Tt.current,G=(M&2)!==0;if(G?(M=M&1|2,n.flags|=128):M&=1,F(Tt,M),Qt(t,n,u,a),u=nt?Ws:0,!G&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&mm(t,a,n);else if(t.tag===19)mm(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&&So(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),pu(n,!1,w,a,k,u);break;case"backwards":case"unstable_legacy-backwards":for(a=null,w=n.child,n.child=null;w!==null;){if(t=w.alternate,t!==null&&So(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}pu(n,!0,a,null,k,u);break;case"together":pu(n,!1,null,null,void 0,u);break;default:n.memoizedState=null}return n.child}function gr(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),Ur|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(Xi(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=ur(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=ur(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function mu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&po(t)))}function Zy(t,n,a){switch(n.tag){case 3:z(n,n.stateNode.containerInfo),Mr(n,Rt,t.memoizedState.cache),di();break;case 27:case 5:se(n);break;case 4:z(n,n.stateNode.containerInfo);break;case 10:Mr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Pc(n),null;break;case 13:var u=n.memoizedState;if(u!==null)return u.dehydrated!==null?(zr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?pm(t,n,a):(zr(n),t=gr(t,n,a),t!==null?t.sibling:null);zr(n);break;case 19:var w=(t.flags&128)!==0;if(u=(a&n.childLanes)!==0,u||(Xi(t,n,a,!1),u=(a&n.childLanes)!==0),w){if(u)return gm(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),F(Tt,Tt.current),u)break;return null;case 22:return n.lanes=0,lm(t,n,a,n.pendingProps);case 24:Mr(n,Rt,t.memoizedState.cache)}return gr(t,n,a)}function xm(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)Ot=!0;else{if(!mu(t,a)&&(n.flags&128)===0)return Ot=!1,Zy(t,n,a);Ot=(t.flags&131072)!==0}else Ot=!1,nt&&(n.flags&1048576)!==0&&Kf(n,Ws,n.index);switch(n.lanes=0,n.tag){case 16:e:{var u=n.pendingProps;if(t=mi(n.elementType),n.type=t,typeof t=="function")yc(t)?(u=bi(t,u),n.tag=1,n=hm(null,n,t,u,a)):(n.tag=0,n=lu(null,n,t,u,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=sm(null,n,t,u,a);break e}else if(w===L){n.tag=14,n=am(null,n,t,u,a);break e}}throw n=I(t)||t,Error(s(306,n,""))}}return n;case 0:return lu(t,n,n.type,n.pendingProps,a);case 1:return u=n.type,w=bi(u,n.pendingProps),hm(t,n,u,w,a);case 3:e:{if(z(n,n.stateNode.containerInfo),t===null)throw Error(s(387));u=n.pendingProps;var k=n.memoizedState;w=k.element,Oc(t,n),Js(n,u,null,a);var M=n.memoizedState;if(u=M.cache,Mr(n,Rt,u),u!==k.cache&&Tc(n,[Rt],a,!0),Qs(),u=M.element,k.isDehydrated)if(k={element:u,isDehydrated:!1,cache:M.cache},n.updateQueue.baseState=k,n.memoizedState=k,n.flags&256){n=fm(t,n,u,a);break e}else if(u!==w){w=Bn(Error(s(424)),n),Gs(w),n=fm(t,n,u,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(St=Fn(t.firstChild),Xt=n,nt=!0,Lr=null,Hn=!0,a=lp(n,null,u,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(di(),u===w){n=gr(t,n,a);break e}Qt(t,n,u,a)}n=n.child}return n;case 26:return Ro(t,n),t===null?(a=Ng(n.type,null,n.pendingProps,null))?n.memoizedState=a:nt||(a=n.type,t=n.pendingProps,u=Xo(Q.current).createElement(a),u[Kt]=n,u[dn]=t,Jt(u,a,t),qt(u),n.stateNode=u):n.memoizedState=Ng(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return se(n),t===null&&nt&&(u=n.stateNode=kg(n.type,n.pendingProps,Q.current),Xt=n,Hn=!0,w=St,Vr(n.type)?(Yu=w,St=Fn(u.firstChild)):St=w),Qt(t,n,n.pendingProps.children,a),Ro(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&nt&&((w=u=St)&&(u=j_(u,n.type,n.pendingProps,Hn),u!==null?(n.stateNode=u,Xt=n,St=Fn(u.firstChild),Hn=!1,w=!0):w=!1),w||Rr(n)),se(n),w=n.type,k=n.pendingProps,M=t!==null?t.memoizedProps:null,u=k.children,$u(w,k)?u=null:M!==null&&$u(w,M)&&(n.flags|=32),n.memoizedState!==null&&(w=Uc(t,n,Uy,null,null,a),ba._currentValue=w),Ro(t,n),Qt(t,n,u,a),n.child;case 6:return t===null&&nt&&((t=a=St)&&(a=N_(a,n.pendingProps,Hn),a!==null?(n.stateNode=a,Xt=n,St=null,t=!0):t=!1),t||Rr(n)),null;case 13:return pm(t,n,a);case 4:return z(n,n.stateNode.containerInfo),u=n.pendingProps,t===null?n.child=xi(n,null,u,a):Qt(t,n,u,a),n.child;case 11:return sm(t,n,n.type,n.pendingProps,a);case 7:return Qt(t,n,n.pendingProps,a),n.child;case 8:return Qt(t,n,n.pendingProps.children,a),n.child;case 12:return Qt(t,n,n.pendingProps.children,a),n.child;case 10:return u=n.pendingProps,Mr(n,n.type,u.value),Qt(t,n,u.children,a),n.child;case 9:return w=n.type._context,u=n.pendingProps.children,fi(n),w=Zt(w),u=u(w),n.flags|=1,Qt(t,n,u,a),n.child;case 14:return am(t,n,n.type,n.pendingProps,a);case 15:return om(t,n,n.type,n.pendingProps,a);case 19:return gm(t,n,a);case 31:return Xy(t,n,a);case 22:return lm(t,n,a,n.pendingProps);case 24:return fi(n),u=Zt(Rt),t===null?(w=Lc(),w===null&&(w=bt,k=Ac(),w.pooledCache=k,k.refCount++,k!==null&&(w.pooledCacheLanes|=a),w=k),n.memoizedState={parent:u,cache:w},Mc(n),Mr(n,Rt,w)):((t.lanes&a)!==0&&(Oc(t,n),Js(n,null,null,a),Qs()),w=t.memoizedState,k=n.memoizedState,w.parent!==u?(w={parent:u,cache:u},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),Mr(n,Rt,u)):(u=k.cache,Mr(n,Rt,u),u!==w.cache&&Tc(n,[Rt],a,!0))),Qt(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function xr(t){t.flags|=4}function gu(t,n,a,u,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(qm())t.flags|=8192;else throw gi=vo,Rc}else t.flags&=-16777217}function vm(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Rg(n))if(qm())t.flags|=8192;else throw gi=vo,Rc}function Oo(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?Gl():536870912,t.lanes|=n,ls|=n)}function sa(t,n){if(!nt)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 u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function wt(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,u=0;if(n)for(var w=t.child;w!==null;)a|=w.lanes|w.childLanes,u|=w.subtreeFlags&65011712,u|=w.flags&65011712,w.return=t,w=w.sibling;else for(w=t.child;w!==null;)a|=w.lanes|w.childLanes,u|=w.subtreeFlags,u|=w.flags,w.return=t,w=w.sibling;return t.subtreeFlags|=u,t.childLanes=a,n}function Qy(t,n,a){var u=n.pendingProps;switch(Cc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return wt(n),null;case 1:return wt(n),null;case 3:return a=n.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),n.memoizedState.cache!==u&&(n.flags|=2048),fr(Rt),ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Ki(n)?xr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Ec())),wt(n),null;case 26:var w=n.type,k=n.memoizedState;return t===null?(xr(n),k!==null?(wt(n),vm(n,k)):(wt(n),gu(n,w,null,u,a))):k?k!==t.memoizedState?(xr(n),wt(n),vm(n,k)):(wt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==u&&xr(n),wt(n),gu(n,w,t,u,a)),null;case 27:if(ge(n),a=Q.current,w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==u&&xr(n);else{if(!u){if(n.stateNode===null)throw Error(s(166));return wt(n),null}t=K.current,Ki(n)?Zf(n):(t=kg(w,u,a),n.stateNode=t,xr(n))}return wt(n),null;case 5:if(ge(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==u&&xr(n);else{if(!u){if(n.stateNode===null)throw Error(s(166));return wt(n),null}if(k=K.current,Ki(n))Zf(n);else{var M=Xo(Q.current);switch(k){case 1:k=M.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:k=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":k=M.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":k=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":k=M.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof u.is=="string"?M.createElement("select",{is:u.is}):M.createElement("select"),u.multiple?k.multiple=!0:u.size&&(k.size=u.size);break;default:k=typeof u.is=="string"?M.createElement(w,{is:u.is}):M.createElement(w)}}k[Kt]=n,k[dn]=u;e:for(M=n.child;M!==null;){if(M.tag===5||M.tag===6)k.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===n)break e;for(;M.sibling===null;){if(M.return===null||M.return===n)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}n.stateNode=k;e:switch(Jt(k,w,u),w){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&xr(n)}}return wt(n),gu(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==u&&xr(n);else{if(typeof u!="string"&&n.stateNode===null)throw Error(s(166));if(t=Q.current,Ki(n)){if(t=n.stateNode,a=n.memoizedProps,u=null,w=Xt,w!==null)switch(w.tag){case 27:case 5:u=w.memoizedProps}t[Kt]=n,t=!!(t.nodeValue===a||u!==null&&u.suppressHydrationWarning===!0||pg(t.nodeValue,a)),t||Rr(n,!0)}else t=Xo(t).createTextNode(u),t[Kt]=n,n.stateNode=t}return wt(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(u=Ki(n),a!==null){if(t===null){if(!u)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Kt]=n}else di(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;wt(n),t=!1}else a=Ec(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(wn(n),n):(wn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return wt(n),null;case 13:if(u=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=Ki(n),u!==null&&u.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[Kt]=n}else di(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;wt(n),w=!1}else w=Ec(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=w),w=!0;if(!w)return n.flags&256?(wn(n),n):(wn(n),null)}return wn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=u!==null,t=t!==null&&t.memoizedState!==null,a&&(u=n.child,w=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(w=u.alternate.memoizedState.cachePool.pool),k=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(k=u.memoizedState.cachePool.pool),k!==w&&(u.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),Oo(n,n.updateQueue),wt(n),null);case 4:return ae(),t===null&&zu(n.stateNode.containerInfo),wt(n),null;case 10:return fr(n.type),wt(n),null;case 19:if(q(Tt),u=n.memoizedState,u===null)return wt(n),null;if(w=(n.flags&128)!==0,k=u.rendering,k===null)if(w)sa(u,!1);else{if(Nt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(k=So(t),k!==null){for(n.flags|=128,sa(u,!1),t=k.updateQueue,n.updateQueue=t,Oo(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)Gf(a,t),a=a.sibling;return F(Tt,Tt.current&1|2),nt&&dr(n,u.treeForkCount),n.child}t=t.sibling}u.tail!==null&&Ge()>Po&&(n.flags|=128,w=!0,sa(u,!1),n.lanes=4194304)}else{if(!w)if(t=So(k),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,Oo(n,t),sa(u,!0),u.tail===null&&u.tailMode==="hidden"&&!k.alternate&&!nt)return wt(n),null}else 2*Ge()-u.renderingStartTime>Po&&a!==536870912&&(n.flags|=128,w=!0,sa(u,!1),n.lanes=4194304);u.isBackwards?(k.sibling=n.child,n.child=k):(t=u.last,t!==null?t.sibling=k:n.child=k,u.last=k)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=Ge(),t.sibling=null,a=Tt.current,F(Tt,w?a&1|2:a&1),nt&&dr(n,u.treeForkCount),t):(wt(n),null);case 22:case 23:return wn(n),Hc(),u=n.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(n.flags|=8192):u&&(n.flags|=8192),u?(a&536870912)!==0&&(n.flags&128)===0&&(wt(n),n.subtreeFlags&6&&(n.flags|=8192)):wt(n),a=n.updateQueue,a!==null&&Oo(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),u=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(u=n.memoizedState.cachePool.pool),u!==a&&(n.flags|=2048),t!==null&&q(pi),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),fr(Rt),wt(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function Jy(t,n){switch(Cc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return fr(Rt),ae(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return ge(n),null;case 31:if(n.memoizedState!==null){if(wn(n),n.alternate===null)throw Error(s(340));di()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(wn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));di()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return q(Tt),null;case 4:return ae(),null;case 10:return fr(n.type),null;case 22:case 23:return wn(n),Hc(),t!==null&&q(pi),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return fr(Rt),null;case 25:return null;default:return null}}function bm(t,n){switch(Cc(n),n.tag){case 3:fr(Rt),ae();break;case 26:case 27:case 5:ge(n);break;case 4:ae();break;case 31:n.memoizedState!==null&&wn(n);break;case 13:wn(n);break;case 19:q(Tt);break;case 10:fr(n.type);break;case 22:case 23:wn(n),Hc(),t!==null&&q(pi);break;case 24:fr(Rt)}}function aa(t,n){try{var a=n.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var w=u.next;a=w;do{if((a.tag&t)===t){u=void 0;var k=a.create,M=a.inst;u=k(),M.destroy=u}a=a.next}while(a!==w)}}catch(G){pt(n,n.return,G)}}function Pr(t,n,a){try{var u=n.updateQueue,w=u!==null?u.lastEffect:null;if(w!==null){var k=w.next;u=k;do{if((u.tag&t)===t){var M=u.inst,G=M.destroy;if(G!==void 0){M.destroy=void 0,w=n;var J=a,le=G;try{le()}catch(he){pt(w,J,he)}}}u=u.next}while(u!==k)}}catch(he){pt(n,n.return,he)}}function ym(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{up(n,a)}catch(u){pt(t,t.return,u)}}}function _m(t,n,a){a.props=bi(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(u){pt(t,n,u)}}function oa(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof a=="function"?t.refCleanup=a(u):a.current=u}}catch(w){pt(t,n,w)}}function Jn(t,n){var a=t.ref,u=t.refCleanup;if(a!==null)if(typeof u=="function")try{u()}catch(w){pt(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){pt(t,n,w)}else a.current=null}function Sm(t){var n=t.type,a=t.memoizedProps,u=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&u.focus();break e;case"img":a.src?u.src=a.src:a.srcSet&&(u.srcset=a.srcSet)}}catch(w){pt(t,t.return,w)}}function xu(t,n,a){try{var u=t.stateNode;__(u,t.type,a,n),u[dn]=n}catch(w){pt(t,t.return,w)}}function wm(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Vr(t.type)||t.tag===4}function vu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||wm(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Vr(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function bu(t,n,a){var u=t.tag;if(u===5||u===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=lr));else if(u!==4&&(u===27&&Vr(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(bu(t,n,a),t=t.sibling;t!==null;)bu(t,n,a),t=t.sibling}function Bo(t,n,a){var u=t.tag;if(u===5||u===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(u!==4&&(u===27&&Vr(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Bo(t,n,a),t=t.sibling;t!==null;)Bo(t,n,a),t=t.sibling}function Cm(t){var n=t.stateNode,a=t.memoizedProps;try{for(var u=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);Jt(n,u,a),n[Kt]=t,n[dn]=a}catch(k){pt(t,t.return,k)}}var vr=!1,Bt=!1,yu=!1,km=typeof WeakSet=="function"?WeakSet:Set,Wt=null;function e_(t,n){if(t=t.containerInfo,Fu=rl,t=If(t),fc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var u=a.getSelection&&a.getSelection();if(u&&u.rangeCount!==0){a=u.anchorNode;var w=u.anchorOffset,k=u.focusNode;u=u.focusOffset;try{a.nodeType,k.nodeType}catch{a=null;break e}var M=0,G=-1,J=-1,le=0,he=0,xe=t,ce=null;t:for(;;){for(var ue;xe!==a||w!==0&&xe.nodeType!==3||(G=M+w),xe!==k||u!==0&&xe.nodeType!==3||(J=M+u),xe.nodeType===3&&(M+=xe.nodeValue.length),(ue=xe.firstChild)!==null;)ce=xe,xe=ue;for(;;){if(xe===t)break t;if(ce===a&&++le===w&&(G=M),ce===k&&++he===u&&(J=M),(ue=xe.nextSibling)!==null)break;xe=ce,ce=xe.parentNode}xe=ue}a=G===-1||J===-1?null:{start:G,end:J}}else a=null}a=a||{start:0,end:0}}else a=null;for(Uu={focusedElem:t,selectionRange:a},rl=!1,Wt=n;Wt!==null;)if(n=Wt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Wt=t;else for(;Wt!==null;){switch(n=Wt,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,u=a.stateNode;try{var je=bi(a.type,w);t=u.getSnapshotBeforeUpdate(je,k),u.__reactInternalSnapshotBeforeUpdate=t}catch(Ie){pt(a,a.return,Ie)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)Wu(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Wu(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,Wt=t;break}Wt=n.return}}function Em(t,n,a){var u=a.flags;switch(a.tag){case 0:case 11:case 15:yr(t,a),u&4&&aa(5,a);break;case 1:if(yr(t,a),u&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(M){pt(a,a.return,M)}else{var w=bi(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(M){pt(a,a.return,M)}}u&64&&ym(a),u&512&&oa(a,a.return);break;case 3:if(yr(t,a),u&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{up(t,n)}catch(M){pt(a,a.return,M)}}break;case 27:n===null&&u&4&&Cm(a);case 26:case 5:yr(t,a),n===null&&u&4&&Sm(a),u&512&&oa(a,a.return);break;case 12:yr(t,a);break;case 31:yr(t,a),u&4&&Tm(t,a);break;case 13:yr(t,a),u&4&&Am(t,a),u&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=c_.bind(null,a),T_(t,a))));break;case 22:if(u=a.memoizedState!==null||vr,!u){n=n!==null&&n.memoizedState!==null||Bt,w=vr;var k=Bt;vr=u,(Bt=n)&&!k?_r(t,a,(a.subtreeFlags&8772)!==0):yr(t,a),vr=w,Bt=k}break;case 30:break;default:yr(t,a)}}function jm(t){var n=t.alternate;n!==null&&(t.alternate=null,jm(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&Xl(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 kt=null,fn=!1;function br(t,n,a){for(a=a.child;a!==null;)Nm(t,n,a),a=a.sibling}function Nm(t,n,a){if(it&&typeof it.onCommitFiberUnmount=="function")try{it.onCommitFiberUnmount(st,a)}catch{}switch(a.tag){case 26:Bt||Jn(a,n),br(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Bt||Jn(a,n);var u=kt,w=fn;Vr(a.type)&&(kt=a.stateNode,fn=!1),br(t,n,a),ga(a.stateNode),kt=u,fn=w;break;case 5:Bt||Jn(a,n);case 6:if(u=kt,w=fn,kt=null,br(t,n,a),kt=u,fn=w,kt!==null)if(fn)try{(kt.nodeType===9?kt.body:kt.nodeName==="HTML"?kt.ownerDocument.body:kt).removeChild(a.stateNode)}catch(k){pt(a,n,k)}else try{kt.removeChild(a.stateNode)}catch(k){pt(a,n,k)}break;case 18:kt!==null&&(fn?(t=kt,yg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),gs(t)):yg(kt,a.stateNode));break;case 4:u=kt,w=fn,kt=a.stateNode.containerInfo,fn=!0,br(t,n,a),kt=u,fn=w;break;case 0:case 11:case 14:case 15:Pr(2,a,n),Bt||Pr(4,a,n),br(t,n,a);break;case 1:Bt||(Jn(a,n),u=a.stateNode,typeof u.componentWillUnmount=="function"&&_m(a,n,u)),br(t,n,a);break;case 21:br(t,n,a);break;case 22:Bt=(u=Bt)||a.memoizedState!==null,br(t,n,a),Bt=u;break;default:br(t,n,a)}}function Tm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{gs(t)}catch(a){pt(n,n.return,a)}}}function Am(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{gs(t)}catch(a){pt(n,n.return,a)}}function t_(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new km),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new km),n;default:throw Error(s(435,t.tag))}}function Io(t,n){var a=t_(t);n.forEach(function(u){if(!a.has(u)){a.add(u);var w=u_.bind(null,t,u);u.then(w,w)}})}function pn(t,n){var a=n.deletions;if(a!==null)for(var u=0;u<a.length;u++){var w=a[u],k=t,M=n,G=M;e:for(;G!==null;){switch(G.tag){case 27:if(Vr(G.type)){kt=G.stateNode,fn=!1;break e}break;case 5:kt=G.stateNode,fn=!1;break e;case 3:case 4:kt=G.stateNode.containerInfo,fn=!0;break e}G=G.return}if(kt===null)throw Error(s(160));Nm(k,M,w),kt=null,fn=!1,k=w.alternate,k!==null&&(k.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Dm(n,t),n=n.sibling}var Wn=null;function Dm(t,n){var a=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:pn(n,t),mn(t),u&4&&(Pr(3,t,t.return),aa(3,t),Pr(5,t,t.return));break;case 1:pn(n,t),mn(t),u&512&&(Bt||a===null||Jn(a,a.return)),u&64&&vr&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?u:a.concat(u))));break;case 26:var w=Wn;if(pn(n,t),mn(t),u&512&&(Bt||a===null||Jn(a,a.return)),u&4){var k=a!==null?a.memoizedState:null;if(u=t.memoizedState,a===null)if(u===null)if(t.stateNode===null){e:{u=t.type,a=t.memoizedProps,w=w.ownerDocument||w;t:switch(u){case"title":k=w.getElementsByTagName("title")[0],(!k||k[Ms]||k[Kt]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=w.createElement(u),w.head.insertBefore(k,w.querySelector("head > title"))),Jt(k,u,a),k[Kt]=t,qt(k),u=k;break e;case"link":var M=Dg("link","href",w).get(u+(a.href||""));if(M){for(var G=0;G<M.length;G++)if(k=M[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)){M.splice(G,1);break t}}k=w.createElement(u),Jt(k,u,a),w.head.appendChild(k);break;case"meta":if(M=Dg("meta","content",w).get(u+(a.content||""))){for(G=0;G<M.length;G++)if(k=M[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)){M.splice(G,1);break t}}k=w.createElement(u),Jt(k,u,a),w.head.appendChild(k);break;default:throw Error(s(468,u))}k[Kt]=t,qt(k),u=k}t.stateNode=u}else Lg(w,t.type,t.stateNode);else t.stateNode=Ag(w,u,t.memoizedProps);else k!==u?(k===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):k.count--,u===null?Lg(w,t.type,t.stateNode):Ag(w,u,t.memoizedProps)):u===null&&t.stateNode!==null&&xu(t,t.memoizedProps,a.memoizedProps)}break;case 27:pn(n,t),mn(t),u&512&&(Bt||a===null||Jn(a,a.return)),a!==null&&u&4&&xu(t,t.memoizedProps,a.memoizedProps);break;case 5:if(pn(n,t),mn(t),u&512&&(Bt||a===null||Jn(a,a.return)),t.flags&32){w=t.stateNode;try{Hi(w,"")}catch(je){pt(t,t.return,je)}}u&4&&t.stateNode!=null&&(w=t.memoizedProps,xu(t,w,a!==null?a.memoizedProps:w)),u&1024&&(yu=!0);break;case 6:if(pn(n,t),mn(t),u&4){if(t.stateNode===null)throw Error(s(162));u=t.memoizedProps,a=t.stateNode;try{a.nodeValue=u}catch(je){pt(t,t.return,je)}}break;case 3:if(Jo=null,w=Wn,Wn=Zo(n.containerInfo),pn(n,t),Wn=w,mn(t),u&4&&a!==null&&a.memoizedState.isDehydrated)try{gs(n.containerInfo)}catch(je){pt(t,t.return,je)}yu&&(yu=!1,Lm(t));break;case 4:u=Wn,Wn=Zo(t.stateNode.containerInfo),pn(n,t),mn(t),Wn=u;break;case 12:pn(n,t),mn(t);break;case 31:pn(n,t),mn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Io(t,u)));break;case 13:pn(n,t),mn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Ho=Ge()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Io(t,u)));break;case 22:w=t.memoizedState!==null;var J=a!==null&&a.memoizedState!==null,le=vr,he=Bt;if(vr=le||w,Bt=he||J,pn(n,t),Bt=he,vr=le,mn(t),u&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||J||vr||Bt||yi(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(k=J.stateNode,w)M=k.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{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(je){pt(J,J.return,je)}}}else if(n.tag===6){if(a===null){J=n;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(je){pt(J,J.return,je)}}}else if(n.tag===18){if(a===null){J=n;try{var ue=J.stateNode;w?_g(ue,!0):_g(J.stateNode,!1)}catch(je){pt(J,J.return,je)}}}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}u&4&&(u=t.updateQueue,u!==null&&(a=u.retryQueue,a!==null&&(u.retryQueue=null,Io(t,a))));break;case 19:pn(n,t),mn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Io(t,u)));break;case 30:break;case 21:break;default:pn(n,t),mn(t)}}function mn(t){var n=t.flags;if(n&2){try{for(var a,u=t.return;u!==null;){if(wm(u)){a=u;break}u=u.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var w=a.stateNode,k=vu(t);Bo(t,k,w);break;case 5:var M=a.stateNode;a.flags&32&&(Hi(M,""),a.flags&=-33);var G=vu(t);Bo(t,G,M);break;case 3:case 4:var J=a.stateNode.containerInfo,le=vu(t);bu(t,le,J);break;default:throw Error(s(161))}}catch(he){pt(t,t.return,he)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Lm(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Lm(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function yr(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Em(t,n.alternate,n),n=n.sibling}function yi(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Pr(4,n,n.return),yi(n);break;case 1:Jn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&_m(n,n.return,a),yi(n);break;case 27:ga(n.stateNode);case 26:case 5:Jn(n,n.return),yi(n);break;case 22:n.memoizedState===null&&yi(n);break;case 30:yi(n);break;default:yi(n)}t=t.sibling}}function _r(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var u=n.alternate,w=t,k=n,M=k.flags;switch(k.tag){case 0:case 11:case 15:_r(w,k,a),aa(4,k);break;case 1:if(_r(w,k,a),u=k,w=u.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(le){pt(u,u.return,le)}if(u=k,w=u.updateQueue,w!==null){var G=u.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)cp(J[w],G)}catch(le){pt(u,u.return,le)}}a&&M&64&&ym(k),oa(k,k.return);break;case 27:Cm(k);case 26:case 5:_r(w,k,a),a&&u===null&&M&4&&Sm(k),oa(k,k.return);break;case 12:_r(w,k,a);break;case 31:_r(w,k,a),a&&M&4&&Tm(w,k);break;case 13:_r(w,k,a),a&&M&4&&Am(w,k);break;case 22:k.memoizedState===null&&_r(w,k,a),oa(k,k.return);break;case 30:break;default:_r(w,k,a)}n=n.sibling}}function _u(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&&Vs(a))}function Su(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Vs(t))}function Gn(t,n,a,u){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Rm(t,n,a,u),n=n.sibling}function Rm(t,n,a,u){var w=n.flags;switch(n.tag){case 0:case 11:case 15:Gn(t,n,a,u),w&2048&&aa(9,n);break;case 1:Gn(t,n,a,u);break;case 3:Gn(t,n,a,u),w&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Vs(t)));break;case 12:if(w&2048){Gn(t,n,a,u),t=n.stateNode;try{var k=n.memoizedProps,M=k.id,G=k.onPostCommit;typeof G=="function"&&G(M,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(J){pt(n,n.return,J)}}else Gn(t,n,a,u);break;case 31:Gn(t,n,a,u);break;case 13:Gn(t,n,a,u);break;case 23:break;case 22:k=n.stateNode,M=n.alternate,n.memoizedState!==null?k._visibility&2?Gn(t,n,a,u):la(t,n):k._visibility&2?Gn(t,n,a,u):(k._visibility|=2,ss(t,n,a,u,(n.subtreeFlags&10256)!==0||!1)),w&2048&&_u(M,n);break;case 24:Gn(t,n,a,u),w&2048&&Su(n.alternate,n);break;default:Gn(t,n,a,u)}}function ss(t,n,a,u,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var k=t,M=n,G=a,J=u,le=M.flags;switch(M.tag){case 0:case 11:case 15:ss(k,M,G,J,w),aa(8,M);break;case 23:break;case 22:var he=M.stateNode;M.memoizedState!==null?he._visibility&2?ss(k,M,G,J,w):la(k,M):(he._visibility|=2,ss(k,M,G,J,w)),w&&le&2048&&_u(M.alternate,M);break;case 24:ss(k,M,G,J,w),w&&le&2048&&Su(M.alternate,M);break;default:ss(k,M,G,J,w)}n=n.sibling}}function la(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,u=n,w=u.flags;switch(u.tag){case 22:la(a,u),w&2048&&_u(u.alternate,u);break;case 24:la(a,u),w&2048&&Su(u.alternate,u);break;default:la(a,u)}n=n.sibling}}var ca=8192;function as(t,n,a){if(t.subtreeFlags&ca)for(t=t.child;t!==null;)Mm(t,n,a),t=t.sibling}function Mm(t,n,a){switch(t.tag){case 26:as(t,n,a),t.flags&ca&&t.memoizedState!==null&&F_(a,Wn,t.memoizedState,t.memoizedProps);break;case 5:as(t,n,a);break;case 3:case 4:var u=Wn;Wn=Zo(t.stateNode.containerInfo),as(t,n,a),Wn=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=ca,ca=16777216,as(t,n,a),ca=u):as(t,n,a));break;default:as(t,n,a)}}function Om(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 ua(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var u=n[a];Wt=u,Im(u,t)}Om(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Bm(t),t=t.sibling}function Bm(t){switch(t.tag){case 0:case 11:case 15:ua(t),t.flags&2048&&Pr(9,t,t.return);break;case 3:ua(t);break;case 12:ua(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,zo(t)):ua(t);break;default:ua(t)}}function zo(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var u=n[a];Wt=u,Im(u,t)}Om(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Pr(8,n,n.return),zo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,zo(n));break;default:zo(n)}t=t.sibling}}function Im(t,n){for(;Wt!==null;){var a=Wt;switch(a.tag){case 0:case 11:case 15:Pr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var u=a.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Vs(a.memoizedState.cache)}if(u=a.child,u!==null)u.return=a,Wt=u;else e:for(a=t;Wt!==null;){u=Wt;var w=u.sibling,k=u.return;if(jm(u),u===a){Wt=null;break e}if(w!==null){w.return=k,Wt=w;break e}Wt=k}}}var n_={getCacheForType:function(t){var n=Zt(Rt),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return Zt(Rt).controller.signal}},r_=typeof WeakMap=="function"?WeakMap:Map,ut=0,bt=null,Ye=null,Ze=0,ft=0,Cn=null,Fr=!1,os=!1,wu=!1,Sr=0,Nt=0,Ur=0,_i=0,Cu=0,kn=0,ls=0,da=null,gn=null,ku=!1,Ho=0,zm=0,Po=1/0,Fo=null,$r=null,Pt=0,qr=null,cs=null,wr=0,Eu=0,ju=null,Hm=null,ha=0,Nu=null;function En(){return(ut&2)!==0&&Ze!==0?Ze&-Ze:V.T!==null?Mu():ef()}function Pm(){if(kn===0)if((Ze&536870912)===0||nt){var t=Ve;Ve<<=1,(Ve&3932160)===0&&(Ve=262144),kn=t}else kn=536870912;return t=Sn.current,t!==null&&(t.flags|=32),kn}function xn(t,n,a){(t===bt&&(ft===2||ft===9)||t.cancelPendingCommit!==null)&&(us(t,0),Wr(t,Ze,kn,!1)),Rs(t,a),((ut&2)===0||t!==bt)&&(t===bt&&((ut&2)===0&&(_i|=a),Nt===4&&Wr(t,Ze,kn,!1)),er(t))}function Fm(t,n,a){if((ut&6)!==0)throw Error(s(327));var u=!a&&(n&127)===0&&(n&t.expiredLanes)===0||Et(t,n),w=u?a_(t,n):Au(t,n,!0),k=u;do{if(w===0){os&&!u&&Wr(t,n,0,!1);break}else{if(a=t.current.alternate,k&&!i_(a)){w=Au(t,n,!1),k=!1;continue}if(w===2){if(k=n,t.errorRecoveryDisabledLanes&k)var M=0;else M=t.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){n=M;e:{var G=t;w=da;var J=G.current.memoizedState.isDehydrated;if(J&&(us(G,M).flags|=256),M=Au(G,M,!1),M!==2){if(wu&&!J){G.errorRecoveryDisabledLanes|=k,_i|=k,w=4;break e}k=gn,gn=w,k!==null&&(gn===null?gn=k:gn.push.apply(gn,k))}w=M}if(k=!1,w!==2)continue}}if(w===1){us(t,0),Wr(t,n,0,!0);break}e:{switch(u=t,k=w,k){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Wr(u,n,kn,!Fr);break e;case 2:gn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(w=Ho+300-Ge(),10<w)){if(Wr(u,n,kn,!Fr),Lt(u,0,!0)!==0)break e;wr=n,u.timeoutHandle=vg(Um.bind(null,u,a,gn,Fo,ku,n,kn,_i,ls,Fr,k,"Throttled",-0,0),w);break e}Um(u,a,gn,Fo,ku,n,kn,_i,ls,Fr,k,null,-0,0)}}break}while(!0);er(t)}function Um(t,n,a,u,w,k,M,G,J,le,he,xe,ce,ue){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:lr},Mm(n,k,xe);var je=(k&62914560)===k?Ho-Ge():(k&4194048)===k?zm-Ge():0;if(je=U_(xe,je),je!==null){wr=k,t.cancelPendingCommit=je(Xm.bind(null,t,n,k,a,u,w,M,G,J,he,xe,null,ce,ue)),Wr(t,k,M,!le);return}}Xm(t,n,k,a,u,w,M,G,J)}function i_(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 u=0;u<a.length;u++){var w=a[u],k=w.getSnapshot;w=w.value;try{if(!yn(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 Wr(t,n,a,u){n&=~Cu,n&=~_i,t.suspendedLanes|=n,t.pingedLanes&=~n,u&&(t.warmLanes|=n),u=t.expirationTimes;for(var w=n;0<w;){var k=31-$e(w),M=1<<k;u[k]=-1,w&=~M}a!==0&&Zh(t,a,n)}function Uo(){return(ut&6)===0?(fa(0),!1):!0}function Tu(){if(Ye!==null){if(ft===0)var t=Ye.return;else t=Ye,hr=hi=null,Wc(t),es=null,Ks=0,t=Ye;for(;t!==null;)bm(t.alternate,t),t=t.return;Ye=null}}function us(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,C_(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),wr=0,Tu(),bt=t,Ye=a=ur(t.current,null),Ze=n,ft=0,Cn=null,Fr=!1,os=Et(t,n),wu=!1,ls=kn=Cu=_i=Ur=Nt=0,gn=da=null,ku=!1,(n&8)!==0&&(n|=n&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=n;0<u;){var w=31-$e(u),k=1<<w;n|=t[w],u&=~k}return Sr=n,lo(),a}function $m(t,n){Ue=null,V.H=ra,n===Ji||n===xo?(n=sp(),ft=3):n===Rc?(n=sp(),ft=4):ft=n===ou?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Cn=n,Ye===null&&(Nt=1,Do(t,Bn(n,t.current)))}function qm(){var t=Sn.current;return t===null?!0:(Ze&4194048)===Ze?Pn===null:(Ze&62914560)===Ze||(Ze&536870912)!==0?t===Pn:!1}function Wm(){var t=V.H;return V.H=ra,t===null?ra:t}function Gm(){var t=V.A;return V.A=n_,t}function $o(){Nt=4,Fr||(Ze&4194048)!==Ze&&Sn.current!==null||(os=!0),(Ur&134217727)===0&&(_i&134217727)===0||bt===null||Wr(bt,Ze,kn,!1)}function Au(t,n,a){var u=ut;ut|=2;var w=Wm(),k=Gm();(bt!==t||Ze!==n)&&(Fo=null,us(t,n)),n=!1;var M=Nt;e:do try{if(ft!==0&&Ye!==null){var G=Ye,J=Cn;switch(ft){case 8:Tu(),M=6;break e;case 3:case 2:case 9:case 6:Sn.current===null&&(n=!0);var le=ft;if(ft=0,Cn=null,ds(t,G,J,le),a&&os){M=0;break e}break;default:le=ft,ft=0,Cn=null,ds(t,G,J,le)}}s_(),M=Nt;break}catch(he){$m(t,he)}while(!0);return n&&t.shellSuspendCounter++,hr=hi=null,ut=u,V.H=w,V.A=k,Ye===null&&(bt=null,Ze=0,lo()),M}function s_(){for(;Ye!==null;)Vm(Ye)}function a_(t,n){var a=ut;ut|=2;var u=Wm(),w=Gm();bt!==t||Ze!==n?(Fo=null,Po=Ge()+500,us(t,n)):os=Et(t,n);e:do try{if(ft!==0&&Ye!==null){n=Ye;var k=Cn;t:switch(ft){case 1:ft=0,Cn=null,ds(t,n,k,1);break;case 2:case 9:if(rp(k)){ft=0,Cn=null,Ym(n);break}n=function(){ft!==2&&ft!==9||bt!==t||(ft=7),er(t)},k.then(n,n);break e;case 3:ft=7;break e;case 4:ft=5;break e;case 7:rp(k)?(ft=0,Cn=null,Ym(n)):(ft=0,Cn=null,ds(t,n,k,7));break;case 5:var M=null;switch(Ye.tag){case 26:M=Ye.memoizedState;case 5:case 27:var G=Ye;if(M?Rg(M):G.stateNode.complete){ft=0,Cn=null;var J=G.sibling;if(J!==null)Ye=J;else{var le=G.return;le!==null?(Ye=le,qo(le)):Ye=null}break t}}ft=0,Cn=null,ds(t,n,k,5);break;case 6:ft=0,Cn=null,ds(t,n,k,6);break;case 8:Tu(),Nt=6;break e;default:throw Error(s(462))}}o_();break}catch(he){$m(t,he)}while(!0);return hr=hi=null,V.H=u,V.A=w,ut=a,Ye!==null?0:(bt=null,Ze=0,lo(),Nt)}function o_(){for(;Ye!==null&&!Je();)Vm(Ye)}function Vm(t){var n=xm(t.alternate,t,Sr);t.memoizedProps=t.pendingProps,n===null?qo(t):Ye=n}function Ym(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=dm(a,n,n.pendingProps,n.type,void 0,Ze);break;case 11:n=dm(a,n,n.pendingProps,n.type.render,n.ref,Ze);break;case 5:Wc(n);default:bm(a,n),n=Ye=Gf(n,Sr),n=xm(a,n,Sr)}t.memoizedProps=t.pendingProps,n===null?qo(t):Ye=n}function ds(t,n,a,u){hr=hi=null,Wc(n),es=null,Ks=0;var w=n.return;try{if(Ky(t,w,n,a,Ze)){Nt=1,Do(t,Bn(a,t.current)),Ye=null;return}}catch(k){if(w!==null)throw Ye=w,k;Nt=1,Do(t,Bn(a,t.current)),Ye=null;return}n.flags&32768?(nt||u===1?t=!0:os||(Ze&536870912)!==0?t=!1:(Fr=t=!0,(u===2||u===9||u===3||u===6)&&(u=Sn.current,u!==null&&u.tag===13&&(u.flags|=16384))),Km(n,t)):qo(n)}function qo(t){var n=t;do{if((n.flags&32768)!==0){Km(n,Fr);return}t=n.return;var a=Qy(n.alternate,n,Sr);if(a!==null){Ye=a;return}if(n=n.sibling,n!==null){Ye=n;return}Ye=n=t}while(n!==null);Nt===0&&(Nt=5)}function Km(t,n){do{var a=Jy(t.alternate,t);if(a!==null){a.flags&=32767,Ye=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Ye=t;return}Ye=t=a}while(t!==null);Nt=6,Ye=null}function Xm(t,n,a,u,w,k,M,G,J){t.cancelPendingCommit=null;do Wo();while(Pt!==0);if((ut&6)!==0)throw Error(s(327));if(n!==null){if(n===t.current)throw Error(s(177));if(k=n.lanes|n.childLanes,k|=vc,P0(t,a,k,M,G,J),t===bt&&(Ye=bt=null,Ze=0),cs=n,qr=t,wr=a,Eu=k,ju=w,Hm=u,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,d_(re,function(){return tg(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||u){u=V.T,V.T=null,w=Z.p,Z.p=2,M=ut,ut|=4;try{e_(t,n,a)}finally{ut=M,Z.p=w,V.T=u}}Pt=1,Zm(),Qm(),Jm()}}function Zm(){if(Pt===1){Pt=0;var t=qr,n=cs,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=V.T,V.T=null;var u=Z.p;Z.p=2;var w=ut;ut|=4;try{Dm(n,t);var k=Uu,M=If(t.containerInfo),G=k.focusedElem,J=k.selectionRange;if(M!==G&&G&&G.ownerDocument&&Bf(G.ownerDocument.documentElement,G)){if(J!==null&&fc(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 ue=ce.getSelection(),je=G.textContent.length,Ie=Math.min(J.start,je),vt=J.end===void 0?Ie:Math.min(J.end,je);!ue.extend&&Ie>vt&&(M=vt,vt=Ie,Ie=M);var ie=Of(G,Ie),ne=Of(G,vt);if(ie&&ne&&(ue.rangeCount!==1||ue.anchorNode!==ie.node||ue.anchorOffset!==ie.offset||ue.focusNode!==ne.node||ue.focusOffset!==ne.offset)){var oe=xe.createRange();oe.setStart(ie.node,ie.offset),ue.removeAllRanges(),Ie>vt?(ue.addRange(oe),ue.extend(ne.node,ne.offset)):(oe.setEnd(ne.node,ne.offset),ue.addRange(oe))}}}}for(xe=[],ue=G;ue=ue.parentNode;)ue.nodeType===1&&xe.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;G<xe.length;G++){var me=xe[G];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}rl=!!Fu,Uu=Fu=null}finally{ut=w,Z.p=u,V.T=a}}t.current=n,Pt=2}}function Qm(){if(Pt===2){Pt=0;var t=qr,n=cs,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=V.T,V.T=null;var u=Z.p;Z.p=2;var w=ut;ut|=4;try{Em(t,n.alternate,n)}finally{ut=w,Z.p=u,V.T=a}}Pt=3}}function Jm(){if(Pt===4||Pt===3){Pt=0,et();var t=qr,n=cs,a=wr,u=Hm;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Pt=5:(Pt=0,cs=qr=null,eg(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&($r=null),Yl(a),n=n.stateNode,it&&typeof it.onCommitFiberRoot=="function")try{it.onCommitFiberRoot(st,n,void 0,(n.current.flags&128)===128)}catch{}if(u!==null){n=V.T,w=Z.p,Z.p=2,V.T=null;try{for(var k=t.onRecoverableError,M=0;M<u.length;M++){var G=u[M];k(G.value,{componentStack:G.stack})}}finally{V.T=n,Z.p=w}}(wr&3)!==0&&Wo(),er(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===Nu?ha++:(ha=0,Nu=t):ha=0,fa(0)}}function eg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Vs(n)))}function Wo(){return Zm(),Qm(),Jm(),tg()}function tg(){if(Pt!==5)return!1;var t=qr,n=Eu;Eu=0;var a=Yl(wr),u=V.T,w=Z.p;try{Z.p=32>a?32:a,V.T=null,a=ju,ju=null;var k=qr,M=wr;if(Pt=0,cs=qr=null,wr=0,(ut&6)!==0)throw Error(s(331));var G=ut;if(ut|=4,Bm(k.current),Rm(k,k.current,M,a),ut=G,fa(0,!1),it&&typeof it.onPostCommitFiberRoot=="function")try{it.onPostCommitFiberRoot(st,k)}catch{}return!0}finally{Z.p=w,V.T=u,eg(t,n)}}function ng(t,n,a){n=Bn(a,n),n=au(t.stateNode,n,2),t=Ir(t,n,2),t!==null&&(Rs(t,2),er(t))}function pt(t,n,a){if(t.tag===3)ng(t,t,a);else for(;n!==null;){if(n.tag===3){ng(n,t,a);break}else if(n.tag===1){var u=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&($r===null||!$r.has(u))){t=Bn(a,t),a=rm(2),u=Ir(n,a,2),u!==null&&(im(a,u,n,t),Rs(u,2),er(u));break}}n=n.return}}function Du(t,n,a){var u=t.pingCache;if(u===null){u=t.pingCache=new r_;var w=new Set;u.set(n,w)}else w=u.get(n),w===void 0&&(w=new Set,u.set(n,w));w.has(a)||(wu=!0,w.add(a),t=l_.bind(null,t,n,a),n.then(t,t))}function l_(t,n,a){var u=t.pingCache;u!==null&&u.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,bt===t&&(Ze&a)===a&&(Nt===4||Nt===3&&(Ze&62914560)===Ze&&300>Ge()-Ho?(ut&2)===0&&us(t,0):Cu|=a,ls===Ze&&(ls=0)),er(t)}function rg(t,n){n===0&&(n=Gl()),t=ci(t,n),t!==null&&(Rs(t,n),er(t))}function c_(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),rg(t,a)}function u_(t,n){var a=0;switch(t.tag){case 31:case 13:var u=t.stateNode,w=t.memoizedState;w!==null&&(a=w.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(n),rg(t,a)}function d_(t,n){return fe(t,n)}var Go=null,hs=null,Lu=!1,Vo=!1,Ru=!1,Gr=0;function er(t){t!==hs&&t.next===null&&(hs===null?Go=hs=t:hs=hs.next=t),Vo=!0,Lu||(Lu=!0,f_())}function fa(t,n){if(!Ru&&Vo){Ru=!0;do for(var a=!1,u=Go;u!==null;){if(t!==0){var w=u.pendingLanes;if(w===0)var k=0;else{var M=u.suspendedLanes,G=u.pingedLanes;k=(1<<31-$e(42|t)+1)-1,k&=w&~(M&~G),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(a=!0,og(u,k))}else k=Ze,k=Lt(u,u===bt?k:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(k&3)===0||Et(u,k)||(a=!0,og(u,k));u=u.next}while(a);Ru=!1}}function h_(){ig()}function ig(){Vo=Lu=!1;var t=0;Gr!==0&&w_()&&(t=Gr);for(var n=Ge(),a=null,u=Go;u!==null;){var w=u.next,k=sg(u,n);k===0?(u.next=null,a===null?Go=w:a.next=w,w===null&&(hs=a)):(a=u,(t!==0||(k&3)!==0)&&(Vo=!0)),u=w}Pt!==0&&Pt!==5||fa(t),Gr!==0&&(Gr=0)}function sg(t,n){for(var a=t.suspendedLanes,u=t.pingedLanes,w=t.expirationTimes,k=t.pendingLanes&-62914561;0<k;){var M=31-$e(k),G=1<<M,J=w[M];J===-1?((G&a)===0||(G&u)!==0)&&(w[M]=Yt(G,n)):J<=n&&(t.expiredLanes|=G),k&=~G}if(n=bt,a=Ze,a=Lt(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,a===0||t===n&&(ft===2||ft===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&Re(u),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Et(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(u!==null&&Re(u),Yl(a)){case 2:case 8:a=be;break;case 32:a=re;break;case 268435456:a=Ce;break;default:a=re}return u=ag.bind(null,t),a=fe(a,u),t.callbackPriority=n,t.callbackNode=a,n}return u!==null&&u!==null&&Re(u),t.callbackPriority=2,t.callbackNode=null,2}function ag(t,n){if(Pt!==0&&Pt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(Wo()&&t.callbackNode!==a)return null;var u=Ze;return u=Lt(t,t===bt?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(Fm(t,u,n),sg(t,Ge()),t.callbackNode!=null&&t.callbackNode===a?ag.bind(null,t):null)}function og(t,n){if(Wo())return null;Fm(t,n,!0)}function f_(){k_(function(){(ut&6)!==0?fe(de,h_):ig()})}function Mu(){if(Gr===0){var t=Zi;t===0&&(t=ze,ze<<=1,(ze&261888)===0&&(ze=256)),Gr=t}return Gr}function lg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:eo(""+t)}function cg(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 p_(t,n,a,u,w){if(n==="submit"&&a&&a.stateNode===w){var k=lg((w[dn]||null).action),M=u.submitter;M&&(n=(n=M[dn]||null)?lg(n.formAction):M.getAttribute("formAction"),n!==null&&(k=n,M=null));var G=new io("action","action",null,u,w);t.push({event:G,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Gr!==0){var J=M?cg(w,M):new FormData(w);eu(a,{pending:!0,data:J,method:w.method,action:k},null,J)}}else typeof k=="function"&&(G.preventDefault(),J=M?cg(w,M):new FormData(w),eu(a,{pending:!0,data:J,method:w.method,action:k},k,J))},currentTarget:w}]})}}for(var Ou=0;Ou<xc.length;Ou++){var Bu=xc[Ou],m_=Bu.toLowerCase(),g_=Bu[0].toUpperCase()+Bu.slice(1);qn(m_,"on"+g_)}qn(Pf,"onAnimationEnd"),qn(Ff,"onAnimationIteration"),qn(Uf,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(Ly,"onTransitionRun"),qn(Ry,"onTransitionStart"),qn(My,"onTransitionCancel"),qn($f,"onTransitionEnd"),Ii("onMouseEnter",["mouseout","mouseover"]),Ii("onMouseLeave",["mouseout","mouseover"]),Ii("onPointerEnter",["pointerout","pointerover"]),Ii("onPointerLeave",["pointerout","pointerover"]),si("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),si("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),si("onBeforeInput",["compositionend","keypress","textInput","paste"]),si("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),si("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),si("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pa="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(" "),x_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(pa));function ug(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var u=t[a],w=u.event;u=u.listeners;e:{var k=void 0;if(n)for(var M=u.length-1;0<=M;M--){var G=u[M],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){oo(he)}w.currentTarget=null,k=J}else for(M=0;M<u.length;M++){if(G=u[M],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){oo(he)}w.currentTarget=null,k=J}}}}function Ke(t,n){var a=n[Kl];a===void 0&&(a=n[Kl]=new Set);var u=t+"__bubble";a.has(u)||(dg(n,t,2,!1),a.add(u))}function Iu(t,n,a){var u=0;n&&(u|=4),dg(a,t,u,n)}var Yo="_reactListening"+Math.random().toString(36).slice(2);function zu(t){if(!t[Yo]){t[Yo]=!0,rf.forEach(function(a){a!=="selectionchange"&&(x_.has(a)||Iu(a,!1,t),Iu(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[Yo]||(n[Yo]=!0,Iu("selectionchange",!1,n))}}function dg(t,n,a,u){switch(Pg(n)){case 2:var w=W_;break;case 8:w=G_;break;default:w=Ju}a=w.bind(null,n,a,t),w=void 0,!ic||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(w=!0),u?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 Hu(t,n,a,u,w){var k=u;if((n&1)===0&&(n&2)===0&&u!==null)e:for(;;){if(u===null)return;var M=u.tag;if(M===3||M===4){var G=u.stateNode.containerInfo;if(G===w)break;if(M===4)for(M=u.return;M!==null;){var J=M.tag;if((J===3||J===4)&&M.stateNode.containerInfo===w)return;M=M.return}for(;G!==null;){if(M=Mi(G),M===null)return;if(J=M.tag,J===5||J===6||J===26||J===27){u=k=M;continue e}G=G.parentNode}}u=u.return}gf(function(){var le=k,he=nc(a),xe=[];e:{var ce=qf.get(t);if(ce!==void 0){var ue=io,je=t;switch(t){case"keypress":if(no(a)===0)break e;case"keydown":case"keyup":ue=uy;break;case"focusin":je="focus",ue=lc;break;case"focusout":je="blur",ue=lc;break;case"beforeblur":case"afterblur":ue=lc;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":ue=bf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=Q0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=fy;break;case Pf:case Ff:case Uf:ue=ty;break;case $f:ue=my;break;case"scroll":case"scrollend":ue=X0;break;case"wheel":ue=xy;break;case"copy":case"cut":case"paste":ue=ry;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=_f;break;case"toggle":case"beforetoggle":ue=by}var Ie=(n&4)!==0,vt=!Ie&&(t==="scroll"||t==="scrollend"),ie=Ie?ce!==null?ce+"Capture":null:ce;Ie=[];for(var ne=le,oe;ne!==null;){var me=ne;if(oe=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||oe===null||ie===null||(me=Bs(ne,ie),me!=null&&Ie.push(ma(ne,me,oe))),vt)break;ne=ne.return}0<Ie.length&&(ce=new ue(ce,je,null,a,he),xe.push({event:ce,listeners:Ie}))}}if((n&7)===0){e:{if(ce=t==="mouseover"||t==="pointerover",ue=t==="mouseout"||t==="pointerout",ce&&a!==tc&&(je=a.relatedTarget||a.fromElement)&&(Mi(je)||je[Ri]))break e;if((ue||ce)&&(ce=he.window===he?he:(ce=he.ownerDocument)?ce.defaultView||ce.parentWindow:window,ue?(je=a.relatedTarget||a.toElement,ue=le,je=je?Mi(je):null,je!==null&&(vt=d(je),Ie=je.tag,je!==vt||Ie!==5&&Ie!==27&&Ie!==6)&&(je=null)):(ue=null,je=le),ue!==je)){if(Ie=bf,me="onMouseLeave",ie="onMouseEnter",ne="mouse",(t==="pointerout"||t==="pointerover")&&(Ie=_f,me="onPointerLeave",ie="onPointerEnter",ne="pointer"),vt=ue==null?ce:Os(ue),oe=je==null?ce:Os(je),ce=new Ie(me,ne+"leave",ue,a,he),ce.target=vt,ce.relatedTarget=oe,me=null,Mi(he)===le&&(Ie=new Ie(ie,ne+"enter",je,a,he),Ie.target=oe,Ie.relatedTarget=vt,me=Ie),vt=me,ue&&je)t:{for(Ie=v_,ie=ue,ne=je,oe=0,me=ie;me;me=Ie(me))oe++;me=0;for(var Le=ne;Le;Le=Ie(Le))me++;for(;0<oe-me;)ie=Ie(ie),oe--;for(;0<me-oe;)ne=Ie(ne),me--;for(;oe--;){if(ie===ne||ne!==null&&ie===ne.alternate){Ie=ie;break t}ie=Ie(ie),ne=Ie(ne)}Ie=null}else Ie=null;ue!==null&&hg(xe,ce,ue,Ie,!1),je!==null&&vt!==null&&hg(xe,vt,je,Ie,!0)}}e:{if(ce=le?Os(le):window,ue=ce.nodeName&&ce.nodeName.toLowerCase(),ue==="select"||ue==="input"&&ce.type==="file")var at=Tf;else if(jf(ce))if(Af)at=Ty;else{at=jy;var Te=Ey}else ue=ce.nodeName,!ue||ue.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&ec(le.elementType)&&(at=Tf):at=Ny;if(at&&(at=at(t,le))){Nf(xe,at,a,he);break e}Te&&Te(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&Jl(ce,"number",ce.value)}switch(Te=le?Os(le):window,t){case"focusin":(jf(Te)||Te.contentEditable==="true")&&($i=Te,pc=le,qs=null);break;case"focusout":qs=pc=$i=null;break;case"mousedown":mc=!0;break;case"contextmenu":case"mouseup":case"dragend":mc=!1,zf(xe,a,he);break;case"selectionchange":if(Dy)break;case"keydown":case"keyup":zf(xe,a,he)}var qe;if(uc)e:{switch(t){case"compositionstart":var Qe="onCompositionStart";break e;case"compositionend":Qe="onCompositionEnd";break e;case"compositionupdate":Qe="onCompositionUpdate";break e}Qe=void 0}else Ui?kf(t,a)&&(Qe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Qe="onCompositionStart");Qe&&(Sf&&a.locale!=="ko"&&(Ui||Qe!=="onCompositionStart"?Qe==="onCompositionEnd"&&Ui&&(qe=xf()):(Ar=he,sc="value"in Ar?Ar.value:Ar.textContent,Ui=!0)),Te=Ko(le,Qe),0<Te.length&&(Qe=new yf(Qe,t,null,a,he),xe.push({event:Qe,listeners:Te}),qe?Qe.data=qe:(qe=Ef(a),qe!==null&&(Qe.data=qe)))),(qe=_y?Sy(t,a):wy(t,a))&&(Qe=Ko(le,"onBeforeInput"),0<Qe.length&&(Te=new yf("onBeforeInput","beforeinput",null,a,he),xe.push({event:Te,listeners:Qe}),Te.data=qe)),p_(xe,t,le,a,he)}ug(xe,n)})}function ma(t,n,a){return{instance:t,listener:n,currentTarget:a}}function Ko(t,n){for(var a=n+"Capture",u=[];t!==null;){var w=t,k=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||k===null||(w=Bs(t,a),w!=null&&u.unshift(ma(t,w,k)),w=Bs(t,n),w!=null&&u.push(ma(t,w,k))),t.tag===3)return u;t=t.return}return[]}function v_(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function hg(t,n,a,u,w){for(var k=n._reactName,M=[];a!==null&&a!==u;){var G=a,J=G.alternate,le=G.stateNode;if(G=G.tag,J!==null&&J===u)break;G!==5&&G!==26&&G!==27||le===null||(J=le,w?(le=Bs(a,k),le!=null&&M.unshift(ma(a,le,J))):w||(le=Bs(a,k),le!=null&&M.push(ma(a,le,J)))),a=a.return}M.length!==0&&t.push({event:n,listeners:M})}var b_=/\r\n?/g,y_=/\u0000|\uFFFD/g;function fg(t){return(typeof t=="string"?t:""+t).replace(b_,`
|
|
49
|
-
`).replace(y_,"")}function pg(t,n){return n=fg(n),fg(t)===n}function xt(t,n,a,u,w,k){switch(a){case"children":typeof u=="string"?n==="body"||n==="textarea"&&u===""||Hi(t,u):(typeof u=="number"||typeof u=="bigint")&&n!=="body"&&Hi(t,""+u);break;case"className":Qa(t,"class",u);break;case"tabIndex":Qa(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Qa(t,a,u);break;case"style":pf(t,u,k);break;case"data":if(n!=="object"){Qa(t,"data",u);break}case"src":case"href":if(u===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(a);break}u=eo(""+u),t.setAttribute(a,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof k=="function"&&(a==="formAction"?(n!=="input"&&xt(t,n,"name",w.name,w,null),xt(t,n,"formEncType",w.formEncType,w,null),xt(t,n,"formMethod",w.formMethod,w,null),xt(t,n,"formTarget",w.formTarget,w,null)):(xt(t,n,"encType",w.encType,w,null),xt(t,n,"method",w.method,w,null),xt(t,n,"target",w.target,w,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(a);break}u=eo(""+u),t.setAttribute(a,u);break;case"onClick":u!=null&&(t.onclick=lr);break;case"onScroll":u!=null&&Ke("scroll",t);break;case"onScrollEnd":u!=null&&Ke("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(a=u.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}a=eo(""+u),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":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(a,""+u):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":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":u===!0?t.setAttribute(a,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(a,u):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(a,u):t.removeAttribute(a);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(a):t.setAttribute(a,u);break;case"popover":Ke("beforetoggle",t),Ke("toggle",t),Za(t,"popover",u);break;case"xlinkActuate":or(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":or(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":or(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":or(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":or(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":or(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":or(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":or(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":or(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Za(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Y0.get(a)||a,Za(t,a,u))}}function Pu(t,n,a,u,w,k){switch(a){case"style":pf(t,u,k);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(a=u.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"children":typeof u=="string"?Hi(t,u):(typeof u=="number"||typeof u=="bigint")&&Hi(t,""+u);break;case"onScroll":u!=null&&Ke("scroll",t);break;case"onScrollEnd":u!=null&&Ke("scrollend",t);break;case"onClick":u!=null&&(t.onclick=lr);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[dn]||null,k=k!=null?k[a]:null,typeof k=="function"&&t.removeEventListener(n,k,w),typeof u=="function")){typeof k!="function"&&k!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,u,w);break e}a in t?t[a]=u:u===!0?t.setAttribute(a,""):Za(t,a,u)}}}function Jt(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ke("error",t),Ke("load",t);var u=!1,w=!1,k;for(k in a)if(a.hasOwnProperty(k)){var M=a[k];if(M!=null)switch(k){case"src":u=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:xt(t,n,k,M,a,null)}}w&&xt(t,n,"srcSet",a.srcSet,a,null),u&&xt(t,n,"src",a.src,a,null);return;case"input":Ke("invalid",t);var G=k=M=w=null,J=null,le=null;for(u in a)if(a.hasOwnProperty(u)){var he=a[u];if(he!=null)switch(u){case"name":w=he;break;case"type":M=he;break;case"checked":J=he;break;case"defaultChecked":le=he;break;case"value":k=he;break;case"defaultValue":G=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(s(137,n));break;default:xt(t,n,u,he,a,null)}}uf(t,k,G,J,le,M,w,!1);return;case"select":Ke("invalid",t),u=M=k=null;for(w in a)if(a.hasOwnProperty(w)&&(G=a[w],G!=null))switch(w){case"value":k=G;break;case"defaultValue":M=G;break;case"multiple":u=G;default:xt(t,n,w,G,a,null)}n=k,a=M,t.multiple=!!u,n!=null?zi(t,!!u,n,!1):a!=null&&zi(t,!!u,a,!0);return;case"textarea":Ke("invalid",t),k=w=u=null;for(M in a)if(a.hasOwnProperty(M)&&(G=a[M],G!=null))switch(M){case"value":u=G;break;case"defaultValue":w=G;break;case"children":k=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(91));break;default:xt(t,n,M,G,a,null)}hf(t,u,w,k);return;case"option":for(J in a)if(a.hasOwnProperty(J)&&(u=a[J],u!=null))switch(J){case"selected":t.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:xt(t,n,J,u,a,null)}return;case"dialog":Ke("beforetoggle",t),Ke("toggle",t),Ke("cancel",t),Ke("close",t);break;case"iframe":case"object":Ke("load",t);break;case"video":case"audio":for(u=0;u<pa.length;u++)Ke(pa[u],t);break;case"image":Ke("error",t),Ke("load",t);break;case"details":Ke("toggle",t);break;case"embed":case"source":case"link":Ke("error",t),Ke("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)&&(u=a[le],u!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:xt(t,n,le,u,a,null)}return;default:if(ec(n)){for(he in a)a.hasOwnProperty(he)&&(u=a[he],u!==void 0&&Pu(t,n,he,u,a,void 0));return}}for(G in a)a.hasOwnProperty(G)&&(u=a[G],u!=null&&xt(t,n,G,u,a,null))}function __(t,n,a,u){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,k=null,M=null,G=null,J=null,le=null,he=null;for(ue in a){var xe=a[ue];if(a.hasOwnProperty(ue)&&xe!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":J=xe;default:u.hasOwnProperty(ue)||xt(t,n,ue,null,u,xe)}}for(var ce in u){var ue=u[ce];if(xe=a[ce],u.hasOwnProperty(ce)&&(ue!=null||xe!=null))switch(ce){case"type":k=ue;break;case"name":w=ue;break;case"checked":le=ue;break;case"defaultChecked":he=ue;break;case"value":M=ue;break;case"defaultValue":G=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,n));break;default:ue!==xe&&xt(t,n,ce,ue,u,xe)}}Ql(t,M,G,J,le,he,k,w);return;case"select":ue=M=G=ce=null;for(k in a)if(J=a[k],a.hasOwnProperty(k)&&J!=null)switch(k){case"value":break;case"multiple":ue=J;default:u.hasOwnProperty(k)||xt(t,n,k,null,u,J)}for(w in u)if(k=u[w],J=a[w],u.hasOwnProperty(w)&&(k!=null||J!=null))switch(w){case"value":ce=k;break;case"defaultValue":G=k;break;case"multiple":M=k;default:k!==J&&xt(t,n,w,k,u,J)}n=G,a=M,u=ue,ce!=null?zi(t,!!a,ce,!1):!!u!=!!a&&(n!=null?zi(t,!!a,n,!0):zi(t,!!a,a?[]:"",!1));return;case"textarea":ue=ce=null;for(G in a)if(w=a[G],a.hasOwnProperty(G)&&w!=null&&!u.hasOwnProperty(G))switch(G){case"value":break;case"children":break;default:xt(t,n,G,null,u,w)}for(M in u)if(w=u[M],k=a[M],u.hasOwnProperty(M)&&(w!=null||k!=null))switch(M){case"value":ce=w;break;case"defaultValue":ue=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:w!==k&&xt(t,n,M,w,u,k)}df(t,ce,ue);return;case"option":for(var je in a)if(ce=a[je],a.hasOwnProperty(je)&&ce!=null&&!u.hasOwnProperty(je))switch(je){case"selected":t.selected=!1;break;default:xt(t,n,je,null,u,ce)}for(J in u)if(ce=u[J],ue=a[J],u.hasOwnProperty(J)&&ce!==ue&&(ce!=null||ue!=null))switch(J){case"selected":t.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:xt(t,n,J,ce,u,ue)}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 Ie in a)ce=a[Ie],a.hasOwnProperty(Ie)&&ce!=null&&!u.hasOwnProperty(Ie)&&xt(t,n,Ie,null,u,ce);for(le in u)if(ce=u[le],ue=a[le],u.hasOwnProperty(le)&&ce!==ue&&(ce!=null||ue!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,n));break;default:xt(t,n,le,ce,u,ue)}return;default:if(ec(n)){for(var vt in a)ce=a[vt],a.hasOwnProperty(vt)&&ce!==void 0&&!u.hasOwnProperty(vt)&&Pu(t,n,vt,void 0,u,ce);for(he in u)ce=u[he],ue=a[he],!u.hasOwnProperty(he)||ce===ue||ce===void 0&&ue===void 0||Pu(t,n,he,ce,u,ue);return}}for(var ie in a)ce=a[ie],a.hasOwnProperty(ie)&&ce!=null&&!u.hasOwnProperty(ie)&&xt(t,n,ie,null,u,ce);for(xe in u)ce=u[xe],ue=a[xe],!u.hasOwnProperty(xe)||ce===ue||ce==null&&ue==null||xt(t,n,xe,ce,u,ue)}function mg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function S_(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),u=0;u<a.length;u++){var w=a[u],k=w.transferSize,M=w.initiatorType,G=w.duration;if(k&&G&&mg(M)){for(M=0,G=w.responseEnd,u+=1;u<a.length;u++){var J=a[u],le=J.startTime;if(le>G)break;var he=J.transferSize,xe=J.initiatorType;he&&mg(xe)&&(J=J.responseEnd,M+=he*(J<G?1:(G-le)/(J-le)))}if(--u,n+=8*(k+M)/(w.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Fu=null,Uu=null;function Xo(t){return t.nodeType===9?t:t.ownerDocument}function gg(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 xg(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 $u(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 qu=null;function w_(){var t=window.event;return t&&t.type==="popstate"?t===qu?!1:(qu=t,!0):(qu=null,!1)}var vg=typeof setTimeout=="function"?setTimeout:void 0,C_=typeof clearTimeout=="function"?clearTimeout:void 0,bg=typeof Promise=="function"?Promise:void 0,k_=typeof queueMicrotask=="function"?queueMicrotask:typeof bg<"u"?function(t){return bg.resolve(null).then(t).catch(E_)}:vg;function E_(t){setTimeout(function(){throw t})}function Vr(t){return t==="head"}function yg(t,n){var a=n,u=0;do{var w=a.nextSibling;if(t.removeChild(a),w&&w.nodeType===8)if(a=w.data,a==="/$"||a==="/&"){if(u===0){t.removeChild(w),gs(n);return}u--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")u++;else if(a==="html")ga(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,ga(a);for(var k=a.firstChild;k;){var M=k.nextSibling,G=k.nodeName;k[Ms]||G==="SCRIPT"||G==="STYLE"||G==="LINK"&&k.rel.toLowerCase()==="stylesheet"||a.removeChild(k),k=M}}else a==="body"&&ga(t.ownerDocument.body);a=w}while(a);gs(n)}function _g(t,n){var a=t;t=0;do{var u=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||""),u&&u.nodeType===8)if(a=u.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=u}while(a)}function Wu(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":Wu(a),Xl(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function j_(t,n,a,u){for(;t.nodeType===1;){var w=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Ms])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=Fn(t.nextSibling),t===null)break}return null}function N_(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Fn(t.nextSibling),t===null))return null;return t}function Sg(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Fn(t.nextSibling),t===null))return null;return t}function Gu(t){return t.data==="$?"||t.data==="$~"}function Vu(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function T_(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var u=function(){n(),a.removeEventListener("DOMContentLoaded",u)};a.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function Fn(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 Yu=null;function wg(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Fn(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function Cg(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 kg(t,n,a){switch(n=Xo(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 ga(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Xl(t)}var Un=new Map,Eg=new Set;function Zo(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Cr=Z.d;Z.d={f:A_,r:D_,D:L_,C:R_,L:M_,m:O_,X:I_,S:B_,M:z_};function A_(){var t=Cr.f(),n=Uo();return t||n}function D_(t){var n=Oi(t);n!==null&&n.tag===5&&n.type==="form"?$p(n):Cr.r(t)}var fs=typeof document>"u"?null:document;function jg(t,n,a){var u=fs;if(u&&typeof n=="string"&&n){var w=Mn(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),Eg.has(w)||(Eg.add(w),t={rel:t,crossOrigin:a,href:n},u.querySelector(w)===null&&(n=u.createElement("link"),Jt(n,"link",t),qt(n),u.head.appendChild(n)))}}function L_(t){Cr.D(t),jg("dns-prefetch",t,null)}function R_(t,n){Cr.C(t,n),jg("preconnect",t,n)}function M_(t,n,a){Cr.L(t,n,a);var u=fs;if(u&&t&&n){var w='link[rel="preload"][as="'+Mn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(w+='[imagesrcset="'+Mn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(w+='[imagesizes="'+Mn(a.imageSizes)+'"]')):w+='[href="'+Mn(t)+'"]';var k=w;switch(n){case"style":k=ps(t);break;case"script":k=ms(t)}Un.has(k)||(t=m({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),Un.set(k,t),u.querySelector(w)!==null||n==="style"&&u.querySelector(xa(k))||n==="script"&&u.querySelector(va(k))||(n=u.createElement("link"),Jt(n,"link",t),qt(n),u.head.appendChild(n)))}}function O_(t,n){Cr.m(t,n);var a=fs;if(a&&t){var u=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+Mn(u)+'"][href="'+Mn(t)+'"]',k=w;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=ms(t)}if(!Un.has(k)&&(t=m({rel:"modulepreload",href:t},n),Un.set(k,t),a.querySelector(w)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(va(k)))return}u=a.createElement("link"),Jt(u,"link",t),qt(u),a.head.appendChild(u)}}}function B_(t,n,a){Cr.S(t,n,a);var u=fs;if(u&&t){var w=Bi(u).hoistableStyles,k=ps(t);n=n||"default";var M=w.get(k);if(!M){var G={loading:0,preload:null};if(M=u.querySelector(xa(k)))G.loading=5;else{t=m({rel:"stylesheet",href:t,"data-precedence":n},a),(a=Un.get(k))&&Ku(t,a);var J=M=u.createElement("link");qt(J),Jt(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,Qo(M,n,u)}M={type:"stylesheet",instance:M,count:1,state:G},w.set(k,M)}}}function I_(t,n){Cr.X(t,n);var a=fs;if(a&&t){var u=Bi(a).hoistableScripts,w=ms(t),k=u.get(w);k||(k=a.querySelector(va(w)),k||(t=m({src:t,async:!0},n),(n=Un.get(w))&&Xu(t,n),k=a.createElement("script"),qt(k),Jt(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},u.set(w,k))}}function z_(t,n){Cr.M(t,n);var a=fs;if(a&&t){var u=Bi(a).hoistableScripts,w=ms(t),k=u.get(w);k||(k=a.querySelector(va(w)),k||(t=m({src:t,async:!0,type:"module"},n),(n=Un.get(w))&&Xu(t,n),k=a.createElement("script"),qt(k),Jt(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},u.set(w,k))}}function Ng(t,n,a,u){var w=(w=Q.current)?Zo(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=ps(a.href),a=Bi(w).hoistableStyles,u=a.get(n),u||(u={type:"style",instance:null,count:0,state:null},a.set(n,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=ps(a.href);var k=Bi(w).hoistableStyles,M=k.get(t);if(M||(w=w.ownerDocument||w,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(t,M),(k=w.querySelector(xa(t)))&&!k._p&&(M.instance=k,M.state.loading=5),Un.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},Un.set(t,a),k||H_(w,t,a,M.state))),n&&u===null)throw Error(s(528,""));return M}if(n&&u!==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=ms(a),a=Bi(w).hoistableScripts,u=a.get(n),u||(u={type:"script",instance:null,count:0,state:null},a.set(n,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function ps(t){return'href="'+Mn(t)+'"'}function xa(t){return'link[rel="stylesheet"]['+t+"]"}function Tg(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function H_(t,n,a,u){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?u.loading=1:(n=t.createElement("link"),u.preload=n,n.addEventListener("load",function(){return u.loading|=1}),n.addEventListener("error",function(){return u.loading|=2}),Jt(n,"link",a),qt(n),t.head.appendChild(n))}function ms(t){return'[src="'+Mn(t)+'"]'}function va(t){return"script[async]"+t}function Ag(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var u=t.querySelector('style[data-href~="'+Mn(a.href)+'"]');if(u)return n.instance=u,qt(u),u;var w=m({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),qt(u),Jt(u,"style",w),Qo(u,a.precedence,t),n.instance=u;case"stylesheet":w=ps(a.href);var k=t.querySelector(xa(w));if(k)return n.state.loading|=4,n.instance=k,qt(k),k;u=Tg(a),(w=Un.get(w))&&Ku(u,w),k=(t.ownerDocument||t).createElement("link"),qt(k);var M=k;return M._p=new Promise(function(G,J){M.onload=G,M.onerror=J}),Jt(k,"link",u),n.state.loading|=4,Qo(k,a.precedence,t),n.instance=k;case"script":return k=ms(a.src),(w=t.querySelector(va(k)))?(n.instance=w,qt(w),w):(u=a,(w=Un.get(k))&&(u=m({},a),Xu(u,w)),t=t.ownerDocument||t,w=t.createElement("script"),qt(w),Jt(w,"link",u),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&&(u=n.instance,n.state.loading|=4,Qo(u,a.precedence,t));return n.instance}function Qo(t,n,a){for(var u=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=u.length?u[u.length-1]:null,k=w,M=0;M<u.length;M++){var G=u[M];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 Ku(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function Xu(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var Jo=null;function Dg(t,n,a){if(Jo===null){var u=new Map,w=Jo=new Map;w.set(a,u)}else w=Jo,u=w.get(a),u||(u=new Map,w.set(a,u));if(u.has(t))return u;for(u.set(t,null),a=a.getElementsByTagName(t),w=0;w<a.length;w++){var k=a[w];if(!(k[Ms]||k[Kt]||t==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var M=k.getAttribute(n)||"";M=t+M;var G=u.get(M);G?G.push(k):u.set(M,[k])}}return u}function Lg(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function P_(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 Rg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function F_(t,n,a,u){if(a.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var w=ps(u.href),k=n.querySelector(xa(w));if(k){n=k._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=el.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=k,qt(k);return}k=n.ownerDocument||n,u=Tg(u),(w=Un.get(w))&&Ku(u,w),k=k.createElement("link"),qt(k);var M=k;M._p=new Promise(function(G,J){M.onload=G,M.onerror=J}),Jt(k,"link",u),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=el.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var Zu=0;function U_(t,n){return t.stylesheets&&t.count===0&&nl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var u=setTimeout(function(){if(t.stylesheets&&nl(t,t.stylesheets),t.unsuspend){var k=t.unsuspend;t.unsuspend=null,k()}},6e4+n);0<t.imgBytes&&Zu===0&&(Zu=62500*S_());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&nl(t,t.stylesheets),t.unsuspend)){var k=t.unsuspend;t.unsuspend=null,k()}},(t.imgBytes>Zu?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(w)}}:null}function el(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var tl=null;function nl(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,tl=new Map,n.forEach($_,t),tl=null,el.call(t))}function $_(t,n){if(!(n.state.loading&4)){var a=tl.get(t);if(a)var u=a.get(null);else{a=new Map,tl.set(t,a);for(var w=t.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<w.length;k++){var M=w[k];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(a.set(M.dataset.precedence,M),u=M)}u&&a.set(null,u)}w=n.instance,M=w.getAttribute("data-precedence"),k=a.get(M)||u,k===u&&a.set(null,w),a.set(M,w),this.count++,u=el.bind(this),w.addEventListener("load",u),w.addEventListener("error",u),k?k.parentNode.insertBefore(w,k.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(w,t.firstChild)),n.state.loading|=4}}var ba={$$typeof:y,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function q_(t,n,a,u,w,k,M,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=Ls(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ls(0),this.hiddenUpdates=Ls(null),this.identifierPrefix=u,this.onUncaughtError=w,this.onCaughtError=k,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function Mg(t,n,a,u,w,k,M,G,J,le,he,xe){return t=new q_(t,n,a,M,J,le,he,xe,G),n=1,k===!0&&(n|=24),k=_n(3,null,null,n),t.current=k,k.stateNode=t,n=Ac(),n.refCount++,t.pooledCache=n,n.refCount++,k.memoizedState={element:u,isDehydrated:a,cache:n},Mc(k),t}function Og(t){return t?(t=Gi,t):Gi}function Bg(t,n,a,u,w,k){w=Og(w),u.context===null?u.context=w:u.pendingContext=w,u=Br(n),u.payload={element:a},k=k===void 0?null:k,k!==null&&(u.callback=k),a=Ir(t,u,n),a!==null&&(xn(a,t,n),Zs(a,t,n))}function Ig(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function Qu(t,n){Ig(t,n),(t=t.alternate)&&Ig(t,n)}function zg(t){if(t.tag===13||t.tag===31){var n=ci(t,67108864);n!==null&&xn(n,t,67108864),Qu(t,67108864)}}function Hg(t){if(t.tag===13||t.tag===31){var n=En();n=Vl(n);var a=ci(t,n);a!==null&&xn(a,t,n),Qu(t,n)}}var rl=!0;function W_(t,n,a,u){var w=V.T;V.T=null;var k=Z.p;try{Z.p=2,Ju(t,n,a,u)}finally{Z.p=k,V.T=w}}function G_(t,n,a,u){var w=V.T;V.T=null;var k=Z.p;try{Z.p=8,Ju(t,n,a,u)}finally{Z.p=k,V.T=w}}function Ju(t,n,a,u){if(rl){var w=ed(u);if(w===null)Hu(t,n,u,il,a),Fg(t,u);else if(Y_(w,t,n,a,u))u.stopPropagation();else if(Fg(t,u),n&4&&-1<V_.indexOf(t)){for(;w!==null;){var k=Oi(w);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var M=Be(k.pendingLanes);if(M!==0){var G=k;for(G.pendingLanes|=2,G.entangledLanes|=2;M;){var J=1<<31-$e(M);G.entanglements[1]|=J,M&=~J}er(k),(ut&6)===0&&(Po=Ge()+500,fa(0))}}break;case 31:case 13:G=ci(k,2),G!==null&&xn(G,k,2),Uo(),Qu(k,2)}if(k=ed(u),k===null&&Hu(t,n,u,il,a),k===w)break;w=k}w!==null&&u.stopPropagation()}else Hu(t,n,u,null,a)}}function ed(t){return t=nc(t),td(t)}var il=null;function td(t){if(il=null,t=Mi(t),t!==null){var n=d(t);if(n===null)t=null;else{var a=n.tag;if(a===13){if(t=p(n),t!==null)return t;t=null}else if(a===31){if(t=l(n),t!==null)return t;t=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return il=t,null}function Pg(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(ct()){case de:return 2;case be:return 8;case re:case Se:return 32;case Ce:return 268435456;default:return 32}default:return 32}}var nd=!1,Yr=null,Kr=null,Xr=null,ya=new Map,_a=new Map,Zr=[],V_="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 Fg(t,n){switch(t){case"focusin":case"focusout":Yr=null;break;case"dragenter":case"dragleave":Kr=null;break;case"mouseover":case"mouseout":Xr=null;break;case"pointerover":case"pointerout":ya.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":_a.delete(n.pointerId)}}function Sa(t,n,a,u,w,k){return t===null||t.nativeEvent!==k?(t={blockedOn:n,domEventName:a,eventSystemFlags:u,nativeEvent:k,targetContainers:[w]},n!==null&&(n=Oi(n),n!==null&&zg(n)),t):(t.eventSystemFlags|=u,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function Y_(t,n,a,u,w){switch(n){case"focusin":return Yr=Sa(Yr,t,n,a,u,w),!0;case"dragenter":return Kr=Sa(Kr,t,n,a,u,w),!0;case"mouseover":return Xr=Sa(Xr,t,n,a,u,w),!0;case"pointerover":var k=w.pointerId;return ya.set(k,Sa(ya.get(k)||null,t,n,a,u,w)),!0;case"gotpointercapture":return k=w.pointerId,_a.set(k,Sa(_a.get(k)||null,t,n,a,u,w)),!0}return!1}function Ug(t){var n=Mi(t.target);if(n!==null){var a=d(n);if(a!==null){if(n=a.tag,n===13){if(n=p(a),n!==null){t.blockedOn=n,tf(t.priority,function(){Hg(a)});return}}else if(n===31){if(n=l(a),n!==null){t.blockedOn=n,tf(t.priority,function(){Hg(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 sl(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=ed(t.nativeEvent);if(a===null){a=t.nativeEvent;var u=new a.constructor(a.type,a);tc=u,a.target.dispatchEvent(u),tc=null}else return n=Oi(a),n!==null&&zg(n),t.blockedOn=a,!1;n.shift()}return!0}function $g(t,n,a){sl(t)&&a.delete(n)}function K_(){nd=!1,Yr!==null&&sl(Yr)&&(Yr=null),Kr!==null&&sl(Kr)&&(Kr=null),Xr!==null&&sl(Xr)&&(Xr=null),ya.forEach($g),_a.forEach($g)}function al(t,n){t.blockedOn===n&&(t.blockedOn=null,nd||(nd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,K_)))}var ol=null;function qg(t){ol!==t&&(ol=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ol===t&&(ol=null);for(var n=0;n<t.length;n+=3){var a=t[n],u=t[n+1],w=t[n+2];if(typeof u!="function"){if(td(u||a)===null)continue;break}var k=Oi(a);k!==null&&(t.splice(n,3),n-=3,eu(k,{pending:!0,data:w,method:a.method,action:u},u,w))}}))}function gs(t){function n(J){return al(J,t)}Yr!==null&&al(Yr,t),Kr!==null&&al(Kr,t),Xr!==null&&al(Xr,t),ya.forEach(n),_a.forEach(n);for(var a=0;a<Zr.length;a++){var u=Zr[a];u.blockedOn===t&&(u.blockedOn=null)}for(;0<Zr.length&&(a=Zr[0],a.blockedOn===null);)Ug(a),a.blockedOn===null&&Zr.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(u=0;u<a.length;u+=3){var w=a[u],k=a[u+1],M=w[dn]||null;if(typeof k=="function")M||qg(a);else if(M){var G=null;if(k&&k.hasAttribute("formAction")){if(w=k,M=k[dn]||null)G=M.formAction;else if(td(w)!==null)continue}else G=M.action;typeof G=="function"?a[u+1]=G:(a.splice(u,3),u-=3),qg(a)}}}function Wg(){function t(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(M){return w=M})},focusReset:"manual",scroll:"manual"})}function n(){w!==null&&(w(),w=null),u||setTimeout(a,20)}function a(){if(!u&&!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 u=!1,w=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),w!==null&&(w(),w=null)}}}function rd(t){this._internalRoot=t}ll.prototype.render=rd.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,u=En();Bg(a,u,t,n,null,null)},ll.prototype.unmount=rd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Bg(t.current,2,null,t,null,null),Uo(),n[Ri]=null}};function ll(t){this._internalRoot=t}ll.prototype.unstable_scheduleHydration=function(t){if(t){var n=ef();t={blockedOn:null,target:t,priority:n};for(var a=0;a<Zr.length&&n!==0&&n<Zr[a].priority;a++);Zr.splice(a,0,t),a===0&&Ug(t)}};var Gg=r.version;if(Gg!=="19.2.4")throw Error(s(527,Gg,"19.2.4"));Z.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=f(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var X_={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cl.isDisabled&&cl.supportsFiber)try{st=cl.inject(X_),it=cl}catch{}}return Ca.createRoot=function(t,n){if(!c(t))throw Error(s(299));var a=!1,u="",w=Jp,k=em,M=tm;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onUncaughtError!==void 0&&(w=n.onUncaughtError),n.onCaughtError!==void 0&&(k=n.onCaughtError),n.onRecoverableError!==void 0&&(M=n.onRecoverableError)),n=Mg(t,1,!1,null,null,a,u,null,w,k,M,Wg),t[Ri]=n.current,zu(t),new rd(n)},Ca.hydrateRoot=function(t,n,a){if(!c(t))throw Error(s(299));var u=!1,w="",k=Jp,M=em,G=tm,J=null;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(w=a.identifierPrefix),a.onUncaughtError!==void 0&&(k=a.onUncaughtError),a.onCaughtError!==void 0&&(M=a.onCaughtError),a.onRecoverableError!==void 0&&(G=a.onRecoverableError),a.formState!==void 0&&(J=a.formState)),n=Mg(t,1,!0,n,a??null,u,w,J,k,M,G,Wg),n.context=Og(null),a=n.current,u=En(),u=Vl(u),w=Br(u),w.callback=null,Ir(a,w,u),a=u,n.current.lanes=a,Rs(n,a),er(n),t[Ri]=n.current,zu(t),new ll(n)},Ca.version="19.2.4",Ca}var nx;function c1(){if(nx)return ad.exports;nx=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(),ad.exports=l1(),ad.exports}var u1=c1();const d1=Dl(u1);function h1(e,r){if(e instanceof RegExp)return{keys:!1,pattern:e};var i,s,c,d,p=[],l="",h=e.split("/");for(h[0]||h.shift();c=h.shift();)i=c[0],i==="*"?(p.push(i),l+=c[1]==="?"?"(?:/(.*))?":"/(.*)"):i===":"?(s=c.indexOf("?",1),d=c.indexOf(".",1),p.push(c.substring(1,~s?s:~d?d:c.length)),l+=~s&&!~d?"(?:/([^/]+?))?":"/([^/]+?)",~d&&(l+=(~s?"?":"")+"\\"+c.substring(d))):l+="/"+c;return{keys:p,pattern:new RegExp("^"+l+(r?"(?=$|/)":"/?$"),"i")}}var ud={exports:{}},dd={};/**
|
|
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 rx;function f1(){if(rx)return dd;rx=1;var e=Ll();function r(m,b){return m===b&&(m!==0||1/m===1/b)||m!==m&&b!==b}var i=typeof Object.is=="function"?Object.is:r,s=e.useState,c=e.useEffect,d=e.useLayoutEffect,p=e.useDebugValue;function l(m,b){var S=b(),E=s({inst:{value:S,getSnapshot:b}}),C=E[0].inst,x=E[1];return d(function(){C.value=S,C.getSnapshot=b,h(C)&&x({inst:C})},[m,S,b]),c(function(){return h(C)&&x({inst:C}),m(function(){h(C)&&x({inst:C})})},[m]),p(S),S}function h(m){var b=m.getSnapshot;m=m.value;try{var S=b();return!i(m,S)}catch{return!0}}function f(m,b){return b()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:l;return dd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,dd}var ix;function p1(){return ix||(ix=1,ud.exports=f1()),ud.exports}var m1=p1();const g1=i1.useInsertionEffect,x1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",v1=x1?U.useLayoutEffect:U.useEffect,b1=g1||v1,Vv=e=>{const r=U.useRef([e,(...i)=>r[0](...i)]).current;return b1(()=>{r[0]=e}),r[1]},y1="popstate",ih="pushState",sh="replaceState",_1="hashchange",sx=[y1,ih,sh,_1],S1=e=>{for(const r of sx)addEventListener(r,e);return()=>{for(const r of sx)removeEventListener(r,e)}},Yv=(e,r)=>m1.useSyncExternalStore(S1,e,r),ax=()=>location.search,w1=({ssrSearch:e}={})=>Yv(ax,e!=null?()=>e:ax),ox=()=>location.pathname,C1=({ssrPath:e}={})=>Yv(ox,e!=null?()=>e:ox),k1=(e,{replace:r=!1,state:i=null}={})=>history[r?sh:ih](i,"",e),E1=(e={})=>[C1(e),k1],lx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[lx]>"u"){for(const e of[ih,sh]){const r=history[e];history[e]=function(){const i=r.apply(this,arguments),s=new Event(e);return s.arguments=arguments,dispatchEvent(s),i}}Object.defineProperty(window,lx,{value:!0})}const j1=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",Kv=(e="")=>e==="/"?"":e,N1=(e,r)=>e[0]==="~"?e.slice(1):Kv(r)+e,T1=(e="",r)=>j1(cx(Kv(e)),cx(r)),cx=e=>{try{return decodeURI(e)}catch{return e}},Xv={hook:E1,searchHook:w1,parser:h1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,i)=>e(r,i)},Zv=U.createContext(Xv),Ns=()=>U.useContext(Zv),Qv={},Jv=U.createContext(Qv),A1=()=>U.useContext(Jv),Rl=e=>{const[r,i]=e.hook(e);return[T1(e.base,r),Vv((s,c)=>e.aroundNav(i,N1(s,e.base),c))]},sr=()=>Rl(Ns()),ah=(e,r,i,s)=>{const{pattern:c,keys:d}=r instanceof RegExp?{keys:!1,pattern:r}:e(r||"*",s),p=c.exec(i)||[],[l,...h]=p;return l!==void 0?[!0,(()=>{const f=d!==!1?Object.fromEntries(d.map((m,b)=>[m,h[b]])):p.groups;let g={...h};return f&&Object.assign(g,f),g})(),...s?[l]:[]]:[!1,null]},oh=e=>ah(Ns().parser,e,sr()[0]),D1=({children:e,...r})=>{var g,m,b;const i=Ns(),s=r.hook?Xv:i;let c=s;const[d,p=r.ssrSearch??""]=((g=r.ssrPath)==null?void 0:g.split("?"))??[];d&&(r.ssrSearch=p,r.ssrPath=d),r.hrefs=r.hrefs??((m=r.hook)==null?void 0:m.hrefs),r.searchHook=r.searchHook??((b=r.hook)==null?void 0:b.searchHook);let l=U.useRef({}),h=l.current,f=h;for(let S in s){const E=S==="base"?s[S]+(r[S]??""):r[S]??s[S];h===f&&E!==f[S]&&(l.current=f={...f}),f[S]=E,(E!==s[S]||E!==c[S])&&(c=f)}return U.createElement(Zv.Provider,{value:c,children:e})},ux=({children:e,component:r},i)=>r?U.createElement(r,{params:i}):typeof e=="function"?e(i):e,L1=e=>{let r=U.useRef(Qv);const i=r.current;return r.current=Object.keys(e).length!==Object.keys(i).length||Object.entries(e).some(([s,c])=>c!==i[s])?e:i},ka=({path:e,nest:r,match:i,...s})=>{const c=Ns(),[d]=Rl(c),[p,l,h]=i??ah(c.parser,e,d,r),f=L1({...A1(),...l});if(!p)return null;const g=h?U.createElement(D1,{base:h},ux(s,f)):ux(s,f);return U.createElement(Jv.Provider,{value:f,children:g})},An=U.forwardRef((e,r)=>{const i=Ns(),[s,c]=Rl(i),{to:d="",href:p=d,onClick:l,asChild:h,children:f,className:g,replace:m,state:b,transition:S,...E}=e,C=Vv(_=>{_.ctrlKey||_.metaKey||_.altKey||_.shiftKey||_.button!==0||(l==null||l(_),_.defaultPrevented||(_.preventDefault(),c(p,e)))}),x=i.hrefs(p[0]==="~"?p.slice(1):i.base+p,i);return h&&U.isValidElement(f)?U.cloneElement(f,{onClick:C,href:x}):U.createElement("a",{...E,onClick:C,href:x,className:g!=null&&g.call?g(s===p):g,children:f,ref:r})}),eb=e=>Array.isArray(e)?e.flatMap(r=>eb(r&&r.type===U.Fragment?r.props.children:r)):[e],R1=({children:e,location:r})=>{const i=Ns(),[s]=Rl(i);for(const c of eb(e)){let d=0;if(U.isValidElement(c)&&(d=ah(i.parser,c.props.path,r||s,c.props.nest))[0])return U.cloneElement(c,{match:d})}return null},dx=e=>{let r;const i=new Set,s=(f,g)=>{const m=typeof f=="function"?f(r):f;if(!Object.is(m,r)){const b=r;r=g??(typeof m!="object"||m===null)?m:Object.assign({},r,m),i.forEach(S=>S(r,b))}},c=()=>r,l={setState:s,getState:c,getInitialState:()=>h,subscribe:f=>(i.add(f),()=>i.delete(f))},h=r=e(s,c,l);return l},M1=(e=>e?dx(e):dx),O1=e=>e;function B1(e,r=O1){const i=ln.useSyncExternalStore(e.subscribe,ln.useCallback(()=>r(e.getState()),[e,r]),ln.useCallback(()=>r(e.getInitialState()),[e,r]));return ln.useDebugValue(i),i}const hx=e=>{const r=M1(e),i=s=>B1(r,s);return Object.assign(i,r),i},Xn=(e=>e?hx(e):hx);async function _e(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 I1(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function vl(){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 z1{constructor(r){kr(this,"ws",null);kr(this,"handlers",new Set);kr(this,"statusHandler",null);kr(this,"baseUrl");kr(this,"isReconnecting",!1);kr(this,"connectingPromise",null);kr(this,"lastCloseCode",0);kr(this,"reconnectAttempts",0);this.baseUrl=r}getUrl(){const r=localStorage.getItem("openfox_token");if(r){const i=this.baseUrl.includes("?")?"&":"?";return`${this.baseUrl}${i}token=${encodeURIComponent(r)}`}return this.baseUrl}setToken(r){localStorage.setItem("openfox_token",r)}clearToken(){localStorage.removeItem("openfox_token")}hasToken(){return!!localStorage.getItem("openfox_token")}getLastCloseCode(){return this.lastCloseCode}onStatusChange(r){this.statusHandler=r}connect(){var r,i;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN?Promise.resolve():(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.CONNECTING?this.connectingPromise:(this.connectingPromise=new Promise((s,c)=>{try{const d=this.getUrl();this.ws=new WebSocket(d);const p=setTimeout(()=>{var l;((l=this.ws)==null?void 0:l.readyState)===WebSocket.CONNECTING&&(this.ws.close(),c(new Error("Connection timeout")))},5e3);this.ws.onopen=()=>{var l;clearTimeout(p),this.isReconnecting=!1,this.connectingPromise=null,(l=this.statusHandler)==null||l.call(this,"connected"),s()},this.ws.onclose=l=>{var h,f,g;clearTimeout(p),this.lastCloseCode=l.code,((h=this.ws)==null?void 0:h.readyState)===WebSocket.CONNECTING?(this.connectingPromise=null,(f=this.statusHandler)==null||f.call(this,"disconnected"),c(new Error(`Connection closed: ${l.code}`))):(this.connectingPromise=null,(g=this.statusHandler)==null||g.call(this,"disconnected"),this.attemptReconnect())},this.ws.onerror=l=>{clearTimeout(p),console.error("WebSocket error:",l),this.connectingPromise=null,c(l)},this.ws.onmessage=l=>{try{const h=JSON.parse(l.data);I1(h)&&this.handlers.forEach(f=>f(h))}catch(h){console.error("Failed to parse WebSocket message:",h)}}}catch(d){this.connectingPromise=null,c(d)}}),this.connectingPromise))}attemptReconnect(){var s;if(([1e3,1005,1006,4e3].includes(this.lastCloseCode)||this.lastCloseCode===0)&&this.hasToken()){console.log("[WS] Auth failure detected, not auto-reconnecting");return}if(this.isReconnecting)return;this.isReconnecting=!0,(s=this.statusHandler)==null||s.call(this,"reconnecting");const i=Math.min(1e3*Math.pow(2,this.reconnectAttempts||0),3e4);this.reconnectAttempts=(this.reconnectAttempts||0)+1,setTimeout(()=>{this.isReconnecting=!1,this.connect().catch(()=>{})},i)}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=vl(),c={id:s,type:r,payload:i};return this.ws.send(JSON.stringify(c)),s}subscribe(r){return this.handlers.add(r),()=>this.handlers.delete(r)}get isConnected(){var r;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN}}const H1=`ws://${window.location.hostname}:${window.location.port||"10469"}/ws`,Ft=new z1(H1);let ul=[],hd=null,bl=null;function P1(){hd===null&&(hd=requestAnimationFrame(()=>{hd=null,bl==null||bl()}))}const nr=Xn()((e,r)=>(bl=()=>{if(ul.length===0)return;const i=ul;ul=[],e(s=>({logs:[...s.logs,...i]}))},{workdir:null,status:null,logs:[],config:null,loading:!1,setWorkdir:i=>{r().workdir!==i&&(e({workdir:i,status:null,logs:[],config:null,loading:!0}),i&&(r().fetchStatus(),r().fetchConfig()))},fetchStatus:async()=>{const i=r().workdir;if(i)try{const c=await(await _e(`/api/dev-server?workdir=${encodeURIComponent(i)}`)).json();e({status:c,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const i=r().workdir;if(i)try{const c=await(await _e(`/api/dev-server/config?workdir=${encodeURIComponent(i)}`)).json();e({config:c.config??null})}catch{}},fetchLogs:async()=>{const i=r().workdir;if(i)try{const d=(await(await _e(`/api/dev-server/logs?workdir=${encodeURIComponent(i)}`)).json()).logs.map(p=>({stream:p.stream,content:p.content}));e({logs:d})}catch{}},start:async()=>{const i=r().workdir;if(i)try{const c=await(await _e(`/api/dev-server/start?workdir=${encodeURIComponent(i)}`,{method:"POST"})).json();e({status:c,logs:[]})}catch{}},stop:async()=>{const i=r().workdir;if(i)try{const c=await(await _e(`/api/dev-server/stop?workdir=${encodeURIComponent(i)}`,{method:"POST"})).json();e({status:c})}catch{}},restart:async()=>{const i=r().workdir;if(i)try{const c=await(await _e(`/api/dev-server/restart?workdir=${encodeURIComponent(i)}`,{method:"POST"})).json();e({status:c,logs:[]})}catch{}},saveConfig:async i=>{const s=r().workdir;if(s)try{const d=await(await _e(`/api/dev-server/config?workdir=${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})).json();e({config:d.config??i}),r().fetchStatus()}catch{}},handleMessage:i=>{const s=r().workdir;if(s)switch(i.type){case"devServer.output":{const c=i.payload;if(c.workdir!==s)return;ul.push({stream:c.stream,content:c.content}),P1();break}case"devServer.state":{const c=i.payload;if(c.workdir!==s)return;e(d=>({status:d.status?{...d.status,state:c.state,errorMessage:c.errorMessage}:d.status}));break}}}})),F1=3e4;function U1(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"auto":return"Auto";case"unknown":return""}}const Ht=Xn((e,r)=>({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 _e("/api/config");if(!i.ok)throw new Error("Failed to fetch config");const s=await i.json();e({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 _e("/api/model/refresh",{method:"POST"});if(!i.ok)throw new Error("Failed to refresh model");const s=await i.json(),d=Ee.getState().currentSession;if(d!=null&&d.providerId&&d.providerModel){e({llmStatus:s.llmStatus,backend:s.backend});return}e({model:s.model,llmStatus:s.llmStatus,backend:s.backend})}catch(i){console.error("Failed to refresh model:",i)}},activateProvider:async i=>{const{activeProviderId:s,providers:c}=r();if(i===s)return!0;e({activating:!0,error:null});try{const d=await _e(`/api/providers/${i}/activate`,{method:"POST"});if(!d.ok){const l=await d.json();throw new Error(l.error??"Failed to activate provider")}const p=await d.json();return e({activeProviderId:p.activeProviderId,model:p.model,backend:p.backend,providers:c.map(l=>({...l,isActive:l.id===p.activeProviderId})),activating:!1}),!0}catch(d){return e({error:d instanceof Error?d.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(i,s)=>{const{providers:c}=r();e({activeProviderId:i,model:s,defaultModelSelection:`${i}/${s}`,providers:c.map(d=>({...d,isActive:d.id===i}))})},updateModelContext:async(i,s,c)=>{e({activating:!0,error:null});try{const d=await _e(`/api/providers/${i}/models/${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contextWindow:c})});if(!d.ok){const h=await d.json();throw new Error(h.error??"Failed to update model context")}const p=await d.json(),{providers:l}=r();return e({providers:l.map(h=>h.id===i?{...h,models:h.models.map(f=>f.id===s?{...f,contextWindow:c,source:"user"}:f)}:h),activating:!1}),p.contextState&&Ee.getState().updateContextState(p.contextState),!0}catch(d){return e({error:d instanceof Error?d.message:"Failed to update model context",activating:!1}),!1}},refreshProviderModels:async i=>{e({activating:!0,error:null});try{const s=await _e(`/api/providers/${i}/refresh`,{method:"POST"});if(!s.ok){const p=await s.json();throw new Error(p.error??"Failed to refresh models")}const c=await s.json(),{providers:d}=r();return e({providers:d.map(p=>p.id===i?{...p,models:c.models}:p),activating:!1}),!0}catch(s){return e({error:s instanceof Error?s.message:"Failed to refresh models",activating:!1}),!1}},startAutoRefresh:()=>{const{autoRefreshInterval:i,refreshModel:s}=r();if(i)return;const c=setInterval(()=>{s()},F1);e({autoRefreshInterval:c})},stopAutoRefresh:()=>{const{autoRefreshInterval:i}=r();i&&(clearInterval(i),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:i,activeProviderId:s}=r();return i.find(c=>c.id===s)},getModelContext:i=>{const{providers:s,activeProviderId:c}=r(),d=s.find(l=>l.id===c);if(!d)return 2e5;const p=d.models.find(l=>l.id===i);return(p==null?void 0:p.contextWindow)??2e5}})),Ut=Xn((e,r)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await _e("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch{e({loading:!1})}},createProject:async(i,s)=>{try{const c=await _e("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,workdir:s})});if(!c.ok)return null;const d=await c.json();return await r().listProjects(),d.project}catch{return null}},loadProject:async i=>{try{const s=await _e(`/api/projects/${i}`);if(!s.ok)return null;const c=await s.json();return e({currentProject:c.project}),r().projects.length===0&&await r().listProjects(),c.project}catch{return null}},updateProject:async(i,s)=>{var c;try{const d=await _e(`/api/projects/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!d.ok)return null;const p=await d.json();return((c=r().currentProject)==null?void 0:c.id)===i&&e({currentProject:p.project}),await r().listProjects(),p.project}catch{return null}},deleteProject:async i=>{var s;try{return(await _e(`/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})}})),ei={GLOBAL_INSTRUCTIONS:"global_instructions",NOTIFICATION_SETTINGS:"notification_settings"},ti=Xn(e=>({settings:{},loading:{},getSetting:async r=>{e(i=>({loading:{...i.loading,[r]:!0}}));try{const s=await(await _e(`/api/settings/${r}`)).json();return e(c=>({settings:{...c.settings,[r]:s.value??""},loading:{...c.loading,[r]:!1}})),s.value}catch{return e(i=>({loading:{...i.loading,[r]:!1}})),null}},setSetting:async(r,i)=>{e(s=>({loading:{...s.loading,[r]:!0}}));try{const c=await(await _e(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:i})})).json();e(d=>({settings:{...d.settings,[r]:c.value??""},loading:{...d.loading,[r]:!1}}))}catch{e(s=>({loading:{...s.loading,[r]:!1}}))}}})),fx=[{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"}],$1=[{key:"planner",label:"Planner"},{key:"build",label:"Builder"},{key:"sub-agent",label:"Sub-agent"}],q1=[{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"}],lh={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"},rr={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},Pd={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...rr},waiting_for_user:{...rr},phase_done:{...rr},phase_blocked:{...rr},new_message:{...rr}},agentOverrides:{}};function tb(e,r,i){var d;const s=e.events[r];if(!i)return s;const c=(d=e.agentOverrides[i])==null?void 0:d[r];return c?{soundEnabled:c.soundEnabled??s.soundEnabled,browserNotification:c.browserNotification??s.browserNotification,customSoundUrl:c.customSoundUrl!==void 0?c.customSoundUrl:s.customSoundUrl}:s}const Ei=Xn((e,r)=>({settings:Pd,loaded:!1,load:()=>{ti.getState().getSetting(ei.NOTIFICATION_SETTINGS);const s=ti.subscribe(d=>{const p=d.settings[ei.NOTIFICATION_SETTINGS];if(p!==void 0)try{const l=JSON.parse(p);e({settings:px(l),loaded:!0})}catch{e({loaded:!0})}}),c=ti.getState().settings[ei.NOTIFICATION_SETTINGS];if(c)try{const d=JSON.parse(c);e({settings:px(d),loaded:!0})}catch{e({loaded:!0})}return s},update:i=>{e({settings:i}),fd(i)},updateEvent:(i,s)=>{const c=r().settings,d={...c,events:{...c.events,[i]:{...c.events[i],...s}}};e({settings:d}),fd(d)},updateAgentOverride:(i,s,c)=>{var h;const d=r().settings,p={...d.agentOverrides};if(c===null){if(p[i]){const f={...p[i]};delete f[s],Object.keys(f).length===0?delete p[i]:p[i]=f}}else p[i]={...p[i],[s]:{...((h=p[i])==null?void 0:h[s])??{},...c}};const l={...d,agentOverrides:p};e({settings:l}),fd(l)}}));function fd(e){ti.getState().setSetting(ei.NOTIFICATION_SETTINGS,JSON.stringify(e))}function px(e){var r,i,s,c,d;return{soundEnabled:e.soundEnabled??Pd.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??Pd.browserNotificationEnabled,events:{complete:{...rr,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...rr,...(i=e.events)==null?void 0:i.waiting_for_user},phase_done:{...rr,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...rr,...(c=e.events)==null?void 0:c.phase_blocked},new_message:{...rr,...(d=e.events)==null?void 0:d.new_message}},agentOverrides:e.agentOverrides??{}}}const mx=new Map;function W1(e){let r=mx.get(e);return r||(r=new Audio(e),r.volume=.5,mx.set(e,r)),r}let nb=typeof Notification<"u"?Notification.permission:"denied";function G1(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(nb=e,e))}const V1={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},Y1={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 K1(e){typeof Notification>"u"||nb==="granted"&&(document.hasFocus()||new Notification(V1[e],{body:Y1[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function Wa(e,r){const{settings:i}=Ei.getState(),s=tb(i,e,r);if(i.soundEnabled&&s.soundEnabled){const c=s.customSoundUrl??lh[e],d=W1(c);d.currentTime=0,d.play().catch(()=>{})}i.browserNotificationEnabled&&s.browserNotification&&K1(e)}const X1=e=>Wa("complete",e),Z1=e=>Wa("phase_done",e),Q1=e=>Wa("phase_blocked",e),gx=e=>Wa("waiting_for_user",e),xx=e=>Wa("new_message",e);let pd=!1;const Ea=new Set,It={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let ks=null,nn=null;function md(){ks===null&&(ks=requestAnimationFrame(()=>{ks=null,nn==null||nn()}))}function Si(){ks!==null&&(cancelAnimationFrame(ks),ks=null)}function Dt(e,r){return r!==null&&e.sessionId===r}function J1(e,r,i){return e.id!==void 0||Dt(e,r)||i===!0&&e.sessionId!==void 0}function eS(e,r){return e.includes(r)?e:[...e,r]}function ja(e,r){return e.filter(i=>i!==r)}function tS(e,r){const i=e.find(c=>c.id===r.id),s=i?{...i,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,messageCount:r.messages.length,criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(c=>c.status.type==="passed").length}:{id:r.id,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,createdAt:"",updatedAt:"",criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(c=>c.status.type==="passed").length,messageCount:r.messages.length};return i?e.map(c=>c.id===r.id?s:c):[s,...e]}function nS(e,r,i){return e.map(s=>{const c=(i==null?void 0:i.id)===s.id?i:null,d=r.find(p=>p.id===s.id);return{...s,title:s.title??(d==null?void 0:d.title),mode:(c==null?void 0:c.mode)??(d==null?void 0:d.mode)??s.mode,phase:(c==null?void 0:c.phase)??(d==null?void 0:d.phase)??s.phase,isRunning:(c==null?void 0:c.isRunning)??(d==null?void 0:d.isRunning)??s.isRunning,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}const vx=new Map;function ws(e,r){var d;const i=r===((d=e.currentSession)==null?void 0:d.id)?e.currentSession:null,s=e.sessions.find(p=>p.id===r),c=(i==null?void 0:i.mode)??(s==null?void 0:s.mode);return c==="planner"?"planner":c==="builder"?"build":"planner"}function rS(e,r){if(e.type==="chat.done"){const i=e.payload,s=ws(r,e.sessionId);i.reason==="complete"&&X1(s),i.reason==="waiting_for_user"&&gx(s);return}if(e.type==="chat.path_confirmation"){const i=ws(r,e.sessionId);gx(i);return}if(e.type==="task.completed"){const i=ws(r,e.sessionId);Z1(i);return}if(e.type==="phase.changed"&&e.sessionId){const i=e.payload,s=vx.get(e.sessionId)??null;if(vx.set(e.sessionId,i.phase),s===i.phase)return;const c=ws(r,e.sessionId);i.phase==="blocked"&&Q1(c)}}const Ee=Xn((e,r)=>(nn=()=>{const i=It;if(!i.messageId)return;const s=i.deltaContent.length>0,c=i.thinkingContent.length>0,d=i.toolOutput.length>0;if(!s&&!c&&!d)return;const p=i.deltaContent,l=i.thinkingContent,h=i.toolOutput;i.deltaContent="",i.thinkingContent="",i.toolOutput=[],e(f=>{var m;const g=f.streamingMessage;if(g&&g.id===i.messageId){let b={...g};if(s&&(b.content=b.content+p),c&&(b.thinkingContent=(b.thinkingContent??"")+l),d){const S=new Set;b.toolCalls=(m=b.toolCalls)==null?void 0:m.map(C=>{const x=h.filter(_=>_.callId===C.id);return x.length===0?C:(S.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...x.map(_=>({stream:_.stream,content:_.content}))]})});const E=h.filter(C=>!S.has(C.callId));E.length>0&&It.toolOutput.push(...E)}return{streamingMessage:b}}if(d){const b=new Set,S=f.messages.map(C=>{var _;if(C.id!==i.messageId)return C;const x=(_=C.toolCalls)==null?void 0:_.map(v=>{const y=h.filter(j=>j.callId===v.id);return y.length===0?v:(b.add(v.id),{...v,streamingOutput:[...v.streamingOutput??[],...y.map(j=>({stream:j.stream,content:j.content}))]})});return{...C,toolCalls:x}}),E=h.filter(C=>!b.has(C.callId));return E.length>0&&It.toolOutput.push(...E),{messages:S}}return f})},{connectionStatus:"disconnected",showPasswordModal:!1,passwordModalRetry:!1,sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,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 _e("/api/auth")).json()).requiresAuth}catch{}if(s&&!Ft.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Ft.onStatusChange(c=>{e({connectionStatus:c}),c==="connected"&&r().listSessions(void 0)});try{if(await Ft.connect(),!pd){pd=!0;const c=r().handleServerMessage;Ft.subscribe(c)}}catch(c){console.error("Failed to connect:",c);const d=Ft.getLastCloseCode();if(!Ft.hasToken()&&(d===1006||d===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}e({connectionStatus:"disconnected"})}},disconnect:()=>{Ft.disconnect(),pd=!1,e({connectionStatus:"disconnected",showPasswordModal:!1})},submitPassword:async i=>{try{const s=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:i})});if(!s.ok){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}const{token:c}=await s.json();Ft.setToken(c),e({showPasswordModal:!1,connectionStatus:"disconnected"});const{listProjects:d}=Ut.getState(),{fetchConfig:p}=Ht.getState();d(),p(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Ft.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(i,s)=>{try{e({pendingSessionCreate:!0});const c=await _e("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:i,title:s})});if(!c.ok)return e({pendingSessionCreate:!1}),null;const d=await c.json();return Ft.send("session.load",{sessionId:d.session.id}),d.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async i=>{try{const s=r().currentSession;!s||s.id!==i?(Si(),e({currentSession:null,unreadSessionIds:ja(r().unreadSessionIds,i),messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:ja(r().unreadSessionIds,i)});const c=await _e(`/api/sessions/${i}`);if(!c.ok)return;const d=await c.json();e({currentSession:d.session,messages:d.messages??[],contextState:d.contextState,queuedMessages:d.queueState??[]}),Ft.send("session.load",{sessionId:i})}catch{}},listSessions:async(i,s=20)=>{try{const c=new URLSearchParams;c.set("limit",String(s)),i&&c.set("projectId",i);const p=await(await _e(`/api/sessions?${c.toString()}`)).json();e({sessions:p.sessions??[],sessionsHasMore:i?p.hasMore??!1:!0})}catch{}},loadMoreSessions:async i=>{const s=r();if(!(s.sessionsPaginationLoading||!s.sessionsHasMore)){e({sessionsPaginationLoading:!0});try{const c=new URLSearchParams;c.set("limit","20"),c.set("offset",String(s.sessions.length)),c.set("projectId",i);const p=await(await _e(`/api/sessions?${c.toString()}`)).json();e(l=>({sessions:[...l.sessions,...p.sessions??[]],sessionsHasMore:p.hasMore??!1,sessionsPaginationLoading:!1}))}catch{e({sessionsPaginationLoading:!1})}}},deleteSession:async i=>{var s;try{return(await _e(`/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 _e(`/api/projects/${i}/sessions`,{method:"DELETE"})).ok?(await r().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{Si(),e(i=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:i.currentSession?ja(i.unreadSessionIds,i.currentSession.id):i.unreadSessionIds}))},sendMessage:async(i,s,c)=>{var p;const d=(p=r().currentSession)==null?void 0:p.id;if(d){e({streamingMessageId:null});try{const h=await(await _e(`/api/sessions/${d}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c==null?void 0:c.messageKind})})).json();h.queueState&&e({queuedMessages:h.queueState})}catch(l){console.error("Error sending message:",l)}}},stopGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i&&!r().abortInProgress){Si(),nn==null||nn(),e({abortInProgress:!0});try{await _e(`/api/sessions/${i}/stop`,{method:"POST"})}catch(c){console.error("Error stopping generation:",c)}}},continueGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i){e({streamingMessageId:null});try{await _e(`/api/sessions/${i}/continue`,{method:"POST"})}catch(c){console.error("Error continuing generation:",c)}}},launchRunner:(i,s,c)=>{e({streamingMessageId:null});const d={};i!=null&&i.trim()&&(d.content=i),s&&s.length>0&&(d.attachments=s),c&&(d.workflowId=c),Ft.send("runner.launch",d)},switchMode:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const d=await _e(`/api/sessions/${s}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:i})});if(!d.ok){console.error("Failed to switch mode:",await d.json());return}const p=await d.json();p.session&&e({currentSession:p.session})}catch(d){console.error("Error switching mode:",d)}},switchDangerLevel:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const d=await _e(`/api/sessions/${s}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:i})});if(!d.ok){console.error("Failed to switch danger level:",await d.json());return}const p=await d.json();p.session&&e({currentSession:p.session})}catch(d){console.error("Error switching danger level:",d)}},acceptAndBuild:(i,s,c)=>{e({streamingMessageId:null});const d={};i&&(d.workflowId=i),s!=null&&s.trim()&&(d.content=s),c&&c.length>0&&(d.attachments=c),Ft.send("mode.accept",d)},editCriteria:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const d=await _e(`/api/sessions/${s}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:i})});d.ok||console.error("Failed to update criteria:",await d.json())}catch(d){console.error("Error updating criteria:",d)}},compactContext:()=>{Ft.send("context.compact",{})},setSessionProvider:async(i,s)=>{var c;try{const d=(c=r().currentSession)==null?void 0:c.id;if(!d)return null;const p=await _e(`/api/sessions/${d}/provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:i,...s?{model:s}:{}})});if(!p.ok)return null;const l=await p.json();return e({currentSession:l.session,messages:l.messages??[],contextState:l.contextState}),l.session}catch{return null}},updateContextState:i=>{e({contextState:i})},confirmPath:async(i,s,c=!1)=>{var p;const d=(p=r().currentSession)==null?void 0:p.id;if(d)try{await _e(`/api/sessions/${d}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,approved:s,alwaysAllow:c})})}catch(l){console.error("Error confirming path:",l)}},answerQuestion:async(i,s)=>{var d;const c=(d=r().currentSession)==null?void 0:d.id;if(c){try{await _e(`/api/sessions/${c}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,answer:s})})}catch(p){console.error("Error answering question:",p)}e({pendingQuestion:null})}},queueAsap:async(i,s,c)=>{var p;const d=(p=r().currentSession)==null?void 0:p.id;if(d)try{const h=await(await _e(`/api/sessions/${d}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c})})).json();h.queueState&&e({queuedMessages:h.queueState})}catch(l){console.error("Error queueing ASAP message:",l)}},queueCompletion:async(i,s,c)=>{var p;const d=(p=r().currentSession)==null?void 0:p.id;if(d)try{const h=await(await _e(`/api/sessions/${d}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c})})).json();h.queueState&&e({queuedMessages:h.queueState})}catch(l){console.error("Error queueing completion message:",l)}},cancelQueued:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const p=await(await _e(`/api/sessions/${s}/queue/${i}`,{method:"DELETE"})).json();p.queueState&&e({queuedMessages:p.queueState})}catch(d){console.error("Error canceling queued message:",d)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:i=>{var p,l,h,f,g,m,b,S,E,C,x,_,v,y,j,A,N,L,T,B,H,W,Y,$;const s=r();rS(i,s);const c=((p=s.currentSession)==null?void 0:p.id)??null,d=()=>{const I=i.sessionId;!I||I===c||e(P=>({unreadSessionIds:eS(P.unreadSessionIds,I)}))};switch(i.type){case"session.state":{const I=i.payload;if(!J1(i,c,s.pendingSessionCreate))break;Si();const P=I.messages.find(D=>D.isStreaming)??null,V=r().pendingSessionCreate===!0,Z=I.pendingConfirmations??[],R=s.pendingPathConfirmation??(Z.length>0?Z[0]??null:null);if(e({currentSession:I.session,sessions:tS(r().sessions,I.session),unreadSessionIds:ja(r().unreadSessionIds,I.session.id),messages:I.messages,streamingMessageId:(P==null?void 0:P.id)??null,streamingMessage:P,currentTodos:[],pendingPathConfirmation:R,error:null,...V?{pendingSessionCreate:I.session.id}:{}}),I.session.providerId&&I.session.providerModel){const D=Ht.getState();D.providers.find(q=>q.id===I.session.providerId)&&D.syncFromSession(I.session.providerId,I.session.providerModel)}break}case"session.list":{const I=i.payload;e(P=>({sessions:nS(I.sessions,P.sessions,P.currentSession)}));break}case"session.deleted":{const I=i.payload;e(P=>({unreadSessionIds:ja(P.unreadSessionIds,I.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const I=i.payload,P=i.sessionId,V=(l=r().currentSession)==null?void 0:l.id,Z=P&&P!==V;e(ee=>({sessions:ee.sessions.map(R=>R.id===P?{...R,isRunning:I.isRunning}:R)})),Z||e(ee=>({currentSession:ee.currentSession?{...ee.currentSession,isRunning:I.isRunning}:null,...I.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!Dt(i,((h=r().currentSession)==null?void 0:h.id)??null)){d();break}const I=i.payload;e(P=>P.messages.some(V=>V.id===I.message.id)?P:{messages:[...P.messages,I.message],streamingMessageId:I.message.isStreaming?I.message.id:P.streamingMessageId,streamingMessage:I.message.isStreaming?I.message:P.streamingMessage});break}case"chat.message_updated":{if(!Dt(i,((f=r().currentSession)==null?void 0:f.id)??null)){d();break}const I=i.payload,P=I.updates.isStreaming===!1&&r().streamingMessageId===I.messageId;P&&(Si(),nn==null||nn()),e(V=>{const Z=V.streamingMessage,ee=P;if(Z&&Z.id===I.messageId){const R={...Z,...I.updates};return{messages:V.messages.map(D=>D.id===I.messageId?R:D),streamingMessageId:ee?null:V.streamingMessageId,streamingMessage:ee?null:{...Z,...I.updates}}}return{messages:V.messages.map(R=>R.id===I.messageId?{...R,...I.updates}:R),streamingMessageId:ee?null:V.streamingMessageId}});break}case"chat.delta":{if(!Dt(i,((g=r().currentSession)==null?void 0:g.id)??null)){d();break}const I=i.payload;if(!Ea.has(I.messageId)){Ea.add(I.messageId);const P=ws(r(),i.sessionId);xx(P)}It.messageId=I.messageId,It.deltaContent+=I.content,md();break}case"chat.thinking":{if(!Dt(i,((m=r().currentSession)==null?void 0:m.id)??null)){d();break}const I=i.payload;if(!Ea.has(I.messageId)){Ea.add(I.messageId);const P=ws(r(),i.sessionId);xx(P)}It.messageId=I.messageId,It.thinkingContent+=I.content,md();break}case"chat.tool_preparing":{if(!Dt(i,((b=r().currentSession)==null?void 0:b.id)??null)){d();break}const I=i.payload;e(P=>{const V=P.streamingMessage;return V&&V.id===I.messageId?{streamingMessage:{...V,preparingToolCalls:[...V.preparingToolCalls??[],{index:I.index,name:I.name}]}}:{messages:P.messages.map(Z=>Z.id===I.messageId?{...Z,preparingToolCalls:[...Z.preparingToolCalls??[],{index:I.index,name:I.name}]}:Z)}});break}case"chat.tool_call":{if(!Dt(i,((S=r().currentSession)==null?void 0:S.id)??null)){d();break}const I=i.payload,P=V=>{var R;const Z=(R=V.preparingToolCalls)==null?void 0:R.filter((D,O)=>{var q;return D.name===I.tool?(q=V.preparingToolCalls)==null?void 0:q.slice(0,O).some(K=>K.name===I.tool):!0}),ee=It.toolOutput.filter(D=>D.callId===I.callId);return ee.length>0&&(It.toolOutput=It.toolOutput.filter(D=>D.callId!==I.callId)),{...V,toolCalls:[...V.toolCalls??[],{id:I.callId,name:I.tool,arguments:I.args,startedAt:Date.now(),...ee.length>0?{streamingOutput:ee.map(D=>({stream:D.stream,content:D.content}))}:{}}],...Z&&Z.length>0?{preparingToolCalls:Z}:{preparingToolCalls:void 0}}};e(V=>{const Z=V.streamingMessage;return Z&&Z.id===I.messageId?{streamingMessage:P(Z)}:{messages:V.messages.map(ee=>ee.id===I.messageId?P(ee):ee)}});break}case"chat.tool_output":{if(!Dt(i,((E=r().currentSession)==null?void 0:E.id)??null)){d();break}const I=i.payload;It.messageId=I.messageId,It.toolOutput.push({messageId:I.messageId,callId:I.callId,stream:I.stream,content:I.output}),md();break}case"chat.tool_result":{if(!Dt(i,((C=r().currentSession)==null?void 0:C.id)??null)){d();break}const I=i.payload,P=V=>{var ee;const Z=(ee=V.toolCalls)==null?void 0:ee.map(R=>R.id===I.callId?{...R,result:I.result}:R);return{...V,toolCalls:Z}};e(V=>{const Z=V.streamingMessage;return Z&&Z.id===I.messageId?{streamingMessage:P(Z)}:{messages:V.messages.map(ee=>ee.id===I.messageId?P(ee):ee)}});break}case"chat.vision_fallback":{if(!Dt(i,((x=r().currentSession)==null?void 0:x.id)??null)){d();break}const I=i.payload;e(P=>{const V=`${I.messageId}-${I.attachmentId}`,Z={...P.visionFallbackByMessage};return Z[V]={type:I.type,attachmentId:I.attachmentId,filename:I.filename,description:I.description},{visionFallbackByMessage:Z}});break}case"chat.todo":{if(!Dt(i,((_=r().currentSession)==null?void 0:_.id)??null)){d();break}const I=i.payload;e({currentTodos:I.todos});break}case"chat.summary":{if(!Dt(i,((v=r().currentSession)==null?void 0:v.id)??null)){d();break}const I=i.payload;e(P=>({currentSession:P.currentSession?{...P.currentSession,summary:I.summary}:null}));break}case"chat.progress":{if(!Dt(i,((y=r().currentSession)==null?void 0:y.id)??null)){d();break}const I=i.payload;console.log("Progress:",I.message,I.phase);break}case"chat.format_retry":{if(!Dt(i,((j=r().currentSession)==null?void 0:j.id)??null)){d();break}const I=i.payload;console.log("Format retry:",I.attempt,"/",I.maxAttempts);break}case"chat.done":{if(!Dt(i,((A=r().currentSession)==null?void 0:A.id)??null)){d();break}Si(),nn==null||nn();const I=i.payload,P=I.stats;It.messageId=null,It.deltaContent="",It.thinkingContent="",It.toolOutput=[],Ea.delete(I.messageId),e(V=>{const Z=V.streamingMessage,ee=Z&&Z.id===I.messageId?{...Z,isStreaming:!1,stats:P??Z.stats}:null;return{messages:V.messages.map(R=>R.id===I.messageId?ee??{...R,isStreaming:!1,stats:P??R.stats}:R),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!Dt(i,((N=r().currentSession)==null?void 0:N.id)??null)){d();break}Si(),nn==null||nn();const I=i.payload;console.error("Chat error:",I.error,"recoverable:",I.recoverable),I.recoverable||(It.messageId=null,It.deltaContent="",It.thinkingContent="",It.toolOutput=[]),e(P=>({error:{code:"CHAT_ERROR",message:I.error},streamingMessageId:I.recoverable?P.streamingMessageId:null,...I.recoverable?{}:{messages:P.streamingMessage?P.messages.map(V=>V.id===P.streamingMessage.id?P.streamingMessage:V):P.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!Dt(i,((L=r().currentSession)==null?void 0:L.id)??null)){d();break}const I=i.payload;e({pendingPathConfirmation:{callId:I.callId,tool:I.tool,paths:I.paths,workdir:I.workdir,reason:I.reason}});break}case"chat.ask_user":{if(!Dt(i,((T=r().currentSession)==null?void 0:T.id)??null)){d();return}const I=i.payload;e({pendingQuestion:{callId:I.callId,question:I.question}});break}case"mode.changed":{if(!Dt(i,((B=r().currentSession)==null?void 0:B.id)??null)){d();break}const I=i.payload;e(P=>({currentSession:P.currentSession?{...P.currentSession,mode:I.mode}:null}));break}case"phase.changed":{const I=i.payload,P=i.sessionId,V=(H=r().currentSession)==null?void 0:H.id,Z=P&&P!==V;e(ee=>({sessions:ee.sessions.map(R=>R.id===P?{...R,phase:I.phase}:R)})),Z||e(ee=>({currentSession:ee.currentSession?{...ee.currentSession,phase:I.phase}:null}));break}case"criteria.updated":{if(!Dt(i,((W=r().currentSession)==null?void 0:W.id)??null)){d();break}const I=i.payload;e(P=>({currentSession:P.currentSession?{...P.currentSession,criteria:I.criteria}:null}));break}case"context.state":{if(!Dt(i,((Y=r().currentSession)==null?void 0:Y.id)??null)){d();break}const I=i.payload;console.log("[session.handleServerMessage.context.state] Received context state:",I.context),e({contextState:I.context});break}case"session.name_generated":{const I=i.payload,P=i.sessionId,V=($=r().currentSession)==null?void 0:$.id;e(Z=>{const ee=Z.sessions.map(D=>D.id===P?{...D,title:I.name,updatedAt:new Date().toISOString()}:D),R=V===P?Z.currentSession?{...Z.currentSession,title:I.name,updatedAt:new Date().toISOString()}:null:Z.currentSession;return{sessions:ee,currentSession:R}});break}case"queue.state":{const I=i.payload;e({queuedMessages:I.messages});break}case"devServer.output":case"devServer.state":{nr.getState().handleMessage(i);break}case"error":{const I=i.payload;console.error("Server error:",I),e({error:{code:I.code,message:I.message},streamingMessageId:null});break}}}}));function rb(){return Ee(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function iS(){return Ee(e=>e.queuedMessages)}function sS(){return Ee(e=>e.abortInProgress)}function aS(){const e=Ee(s=>s.connect),r=Ee(s=>s.connectionStatus),i=Ei(s=>s.load);return U.useEffect(()=>{e()},[e]),U.useEffect(()=>{r==="connected"&&i()},[r,i]),{connectionStatus:r}}function Fd(){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=Ft.ws;!i||i.readyState!==WebSocket.OPEN||i.send(JSON.stringify({id:Fd(),type:e,payload:r}))}const ir=Xn((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 _e("/api/terminals");if(i.ok){const s=await i.json();e({sessions:s});const c=Ft.ws;if(c&&c.readyState===WebSocket.OPEN)for(const d of s)c.send(JSON.stringify({id:Fd(),type:"terminal.subscribe",payload:{sessionId:d.id}}))}}catch(i){console.error("Failed to fetch terminals:",i)}},createSession:async i=>{try{const s=await _e("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:i??r().workdir??void 0})});if(s.ok){const c=await s.json();e(p=>({sessions:[...p.sessions,c]}));const d=Ft.ws;d&&d.readyState===WebSocket.OPEN&&d.send(JSON.stringify({id:Fd(),type:"terminal.subscribe",payload:{sessionId:c.id}}))}}catch(s){console.error("Failed to create terminal:",s)}},writeSession:(i,s)=>{bx("terminal.write",{sessionId:i,data:s})},resizeSession:(i,s,c)=>{bx("terminal.resize",{sessionId:i,cols:s,rows:c})},killSession:async i=>{try{(await _e(`/api/terminals/${i}`,{method:"DELETE"})).ok&&e(c=>({sessions:c.sessions.filter(d=>d.id!==i)}))}catch(s){console.error("Failed to kill terminal:",s)}},handleMessage:i=>{switch(i.type){case"terminal.exit":{const{sessionId:s}=i.payload||{};s&&e(c=>{const d=c.sessions.filter(p=>p.id!==s);return d.length===0&&c.isOpen?{sessions:[],isOpen:!1}:{sessions:d}});break}}}}));Ft.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&ir.getState().handleMessage(e)});var ch=Gv();function un({isOpen:e,onClose:r,title:i,children:s,size:c="md"}){const d=U.useRef(null),p=U.useRef(null),l=U.useCallback(f=>{f.key==="Escape"&&r()},[r]);if(U.useEffect(()=>{var f,g;return e?(p.current=document.activeElement,(f=d.current)==null||f.focus(),document.body.style.overflow="hidden"):((g=p.current)==null||g.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}},[e]),U.useEffect(()=>{if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,l]),!e)return null;const h={sm:"max-w-sm md:max-w-sm",md:"max-w-[90vw] md:max-w-md",lg:"max-w-[90vw] md:max-w-2xl h-[80vh]",xl:"max-w-[90vw] md:max-w-4xl h-[80vh]",full:"max-w-[95vw] h-[90vh]"};return ch.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:r}),o.jsxs("div",{ref:d,tabIndex:-1,className:`relative w-full ${h[c]} bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]`,children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary truncate",children:i}),o.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors flex-shrink-0",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:"M6 18L18 6M6 6l12 12"})})})]}),o.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",children:s})]})]}),document.body)}const dt=U.forwardRef(({variant:e="secondary",size:r="md",className:i="",children:s,...c},d)=>{const p="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",l={primary:"bg-accent-primary/25 text-white hover:bg-accent-primary/40",secondary:"bg-bg-tertiary text-text-primary hover:bg-border",danger:"bg-accent-error text-white hover:bg-accent-error/80"},h={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:d,className:`${p} ${l[e]} ${h[r]} ${i}`,...c,children:s})});dt.displayName="Button";function oS(e){const r=new Audio(e);r.volume=.5,r.play().catch(()=>{})}function ib({value:e,defaultUrl:r,disabled:i,onChange:s}){const c=e??r;return o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("select",{value:c,disabled:i,onChange:d=>{const p=d.target.value;s(p===r?null:p)},className:"px-2 py-1 text-xs bg-bg-tertiary border border-border rounded focus:outline-none focus:ring-1 focus:ring-accent-primary disabled:opacity-40",children:q1.map(({url:d,label:p})=>o.jsxs("option",{value:d,children:[p,d===r?" (default)":""]},d))}),o.jsx("button",{onClick:()=>oS(c),disabled:i,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary disabled:opacity-40 disabled:cursor-not-allowed transition-colors",title:"Preview sound",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.536 8.464a5 5 0 010 7.072M17.95 6.05a8 8 0 010 11.9M6.5 8.8h-2a1 1 0 00-1 1v4.4a1 1 0 001 1h2l4.5 3.5V5.3L6.5 8.8z"})})})]})}function lS(){const e=Ei(h=>h.settings),r=Ei(h=>h.update),i=Ei(h=>h.updateEvent),s=Ei(h=>h.updateAgentOverride),c=Ei(h=>h.load),[d,p]=U.useState(null);U.useEffect(()=>{c()},[c]);const l=async()=>{await G1()==="granted"&&r({...e,browserNotificationEnabled:!0})};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(yx,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:h=>r({...e,soundEnabled:h})}),o.jsx(yx,{label:"Browser notifications",description:"Show desktop notifications when the window is not focused",checked:e.browserNotificationEnabled,onChange:h=>{h&&typeof Notification<"u"&&Notification.permission!=="granted"?l():r({...e,browserNotificationEnabled:h})}}),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:"Event Configuration"}),fx.map(({key:h,label:f,description:g})=>o.jsx(cS,{event:h,label:f,description:g,config:e.events[h],onUpdate:m=>i(h,m),soundMasterEnabled:e.soundEnabled,browserMasterEnabled:e.browserNotificationEnabled},h))]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Per-Agent Overrides"}),o.jsx("p",{className:"text-xs text-text-muted",children:"Override notification settings for specific agent types. Unconfigured events use the global defaults above."}),$1.map(({key:h,label:f})=>o.jsxs("div",{className:"border border-border rounded",children:[o.jsxs("button",{className:"w-full flex items-center justify-between px-3 py-2 text-sm text-text-secondary hover:bg-bg-tertiary transition-colors rounded",onClick:()=>p(d===h?null:h),children:[o.jsx("span",{className:"font-medium",children:f}),o.jsx("svg",{className:`w-4 h-4 transition-transform ${d===h?"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"})})]}),d===h&&o.jsx("div",{className:"px-3 pb-3 space-y-3 border-t border-border pt-2",children:fx.map(({key:g,label:m})=>{var x;const b=(x=e.agentOverrides[h])==null?void 0:x[g],S=b!==void 0,E=tb(e,g,h),C=lh[g];return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[o.jsx("input",{type:"checkbox",checked:S,onChange:_=>{_.target.checked?s(h,g,{soundEnabled:E.soundEnabled,browserNotification:E.browserNotification}):s(h,g,null)},className:"rounded border-border"}),o.jsx("span",{className:`flex-1 ${S?"text-text-primary":"text-text-muted"}`,children:m}),S&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"flex items-center gap-1 text-text-secondary",children:[o.jsx("input",{type:"checkbox",checked:E.soundEnabled,onChange:_=>s(h,g,{soundEnabled:_.target.checked}),className:"rounded border-border"}),"Sound"]}),o.jsxs("label",{className:"flex items-center gap-1 text-text-secondary",children:[o.jsx("input",{type:"checkbox",checked:E.browserNotification,onChange:_=>s(h,g,{browserNotification:_.target.checked}),className:"rounded border-border"}),"Browser"]})]})]}),S&&E.soundEnabled&&o.jsx("div",{className:"ml-6",children:o.jsx(ib,{value:(b==null?void 0:b.customSoundUrl)??null,defaultUrl:C,onChange:_=>s(h,g,{customSoundUrl:_})})})]},g)})})]},h))]})]})}function yx({label:e,description:r,checked:i,onChange:s}){return o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[o.jsx("div",{className:"pt-0.5",children:o.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${i?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:c=>{c.preventDefault(),s(!i)},children:o.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${i?"translate-x-4":"translate-x-0.5"}`})})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm text-text-primary group-hover:text-accent-primary transition-colors",children:e}),o.jsx("div",{className:"text-xs text-text-muted",children:r})]})]})}function cS({event:e,label:r,description:i,config:s,onUpdate:c,soundMasterEnabled:d,browserMasterEnabled:p}){return o.jsxs("div",{className:"border border-border rounded px-3 py-2 space-y-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm text-text-primary",children:r}),o.jsx("div",{className:"text-xs text-text-muted",children:i})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("input",{type:"checkbox",checked:s.soundEnabled,onChange:l=>c({soundEnabled:l.target.checked}),disabled:!d,className:"rounded border-border"}),"Sound ",!d&&o.jsx("span",{className:"text-text-muted",children:"(master off)"})]}),o.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("input",{type:"checkbox",checked:s.browserNotification,onChange:l=>c({browserNotification:l.target.checked}),disabled:!p,className:"rounded border-border"}),"Browser notification ",!p&&o.jsx("span",{className:"text-text-muted",children:"(master off)"})]})]}),s.soundEnabled&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-text-muted",children:"Sound:"}),o.jsx(ib,{value:s.customSoundUrl,defaultUrl:lh[e],disabled:!d,onChange:l=>c({customSoundUrl:l})})]})]})}const sb=U.forwardRef(({icon:e,iconSize:r="w-3.5 h-3.5",className:i="",...s},c)=>o.jsx("button",{ref:c,type:"button",className:`p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors ${i}`,...s,children:o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:e})})}));sb.displayName="IconButton";const uS="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",ri=U.forwardRef((e,r)=>o.jsx(sb,{ref:r,icon:uS,title:"Edit",...e}));ri.displayName="EditButton";const Vn=Xn((e,r)=>({skills:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await _e("/api/skills/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchSkills:async()=>{e({loading:!0});try{const s=await(await _e("/api/skills")).json();e({skills:s.skills??[],defaultIds:s.defaultIds??r().defaultIds,modifiedIds:s.modifiedIds??[],loading:!1})}catch{e({loading:!1})}},toggleSkill:async i=>{try{const c=await(await _e(`/api/skills/${i}/toggle`,{method:"POST"})).json();e({skills:r().skills.map(d=>d.id===i?{...d,enabled:c.enabled}:d)})}catch{}},fetchSkill:async i=>{try{const s=await _e(`/api/skills/${i}`);return s.ok?await s.json():null}catch{return null}},createSkill:async i=>{try{const s=await _e("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?(await r().fetchSkills(),{success:!0}):{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},updateSkill:async(i,s)=>{try{const c=await _e(`/api/skills/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return c.ok?(await r().fetchSkills(),{success:!0}):{success:!1,error:(await c.json()).error}}catch{return{success:!1,error:"Network error"}}},deleteSkill:async i=>{try{return(await _e(`/api/skills/${i}`,{method:"DELETE"})).ok?(e({skills:r().skills.filter(c=>c.id!==i)}),!0):!1}catch{return!1}},restoreDefault:async i=>{try{return(await _e(`/api/skills/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchSkills(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await _e("/api/skills/restore-all-defaults",{method:"POST"})).ok?(await r().fetchSkills(),!0):!1}catch{return!1}}}));function dS(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function hS({isOpen:e}){const r=Vn(Q=>Q.skills),i=Vn(Q=>Q.modifiedIds),s=Vn(Q=>Q.loading),c=Vn(Q=>Q.fetchSkills),d=Vn(Q=>Q.toggleSkill),p=Vn(Q=>Q.fetchSkill),l=Vn(Q=>Q.createSkill),h=Vn(Q=>Q.updateSkill),f=Vn(Q=>Q.deleteSkill),g=Vn(Q=>Q.restoreDefault),m=Vn(Q=>Q.restoreAllDefaults),[b,S]=U.useState("list"),[E,C]=U.useState(null),[x,_]=U.useState(null),[v,y]=U.useState(""),[j,A]=U.useState(""),[N,L]=U.useState(""),[T,B]=U.useState("1.0.0"),[H,W]=U.useState(""),[Y,$]=U.useState(""),[I,P]=U.useState(!1),[V,Z]=U.useState(null),[ee,R]=U.useState(!1);U.useEffect(()=>{e&&(c(),S("list"),C(null),_(null),Z(null),R(!1))},[e,c]);const D=()=>{C(null),y(""),A(""),L(""),B("1.0.0"),W(""),$(""),S("edit")},O=async Q=>{const X=await p(Q);X&&(C(Q),y(X.metadata.name),A(X.metadata.id),L(X.metadata.description),B(X.metadata.version),W(X.prompt),$(""),S("edit"))},q=async Q=>{await f(Q),_(null)},F=async()=>{const Q=E??j;if(!Q||!v||!H){$("Name and prompt are required.");return}P(!0),$("");const X={metadata:{id:Q,name:v,description:N,version:T||"1.0.0"},prompt:H},z=E?await h(E,X):await l(X);if(P(!1),!z.success){$(z.error??"Failed to save skill.");return}S("list")},K=()=>{S("list")},te=Q=>{y(Q),E||A(dS(Q))};return b==="edit"?o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("button",{onClick:K,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Back to list",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:"M15 19l-7-7 7-7"})})}),o.jsx("span",{className:"text-sm font-medium text-text-primary",children:E?"Edit Skill":"New Skill"})]}),Y&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:Y}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),o.jsx("input",{value:v,onChange:Q=>te(Q.target.value),placeholder:"My Skill",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"})]}),o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["ID ",E&&o.jsx("span",{className:"text-text-muted",children:"(read-only)"})]}),o.jsx("input",{value:j,onChange:Q=>!E&&A(Q.target.value),readOnly:!!E,placeholder:"my-skill",className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary ${E?"opacity-60":""}`})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Description"}),o.jsx("input",{value:N,onChange:Q=>L(Q.target.value),placeholder:"Short description of what this skill provides",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"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Version"}),o.jsx("input",{value:T,onChange:Q=>B(Q.target.value),placeholder:"1.0.0",className:"w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary"})]})]})]}),o.jsxs("div",{className:"flex-1 min-h-[150px] mt-3 overflow-hidden",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:H,onChange:Q=>W(Q.target.value),placeholder:"Instructions the agent receives when this skill is loaded...",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"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-5 border-t border-border flex-shrink-0",children:[o.jsx(dt,{variant:"secondary",onClick:K,children:"Cancel"}),o.jsx(dt,{variant:"primary",onClick:F,disabled:I||!v||!H,children:I?"Saving...":"Save"})]})]}):o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Skills provide domain-specific knowledge that agents can load on demand."}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[i.length>0&&(ee?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await m(),R(!1)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Confirm"}),o.jsx("button",{onClick:()=>R(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:()=>R(!0),className:"px-2 py-1 rounded text-xs text-text-muted hover:text-amber-400 hover:bg-amber-500/10 transition-colors",title:"Restore all skills to defaults",children:"Restore Defaults"})),o.jsx(dt,{variant:"primary",size:"sm",onClick:D,children:"+ New"})]})]}),s&&r.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading skills..."}):r.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No skills installed."}):o.jsx("div",{className:"space-y-2",children:r.map(Q=>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:Q.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",Q.version]}),i.includes(Q.id)&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:Q.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[i.includes(Q.id)&&(V===Q.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await g(Q.id),Z(null)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Restore"}),o.jsx("button",{onClick:()=>Z(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:()=>Z(Q.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",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:"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(ri,{onClick:()=>O(Q.id)}),x===Q.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:()=>q(Q.id),className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs hover:bg-accent-error/30 transition-colors",children:"Delete"}),o.jsx("button",{onClick:()=>_(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:()=>_(Q.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete skill",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"})})}),o.jsx("button",{onClick:()=>d(Q.id),className:`relative w-9 h-5 rounded-full transition-colors flex-shrink-0 ml-1 ${Q.enabled?"bg-accent-primary":"bg-bg-primary"}`,title:Q.enabled?"Disable skill":"Enable skill",children:o.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${Q.enabled?"translate-x-4":"translate-x-0"}`})})]})]},Q.id))})]})}function fS({isOpen:e,onClose:r}){const[i,s]=U.useState("instructions");return o.jsx(un,{isOpen:e,onClose:r,title:"Settings",size:"lg",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(dl,{label:"Instructions",active:i==="instructions",onClick:()=>s("instructions")}),o.jsx(dl,{label:"Skills",active:i==="skills",onClick:()=>s("skills")}),o.jsx(dl,{label:"Notifications",active:i==="notifications",onClick:()=>s("notifications")}),o.jsx(dl,{label:"Advanced",active:i==="advanced",onClick:()=>s("advanced")})]}),i==="instructions"&&o.jsx(mS,{isOpen:e}),i==="skills"&&o.jsx(hS,{isOpen:e}),i==="notifications"&&o.jsx(lS,{}),i==="advanced"&&o.jsx(pS,{onClose:r})]})})}function pS({onClose:e}){const[,r]=sr();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(dt,{variant:"secondary",onClick:i,children:"Launch Onboarding"})]})})}function dl({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 mS({isOpen:e}){const r=ti(x=>x.settings),i=ti(x=>x.loading),s=ti(x=>x.getSetting),c=ti(x=>x.setSetting),d=r[ei.GLOBAL_INSTRUCTIONS]??"",p=i[ei.GLOBAL_INSTRUCTIONS]??!1,[l,h]=U.useState(d),[f,g]=U.useState(!1),[m,b]=U.useState(!1);U.useEffect(()=>{e&&s(ei.GLOBAL_INSTRUCTIONS)},[e,s]),U.useEffect(()=>{h(d),g(!1)},[d]);const S=async()=>{b(!0),c(ei.GLOBAL_INSTRUCTIONS,l),b(!1),g(!1)},E=()=>{h(d),g(!1)},C=p||m;return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),o.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),o.jsx("textarea",{value:l,onChange:x=>{h(x.target.value),g(!0)},placeholder:"Enter global instructions that apply to all projects...",className:"w-full h-64 px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:C})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(dt,{variant:"secondary",onClick:E,disabled:!f,children:"Discard"}),o.jsx(dt,{variant:"primary",onClick:S,disabled:!f||C,children:m?"Saving...":"Save"})]})]})}var gd={exports:{}},_x;function gS(){return _x||(_x=1,(function(e,r){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(p,l,h){var f=this&&this.__decorate||function(v,y,j,A){var N,L=arguments.length,T=L<3?y:A===null?A=Object.getOwnPropertyDescriptor(y,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(v,y,j,A);else for(var B=v.length-1;B>=0;B--)(N=v[B])&&(T=(L<3?N(T):L>3?N(y,j,T):N(y,j))||T);return L>3&&T&&Object.defineProperty(y,j,T),T},g=this&&this.__param||function(v,y){return function(j,A){y(j,A,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const m=h(9042),b=h(9924),S=h(844),E=h(4725),C=h(2585),x=h(3656);let _=l.AccessibilityManager=class extends S.Disposable{constructor(v,y,j,A){super(),this._terminal=v,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 b.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
58
|
-
`)))),this.register(this._terminal.onA11yTab((N=>this._handleTab(N)))),this.register(this._terminal.onKey((N=>this._handleKey(N.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,x.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,S.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(v){for(let y=0;y<v;y++)this._handleChar(" ")}_handleChar(v){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==v&&(this._charsToAnnounce+=v):this._charsToAnnounce+=v,v===`
|
|
59
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(v){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(v)||this._charsToConsume.push(v)}_refreshRows(v,y){this._liveRegionDebouncer.refresh(v,y,this._terminal.rows)}_renderRows(v,y){const j=this._terminal.buffer,A=j.lines.length.toString();for(let N=v;N<=y;N++){const L=j.lines.get(j.ydisp+N),T=[],B=(L==null?void 0:L.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(v,y){const j=v.target,A=this._rowElements[y===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(y===0?"1":`${this._terminal.buffer.lines.length}`)||v.relatedTarget!==A)return;let N,L;if(y===0?(N=j,L=this._rowElements.pop(),this._rowContainer.removeChild(L)):(N=this._rowElements.shift(),L=j,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),L.removeEventListener("focus",this._bottomBoundaryFocusListener),y===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(y===0?-1:1),this._rowElements[y===0?1:this._rowElements.length-2].focus(),v.preventDefault(),v.stopImmediatePropagation()}_handleSelectionChange(){var B;if(this._rowElements.length===0)return;const v=document.getSelection();if(!v)return;if(v.isCollapsed)return void(this._rowContainer.contains(v.anchorNode)&&this._terminal.clearSelection());if(!v.anchorNode||!v.focusNode)return void console.error("anchorNode and/or focusNode are null");let y={node:v.anchorNode,offset:v.anchorOffset},j={node:v.focusNode,offset:v.focusOffset};if((y.node.compareDocumentPosition(j.node)&Node.DOCUMENT_POSITION_PRECEDING||y.node===j.node&&y.offset>j.offset)&&([y,j]=[j,y]),y.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(y={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(y.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 Y=H instanceof Text?H.parentNode:H;let $=parseInt(Y==null?void 0:Y.getAttribute("aria-posinset"),10)-1;if(isNaN($))return console.warn("row is invalid. Race condition?"),null;const I=this._rowColumns.get(Y);if(!I)return console.warn("columns is null. Race condition?"),null;let P=W<I.length?I[W]:I.slice(-1)[0]+1;return P>=this._terminal.cols&&(++$,P=0),{row:$,column:P}},L=N(y),T=N(j);if(L&&T){if(L.row>T.row||L.row===T.row&&L.column>=T.column)throw new Error("invalid range");this._terminal.select(L.column,L.row,(T.row-L.row)*this._terminal.cols-L.column+T.column)}}_handleResize(v){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let y=this._rowContainer.children.length;y<this._terminal.rows;y++)this._rowElements[y]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[y]);for(;this._rowElements.length>v;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const v=this._coreBrowserService.mainDocument.createElement("div");return v.setAttribute("role","listitem"),v.tabIndex=-1,this._refreshRowDimensions(v),v}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let v=0;v<this._terminal.rows;v++)this._refreshRowDimensions(this._rowElements[v])}}_refreshRowDimensions(v){v.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=_=f([g(1,C.IInstantiationService),g(2,E.ICoreBrowserService),g(3,E.IRenderService)],_)},3614:(p,l)=>{function h(b){return b.replace(/\r?\n/g,"\r")}function f(b,S){return S?"\x1B[200~"+b+"\x1B[201~":b}function g(b,S,E,C){b=f(b=h(b),E.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),E.triggerDataEvent(b,!0),S.value=""}function m(b,S,E){const C=E.getBoundingClientRect(),x=b.clientX-C.left-10,_=b.clientY-C.top-10;S.style.width="20px",S.style.height="20px",S.style.left=`${x}px`,S.style.top=`${_}px`,S.style.zIndex="1000",S.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=h,l.bracketTextForPaste=f,l.copyHandler=function(b,S){b.clipboardData&&b.clipboardData.setData("text/plain",S.selectionText),b.preventDefault()},l.handlePasteEvent=function(b,S,E,C){b.stopPropagation(),b.clipboardData&&g(b.clipboardData.getData("text/plain"),S,E,C)},l.paste=g,l.moveTextAreaUnderMouseCursor=m,l.rightClickHandler=function(b,S,E,C,x){m(b,S,E),x&&C.rightClickSelect(b),S.value=C.selectionText,S.select()}},7239:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const f=h(1505);l.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(g,m,b){this._css.set(g,m,b)}getCss(g,m){return this._css.get(g,m)}setColor(g,m,b){this._color.set(g,m,b)}getColor(g,m){return this._color.get(g,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(h,f,g,m){h.addEventListener(f,g,m);let b=!1;return{dispose:()=>{b||(b=!0,h.removeEventListener(f,g,m))}}}},3551:function(p,l,h){var f=this&&this.__decorate||function(_,v,y,j){var A,N=arguments.length,L=N<3?v:j===null?j=Object.getOwnPropertyDescriptor(v,y):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(_,v,y,j);else for(var T=_.length-1;T>=0;T--)(A=_[T])&&(L=(N<3?A(L):N>3?A(v,y,L):A(v,y))||L);return N>3&&L&&Object.defineProperty(v,y,L),L},g=this&&this.__param||function(_,v){return function(y,j){v(y,j,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const m=h(3656),b=h(8460),S=h(844),E=h(2585),C=h(4725);let x=l.Linkifier=class extends S.Disposable{get currentLink(){return this._currentLink}constructor(_,v,y,j,A){super(),this._element=_,this._mouseService=v,this._renderService=y,this._bufferService=j,this._linkProviderService=A,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new b.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new b.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,S.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,S.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(_){this._lastMouseEvent=_;const v=this._positionFromMouseEvent(_,this._element,this._mouseService);if(!v)return;this._isMouseOut=!1;const y=_.composedPath();for(let j=0;j<y.length;j++){const A=y[j];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&v.x===this._lastBufferCell.x&&v.y===this._lastBufferCell.y||(this._handleHover(v),this._lastBufferCell=v)}_handleHover(_){if(this._activeLine!==_.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(_,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,_)||(this._clearCurrentLink(),this._askForLink(_,!0))}_askForLink(_,v){var j,A;this._activeProviderReplies&&v||((j=this._activeProviderReplies)==null||j.forEach((N=>{N==null||N.forEach((L=>{L.link.dispose&&L.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=_.y);let y=!1;for(const[N,L]of this._linkProviderService.linkProviders.entries())v?(A=this._activeProviderReplies)!=null&&A.get(N)&&(y=this._checkLinkProviderResult(N,_,y)):L.provideLinks(_.y,(T=>{var H,W;if(this._isMouseOut)return;const B=T==null?void 0:T.map((Y=>({link:Y})));(H=this._activeProviderReplies)==null||H.set(N,B),y=this._checkLinkProviderResult(N,_,y),((W=this._activeProviderReplies)==null?void 0:W.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(_.y,this._activeProviderReplies)}))}_removeIntersectingLinks(_,v){const y=new Set;for(let j=0;j<v.size;j++){const A=v.get(j);if(A)for(let N=0;N<A.length;N++){const L=A[N],T=L.link.range.start.y<_?0:L.link.range.start.x,B=L.link.range.end.y>_?this._bufferService.cols:L.link.range.end.x;for(let H=T;H<=B;H++){if(y.has(H)){A.splice(N--,1);break}y.add(H)}}}}_checkLinkProviderResult(_,v,y){var N;if(!this._activeProviderReplies)return y;const j=this._activeProviderReplies.get(_);let A=!1;for(let L=0;L<_;L++)this._activeProviderReplies.has(L)&&!this._activeProviderReplies.get(L)||(A=!0);if(!A&&j){const L=j.find((T=>this._linkAtPosition(T.link,v)));L&&(y=!0,this._handleNewLink(L))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!y)for(let L=0;L<this._activeProviderReplies.size;L++){const T=(N=this._activeProviderReplies.get(L))==null?void 0:N.find((B=>this._linkAtPosition(B.link,v)));if(T){y=!0,this._handleNewLink(T);break}}return y}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(_){if(!this._currentLink)return;const v=this._positionFromMouseEvent(_,this._element,this._mouseService);v&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,v)&&this._currentLink.link.activate(_,this._currentLink.link.text)}_clearCurrentLink(_,v){this._currentLink&&this._lastMouseEvent&&(!_||!v||this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=v)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,S.disposeArray)(this._linkCacheDisposables))}_handleNewLink(_){if(!this._lastMouseEvent)return;const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._linkAtPosition(_.link,v)&&(this._currentLink=_,this._currentLink.state={decorations:{underline:_.link.decorations===void 0||_.link.decorations.underline,pointerCursor:_.link.decorations===void 0||_.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,_.link,this._lastMouseEvent),_.link.decorations={},Object.defineProperties(_.link.decorations,{pointerCursor:{get:()=>{var y,j;return(j=(y=this._currentLink)==null?void 0:y.state)==null?void 0:j.decorations.pointerCursor},set:y=>{var j;(j=this._currentLink)!=null&&j.state&&this._currentLink.state.decorations.pointerCursor!==y&&(this._currentLink.state.decorations.pointerCursor=y,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",y))}},underline:{get:()=>{var y,j;return(j=(y=this._currentLink)==null?void 0:y.state)==null?void 0:j.decorations.underline},set:y=>{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)!==y&&(this._currentLink.state.decorations.underline=y,this._currentLink.state.isHovered&&this._fireUnderlineEvent(_.link,y))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((y=>{if(!this._currentLink)return;const j=y.start===0?0:y.start+1+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.ydisp+1+y.end;if(this._currentLink.link.range.start.y>=j&&this._currentLink.link.range.end.y<=A&&(this._clearCurrentLink(j,A),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(_,v,y){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!0),this._currentLink.state.decorations.pointerCursor&&_.classList.add("xterm-cursor-pointer")),v.hover&&v.hover(y,v.text)}_fireUnderlineEvent(_,v){const y=_.range,j=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(y.start.x-1,y.start.y-j-1,y.end.x,y.end.y-j-1,void 0);(v?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(_,v,y){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!1),this._currentLink.state.decorations.pointerCursor&&_.classList.remove("xterm-cursor-pointer")),v.leave&&v.leave(y,v.text)}_linkAtPosition(_,v){const y=_.range.start.y*this._bufferService.cols+_.range.start.x,j=_.range.end.y*this._bufferService.cols+_.range.end.x,A=v.y*this._bufferService.cols+v.x;return y<=A&&A<=j}_positionFromMouseEvent(_,v,y){const j=y.getCoords(_,v,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(_,v,y,j,A){return{x1:_,y1:v,x2:y,y2:j,cols:this._bufferService.cols,fg:A}}};l.Linkifier=x=f([g(1,C.IMouseService),g(2,C.IRenderService),g(3,E.IBufferService),g(4,C.ILinkProviderService)],x)},9042:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(p,l,h){var f=this&&this.__decorate||function(C,x,_,v){var y,j=arguments.length,A=j<3?x:v===null?v=Object.getOwnPropertyDescriptor(x,_):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,x,_,v);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(A=(j<3?y(A):j>3?y(x,_,A):y(x,_))||A);return j>3&&A&&Object.defineProperty(x,_,A),A},g=this&&this.__param||function(C,x){return function(_,v){x(_,v,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const m=h(511),b=h(2585);let S=l.OscLinkProvider=class{constructor(C,x,_){this._bufferService=C,this._optionsService=x,this._oscLinkService=_}provideLinks(C,x){var B;const _=this._bufferService.buffer.lines.get(C-1);if(!_)return void x(void 0);const v=[],y=this._optionsService.rawOptions.linkHandler,j=new m.CellData,A=_.getTrimmedLength();let N=-1,L=-1,T=!1;for(let H=0;H<A;H++)if(L!==-1||_.hasContent(H)){if(_.loadCell(H,j),j.hasExtendedAttrs()&&j.extended.urlId){if(L===-1){L=H,N=j.extended.urlId;continue}T=j.extended.urlId!==N}else L!==-1&&(T=!0);if(T||L!==-1&&H===A-1){const W=(B=this._oscLinkService.getLinkData(N))==null?void 0:B.uri;if(W){const Y={start:{x:L+1,y:C},end:{x:H+(T||H!==A-1?0:1),y:C}};let $=!1;if(!(y!=null&&y.allowNonHttpProtocols))try{const I=new URL(W);["http:","https:"].includes(I.protocol)||($=!0)}catch{$=!0}$||v.push({text:W,range:Y,activate:(I,P)=>y?y.activate(I,P,Y):E(0,P),hover:(I,P)=>{var V;return(V=y==null?void 0:y.hover)==null?void 0:V.call(y,I,P,Y)},leave:(I,P)=>{var V;return(V=y==null?void 0:y.leave)==null?void 0:V.call(y,I,P,Y)}})}T=!1,j.hasExtendedAttrs()&&j.extended.urlId?(L=H,N=j.extended.urlId):(L=-1,N=-1)}}x(v)}};function E(C,x){if(confirm(`Do you want to navigate to ${x}?
|
|
60
|
-
|
|
61
|
-
WARNING: This link could potentially be dangerous`)){const _=window.open();if(_){try{_.opener=null}catch{}_.location.href=x}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=S=f([g(0,b.IBufferService),g(1,b.IOptionsService),g(2,b.IOscLinkService)],S)},6193:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(h,f){this._renderCallback=h,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(h){return this._refreshCallbacks.push(h),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(h,f,g){this._rowCount=g,h=h!==void 0?h:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,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 h=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const h of this._refreshCallbacks)h(0);this._refreshCallbacks=[]}}},3236:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const f=h(3614),g=h(3656),m=h(3551),b=h(9042),S=h(3730),E=h(1680),C=h(3107),x=h(5744),_=h(2950),v=h(1296),y=h(428),j=h(4269),A=h(5114),N=h(8934),L=h(3230),T=h(9312),B=h(4725),H=h(6731),W=h(8055),Y=h(8969),$=h(8460),I=h(844),P=h(6114),V=h(8437),Z=h(2584),ee=h(7399),R=h(5941),D=h(9074),O=h(2585),q=h(5435),F=h(4567),K=h(779);class te extends Y.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=P,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new I.MutableDisposable),this._onCursorMove=this.register(new $.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new $.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new $.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new $.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new $.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new $.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new $.EventEmitter),this._onBlur=this.register(new $.EventEmitter),this._onA11yCharEmitter=this.register(new $.EventEmitter),this._onA11yTabEmitter=this.register(new $.EventEmitter),this._onWillOpen=this.register(new $.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(D.DecorationService),this._instantiationService.setService(O.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(B.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(S.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((z,ae)=>this.refresh(z,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((z=>this._reportWindowsOptions(z)))),this.register(this._inputHandler.onColor((z=>this._handleColorEvent(z)))),this.register((0,$.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,$.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,$.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,$.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((z=>this._afterResize(z.cols,z.rows)))),this.register((0,I.toDisposable)((()=>{var z,ae;this._customKeyEventHandler=void 0,(ae=(z=this.element)==null?void 0:z.parentNode)==null||ae.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const z of X){let ae,se="";switch(z.index){case 256:ae="foreground",se="10";break;case 257:ae="background",se="11";break;case 258:ae="cursor",se="12";break;default:ae="ansi",se="4;"+z.index}switch(z.type){case 0:const ge=W.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[z.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${Z.C0.ESC}]${se};${(0,R.toRgbString)(ge)}${Z.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((ve=>ve.ansi[z.index]=W.channels.toColor(...z.color)));else{const ve=ae;this._themeService.modifyColors((Ne=>Ne[ve]=W.channels.toColor(...z.color)))}break;case 2:this._themeService.restoreColor(z.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(Z.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(Z.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,z=this.buffer.lines.get(X);if(!z)return;const ae=Math.min(this.buffer.x,this.cols-1),se=this._renderService.dimensions.css.cell.height,ge=z.getWidth(ae),ve=this._renderService.dimensions.css.cell.width*ge,Ne=this.buffer.y*this._renderService.dimensions.css.cell.height,De=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=De+"px",this.textarea.style.top=Ne+"px",this.textarea.style.width=ve+"px",this.textarea.style.height=se+"px",this.textarea.style.lineHeight=se+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(z=>{this.hasSelection()&&(0,f.copyHandler)(z,this._selectionService)})));const X=z=>(0,f.handlePasteEvent)(z,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,g.addDisposableDomListener)(this.element,"paste",X)),P.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(z=>{z.button===2&&(0,f.rightClickHandler)(z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(z=>{(0,f.rightClickHandler)(z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),P.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(z=>{z.button===1&&(0,f.moveTextAreaUnderMouseCursor)(z,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 ae;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"),((ae=this.element)==null?void 0:ae.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 z=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),z.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",(se=>this.updateCursorStyle(se)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),z.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",b.promptLabel),P.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",(se=>this._handleTextAreaFocus(se)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(y.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(L.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(B.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((se=>this._onRender.fire(se)))),this.onResize((se=>this._renderService.resize(se.cols,se.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(_.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(z);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((se=>this.scrollLines(se.amount,se.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((se=>this.scrollLines(se.amount,se.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((se=>this._renderService.handleSelectionChanged(se.start,se.end,se.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((se=>{this.textarea.value=se,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((se=>{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",(se=>this._selectionService.handleMouseDown(se)))),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",(se=>this._handleScreenReaderModeOptionChange(se)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(x.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(se=>{!this._overviewRulerRenderer&&se&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(x.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(v.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,z=this.element;function ae(ve){const Ne=X._mouseService.getMouseReportCoords(ve,X.screenElement);if(!Ne)return!1;let De,Oe;switch(ve.overrideType||ve.type){case"mousemove":Oe=32,ve.buttons===void 0?(De=3,ve.button!==void 0&&(De=ve.button<3?ve.button:3)):De=1&ve.buttons?0:4&ve.buttons?1:2&ve.buttons?2:3;break;case"mouseup":Oe=0,De=ve.button<3?ve.button:3;break;case"mousedown":Oe=1,De=ve.button<3?ve.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(ve)===!1||X.viewport.getLinesScrolled(ve)===0)return!1;Oe=ve.deltaY<0?0:1,De=4;break;default:return!1}return!(Oe===void 0||De===void 0||De>4)&&X.coreMouseService.triggerMouseEvent({col:Ne.col,row:Ne.row,x:Ne.x,y:Ne.y,button:De,action:Oe,ctrl:ve.ctrlKey,alt:ve.altKey,shift:ve.shiftKey})}const se={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ge={mouseup:ve=>(ae(ve),ve.buttons||(this._document.removeEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.removeEventListener("mousemove",se.mousedrag)),this.cancel(ve)),wheel:ve=>(ae(ve),this.cancel(ve,!0)),mousedrag:ve=>{ve.buttons&&ae(ve)},mousemove:ve=>{ve.buttons||ae(ve)}};this.register(this.coreMouseService.onProtocolChange((ve=>{ve?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ve)),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&ve?se.mousemove||(z.addEventListener("mousemove",ge.mousemove),se.mousemove=ge.mousemove):(z.removeEventListener("mousemove",se.mousemove),se.mousemove=null),16&ve?se.wheel||(z.addEventListener("wheel",ge.wheel,{passive:!1}),se.wheel=ge.wheel):(z.removeEventListener("wheel",se.wheel),se.wheel=null),2&ve?se.mouseup||(se.mouseup=ge.mouseup):(this._document.removeEventListener("mouseup",se.mouseup),se.mouseup=null),4&ve?se.mousedrag||(se.mousedrag=ge.mousedrag):(this._document.removeEventListener("mousemove",se.mousedrag),se.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(z,"mousedown",(ve=>{if(ve.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ve))return ae(ve),se.mouseup&&this._document.addEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.addEventListener("mousemove",se.mousedrag),this.cancel(ve)}))),this.register((0,g.addDisposableDomListener)(z,"wheel",(ve=>{if(!se.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ve)===!1)return!1;if(!this.buffer.hasScrollback){const Ne=this.viewport.getLinesScrolled(ve);if(Ne===0)return;const De=Z.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ve.deltaY<0?"A":"B");let Oe="";for(let Fe=0;Fe<Math.abs(Ne);Fe++)Oe+=De;return this.coreService.triggerDataEvent(Oe,!0),this.cancel(ve,!0)}return this.viewport.handleWheel(ve)?this.cancel(ve):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)(z,"touchstart",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ve),this.cancel(ve)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(z,"touchmove",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ve)?void 0:this.cancel(ve)}),{passive:!1}))}refresh(X,z){var ae;(ae=this._renderService)==null||ae.refreshRows(X,z)}updateCursorStyle(X){var z;(z=this._selectionService)!=null&&z.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,z,ae=0){var se;ae===1?(super.scrollLines(X,z,ae),this.refresh(0,this.rows-1)):(se=this.viewport)==null||se.scrollLines(X)}paste(X){(0,f.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 z=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),z}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,z,ae){this._selectionService.setSelection(X,z,ae)}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,z){var ae;(ae=this._selectionService)==null||ae.selectLines(X,z)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const z=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!z&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;z||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,ee.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),ae.type===3||ae.type===2){const se=this.rows-1;return this.scrollLines(ae.type===2?-se:se),this.cancel(X,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(ae.cancel&&this.cancel(X,!0),!ae.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):(ae.key!==Z.C0.ETX&&ae.key!==Z.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,z){const ae=X.isMac&&!this.options.macOptionIsMeta&&z.altKey&&!z.ctrlKey&&!z.metaKey||X.isWindows&&z.altKey&&z.ctrlKey&&!z.metaKey||X.isWindows&&z.getModifierState("AltGraph");return z.type==="keypress"?ae:ae&&(!z.keyCode||z.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(z){return z.keyCode===16||z.keyCode===17||z.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let z;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)z=X.charCode;else if(X.which===null||X.which===void 0)z=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;z=X.which}return!(!z||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(z=String.fromCharCode(z),this._onKey.fire({key:z,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(z,!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 z=X.data;return this.coreService.triggerDataEvent(z,!0),this.cancel(X),!0}return!1}resize(X,z){X!==this.cols||z!==this.rows?super.resize(X,z):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,z){var ae,se;(ae=this._charSizeService)==null||ae.measure(),(se=this.viewport)==null||se.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 z=1;z<this.rows;z++)this.buffer.lines.push(this.buffer.getBlankLine(V.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 z,ae;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(z=this._selectionService)==null||z.reset(),this._decorationService.reset(),(ae=this.viewport)==null||ae.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(Z.C0.ESC+"[I"):this.coreService.triggerDataEvent(Z.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case q.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const z=this._renderService.dimensions.css.canvas.width.toFixed(0),ae=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.C0.ESC}[4;${ae};${z}t`);break;case q.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const se=this._renderService.dimensions.css.cell.width.toFixed(0),ge=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.C0.ESC}[6;${ge};${se}t`)}}cancel(X,z){if(this.options.cancelEvents||z)return X.preventDefault(),X.stopPropagation(),!1}}l.Terminal=te},9924:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(h,f=1e3){this._renderCallback=h,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(h,f,g){this._rowCount=g,h=h!==void 0?h:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const m=Date.now();if(m-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=m,this._innerRefresh();else if(!this._additionalRefreshRequested){const b=m-this._lastRefreshMs,S=this._debounceThresholdMS-b;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),S)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const h=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,f)}}},1680:function(p,l,h){var f=this&&this.__decorate||function(_,v,y,j){var A,N=arguments.length,L=N<3?v:j===null?j=Object.getOwnPropertyDescriptor(v,y):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(_,v,y,j);else for(var T=_.length-1;T>=0;T--)(A=_[T])&&(L=(N<3?A(L):N>3?A(v,y,L):A(v,y))||L);return N>3&&L&&Object.defineProperty(v,y,L),L},g=this&&this.__param||function(_,v){return function(y,j){v(y,j,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const m=h(3656),b=h(4725),S=h(8460),E=h(844),C=h(2585);let x=l.Viewport=class extends E.Disposable{constructor(_,v,y,j,A,N,L,T){super(),this._viewportElement=_,this._scrollArea=v,this._bufferService=y,this._optionsService=j,this._charSizeService=A,this._renderService=N,this._coreBrowserService=L,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 S.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(_){this._viewportElement.style.backgroundColor=_.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(_){if(_)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const v=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==v&&(this._lastRecordedBufferHeight=v,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const _=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==_&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=_),this._refreshAnimationFrame=null}syncScrollArea(_=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(_);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(_)}_handleScroll(_){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const v=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const _=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(_*(this._smoothScrollState.target-this._smoothScrollState.origin)),_<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(_,v){const y=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(v<0&&this._viewportElement.scrollTop!==0||v>0&&y<this._lastRecordedBufferHeight)||(_.cancelable&&_.preventDefault(),!1)}handleWheel(_){const v=this._getPixelsScrolled(_);return v!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+v:this._smoothScrollState.target+=v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=v,this._bubbleScroll(_,v))}scrollLines(_){if(_!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const v=_*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:_,suppressScrollEvent:!1})}_getPixelsScrolled(_){if(_.deltaY===0||_.shiftKey)return 0;let v=this._applyScrollModifier(_.deltaY,_);return _.deltaMode===WheelEvent.DOM_DELTA_LINE?v*=this._currentRowHeight:_.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._currentRowHeight*this._bufferService.rows),v}getBufferElements(_,v){var T;let y,j="";const A=[],N=v??this._bufferService.buffer.lines.length,L=this._bufferService.buffer.lines;for(let B=_;B<N;B++){const H=L.get(B);if(!H)continue;const W=(T=L.get(B+1))==null?void 0:T.isWrapped;if(j+=H.translateToString(!W),!W||B===L.length-1){const Y=document.createElement("div");Y.textContent=j,A.push(Y),j.length>0&&(y=Y),j=""}}return{bufferElements:A,cursorElement:y}}getLinesScrolled(_){if(_.deltaY===0||_.shiftKey)return 0;let v=this._applyScrollModifier(_.deltaY,_);return _.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(v/=this._currentRowHeight+0,this._wheelPartialScroll+=v,v=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):_.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._bufferService.rows),v}_applyScrollModifier(_,v){const y=this._optionsService.rawOptions.fastScrollModifier;return y==="alt"&&v.altKey||y==="ctrl"&&v.ctrlKey||y==="shift"&&v.shiftKey?_*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:_*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(_){this._lastTouchY=_.touches[0].pageY}handleTouchMove(_){const v=this._lastTouchY-_.touches[0].pageY;return this._lastTouchY=_.touches[0].pageY,v!==0&&(this._viewportElement.scrollTop+=v,this._bubbleScroll(_,v))}};l.Viewport=x=f([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,b.ICharSizeService),g(5,b.IRenderService),g(6,b.ICoreBrowserService),g(7,b.IThemeService)],x)},3107:function(p,l,h){var f=this&&this.__decorate||function(C,x,_,v){var y,j=arguments.length,A=j<3?x:v===null?v=Object.getOwnPropertyDescriptor(x,_):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,x,_,v);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(A=(j<3?y(A):j>3?y(x,_,A):y(x,_))||A);return j>3&&A&&Object.defineProperty(x,_,A),A},g=this&&this.__param||function(C,x){return function(_,v){x(_,v,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const m=h(4725),b=h(844),S=h(2585);let E=l.BufferDecorationRenderer=class extends b.Disposable{constructor(C,x,_,v,y){super(),this._screenElement=C,this._bufferService=x,this._coreBrowserService=_,this._decorationService=v,this._renderService=y,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((j=>this._removeDecoration(j)))),this.register((0,b.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var v;const x=this._coreBrowserService.mainDocument.createElement("div");x.classList.add("xterm-decoration"),x.classList.toggle("xterm-decoration-top-layer",((v=C==null?void 0:C.options)==null?void 0:v.layer)==="top"),x.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,x.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",x.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",x.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const _=C.options.x??0;return _&&_>this._bufferService.cols&&(x.style.display="none"),this._refreshXPosition(C,x),x}_refreshStyle(C){const x=C.marker.line-this._bufferService.buffers.active.ydisp;if(x<0||x>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let _=this._decorationElements.get(C);_||(_=this._createElement(C),C.element=_,this._decorationElements.set(C,_),this._container.appendChild(_),C.onDispose((()=>{this._decorationElements.delete(C),_.remove()}))),_.style.top=x*this._renderService.dimensions.css.cell.height+"px",_.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(_)}}_refreshXPosition(C,x=C.element){if(!x)return;const _=C.options.x??0;(C.options.anchor||"left")==="right"?x.style.right=_?_*this._renderService.dimensions.css.cell.width+"px":"":x.style.left=_?_*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var x;(x=this._decorationElements.get(C))==null||x.remove(),this._decorationElements.delete(C),C.dispose()}};l.BufferDecorationRenderer=E=f([g(1,S.IBufferService),g(2,m.ICoreBrowserService),g(3,S.IDecorationService),g(4,m.IRenderService)],E)},5871:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(h){if(h.options.overviewRulerOptions){for(const f of this._zones)if(f.color===h.options.overviewRulerOptions.color&&f.position===h.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,h.marker.line))return;if(this._lineAdjacentToZone(f,h.marker.line,h.options.overviewRulerOptions.position))return void this._addLineToZone(f,h.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=h.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=h.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=h.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=h.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:h.options.overviewRulerOptions.color,position:h.options.overviewRulerOptions.position,startBufferLine:h.marker.line,endBufferLine:h.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(h){this._linePadding=h}_lineIntersectsZone(h,f){return f>=h.startBufferLine&&f<=h.endBufferLine}_lineAdjacentToZone(h,f,g){return f>=h.startBufferLine-this._linePadding[g||"full"]&&f<=h.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(h,f){h.startBufferLine=Math.min(h.startBufferLine,f),h.endBufferLine=Math.max(h.endBufferLine,f)}}},5744:function(p,l,h){var f=this&&this.__decorate||function(y,j,A,N){var L,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(y,j,A,N);else for(var H=y.length-1;H>=0;H--)(L=y[H])&&(B=(T<3?L(B):T>3?L(j,A,B):L(j,A))||B);return T>3&&B&&Object.defineProperty(j,A,B),B},g=this&&this.__param||function(y,j){return function(A,N){j(A,N,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const m=h(5871),b=h(4725),S=h(844),E=h(2585),C={full:0,left:0,center:0,right:0},x={full:0,left:0,center:0,right:0},_={full:0,left:0,center:0,right:0};let v=l.OverviewRulerRenderer=class extends S.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(y,j,A,N,L,T,B){var W;super(),this._viewportElement=y,this._screenElement=j,this._bufferService=A,this._decorationService=N,this._renderService=L,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,S.toDisposable)((()=>{var Y;(Y=this._canvas)==null||Y.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 y=Math.floor(this._canvas.width/3),j=Math.ceil(this._canvas.width/3);x.full=this._canvas.width,x.left=y,x.center=j,x.right=y,this._refreshDrawHeightConstants(),_.full=0,_.left=0,_.center=x.left,_.right=x.left+x.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const y=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(y,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 y=this._colorZoneStore.zones;for(const j of y)j.position!=="full"&&this._renderColorZone(j);for(const j of y)j.position==="full"&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(y){this._ctx.fillStyle=y.color,this._ctx.fillRect(_[y.position||"full"],Math.round((this._canvas.height-1)*(y.startBufferLine/this._bufferService.buffers.active.lines.length)-C[y.position||"full"]/2),x[y.position||"full"],Math.round((this._canvas.height-1)*((y.endBufferLine-y.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[y.position||"full"]))}_queueRefresh(y,j){this._shouldUpdateDimensions=y||this._shouldUpdateDimensions,this._shouldUpdateAnchor=j||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=v=f([g(2,E.IBufferService),g(3,E.IDecorationService),g(4,b.IRenderService),g(5,E.IOptionsService),g(6,b.ICoreBrowserService)],v)},2950:function(p,l,h){var f=this&&this.__decorate||function(C,x,_,v){var y,j=arguments.length,A=j<3?x:v===null?v=Object.getOwnPropertyDescriptor(x,_):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,x,_,v);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(A=(j<3?y(A):j>3?y(x,_,A):y(x,_))||A);return j>3&&A&&Object.defineProperty(x,_,A),A},g=this&&this.__param||function(C,x){return function(_,v){x(_,v,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const m=h(4725),b=h(2585),S=h(2584);let E=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,x,_,v,y,j){this._textarea=C,this._compositionView=x,this._bufferService=_,this._optionsService=v,this._coreService=y,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 x={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let _;this._isSendingComposition=!1,x.start+=this._dataAlreadySent.length,_=this._isComposing?this._textarea.value.substring(x.start,x.end):this._textarea.value.substring(x.start),_.length>0&&this._coreService.triggerDataEvent(_,!0)}}),0)}else{this._isSendingComposition=!1;const x=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(x,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const x=this._textarea.value,_=x.replace(C,"");this._dataAlreadySent=_,x.length>C.length?this._coreService.triggerDataEvent(_,!0):x.length<C.length?this._coreService.triggerDataEvent(`${S.C0.DEL}`,!0):x.length===C.length&&x!==C&&this._coreService.triggerDataEvent(x,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const x=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),_=this._renderService.dimensions.css.cell.height,v=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,y=x*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=y+"px",this._compositionView.style.top=v+"px",this._compositionView.style.height=_+"px",this._compositionView.style.lineHeight=_+"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=y+"px",this._textarea.style.top=v+"px",this._textarea.style.width=Math.max(j.width,1)+"px",this._textarea.style.height=Math.max(j.height,1)+"px",this._textarea.style.lineHeight=j.height+"px"}C||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=E=f([g(2,b.IBufferService),g(3,b.IOptionsService),g(4,b.ICoreService),g(5,m.IRenderService)],E)},9806:(p,l)=>{function h(f,g,m){const b=m.getBoundingClientRect(),S=f.getComputedStyle(m),E=parseInt(S.getPropertyValue("padding-left")),C=parseInt(S.getPropertyValue("padding-top"));return[g.clientX-b.left-E,g.clientY-b.top-C]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=h,l.getCoords=function(f,g,m,b,S,E,C,x,_){if(!E)return;const v=h(f,g,m);return v?(v[0]=Math.ceil((v[0]+(_?C/2:0))/C),v[1]=Math.ceil(v[1]/x),v[0]=Math.min(Math.max(v[0],1),b+(_?1:0)),v[1]=Math.min(Math.max(v[1],1),S),v):void 0}},9504:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const f=h(2584);function g(x,_,v,y){const j=x-m(x,v),A=_-m(_,v),N=Math.abs(j-A)-(function(L,T,B){let H=0;const W=L-m(L,B),Y=T-m(T,B);for(let $=0;$<Math.abs(W-Y);$++){const I=b(L,T)==="A"?-1:1,P=B.buffer.lines.get(W+I*$);P!=null&&P.isWrapped&&H++}return H})(x,_,v);return C(N,E(b(x,_),y))}function m(x,_){let v=0,y=_.buffer.lines.get(x),j=y==null?void 0:y.isWrapped;for(;j&&x>=0&&x<_.rows;)v++,y=_.buffer.lines.get(--x),j=y==null?void 0:y.isWrapped;return v}function b(x,_){return x>_?"A":"B"}function S(x,_,v,y,j,A){let N=x,L=_,T="";for(;N!==v||L!==y;)N+=j?1:-1,j&&N>A.cols-1?(T+=A.buffer.translateBufferLineToString(L,!1,x,N),N=0,x=0,L++):!j&&N<0&&(T+=A.buffer.translateBufferLineToString(L,!1,0,x+1),N=A.cols-1,x=N,L--);return T+A.buffer.translateBufferLineToString(L,!1,x,N)}function E(x,_){const v=_?"O":"[";return f.C0.ESC+v+x}function C(x,_){x=Math.floor(x);let v="";for(let y=0;y<x;y++)v+=_;return v}l.moveToCellSequence=function(x,_,v,y){const j=v.buffer.x,A=v.buffer.y;if(!v.buffer.hasScrollback)return(function(T,B,H,W,Y,$){return g(B,W,Y,$).length===0?"":C(S(T,B,T,B-m(B,Y),!1,Y).length,E("D",$))})(j,A,0,_,v,y)+g(A,_,v,y)+(function(T,B,H,W,Y,$){let I;I=g(B,W,Y,$).length>0?W-m(W,Y):B;const P=W,V=(function(Z,ee,R,D,O,q){let F;return F=g(R,D,O,q).length>0?D-m(D,O):ee,Z<R&&F<=D||Z>=R&&F<D?"C":"D"})(T,B,H,W,Y,$);return C(S(T,I,H,P,V==="C",Y).length,E(V,$))})(j,A,x,_,v,y);let N;if(A===_)return N=j>x?"D":"C",C(Math.abs(j-x),E(N,y));N=A>_?"D":"C";const L=Math.abs(A-_);return C((function(T,B){return B.cols-T})(A>_?x:j,v)+(L-1)*v.cols+1+((A>_?j:x)-1),E(N,y))}},1296:function(p,l,h){var f=this&&this.__decorate||function($,I,P,V){var Z,ee=arguments.length,R=ee<3?I:V===null?V=Object.getOwnPropertyDescriptor(I,P):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate($,I,P,V);else for(var D=$.length-1;D>=0;D--)(Z=$[D])&&(R=(ee<3?Z(R):ee>3?Z(I,P,R):Z(I,P))||R);return ee>3&&R&&Object.defineProperty(I,P,R),R},g=this&&this.__param||function($,I){return function(P,V){I(P,V,$)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const m=h(3787),b=h(2550),S=h(2223),E=h(6171),C=h(6052),x=h(4725),_=h(8055),v=h(8460),y=h(844),j=h(2585),A="xterm-dom-renderer-owner-",N="xterm-rows",L="xterm-fg-",T="xterm-bg-",B="xterm-focus",H="xterm-selection";let W=1,Y=l.DomRenderer=class extends y.Disposable{constructor($,I,P,V,Z,ee,R,D,O,q,F,K,te){super(),this._terminal=$,this._document=I,this._element=P,this._screenElement=V,this._viewportElement=Z,this._helperContainer=ee,this._linkifier2=R,this._charSizeService=O,this._optionsService=q,this._bufferService=F,this._coreBrowserService=K,this._themeService=te,this._terminalClass=W++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new v.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(N),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(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((Q=>this._injectCss(Q)))),this._injectCss(this._themeService.colors),this._rowFactory=D.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((Q=>this._handleLinkHover(Q)))),this.register(this._linkifier2.onHideLinkUnderline((Q=>this._handleLinkLeave(Q)))),this.register((0,y.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 b.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const $=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*$,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*$),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/$),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/$),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 P of this._rowElements)P.style.width=`${this.dimensions.css.canvas.width}px`,P.style.height=`${this.dimensions.css.cell.height}px`,P.style.lineHeight=`${this.dimensions.css.cell.height}px`,P.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const I=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=I,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss($){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let I=`${this._terminalSelector} .${N} { color: ${$.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;I+=`${this._terminalSelector} .${N} .xterm-dim { color: ${_.color.multiplyOpacity($.foreground,.5).css};}`,I+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const P=`blink_underline_${this._terminalClass}`,V=`blink_bar_${this._terminalClass}`,Z=`blink_block_${this._terminalClass}`;I+=`@keyframes ${P} { 50% { border-bottom-style: hidden; }}`,I+=`@keyframes ${V} { 50% { box-shadow: none; }}`,I+=`@keyframes ${Z} { 0% { background-color: ${$.cursor.css}; color: ${$.cursorAccent.css}; } 50% { background-color: inherit; color: ${$.cursor.css}; }}`,I+=`${this._terminalSelector} .${N}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${N}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${N}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Z} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${$.cursor.css}; color: ${$.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${$.cursor.css} !important; color: ${$.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${$.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${$.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${$.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,I+=`${this._terminalSelector} .${H} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${H} div { position: absolute; background-color: ${$.selectionBackgroundOpaque.css};}${this._terminalSelector} .${H} div { position: absolute; background-color: ${$.selectionInactiveBackgroundOpaque.css};}`;for(const[ee,R]of $.ansi.entries())I+=`${this._terminalSelector} .${L}${ee} { color: ${R.css}; }${this._terminalSelector} .${L}${ee}.xterm-dim { color: ${_.color.multiplyOpacity(R,.5).css}; }${this._terminalSelector} .${T}${ee} { background-color: ${R.css}; }`;I+=`${this._terminalSelector} .${L}${S.INVERTED_DEFAULT_COLOR} { color: ${_.color.opaque($.background).css}; }${this._terminalSelector} .${L}${S.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${_.color.multiplyOpacity(_.color.opaque($.background),.5).css}; }${this._terminalSelector} .${T}${S.INVERTED_DEFAULT_COLOR} { background-color: ${$.foreground.css}; }`,this._themeStyleElement.textContent=I}_setDefaultSpacing(){const $=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${$}px`,this._rowFactory.defaultSpacing=$}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements($,I){for(let P=this._rowElements.length;P<=I;P++){const V=this._document.createElement("div");this._rowContainer.appendChild(V),this._rowElements.push(V)}for(;this._rowElements.length>I;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize($,I){this._refreshRowElements($,I),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(B),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(B),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged($,I,P){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged($,I,P),this.renderRows(0,this._bufferService.rows-1),!$||!I)return;this._selectionRenderModel.update(this._terminal,$,I,P);const V=this._selectionRenderModel.viewportStartRow,Z=this._selectionRenderModel.viewportEndRow,ee=this._selectionRenderModel.viewportCappedStartRow,R=this._selectionRenderModel.viewportCappedEndRow;if(ee>=this._bufferService.rows||R<0)return;const D=this._document.createDocumentFragment();if(P){const O=$[0]>I[0];D.appendChild(this._createSelectionElement(ee,O?I[0]:$[0],O?$[0]:I[0],R-ee+1))}else{const O=V===ee?$[0]:0,q=ee===Z?I[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(ee,O,q));const F=R-ee-1;if(D.appendChild(this._createSelectionElement(ee+1,0,this._bufferService.cols,F)),ee!==R){const K=Z===R?I[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(R,0,K))}}this._selectionContainer.appendChild(D)}_createSelectionElement($,I,P,V=1){const Z=this._document.createElement("div"),ee=I*this.dimensions.css.cell.width;let R=this.dimensions.css.cell.width*(P-I);return ee+R>this.dimensions.css.canvas.width&&(R=this.dimensions.css.canvas.width-ee),Z.style.height=V*this.dimensions.css.cell.height+"px",Z.style.top=$*this.dimensions.css.cell.height+"px",Z.style.left=`${ee}px`,Z.style.width=`${R}px`,Z}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 $ of this._rowElements)$.replaceChildren()}renderRows($,I){const P=this._bufferService.buffer,V=P.ybase+P.y,Z=Math.min(P.x,this._bufferService.cols-1),ee=this._optionsService.rawOptions.cursorBlink,R=this._optionsService.rawOptions.cursorStyle,D=this._optionsService.rawOptions.cursorInactiveStyle;for(let O=$;O<=I;O++){const q=O+P.ydisp,F=this._rowElements[O],K=P.lines.get(q);if(!F||!K)break;F.replaceChildren(...this._rowFactory.createRow(K,q,q===V,R,D,Z,ee,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${A}${this._terminalClass}`}_handleLinkHover($){this._setCellUnderline($.x1,$.x2,$.y1,$.y2,$.cols,!0)}_handleLinkLeave($){this._setCellUnderline($.x1,$.x2,$.y1,$.y2,$.cols,!1)}_setCellUnderline($,I,P,V,Z,ee){P<0&&($=0),V<0&&(I=0);const R=this._bufferService.rows-1;P=Math.max(Math.min(P,R),0),V=Math.max(Math.min(V,R),0),Z=Math.min(Z,this._bufferService.cols);const D=this._bufferService.buffer,O=D.ybase+D.y,q=Math.min(D.x,Z-1),F=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,te=this._optionsService.rawOptions.cursorInactiveStyle;for(let Q=P;Q<=V;++Q){const X=Q+D.ydisp,z=this._rowElements[Q],ae=D.lines.get(X);if(!z||!ae)break;z.replaceChildren(...this._rowFactory.createRow(ae,X,X===O,K,te,q,F,this.dimensions.css.cell.width,this._widthCache,ee?Q===P?$:0:-1,ee?(Q===V?I:Z)-1:-1))}}};l.DomRenderer=Y=f([g(7,j.IInstantiationService),g(8,x.ICharSizeService),g(9,j.IOptionsService),g(10,j.IBufferService),g(11,x.ICoreBrowserService),g(12,x.IThemeService)],Y)},3787:function(p,l,h){var f=this&&this.__decorate||function(N,L,T,B){var H,W=arguments.length,Y=W<3?L:B===null?B=Object.getOwnPropertyDescriptor(L,T):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(N,L,T,B);else for(var $=N.length-1;$>=0;$--)(H=N[$])&&(Y=(W<3?H(Y):W>3?H(L,T,Y):H(L,T))||Y);return W>3&&Y&&Object.defineProperty(L,T,Y),Y},g=this&&this.__param||function(N,L){return function(T,B){L(T,B,N)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const m=h(2223),b=h(643),S=h(511),E=h(2585),C=h(8055),x=h(4725),_=h(4269),v=h(6171),y=h(3734);let j=l.DomRendererRowFactory=class{constructor(N,L,T,B,H,W,Y){this._document=N,this._characterJoinerService=L,this._optionsService=T,this._coreBrowserService=B,this._coreService=H,this._decorationService=W,this._themeService=Y,this._workCell=new S.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,L,T){this._selectionStart=N,this._selectionEnd=L,this._columnSelectMode=T}createRow(N,L,T,B,H,W,Y,$,I,P,V){const Z=[],ee=this._characterJoinerService.getJoinedCharacters(L),R=this._themeService.colors;let D,O=N.getNoBgTrimmedLength();T&&O<W+1&&(O=W+1);let q=0,F="",K=0,te=0,Q=0,X=!1,z=0,ae=!1,se=0;const ge=[],ve=P!==-1&&V!==-1;for(let Ne=0;Ne<O;Ne++){N.loadCell(Ne,this._workCell);let De=this._workCell.getWidth();if(De===0)continue;let Oe=!1,Fe=Ne,ke=this._workCell;if(ee.length>0&&Ne===ee[0][0]){Oe=!0;const Ae=ee.shift();ke=new _.JoinedCellData(this._workCell,N.translateToString(!0,Ae[0],Ae[1]),Ae[1]-Ae[0]),Fe=Ae[1]-1,De=ke.getWidth()}const lt=this._isCellInSelection(Ne,L),ht=T&&Ne===W,fe=ve&&Ne>=P&&Ne<=V;let Re=!1;this._decorationService.forEachDecorationAtCell(Ne,L,void 0,(Ae=>{Re=!0}));let Je=ke.getChars()||b.WHITESPACE_CELL_CHAR;if(Je===" "&&(ke.isUnderline()||ke.isOverline())&&(Je=" "),se=De*$-I.get(Je,ke.isBold(),ke.isItalic()),D){if(q&&(lt&&ae||!lt&&!ae&&ke.bg===K)&&(lt&&ae&&R.selectionForeground||ke.fg===te)&&ke.extended.ext===Q&&fe===X&&se===z&&!ht&&!Oe&&!Re){ke.isInvisible()?F+=b.WHITESPACE_CELL_CHAR:F+=Je,q++;continue}q&&(D.textContent=F),D=this._document.createElement("span"),q=0,F=""}else D=this._document.createElement("span");if(K=ke.bg,te=ke.fg,Q=ke.extended.ext,X=fe,z=se,ae=lt,Oe&&W>=Ne&&W<=Fe&&(W=Ne),!this._coreService.isCursorHidden&&ht&&this._coreService.isCursorInitialized){if(ge.push("xterm-cursor"),this._coreBrowserService.isFocused)Y&&ge.push("xterm-cursor-blink"),ge.push(B==="bar"?"xterm-cursor-bar":B==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(H)switch(H){case"outline":ge.push("xterm-cursor-outline");break;case"block":ge.push("xterm-cursor-block");break;case"bar":ge.push("xterm-cursor-bar");break;case"underline":ge.push("xterm-cursor-underline")}}if(ke.isBold()&&ge.push("xterm-bold"),ke.isItalic()&&ge.push("xterm-italic"),ke.isDim()&&ge.push("xterm-dim"),F=ke.isInvisible()?b.WHITESPACE_CELL_CHAR:ke.getChars()||b.WHITESPACE_CELL_CHAR,ke.isUnderline()&&(ge.push(`xterm-underline-${ke.extended.underlineStyle}`),F===" "&&(F=" "),!ke.isUnderlineColorDefault()))if(ke.isUnderlineColorRGB())D.style.textDecorationColor=`rgb(${y.AttributeData.toColorRGB(ke.getUnderlineColor()).join(",")})`;else{let Ae=ke.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ke.isBold()&&Ae<8&&(Ae+=8),D.style.textDecorationColor=R.ansi[Ae].css}ke.isOverline()&&(ge.push("xterm-overline"),F===" "&&(F=" ")),ke.isStrikethrough()&&ge.push("xterm-strikethrough"),fe&&(D.style.textDecoration="underline");let et=ke.getFgColor(),Ge=ke.getFgColorMode(),ct=ke.getBgColor(),de=ke.getBgColorMode();const be=!!ke.isInverse();if(be){const Ae=et;et=ct,ct=Ae;const st=Ge;Ge=de,de=st}let re,Se,Ce,He=!1;switch(this._decorationService.forEachDecorationAtCell(Ne,L,void 0,(Ae=>{Ae.options.layer!=="top"&&He||(Ae.backgroundColorRGB&&(de=50331648,ct=Ae.backgroundColorRGB.rgba>>8&16777215,re=Ae.backgroundColorRGB),Ae.foregroundColorRGB&&(Ge=50331648,et=Ae.foregroundColorRGB.rgba>>8&16777215,Se=Ae.foregroundColorRGB),He=Ae.options.layer==="top")})),!He&<&&(re=this._coreBrowserService.isFocused?R.selectionBackgroundOpaque:R.selectionInactiveBackgroundOpaque,ct=re.rgba>>8&16777215,de=50331648,He=!0,R.selectionForeground&&(Ge=50331648,et=R.selectionForeground.rgba>>8&16777215,Se=R.selectionForeground)),He&&ge.push("xterm-decoration-top"),de){case 16777216:case 33554432:Ce=R.ansi[ct],ge.push(`xterm-bg-${ct}`);break;case 50331648:Ce=C.channels.toColor(ct>>16,ct>>8&255,255&ct),this._addStyle(D,`background-color:#${A((ct>>>0).toString(16),"0",6)}`);break;default:be?(Ce=R.foreground,ge.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):Ce=R.background}switch(re||ke.isDim()&&(re=C.color.multiplyOpacity(Ce,.5)),Ge){case 16777216:case 33554432:ke.isBold()&&et<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(et+=8),this._applyMinimumContrast(D,Ce,R.ansi[et],ke,re,void 0)||ge.push(`xterm-fg-${et}`);break;case 50331648:const Ae=C.channels.toColor(et>>16&255,et>>8&255,255&et);this._applyMinimumContrast(D,Ce,Ae,ke,re,Se)||this._addStyle(D,`color:#${A(et.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(D,Ce,R.foreground,ke,re,Se)||be&&ge.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}ge.length&&(D.className=ge.join(" "),ge.length=0),ht||Oe||Re?D.textContent=F:q++,se!==this.defaultSpacing&&(D.style.letterSpacing=`${se}px`),Z.push(D),Ne=Fe}return D&&q&&(D.textContent=F),Z}_applyMinimumContrast(N,L,T,B,H,W){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,v.treatGlyphAsBackgroundColor)(B.getCode()))return!1;const Y=this._getContrastCache(B);let $;if(H||W||($=Y.getColor(L.rgba,T.rgba)),$===void 0){const I=this._optionsService.rawOptions.minimumContrastRatio/(B.isDim()?2:1);$=C.color.ensureContrastRatio(H||L,W||T,I),Y.setColor((H||L).rgba,(W||T).rgba,$??null)}return!!$&&(this._addStyle(N,`color:${$.css}`),!0)}_getContrastCache(N){return N.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(N,L){N.setAttribute("style",`${N.getAttribute("style")||""}${L};`)}_isCellInSelection(N,L){const T=this._selectionStart,B=this._selectionEnd;return!(!T||!B)&&(this._columnSelectMode?T[0]<=B[0]?N>=T[0]&&L>=T[1]&&N<B[0]&&L<=B[1]:N<T[0]&&L>=T[1]&&N>=B[0]&&L<=B[1]:L>T[1]&&L<B[1]||T[1]===B[1]&&L===T[1]&&N>=T[0]&&N<B[0]||T[1]<B[1]&&L===B[1]&&N<B[0]||T[1]<B[1]&&L===T[1]&&N>=T[0])}};function A(N,L,T){for(;N.length<T;)N=L+N;return N}l.DomRendererRowFactory=j=f([g(1,x.ICharacterJoinerService),g(2,E.IOptionsService),g(3,x.ICoreBrowserService),g(4,E.ICoreService),g(5,E.IDecorationService),g(6,x.IThemeService)],j)},2550:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(h,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=h.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=h.createElement("span");g.classList.add("xterm-char-measure-element");const m=h.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold";const b=h.createElement("span");b.classList.add("xterm-char-measure-element"),b.style.fontStyle="italic";const S=h.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontWeight="bold",S.style.fontStyle="italic",this._measureElements=[g,m,b,S],this._container.appendChild(g),this._container.appendChild(m),this._container.appendChild(b),this._container.appendChild(S),f.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(h,f,g,m){h===this._font&&f===this._fontSize&&g===this._weight&&m===this._weightBold||(this._font=h,this._fontSize=f,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(h,f,g){let m=0;if(!f&&!g&&h.length===1&&(m=h.charCodeAt(0))<256){if(this._flat[m]!==-9999)return this._flat[m];const E=this._measure(h,0);return E>0&&(this._flat[m]=E),E}let b=h;f&&(b+="B"),g&&(b+="I");let S=this._holey.get(b);if(S===void 0){let E=0;f&&(E|=1),g&&(E|=2),S=this._measure(h,E),S>0&&this._holey.set(b,S)}return S}_measure(h,f){const g=this._measureElements[f];return g.textContent=h.repeat(32),g.offsetWidth/32}}},2223:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const f=h(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(p,l)=>{function h(g){return 57508<=g&&g<=57558}function f(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},l.isPowerlineGlyph=h,l.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},l.isEmoji=f,l.allowRescaling=function(g,m,b,S){return m===1&&b>Math.ceil(1.5*S)&&g!==void 0&&g>255&&!f(g)&&!h(g)&&!(function(E){return 57344<=E&&E<=63743})(g)},l.treatGlyphAsBackgroundColor=function(g){return h(g)||(function(m){return 9472<=m&&m<=9631})(g)},l.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},l.computeNextVariantOffset=function(g,m,b=0){return(g-(2*Math.round(m)-b))%(2*Math.round(m))}},6052:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class h{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(g,m,b,S=!1){if(this.selectionStart=m,this.selectionEnd=b,!m||!b||m[0]===b[0]&&m[1]===b[1])return void this.clear();const E=g.buffers.active.ydisp,C=m[1]-E,x=b[1]-E,_=Math.max(C,0),v=Math.min(x,g.rows-1);_>=g.rows||v<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=S,this.viewportStartRow=C,this.viewportEndRow=x,this.viewportCappedStartRow=_,this.viewportCappedEndRow=v,this.startCol=m[0],this.endCol=b[0])}isCellSelected(g,m,b){return!!this.hasSelection&&(b-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&b>=this.viewportCappedStartRow&&m<this.endCol&&b<=this.viewportCappedEndRow:m<this.startCol&&b>=this.viewportCappedStartRow&&m>=this.endCol&&b<=this.viewportCappedEndRow:b>this.viewportStartRow&&b<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&b===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportStartRow&&m>=this.startCol)}}l.createSelectionRenderModel=function(){return new h}},456:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(h){this._bufferService=h,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 h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?h%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)-1]:[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[h,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[Math.max(h,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const h=this.selectionStart,f=this.selectionEnd;return!(!h||!f)&&(h[1]>f[1]||h[1]===f[1]&&h[0]>f[0])}handleTrim(h){return this.selectionStart&&(this.selectionStart[1]-=h),this.selectionEnd&&(this.selectionEnd[1]-=h),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(p,l,h){var f=this&&this.__decorate||function(v,y,j,A){var N,L=arguments.length,T=L<3?y:A===null?A=Object.getOwnPropertyDescriptor(y,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(v,y,j,A);else for(var B=v.length-1;B>=0;B--)(N=v[B])&&(T=(L<3?N(T):L>3?N(y,j,T):N(y,j))||T);return L>3&&T&&Object.defineProperty(y,j,T),T},g=this&&this.__param||function(v,y){return function(j,A){y(j,A,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const m=h(2585),b=h(8460),S=h(844);let E=l.CharSizeService=class extends S.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(v,y,j){super(),this._optionsService=j,this.width=0,this.height=0,this._onCharSizeChange=this.register(new b.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new _(this._optionsService))}catch{this._measureStrategy=this.register(new x(v,y,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const v=this._measureStrategy.measure();v.width===this.width&&v.height===this.height||(this.width=v.width,this.height=v.height,this._onCharSizeChange.fire())}};l.CharSizeService=E=f([g(2,m.IOptionsService)],E);class C extends S.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(y,j){y!==void 0&&y>0&&j!==void 0&&j>0&&(this._result.width=y,this._result.height=j)}}class x extends C{constructor(y,j,A){super(),this._document=y,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 _ extends C{constructor(y){super(),this._optionsService=y,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 y=this._ctx.measureText("W");return this._validateAndSet(y.width,y.fontBoundingBoxAscent+y.fontBoundingBoxDescent),this._result}}},4269:function(p,l,h){var f=this&&this.__decorate||function(_,v,y,j){var A,N=arguments.length,L=N<3?v:j===null?j=Object.getOwnPropertyDescriptor(v,y):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(_,v,y,j);else for(var T=_.length-1;T>=0;T--)(A=_[T])&&(L=(N<3?A(L):N>3?A(v,y,L):A(v,y))||L);return N>3&&L&&Object.defineProperty(v,y,L),L},g=this&&this.__param||function(_,v){return function(y,j){v(y,j,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const m=h(3734),b=h(643),S=h(511),E=h(2585);class C extends m.AttributeData{constructor(v,y,j){super(),this.content=0,this.combinedData="",this.fg=v.fg,this.bg=v.bg,this.combinedData=y,this._width=j}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(v){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=C;let x=l.CharacterJoinerService=class ab{constructor(v){this._bufferService=v,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new S.CellData}register(v){const y={id:this._nextCharacterJoinerId++,handler:v};return this._characterJoiners.push(y),y.id}deregister(v){for(let y=0;y<this._characterJoiners.length;y++)if(this._characterJoiners[y].id===v)return this._characterJoiners.splice(y,1),!0;return!1}getJoinedCharacters(v){if(this._characterJoiners.length===0)return[];const y=this._bufferService.buffer.lines.get(v);if(!y||y.length===0)return[];const j=[],A=y.translateToString(!0);let N=0,L=0,T=0,B=y.getFg(0),H=y.getBg(0);for(let W=0;W<y.getTrimmedLength();W++)if(y.loadCell(W,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==B||this._workCell.bg!==H){if(W-N>1){const Y=this._getJoinedRanges(A,T,L,y,N);for(let $=0;$<Y.length;$++)j.push(Y[$])}N=W,T=L,B=this._workCell.fg,H=this._workCell.bg}L+=this._workCell.getChars().length||b.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const W=this._getJoinedRanges(A,T,L,y,N);for(let Y=0;Y<W.length;Y++)j.push(W[Y])}return j}_getJoinedRanges(v,y,j,A,N){const L=v.substring(y,j);let T=[];try{T=this._characterJoiners[0].handler(L)}catch(B){console.error(B)}for(let B=1;B<this._characterJoiners.length;B++)try{const H=this._characterJoiners[B].handler(L);for(let W=0;W<H.length;W++)ab._mergeRanges(T,H[W])}catch(H){console.error(H)}return this._stringRangesToCellRanges(T,A,N),T}_stringRangesToCellRanges(v,y,j){let A=0,N=!1,L=0,T=v[A];if(T){for(let B=j;B<this._bufferService.cols;B++){const H=y.getWidth(B),W=y.getString(B).length||b.WHITESPACE_CELL_CHAR.length;if(H!==0){if(!N&&T[0]<=L&&(T[0]=B,N=!0),T[1]<=L){if(T[1]=B,T=v[++A],!T)break;T[0]<=L?(T[0]=B,N=!0):N=!1}L+=W}}T&&(T[1]=this._bufferService.cols)}}static _mergeRanges(v,y){let j=!1;for(let A=0;A<v.length;A++){const N=v[A];if(j){if(y[1]<=N[0])return v[A-1][1]=y[1],v;if(y[1]<=N[1])return v[A-1][1]=Math.max(y[1],N[1]),v.splice(A,1),v;v.splice(A,1),A--}else{if(y[1]<=N[0])return v.splice(A,0,y),v;if(y[1]<=N[1])return N[0]=Math.min(y[0],N[0]),v;y[0]<N[1]&&(N[0]=Math.min(y[0],N[0]),j=!0)}}return j?v[v.length-1][1]=y[1]:v.push(y),v}};l.CharacterJoinerService=x=f([g(0,E.IBufferService)],x)},5114:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const f=h(844),g=h(8460),m=h(3656);class b extends f.Disposable{constructor(C,x,_){super(),this._textarea=C,this._window=x,this.mainDocument=_,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new S(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((v=>this._screenDprMonitor.setWindow(v)))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(C){this._window!==C&&(this._window=C,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}l.CoreBrowserService=b;class S extends f.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new f.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,f.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:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const f=h(844);class g extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(b){return this.linkProviders.push(b),{dispose:()=>{const S=this.linkProviders.indexOf(b);S!==-1&&this.linkProviders.splice(S,1)}}}}l.LinkProviderService=g},8934:function(p,l,h){var f=this&&this.__decorate||function(E,C,x,_){var v,y=arguments.length,j=y<3?C:_===null?_=Object.getOwnPropertyDescriptor(C,x):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(E,C,x,_);else for(var A=E.length-1;A>=0;A--)(v=E[A])&&(j=(y<3?v(j):y>3?v(C,x,j):v(C,x))||j);return y>3&&j&&Object.defineProperty(C,x,j),j},g=this&&this.__param||function(E,C){return function(x,_){C(x,_,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const m=h(4725),b=h(9806);let S=l.MouseService=class{constructor(E,C){this._renderService=E,this._charSizeService=C}getCoords(E,C,x,_,v){return(0,b.getCoords)(window,E,C,x,_,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,v)}getMouseReportCoords(E,C){const x=(0,b.getCoordsRelativeToElement)(window,E,C);if(this._charSizeService.hasValidSize)return x[0]=Math.min(Math.max(x[0],0),this._renderService.dimensions.css.canvas.width-1),x[1]=Math.min(Math.max(x[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(x[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(x[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(x[0]),y:Math.floor(x[1])}}};l.MouseService=S=f([g(0,m.IRenderService),g(1,m.ICharSizeService)],S)},3230:function(p,l,h){var f=this&&this.__decorate||function(v,y,j,A){var N,L=arguments.length,T=L<3?y:A===null?A=Object.getOwnPropertyDescriptor(y,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(v,y,j,A);else for(var B=v.length-1;B>=0;B--)(N=v[B])&&(T=(L<3?N(T):L>3?N(y,j,T):N(y,j))||T);return L>3&&T&&Object.defineProperty(y,j,T),T},g=this&&this.__param||function(v,y){return function(j,A){y(j,A,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const m=h(6193),b=h(4725),S=h(8460),E=h(844),C=h(7226),x=h(2585);let _=l.RenderService=class extends E.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,y,j,A,N,L,T,B){super(),this._rowCount=v,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 S.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new S.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new S.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new S.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(L.onResize((()=>this._fullRefresh()))),this.register(L.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(L.cols,L.rows),this._fullRefresh()}))),this.register(j.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(L.buffer.y,L.buffer.y,!0)))),this.register(B.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(T.window,y),this.register(T.onWindowChange((H=>this._registerIntersectionObserver(H,y))))}_registerIntersectionObserver(v,y){if("IntersectionObserver"in v){const j=new v.IntersectionObserver((A=>this._handleIntersectionChange(A[A.length-1])),{threshold:0});j.observe(y),this._observerDisposable.value=(0,E.toDisposable)((()=>j.disconnect()))}}_handleIntersectionChange(v){this._isPaused=v.isIntersecting===void 0?v.intersectionRatio===0:!v.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(v,y,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,y,this._rowCount))}_renderRows(v,y){this._renderer.value&&(v=Math.min(v,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(v,y),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:v,end:y}),this._onRender.fire({start:v,end:y}),this._isNextRenderRedrawOnly=!0)}resize(v,y){this._rowCount=y,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(v){this._renderer.value=v,this._renderer.value&&(this._renderer.value.onRequestRedraw((y=>this.refreshRows(y.start,y.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(v){return this._renderDebouncer.addRefreshCallback(v)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var v,y;this._renderer.value&&((y=(v=this._renderer.value).clearTextureAtlas)==null||y.call(v),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(v,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(v,y)})):this._renderer.value.handleResize(v,y),this._fullRefresh())}handleCharSizeChanged(){var v;(v=this._renderer.value)==null||v.handleCharSizeChanged()}handleBlur(){var v;(v=this._renderer.value)==null||v.handleBlur()}handleFocus(){var v;(v=this._renderer.value)==null||v.handleFocus()}handleSelectionChanged(v,y,j){var A;this._selectionState.start=v,this._selectionState.end=y,this._selectionState.columnSelectMode=j,(A=this._renderer.value)==null||A.handleSelectionChanged(v,y,j)}handleCursorMove(){var v;(v=this._renderer.value)==null||v.handleCursorMove()}clear(){var v;(v=this._renderer.value)==null||v.clear()}};l.RenderService=_=f([g(2,x.IOptionsService),g(3,b.ICharSizeService),g(4,x.IDecorationService),g(5,x.IBufferService),g(6,b.ICoreBrowserService),g(7,b.IThemeService)],_)},9312:function(p,l,h){var f=this&&this.__decorate||function(T,B,H,W){var Y,$=arguments.length,I=$<3?B:W===null?W=Object.getOwnPropertyDescriptor(B,H):W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(T,B,H,W);else for(var P=T.length-1;P>=0;P--)(Y=T[P])&&(I=($<3?Y(I):$>3?Y(B,H,I):Y(B,H))||I);return $>3&&I&&Object.defineProperty(B,H,I),I},g=this&&this.__param||function(T,B){return function(H,W){B(H,W,T)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const m=h(9806),b=h(9504),S=h(456),E=h(4725),C=h(8460),x=h(844),_=h(6114),v=h(4841),y=h(511),j=h(2585),A=" ",N=new RegExp(A,"g");let L=l.SelectionService=class extends x.Disposable{constructor(T,B,H,W,Y,$,I,P,V){super(),this._element=T,this._screenElement=B,this._linkifier=H,this._bufferService=W,this._coreService=Y,this._mouseService=$,this._optionsService=I,this._renderService=P,this._coreBrowserService=V,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new y.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=Z=>this._handleMouseMove(Z),this._mouseUpListener=Z=>this._handleMouseUp(Z),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Z=>this._handleTrim(Z))),this.register(this._bufferService.buffers.onBufferActivate((Z=>this._handleBufferActivate(Z)))),this.enable(),this._model=new S.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,x.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 Y=T[0]<B[0]?T[0]:B[0],$=T[0]<B[0]?B[0]:T[0];for(let I=T[1];I<=B[1];I++){const P=H.translateBufferLineToString(I,!0,Y,$);W.push(P)}}else{const Y=T[1]===B[1]?B[0]:void 0;W.push(H.translateBufferLineToString(T[1],!0,T[0],Y));for(let $=T[1]+1;$<=B[1]-1;$++){const I=H.lines.get($),P=H.translateBufferLineToString($,!0);I!=null&&I.isWrapped?W[W.length-1]+=P:W.push(P)}if(T[1]!==B[1]){const $=H.lines.get(B[1]),I=H.translateBufferLineToString(B[1],!0,0,B[0]);$&&$.isWrapped?W[W.length-1]+=I:W.push(I)}}return W.map((Y=>Y.replace(N," "))).join(_.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()))),_.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 Y,$;const H=($=(Y=this._linkifier.currentLink)==null?void 0:Y.link)==null?void 0:$.range;if(H)return this._model.selectionStart=[H.start.x-1,H.start.y-1],this._model.selectionStartLength=(0,v.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 _.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&&!(_.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,b.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 Y=T.loadCell(W,this._workCell).getChars().length;this._workCell.getWidth()===0?H--:Y>1&&B!==W&&(H+=Y-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 Y=this._bufferService.buffer,$=Y.lines.get(T[1]);if(!$)return;const I=Y.translateBufferLineToString(T[1],!1);let P=this._convertViewportColToCharacterIndex($,T[0]),V=P;const Z=T[0]-P;let ee=0,R=0,D=0,O=0;if(I.charAt(P)===" "){for(;P>0&&I.charAt(P-1)===" ";)P--;for(;V<I.length&&I.charAt(V+1)===" ";)V++}else{let K=T[0],te=T[0];$.getWidth(K)===0&&(ee++,K--),$.getWidth(te)===2&&(R++,te++);const Q=$.getString(te).length;for(Q>1&&(O+=Q-1,V+=Q-1);K>0&&P>0&&!this._isCharWordSeparator($.loadCell(K-1,this._workCell));){$.loadCell(K-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(ee++,K--):X>1&&(D+=X-1,P-=X-1),P--,K--}for(;te<$.length&&V+1<I.length&&!this._isCharWordSeparator($.loadCell(te+1,this._workCell));){$.loadCell(te+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(R++,te++):X>1&&(O+=X-1,V+=X-1),V++,te++}}V++;let q=P+Z-ee+D,F=Math.min(this._bufferService.cols,V-P+ee+R-D-O);if(B||I.slice(P,V).trim()!==""){if(H&&q===0&&$.getCodePoint(0)!==32){const K=Y.lines.get(T[1]-1);if(K&&$.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){const te=this._getWordAt([this._bufferService.cols-1,T[1]-1],!1,!0,!1);if(te){const Q=this._bufferService.cols-te.start;q-=Q,F+=Q}}}if(W&&q+F===this._bufferService.cols&&$.getCodePoint(this._bufferService.cols-1)!==32){const K=Y.lines.get(T[1]+1);if(K!=null&&K.isWrapped&&K.getCodePoint(0)!==32){const te=this._getWordAt([0,T[1]+1],!1,!1,!0);te&&(F+=te.length)}}return{start:q,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,v.getRangeLength)(H,this._bufferService.cols)}};l.SelectionService=L=f([g(3,j.IBufferService),g(4,j.ICoreService),g(5,E.IMouseService),g(6,j.IOptionsService),g(7,E.IRenderService),g(8,E.ICoreBrowserService)],L)},4725:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const f=h(8343);l.ICharSizeService=(0,f.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),l.IMouseService=(0,f.createDecorator)("MouseService"),l.IRenderService=(0,f.createDecorator)("RenderService"),l.ISelectionService=(0,f.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,f.createDecorator)("ThemeService"),l.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(p,l,h){var f=this&&this.__decorate||function(L,T,B,H){var W,Y=arguments.length,$=Y<3?T:H===null?H=Object.getOwnPropertyDescriptor(T,B):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(L,T,B,H);else for(var I=L.length-1;I>=0;I--)(W=L[I])&&($=(Y<3?W($):Y>3?W(T,B,$):W(T,B))||$);return Y>3&&$&&Object.defineProperty(T,B,$),$},g=this&&this.__param||function(L,T){return function(B,H){T(B,H,L)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const m=h(7239),b=h(8055),S=h(8460),E=h(844),C=h(2585),x=b.css.toColor("#ffffff"),_=b.css.toColor("#000000"),v=b.css.toColor("#ffffff"),y=b.css.toColor("#000000"),j={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const L=[b.css.toColor("#2e3436"),b.css.toColor("#cc0000"),b.css.toColor("#4e9a06"),b.css.toColor("#c4a000"),b.css.toColor("#3465a4"),b.css.toColor("#75507b"),b.css.toColor("#06989a"),b.css.toColor("#d3d7cf"),b.css.toColor("#555753"),b.css.toColor("#ef2929"),b.css.toColor("#8ae234"),b.css.toColor("#fce94f"),b.css.toColor("#729fcf"),b.css.toColor("#ad7fa8"),b.css.toColor("#34e2e2"),b.css.toColor("#eeeeec")],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],Y=T[B%6];L.push({css:b.channels.toCss(H,W,Y),rgba:b.channels.toRgba(H,W,Y)})}for(let B=0;B<24;B++){const H=8+10*B;L.push({css:b.channels.toCss(H,H,H),rgba:b.channels.toRgba(H,H,H)})}return L})());let A=l.ThemeService=class extends E.Disposable{get colors(){return this._colors}constructor(L){super(),this._optionsService=L,this._contrastCache=new m.ColorContrastCache,this._halfContrastCache=new m.ColorContrastCache,this._onChangeColors=this.register(new S.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:x,background:_,cursor:v,cursorAccent:y,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:b.color.blend(_,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:b.color.blend(_,j),ansi:l.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(L={}){const T=this._colors;if(T.foreground=N(L.foreground,x),T.background=N(L.background,_),T.cursor=N(L.cursor,v),T.cursorAccent=N(L.cursorAccent,y),T.selectionBackgroundTransparent=N(L.selectionBackground,j),T.selectionBackgroundOpaque=b.color.blend(T.background,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundTransparent=N(L.selectionInactiveBackground,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundOpaque=b.color.blend(T.background,T.selectionInactiveBackgroundTransparent),T.selectionForeground=L.selectionForeground?N(L.selectionForeground,b.NULL_COLOR):void 0,T.selectionForeground===b.NULL_COLOR&&(T.selectionForeground=void 0),b.color.isOpaque(T.selectionBackgroundTransparent)&&(T.selectionBackgroundTransparent=b.color.opacity(T.selectionBackgroundTransparent,.3)),b.color.isOpaque(T.selectionInactiveBackgroundTransparent)&&(T.selectionInactiveBackgroundTransparent=b.color.opacity(T.selectionInactiveBackgroundTransparent,.3)),T.ansi=l.DEFAULT_ANSI_COLORS.slice(),T.ansi[0]=N(L.black,l.DEFAULT_ANSI_COLORS[0]),T.ansi[1]=N(L.red,l.DEFAULT_ANSI_COLORS[1]),T.ansi[2]=N(L.green,l.DEFAULT_ANSI_COLORS[2]),T.ansi[3]=N(L.yellow,l.DEFAULT_ANSI_COLORS[3]),T.ansi[4]=N(L.blue,l.DEFAULT_ANSI_COLORS[4]),T.ansi[5]=N(L.magenta,l.DEFAULT_ANSI_COLORS[5]),T.ansi[6]=N(L.cyan,l.DEFAULT_ANSI_COLORS[6]),T.ansi[7]=N(L.white,l.DEFAULT_ANSI_COLORS[7]),T.ansi[8]=N(L.brightBlack,l.DEFAULT_ANSI_COLORS[8]),T.ansi[9]=N(L.brightRed,l.DEFAULT_ANSI_COLORS[9]),T.ansi[10]=N(L.brightGreen,l.DEFAULT_ANSI_COLORS[10]),T.ansi[11]=N(L.brightYellow,l.DEFAULT_ANSI_COLORS[11]),T.ansi[12]=N(L.brightBlue,l.DEFAULT_ANSI_COLORS[12]),T.ansi[13]=N(L.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),T.ansi[14]=N(L.brightCyan,l.DEFAULT_ANSI_COLORS[14]),T.ansi[15]=N(L.brightWhite,l.DEFAULT_ANSI_COLORS[15]),L.extendedAnsi){const B=Math.min(T.ansi.length-16,L.extendedAnsi.length);for(let H=0;H<B;H++)T.ansi[H+16]=N(L.extendedAnsi[H],l.DEFAULT_ANSI_COLORS[H+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(L){this._restoreColor(L),this._onChangeColors.fire(this.colors)}_restoreColor(L){if(L!==void 0)switch(L){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[L]=this._restoreColors.ansi[L]}else for(let T=0;T<this._restoreColors.ansi.length;++T)this._colors.ansi[T]=this._restoreColors.ansi[T]}modifyColors(L){L(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(L,T){if(L!==void 0)try{return b.css.toColor(L)}catch{}return T}l.ThemeService=A=f([g(0,C.IOptionsService)],A)},6349:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const f=h(8460),g=h(844);class m extends g.Disposable{constructor(S){super(),this._maxLength=S,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.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(S){if(this._maxLength===S)return;const E=new Array(S);for(let C=0;C<Math.min(S,this.length);C++)E[C]=this._array[this._getCyclicIndex(C)];this._array=E,this._maxLength=S,this._startIndex=0}get length(){return this._length}set length(S){if(S>this._length)for(let E=this._length;E<S;E++)this._array[E]=void 0;this._length=S}get(S){return this._array[this._getCyclicIndex(S)]}set(S,E){this._array[this._getCyclicIndex(S)]=E}push(S){this._array[this._getCyclicIndex(this._length)]=S,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(S,E,...C){if(E){for(let x=S;x<this._length-E;x++)this._array[this._getCyclicIndex(x)]=this._array[this._getCyclicIndex(x+E)];this._length-=E,this.onDeleteEmitter.fire({index:S,amount:E})}for(let x=this._length-1;x>=S;x--)this._array[this._getCyclicIndex(x+C.length)]=this._array[this._getCyclicIndex(x)];for(let x=0;x<C.length;x++)this._array[this._getCyclicIndex(S+x)]=C[x];if(C.length&&this.onInsertEmitter.fire({index:S,amount:C.length}),this._length+C.length>this._maxLength){const x=this._length+C.length-this._maxLength;this._startIndex+=x,this._length=this._maxLength,this.onTrimEmitter.fire(x)}else this._length+=C.length}trimStart(S){S>this._length&&(S=this._length),this._startIndex+=S,this._length-=S,this.onTrimEmitter.fire(S)}shiftElements(S,E,C){if(!(E<=0)){if(S<0||S>=this._length)throw new Error("start argument out of range");if(S+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let _=E-1;_>=0;_--)this.set(S+_+C,this.get(S+_));const x=S+E+C-this._length;if(x>0)for(this._length+=x;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let x=0;x<E;x++)this.set(S+x+C,this.get(S+x))}}_getCyclicIndex(S){return(this._startIndex+S)%this._maxLength}}l.CircularList=m},1439:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function h(f,g=5){if(typeof f!="object")return f;const m=Array.isArray(f)?[]:{};for(const b in f)m[b]=g<=1?f[b]:f[b]&&h(f[b],g-1);return m}},8055:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let h=0,f=0,g=0,m=0;var b,S,E,C,x;function _(y){const j=y.toString(16);return j.length<2?"0"+j:j}function v(y,j){return y<j?(j+.05)/(y+.05):(y+.05)/(j+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(y){y.toCss=function(j,A,N,L){return L!==void 0?`#${_(j)}${_(A)}${_(N)}${_(L)}`:`#${_(j)}${_(A)}${_(N)}`},y.toRgba=function(j,A,N,L=255){return(j<<24|A<<16|N<<8|L)>>>0},y.toColor=function(j,A,N,L){return{css:y.toCss(j,A,N,L),rgba:y.toRgba(j,A,N,L)}}})(b||(l.channels=b={})),(function(y){function j(A,N){return m=Math.round(255*N),[h,f,g]=x.toChannels(A.rgba),{css:b.toCss(h,f,g,m),rgba:b.toRgba(h,f,g,m)}}y.blend=function(A,N){if(m=(255&N.rgba)/255,m===1)return{css:N.css,rgba:N.rgba};const L=N.rgba>>24&255,T=N.rgba>>16&255,B=N.rgba>>8&255,H=A.rgba>>24&255,W=A.rgba>>16&255,Y=A.rgba>>8&255;return h=H+Math.round((L-H)*m),f=W+Math.round((T-W)*m),g=Y+Math.round((B-Y)*m),{css:b.toCss(h,f,g),rgba:b.toRgba(h,f,g)}},y.isOpaque=function(A){return(255&A.rgba)==255},y.ensureContrastRatio=function(A,N,L){const T=x.ensureContrastRatio(A.rgba,N.rgba,L);if(T)return b.toColor(T>>24&255,T>>16&255,T>>8&255)},y.opaque=function(A){const N=(255|A.rgba)>>>0;return[h,f,g]=x.toChannels(N),{css:b.toCss(h,f,g),rgba:N}},y.opacity=j,y.multiplyOpacity=function(A,N){return m=255&A.rgba,j(A,m*N/255)},y.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(S||(l.color=S={})),(function(y){let j,A;try{const N=document.createElement("canvas");N.width=1,N.height=1;const L=N.getContext("2d",{willReadFrequently:!0});L&&(j=L,j.globalCompositeOperation="copy",A=j.createLinearGradient(0,0,1,1))}catch{}y.toColor=function(N){if(N.match(/#[\da-f]{3,8}/i))switch(N.length){case 4:return h=parseInt(N.slice(1,2).repeat(2),16),f=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),b.toColor(h,f,g);case 5:return h=parseInt(N.slice(1,2).repeat(2),16),f=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),m=parseInt(N.slice(4,5).repeat(2),16),b.toColor(h,f,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 L=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(L)return h=parseInt(L[1]),f=parseInt(L[2]),g=parseInt(L[3]),m=Math.round(255*(L[5]===void 0?1:parseFloat(L[5]))),b.toColor(h,f,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),[h,f,g,m]=j.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:b.toRgba(h,f,g,m),css:N}}})(E||(l.css=E={})),(function(y){function j(A,N,L){const T=A/255,B=N/255,H=L/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))}y.relativeLuminance=function(A){return j(A>>16&255,A>>8&255,255&A)},y.relativeLuminance2=j})(C||(l.rgb=C={})),(function(y){function j(N,L,T){const B=N>>24&255,H=N>>16&255,W=N>>8&255;let Y=L>>24&255,$=L>>16&255,I=L>>8&255,P=v(C.relativeLuminance2(Y,$,I),C.relativeLuminance2(B,H,W));for(;P<T&&(Y>0||$>0||I>0);)Y-=Math.max(0,Math.ceil(.1*Y)),$-=Math.max(0,Math.ceil(.1*$)),I-=Math.max(0,Math.ceil(.1*I)),P=v(C.relativeLuminance2(Y,$,I),C.relativeLuminance2(B,H,W));return(Y<<24|$<<16|I<<8|255)>>>0}function A(N,L,T){const B=N>>24&255,H=N>>16&255,W=N>>8&255;let Y=L>>24&255,$=L>>16&255,I=L>>8&255,P=v(C.relativeLuminance2(Y,$,I),C.relativeLuminance2(B,H,W));for(;P<T&&(Y<255||$<255||I<255);)Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),$=Math.min(255,$+Math.ceil(.1*(255-$))),I=Math.min(255,I+Math.ceil(.1*(255-I))),P=v(C.relativeLuminance2(Y,$,I),C.relativeLuminance2(B,H,W));return(Y<<24|$<<16|I<<8|255)>>>0}y.blend=function(N,L){if(m=(255&L)/255,m===1)return L;const T=L>>24&255,B=L>>16&255,H=L>>8&255,W=N>>24&255,Y=N>>16&255,$=N>>8&255;return h=W+Math.round((T-W)*m),f=Y+Math.round((B-Y)*m),g=$+Math.round((H-$)*m),b.toRgba(h,f,g)},y.ensureContrastRatio=function(N,L,T){const B=C.relativeLuminance(N>>8),H=C.relativeLuminance(L>>8);if(v(B,H)<T){if(H<B){const $=j(N,L,T),I=v(B,C.relativeLuminance($>>8));if(I<T){const P=A(N,L,T);return I>v(B,C.relativeLuminance(P>>8))?$:P}return $}const W=A(N,L,T),Y=v(B,C.relativeLuminance(W>>8));if(Y<T){const $=j(N,L,T);return Y>v(B,C.relativeLuminance($>>8))?W:$}return W}},y.reduceLuminance=j,y.increaseLuminance=A,y.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(x||(l.rgba=x={})),l.toPaddedHex=_,l.contrastRatio=v},8969:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const f=h(844),g=h(2585),m=h(4348),b=h(7866),S=h(744),E=h(7302),C=h(6975),x=h(8460),_=h(1753),v=h(1480),y=h(7994),j=h(9282),A=h(5435),N=h(5981),L=h(2660);let T=!1;class B extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new x.EventEmitter),this._onScroll.event((W=>{var Y;(Y=this._onScrollApi)==null||Y.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 Y in W)this.optionsService.options[Y]=W[Y]}constructor(W){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new x.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new x.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new x.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new x.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new x.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new x.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(S.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(b.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(_.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(v.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(y.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(L.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,x.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,x.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,x.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,x.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((Y=>{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((Y=>{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(((Y,$)=>this._inputHandler.parse(Y,$)))),this.register((0,x.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(W,Y){this._writeBuffer.write(W,Y)}writeSync(W,Y){this._logService.logLevel<=g.LogLevelEnum.WARN&&!T&&(this._logService.warn("writeSync is unreliable and will be removed soon."),T=!0),this._writeBuffer.writeSync(W,Y)}input(W,Y=!0){this.coreService.triggerDataEvent(W,Y)}resize(W,Y){isNaN(W)||isNaN(Y)||(W=Math.max(W,S.MINIMUM_COLS),Y=Math.max(Y,S.MINIMUM_ROWS),this._bufferService.resize(W,Y))}scroll(W,Y=!1){this._bufferService.scroll(W,Y)}scrollLines(W,Y,$){this._bufferService.scrollLines(W,Y,$)}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 Y=W-this._bufferService.buffer.ydisp;Y!==0&&this.scrollLines(Y)}registerEscHandler(W,Y){return this._inputHandler.registerEscHandler(W,Y)}registerDcsHandler(W,Y){return this._inputHandler.registerDcsHandler(W,Y)}registerCsiHandler(W,Y){return this._inputHandler.registerCsiHandler(W,Y)}registerOscHandler(W,Y){return this._inputHandler.registerOscHandler(W,Y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let W=!1;const Y=this.optionsService.rawOptions.windowsPty;Y&&Y.buildNumber!==void 0&&Y.buildNumber!==void 0?W=Y.backend==="conpty"&&Y.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,f.toDisposable)((()=>{for(const Y of W)Y.dispose()}))}}}l.CoreTerminal=B},8460:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===h)return void this._listeners.splice(f,1)}}})),this._event}fire(h,f){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,h,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(h,f){return h((g=>f.fire(g)))},l.runAndSubscribe=function(h,f){return f(void 0),h((g=>f(g)))}},5435:function(p,l,h){var f=this&&this.__decorate||function(ee,R,D,O){var q,F=arguments.length,K=F<3?R:O===null?O=Object.getOwnPropertyDescriptor(R,D):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(ee,R,D,O);else for(var te=ee.length-1;te>=0;te--)(q=ee[te])&&(K=(F<3?q(K):F>3?q(R,D,K):q(R,D))||K);return F>3&&K&&Object.defineProperty(R,D,K),K},g=this&&this.__param||function(ee,R){return function(D,O){R(D,O,ee)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const m=h(2584),b=h(7116),S=h(2015),E=h(844),C=h(482),x=h(8437),_=h(8460),v=h(643),y=h(511),j=h(3734),A=h(2585),N=h(1480),L=h(6242),T=h(6351),B=h(5941),H={"(":0,")":1,"*":2,"+":3,"-":1,".":2},W=131072;function Y(ee,R){if(ee>24)return R.setWinLines||!1;switch(ee){case 1:return!!R.restoreWin;case 2:return!!R.minimizeWin;case 3:return!!R.setWinPosition;case 4:return!!R.setWinSizePixels;case 5:return!!R.raiseWin;case 6:return!!R.lowerWin;case 7:return!!R.refreshWin;case 8:return!!R.setWinSizeChars;case 9:return!!R.maximizeWin;case 10:return!!R.fullscreenWin;case 11:return!!R.getWinState;case 13:return!!R.getWinPosition;case 14:return!!R.getWinSizePixels;case 15:return!!R.getScreenSizePixels;case 16:return!!R.getCellSizePixels;case 18:return!!R.getWinSizeChars;case 19:return!!R.getScreenSizeChars;case 20:return!!R.getIconTitle;case 21:return!!R.getWinTitle;case 22:return!!R.pushTitle;case 23:return!!R.popTitle;case 24:return!!R.setWinLines}return!1}var $;(function(ee){ee[ee.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ee[ee.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})($||(l.WindowsOptionsReportType=$={}));let I=0;class P extends E.Disposable{getAttrData(){return this._curAttrData}constructor(R,D,O,q,F,K,te,Q,X=new S.EscapeSequenceParser){super(),this._bufferService=R,this._charsetService=D,this._coreService=O,this._logService=q,this._optionsService=F,this._oscLinkService=K,this._coreMouseService=te,this._unicodeService=Q,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new y.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=x.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=x.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new _.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new _.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new _.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new _.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new _.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new _.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new _.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new _.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new _.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new _.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new _.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new _.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new _.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 V(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((z=>this._activeBuffer=z.activeBuffer))),this._parser.setCsiHandlerFallback(((z,ae)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(z),params:ae.toArray()})})),this._parser.setEscHandlerFallback((z=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(z)})})),this._parser.setExecuteHandlerFallback((z=>{this._logService.debug("Unknown EXECUTE code: ",{code:z})})),this._parser.setOscHandlerFallback(((z,ae,se)=>{this._logService.debug("Unknown OSC code: ",{identifier:z,action:ae,data:se})})),this._parser.setDcsHandlerFallback(((z,ae,se)=>{ae==="HOOK"&&(se=se.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(z),action:ae,payload:se})})),this._parser.setPrintHandler(((z,ae,se)=>this.print(z,ae,se))),this._parser.registerCsiHandler({final:"@"},(z=>this.insertChars(z))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(z=>this.scrollLeft(z))),this._parser.registerCsiHandler({final:"A"},(z=>this.cursorUp(z))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(z=>this.scrollRight(z))),this._parser.registerCsiHandler({final:"B"},(z=>this.cursorDown(z))),this._parser.registerCsiHandler({final:"C"},(z=>this.cursorForward(z))),this._parser.registerCsiHandler({final:"D"},(z=>this.cursorBackward(z))),this._parser.registerCsiHandler({final:"E"},(z=>this.cursorNextLine(z))),this._parser.registerCsiHandler({final:"F"},(z=>this.cursorPrecedingLine(z))),this._parser.registerCsiHandler({final:"G"},(z=>this.cursorCharAbsolute(z))),this._parser.registerCsiHandler({final:"H"},(z=>this.cursorPosition(z))),this._parser.registerCsiHandler({final:"I"},(z=>this.cursorForwardTab(z))),this._parser.registerCsiHandler({final:"J"},(z=>this.eraseInDisplay(z,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(z=>this.eraseInDisplay(z,!0))),this._parser.registerCsiHandler({final:"K"},(z=>this.eraseInLine(z,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(z=>this.eraseInLine(z,!0))),this._parser.registerCsiHandler({final:"L"},(z=>this.insertLines(z))),this._parser.registerCsiHandler({final:"M"},(z=>this.deleteLines(z))),this._parser.registerCsiHandler({final:"P"},(z=>this.deleteChars(z))),this._parser.registerCsiHandler({final:"S"},(z=>this.scrollUp(z))),this._parser.registerCsiHandler({final:"T"},(z=>this.scrollDown(z))),this._parser.registerCsiHandler({final:"X"},(z=>this.eraseChars(z))),this._parser.registerCsiHandler({final:"Z"},(z=>this.cursorBackwardTab(z))),this._parser.registerCsiHandler({final:"`"},(z=>this.charPosAbsolute(z))),this._parser.registerCsiHandler({final:"a"},(z=>this.hPositionRelative(z))),this._parser.registerCsiHandler({final:"b"},(z=>this.repeatPrecedingCharacter(z))),this._parser.registerCsiHandler({final:"c"},(z=>this.sendDeviceAttributesPrimary(z))),this._parser.registerCsiHandler({prefix:">",final:"c"},(z=>this.sendDeviceAttributesSecondary(z))),this._parser.registerCsiHandler({final:"d"},(z=>this.linePosAbsolute(z))),this._parser.registerCsiHandler({final:"e"},(z=>this.vPositionRelative(z))),this._parser.registerCsiHandler({final:"f"},(z=>this.hVPosition(z))),this._parser.registerCsiHandler({final:"g"},(z=>this.tabClear(z))),this._parser.registerCsiHandler({final:"h"},(z=>this.setMode(z))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(z=>this.setModePrivate(z))),this._parser.registerCsiHandler({final:"l"},(z=>this.resetMode(z))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(z=>this.resetModePrivate(z))),this._parser.registerCsiHandler({final:"m"},(z=>this.charAttributes(z))),this._parser.registerCsiHandler({final:"n"},(z=>this.deviceStatus(z))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(z=>this.deviceStatusPrivate(z))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(z=>this.softReset(z))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(z=>this.setCursorStyle(z))),this._parser.registerCsiHandler({final:"r"},(z=>this.setScrollRegion(z))),this._parser.registerCsiHandler({final:"s"},(z=>this.saveCursor(z))),this._parser.registerCsiHandler({final:"t"},(z=>this.windowOptions(z))),this._parser.registerCsiHandler({final:"u"},(z=>this.restoreCursor(z))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(z=>this.insertColumns(z))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(z=>this.deleteColumns(z))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(z=>this.selectProtected(z))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(z=>this.requestMode(z,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(z=>this.requestMode(z,!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 L.OscHandler((z=>(this.setTitle(z),this.setIconName(z),!0)))),this._parser.registerOscHandler(1,new L.OscHandler((z=>this.setIconName(z)))),this._parser.registerOscHandler(2,new L.OscHandler((z=>this.setTitle(z)))),this._parser.registerOscHandler(4,new L.OscHandler((z=>this.setOrReportIndexedColor(z)))),this._parser.registerOscHandler(8,new L.OscHandler((z=>this.setHyperlink(z)))),this._parser.registerOscHandler(10,new L.OscHandler((z=>this.setOrReportFgColor(z)))),this._parser.registerOscHandler(11,new L.OscHandler((z=>this.setOrReportBgColor(z)))),this._parser.registerOscHandler(12,new L.OscHandler((z=>this.setOrReportCursorColor(z)))),this._parser.registerOscHandler(104,new L.OscHandler((z=>this.restoreIndexedColor(z)))),this._parser.registerOscHandler(110,new L.OscHandler((z=>this.restoreFgColor(z)))),this._parser.registerOscHandler(111,new L.OscHandler((z=>this.restoreBgColor(z)))),this._parser.registerOscHandler(112,new L.OscHandler((z=>this.restoreCursorColor(z)))),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 z in b.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:z},(()=>this.selectCharset("("+z))),this._parser.registerEscHandler({intermediates:")",final:z},(()=>this.selectCharset(")"+z))),this._parser.registerEscHandler({intermediates:"*",final:z},(()=>this.selectCharset("*"+z))),this._parser.registerEscHandler({intermediates:"+",final:z},(()=>this.selectCharset("+"+z))),this._parser.registerEscHandler({intermediates:"-",final:z},(()=>this.selectCharset("-"+z))),this._parser.registerEscHandler({intermediates:".",final:z},(()=>this.selectCharset("."+z))),this._parser.registerEscHandler({intermediates:"/",final:z},(()=>this.selectCharset("/"+z)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((z=>(this._logService.error("Parsing error: ",z),z))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler(((z,ae)=>this.requestStatusString(z,ae))))}_preserveStack(R,D,O,q){this._parseStack.paused=!0,this._parseStack.cursorStartX=R,this._parseStack.cursorStartY=D,this._parseStack.decodedLength=O,this._parseStack.position=q}_logSlowResolvingAsync(R){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([R,new Promise(((D,O)=>setTimeout((()=>O("#SLOW_TIMEOUT")),5e3)))]).catch((D=>{if(D!=="#SLOW_TIMEOUT")throw D;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(R,D){let O,q=this._activeBuffer.x,F=this._activeBuffer.y,K=0;const te=this._parseStack.paused;if(te){if(O=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,D))return this._logSlowResolvingAsync(O),O;q=this._parseStack.cursorStartX,F=this._parseStack.cursorStartY,this._parseStack.paused=!1,R.length>W&&(K=this._parseStack.position+W)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof R=="string"?` "${R}"`:` "${Array.prototype.map.call(R,(z=>String.fromCharCode(z))).join("")}"`),typeof R=="string"?R.split("").map((z=>z.charCodeAt(0))):R),this._parseBuffer.length<R.length&&this._parseBuffer.length<W&&(this._parseBuffer=new Uint32Array(Math.min(R.length,W))),te||this._dirtyRowTracker.clearRange(),R.length>W)for(let z=K;z<R.length;z+=W){const ae=z+W<R.length?z+W:R.length,se=typeof R=="string"?this._stringDecoder.decode(R.substring(z,ae),this._parseBuffer):this._utf8Decoder.decode(R.subarray(z,ae),this._parseBuffer);if(O=this._parser.parse(this._parseBuffer,se))return this._preserveStack(q,F,se,z),this._logSlowResolvingAsync(O),O}else if(!te){const z=typeof R=="string"?this._stringDecoder.decode(R,this._parseBuffer):this._utf8Decoder.decode(R,this._parseBuffer);if(O=this._parser.parse(this._parseBuffer,z))return this._preserveStack(q,F,z,0),this._logSlowResolvingAsync(O),O}this._activeBuffer.x===q&&this._activeBuffer.y===F||this._onCursorMove.fire();const Q=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(Q,this._bufferService.rows-1))}print(R,D,O){let q,F;const K=this._charsetService.charset,te=this._optionsService.rawOptions.screenReaderMode,Q=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,z=this._coreService.modes.insertMode,ae=this._curAttrData;let se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&O-D>0&&se.getWidth(this._activeBuffer.x-1)===2&&se.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ae);let ge=this._parser.precedingJoinState;for(let ve=D;ve<O;++ve){if(q=R[ve],q<127&&K){const Fe=K[String.fromCharCode(q)];Fe&&(q=Fe.charCodeAt(0))}const Ne=this._unicodeService.charProperties(q,ge);F=N.UnicodeService.extractWidth(Ne);const De=N.UnicodeService.extractShouldJoin(Ne),Oe=De?N.UnicodeService.extractWidth(ge):0;if(ge=Ne,te&&this._onA11yChar.fire((0,C.stringFromCodePoint)(q)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+F-Oe>Q){if(X){const Fe=se;let ke=this._activeBuffer.x-Oe;for(this._activeBuffer.x=Oe,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),se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Oe>0&&se instanceof x.BufferLine&&se.copyCellsFrom(Fe,ke,0,Oe,!1);ke<Q;)Fe.setCellFromCodepoint(ke++,0,1,ae)}else if(this._activeBuffer.x=Q-1,F===2)continue}if(De&&this._activeBuffer.x){const Fe=se.getWidth(this._activeBuffer.x-1)?1:2;se.addCodepointToCell(this._activeBuffer.x-Fe,q,F);for(let ke=F-Oe;--ke>=0;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}else if(z&&(se.insertCells(this._activeBuffer.x,F-Oe,this._activeBuffer.getNullCell(ae)),se.getWidth(Q-1)===2&&se.setCellFromCodepoint(Q-1,v.NULL_CELL_CODE,v.NULL_CELL_WIDTH,ae)),se.setCellFromCodepoint(this._activeBuffer.x++,q,F,ae),F>0)for(;--F;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}this._parser.precedingJoinState=ge,this._activeBuffer.x<Q&&O-D>0&&se.getWidth(this._activeBuffer.x)===0&&!se.hasContent(this._activeBuffer.x)&&se.setCellFromCodepoint(this._activeBuffer.x,0,1,ae),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(R,D){return R.final!=="t"||R.prefix||R.intermediates?this._parser.registerCsiHandler(R,D):this._parser.registerCsiHandler(R,(O=>!Y(O.params[0],this._optionsService.rawOptions.windowOptions)||D(O)))}registerDcsHandler(R,D){return this._parser.registerDcsHandler(R,new T.DcsHandler(D))}registerEscHandler(R,D){return this._parser.registerEscHandler(R,D)}registerOscHandler(R,D){return this._parser.registerOscHandler(R,new L.OscHandler(D))}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 R;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&&((R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&R.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);D.hasWidth(this._activeBuffer.x)&&!D.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const R=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-R),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(R=this._bufferService.cols-1){this._activeBuffer.x=Math.min(R,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(R,D){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=R,this._activeBuffer.y=this._activeBuffer.scrollTop+D):(this._activeBuffer.x=R,this._activeBuffer.y=D),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(R,D){this._restrictCursor(),this._setCursor(this._activeBuffer.x+R,this._activeBuffer.y+D)}cursorUp(R){const D=this._activeBuffer.y-this._activeBuffer.scrollTop;return D>=0?this._moveCursor(0,-Math.min(D,R.params[0]||1)):this._moveCursor(0,-(R.params[0]||1)),!0}cursorDown(R){const D=this._activeBuffer.scrollBottom-this._activeBuffer.y;return D>=0?this._moveCursor(0,Math.min(D,R.params[0]||1)):this._moveCursor(0,R.params[0]||1),!0}cursorForward(R){return this._moveCursor(R.params[0]||1,0),!0}cursorBackward(R){return this._moveCursor(-(R.params[0]||1),0),!0}cursorNextLine(R){return this.cursorDown(R),this._activeBuffer.x=0,!0}cursorPrecedingLine(R){return this.cursorUp(R),this._activeBuffer.x=0,!0}cursorCharAbsolute(R){return this._setCursor((R.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(R){return this._setCursor(R.length>=2?(R.params[1]||1)-1:0,(R.params[0]||1)-1),!0}charPosAbsolute(R){return this._setCursor((R.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(R){return this._moveCursor(R.params[0]||1,0),!0}linePosAbsolute(R){return this._setCursor(this._activeBuffer.x,(R.params[0]||1)-1),!0}vPositionRelative(R){return this._moveCursor(0,R.params[0]||1),!0}hVPosition(R){return this.cursorPosition(R),!0}tabClear(R){const D=R.params[0];return D===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:D===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(R){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let D=R.params[0]||1;for(;D--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(R){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let D=R.params[0]||1;for(;D--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(R){const D=R.params[0];return D===1&&(this._curAttrData.bg|=536870912),D!==2&&D!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(R,D,O,q=!1,F=!1){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);K.replaceCells(D,O,this._activeBuffer.getNullCell(this._eraseAttrData()),F),q&&(K.isWrapped=!1)}_resetBufferLine(R,D=!1){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);O&&(O.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),D),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+R),O.isWrapped=!1)}eraseInDisplay(R,D=!1){let O;switch(this._restrictCursor(this._bufferService.cols),R.params[0]){case 0:for(O=this._activeBuffer.y,this._dirtyRowTracker.markDirty(O),this._eraseInBufferLine(O++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,D);O<this._bufferService.rows;O++)this._resetBufferLine(O,D);this._dirtyRowTracker.markDirty(O);break;case 1:for(O=this._activeBuffer.y,this._dirtyRowTracker.markDirty(O),this._eraseInBufferLine(O,0,this._activeBuffer.x+1,!0,D),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(O+1).isWrapped=!1);O--;)this._resetBufferLine(O,D);this._dirtyRowTracker.markDirty(0);break;case 2:for(O=this._bufferService.rows,this._dirtyRowTracker.markDirty(O-1);O--;)this._resetBufferLine(O,D);this._dirtyRowTracker.markDirty(0);break;case 3:const q=this._activeBuffer.lines.length-this._bufferService.rows;q>0&&(this._activeBuffer.lines.trimStart(q),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-q,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-q,0),this._onScroll.fire(0))}return!0}eraseInLine(R,D=!1){switch(this._restrictCursor(this._bufferService.cols),R.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,D);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,D);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,D)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(R){this._restrictCursor();let D=R.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const O=this._activeBuffer.ybase+this._activeBuffer.y,q=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-q+1;for(;D--;)this._activeBuffer.lines.splice(F-1,1),this._activeBuffer.lines.splice(O,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(R){this._restrictCursor();let D=R.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const O=this._activeBuffer.ybase+this._activeBuffer.y;let q;for(q=this._bufferService.rows-1-this._activeBuffer.scrollBottom,q=this._bufferService.rows-1+this._activeBuffer.ybase-q;D--;)this._activeBuffer.lines.splice(O,1),this._activeBuffer.lines.splice(q,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(R){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.insertCells(this._activeBuffer.x,R.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(R){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.deleteCells(this._activeBuffer.x,R.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(R){let D=R.params[0]||1;for(;D--;)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(R){let D=R.params[0]||1;for(;D--;)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(x.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=R.params[0]||1;for(let O=this._activeBuffer.scrollTop;O<=this._activeBuffer.scrollBottom;++O){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);q.deleteCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=R.params[0]||1;for(let O=this._activeBuffer.scrollTop;O<=this._activeBuffer.scrollBottom;++O){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);q.insertCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=R.params[0]||1;for(let O=this._activeBuffer.scrollTop;O<=this._activeBuffer.scrollBottom;++O){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);q.insertCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=R.params[0]||1;for(let O=this._activeBuffer.scrollTop;O<=this._activeBuffer.scrollBottom;++O){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);q.deleteCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(R){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(R.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(R){const D=this._parser.precedingJoinState;if(!D)return!0;const O=R.params[0]||1,q=N.UnicodeService.extractWidth(D),F=this._activeBuffer.x-q,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(F),te=new Uint32Array(K.length*O);let Q=0;for(let z=0;z<K.length;){const ae=K.codePointAt(z)||0;te[Q++]=ae,z+=ae>65535?2:1}let X=Q;for(let z=1;z<O;++z)te.copyWithin(X,0,Q),X+=Q;return this.print(te,0,X),!0}sendDeviceAttributesPrimary(R){return R.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(R){return R.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(R.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(R){return(this._optionsService.rawOptions.termName+"").indexOf(R)===0}setMode(R){for(let D=0;D<R.length;D++)switch(R.params[D]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(R){for(let D=0;D<R.length;D++)switch(R.params[D]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,b.DEFAULT_CHARSET),this._charsetService.setgCharset(1,b.DEFAULT_CHARSET),this._charsetService.setgCharset(2,b.DEFAULT_CHARSET),this._charsetService.setgCharset(3,b.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(R){for(let D=0;D<R.length;D++)switch(R.params[D]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(R){for(let D=0;D<R.length;D++)switch(R.params[D]){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(),R.params[D]===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(R,D){const O=this._coreService.decPrivateModes,{activeProtocol:q,activeEncoding:F}=this._coreMouseService,K=this._coreService,{buffers:te,cols:Q}=this._bufferService,{active:X,alt:z}=te,ae=this._optionsService.rawOptions,se=De=>De?1:2,ge=R.params[0];return ve=ge,Ne=D?ge===2?4:ge===4?se(K.modes.insertMode):ge===12?3:ge===20?se(ae.convertEol):0:ge===1?se(O.applicationCursorKeys):ge===3?ae.windowOptions.setWinLines?Q===80?2:Q===132?1:0:0:ge===6?se(O.origin):ge===7?se(O.wraparound):ge===8?3:ge===9?se(q==="X10"):ge===12?se(ae.cursorBlink):ge===25?se(!K.isCursorHidden):ge===45?se(O.reverseWraparound):ge===66?se(O.applicationKeypad):ge===67?4:ge===1e3?se(q==="VT200"):ge===1002?se(q==="DRAG"):ge===1003?se(q==="ANY"):ge===1004?se(O.sendFocus):ge===1005?4:ge===1006?se(F==="SGR"):ge===1015?4:ge===1016?se(F==="SGR_PIXELS"):ge===1048?1:ge===47||ge===1047||ge===1049?se(X===z):ge===2004?se(O.bracketedPasteMode):0,K.triggerDataEvent(`${m.C0.ESC}[${D?"":"?"}${ve};${Ne}$y`),!0;var ve,Ne}_updateAttrColor(R,D,O,q,F){return D===2?(R|=50331648,R&=-16777216,R|=j.AttributeData.fromColorRGB([O,q,F])):D===5&&(R&=-50331904,R|=33554432|255&O),R}_extractColor(R,D,O){const q=[0,0,-1,0,0,0];let F=0,K=0;do{if(q[K+F]=R.params[D+K],R.hasSubParams(D+K)){const te=R.getSubParams(D+K);let Q=0;do q[1]===5&&(F=1),q[K+Q+1+F]=te[Q];while(++Q<te.length&&Q+K+1+F<q.length);break}if(q[1]===5&&K+F>=2||q[1]===2&&K+F>=5)break;q[1]&&(F=1)}while(++K+D<R.length&&K+F<q.length);for(let te=2;te<q.length;++te)q[te]===-1&&(q[te]=0);switch(q[0]){case 38:O.fg=this._updateAttrColor(O.fg,q[1],q[3],q[4],q[5]);break;case 48:O.bg=this._updateAttrColor(O.bg,q[1],q[3],q[4],q[5]);break;case 58:O.extended=O.extended.clone(),O.extended.underlineColor=this._updateAttrColor(O.extended.underlineColor,q[1],q[3],q[4],q[5])}return K}_processUnderline(R,D){D.extended=D.extended.clone(),(!~R||R>5)&&(R=1),D.extended.underlineStyle=R,D.fg|=268435456,R===0&&(D.fg&=-268435457),D.updateExtended()}_processSGR0(R){R.fg=x.DEFAULT_ATTR_DATA.fg,R.bg=x.DEFAULT_ATTR_DATA.bg,R.extended=R.extended.clone(),R.extended.underlineStyle=0,R.extended.underlineColor&=-67108864,R.updateExtended()}charAttributes(R){if(R.length===1&&R.params[0]===0)return this._processSGR0(this._curAttrData),!0;const D=R.length;let O;const q=this._curAttrData;for(let F=0;F<D;F++)O=R.params[F],O>=30&&O<=37?(q.fg&=-50331904,q.fg|=16777216|O-30):O>=40&&O<=47?(q.bg&=-50331904,q.bg|=16777216|O-40):O>=90&&O<=97?(q.fg&=-50331904,q.fg|=16777224|O-90):O>=100&&O<=107?(q.bg&=-50331904,q.bg|=16777224|O-100):O===0?this._processSGR0(q):O===1?q.fg|=134217728:O===3?q.bg|=67108864:O===4?(q.fg|=268435456,this._processUnderline(R.hasSubParams(F)?R.getSubParams(F)[0]:1,q)):O===5?q.fg|=536870912:O===7?q.fg|=67108864:O===8?q.fg|=1073741824:O===9?q.fg|=2147483648:O===2?q.bg|=134217728:O===21?this._processUnderline(2,q):O===22?(q.fg&=-134217729,q.bg&=-134217729):O===23?q.bg&=-67108865:O===24?(q.fg&=-268435457,this._processUnderline(0,q)):O===25?q.fg&=-536870913:O===27?q.fg&=-67108865:O===28?q.fg&=-1073741825:O===29?q.fg&=2147483647:O===39?(q.fg&=-67108864,q.fg|=16777215&x.DEFAULT_ATTR_DATA.fg):O===49?(q.bg&=-67108864,q.bg|=16777215&x.DEFAULT_ATTR_DATA.bg):O===38||O===48||O===58?F+=this._extractColor(R,F,q):O===53?q.bg|=1073741824:O===55?q.bg&=-1073741825:O===59?(q.extended=q.extended.clone(),q.extended.underlineColor=-1,q.updateExtended()):O===100?(q.fg&=-67108864,q.fg|=16777215&x.DEFAULT_ATTR_DATA.fg,q.bg&=-67108864,q.bg|=16777215&x.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",O);return!0}deviceStatus(R){switch(R.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const D=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${D};${O}R`)}return!0}deviceStatusPrivate(R){if(R.params[0]===6){const D=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${D};${O}R`)}return!0}softReset(R){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=x.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(R){const D=R.params[0]||1;switch(D){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 O=D%2==1;return this._optionsService.options.cursorBlink=O,!0}setScrollRegion(R){const D=R.params[0]||1;let O;return(R.length<2||(O=R.params[1])>this._bufferService.rows||O===0)&&(O=this._bufferService.rows),O>D&&(this._activeBuffer.scrollTop=D-1,this._activeBuffer.scrollBottom=O-1,this._setCursor(0,0)),!0}windowOptions(R){if(!Y(R.params[0],this._optionsService.rawOptions.windowOptions))return!0;const D=R.length>1?R.params[1]:0;switch(R.params[0]){case 14:D!==2&&this._onRequestWindowsOptionsReport.fire($.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire($.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:D!==0&&D!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),D!==0&&D!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:D!==0&&D!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),D!==0&&D!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(R){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(R){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(R){return this._windowTitle=R,this._onTitleChange.fire(R),!0}setIconName(R){return this._iconName=R,!0}setOrReportIndexedColor(R){const D=[],O=R.split(";");for(;O.length>1;){const q=O.shift(),F=O.shift();if(/^\d+$/.exec(q)){const K=parseInt(q);if(Z(K))if(F==="?")D.push({type:0,index:K});else{const te=(0,B.parseColor)(F);te&&D.push({type:1,index:K,color:te})}}}return D.length&&this._onColor.fire(D),!0}setHyperlink(R){const D=R.split(";");return!(D.length<2)&&(D[1]?this._createHyperlink(D[0],D[1]):!D[0]&&this._finishHyperlink())}_createHyperlink(R,D){this._getCurrentLinkId()&&this._finishHyperlink();const O=R.split(":");let q;const F=O.findIndex((K=>K.startsWith("id=")));return F!==-1&&(q=O[F].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:q,uri:D}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(R,D){const O=R.split(";");for(let q=0;q<O.length&&!(D>=this._specialColors.length);++q,++D)if(O[q]==="?")this._onColor.fire([{type:0,index:this._specialColors[D]}]);else{const F=(0,B.parseColor)(O[q]);F&&this._onColor.fire([{type:1,index:this._specialColors[D],color:F}])}return!0}setOrReportFgColor(R){return this._setOrReportSpecialColor(R,0)}setOrReportBgColor(R){return this._setOrReportSpecialColor(R,1)}setOrReportCursorColor(R){return this._setOrReportSpecialColor(R,2)}restoreIndexedColor(R){if(!R)return this._onColor.fire([{type:2}]),!0;const D=[],O=R.split(";");for(let q=0;q<O.length;++q)if(/^\d+$/.exec(O[q])){const F=parseInt(O[q]);Z(F)&&D.push({type:2,index:F})}return D.length&&this._onColor.fire(D),!0}restoreFgColor(R){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(R){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(R){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,b.DEFAULT_CHARSET),!0}selectCharset(R){return R.length!==2?(this.selectDefaultCharset(),!0):(R[0]==="/"||this._charsetService.setgCharset(H[R[0]],b.CHARSETS[R[1]]||b.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const R=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,R,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=x.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=x.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(R){return this._charsetService.setgLevel(R),!0}screenAlignmentPattern(){const R=new y.CellData;R.content=4194373,R.fg=this._curAttrData.fg,R.bg=this._curAttrData.bg,this._setCursor(0,0);for(let D=0;D<this._bufferService.rows;++D){const O=this._activeBuffer.ybase+this._activeBuffer.y+D,q=this._activeBuffer.lines.get(O);q&&(q.fill(R),q.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(R,D){const O=this._bufferService.buffer,q=this._optionsService.rawOptions;return(F=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${F}${m.C0.ESC}\\`),!0))(R==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:R==='"p'?'P1$r61;1"p':R==="r"?`P1$r${O.scrollTop+1};${O.scrollBottom+1}r`:R==="m"?"P1$r0m":R===" q"?`P1$r${{block:2,underline:4,bar:6}[q.cursorStyle]-(q.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(R,D){this._dirtyRowTracker.markRangeDirty(R,D)}}l.InputHandler=P;let V=class{constructor(ee){this._bufferService=ee,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ee){ee<this.start?this.start=ee:ee>this.end&&(this.end=ee)}markRangeDirty(ee,R){ee>R&&(I=ee,ee=R,R=I),ee<this.start&&(this.start=ee),R>this.end&&(this.end=R)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Z(ee){return 0<=ee&&ee<256}V=f([g(0,A.IBufferService)],V)},844:(p,l)=>{function h(f){for(const g of f)g.dispose();f.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const g=this._disposables.indexOf(f);g!==-1&&this._disposables.splice(g,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var g;this._isDisposed||f===this._value||((g=this._value)==null||g.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},l.toDisposable=function(f){return{dispose:f}},l.disposeArray=h,l.getDisposeArrayDisposable=function(f){return{dispose:()=>h(f)}}},1505:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class h{constructor(){this._data={}}set(g,m,b){this._data[g]||(this._data[g]={}),this._data[g][m]=b}get(g,m){return this._data[g]?this._data[g][m]:void 0}clear(){this._data={}}}l.TwoKeyMap=h,l.FourKeyMap=class{constructor(){this._data=new h}set(f,g,m,b,S){this._data.get(f,g)||this._data.set(f,g,new h),this._data.get(f,g).set(m,b,S)}get(f,g,m,b){var S;return(S=this._data.get(f,g))==null?void 0:S.get(m,b)}clear(){this._data.clear()}}},6114:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const h=l.isNode?"node":navigator.userAgent,f=l.isNode?"node":navigator.platform;l.isFirefox=h.includes("Firefox"),l.isLegacyEdge=h.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(h),l.getSafariVersion=function(){if(!l.isSafari)return 0;const g=h.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),l.isIpad=f==="iPad",l.isIphone=f==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),l.isLinux=f.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(h)},6106:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let h=0;l.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(h=this._search(this._getKey(f)),this._array.splice(h,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const g=this._getKey(f);if(g===void 0||(h=this._search(g),h===-1)||this._getKey(this._array[h])!==g)return!1;do if(this._array[h]===f)return this._array.splice(h,1),!0;while(++h<this._array.length&&this._getKey(this._array[h])===g);return!1}*getKeyIterator(f){if(this._array.length!==0&&(h=this._search(f),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===f))do yield this._array[h];while(++h<this._array.length&&this._getKey(this._array[h])===f)}forEachByKey(f,g){if(this._array.length!==0&&(h=this._search(f),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===f))do g(this._array[h]);while(++h<this._array.length&&this._getKey(this._array[h])===f)}values(){return[...this._array].values()}_search(f){let g=0,m=this._array.length-1;for(;m>=g;){let b=g+m>>1;const S=this._getKey(this._array[b]);if(S>f)m=b-1;else{if(!(S<f)){for(;b>0&&this._getKey(this._array[b-1])===f;)b--;return b}g=b+1}}return g}}},7226:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const f=h(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(S){this._tasks.push(S),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(S){this._idleCallback=void 0;let E=0,C=0,x=S.timeRemaining(),_=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),_=S.timeRemaining(),1.5*C>_)return x-E<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(x-E))}ms`),void this._start();x=_}this.clear()}}class m extends g{_requestCallback(S){return setTimeout((()=>S(this._createDeadline(16))))}_cancelCallback(S){clearTimeout(S)}_createDeadline(S){const E=Date.now()+S;return{timeRemaining:()=>Math.max(0,E-Date.now())}}}l.PriorityTaskQueue=m,l.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(b){return requestIdleCallback(b)}_cancelCallback(b){cancelIdleCallback(b)}}:m,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(b){this._queue.clear(),this._queue.enqueue(b)}flush(){this._queue.flush()}}},9282:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const f=h(643);l.updateWindowsModeWrappedState=function(g){const m=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),b=m==null?void 0:m.get(g.cols-1),S=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);S&&b&&(S.isWrapped=b[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&b[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class h{constructor(){this.fg=0,this.bg=0,this.extended=new f}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 h;return m.fg=this.fg,m.bg=this.bg,m.extended=this.extended.clone(),m}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}l.AttributeData=h;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(m){this._ext=m}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(m){this._ext&=-469762049,this._ext|=m<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(m){this._ext&=-67108864,this._ext|=67108863&m}get urlId(){return this._urlId}set urlId(m){this._urlId=m}get underlineVariantOffset(){const m=(3758096384&this._ext)>>29;return m<0?4294967288^m:m}set underlineVariantOffset(m){this._ext&=536870911,this._ext|=m<<29&3758096384}constructor(m=0,b=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=b}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=f},9092:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const f=h(6349),g=h(7226),m=h(3734),b=h(8437),S=h(4634),E=h(511),C=h(643),x=h(4863),_=h(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(v,y,j){this._hasScrollback=v,this._optionsService=y,this._bufferService=j,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=b.DEFAULT_ATTR_DATA.clone(),this.savedCharset=_.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 f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(v){return v?(this._nullCell.fg=v.fg,this._nullCell.bg=v.bg,this._nullCell.extended=v.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(v){return v?(this._whitespaceCell.fg=v.fg,this._whitespaceCell.bg=v.bg,this._whitespaceCell.extended=v.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(v,y){return new b.BufferLine(this._bufferService.cols,this.getNullCell(v),y)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const v=this.ybase+this.y-this.ydisp;return v>=0&&v<this._rows}_getCorrectBufferLength(v){if(!this._hasScrollback)return v;const y=v+this._optionsService.rawOptions.scrollback;return y>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:y}fillViewportRows(v){if(this.lines.length===0){v===void 0&&(v=b.DEFAULT_ATTR_DATA);let y=this._rows;for(;y--;)this.lines.push(this.getBlankLine(v))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(v,y){const j=this.getNullCell(b.DEFAULT_ATTR_DATA);let A=0;const N=this._getCorrectBufferLength(y);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols<v)for(let T=0;T<this.lines.length;T++)A+=+this.lines.get(T).resize(v,j);let L=0;if(this._rows<y)for(let T=this._rows;T<y;T++)this.lines.length<y+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new b.BufferLine(v,j)):this.ybase>0&&this.lines.length<=this.ybase+this.y+L+1?(this.ybase--,L++,this.ydisp>0&&this.ydisp--):this.lines.push(new b.BufferLine(v,j)));else for(let T=this._rows;T>y;T--)this.lines.length>y+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,v-1),this.y=Math.min(this.y,y-1),L&&(this.y+=L),this.savedX=Math.min(this.savedX,v-1),this.scrollTop=0}if(this.scrollBottom=y-1,this._isReflowEnabled&&(this._reflow(v,y),this._cols>v))for(let L=0;L<this.lines.length;L++)A+=+this.lines.get(L).resize(v,j);this._cols=v,this._rows=y,this._memoryCleanupQueue.clear(),A>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let v=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,v=!1);let y=0;for(;this._memoryCleanupPosition<this.lines.length;)if(y+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),y>100)return!0;return v}get _isReflowEnabled(){const v=this._optionsService.rawOptions.windowsPty;return v&&v.buildNumber?this._hasScrollback&&v.backend==="conpty"&&v.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(v,y){this._cols!==v&&(v>this._cols?this._reflowLarger(v,y):this._reflowSmaller(v,y))}_reflowLarger(v,y){const j=(0,S.reflowLargerGetLinesToRemove)(this.lines,this._cols,v,this.ybase+this.y,this.getNullCell(b.DEFAULT_ATTR_DATA));if(j.length>0){const A=(0,S.reflowLargerCreateNewLayout)(this.lines,j);(0,S.reflowLargerApplyNewLayout)(this.lines,A.layout),this._reflowLargerAdjustViewport(v,y,A.countRemoved)}}_reflowLargerAdjustViewport(v,y,j){const A=this.getNullCell(b.DEFAULT_ATTR_DATA);let N=j;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<y&&this.lines.push(new b.BufferLine(v,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(v,y){const j=this.getNullCell(b.DEFAULT_ATTR_DATA),A=[];let N=0;for(let L=this.lines.length-1;L>=0;L--){let T=this.lines.get(L);if(!T||!T.isWrapped&&T.getTrimmedLength()<=v)continue;const B=[T];for(;T.isWrapped&&L>0;)T=this.lines.get(--L),B.unshift(T);const H=this.ybase+this.y;if(H>=L&&H<L+B.length)continue;const W=B[B.length-1].getTrimmedLength(),Y=(0,S.reflowSmallerGetNewLineLengths)(B,this._cols,v),$=Y.length-B.length;let I;I=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+$):Math.max(0,this.lines.length-this.lines.maxLength+$);const P=[];for(let O=0;O<$;O++){const q=this.getBlankLine(b.DEFAULT_ATTR_DATA,!0);P.push(q)}P.length>0&&(A.push({start:L+B.length+N,newLines:P}),N+=P.length),B.push(...P);let V=Y.length-1,Z=Y[V];Z===0&&(V--,Z=Y[V]);let ee=B.length-$-1,R=W;for(;ee>=0;){const O=Math.min(R,Z);if(B[V]===void 0)break;if(B[V].copyCellsFrom(B[ee],R-O,Z-O,O,!0),Z-=O,Z===0&&(V--,Z=Y[V]),R-=O,R===0){ee--;const q=Math.max(ee,0);R=(0,S.getWrappedLineTrimmedLength)(B,q,this._cols)}}for(let O=0;O<B.length;O++)Y[O]<v&&B[O].setCell(Y[O],j);let D=$-I;for(;D-- >0;)this.ybase===0?this.y<y-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+N)-y&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+$,this.ybase+y-1)}if(A.length>0){const L=[],T=[];for(let V=0;V<this.lines.length;V++)T.push(this.lines.get(V));const B=this.lines.length;let H=B-1,W=0,Y=A[W];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let $=0;for(let V=Math.min(this.lines.maxLength-1,B+N-1);V>=0;V--)if(Y&&Y.start>H+$){for(let Z=Y.newLines.length-1;Z>=0;Z--)this.lines.set(V--,Y.newLines[Z]);V++,L.push({index:H+1,amount:Y.newLines.length}),$+=Y.newLines.length,Y=A[++W]}else this.lines.set(V,T[H--]);let I=0;for(let V=L.length-1;V>=0;V--)L[V].index+=I,this.lines.onInsertEmitter.fire(L[V]),I+=L[V].amount;const P=Math.max(0,B+N-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}}translateBufferLineToString(v,y,j=0,A){const N=this.lines.get(v);return N?N.translateToString(y,j,A):""}getWrappedRangeForLine(v){let y=v,j=v;for(;y>0&&this.lines.get(y).isWrapped;)y--;for(;j+1<this.lines.length&&this.lines.get(j+1).isWrapped;)j++;return{first:y,last:j}}setupTabStops(v){for(v!=null?this.tabs[v]||(v=this.prevStop(v)):(this.tabs={},v=0);v<this._cols;v+=this._optionsService.rawOptions.tabStopWidth)this.tabs[v]=!0}prevStop(v){for(v==null&&(v=this.x);!this.tabs[--v]&&v>0;);return v>=this._cols?this._cols-1:v<0?0:v}nextStop(v){for(v==null&&(v=this.x);!this.tabs[++v]&&v<this._cols;);return v>=this._cols?this._cols-1:v<0?0:v}clearMarkers(v){this._isClearing=!0;for(let y=0;y<this.markers.length;y++)this.markers[y].line===v&&(this.markers[y].dispose(),this.markers.splice(y--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].dispose(),this.markers.splice(v--,1);this._isClearing=!1}addMarker(v){const y=new x.Marker(v);return this.markers.push(y),y.register(this.lines.onTrim((j=>{y.line-=j,y.line<0&&y.dispose()}))),y.register(this.lines.onInsert((j=>{y.line>=j.index&&(y.line+=j.amount)}))),y.register(this.lines.onDelete((j=>{y.line>=j.index&&y.line<j.index+j.amount&&y.dispose(),y.line>j.index&&(y.line-=j.amount)}))),y.register(y.onDispose((()=>this._removeMarker(y)))),y}_removeMarker(v){this._isClearing||this.markers.splice(this.markers.indexOf(v),1)}}},8437:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const f=h(3734),g=h(511),m=h(643),b=h(482);l.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let S=0;class E{constructor(x,_,v=!1){this.isWrapped=v,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*x);const y=_||g.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let j=0;j<x;++j)this.setCell(j,y);this.length=x}get(x){const _=this._data[3*x+0],v=2097151&_;return[this._data[3*x+1],2097152&_?this._combined[x]:v?(0,b.stringFromCodePoint)(v):"",_>>22,2097152&_?this._combined[x].charCodeAt(this._combined[x].length-1):v]}set(x,_){this._data[3*x+1]=_[m.CHAR_DATA_ATTR_INDEX],_[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[x]=_[1],this._data[3*x+0]=2097152|x|_[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*x+0]=_[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(x){return this._data[3*x+0]>>22}hasWidth(x){return 12582912&this._data[3*x+0]}getFg(x){return this._data[3*x+1]}getBg(x){return this._data[3*x+2]}hasContent(x){return 4194303&this._data[3*x+0]}getCodePoint(x){const _=this._data[3*x+0];return 2097152&_?this._combined[x].charCodeAt(this._combined[x].length-1):2097151&_}isCombined(x){return 2097152&this._data[3*x+0]}getString(x){const _=this._data[3*x+0];return 2097152&_?this._combined[x]:2097151&_?(0,b.stringFromCodePoint)(2097151&_):""}isProtected(x){return 536870912&this._data[3*x+2]}loadCell(x,_){return S=3*x,_.content=this._data[S+0],_.fg=this._data[S+1],_.bg=this._data[S+2],2097152&_.content&&(_.combinedData=this._combined[x]),268435456&_.bg&&(_.extended=this._extendedAttrs[x]),_}setCell(x,_){2097152&_.content&&(this._combined[x]=_.combinedData),268435456&_.bg&&(this._extendedAttrs[x]=_.extended),this._data[3*x+0]=_.content,this._data[3*x+1]=_.fg,this._data[3*x+2]=_.bg}setCellFromCodepoint(x,_,v,y){268435456&y.bg&&(this._extendedAttrs[x]=y.extended),this._data[3*x+0]=_|v<<22,this._data[3*x+1]=y.fg,this._data[3*x+2]=y.bg}addCodepointToCell(x,_,v){let y=this._data[3*x+0];2097152&y?this._combined[x]+=(0,b.stringFromCodePoint)(_):2097151&y?(this._combined[x]=(0,b.stringFromCodePoint)(2097151&y)+(0,b.stringFromCodePoint)(_),y&=-2097152,y|=2097152):y=_|4194304,v&&(y&=-12582913,y|=v<<22),this._data[3*x+0]=y}insertCells(x,_,v){if((x%=this.length)&&this.getWidth(x-1)===2&&this.setCellFromCodepoint(x-1,0,1,v),_<this.length-x){const y=new g.CellData;for(let j=this.length-x-_-1;j>=0;--j)this.setCell(x+_+j,this.loadCell(x+j,y));for(let j=0;j<_;++j)this.setCell(x+j,v)}else for(let y=x;y<this.length;++y)this.setCell(y,v);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,v)}deleteCells(x,_,v){if(x%=this.length,_<this.length-x){const y=new g.CellData;for(let j=0;j<this.length-x-_;++j)this.setCell(x+j,this.loadCell(x+_+j,y));for(let j=this.length-_;j<this.length;++j)this.setCell(j,v)}else for(let y=x;y<this.length;++y)this.setCell(y,v);x&&this.getWidth(x-1)===2&&this.setCellFromCodepoint(x-1,0,1,v),this.getWidth(x)!==0||this.hasContent(x)||this.setCellFromCodepoint(x,0,1,v)}replaceCells(x,_,v,y=!1){if(y)for(x&&this.getWidth(x-1)===2&&!this.isProtected(x-1)&&this.setCellFromCodepoint(x-1,0,1,v),_<this.length&&this.getWidth(_-1)===2&&!this.isProtected(_)&&this.setCellFromCodepoint(_,0,1,v);x<_&&x<this.length;)this.isProtected(x)||this.setCell(x,v),x++;else for(x&&this.getWidth(x-1)===2&&this.setCellFromCodepoint(x-1,0,1,v),_<this.length&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_,0,1,v);x<_&&x<this.length;)this.setCell(x++,v)}resize(x,_){if(x===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const v=3*x;if(x>this.length){if(this._data.buffer.byteLength>=4*v)this._data=new Uint32Array(this._data.buffer,0,v);else{const y=new Uint32Array(v);y.set(this._data),this._data=y}for(let y=this.length;y<x;++y)this.setCell(y,_)}else{this._data=this._data.subarray(0,v);const y=Object.keys(this._combined);for(let A=0;A<y.length;A++){const N=parseInt(y[A],10);N>=x&&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>=x&&delete this._extendedAttrs[N]}}return this.length=x,4*v*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const x=new Uint32Array(this._data.length);return x.set(this._data),this._data=x,1}return 0}fill(x,_=!1){if(_)for(let v=0;v<this.length;++v)this.isProtected(v)||this.setCell(v,x);else{this._combined={},this._extendedAttrs={};for(let v=0;v<this.length;++v)this.setCell(v,x)}}copyFrom(x){this.length!==x.length?this._data=new Uint32Array(x._data):this._data.set(x._data),this.length=x.length,this._combined={};for(const _ in x._combined)this._combined[_]=x._combined[_];this._extendedAttrs={};for(const _ in x._extendedAttrs)this._extendedAttrs[_]=x._extendedAttrs[_];this.isWrapped=x.isWrapped}clone(){const x=new E(0);x._data=new Uint32Array(this._data),x.length=this.length;for(const _ in this._combined)x._combined[_]=this._combined[_];for(const _ in this._extendedAttrs)x._extendedAttrs[_]=this._extendedAttrs[_];return x.isWrapped=this.isWrapped,x}getTrimmedLength(){for(let x=this.length-1;x>=0;--x)if(4194303&this._data[3*x+0])return x+(this._data[3*x+0]>>22);return 0}getNoBgTrimmedLength(){for(let x=this.length-1;x>=0;--x)if(4194303&this._data[3*x+0]||50331648&this._data[3*x+2])return x+(this._data[3*x+0]>>22);return 0}copyCellsFrom(x,_,v,y,j){const A=x._data;if(j)for(let L=y-1;L>=0;L--){for(let T=0;T<3;T++)this._data[3*(v+L)+T]=A[3*(_+L)+T];268435456&A[3*(_+L)+2]&&(this._extendedAttrs[v+L]=x._extendedAttrs[_+L])}else for(let L=0;L<y;L++){for(let T=0;T<3;T++)this._data[3*(v+L)+T]=A[3*(_+L)+T];268435456&A[3*(_+L)+2]&&(this._extendedAttrs[v+L]=x._extendedAttrs[_+L])}const N=Object.keys(x._combined);for(let L=0;L<N.length;L++){const T=parseInt(N[L],10);T>=_&&(this._combined[T-_+v]=x._combined[T])}}translateToString(x,_,v,y){_=_??0,v=v??this.length,x&&(v=Math.min(v,this.getTrimmedLength())),y&&(y.length=0);let j="";for(;_<v;){const A=this._data[3*_+0],N=2097151&A,L=2097152&A?this._combined[_]:N?(0,b.stringFromCodePoint)(N):m.WHITESPACE_CELL_CHAR;if(j+=L,y)for(let T=0;T<L.length;++T)y.push(_);_+=A>>22||1}return y&&y.push(_),j}}l.BufferLine=E},4841:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(h,f){if(h.start.y>h.end.y)throw new Error(`Buffer range end (${h.end.x}, ${h.end.y}) cannot be before start (${h.start.x}, ${h.start.y})`);return f*(h.end.y-h.start.y)+(h.end.x-h.start.x+1)}},4634:(p,l)=>{function h(f,g,m){if(g===f.length-1)return f[g].getTrimmedLength();const b=!f[g].hasContent(m-1)&&f[g].getWidth(m-1)===1,S=f[g+1].getWidth(0)===2;return b&&S?m-1:m}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(f,g,m,b,S){const E=[];for(let C=0;C<f.length-1;C++){let x=C,_=f.get(++x);if(!_.isWrapped)continue;const v=[f.get(C)];for(;x<f.length&&_.isWrapped;)v.push(_),_=f.get(++x);if(b>=C&&b<x){C+=v.length-1;continue}let y=0,j=h(v,y,g),A=1,N=0;for(;A<v.length;){const T=h(v,A,g),B=T-N,H=m-j,W=Math.min(B,H);v[y].copyCellsFrom(v[A],N,j,W,!1),j+=W,j===m&&(y++,j=0),N+=W,N===T&&(A++,N=0),j===0&&y!==0&&v[y-1].getWidth(m-1)===2&&(v[y].copyCellsFrom(v[y-1],m-1,j++,1,!1),v[y-1].setCell(m-1,S))}v[y].replaceCells(j,m,S);let L=0;for(let T=v.length-1;T>0&&(T>y||v[T].getTrimmedLength()===0);T--)L++;L>0&&(E.push(C+v.length-L),E.push(L)),C+=v.length-1}return E},l.reflowLargerCreateNewLayout=function(f,g){const m=[];let b=0,S=g[b],E=0;for(let C=0;C<f.length;C++)if(S===C){const x=g[++b];f.onDeleteEmitter.fire({index:C-E,amount:x}),C+=x-1,E+=x,S=g[++b]}else m.push(C);return{layout:m,countRemoved:E}},l.reflowLargerApplyNewLayout=function(f,g){const m=[];for(let b=0;b<g.length;b++)m.push(f.get(g[b]));for(let b=0;b<m.length;b++)f.set(b,m[b]);f.length=g.length},l.reflowSmallerGetNewLineLengths=function(f,g,m){const b=[],S=f.map(((_,v)=>h(f,v,g))).reduce(((_,v)=>_+v));let E=0,C=0,x=0;for(;x<S;){if(S-x<m){b.push(S-x);break}E+=m;const _=h(f,C,g);E>_&&(E-=_,C++);const v=f[C].getWidth(E-1)===2;v&&E--;const y=v?m-1:m;b.push(y),x+=y}return b},l.getWrappedLineTrimmedLength=h},5295:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const f=h(8460),g=h(844),m=h(9092);class b extends g.Disposable{constructor(E,C){super(),this._optionsService=E,this._bufferService=C,this._onBufferActivate=this.register(new f.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new m.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new m.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(E){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(E),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(E,C){this._normal.resize(E,C),this._alt.resize(E,C),this.setupTabStops(E)}setupTabStops(E){this._normal.setupTabStops(E),this._alt.setupTabStops(E)}}l.BufferSet=b},511:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const f=h(482),g=h(643),m=h(3734);class b extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(E){const C=new b;return C.setFromCharData(E),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.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 x=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=x&&x<=56319){const _=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=_&&_<=57343?this.content=1024*(x-55296)+_-56320+65536|E[g.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|E[g.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=E[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|E[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=b},643:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const f=h(8460),g=h(844);class m{get id(){return this._id}constructor(S){this.line=S,this.isDisposed=!1,this._disposables=[],this._id=m._nextId++,this._onDispose=this.register(new f.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(S){return this._disposables.push(S),S}}l.Marker=m,m._nextId=1},7116:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(p,l)=>{var h,f,g;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,(function(m){m.NUL="\0",m.SOH="",m.STX="",m.ETX="",m.EOT="",m.ENQ="",m.ACK="",m.BEL="\x07",m.BS="\b",m.HT=" ",m.LF=`
|
|
64
|
-
`,m.VT="\v",m.FF="\f",m.CR="\r",m.SO="",m.SI="",m.DLE="",m.DC1="",m.DC2="",m.DC3="",m.DC4="",m.NAK="",m.SYN="",m.ETB="",m.CAN="",m.EM="",m.SUB="",m.ESC="\x1B",m.FS="",m.GS="",m.RS="",m.US="",m.SP=" ",m.DEL=""})(h||(l.C0=h={})),(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=""})(f||(l.C1=f={})),(function(m){m.ST=`${h.ESC}\\`})(g||(l.C1_ESCAPED=g={}))},7399:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const f=h(2584),g={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};l.evaluateKeyboardEvent=function(m,b,S,E){const C={type:0,cancel:!1,key:void 0},x=(m.shiftKey?1:0)|(m.altKey?2:0)|(m.ctrlKey?4:0)|(m.metaKey?8:0);switch(m.keyCode){case 0:m.key==="UIKeyInputUpArrow"?C.key=b?f.C0.ESC+"OA":f.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?C.key=b?f.C0.ESC+"OD":f.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?C.key=b?f.C0.ESC+"OC":f.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(C.key=b?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:C.key=m.ctrlKey?"\b":f.C0.DEL,m.altKey&&(C.key=f.C0.ESC+C.key);break;case 9:if(m.shiftKey){C.key=f.C0.ESC+"[Z";break}C.key=f.C0.HT,C.cancel=!0;break;case 13:C.key=m.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,C.cancel=!0;break;case 27:C.key=f.C0.ESC,m.altKey&&(C.key=f.C0.ESC+f.C0.ESC),C.cancel=!0;break;case 37:if(m.metaKey)break;x?(C.key=f.C0.ESC+"[1;"+(x+1)+"D",C.key===f.C0.ESC+"[1;3D"&&(C.key=f.C0.ESC+(S?"b":"[1;5D"))):C.key=b?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(m.metaKey)break;x?(C.key=f.C0.ESC+"[1;"+(x+1)+"C",C.key===f.C0.ESC+"[1;3C"&&(C.key=f.C0.ESC+(S?"f":"[1;5C"))):C.key=b?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(m.metaKey)break;x?(C.key=f.C0.ESC+"[1;"+(x+1)+"A",S||C.key!==f.C0.ESC+"[1;3A"||(C.key=f.C0.ESC+"[1;5A")):C.key=b?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(m.metaKey)break;x?(C.key=f.C0.ESC+"[1;"+(x+1)+"B",S||C.key!==f.C0.ESC+"[1;3B"||(C.key=f.C0.ESC+"[1;5B")):C.key=b?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(C.key=f.C0.ESC+"[2~");break;case 46:C.key=x?f.C0.ESC+"[3;"+(x+1)+"~":f.C0.ESC+"[3~";break;case 36:C.key=x?f.C0.ESC+"[1;"+(x+1)+"H":b?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:C.key=x?f.C0.ESC+"[1;"+(x+1)+"F":b?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:m.shiftKey?C.type=2:m.ctrlKey?C.key=f.C0.ESC+"[5;"+(x+1)+"~":C.key=f.C0.ESC+"[5~";break;case 34:m.shiftKey?C.type=3:m.ctrlKey?C.key=f.C0.ESC+"[6;"+(x+1)+"~":C.key=f.C0.ESC+"[6~";break;case 112:C.key=x?f.C0.ESC+"[1;"+(x+1)+"P":f.C0.ESC+"OP";break;case 113:C.key=x?f.C0.ESC+"[1;"+(x+1)+"Q":f.C0.ESC+"OQ";break;case 114:C.key=x?f.C0.ESC+"[1;"+(x+1)+"R":f.C0.ESC+"OR";break;case 115:C.key=x?f.C0.ESC+"[1;"+(x+1)+"S":f.C0.ESC+"OS";break;case 116:C.key=x?f.C0.ESC+"[15;"+(x+1)+"~":f.C0.ESC+"[15~";break;case 117:C.key=x?f.C0.ESC+"[17;"+(x+1)+"~":f.C0.ESC+"[17~";break;case 118:C.key=x?f.C0.ESC+"[18;"+(x+1)+"~":f.C0.ESC+"[18~";break;case 119:C.key=x?f.C0.ESC+"[19;"+(x+1)+"~":f.C0.ESC+"[19~";break;case 120:C.key=x?f.C0.ESC+"[20;"+(x+1)+"~":f.C0.ESC+"[20~";break;case 121:C.key=x?f.C0.ESC+"[21;"+(x+1)+"~":f.C0.ESC+"[21~";break;case 122:C.key=x?f.C0.ESC+"[23;"+(x+1)+"~":f.C0.ESC+"[23~";break;case 123:C.key=x?f.C0.ESC+"[24;"+(x+1)+"~":f.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(S&&!E||!m.altKey||m.metaKey)!S||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=f.C0.US),m.key==="@"&&(C.key=f.C0.NUL)):m.keyCode===65&&(C.type=1);else{const _=g[m.keyCode],v=_==null?void 0:_[m.shiftKey?1:0];if(v)C.key=f.C0.ESC+v;else if(m.keyCode>=65&&m.keyCode<=90){const y=m.ctrlKey?m.keyCode-64:m.keyCode+32;let j=String.fromCharCode(y);m.shiftKey&&(j=j.toUpperCase()),C.key=f.C0.ESC+j}else if(m.keyCode===32)C.key=f.C0.ESC+(m.ctrlKey?f.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let y=m.code.slice(3,4);m.shiftKey||(y=y.toLowerCase()),C.key=f.C0.ESC+y,C.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?C.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?C.key=f.C0.NUL:m.keyCode>=51&&m.keyCode<=55?C.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?C.key=f.C0.DEL:m.keyCode===219?C.key=f.C0.ESC:m.keyCode===220?C.key=f.C0.FS:m.keyCode===221&&(C.key=f.C0.GS)}return C}},482:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(h){return h>65535?(h-=65536,String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):String.fromCharCode(h)},l.utf32ToString=function(h,f=0,g=h.length){let m="";for(let b=f;b<g;++b){let S=h[b];S>65535?(S-=65536,m+=String.fromCharCode(55296+(S>>10))+String.fromCharCode(S%1024+56320)):m+=String.fromCharCode(S)}return m},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,f){const g=h.length;if(!g)return 0;let m=0,b=0;if(this._interim){const S=h.charCodeAt(b++);56320<=S&&S<=57343?f[m++]=1024*(this._interim-55296)+S-56320+65536:(f[m++]=this._interim,f[m++]=S),this._interim=0}for(let S=b;S<g;++S){const E=h.charCodeAt(S);if(55296<=E&&E<=56319){if(++S>=g)return this._interim=E,m;const C=h.charCodeAt(S);56320<=C&&C<=57343?f[m++]=1024*(E-55296)+C-56320+65536:(f[m++]=E,f[m++]=C)}else E!==65279&&(f[m++]=E)}return m}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,f){const g=h.length;if(!g)return 0;let m,b,S,E,C=0,x=0,_=0;if(this.interim[0]){let j=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let N,L=0;for(;(N=63&this.interim[++L])&&L<4;)A<<=6,A|=N;const T=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,B=T-L;for(;_<B;){if(_>=g)return 0;if(N=h[_++],(192&N)!=128){_--,j=!0;break}this.interim[L++]=N,A<<=6,A|=63&N}j||(T===2?A<128?_--:f[C++]=A:T===3?A<2048||A>=55296&&A<=57343||A===65279||(f[C++]=A):A<65536||A>1114111||(f[C++]=A)),this.interim.fill(0)}const v=g-4;let y=_;for(;y<g;){for(;!(!(y<v)||128&(m=h[y])||128&(b=h[y+1])||128&(S=h[y+2])||128&(E=h[y+3]));)f[C++]=m,f[C++]=b,f[C++]=S,f[C++]=E,y+=4;if(m=h[y++],m<128)f[C++]=m;else if((224&m)==192){if(y>=g)return this.interim[0]=m,C;if(b=h[y++],(192&b)!=128){y--;continue}if(x=(31&m)<<6|63&b,x<128){y--;continue}f[C++]=x}else if((240&m)==224){if(y>=g)return this.interim[0]=m,C;if(b=h[y++],(192&b)!=128){y--;continue}if(y>=g)return this.interim[0]=m,this.interim[1]=b,C;if(S=h[y++],(192&S)!=128){y--;continue}if(x=(15&m)<<12|(63&b)<<6|63&S,x<2048||x>=55296&&x<=57343||x===65279)continue;f[C++]=x}else if((248&m)==240){if(y>=g)return this.interim[0]=m,C;if(b=h[y++],(192&b)!=128){y--;continue}if(y>=g)return this.interim[0]=m,this.interim[1]=b,C;if(S=h[y++],(192&S)!=128){y--;continue}if(y>=g)return this.interim[0]=m,this.interim[1]=b,this.interim[2]=S,C;if(E=h[y++],(192&E)!=128){y--;continue}if(x=(7&m)<<18|(63&b)<<12|(63&S)<<6|63&E,x<65536||x>1114111)continue;f[C++]=x}}return C}}},225:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const f=h(1480),g=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],m=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let b;l.UnicodeV6=class{constructor(){if(this.version="6",!b){b=new Uint8Array(65536),b.fill(1),b[0]=0,b.fill(0,1,32),b.fill(0,127,160),b.fill(2,4352,4448),b[9001]=2,b[9002]=2,b.fill(2,11904,42192),b[12351]=1,b.fill(2,44032,55204),b.fill(2,63744,64256),b.fill(2,65040,65050),b.fill(2,65072,65136),b.fill(2,65280,65377),b.fill(2,65504,65511);for(let S=0;S<g.length;++S)b.fill(0,g[S][0],g[S][1]+1)}}wcwidth(S){return S<32?0:S<127?1:S<65536?b[S]:(function(E,C){let x,_=0,v=C.length-1;if(E<C[0][0]||E>C[v][1])return!1;for(;v>=_;)if(x=_+v>>1,E>C[x][1])_=x+1;else{if(!(E<C[x][0]))return!0;v=x-1}return!1})(S,m)?0:S>=131072&&S<=196605||S>=196608&&S<=262141?2:1}charProperties(S,E){let C=this.wcwidth(S),x=C===0&&E!==0;if(x){const _=f.UnicodeService.extractWidth(E);_===0?x=!1:_>C&&(C=_)}return f.UnicodeService.createPropertyValue(0,C,x)}}},5981:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const f=h(8460),g=h(844);class m extends g.Disposable{constructor(S){super(),this._action=S,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(S,E){if(E!==void 0&&this._syncCalls>E)return void(this._syncCalls=0);if(this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const x=this._callbacks.shift();x&&x()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(S,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+=S.length,this._writeBuffer.push(S),this._callbacks.push(E),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(E)}_innerWrite(S=0,E=!0){const C=S||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const x=this._writeBuffer[this._bufferOffset],_=this._action(x,E);if(_){const y=j=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,j))):this._innerWrite(C,j);return void _.catch((j=>(queueMicrotask((()=>{throw j})),Promise.resolve(!1)))).then(y)}const v=this._callbacks[this._bufferOffset];if(v&&v(),this._bufferOffset++,this._pendingData-=x.length,Date.now()-C>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}l.WriteBuffer=m},5941:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const h=/^([\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})$/,f=/^[\da-f]+$/;function g(m,b){const S=m.toString(16),E=S.length<2?"0"+S:S;switch(b){case 4:return S[0];case 8:return E;case 12:return(E+E).slice(0,3);default:return E+E}}l.parseColor=function(m){if(!m)return;let b=m.toLowerCase();if(b.indexOf("rgb:")===0){b=b.slice(4);const S=h.exec(b);if(S){const E=S[1]?15:S[4]?255:S[7]?4095:65535;return[Math.round(parseInt(S[1]||S[4]||S[7]||S[10],16)/E*255),Math.round(parseInt(S[2]||S[5]||S[8]||S[11],16)/E*255),Math.round(parseInt(S[3]||S[6]||S[9]||S[12],16)/E*255)]}}else if(b.indexOf("#")===0&&(b=b.slice(1),f.exec(b)&&[3,6,9,12].includes(b.length))){const S=b.length/3,E=[0,0,0];for(let C=0;C<3;++C){const x=parseInt(b.slice(S*C,S*C+S),16);E[C]=S===1?x<<4:S===2?x:S===3?x>>4:x>>8}return E}},l.toRgbString=function(m,b=16){const[S,E,C]=m;return`rgb:${g(S,b)}/${g(E,b)}/${g(C,b)}`}},5770:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const f=h(482),g=h(8742),m=h(5770),b=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=b,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=b}registerHandler(E,C){this._handlers[E]===void 0&&(this._handlers[E]=[]);const x=this._handlers[E];return x.push(C),{dispose:()=>{const _=x.indexOf(C);_!==-1&&x.splice(_,1)}}}clearHandler(E){this._handlers[E]&&delete this._handlers[E]}setHandlerFallback(E){this._handlerFb=E}reset(){if(this._active.length)for(let E=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;E>=0;--E)this._active[E].unhook(!1);this._stack.paused=!1,this._active=b,this._ident=0}hook(E,C){if(this.reset(),this._ident=E,this._active=this._handlers[E]||b,this._active.length)for(let x=this._active.length-1;x>=0;x--)this._active[x].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(E,C,x){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(E,C,x);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(E,C,x))}unhook(E,C=!0){if(this._active.length){let x=!1,_=this._active.length-1,v=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,x=C,v=this._stack.fallThrough,this._stack.paused=!1),!v&&x===!1){for(;_>=0&&(x=this._active[_].unhook(E),x!==!0);_--)if(x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,x;_--}for(;_>=0;_--)if(x=this._active[_].unhook(!1),x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,x}else this._handlerFb(this._ident,"UNHOOK",E);this._active=b,this._ident=0}};const S=new g.Params;S.addParam(0),l.DcsHandler=class{constructor(E){this._handler=E,this._data="",this._params=S,this._hitLimit=!1}hook(E){this._params=E.length>1||E.params[0]?E.clone():S,this._data="",this._hitLimit=!1}put(E,C,x){this._hitLimit||(this._data+=(0,f.utf32ToString)(E,C,x),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((x=>(this._params=S,this._data="",this._hitLimit=!1,x)));return this._params=S,this._data="",this._hitLimit=!1,C}}},2015:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const f=h(844),g=h(8742),m=h(6242),b=h(6351);class S{constructor(_){this.table=new Uint8Array(_)}setDefault(_,v){this.table.fill(_<<4|v)}add(_,v,y,j){this.table[v<<8|_]=y<<4|j}addMany(_,v,y,j){for(let A=0;A<_.length;A++)this.table[v<<8|_[A]]=y<<4|j}}l.TransitionTable=S;const E=160;l.VT500_TRANSITION_TABLE=(function(){const x=new S(4095),_=Array.apply(null,Array(256)).map(((L,T)=>T)),v=(L,T)=>_.slice(L,T),y=v(32,127),j=v(0,24);j.push(25),j.push.apply(j,v(28,32));const A=v(0,14);let N;for(N in x.setDefault(1,0),x.addMany(y,0,2,0),A)x.addMany([24,26,153,154],N,3,0),x.addMany(v(128,144),N,3,0),x.addMany(v(144,152),N,3,0),x.add(156,N,0,0),x.add(27,N,11,1),x.add(157,N,4,8),x.addMany([152,158,159],N,0,7),x.add(155,N,11,3),x.add(144,N,11,9);return x.addMany(j,0,3,0),x.addMany(j,1,3,1),x.add(127,1,0,1),x.addMany(j,8,0,8),x.addMany(j,3,3,3),x.add(127,3,0,3),x.addMany(j,4,3,4),x.add(127,4,0,4),x.addMany(j,6,3,6),x.addMany(j,5,3,5),x.add(127,5,0,5),x.addMany(j,2,3,2),x.add(127,2,0,2),x.add(93,1,4,8),x.addMany(y,8,5,8),x.add(127,8,5,8),x.addMany([156,27,24,26,7],8,6,0),x.addMany(v(28,32),8,0,8),x.addMany([88,94,95],1,0,7),x.addMany(y,7,0,7),x.addMany(j,7,0,7),x.add(156,7,0,0),x.add(127,7,0,7),x.add(91,1,11,3),x.addMany(v(64,127),3,7,0),x.addMany(v(48,60),3,8,4),x.addMany([60,61,62,63],3,9,4),x.addMany(v(48,60),4,8,4),x.addMany(v(64,127),4,7,0),x.addMany([60,61,62,63],4,0,6),x.addMany(v(32,64),6,0,6),x.add(127,6,0,6),x.addMany(v(64,127),6,0,0),x.addMany(v(32,48),3,9,5),x.addMany(v(32,48),5,9,5),x.addMany(v(48,64),5,0,6),x.addMany(v(64,127),5,7,0),x.addMany(v(32,48),4,9,5),x.addMany(v(32,48),1,9,2),x.addMany(v(32,48),2,9,2),x.addMany(v(48,127),2,10,0),x.addMany(v(48,80),1,10,0),x.addMany(v(81,88),1,10,0),x.addMany([89,90,92],1,10,0),x.addMany(v(96,127),1,10,0),x.add(80,1,11,9),x.addMany(j,9,0,9),x.add(127,9,0,9),x.addMany(v(28,32),9,0,9),x.addMany(v(32,48),9,9,12),x.addMany(v(48,60),9,8,10),x.addMany([60,61,62,63],9,9,10),x.addMany(j,11,0,11),x.addMany(v(32,128),11,0,11),x.addMany(v(28,32),11,0,11),x.addMany(j,10,0,10),x.add(127,10,0,10),x.addMany(v(28,32),10,0,10),x.addMany(v(48,60),10,8,10),x.addMany([60,61,62,63],10,0,11),x.addMany(v(32,48),10,9,12),x.addMany(j,12,0,12),x.add(127,12,0,12),x.addMany(v(28,32),12,0,12),x.addMany(v(32,48),12,9,12),x.addMany(v(48,64),12,0,11),x.addMany(v(64,127),12,12,13),x.addMany(v(64,127),10,12,13),x.addMany(v(64,127),9,12,13),x.addMany(j,13,13,13),x.addMany(y,13,13,13),x.add(127,13,0,13),x.addMany([27,156,24,26],13,14,0),x.add(E,0,2,0),x.add(E,8,5,8),x.add(E,6,0,6),x.add(E,11,0,11),x.add(E,13,13,13),x})();class C extends f.Disposable{constructor(_=l.VT500_TRANSITION_TABLE){super(),this._transitions=_,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(v,y,j)=>{},this._executeHandlerFb=v=>{},this._csiHandlerFb=(v,y)=>{},this._escHandlerFb=v=>{},this._errorHandlerFb=v=>v,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new m.OscParser),this._dcsParser=this.register(new b.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(_,v=[64,126]){let y=0;if(_.prefix){if(_.prefix.length>1)throw new Error("only one byte as prefix supported");if(y=_.prefix.charCodeAt(0),y&&60>y||y>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(_.intermediates){if(_.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let A=0;A<_.intermediates.length;++A){const N=_.intermediates.charCodeAt(A);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");y<<=8,y|=N}}if(_.final.length!==1)throw new Error("final must be a single byte");const j=_.final.charCodeAt(0);if(v[0]>j||j>v[1])throw new Error(`final must be in range ${v[0]} .. ${v[1]}`);return y<<=8,y|=j,y}identToString(_){const v=[];for(;_;)v.push(String.fromCharCode(255&_)),_>>=8;return v.reverse().join("")}setPrintHandler(_){this._printHandler=_}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(_,v){const y=this._identifier(_,[48,126]);this._escHandlers[y]===void 0&&(this._escHandlers[y]=[]);const j=this._escHandlers[y];return j.push(v),{dispose:()=>{const A=j.indexOf(v);A!==-1&&j.splice(A,1)}}}clearEscHandler(_){this._escHandlers[this._identifier(_,[48,126])]&&delete this._escHandlers[this._identifier(_,[48,126])]}setEscHandlerFallback(_){this._escHandlerFb=_}setExecuteHandler(_,v){this._executeHandlers[_.charCodeAt(0)]=v}clearExecuteHandler(_){this._executeHandlers[_.charCodeAt(0)]&&delete this._executeHandlers[_.charCodeAt(0)]}setExecuteHandlerFallback(_){this._executeHandlerFb=_}registerCsiHandler(_,v){const y=this._identifier(_);this._csiHandlers[y]===void 0&&(this._csiHandlers[y]=[]);const j=this._csiHandlers[y];return j.push(v),{dispose:()=>{const A=j.indexOf(v);A!==-1&&j.splice(A,1)}}}clearCsiHandler(_){this._csiHandlers[this._identifier(_)]&&delete this._csiHandlers[this._identifier(_)]}setCsiHandlerFallback(_){this._csiHandlerFb=_}registerDcsHandler(_,v){return this._dcsParser.registerHandler(this._identifier(_),v)}clearDcsHandler(_){this._dcsParser.clearHandler(this._identifier(_))}setDcsHandlerFallback(_){this._dcsParser.setHandlerFallback(_)}registerOscHandler(_,v){return this._oscParser.registerHandler(_,v)}clearOscHandler(_){this._oscParser.clearHandler(_)}setOscHandlerFallback(_){this._oscParser.setHandlerFallback(_)}setErrorHandler(_){this._errorHandler=_}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(_,v,y,j,A){this._parseStack.state=_,this._parseStack.handlers=v,this._parseStack.handlerPos=y,this._parseStack.transition=j,this._parseStack.chunkPos=A}parse(_,v,y){let j,A=0,N=0,L=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,L=this._parseStack.chunkPos+1;else{if(y===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(y===!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(y===!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=_[this._parseStack.chunkPos],j=this._dcsParser.unhook(A!==24&&A!==26,y),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(A=_[this._parseStack.chunkPos],j=this._oscParser.end(A!==24&&A!==26,y),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,L=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let T=L;T<v;++T){switch(A=_[T],N=this._transitions.table[this.currentState<<8|(A<160?A:E)],N>>4){case 2:for(let $=T+1;;++$){if($>=v||(A=_[$])<32||A>126&&A<E){this._printHandler(_,T,$),T=$-1;break}if(++$>=v||(A=_[$])<32||A>126&&A<E){this._printHandler(_,T,$),T=$-1;break}if(++$>=v||(A=_[$])<32||A>126&&A<E){this._printHandler(_,T,$),T=$-1;break}if(++$>=v||(A=_[$])<32||A>126&&A<E){this._printHandler(_,T,$),T=$-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<v&&(A=_[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 Y=W?W.length-1:-1;for(;Y>=0&&(j=W[Y](),j!==!0);Y--)if(j instanceof Promise)return this._preserveStack(4,W,Y,N,T),j;Y<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 $=T+1;;++$)if($>=v||(A=_[$])===24||A===26||A===27||A>127&&A<E){this._dcsParser.put(_,T,$),T=$-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 $=T+1;;$++)if($>=v||(A=_[$])<32||A>127&&A<E){this._oscParser.put(_,T,$),T=$-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}}}l.EscapeSequenceParser=C},6242:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const f=h(5770),g=h(482),m=[];l.OscParser=class{constructor(){this._state=0,this._active=m,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(b,S){this._handlers[b]===void 0&&(this._handlers[b]=[]);const E=this._handlers[b];return E.push(S),{dispose:()=>{const C=E.indexOf(S);C!==-1&&E.splice(C,1)}}}clearHandler(b){this._handlers[b]&&delete this._handlers[b]}setHandlerFallback(b){this._handlerFb=b}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let b=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;b>=0;--b)this._active[b].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].start();else this._handlerFb(this._id,"START")}_put(b,S,E){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(b,S,E);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(b,S,E))}start(){this.reset(),this._state=1}put(b,S,E){if(this._state!==3){if(this._state===1)for(;S<E;){const C=b[S++];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-S>0&&this._put(b,S,E)}}end(b,S=!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,x=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,E=S,x=this._stack.fallThrough,this._stack.paused=!1),!x&&E===!1){for(;C>=0&&(E=this._active[C].end(b),E!==!0);C--)if(E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,E;C--}for(;C>=0;C--)if(E=this._active[C].end(!1),E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,E}else this._handlerFb(this._id,"END",b);this._active=m,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(b){this._handler=b,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(b,S,E){this._hitLimit||(this._data+=(0,g.utf32ToString)(b,S,E),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(b){let S=!1;if(this._hitLimit)S=!1;else if(b&&(S=this._handler(this._data),S instanceof Promise))return S.then((E=>(this._data="",this._hitLimit=!1,E)));return this._data="",this._hitLimit=!1,S}}},8742:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const h=2147483647;class f{static fromArray(m){const b=new f;if(!m.length)return b;for(let S=Array.isArray(m[0])?1:0;S<m.length;++S){const E=m[S];if(Array.isArray(E))for(let C=0;C<E.length;++C)b.addSubParam(E[C]);else b.addParam(E)}return b}constructor(m=32,b=32){if(this.maxLength=m,this.maxSubParamsLength=b,b>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(b),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new f(this.maxLength,this.maxSubParamsLength);return m.params.set(this.params),m.length=this.length,m._subParams.set(this._subParams),m._subParamsLength=this._subParamsLength,m._subParamsIdx.set(this._subParamsIdx),m._rejectDigits=this._rejectDigits,m._rejectSubDigits=this._rejectSubDigits,m._digitIsSub=this._digitIsSub,m}toArray(){const m=[];for(let b=0;b<this.length;++b){m.push(this.params[b]);const S=this._subParamsIdx[b]>>8,E=255&this._subParamsIdx[b];E-S>0&&m.push(Array.prototype.slice.call(this._subParams,S,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>h?h: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>h?h:m,this._subParamsIdx[this.length-1]++}}hasSubParams(m){return(255&this._subParamsIdx[m])-(this._subParamsIdx[m]>>8)>0}getSubParams(m){const b=this._subParamsIdx[m]>>8,S=255&this._subParamsIdx[m];return S-b>0?this._subParams.subarray(b,S):null}getSubParamsAll(){const m={};for(let b=0;b<this.length;++b){const S=this._subParamsIdx[b]>>8,E=255&this._subParamsIdx[b];E-S>0&&(m[b]=this._subParams.slice(S,E))}return m}addDigit(m){let b;if(this._rejectDigits||!(b=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const S=this._digitIsSub?this._subParams:this.params,E=S[b-1];S[b-1]=~E?Math.min(10*E+m,h):m}}l.Params=f},5741:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let h=this._addons.length-1;h>=0;h--)this._addons[h].instance.dispose()}loadAddon(h,f){const g={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(g),f.dispose=()=>this._wrappedAddonDispose(g),f.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let f=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===h){f=g;break}if(f===-1)throw new Error("Could not dispose an addon that has not been loaded");h.isDisposed=!0,h.dispose.apply(h.instance),this._addons.splice(f,1)}}},8771:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const f=h(3785),g=h(511);l.BufferApiView=class{constructor(m,b){this._buffer=m,this.type=b}init(m){return this._buffer=m,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(m){const b=this._buffer.lines.get(m);if(b)return new f.BufferLineApiView(b)}getNullCell(){return new g.CellData}}},3785:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const f=h(511);l.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,m){if(!(g<0||g>=this._line.length))return m?(this._line.loadCell(g,m),m):this._line.loadCell(g,new f.CellData)}translateToString(g,m,b){return this._line.translateToString(g,m,b)}}},8285:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const f=h(8771),g=h(8460),m=h(844);class b extends m.Disposable{constructor(E){super(),this._core=E,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}l.BufferNamespaceApi=b},7975:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(h){this._core=h}registerCsiHandler(h,f){return this._core.registerCsiHandler(h,(g=>f(g.toArray())))}addCsiHandler(h,f){return this.registerCsiHandler(h,f)}registerDcsHandler(h,f){return this._core.registerDcsHandler(h,((g,m)=>f(g,m.toArray())))}addDcsHandler(h,f){return this.registerDcsHandler(h,f)}registerEscHandler(h,f){return this._core.registerEscHandler(h,f)}addEscHandler(h,f){return this.registerEscHandler(h,f)}registerOscHandler(h,f){return this._core.registerOscHandler(h,f)}addOscHandler(h,f){return this.registerOscHandler(h,f)}}},7090:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(h){this._core=h}register(h){this._core.unicodeService.register(h)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(h){this._core.unicodeService.activeVersion=h}}},744:function(p,l,h){var f=this&&this.__decorate||function(x,_,v,y){var j,A=arguments.length,N=A<3?_:y===null?y=Object.getOwnPropertyDescriptor(_,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,_,v,y);else for(var L=x.length-1;L>=0;L--)(j=x[L])&&(N=(A<3?j(N):A>3?j(_,v,N):j(_,v))||N);return A>3&&N&&Object.defineProperty(_,v,N),N},g=this&&this.__param||function(x,_){return function(v,y){_(v,y,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const m=h(8460),b=h(844),S=h(5295),E=h(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let C=l.BufferService=class extends b.Disposable{get buffer(){return this.buffers.active}constructor(x){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(x.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(x.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new S.BufferSet(x,this))}resize(x,_){this.cols=x,this.rows=_,this.buffers.resize(x,_),this._onResize.fire({cols:x,rows:_})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(x,_=!1){const v=this.buffer;let y;y=this._cachedBlankLine,y&&y.length===this.cols&&y.getFg(0)===x.fg&&y.getBg(0)===x.bg||(y=v.getBlankLine(x,_),this._cachedBlankLine=y),y.isWrapped=_;const j=v.ybase+v.scrollTop,A=v.ybase+v.scrollBottom;if(v.scrollTop===0){const N=v.lines.isFull;A===v.lines.length-1?N?v.lines.recycle().copyFrom(y):v.lines.push(y.clone()):v.lines.splice(A+1,0,y.clone()),N?this.isUserScrolling&&(v.ydisp=Math.max(v.ydisp-1,0)):(v.ybase++,this.isUserScrolling||v.ydisp++)}else{const N=A-j+1;v.lines.shiftElements(j+1,N-1,-1),v.lines.set(A,y.clone())}this.isUserScrolling||(v.ydisp=v.ybase),this._onScroll.fire(v.ydisp)}scrollLines(x,_,v){const y=this.buffer;if(x<0){if(y.ydisp===0)return;this.isUserScrolling=!0}else x+y.ydisp>=y.ybase&&(this.isUserScrolling=!1);const j=y.ydisp;y.ydisp=Math.max(Math.min(y.ydisp+x,y.ybase),0),j!==y.ydisp&&(_||this._onScroll.fire(y.ydisp))}};l.BufferService=C=f([g(0,E.IOptionsService)],C)},7994:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(h){this.glevel=h,this.charset=this._charsets[h]}setgCharset(h,f){this._charsets[h]=f,this.glevel===h&&(this.charset=f)}}},1753:function(p,l,h){var f=this&&this.__decorate||function(y,j,A,N){var L,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(y,j,A,N);else for(var H=y.length-1;H>=0;H--)(L=y[H])&&(B=(T<3?L(B):T>3?L(j,A,B):L(j,A))||B);return T>3&&B&&Object.defineProperty(j,A,B),B},g=this&&this.__param||function(y,j){return function(A,N){j(A,N,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const m=h(2585),b=h(8460),S=h(844),E={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:y=>y.button!==4&&y.action===1&&(y.ctrl=!1,y.alt=!1,y.shift=!1,!0)},VT200:{events:19,restrict:y=>y.action!==32},DRAG:{events:23,restrict:y=>y.action!==32||y.button!==3},ANY:{events:31,restrict:y=>!0}};function C(y,j){let A=(y.ctrl?16:0)|(y.shift?4:0)|(y.alt?8:0);return y.button===4?(A|=64,A|=y.action):(A|=3&y.button,4&y.button&&(A|=64),8&y.button&&(A|=128),y.action===32?A|=32:y.action!==0||j||(A|=3)),A}const x=String.fromCharCode,_={DEFAULT:y=>{const j=[C(y,!1)+32,y.col+32,y.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`\x1B[M${x(j[0])}${x(j[1])}${x(j[2])}`},SGR:y=>{const j=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.col};${y.row}${j}`},SGR_PIXELS:y=>{const j=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.x};${y.y}${j}`}};let v=l.CoreMouseService=class extends S.Disposable{constructor(y,j){super(),this._bufferService=y,this._coreService=j,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new b.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const A of Object.keys(E))this.addProtocol(A,E[A]);for(const A of Object.keys(_))this.addEncoding(A,_[A]);this.reset()}addProtocol(y,j){this._protocols[y]=j}addEncoding(y,j){this._encodings[y]=j}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(y){if(!this._protocols[y])throw new Error(`unknown protocol "${y}"`);this._activeProtocol=y,this._onProtocolChange.fire(this._protocols[y].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(y){if(!this._encodings[y])throw new Error(`unknown encoding "${y}"`);this._activeEncoding=y}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(y){if(y.col<0||y.col>=this._bufferService.cols||y.row<0||y.row>=this._bufferService.rows||y.button===4&&y.action===32||y.button===3&&y.action!==32||y.button!==4&&(y.action===2||y.action===3)||(y.col++,y.row++,y.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,y,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(y))return!1;const j=this._encodings[this._activeEncoding](y);return j&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(j):this._coreService.triggerDataEvent(j,!0)),this._lastEvent=y,!0}explainEvents(y){return{down:!!(1&y),up:!!(2&y),drag:!!(4&y),move:!!(8&y),wheel:!!(16&y)}}_equalEvents(y,j,A){if(A){if(y.x!==j.x||y.y!==j.y)return!1}else if(y.col!==j.col||y.row!==j.row)return!1;return y.button===j.button&&y.action===j.action&&y.ctrl===j.ctrl&&y.alt===j.alt&&y.shift===j.shift}};l.CoreMouseService=v=f([g(0,m.IBufferService),g(1,m.ICoreService)],v)},6975:function(p,l,h){var f=this&&this.__decorate||function(v,y,j,A){var N,L=arguments.length,T=L<3?y:A===null?A=Object.getOwnPropertyDescriptor(y,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(v,y,j,A);else for(var B=v.length-1;B>=0;B--)(N=v[B])&&(T=(L<3?N(T):L>3?N(y,j,T):N(y,j))||T);return L>3&&T&&Object.defineProperty(y,j,T),T},g=this&&this.__param||function(v,y){return function(j,A){y(j,A,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const m=h(1439),b=h(8460),S=h(844),E=h(2585),C=Object.freeze({insertMode:!1}),x=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let _=l.CoreService=class extends S.Disposable{constructor(v,y,j){super(),this._bufferService=v,this._logService=y,this._optionsService=j,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new b.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new b.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(x)}reset(){this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(x)}triggerDataEvent(v,y=!1){if(this._optionsService.rawOptions.disableStdin)return;const j=this._bufferService.buffer;y&&this._optionsService.rawOptions.scrollOnUserInput&&j.ybase!==j.ydisp&&this._onRequestScrollToBottom.fire(),y&&this._onUserInput.fire(),this._logService.debug(`sending data "${v}"`,(()=>v.split("").map((A=>A.charCodeAt(0))))),this._onData.fire(v)}triggerBinaryEvent(v){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${v}"`,(()=>v.split("").map((y=>y.charCodeAt(0))))),this._onBinary.fire(v))}};l.CoreService=_=f([g(0,E.IBufferService),g(1,E.ILogService),g(2,E.IOptionsService)],_)},9074:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const f=h(8055),g=h(8460),m=h(844),b=h(6106);let S=0,E=0;class C extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new b.SortedList((v=>v==null?void 0:v.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,m.toDisposable)((()=>this.reset())))}registerDecoration(v){if(v.marker.isDisposed)return;const y=new x(v);if(y){const j=y.marker.onDispose((()=>y.dispose()));y.onDispose((()=>{y&&(this._decorations.delete(y)&&this._onDecorationRemoved.fire(y),j.dispose())})),this._decorations.insert(y),this._onDecorationRegistered.fire(y)}return y}reset(){for(const v of this._decorations.values())v.dispose();this._decorations.clear()}*getDecorationsAtCell(v,y,j){let A=0,N=0;for(const L of this._decorations.getKeyIterator(y))A=L.options.x??0,N=A+(L.options.width??1),v>=A&&v<N&&(!j||(L.options.layer??"bottom")===j)&&(yield L)}forEachDecorationAtCell(v,y,j,A){this._decorations.forEachByKey(y,(N=>{S=N.options.x??0,E=S+(N.options.width??1),v>=S&&v<E&&(!j||(N.options.layer??"bottom")===j)&&A(N)}))}}l.DecorationService=C;class x extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=f.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=f.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(v){super(),this.options=v,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=v.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const f=h(2585),g=h(8343);class m{constructor(...S){this._entries=new Map;for(const[E,C]of S)this.set(E,C)}set(S,E){const C=this._entries.get(S);return this._entries.set(S,E),C}forEach(S){for(const[E,C]of this._entries.entries())S(E,C)}has(S){return this._entries.has(S)}get(S){return this._entries.get(S)}}l.ServiceCollection=m,l.InstantiationService=class{constructor(){this._services=new m,this._services.set(f.IInstantiationService,this)}setService(b,S){this._services.set(b,S)}getService(b){return this._services.get(b)}createInstance(b,...S){const E=(0,g.getServiceDependencies)(b).sort(((_,v)=>_.index-v.index)),C=[];for(const _ of E){const v=this._services.get(_.id);if(!v)throw new Error(`[createInstance] ${b.name} depends on UNKNOWN service ${_.id}.`);C.push(v)}const x=E.length>0?E[0].index:S.length;if(S.length!==x)throw new Error(`[createInstance] First service dependency of ${b.name} at position ${x+1} conflicts with ${S.length} static arguments`);return new b(...S,...C)}}},7866:function(p,l,h){var f=this&&this.__decorate||function(x,_,v,y){var j,A=arguments.length,N=A<3?_:y===null?y=Object.getOwnPropertyDescriptor(_,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,_,v,y);else for(var L=x.length-1;L>=0;L--)(j=x[L])&&(N=(A<3?j(N):A>3?j(_,v,N):j(_,v))||N);return A>3&&N&&Object.defineProperty(_,v,N),N},g=this&&this.__param||function(x,_){return function(v,y){_(v,y,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const m=h(844),b=h(2585),S={trace:b.LogLevelEnum.TRACE,debug:b.LogLevelEnum.DEBUG,info:b.LogLevelEnum.INFO,warn:b.LogLevelEnum.WARN,error:b.LogLevelEnum.ERROR,off:b.LogLevelEnum.OFF};let E,C=l.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(x){super(),this._optionsService=x,this._logLevel=b.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),E=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(x){for(let _=0;_<x.length;_++)typeof x[_]=="function"&&(x[_]=x[_]())}_log(x,_,v){this._evalLazyOptionalParams(v),x.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+_,...v)}trace(x,..._){var v;this._logLevel<=b.LogLevelEnum.TRACE&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.trace.bind(this._optionsService.options.logger))??console.log,x,_)}debug(x,..._){var v;this._logLevel<=b.LogLevelEnum.DEBUG&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.debug.bind(this._optionsService.options.logger))??console.log,x,_)}info(x,..._){var v;this._logLevel<=b.LogLevelEnum.INFO&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.info.bind(this._optionsService.options.logger))??console.info,x,_)}warn(x,..._){var v;this._logLevel<=b.LogLevelEnum.WARN&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.warn.bind(this._optionsService.options.logger))??console.warn,x,_)}error(x,..._){var v;this._logLevel<=b.LogLevelEnum.ERROR&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.error.bind(this._optionsService.options.logger))??console.error,x,_)}};l.LogService=C=f([g(0,b.IOptionsService)],C),l.setTraceLogger=function(x){E=x},l.traceCall=function(x,_,v){if(typeof v.value!="function")throw new Error("not supported");const y=v.value;v.value=function(...j){if(E.logLevel!==b.LogLevelEnum.TRACE)return y.apply(this,j);E.trace(`GlyphRenderer#${y.name}(${j.map((N=>JSON.stringify(N))).join(", ")})`);const A=y.apply(this,j);return E.trace(`GlyphRenderer#${y.name} return`,A),A}}},7302:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const f=h(8460),g=h(844),m=h(6114);l.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:m.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const b=["normal","bold","100","200","300","400","500","600","700","800","900"];class S extends g.Disposable{constructor(C){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const x={...l.DEFAULT_OPTIONS};for(const _ in C)if(_ in x)try{const v=C[_];x[_]=this._sanitizeAndValidateOption(_,v)}catch(v){console.error(v)}this.rawOptions=x,this.options={...x},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,x){return this.onOptionChange((_=>{_===C&&x(this.rawOptions[C])}))}onMultipleOptionChange(C,x){return this.onOptionChange((_=>{C.indexOf(_)!==-1&&x()}))}_setupOptions(){const C=_=>{if(!(_ in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);return this.rawOptions[_]},x=(_,v)=>{if(!(_ in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);v=this._sanitizeAndValidateOption(_,v),this.rawOptions[_]!==v&&(this.rawOptions[_]=v,this._onOptionChange.fire(_))};for(const _ in this.rawOptions){const v={get:C.bind(this,_),set:x.bind(this,_)};Object.defineProperty(this.options,_,v)}}_sanitizeAndValidateOption(C,x){switch(C){case"cursorStyle":if(x||(x=l.DEFAULT_OPTIONS[C]),!(function(_){return _==="block"||_==="underline"||_==="bar"})(x))throw new Error(`"${x}" is not a valid value for ${C}`);break;case"wordSeparator":x||(x=l.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof x=="number"&&1<=x&&x<=1e3)break;x=b.includes(x)?x:l.DEFAULT_OPTIONS[C];break;case"cursorWidth":x=Math.floor(x);case"lineHeight":case"tabStopWidth":if(x<1)throw new Error(`${C} cannot be less than 1, value: ${x}`);break;case"minimumContrastRatio":x=Math.max(1,Math.min(21,Math.round(10*x)/10));break;case"scrollback":if((x=Math.min(x,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${x}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(x<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${x}`);break;case"rows":case"cols":if(!x&&x!==0)throw new Error(`${C} must be numeric, value: ${x}`);break;case"windowsPty":x=x??{}}return x}}l.OptionsService=S},2660:function(p,l,h){var f=this&&this.__decorate||function(S,E,C,x){var _,v=arguments.length,y=v<3?E:x===null?x=Object.getOwnPropertyDescriptor(E,C):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(S,E,C,x);else for(var j=S.length-1;j>=0;j--)(_=S[j])&&(y=(v<3?_(y):v>3?_(E,C,y):_(E,C))||y);return v>3&&y&&Object.defineProperty(E,C,y),y},g=this&&this.__param||function(S,E){return function(C,x){E(C,x,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const m=h(2585);let b=l.OscLinkService=class{constructor(S){this._bufferService=S,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(S){const E=this._bufferService.buffer;if(S.id===void 0){const j=E.addMarker(E.ybase+E.y),A={data:S,id:this._nextId++,lines:[j]};return j.onDispose((()=>this._removeMarkerFromLink(A,j))),this._dataByLinkId.set(A.id,A),A.id}const C=S,x=this._getEntryIdKey(C),_=this._entriesWithId.get(x);if(_)return this.addLineToLink(_.id,E.ybase+E.y),_.id;const v=E.addMarker(E.ybase+E.y),y={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(y,v))),this._entriesWithId.set(y.key,y),this._dataByLinkId.set(y.id,y),y.id}addLineToLink(S,E){const C=this._dataByLinkId.get(S);if(C&&C.lines.every((x=>x.line!==E))){const x=this._bufferService.buffer.addMarker(E);C.lines.push(x),x.onDispose((()=>this._removeMarkerFromLink(C,x)))}}getLinkData(S){var E;return(E=this._dataByLinkId.get(S))==null?void 0:E.data}_getEntryIdKey(S){return`${S.id};;${S.uri}`}_removeMarkerFromLink(S,E){const C=S.lines.indexOf(E);C!==-1&&(S.lines.splice(C,1),S.lines.length===0&&(S.data.id!==void 0&&this._entriesWithId.delete(S.key),this._dataByLinkId.delete(S.id)))}};l.OscLinkService=b=f([g(0,m.IBufferService)],b)},8343:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const h="di$target",f="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(g){return g[f]||[]},l.createDecorator=function(g){if(l.serviceRegistry.has(g))return l.serviceRegistry.get(g);const m=function(b,S,E){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,x,_){x[h]===x?x[f].push({id:C,index:_}):(x[f]=[{id:C,index:_}],x[h]=x)})(m,b,E)};return m.toString=()=>g,l.serviceRegistry.set(g,m),m}},2585:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const f=h(8343);var g;l.IBufferService=(0,f.createDecorator)("BufferService"),l.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),l.ICoreService=(0,f.createDecorator)("CoreService"),l.ICharsetService=(0,f.createDecorator)("CharsetService"),l.IInstantiationService=(0,f.createDecorator)("InstantiationService"),(function(m){m[m.TRACE=0]="TRACE",m[m.DEBUG=1]="DEBUG",m[m.INFO=2]="INFO",m[m.WARN=3]="WARN",m[m.ERROR=4]="ERROR",m[m.OFF=5]="OFF"})(g||(l.LogLevelEnum=g={})),l.ILogService=(0,f.createDecorator)("LogService"),l.IOptionsService=(0,f.createDecorator)("OptionsService"),l.IOscLinkService=(0,f.createDecorator)("OscLinkService"),l.IUnicodeService=(0,f.createDecorator)("UnicodeService"),l.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const f=h(8460),g=h(225);class m{static extractShouldJoin(S){return(1&S)!=0}static extractWidth(S){return S>>1&3}static extractCharKind(S){return S>>3}static createPropertyValue(S,E,C=!1){return(16777215&S)<<3|(3&E)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const S=new g.UnicodeV6;this.register(S),this._active=S.version,this._activeProvider=S}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(S){if(!this._providers[S])throw new Error(`unknown Unicode version "${S}"`);this._active=S,this._activeProvider=this._providers[S],this._onChange.fire(S)}register(S){this._providers[S.version]=S}wcwidth(S){return this._activeProvider.wcwidth(S)}getStringCellWidth(S){let E=0,C=0;const x=S.length;for(let _=0;_<x;++_){let v=S.charCodeAt(_);if(55296<=v&&v<=56319){if(++_>=x)return E+this.wcwidth(v);const A=S.charCodeAt(_);56320<=A&&A<=57343?v=1024*(v-55296)+A-56320+65536:E+=this.wcwidth(A)}const y=this.charProperties(v,C);let j=m.extractWidth(y);m.extractShouldJoin(y)&&(j-=m.extractWidth(C)),E+=j,C=y}return E}charProperties(S,E){return this._activeProvider.charProperties(S,E)}}l.UnicodeService=m}},s={};function c(p){var l=s[p];if(l!==void 0)return l.exports;var h=s[p]={exports:{}};return i[p].call(h.exports,h,h.exports,c),h.exports}var d={};return(()=>{var p=d;Object.defineProperty(p,"__esModule",{value:!0}),p.Terminal=void 0;const l=c(9042),h=c(3236),f=c(844),g=c(5741),m=c(8285),b=c(7975),S=c(7090),E=["cols","rows"];class C extends f.Disposable{constructor(_){super(),this._core=this.register(new h.Terminal(_)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const v=j=>this._core.options[j],y=(j,A)=>{this._checkReadonlyOptions(j),this._core.options[j]=A};for(const j in this._core.options){const A={get:v.bind(this,j),set:y.bind(this,j)};Object.defineProperty(this._publicOptions,j,A)}}_checkReadonlyOptions(_){if(E.includes(_))throw new Error(`Option "${_}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new b.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new S.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 _=this._core.coreService.decPrivateModes;let v="none";switch(this._core.coreMouseService.activeProtocol){case"X10":v="x10";break;case"VT200":v="vt200";break;case"DRAG":v="drag";break;case"ANY":v="any"}return{applicationCursorKeysMode:_.applicationCursorKeys,applicationKeypadMode:_.applicationKeypad,bracketedPasteMode:_.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:v,originMode:_.origin,reverseWraparoundMode:_.reverseWraparound,sendFocusMode:_.sendFocus,wraparoundMode:_.wraparound}}get options(){return this._publicOptions}set options(_){for(const v in _)this._publicOptions[v]=_[v]}blur(){this._core.blur()}focus(){this._core.focus()}input(_,v=!0){this._core.input(_,v)}resize(_,v){this._verifyIntegers(_,v),this._core.resize(_,v)}open(_){this._core.open(_)}attachCustomKeyEventHandler(_){this._core.attachCustomKeyEventHandler(_)}attachCustomWheelEventHandler(_){this._core.attachCustomWheelEventHandler(_)}registerLinkProvider(_){return this._core.registerLinkProvider(_)}registerCharacterJoiner(_){return this._checkProposedApi(),this._core.registerCharacterJoiner(_)}deregisterCharacterJoiner(_){this._checkProposedApi(),this._core.deregisterCharacterJoiner(_)}registerMarker(_=0){return this._verifyIntegers(_),this._core.registerMarker(_)}registerDecoration(_){return this._checkProposedApi(),this._verifyPositiveIntegers(_.x??0,_.width??0,_.height??0),this._core.registerDecoration(_)}hasSelection(){return this._core.hasSelection()}select(_,v,y){this._verifyIntegers(_,v,y),this._core.select(_,v,y)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(_,v){this._verifyIntegers(_,v),this._core.selectLines(_,v)}dispose(){super.dispose()}scrollLines(_){this._verifyIntegers(_),this._core.scrollLines(_)}scrollPages(_){this._verifyIntegers(_),this._core.scrollPages(_)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(_){this._verifyIntegers(_),this._core.scrollToLine(_)}clear(){this._core.clear()}write(_,v){this._core.write(_,v)}writeln(_,v){this._core.write(_),this._core.write(`\r
|
|
65
|
-
`,v)}paste(_){this._core.paste(_)}refresh(_,v){this._verifyIntegers(_,v),this._core.refresh(_,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(_){this._addonManager.loadAddon(this,_)}static get strings(){return l}_verifyIntegers(..._){for(const v of _)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(..._){for(const v of _)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}p.Terminal=C})(),d})()))})(gd)),gd.exports}var xS=gS();/**
|
|
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 vS=2,bS=1,yS=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let r=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var m;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let r=this._terminal.options.scrollback===0?0:((m=this._terminal.options.overviewRuler)==null?void 0:m.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),c=Math.max(0,parseInt(i.getPropertyValue("width"))),d=window.getComputedStyle(this._terminal.element),p={top:parseInt(d.getPropertyValue("padding-top")),bottom:parseInt(d.getPropertyValue("padding-bottom")),right:parseInt(d.getPropertyValue("padding-right")),left:parseInt(d.getPropertyValue("padding-left"))},l=p.top+p.bottom,h=p.right+p.left,f=s-l,g=c-h-r;return{cols:Math.max(vS,Math.floor(g/e.css.cell.width)),rows:Math.max(bS,Math.floor(f/e.css.cell.height))}}};function _S({sessionId:e,onClose:r,onEscape:i,autoFocus:s}){const c=U.useRef(null),d=U.useRef(e),p=U.useRef(null),l=U.useRef(null),h=ir(g=>g.writeSession),f=ir(g=>g.resizeSession);return U.useEffect(()=>{d.current=e},[e]),U.useEffect(()=>{if(!i)return;const g=m=>{(m.key==="²"||m.key==="`")&&(m.preventDefault(),m.stopPropagation(),i())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i]),U.useEffect(()=>{if(!c.current)return;const g=new xS.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new yS;g.loadAddon(m),p.current={term:g,fitAddon:m},c.current.addEventListener("keydown",C=>{(C.key==="²"||C.key==="`")&&i&&(C.preventDefault(),C.stopPropagation(),i())}),g.open(c.current);const b=c.current.querySelector(".xterm");b&&(b.style.padding="8px"),m.fit(),s&&setTimeout(()=>{g.focus()},150);const S=new ResizeObserver(()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{requestAnimationFrame(()=>{var x;m.fit&&m.fit();const C=(x=p.current)==null?void 0:x.term;C&&C.cols>0&&C.rows>0&&f(d.current,C.cols,C.rows)})},100)});S.observe(c.current),g.onData(C=>{if((C==="\x1B"||C==="²"||C==="`")&&i){i();return}h(d.current,C)}),g.onKey(C=>{(C.key==="\x1B"||C.key==="²"||C.key==="`")&&i&&(C.domEvent.stopPropagation(),i())});const E=Ft.subscribe(C=>{var x,_;if(C.type==="terminal.output"&&((x=C.payload)==null?void 0:x.sessionId)===d.current){const v=(_=C.payload)==null?void 0:_.data;v&&g.write(v)}});return()=>{E(),S.disconnect(),l.current&&clearTimeout(l.current),g.dispose(),p.current=null}},[e,h,f]),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:c,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:g=>{(g.key==="²"||g.key==="`")&&i&&(g.preventDefault(),g.stopPropagation(),i())}})]})}function SS(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 wS({isOpen:e,onClose:r,onFocusChat:i}){const s=ir(C=>C.createSession),c=ir(C=>C.killSession),d=ir(C=>C.sessions),p=ir(C=>C.setWorkdir),l=ir(C=>C.fetchSessions),h=Ut(C=>C.currentProject),[f,g]=U.useState(!0),m=U.useRef(null),b=U.useRef(!1),S=U.useRef(!1),E=U.useCallback(()=>{r(),i()},[r,i]);return U.useEffect(()=>{h!=null&&h.workdir&&p(h.workdir)},[h==null?void 0:h.workdir,p]),U.useEffect(()=>{e&&(g(!0),l().finally(()=>g(!1)))},[e,l]),U.useEffect(()=>{e&&d.length===0&&!f&&!S.current&&(S.current=!0,s())},[e,d.length,f,s]),U.useEffect(()=>{e?(b.current=!0,setTimeout(()=>{var C;(C=m.current)==null||C.focus(),setTimeout(()=>{b.current=!1},200)},100)):S.current=!1},[e]),U.useEffect(()=>{if(!e)return;const C=x=>{b.current||(x.key==="Escape"||x.key==="²"||x.key==="`")&&(x.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-40 bg-black/40",style:{pointerEvents:"auto"},onClick:E}),o.jsxs("div",{ref:m,tabIndex:-1,className:"fixed inset-x-0 top-0 z-50 h-[50vh] bg-bg-primary border-b border-border flex flex-col animate-slide-down outline-none",onClick:C=>C.stopPropagation(),onKeyDown:C=>{(C.key==="Escape"||C.key==="²"||C.key==="`")&&(C.preventDefault(),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:f?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):d.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 ${SS(d.length)} gap-2 h-full auto-rows-fr`,children:d.map(C=>o.jsx(_S,{sessionId:C.id,onClose:()=>c(C.id),onEscape:E,autoFocus:d.length===1},C.id))})})]})]}):null}function Ga({items:e,trigger:r,minWidth:i="120px"}){const[s,c]=U.useState(!1),[d,p]=U.useState(null),l=U.useRef(null),h=U.useRef(null);U.useEffect(()=>{function b(S){h.current&&!h.current.contains(S.target)&&c(!1)}return s&&document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b)}},[s]);const f=U.useCallback(()=>{if(!l.current)return;const b=l.current.getBoundingClientRect(),S=200,C=window.innerHeight-b.bottom<S;p({top:C?b.top-S-4:b.bottom+4,left:b.left,alignToTop:C})},[]),g=b=>{b.stopPropagation(),s||f(),c(!s)},m=d&&o.jsx("div",{ref:h,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${d.alignToTop?"mb-1":"mt-1"}`,style:{top:d.top,left:d.left,minWidth:i},children:e.map((b,S)=>{const E=o.jsxs(o.Fragment,{children:[b.icon&&o.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:b.icon}),b.label]});return b.href?o.jsx("a",{href:b.href,onClick:C=>{var x;(x=b.onClick)==null||x.call(b,C),c(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${b.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${S!==e.length-1?"border-b border-border":""}`,children:E},S):o.jsx("button",{onClick:C=>{var x;(x=b.onClick)==null||x.call(b,C),b.closeOnClick!==!1&&c(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${b.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${S!==e.length-1?"border-b border-border":""}`,children:E},S)})});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative",children:o.jsx("div",{ref:l,onClick:g,children:r})}),s&&ch.createPortal(m,document.body)]})}function ob(e){const r=new Date(e),s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],c=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),p=String(r.getDate()).padStart(2,"0");return`${s} ${c}/${d}/${p}`}function uh(e){const r=new Date(e),i=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0");return`${i}:${s}`}function CS(e){const r=new Date(e),i=new Date,s=new Date(i.getFullYear(),i.getMonth(),i.getDate()),c=new Date(r.getFullYear(),r.getMonth(),r.getDate()),d=Math.floor((s.getTime()-c.getTime())/(1e3*60*60*24)),p=uh(e);if(d===0)return`today ${p}`;if(d===1)return`yesterday ${p}`;if(d<7)return`${d} days ago ${p}`;{const l=r.getFullYear(),h=String(r.getMonth()+1).padStart(2,"0"),f=String(r.getDate()).padStart(2,"0");return`${l}/${h}/${f} ${p}`}}function kS(e){const r=new Date(e),i=r.getFullYear(),s=String(r.getMonth()+1).padStart(2,"0"),c=String(r.getDate()).padStart(2,"0");return`${i}-${s}-${c}`}function lb(e){const r=new Map;for(const c of e){const d=kS(c.updatedAt);r.has(d)||r.set(d,[]),r.get(d).push(c)}for(const[c,d]of r)d.sort((p,l)=>{const h=new Date(p.updatedAt).getTime();return new Date(l.updatedAt).getTime()-h});const i=Array.from(r.keys()).sort((c,d)=>d.localeCompare(c)),s=new Map;for(const c of i)s.set(c,r.get(c));return s}function ES({projects:e,currentProject:r}){const i=Ut(d=>d.loadProject),c=[...e].sort((d,p)=>d.name.localeCompare(p.name)).map(d=>({label:d.name,icon:d.id===r.id?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:"M5 13l4 4L19 7"})}):void 0,href:`/p/${d.id}`,onClick:()=>{i(d.id)}}));return o.jsx(Ga,{items:c,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:r.name,children:[r.name,o.jsx("svg",{className:"w-3 h-3 flex-shrink-0",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"})})]}),minWidth:"250px"})}function jS({currentProject:e,sessions:r,currentSession:i,projectIdFromUrl:s}){const[c,d]=U.useState(!1),p=U.useRef(null);if(U.useEffect(()=>{function f(g){p.current&&!p.current.contains(g.target)&&d(!1)}if(c)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[c]),!(e!=null&&e.id)||e.id!==s)return null;const l=r.filter(f=>f.projectId===e.id).sort((f,g)=>new Date(g.updatedAt).getTime()-new Date(f.updatedAt).getTime()).slice(0,5),h=[];h.push({label:o.jsxs(An,{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"})]}),onClick:()=>{}});for(const f of l)h.push({label:o.jsx(An,{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,onClick:()=>{}});return h.push({label:o.jsxs(An,{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"})]}),onClick:()=>{}}),o.jsxs("div",{className:"relative",ref:p,children:[o.jsxs("button",{type:"button",onClick:()=>d(!c),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors",children:[o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e==null?void 0:e.name}),o.jsx("svg",{className:"w-3 h-3 text-text-muted flex-shrink-0",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"})})]}),c&&h.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:h.map((f,g)=>{if(f.label&&typeof f.label=="object"&&f.label.type===An){const m=f.label,b=m.props.href||"";return o.jsxs(An,{href:b,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,m.props.children]},g)}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]},g):o.jsxs("button",{type:"button",onClick:()=>{var m;(m=f.onClick)==null||m.call(f),d(!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]},g)})})]})}function NS({sessions:e,currentProject:r,currentSession:i}){var h;const s=Ee(f=>f.loadSession),c=e.filter(f=>f.projectId===r.id).slice(0,15),d=lb(c),p=[];p.push({label:o.jsxs(An,{href:`/p/${r.id}/new`,className:"flex items-center gap-2 px-3 py-2 min-w-[160px]","data-testid":"session-dropdown-new-session",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"})]}),onClick:()=>{}});for(const[f,g]of d){const m=g[0];if(m){p.push({label:o.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:ob(m.updatedAt)}),onClick:()=>{}});for(const b of g)p.push({label:o.jsxs("div",{className:"min-w-[160px]",children:[o.jsx("div",{className:"truncate text-sm",children:b.title??b.id.slice(0,8)}),o.jsx("div",{className:"text-text-muted text-xs",children:uh(b.updatedAt)})]}),icon:b.id===(i==null?void 0:i.id)?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:"M5 13l4 4L19 7"})}):void 0,href:`/p/${r.id}/s/${b.id}`,onClick:()=>{s(b.id)}})}}const l=i?((h=i.metadata)==null?void 0:h.title)??i.id.slice(0,8):"No session selected";return o.jsx(Ga,{items:p,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:l,"data-testid":"header-session-dropdown",children:[l,o.jsx("svg",{className:"w-3 h-3 flex-shrink-0",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"})})]}),minWidth:"280px"})}function TS({onMenuClick:e,onCriteriaToggle:r}){const[i,s]=U.useState(!1),[c]=sr(),d=c.startsWith("/p/"),p=/^\/p\/[^/]+\/s\/[^/]+$/.test(c),l=Ee(x=>x.currentSession),h=Ee(x=>x.sessions),f=Ut(x=>x.currentProject),g=Ut(x=>x.projects),m=Ht(x=>x.startAutoRefresh),b=Ht(x=>x.stopAutoRefresh),S=ir(x=>x.setOpen),E=ir(x=>x.isOpen),C=U.useCallback(()=>{const x=document.querySelector('textarea[placeholder*="What would you like to build"], textarea[placeholder*="Send a message"]');x&&x.focus()},[]);return U.useEffect(()=>{const x=_=>{(_.key==="²"||_.key==="`")&&(_.preventDefault(),E||S(!0))};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[E,S]),U.useEffect(()=>(m(),()=>b()),[m,b]),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&&d&&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("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"})})}),o.jsx(An,{href:"/",className:"text-accent-primary font-semibold text-base hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),f&&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(ES,{projects:g,currentProject:f})}),o.jsx("span",{className:"md:hidden",children:o.jsx(jS,{currentProject:f,sessions:h,currentSession:l,projectIdFromUrl:d&&c.split("/")[2]||null},f==null?void 0:f.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(NS,{sessions:h,currentProject:f,currentSession:l})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d&&o.jsx("button",{onClick:()=>S(!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 (²)",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&&p&&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("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"})})})]}),o.jsx(fS,{isOpen:i,onClose:()=>s(!1)}),o.jsx(wS,{isOpen:E,onClose:()=>S(!1),onFocusChat:C})]})}function AS({isOpen:e,onClose:r,title:i,label:s,description:c,placeholder:d,value:p,isLoading:l=!1,onSave:h}){const[f,g]=U.useState(p),[m,b]=U.useState(!1),[S,E]=U.useState(!1);U.useEffect(()=>{g(p),b(!1)},[p]);const C=y=>{g(y.target.value),b(!0)},x=async()=>{E(!0),await h(f),E(!1),b(!1),r()},_=()=>{g(p),b(!1),r()},v=l||S;return o.jsx(un,{isOpen:e,onClose:_,title:i,size:"lg",children:o.jsxs("div",{className:"flex flex-col h-full -mt-1",children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:s}),o.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children:c}),o.jsx("div",{className:"flex-1 min-h-[150px]",children:o.jsx("textarea",{value:f,onChange:C,placeholder:d,className:"w-full h-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:v})}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(dt,{variant:"secondary",onClick:_,children:"Cancel"}),o.jsx(dt,{variant:"primary",onClick:x,disabled:!m||v,children:S?"Saving...":"Save"})]})]})})}function DS({isOpen:e,onClose:r,project:i}){const s=Ut(d=>d.updateProject),c=async d=>{s(i.id,{customInstructions:d||null}),await new Promise(p=>setTimeout(p,100))};return o.jsx(AS,{isOpen:e,onClose:r,title:`${i.name} Settings`,label:"Project Instructions",description:"These instructions are injected into prompts when working in this project. They are applied after global instructions but before AGENTS.md files.",placeholder:"Enter project-specific instructions...",value:i.customInstructions??"",onSave:c})}function cb({projectId:e,isOpen:r=!0,onClose:i}){const[,s]=sr(),[c,d]=U.useState(!1),p=Ee(j=>j.sessions),l=Ee(j=>j.currentSession),h=Ee(j=>j.unreadSessionIds),f=Ee(j=>j.deleteSession),g=Ee(j=>j.deleteAllSessions),m=Ee(j=>j.loadMoreSessions),b=Ee(j=>j.sessionsHasMore),S=Ee(j=>j.sessionsPaginationLoading),E=Ut(j=>j.currentProject),C=U.useRef(null),x=U.useCallback(()=>{b&&!S&&E&&m(E.id)},[b,S,E,m]);U.useEffect(()=>{if(!C.current||!b)return;const j=new IntersectionObserver(A=>{const N=A[0];N&&N.isIntersecting&&x()},{threshold:.1});return j.observe(C.current),()=>j.disconnect()},[b,x]);const _=p.filter(j=>j.projectId===(E==null?void 0:E.id)),v=(j,A)=>{A==null||A.stopPropagation(),confirm("Delete this session?")&&(f(j),(l==null?void 0:l.id)===j&&s(`/p/${e}`))},y=()=>{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(An,{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(Ga,{items:[{label:"Edit project settings",onClick:()=>d(!0)},{label:"Delete all sessions",onClick:y,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("button",{onClick:i,className:"md:hidden flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close sidebar",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"})})})]}),E&&o.jsx(DS,{isOpen:c,onClose:()=>d(!1),project:E}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:_.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:LS(_,l,h,v,e)}),S&&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 LS(e,r,i,s,c){const d=lb(e);return Array.from(d).map(([p,l])=>{const h=l[0];return h?o.jsxs("div",{children:[o.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:ob(h.updatedAt)}),l.map(f=>{const g=(r==null?void 0:r.id)===f.id,m=i.includes(f.id),b=f.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(An,{href:`/p/${c}/s/${f.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:f.title??f.id.slice(0,6)}),o.jsx(Ga,{items:[{label:"Delete session",onClick:S=>s(f.id,S),danger:!0}],trigger:o.jsx("button",{onClick:S=>S.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:[b?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:uh(f.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[f.messageCount," messages"]})]})]})},f.id)})]},p):null})}const Sx=["⠋","⠙","⠹","⠸","⠼","⠴"];function RS(){var l;const e=Ut(h=>h.currentProject),r=Ee(h=>h.currentSession),i=rb(),s=!1,c=U.useRef(0),d=U.useRef(null);U.useEffect(()=>(i?(d.current=window.setInterval(()=>{c.current=(c.current+1)%Sx.length,p()},150),p()):(d.current&&(clearInterval(d.current),d.current=null),p()),()=>{d.current&&(clearInterval(d.current),d.current=null)}),[i,e,r,s]);const p=()=>{var m;const f=(m=r==null?void 0:r.metadata)==null?void 0:m.title,g=i?`${Sx[c.current]} `:"";e&&f?document.title=`${g}${e.name} - ${f} | OpenFox`:e?document.title=`${g}${e.name} | OpenFox`:document.title=`${g}OpenFox`};return typeof window<"u"&&((l=r==null?void 0:r.metadata)!=null&&l.title)&&window.document.documentElement.setAttribute("data-session-title",r.metadata.title),null}const Ml=U.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}));Ml.displayName="Input";function MS({isOpen:e,onClose:r,projectName:i,onConfirm:s}){const c=()=>{s(),r()};return o.jsx(un,{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(dt,{variant:"secondary",onClick:r,children:"Cancel"}),o.jsx(dt,{variant:"danger",onClick:c,children:"Delete"})]})]})})}function OS(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 BS({isOpen:e,onClose:r}){const[,i]=sr(),[s,c]=U.useState(""),[d,p]=U.useState(null),[l,h]=U.useState(!1),[f,g]=U.useState(""),m=U.useRef(null);U.useEffect(()=>{e&&(_e("/api/config").then(C=>C.json()).then(C=>{C.workdir&&g(C.workdir)}),c(""),p(null),h(!1),setTimeout(()=>{var C;(C=m.current)==null||C.focus()},100))},[e]);const b=U.useCallback(async C=>{C.preventDefault();const x=OS(s);if(!x.valid){p(x.error);return}h(!0),p(null);const _=`${f}/${s}`;try{const v=await _e("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:_})});if(!v.ok){const A=await v.json().catch(()=>({}));throw new Error(A.error||"Failed to create project")}const j=(await v.json()).project;r(),i(`/p/${j.id}`)}catch(v){p(v instanceof Error?v.message:"Failed to create project"),h(!1)}},[s,i,r,f]),S=U.useCallback(()=>{c(""),p(null),r()},[r]),E=s?`${f}/${s}`:"";return o.jsx(un,{isOpen:e,onClose:S,title:"Create New Project",size:"sm",children:o.jsxs("form",{onSubmit:b,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),o.jsx(Ml,{ref:m,id:"project-name",value:s,onChange:C=>{c(C.target.value),p(null)},placeholder:"my-project",disabled:l,className:"w-full"}),s&&o.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",o.jsx("span",{className:"font-mono",children:E})]}),d&&o.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:d})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(dt,{type:"button",variant:"secondary",onClick:S,disabled:l,children:"Cancel"}),o.jsx(dt,{type:"submit",variant:"primary",disabled:l||!s.trim(),className:"min-w-[100px]",children:l?o.jsxs("span",{className:"flex items-center gap-2",children:[o.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"})]})]})})}function IS({isOpen:e,onClose:r}){const[,i]=sr(),[s,c]=U.useState(!1),[d,p]=U.useState(""),[l,h]=U.useState(null),[f,g]=U.useState(!1),[m,b]=U.useState(null),S=Ut(R=>R.projects),E=Ut(R=>R.createProject),C=Ut(R=>R.listProjects),x=Ut(R=>R.deleteProject),[_,v]=U.useState(null),[y,j]=U.useState(-1),[A,N]=U.useState(null),L=U.useRef([]);U.useEffect(()=>{_e("/api/config").then(R=>R.json()).then(R=>{R.workdir&&b(R.workdir)})},[]);const T=U.useCallback(async R=>{g(!0);try{const D=R?`/api/directories?path=${encodeURIComponent(R)}`:m?`/api/directories?path=${encodeURIComponent(m)}`:"/api/directories",q=await(await _e(D)).json();h(q)}catch(D){console.error("Failed to load directories:",D)}finally{g(!1)}},[m]);U.useEffect(()=>{e&&m&&(T(m),C())},[e,m,T,C]);const B=(l==null?void 0:l.directories.filter(R=>d===""||R.name.toLowerCase().includes(d.toLowerCase())))??[],H=[...l!=null&&l.parent&&!d?[{type:"parent",path:l.parent,name:".."}]:[],...B.map(R=>({type:"directory",path:R.path,name:R.name}))],W=R=>{i(`/p/${R}`),r()},Y=(R,D)=>{D.stopPropagation(),N(R)},$=()=>{A&&(x(A.id),N(null))},I=R=>{const D=R.split("/").filter(Boolean).pop()??"";E(D,R),C(),v(R)};U.useEffect(()=>{if(_){const R=S.find(D=>D.workdir===_);R&&(i(`/p/${R.id}`),r(),v(null))}},[S,_,i,r]),U.useEffect(()=>{j(H.length>0?0:-1)},[d,H.length]);const P=R=>{p(""),T(R)},V=U.useCallback(R=>{if(!e)return;if(R.key==="Escape"){r();return}if(!["ArrowDown","ArrowUp","Enter"].includes(R.key))return;const D=document.activeElement;if(!(!D||D.tagName!=="INPUT")){if(R.preventDefault(),R.key==="ArrowDown")j(O=>{const q=O+1;return q>=H.length?0:q});else if(R.key==="ArrowUp")j(O=>{const q=O-1;return q<0?H.length-1:q});else if(R.key==="Enter"&&y>=0&&y<H.length){const O=H[y];(O==null?void 0:O.type)==="parent"?P(O.path):O&&I(O.path)}}},[e,H.length,y,P,I,r]);U.useEffect(()=>{if(e)return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[e,V]),U.useEffect(()=>{y>=0&&L.current[y]&&L.current[y].scrollIntoView({behavior:"smooth",block:"nearest"})},[y]);const ee=(()=>{if(!l)return[];const R=l.current.split("/").filter(Boolean),D=[];let O="";for(const q of R)O+="/"+q,D.push({name:q,path:O});return D})();return e?o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",children:[o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg w-full max-w-[90vw] md:max-w-4xl max-h-[90vh] flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Open Project"}),o.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",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:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-[400px]",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:S.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:S.map(R=>o.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[o.jsxs("button",{onClick:()=>W(R.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:R.name}),o.jsx("div",{className:"text-xs text-text-muted truncate",children:R.workdir})]})]}),o.jsx("button",{onClick:D=>Y(R,D),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"})})})]},R.id))})})]}),o.jsxs("div",{className:"w-1/2 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:"Browse Projects"})}),o.jsx("div",{className:"p-3 border-b border-border",children:o.jsxs("div",{className:"relative",children:[o.jsx(Ml,{value:d,onChange:R=>p(R.target.value),placeholder:"Type to filter directories...",className:"w-full pl-9"}),o.jsx("svg",{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-text-muted",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"})})]})}),o.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 border-b border-border",children:o.jsx("div",{className:"flex items-center text-xs overflow-x-auto",children:ee.map((R,D)=>o.jsxs("span",{className:"flex items-center flex-shrink-0",children:[o.jsx("span",{className:"text-text-muted",children:"/"}),D===ee.length-1?o.jsx("span",{className:"text-accent-primary font-medium px-1",children:R.name}):o.jsx("button",{onClick:()=>P(R.path),className:"text-text-secondary hover:text-accent-primary px-1",children:R.name})]},R.path))})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:f?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"})}):H.length===0?o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:d?"No matching directories":"No subdirectories"}):o.jsx("div",{className:"divide-y divide-border",children:H.map((R,D)=>o.jsxs("button",{ref:O=>{L.current[D]=O},onClick:()=>R.type==="parent"?P(R.path):I(R.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${D===y?"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:R.name})]},R.path))})})]})]}),o.jsxs("div",{className:"p-4 border-t border-border flex justify-between gap-2",children:[o.jsx(dt,{variant:"secondary",onClick:()=>c(!0),children:"Create Project"}),o.jsx(dt,{variant:"secondary",onClick:r,children:"Cancel"})]})]}),s&&o.jsx(BS,{isOpen:s,onClose:()=>c(!1)}),A&&o.jsx(MS,{isOpen:!0,onClose:()=>N(null),projectName:A.name,onConfirm:$})]}):null}function zS(){const[e,r]=U.useState(!1),i=Ee(g=>g.sessions),s=Ut(g=>g.projects),c=Ut(g=>g.listProjects),d=Ee(g=>g.listSessions),p=Ee(g=>g.connectionStatus);U.useEffect(()=>{p==="connected"&&(c(),d())},[p,c,d]);const l=[...s].sort((g,m)=>{const b=i.filter(x=>x.workdir.startsWith(g.workdir)),S=i.filter(x=>x.workdir.startsWith(m.workdir)),E=b.length>0?new Date(b.reduce((x,_)=>new Date(_.updatedAt)>new Date(x.updatedAt)?_:x).updatedAt).getTime():new Date(g.updatedAt).getTime();return(S.length>0?new Date(S.reduce((x,_)=>new Date(_.updatedAt)>new Date(x.updatedAt)?_:x).updatedAt).getTime():new Date(m.updatedAt).getTime())-E}),h=g=>{const m=s.find(b=>b.id===g);return m?i.filter(b=>b.workdir.startsWith(m.workdir)).sort((b,S)=>new Date(S.updatedAt).getTime()-new Date(b.updatedAt).getTime()).slice(0,5):[]},f=()=>{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(dt,{variant:"primary",onClick:f,children:"Open Project"})]}),l.map(g=>{const m=h(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(An,{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(An,{href:`/p/${g.id}/new`,className:"rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-1.5 py-1 text-xs",children:"+ New Session"})]}),o.jsx("div",{className:"divide-y divide-border",children:m.length>0?m.map(b=>{const S=s.find(C=>b.workdir.startsWith(C.workdir)),E=S?`/p/${S.id}/s/${b.id}`:"#";return o.jsx(An,{href:E,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm text-text-muted truncate",children:b.title??b.id.slice(0,8)})})}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-text-muted text-xs",children:CS(b.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs",children:[b.messageCount," msgs"]})]})]})},b.id)}):o.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},g.id)}),l.length===0&&o.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."})]}),e&&o.jsx(IS,{isOpen:e,onClose:()=>r(!1)})]})}const HS={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function dh({size:e="md",className:r=""}){return o.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${HS[e]} ${r}`})}function PS({text:e,...r}){return o.jsxs("div",{className:"text-center",children:[o.jsx(dh,{...r,className:"mx-auto mb-4"}),e&&o.jsx("div",{className:"text-text-secondary",children:e})]})}function FS(){const[,e]=oh("/p/:projectId/new"),[,r]=sr(),i=e==null?void 0:e.projectId,s=Ee(c=>c.createSession);return U.useEffect(()=>{i&&(async()=>{const d=await s(i);r(d?`/p/${i}/s/${d.id}`:`/p/${i}`)})()},[i,s,r]),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(dh,{})})}function US(){const e=Ut(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(An,{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 Na=e=>Math.round(e*10)/10;function Ud(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function $S(e){return`${e.providerId}::${e.model}`}function qS(e){return`${e.providerName} > ${e.model}`}function wx(e){let r=0,i=0,s=0,c=0,d=0,p=0;const l=[],h=[];let f=0;for(const[b,S]of e.entries()){const E=S.stats,C=Ud(E);r+=E.totalTime,i+=E.toolTime,s+=E.prefillTokens,c+=E.generationTokens;const x=E.prefillSpeed>0?E.prefillTokens/E.prefillSpeed:0,_=E.generationSpeed>0?E.generationTokens/E.generationSpeed:0;d+=x,p+=_,l.push({messageId:S.id,timestamp:S.timestamp,...C,mode:E.mode,responseIndex:b+1,prefillTokens:E.prefillTokens,generationTokens:E.generationTokens,prefillSpeed:E.prefillSpeed,generationSpeed:E.generationSpeed,totalTime:E.totalTime,aiTime:E.totalTime-E.toolTime,toolTime:E.toolTime});const v=E.llmCalls??[];for(const y of v)f+=1,h.push({messageId:S.id,timestamp:y.timestamp??S.timestamp,providerId:y.providerId,providerName:y.providerName,backend:y.backend,model:y.model,mode:E.mode,responseIndex:b+1,sessionCallIndex:f,callIndex:y.callIndex,promptTokens:y.promptTokens,completionTokens:y.completionTokens,ttft:y.ttft,completionTime:y.completionTime,prefillSpeed:y.prefillSpeed,generationSpeed:y.generationSpeed,totalTime:y.totalTime})}const g=d>0?Na(s/d):0,m=p>0?Na(c/p):0;return{totalTime:Na(r),aiTime:Na(r-i),toolTime:Na(i),prefillTokens:s,generationTokens:c,avgPrefillSpeed:g,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:h.length,dataPoints:l,callDataPoints:h}}function WS(e){const r=e.filter(c=>c.stats!==void 0&&c.stats!==null).sort((c,d)=>new Date(c.timestamp).getTime()-new Date(d.timestamp).getTime());if(r.length===0)return null;const i=new Map;for(const c of r){const d=$S(Ud(c.stats)),p=i.get(d)??[];i.set(d,[...p,c])}const s=Array.from(i.entries()).map(([c,d])=>{const p=Ud(d[0].stats),l=wx(d);return{...p,key:c,label:qS(p),...l}});return{...wx(r),modelGroups:s}}function GS(e){return U.useMemo(()=>WS(e),[e])}function VS(e){const[r,i]=U.useState(null),[s,c]=U.useState(!0),[d,p]=U.useState(null),l=e||"";return U.useEffect(()=>{if(!l){c(!1);return}let h=!0,f=null;const g=async()=>{try{const b=await(await _e(`/api/branch?workdir=${encodeURIComponent(l)}`)).json();h&&(i(b.branch),p(b.error||null),c(!1))}catch(m){h&&(p(m instanceof Error?m.message:"Failed to fetch branch"),c(!1))}};return g(),f=setInterval(g,3e3),()=>{h=!1,f&&clearInterval(f)}},[l]),{branch:r,loading:s,error:d}}function Cx(e){return e.toLocaleString("en-US").replace(/,/g," ")}function kx(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function YS(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 KS="modulepreload",XS=function(e){return"/"+e},Ex={},ZS=function(r,i,s){let c=Promise.resolve();if(i&&i.length>0){let p=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),h=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));c=p(i.map(f=>{if(f=XS(f),f in Ex)return;Ex[f]=!0;const g=f.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":KS,g||(b.as="script"),b.crossOrigin="",b.href=f,h&&b.setAttribute("nonce",h),document.head.appendChild(b),g)return new Promise((S,E)=>{b.addEventListener("load",S),b.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${f}`)))})}))}function d(p){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=p,window.dispatchEvent(l),!l.defaultPrevented)throw p}return c.then(p=>{for(const l of p||[])l.status==="rejected"&&d(l.reason);return r().catch(d)})},jx=["▁","▂","▃","▄","▅","▆","▇","█"];function QS(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 JS(e,r){if(e===r){const c=Math.max(Math.abs(e)*.05,1);return{minY:e-c,maxY:r+c}}const i=r-e,s=Math.max(i*.1,.1);return{minY:e-s,maxY:r+s}}function ew(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const i=[...e].sort((m,b)=>m.x-b.x),s=i[0].x,c=i[i.length-1].x,d=Math.min(...i.map(m=>m.y)),p=Math.max(...i.map(m=>m.y)),{minY:l,maxY:h}=JS(d,p),f=Array.from({length:r},()=>" "),g=new Map;for(const m of i){const b=c===s?0:Math.round((m.x-s)/(c-s)*(r-1)),S=g.get(b)??[];g.set(b,[...S,m.y])}for(const[m,b]of g){const S=Math.max(...b);f[m]=jx[QS(S,l,h)]??jx[0]}return{blocks:f.join(""),minX:s,maxX:c,minY:l,maxY:h}}function Nx(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Tx({data:e,width:r=60,height:i=78,label:s,xLabel:c,yLabel:d,showAxes:p=!0,formatY:l=Nx,formatX:h=Nx}){const f=U.useMemo(()=>{const g=ew(e,r),m=Math.max(r*6,240),b=10,S=8,C=[...e].sort((y,j)=>y.x-j.x).map(y=>{const j=g.maxX===g.minX?m/2:b+(y.x-g.minX)/(g.maxX-g.minX)*(m-b*2),A=g.maxY===g.minY?i/2:S+(g.maxY-y.y)/(g.maxY-g.minY)*(i-S*2);return{...y,cx:j,cy:A,leftPercent:j/m*100,topPercent:A/i*100}}),x=C.map((y,j)=>`${j===0?"M":"L"} ${y.cx.toFixed(1)} ${y.cy.toFixed(1)}`).join(" "),v=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(y=>({value:y,y:g.maxY===g.minY?i/2:S+(g.maxY-y)/(g.maxY-g.minY)*(i-S*2)}));return{...g,chartWidth:m,points:C,path:x,gridLines:v}},[e,i,r]);return e.length===0?o.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[s&&o.jsx("div",{className:"mb-1",children:s}),o.jsx("div",{children:"No data"})]}):o.jsxs("div",{className:"font-mono text-xs",children:[s&&o.jsx("div",{className:"text-text-secondary mb-2",children:s}),o.jsxs("div",{className:"flex gap-3",children:[p&&o.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:f.gridLines.map(g=>o.jsx("span",{children:l(g.value)},`${g.value}-${g.y}`))}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"relative h-[78px]",children:[o.jsxs("svg",{viewBox:`0 0 ${f.chartWidth} ${i}`,className:"w-full h-[78px] overflow-visible",preserveAspectRatio:"none","aria-hidden":"true",children:[f.gridLines.map(g=>o.jsx("line",{x1:"0",x2:f.chartWidth,y1:g.y,y2:g.y,stroke:"currentColor",strokeDasharray:"3 4",className:"text-border/60"},`grid-${g.y}`)),f.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}`)),f.points.length>1&&o.jsx("path",{d:f.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),f.points.map(g=>o.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${g.leftPercent}%`,top:`${g.topPercent}%`},title:`${h(g.x)} -> ${l(g.y)}`,children:o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-primary/20 flex items-center justify-center",children:o.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})})},`point-${g.x}-${g.y}`))]})})]}),p&&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:h(f.minX)}),o.jsx("span",{children:c}),o.jsx("span",{children:h(f.maxX)})]})]}),d&&p&&o.jsx("div",{className:"text-text-muted mt-1 text-center",children:d})]})}function tw({data:e,prefillLabel:r="Prefill Speed (tok/s) by Response",generationLabel:i="Generation Speed (tok/s) by Response",xLabel:s="response",width:c=60}){const d=e.map(l=>({x:l.x,y:l.ppSpeed})),p=e.map(l=>({x:l.x,y:l.tgSpeed}));return o.jsxs("div",{className:"space-y-5",children:[o.jsx(Tx,{data:d,width:c,label:r,xLabel:s}),o.jsx(Tx,{data:p,width:c,label:i,xLabel:s})]})}function nw(e){const r=new Map;for(const i of e.callDataPoints){const s=r.get(i.messageId)??[];r.set(i.messageId,[...s,i])}return e.dataPoints.map(i=>{const s=[...r.get(i.messageId)??[]].sort((c,d)=>c.callIndex-d.callIndex);return{...i,callCount:s.length,calls:s,isExpandable:s.length>1}})}function rw(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 iw(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 sw(e){return e.callDataPoints.length>0?iw(e):rw(e)}function xd(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 ji(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function Ma(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function aw(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),i=Math.max(...e);return r===i?`${ji(r)} ctx`:`${ji(r)}-${ji(i)} ctx`}function Cl(e){return`${Ma(e)} t/s`}function ub(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function ow(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 lw({isOpen:e,onClose:r,stats:i}){const s=U.useRef(null),[c,d]=U.useState({}),[p,l]=U.useState(()=>{var E;return((E=i.modelGroups[0])==null?void 0:E.key)??""});U.useEffect(()=>{var E;i.modelGroups.some(C=>C.key===p)||l(((E=i.modelGroups[0])==null?void 0:E.key)??"")},[p,i.modelGroups]);const h=U.useMemo(()=>i.modelGroups.find(E=>E.key===p)??i.modelGroups[0],[p,i.modelGroups]),f=U.useMemo(()=>h?nw(h):[],[h]),g=U.useMemo(()=>h?sw(h):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[h]),m=U.useCallback(E=>{d(C=>({...C,[E]:!C[E]}))},[]),b=U.useCallback(()=>{if(!h)return;const E=ow(h);navigator.clipboard.writeText(JSON.stringify(E,null,2)).catch(C=>console.error("Failed to copy:",C))},[h]),S=U.useCallback(async()=>{if(s.current)try{const E=(await ZS(async()=>{const{default:_}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:_}},[])).default,C=await E(s.current,{backgroundColor:"#1a1a1a",scale:2}),x=document.createElement("a");x.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,x.href=C.toDataURL("image/png"),x.click()}catch(E){console.error("Failed to export PNG:",E),b()}},[b]);return o.jsx(un,{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:()=>l(E.key),className:`px-3 py-1.5 rounded border text-xs transition-colors ${E.key===(h==null?void 0:h.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))})}),h&&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(Er,{label:"AI Time",value:xd(h.aiTime)}),o.jsx(Er,{label:"Total Time",value:xd(h.totalTime)}),o.jsx(Er,{label:"Tool Time",value:xd(h.toolTime)}),o.jsx(Er,{label:"Responses",value:h.responseCount.toString()}),o.jsx(Er,{label:"LLM Calls",value:h.llmCallCount.toString()})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-3",children:[o.jsx(Er,{label:"Prefill Tokens",value:ji(h.prefillTokens),subValue:`@ ${Ma(h.avgPrefillSpeed)} tok/s`}),o.jsx(Er,{label:"Gen Tokens",value:ji(h.generationTokens),subValue:`@ ${Ma(h.avgGenerationSpeed)} tok/s`}),o.jsx(Er,{label:"Avg PP Speed",value:`${Ma(h.avgPrefillSpeed)}`,subValue:"tok/s"}),o.jsx(Er,{label:"Avg TG Speed",value:`${Ma(h.avgGenerationSpeed)}`,subValue:"tok/s"})]})]}),h&&g.points.length>1&&o.jsxs("section",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary uppercase tracking-wide",children:"Performance Progression"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:b,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Copy JSON"}),o.jsx("button",{onClick:S,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(tw,{data:g.points,width:50,prefillLabel:g.prefillLabel,generationLabel:g.generationLabel,xLabel:g.xLabel})})]}),h&&o.jsxs("section",{children:[o.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",h.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:f.map((E,C)=>o.jsxs(U.Fragment,{children:[o.jsx(cw,{row:E,index:C,isExpanded:c[E.messageId]??!1,onToggle:E.isExpandable?()=>m(E.messageId):void 0}),(c[E.messageId]??!1)&&E.calls.map((x,_)=>o.jsx(uw,{dataPoint:x,index:_},`${x.messageId}-${x.callIndex}`))]},E.messageId))})]})})]})]})})}function Er({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 cw({row:e,index:r,isExpanded:i,onToggle:s}){const c=e.calls.length>0?aw(e.calls.map(d=>d.promptTokens)):`${ji(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:ub(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:c.replace(/ ctx$/,"")}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Cl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Cl(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 uw({dataPoint:e,index:r}){return 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:ub(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:ji(e.promptTokens)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Cl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Cl(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"})]})}const dw={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"}},hw=U.memo(function({criteria:r}){if(r.length===0)return o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No criteria yet"});const i={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const c of r){const d=c.status.type;d in i&&i[d]++}const s=Object.keys(i).filter(c=>i[c]>0);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"font-semibold text-text-primary",children:"Total:"}),o.jsx("span",{className:"text-text-secondary",children:r.length})]}),o.jsx("div",{className:"space-y-1",children:s.map(c=>{const d=dw[c];return o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:`${d.color} ${d.animate?"animate-pulse":""} text-sm leading-tight`,children:d.icon}),o.jsxs("span",{className:"text-text-muted",children:[d.label,":"]}),o.jsx("span",{className:"text-text-primary font-medium",children:i[c]})]},c)})})]})});function fw({isOpen:e,onClose:r}){const i=nr(S=>S.config),s=nr(S=>S.saveConfig),[c,d]=U.useState(""),[p,l]=U.useState(""),[h,f]=U.useState(!1),[g,m]=U.useState(!1);U.useEffect(()=>{e&&(d((i==null?void 0:i.command)??""),l((i==null?void 0:i.url)??""),f((i==null?void 0:i.hotReload)??!1))},[e,i]);const b=async()=>{!c.trim()||!p.trim()||(m(!0),await s({command:c.trim(),url:p.trim(),hotReload:h}),m(!1),r())};return o.jsx(un,{isOpen:e,onClose:r,title:"Dev Server Config",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Command"}),o.jsx("input",{className:"input w-full",type:"text",value:c,onChange:S=>d(S.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:p,onChange:S=>l(S.target.value),placeholder:"http://localhost:3000"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"checkbox",id:"hotReload",checked:h,onChange:S=>f(S.target.checked),className:"rounded border-border bg-bg-tertiary"}),o.jsx("label",{htmlFor:"hotReload",className:"text-xs text-text-secondary",children:"Hot Reload"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[o.jsx("button",{className:"btn btn-secondary",onClick:r,children:"Cancel"}),o.jsx("button",{className:"btn btn-primary",onClick:b,disabled:g||!c.trim()||!p.trim(),children:g?"Saving...":"Save"})]})]})})}const Ax={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"},pw={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"},Dx={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},mw="text-text-primary";function gw(e){const r=[],i=/\x1b\[([0-9;]+)m/g;let s=0,c="text-text-primary",d;try{for(;(d=i.exec(e))!==null;){if(d.index>s){const f=e.slice(s,d.index);f&&r.push({text:f,className:c})}const p=d[1];if(!p)continue;const l=p.split(";").map(Number);if(l.length===0||l[0]===0){c="text-text-primary";continue}const h=[];for(const f of l)if(f>=30&&f<=37){const g=Ax[f];g&&h.push(g)}else if(f>=40&&f<=47){const g=pw[f];g&&h.push(g)}else if(f>=90&&f<=97){const g=Ax[f];g&&h.push(g)}else if(f in Dx){const g=Dx[f];g&&h.push(g)}else f===39?h.push(mw):f===49&&(c=c.split(" ").filter(g=>!g.startsWith("bg-")).join(" "));h.length>0&&(c=h.join(" ")),s=i.lastIndex}if(s<e.length){const p=e.slice(s);p&&r.push({text:p,className:c})}return r}catch(p){return console.warn("ANSI parsing failed, stripping codes:",p),[{text:xw(e),className:"text-text-primary"}]}}function xw(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function kl(e){var i,s;const r=gw(e);return r.length===1&&((i=r[0])==null?void 0:i.className)==="text-text-primary"?(s=r[0])==null?void 0:s.text:r.map((c,d)=>ln.createElement("span",{key:d,className:c.className},c.text))}const vw=U.memo(function({logs:r,onClose:i}){const s=U.useRef(null);return U.useEffect(()=>{const c=d=>{d.key==="Escape"&&i()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[i]),U.useEffect(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[r]),o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:i,children:o.jsxs("div",{className:"relative w-[90vw] h-[90vh] bg-bg-primary rounded-lg border border-border flex flex-col",onClick:c=>c.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server Logs"}),o.jsx("button",{onClick:i,className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",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("pre",{ref:s,className:"flex-1 overflow-auto p-4 text-sm font-mono text-text-primary",children:r.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):r.map((c,d)=>o.jsx("span",{className:c.stream==="stderr"?"text-accent-warning":"",children:kl(c.content)},d))})]})})}),bw=U.memo(function({workdir:r}){const i=nr(y=>y.setWorkdir),s=nr(y=>y.status),c=nr(y=>y.config),d=nr(y=>y.logs),p=nr(y=>y.start),l=nr(y=>y.stop),h=nr(y=>y.fetchLogs),[f,g]=U.useState(!1),[m,b]=U.useState(!1),S=U.useRef(null),E=(s==null?void 0:s.state)??"off",C=c!==null,x=E==="running"||E==="warning";U.useEffect(()=>{i(r??null)},[r,i]),U.useEffect(()=>{x&&h()},[x,h]),U.useEffect(()=>{S.current&&x&&(S.current.scrollTop=S.current.scrollHeight)},[d,x]);const _=()=>{x?l():p()},v=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 ${E==="running"?"bg-accent-success":E==="warning"?"bg-accent-warning":E==="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:v})]}),C?o.jsxs(o.Fragment,{children:[E==="running"||E==="warning"?o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{onClick:_,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:_,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"}),x&&o.jsxs("div",{className:"relative",children:[o.jsx("pre",{ref:S,className:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border",children:d.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):d.map((y,j)=>o.jsx("span",{className:y.stream==="stderr"?"text-accent-warning":"",children:kl(y.content)},j))}),o.jsx("button",{onClick:()=>b(!0),className:"absolute bottom-2 right-2 p-1 rounded bg-bg-tertiary/80 hover:bg-bg-tertiary text-text-muted transition-colors",title:"Expand logs",children:o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M3 4a1 1 0 011-1h4a1 1 0 010 2H5v3a1 1 0 01-2 0V4zm12-1a1 1 0 00-1 1v3a1 1 0 102 0V5h3a1 1 0 100-2h-4zm-9 12a1 1 0 011 1v3h3a1 1 0 110 2H4a1 1 0 01-1-1v-4a1 1 0 011-1zm12 0a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 110-2h3v-3a1 1 0 011-1z",clipRule:"evenodd"})})})]})]}):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(fw,{isOpen:f,onClose:()=>g(!1)}),m&&o.jsx(vw,{logs:d,onClose:()=>b(!1)})]})});function Lx({summary:e,messages:r,workdir:i}){const[s,c]=U.useState(!1),d=GS(r),{branch:p}=VS(i),l=Ee(h=>h.currentSession);return o.jsxs("div",{className:"flex flex-col h-full",children:[d&&o.jsxs("div",{className:"mb-4",children:[o.jsx("button",{onClick:()=>c(!0),className:"w-full flex items-center justify-center px-3 py-2 rounded bg-bg-tertiary hover:bg-bg-secondary transition-colors",title:"View detailed response and call-level stats",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[o.jsx("span",{className:"text-text-secondary",children:YS(d.aiTime)}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:kx(d.avgPrefillSpeed)}),o.jsx("span",{children:"pp"}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:kx(d.avgGenerationSpeed)}),o.jsx("span",{children:"tg"})]})}),o.jsx(lw,{isOpen:s,onClose:()=>c(!1),stats:d})]}),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(hw,{criteria:(l==null?void 0:l.criteria)??[]})]})]}),p&&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:p,children:p})]}),o.jsx(bw,{workdir:i})]})}function yw({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:i,messages:s}){const c=Ee(d=>d.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(Lx,{summary:(c==null?void 0:c.summary)??null,messages:s,workdir:c==null?void 0:c.workdir})}):o.jsx("aside",{className:"hidden md:block w-0 shrink-0 overflow-hidden border-l-0"}),o.jsx("aside",{className:`
|
|
85
|
-
md:hidden
|
|
86
|
-
p-4 overflow-y-auto bg-bg-secondary
|
|
87
|
-
transition-all duration-300 ease-in-out
|
|
88
|
-
fixed right-0 top-[32px] h-[calc(100vh-32px)] z-50
|
|
89
|
-
${r?"w-[320px] translate-x-0 border-l border-border":"w-[320px] translate-x-full"}
|
|
90
|
-
`,children:o.jsx(Lx,{summary:(c==null?void 0:c.summary)??null,messages:s,workdir:c==null?void 0:c.workdir})})]})]})}function _w(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function Rx(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function Sw(){const e=Ee(f=>f.contextState),r=Ee(f=>f.currentSession),i=Ee(f=>f.compactContext);if(!e||!r)return null;const{currentTokens:s,maxTokens:c,compactionCount:d,dangerZone:p}=e,l=Math.round(s/c*100),h=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:Rx(l,p),children:[Cx(s)," / ",Cx(c)]}),o.jsxs("span",{className:Rx(l,p),children:["(",l,"%)"]})]}),o.jsx("div",{className:"h-1.5 bg-bg-tertiary rounded-full overflow-hidden w-20",children:o.jsx("div",{className:`h-full transition-all duration-300 ${_w(l,p)}`,style:{width:`${Math.min(l,100)}%`}})}),p&&o.jsx("span",{className:"text-[10px] text-accent-error font-medium animate-pulse",children:"Low!"}),d>0&&o.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[d,"x"]}),o.jsx(dt,{variant:"secondary",size:"md",onClick:i,disabled:h,title:h?"Cannot compact while running":"Compact context",className:p?"border-accent-error text-accent-error hover:bg-accent-error/10":"",children:"Compact"})]})})})}function Mx(e){const r=[],i=String(e||"");let s=i.indexOf(","),c=0,d=!1;for(;!d;){s===-1&&(s=i.length,d=!0);const p=i.slice(c,s).trim();(p||!d)&&r.push(p),c=s+1,s=i.indexOf(",",c)}return r}function ww(e,r){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const Cw=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kw=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ew={};function Ox(e,r){return(Ew.jsx?kw:Cw).test(e)}const jw=/[ \t\n\f\r]/g;function Nw(e){return typeof e=="object"?e.type==="text"?Bx(e.value):!1:Bx(e)}function Bx(e){return e.replace(jw,"")===""}class Va{constructor(r,i,s){this.normal=i,this.property=r,s&&(this.space=s)}}Va.prototype.normal={};Va.prototype.property={};Va.prototype.space=void 0;function db(e,r){const i={},s={};for(const c of e)Object.assign(i,c.property),Object.assign(s,c.normal);return new Va(i,s,r)}function Ha(e){return e.toLowerCase()}class bn{constructor(r,i){this.attribute=i,this.property=r}}bn.prototype.attribute="";bn.prototype.booleanish=!1;bn.prototype.boolean=!1;bn.prototype.commaOrSpaceSeparated=!1;bn.prototype.commaSeparated=!1;bn.prototype.defined=!1;bn.prototype.mustUseProperty=!1;bn.prototype.number=!1;bn.prototype.overloadedBoolean=!1;bn.prototype.property="";bn.prototype.spaceSeparated=!1;bn.prototype.space=void 0;let Tw=0;const We=Ai(),zt=Ai(),$d=Ai(),ye=Ai(),_t=Ai(),Es=Ai(),Nn=Ai();function Ai(){return 2**++Tw}const qd=Object.freeze(Object.defineProperty({__proto__:null,boolean:We,booleanish:zt,commaOrSpaceSeparated:Nn,commaSeparated:Es,number:ye,overloadedBoolean:$d,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),vd=Object.keys(qd);class hh extends bn{constructor(r,i,s,c){let d=-1;if(super(r,i),Ix(this,"space",c),typeof s=="number")for(;++d<vd.length;){const p=vd[d];Ix(this,vd[d],(s&qd[p])===qd[p])}}}hh.prototype.defined=!0;function Ix(e,r,i){i&&(e[r]=i)}function Ts(e){const r={},i={};for(const[s,c]of Object.entries(e.properties)){const d=new hh(s,e.transform(e.attributes||{},s),c,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(d.mustUseProperty=!0),r[s]=d,i[Ha(s)]=s,i[Ha(d.attribute)]=s}return new Va(r,i,e.space)}const hb=Ts({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:ye,ariaColIndex:ye,ariaColSpan:ye,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:_t,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:ye,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:ye,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:_t,ariaRowCount:ye,ariaRowIndex:ye,ariaRowSpan:ye,ariaSelected:zt,ariaSetSize:ye,ariaSort:null,ariaValueMax:ye,ariaValueMin:ye,ariaValueNow:ye,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function fb(e,r){return r in e?e[r]:r}function pb(e,r){return fb(e,r.toLowerCase())}const Aw=Ts({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Es,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:We,allowPaymentRequest:We,allowUserMedia:We,alt:null,as:null,async:We,autoCapitalize:null,autoComplete:_t,autoFocus:We,autoPlay:We,blocking:_t,capture:null,charSet:null,checked:We,cite:null,className:_t,cols:ye,colSpan:null,content:null,contentEditable:zt,controls:We,controlsList:_t,coords:ye|Es,crossOrigin:null,data:null,dateTime:null,decoding:null,default:We,defer:We,dir:null,dirName:null,disabled:We,download:$d,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:We,formTarget:null,headers:_t,height:ye,hidden:$d,high:ye,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:We,inputMode:null,integrity:null,is:null,isMap:We,itemId:null,itemProp:_t,itemRef:_t,itemScope:We,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:We,low:ye,manifest:null,max:null,maxLength:ye,media:null,method:null,min:null,minLength:ye,multiple:We,muted:We,name:null,nonce:null,noModule:We,noValidate:We,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:We,optimum:ye,pattern:null,ping:_t,placeholder:null,playsInline:We,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:We,referrerPolicy:null,rel:_t,required:We,reversed:We,rows:ye,rowSpan:ye,sandbox:_t,scope:null,scoped:We,seamless:We,selected:We,shadowRootClonable:We,shadowRootDelegatesFocus:We,shadowRootMode:null,shape:null,size:ye,sizes:null,slot:null,span:ye,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ye,step:null,style:null,tabIndex:ye,target:null,title:null,translate:null,type:null,typeMustMatch:We,useMap:null,value:zt,width:ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,axis:null,background:null,bgColor:null,border:ye,borderColor:null,bottomMargin:ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:We,declare:We,event:null,face:null,frame:null,frameBorder:null,hSpace:ye,leftMargin:ye,link:null,longDesc:null,lowSrc:null,marginHeight:ye,marginWidth:ye,noResize:We,noHref:We,noShade:We,noWrap:We,object:null,profile:null,prompt:null,rev:null,rightMargin:ye,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ye,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:We,disableRemotePlayback:We,prefix:null,property:null,results:ye,security:null,unselectable:null},space:"html",transform:pb}),Dw=Ts({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:Nn,accentHeight:ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ye,amplitude:ye,arabicForm:null,ascent:ye,attributeName:null,attributeType:null,azimuth:ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ye,by:null,calcMode:null,capHeight:ye,className:_t,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:ye,diffuseConstant:ye,direction:null,display:null,dur:null,divisor:ye,dominantBaseline:null,download:We,dx:null,dy:null,edgeMode:null,editable:null,elevation:ye,enableBackground:null,end:null,event:null,exponent:ye,externalResourcesRequired:null,fill:null,fillOpacity:ye,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:Es,g2:Es,glyphName:Es,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ye,horizOriginX:ye,horizOriginY:ye,id:null,ideographic:ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ye,k:ye,k1:ye,k2:ye,k3:ye,k4:ye,kernelMatrix:Nn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ye,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:ye,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:ye,overlineThickness:ye,paintOrder:null,panose1:null,path:null,pathLength:ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ye,pointsAtY:ye,pointsAtZ:ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Nn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Nn,rev:Nn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Nn,requiredFeatures:Nn,requiredFonts:Nn,requiredFormats:Nn,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:ye,specularExponent:ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ye,strikethroughThickness:ye,string:null,stroke:null,strokeDashArray:Nn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ye,strokeOpacity:ye,strokeWidth:null,style:null,surfaceScale:ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Nn,tabIndex:ye,tableValues:null,target:null,targetX:ye,targetY:ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Nn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ye,underlineThickness:ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ye,values:null,vAlphabetic:ye,vMathematical:ye,vectorEffect:null,vHanging:ye,vIdeographic:ye,version:null,vertAdvY:ye,vertOriginX:ye,vertOriginY:ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:fb}),mb=Ts({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()}}),gb=Ts({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:pb}),xb=Ts({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),Lw={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"},Rw=/[A-Z]/g,zx=/-[a-z]/g,Mw=/^data[-\w.:]+$/i;function vb(e,r){const i=Ha(r);let s=r,c=bn;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&Mw.test(r)){if(r.charAt(4)==="-"){const d=r.slice(5).replace(zx,Bw);s="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{const d=r.slice(4);if(!zx.test(d)){let p=d.replace(Rw,Ow);p.charAt(0)!=="-"&&(p="-"+p),r="data"+p}}c=hh}return new c(s,r)}function Ow(e){return"-"+e.toLowerCase()}function Bw(e){return e.charAt(1).toUpperCase()}const bb=db([hb,Aw,mb,gb,xb],"html"),Ol=db([hb,Dw,mb,gb,xb],"svg");function Hx(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function Iw(e){return e.join(" ").trim()}var xs={},bd,Px;function zw(){if(Px)return bd;Px=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,d=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,p=/^[;\s]*/,l=/^\s+|\s+$/g,h=`
|
|
91
|
-
`,f="/",g="*",m="",b="comment",S="declaration";function E(x,_){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];_=_||{};var v=1,y=1;function j(I){var P=I.match(r);P&&(v+=P.length);var V=I.lastIndexOf(h);y=~V?I.length-V:y+I.length}function A(){var I={line:v,column:y};return function(P){return P.position=new N(I),B(),P}}function N(I){this.start=I,this.end={line:v,column:y},this.source=_.source}N.prototype.content=x;function L(I){var P=new Error(_.source+":"+v+":"+y+": "+I);if(P.reason=I,P.filename=_.source,P.line=v,P.column=y,P.source=x,!_.silent)throw P}function T(I){var P=I.exec(x);if(P){var V=P[0];return j(V),x=x.slice(V.length),P}}function B(){T(i)}function H(I){var P;for(I=I||[];P=W();)P!==!1&&I.push(P);return I}function W(){var I=A();if(!(f!=x.charAt(0)||g!=x.charAt(1))){for(var P=2;m!=x.charAt(P)&&(g!=x.charAt(P)||f!=x.charAt(P+1));)++P;if(P+=2,m===x.charAt(P-1))return L("End of comment missing");var V=x.slice(2,P-2);return y+=2,j(V),x=x.slice(P),y+=2,I({type:b,comment:V})}}function Y(){var I=A(),P=T(s);if(P){if(W(),!T(c))return L("property missing ':'");var V=T(d),Z=I({type:S,property:C(P[0].replace(e,m)),value:V?C(V[0].replace(e,m)):m});return T(p),Z}}function $(){var I=[];H(I);for(var P;P=Y();)P!==!1&&(I.push(P),H(I));return I}return B(),$()}function C(x){return x?x.replace(l,m):m}return bd=E,bd}var Fx;function Hw(){if(Fx)return xs;Fx=1;var e=xs&&xs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(xs,"__esModule",{value:!0}),xs.default=i;const r=e(zw());function i(s,c){let d=null;if(!s||typeof s!="string")return d;const p=(0,r.default)(s),l=typeof c=="function";return p.forEach(h=>{if(h.type!=="declaration")return;const{property:f,value:g}=h;l?c(f,g,h):g&&(d=d||{},d[f]=g)}),d}return xs}var Ta={},Ux;function Pw(){if(Ux)return Ta;Ux=1,Object.defineProperty(Ta,"__esModule",{value:!0}),Ta.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,d=function(f){return!f||i.test(f)||e.test(f)},p=function(f,g){return g.toUpperCase()},l=function(f,g){return"".concat(g,"-")},h=function(f,g){return g===void 0&&(g={}),d(f)?f:(f=f.toLowerCase(),g.reactCompat?f=f.replace(c,l):f=f.replace(s,l),f.replace(r,p))};return Ta.camelCase=h,Ta}var Aa,$x;function Fw(){if($x)return Aa;$x=1;var e=Aa&&Aa.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},r=e(Hw()),i=Pw();function s(c,d){var p={};return!c||typeof c!="string"||(0,r.default)(c,function(l,h){l&&h&&(p[(0,i.camelCase)(l,d)]=h)}),p}return s.default=s,Aa=s,Aa}var Uw=Fw();const $w=Dl(Uw),yb=_b("end"),fh=_b("start");function _b(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 qw(e){const r=fh(e),i=yb(e);if(r&&i)return{start:r,end:i}}function Oa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?qx(e.position):"start"in e||"end"in e?qx(e):"line"in e||"column"in e?Wd(e):""}function Wd(e){return Wx(e&&e.line)+":"+Wx(e&&e.column)}function qx(e){return Wd(e&&e.start)+"-"+Wd(e&&e.end)}function Wx(e){return e&&typeof e=="number"?e:1}class an extends Error{constructor(r,i,s){super(),typeof i=="string"&&(s=i,i=void 0);let c="",d={},p=!1;if(i&&("line"in i&&"column"in i?d={place:i}:"start"in i&&"end"in i?d={place:i}:"type"in i?d={ancestors:[i],place:i.position}:d={...i}),typeof r=="string"?c=r:!d.cause&&r&&(p=!0,c=r.message,d.cause=r),!d.ruleId&&!d.source&&typeof s=="string"){const h=s.indexOf(":");h===-1?d.ruleId=s:(d.source=s.slice(0,h),d.ruleId=s.slice(h+1))}if(!d.place&&d.ancestors&&d.ancestors){const h=d.ancestors[d.ancestors.length-1];h&&(d.place=h.position)}const l=d.place&&"start"in d.place?d.place.start:d.place;this.ancestors=d.ancestors||void 0,this.cause=d.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=l?l.line:void 0,this.name=Oa(d.place)||"1:1",this.place=d.place||void 0,this.reason=this.message,this.ruleId=d.ruleId||void 0,this.source=d.source||void 0,this.stack=p&&d.cause&&typeof d.cause.stack=="string"?d.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}an.prototype.file="";an.prototype.name="";an.prototype.reason="";an.prototype.message="";an.prototype.stack="";an.prototype.column=void 0;an.prototype.line=void 0;an.prototype.ancestors=void 0;an.prototype.cause=void 0;an.prototype.fatal=void 0;an.prototype.place=void 0;an.prototype.ruleId=void 0;an.prototype.source=void 0;const ph={}.hasOwnProperty,Ww=new Map,Gw=/[A-Z]/g,Vw=new Set(["table","tbody","thead","tfoot","tr"]),Yw=new Set(["td","th"]),Sb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Kw(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=r2(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=n2(i,r.jsx,r.jsxs)}const c={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:s,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?Ol:bb,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},d=wb(c,e,void 0);return d&&typeof d!="string"?d:c.create(e,c.Fragment,{children:d||void 0},void 0)}function wb(e,r,i){if(r.type==="element")return Xw(e,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return Zw(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return Jw(e,r,i);if(r.type==="mdxjsEsm")return Qw(e,r);if(r.type==="root")return e2(e,r,i);if(r.type==="text")return t2(e,r)}function Xw(e,r,i){const s=e.schema;let c=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(c=Ol,e.schema=c),e.ancestors.push(r);const d=kb(e,r.tagName,!1),p=i2(e,r);let l=gh(e,r);return Vw.has(r.tagName)&&(l=l.filter(function(h){return typeof h=="string"?!Nw(h):!0})),Cb(e,p,d,r),mh(p,l),e.ancestors.pop(),e.schema=s,e.create(r,d,p,i)}function Zw(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)}Pa(e,r.position)}function Qw(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);Pa(e,r.position)}function Jw(e,r,i){const s=e.schema;let c=s;r.name==="svg"&&s.space==="html"&&(c=Ol,e.schema=c),e.ancestors.push(r);const d=r.name===null?e.Fragment:kb(e,r.name,!0),p=s2(e,r),l=gh(e,r);return Cb(e,p,d,r),mh(p,l),e.ancestors.pop(),e.schema=s,e.create(r,d,p,i)}function e2(e,r,i){const s={};return mh(s,gh(e,r)),e.create(r,e.Fragment,s,i)}function t2(e,r){return r.value}function Cb(e,r,i,s){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(r.node=s)}function mh(e,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(e.children=i)}}function n2(e,r,i){return s;function s(c,d,p,l){const f=Array.isArray(p.children)?i:r;return l?f(d,p,l):f(d,p)}}function r2(e,r){return i;function i(s,c,d,p){const l=Array.isArray(d.children),h=fh(s);return r(c,d,p,l,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function i2(e,r){const i={};let s,c;for(c in r.properties)if(c!=="children"&&ph.call(r.properties,c)){const d=a2(e,c,r.properties[c]);if(d){const[p,l]=d;e.tableCellAlignToStyle&&p==="align"&&typeof l=="string"&&Yw.has(r.tagName)?s=l:i[p]=l}}if(s){const d=i.style||(i.style={});d[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return i}function s2(e,r){const i={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const d=s.data.estree.body[0];d.type;const p=d.expression;p.type;const l=p.properties[0];l.type,Object.assign(i,e.evaluater.evaluateExpression(l.argument))}else Pa(e,r.position);else{const c=s.name;let d;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,d=e.evaluater.evaluateExpression(l.expression)}else Pa(e,r.position);else d=s.value===null?!0:s.value;i[c]=d}return i}function gh(e,r){const i=[];let s=-1;const c=e.passKeys?new Map:Ww;for(;++s<r.children.length;){const d=r.children[s];let p;if(e.passKeys){const h=d.type==="element"?d.tagName:d.type==="mdxJsxFlowElement"||d.type==="mdxJsxTextElement"?d.name:void 0;if(h){const f=c.get(h)||0;p=h+"-"+f,c.set(h,f+1)}}const l=wb(e,d,p);l!==void 0&&i.push(l)}return i}function a2(e,r,i){const s=vb(e.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?ww(i):Iw(i)),s.property==="style"){let c=typeof i=="object"?i:o2(e,String(i));return e.stylePropertyNameCase==="css"&&(c=l2(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&s.space?Lw[s.property]||s.property:s.attribute,i]}}function o2(e,r){try{return $w(r,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const s=i,c=new an("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=Sb+"#cannot-parse-style-attribute",c}}function kb(e,r,i){let s;if(!i)s={type:"Literal",value:r};else if(r.includes(".")){const c=r.split(".");let d=-1,p;for(;++d<c.length;){const l=Ox(c[d])?{type:"Identifier",name:c[d]}:{type:"Literal",value:c[d]};p=p?{type:"MemberExpression",object:p,property:l,computed:!!(d&&l.type==="Literal"),optional:!1}:l}s=p}else s=Ox(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const c=s.value;return ph.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(s);Pa(e)}function Pa(e,r){const i=new an("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=Sb+"#cannot-handle-mdx-estrees-without-createevaluater",i}function l2(e){const r={};let i;for(i in e)ph.call(e,i)&&(r[c2(i)]=e[i]);return r}function c2(e){let r=e.replace(Gw,u2);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function u2(e){return"-"+e.toLowerCase()}const yd={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},d2={};function xh(e,r){const i=d2,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,c=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return Eb(e,s,c)}function Eb(e,r,i){if(h2(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 Gx(e.children,r,i)}return Array.isArray(e)?Gx(e,r,i):""}function Gx(e,r,i){const s=[];let c=-1;for(;++c<e.length;)s[c]=Eb(e[c],r,i);return s.join("")}function h2(e){return!!(e&&typeof e=="object")}const Vx=document.createElement("i");function Fa(e){const r="&"+e+";";Vx.innerHTML=r;const i=Vx.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===r?!1:i}function Dn(e,r,i,s){const c=e.length;let d=0,p;if(r<0?r=-r>c?0:c+r:r=r>c?c:r,i=i>0?i:0,s.length<1e4)p=Array.from(s),p.unshift(r,i),e.splice(...p);else for(i&&e.splice(r,i);d<s.length;)p=s.slice(d,d+1e4),p.unshift(r,0),e.splice(...p),d+=1e4,r+=1e4}function $n(e,r){return e.length>0?(Dn(e,e.length,0,r),e):r}const Yx={}.hasOwnProperty;function jb(e){const r={};let i=-1;for(;++i<e.length;)f2(r,e[i]);return r}function f2(e,r){let i;for(i in r){const c=(Yx.call(e,i)?e[i]:void 0)||(e[i]={}),d=r[i];let p;if(d)for(p in d){Yx.call(c,p)||(c[p]=[]);const l=d[p];p2(c[p],Array.isArray(l)?l:l?[l]:[])}}}function p2(e,r){let i=-1;const s=[];for(;++i<r.length;)(r[i].add==="after"?e:s).push(r[i]);Dn(e,0,0,s)}function Nb(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 Kn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cn=ii(/[A-Za-z]/),sn=ii(/[\dA-Za-z]/),m2=ii(/[#-'*+\--9=?A-Z^-~]/);function El(e){return e!==null&&(e<32||e===127)}const Gd=ii(/\d/),g2=ii(/[\dA-Fa-f]/),x2=ii(/[!-/:-@[-`{-~]/);function Me(e){return e!==null&&e<-2}function yt(e){return e!==null&&(e<0||e===32)}function Xe(e){return e===-2||e===-1||e===32}const Bl=ii(new RegExp("\\p{P}|\\p{S}","u")),Ti=ii(/\s/);function ii(e){return r;function r(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function As(e){const r=[];let i=-1,s=0,c=0;for(;++i<e.length;){const d=e.charCodeAt(i);let p="";if(d===37&&sn(e.charCodeAt(i+1))&&sn(e.charCodeAt(i+2)))c=2;else if(d<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(d))||(p=String.fromCharCode(d));else if(d>55295&&d<57344){const l=e.charCodeAt(i+1);d<56320&&l>56319&&l<57344?(p=String.fromCharCode(d,l),c=1):p="�"}else p=String.fromCharCode(d);p&&(r.push(e.slice(s,i),encodeURIComponent(p)),s=i+c+1,p=""),c&&(i+=c,c=0)}return r.join("")+e.slice(s)}function rt(e,r,i,s){const c=s?s-1:Number.POSITIVE_INFINITY;let d=0;return p;function p(h){return Xe(h)?(e.enter(i),l(h)):r(h)}function l(h){return Xe(h)&&d++<c?(e.consume(h),l):(e.exit(i),r(h))}}const v2={tokenize:b2};function b2(e){const r=e.attempt(this.parser.constructs.contentInitial,s,c);let i;return r;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),rt(e,r,"linePrefix")}function c(l){return e.enter("paragraph"),d(l)}function d(l){const h=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=h),i=h,p(l)}function p(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Me(l)?(e.consume(l),e.exit("chunkText"),d):(e.consume(l),p)}}const y2={tokenize:_2},Kx={tokenize:S2};function _2(e){const r=this,i=[];let s=0,c,d,p;return l;function l(y){if(s<i.length){const j=i[s];return r.containerState=j[1],e.attempt(j[0].continuation,h,f)(y)}return f(y)}function h(y){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,c&&v();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}_(s);let L=j;for(;L<r.events.length;)r.events[L][1].end={...N},L++;return Dn(r.events,A+1,0,r.events.slice(j)),r.events.length=L,f(y)}return l(y)}function f(y){if(s===i.length){if(!c)return b(y);if(c.currentConstruct&&c.currentConstruct.concrete)return E(y);r.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(Kx,g,m)(y)}function g(y){return c&&v(),_(s),b(y)}function m(y){return r.parser.lazy[r.now().line]=s!==i.length,p=r.now().offset,E(y)}function b(y){return r.containerState={},e.attempt(Kx,S,E)(y)}function S(y){return s++,i.push([r.currentConstruct,r.containerState]),b(y)}function E(y){if(y===null){c&&v(),_(0),e.consume(y);return}return c=c||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:d}),C(y)}function C(y){if(y===null){x(e.exit("chunkFlow"),!0),_(0),e.consume(y);return}return Me(y)?(e.consume(y),x(e.exit("chunkFlow")),s=0,r.interrupt=void 0,l):(e.consume(y),C)}function x(y,j){const A=r.sliceStream(y);if(j&&A.push(null),y.previous=d,d&&(d.next=y),d=y,c.defineSkip(y.start),c.write(A),r.parser.lazy[y.start.line]){let N=c.events.length;for(;N--;)if(c.events[N][1].start.offset<p&&(!c.events[N][1].end||c.events[N][1].end.offset>p))return;const L=r.events.length;let T=L,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(_(s),N=L;N<r.events.length;)r.events[N][1].end={...H},N++;Dn(r.events,T+1,0,r.events.slice(L)),r.events.length=N}}function _(y){let j=i.length;for(;j-- >y;){const A=i[j];r.containerState=A[1],A[0].exit.call(r,e)}i.length=y}function v(){c.write([null]),d=void 0,c=void 0,r.containerState._closeFlow=void 0}}function S2(e,r,i){return rt(e,e.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function js(e){if(e===null||yt(e)||Ti(e))return 1;if(Bl(e))return 2}function Il(e,r,i){const s=[];let c=-1;for(;++c<e.length;){const d=e[c].resolveAll;d&&!s.includes(d)&&(r=d(r,i),s.push(d))}return r}const Vd={name:"attention",resolveAll:w2,tokenize:C2};function w2(e,r){let i=-1,s,c,d,p,l,h,f,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;h=e[s][1].end.offset-e[s][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const m={...e[s][1].end},b={...e[i][1].start};Xx(m,-h),Xx(b,h),p={type:h>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},l={type:h>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:b},d={type:h>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[i][1].start}},c={type:h>1?"strong":"emphasis",start:{...p.start},end:{...l.end}},e[s][1].end={...p.start},e[i][1].start={...l.end},f=[],e[s][1].end.offset-e[s][1].start.offset&&(f=$n(f,[["enter",e[s][1],r],["exit",e[s][1],r]])),f=$n(f,[["enter",c,r],["enter",p,r],["exit",p,r],["enter",d,r]]),f=$n(f,Il(r.parser.constructs.insideSpan.null,e.slice(s+1,i),r)),f=$n(f,[["exit",d,r],["enter",l,r],["exit",l,r],["exit",c,r]]),e[i][1].end.offset-e[i][1].start.offset?(g=2,f=$n(f,[["enter",e[i][1],r],["exit",e[i][1],r]])):g=0,Dn(e,s-1,i-s+3,f),i=s+f.length-g-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function C2(e,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,c=js(s);let d;return p;function p(h){return d=h,e.enter("attentionSequence"),l(h)}function l(h){if(h===d)return e.consume(h),l;const f=e.exit("attentionSequence"),g=js(h),m=!g||g===2&&c||i.includes(h),b=!c||c===2&&g||i.includes(s);return f._open=!!(d===42?m:m&&(c||!b)),f._close=!!(d===42?b:b&&(g||!m)),r(h)}}function Xx(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const k2={name:"autolink",tokenize:E2};function E2(e,r,i){let s=0;return c;function c(S){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),d}function d(S){return cn(S)?(e.consume(S),p):S===64?i(S):f(S)}function p(S){return S===43||S===45||S===46||sn(S)?(s=1,l(S)):f(S)}function l(S){return S===58?(e.consume(S),s=0,h):(S===43||S===45||S===46||sn(S))&&s++<32?(e.consume(S),l):(s=0,f(S))}function h(S){return S===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.exit("autolink"),r):S===null||S===32||S===60||El(S)?i(S):(e.consume(S),h)}function f(S){return S===64?(e.consume(S),g):m2(S)?(e.consume(S),f):i(S)}function g(S){return sn(S)?m(S):i(S)}function m(S){return S===46?(e.consume(S),s=0,g):S===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.exit("autolink"),r):b(S)}function b(S){if((S===45||sn(S))&&s++<63){const E=S===45?b:m;return e.consume(S),E}return i(S)}}const Ya={partial:!0,tokenize:j2};function j2(e,r,i){return s;function s(d){return Xe(d)?rt(e,c,"linePrefix")(d):c(d)}function c(d){return d===null||Me(d)?r(d):i(d)}}const Tb={continuation:{tokenize:T2},exit:A2,name:"blockQuote",tokenize:N2};function N2(e,r,i){const s=this;return c;function c(p){if(p===62){const l=s.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(p),e.exit("blockQuoteMarker"),d}return i(p)}function d(p){return Xe(p)?(e.enter("blockQuotePrefixWhitespace"),e.consume(p),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(p))}}function T2(e,r,i){const s=this;return c;function c(p){return Xe(p)?rt(e,d,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(p):d(p)}function d(p){return e.attempt(Tb,r,i)(p)}}function A2(e){e.exit("blockQuote")}const Ab={name:"characterEscape",tokenize:D2};function D2(e,r,i){return s;function s(d){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(d),e.exit("escapeMarker"),c}function c(d){return x2(d)?(e.enter("characterEscapeValue"),e.consume(d),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):i(d)}}const Db={name:"characterReference",tokenize:L2};function L2(e,r,i){const s=this;let c=0,d,p;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),h}function h(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),d=31,p=sn,g(m))}function f(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),d=6,p=g2,g):(e.enter("characterReferenceValue"),d=7,p=Gd,g(m))}function g(m){if(m===59&&c){const b=e.exit("characterReferenceValue");return p===sn&&!Fa(s.sliceSerialize(b))?i(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return p(m)&&c++<d?(e.consume(m),g):i(m)}}const Zx={partial:!0,tokenize:M2},Qx={concrete:!0,name:"codeFenced",tokenize:R2};function R2(e,r,i){const s=this,c={partial:!0,tokenize:A};let d=0,p=0,l;return h;function h(N){return f(N)}function f(N){const L=s.events[s.events.length-1];return d=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,l=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(N)}function g(N){return N===l?(p++,e.consume(N),g):p<3?i(N):(e.exit("codeFencedFenceSequence"),Xe(N)?rt(e,m,"whitespace")(N):m(N))}function m(N){return N===null||Me(N)?(e.exit("codeFencedFence"),s.interrupt?r(N):e.check(Zx,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(N))}function b(N){return N===null||Me(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(N)):Xe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),rt(e,S,"whitespace")(N)):N===96&&N===l?i(N):(e.consume(N),b)}function S(N){return N===null||Me(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),E(N))}function E(N){return N===null||Me(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(N)):N===96&&N===l?i(N):(e.consume(N),E)}function C(N){return e.attempt(c,j,x)(N)}function x(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),_}function _(N){return d>0&&Xe(N)?rt(e,v,"linePrefix",d+1)(N):v(N)}function v(N){return N===null||Me(N)?e.check(Zx,C,j)(N):(e.enter("codeFlowValue"),y(N))}function y(N){return N===null||Me(N)?(e.exit("codeFlowValue"),v(N)):(e.consume(N),y)}function j(N){return e.exit("codeFenced"),r(N)}function A(N,L,T){let B=0;return H;function H(P){return N.enter("lineEnding"),N.consume(P),N.exit("lineEnding"),W}function W(P){return N.enter("codeFencedFence"),Xe(P)?rt(N,Y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):Y(P)}function Y(P){return P===l?(N.enter("codeFencedFenceSequence"),$(P)):T(P)}function $(P){return P===l?(B++,N.consume(P),$):B>=p?(N.exit("codeFencedFenceSequence"),Xe(P)?rt(N,I,"whitespace")(P):I(P)):T(P)}function I(P){return P===null||Me(P)?(N.exit("codeFencedFence"),L(P)):T(P)}}}function M2(e,r,i){const s=this;return c;function c(p){return p===null?i(p):(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d)}function d(p){return s.parser.lazy[s.now().line]?i(p):r(p)}}const _d={name:"codeIndented",tokenize:B2},O2={partial:!0,tokenize:I2};function B2(e,r,i){const s=this;return c;function c(f){return e.enter("codeIndented"),rt(e,d,"linePrefix",5)(f)}function d(f){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?p(f):i(f)}function p(f){return f===null?h(f):Me(f)?e.attempt(O2,p,h)(f):(e.enter("codeFlowValue"),l(f))}function l(f){return f===null||Me(f)?(e.exit("codeFlowValue"),p(f)):(e.consume(f),l)}function h(f){return e.exit("codeIndented"),r(f)}}function I2(e,r,i){const s=this;return c;function c(p){return s.parser.lazy[s.now().line]?i(p):Me(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):rt(e,d,"linePrefix",5)(p)}function d(p){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(p):Me(p)?c(p):i(p)}}const z2={name:"codeText",previous:P2,resolve:H2,tokenize:F2};function H2(e){let r=e.length-4,i=3,s,c;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(s=i;++s<r;)if(e[s][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(s=i-1,r++;++s<=r;)c===void 0?s!==r&&e[s][1].type!=="lineEnding"&&(c=s):(s===r||e[s][1].type==="lineEnding")&&(e[c][1].type="codeTextData",s!==c+2&&(e[c][1].end=e[s-1][1].end,e.splice(c+2,s-c-2),r-=s-c-2,s=c+2),c=void 0);return e}function P2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function F2(e,r,i){let s=0,c,d;return p;function p(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),s++,l):(e.exit("codeTextSequence"),h(m))}function h(m){return m===null?i(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),h):m===96?(d=e.enter("codeTextSequence"),c=0,g(m)):Me(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),h):(e.enter("codeTextData"),f(m))}function f(m){return m===null||m===32||m===96||Me(m)?(e.exit("codeTextData"),h(m)):(e.consume(m),f)}function g(m){return m===96?(e.consume(m),c++,g):c===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(d.type="codeTextData",f(m))}}class U2{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,i){const s=i??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(r,s):r>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(r,i,s){const c=i||0;this.setCursor(Math.trunc(r));const d=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return s&&Da(this.left,s),d.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),Da(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Da(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);Da(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Da(this.left,i.reverse())}}}function Da(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 Lb(e){const r={};let i=-1,s,c,d,p,l,h,f;const g=new U2(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"&&(h=s[1]._tokenizer.events,d=0,d<h.length&&h[d][1].type==="lineEndingBlank"&&(d+=2),d<h.length&&h[d][1].type==="content"))for(;++d<h.length&&h[d][1].type!=="content";)h[d][1].type==="chunkText"&&(h[d][1]._isInFirstContentOfListItem=!0,d++);if(s[0]==="enter")s[1].contentType&&(Object.assign(r,$2(g,i)),i=r[i],f=!0);else if(s[1]._container){for(d=i,c=void 0;d--;)if(p=g.get(d),p[1].type==="lineEnding"||p[1].type==="lineEndingBlank")p[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),p[1].type="lineEnding",c=d);else if(!(p[1].type==="linePrefix"||p[1].type==="listItemIndent"))break;c&&(s[1].end={...g.get(c)[1].start},l=g.slice(c,i),l.unshift(s),g.splice(c,i-c+1,l))}}return Dn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!f}function $2(e,r){const i=e.get(r)[1],s=e.get(r)[2];let c=r-1;const d=[];let p=i._tokenizer;p||(p=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(p._contentTypeTextTrailing=!0));const l=p.events,h=[],f={};let g,m,b=-1,S=i,E=0,C=0;const x=[C];for(;S;){for(;e.get(++c)[1]!==S;);d.push(c),S._tokenizer||(g=s.sliceStream(S),S.next||g.push(null),m&&p.defineSkip(S.start),S._isInFirstContentOfListItem&&(p._gfmTasklistFirstContentOfListItem=!0),p.write(g),S._isInFirstContentOfListItem&&(p._gfmTasklistFirstContentOfListItem=void 0)),m=S,S=S.next}for(S=i;++b<l.length;)l[b][0]==="exit"&&l[b-1][0]==="enter"&&l[b][1].type===l[b-1][1].type&&l[b][1].start.line!==l[b][1].end.line&&(C=b+1,x.push(C),S._tokenizer=void 0,S.previous=void 0,S=S.next);for(p.events=[],S?(S._tokenizer=void 0,S.previous=void 0):x.pop(),b=x.length;b--;){const _=l.slice(x[b],x[b+1]),v=d.pop();h.push([v,v+_.length-1]),e.splice(v,2,_)}for(h.reverse(),b=-1;++b<h.length;)f[E+h[b][0]]=E+h[b][1],E+=h[b][1]-h[b][0]-1;return f}const q2={resolve:G2,tokenize:V2},W2={partial:!0,tokenize:Y2};function G2(e){return Lb(e),e}function V2(e,r){let i;return s;function s(l){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),c(l)}function c(l){return l===null?d(l):Me(l)?e.check(W2,p,d)(l):(e.consume(l),c)}function d(l){return e.exit("chunkContent"),e.exit("content"),r(l)}function p(l){return e.consume(l),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,c}}function Y2(e,r,i){const s=this;return c;function c(p){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),rt(e,d,"linePrefix")}function d(p){if(p===null||Me(p))return i(p);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(p):e.interrupt(s.parser.constructs.flow,i,r)(p)}}function Rb(e,r,i,s,c,d,p,l,h){const f=h||Number.POSITIVE_INFINITY;let g=0;return m;function m(_){return _===60?(e.enter(s),e.enter(c),e.enter(d),e.consume(_),e.exit(d),b):_===null||_===32||_===41||El(_)?i(_):(e.enter(s),e.enter(p),e.enter(l),e.enter("chunkString",{contentType:"string"}),C(_))}function b(_){return _===62?(e.enter(d),e.consume(_),e.exit(d),e.exit(c),e.exit(s),r):(e.enter(l),e.enter("chunkString",{contentType:"string"}),S(_))}function S(_){return _===62?(e.exit("chunkString"),e.exit(l),b(_)):_===null||_===60||Me(_)?i(_):(e.consume(_),_===92?E:S)}function E(_){return _===60||_===62||_===92?(e.consume(_),S):S(_)}function C(_){return!g&&(_===null||_===41||yt(_))?(e.exit("chunkString"),e.exit(l),e.exit(p),e.exit(s),r(_)):g<f&&_===40?(e.consume(_),g++,C):_===41?(e.consume(_),g--,C):_===null||_===32||_===40||El(_)?i(_):(e.consume(_),_===92?x:C)}function x(_){return _===40||_===41||_===92?(e.consume(_),C):C(_)}}function Mb(e,r,i,s,c,d){const p=this;let l=0,h;return f;function f(S){return e.enter(s),e.enter(c),e.consume(S),e.exit(c),e.enter(d),g}function g(S){return l>999||S===null||S===91||S===93&&!h||S===94&&!l&&"_hiddenFootnoteSupport"in p.parser.constructs?i(S):S===93?(e.exit(d),e.enter(c),e.consume(S),e.exit(c),e.exit(s),r):Me(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||S===91||S===93||Me(S)||l++>999?(e.exit("chunkString"),g(S)):(e.consume(S),h||(h=!Xe(S)),S===92?b:m)}function b(S){return S===91||S===92||S===93?(e.consume(S),l++,m):m(S)}}function Ob(e,r,i,s,c,d){let p;return l;function l(b){return b===34||b===39||b===40?(e.enter(s),e.enter(c),e.consume(b),e.exit(c),p=b===40?41:b,h):i(b)}function h(b){return b===p?(e.enter(c),e.consume(b),e.exit(c),e.exit(s),r):(e.enter(d),f(b))}function f(b){return b===p?(e.exit(d),h(p)):b===null?i(b):Me(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),rt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===p||b===null||Me(b)?(e.exit("chunkString"),f(b)):(e.consume(b),b===92?m:g)}function m(b){return b===p||b===92?(e.consume(b),g):g(b)}}function Ba(e,r){let i;return s;function s(c){return Me(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i=!0,s):Xe(c)?rt(e,s,i?"linePrefix":"lineSuffix")(c):r(c)}}const K2={name:"definition",tokenize:Z2},X2={partial:!0,tokenize:Q2};function Z2(e,r,i){const s=this;let c;return d;function d(S){return e.enter("definition"),p(S)}function p(S){return Mb.call(s,e,l,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(S)}function l(S){return c=Kn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),h):i(S)}function h(S){return yt(S)?Ba(e,f)(S):f(S)}function f(S){return Rb(e,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(S)}function g(S){return e.attempt(X2,m,m)(S)}function m(S){return Xe(S)?rt(e,b,"whitespace")(S):b(S)}function b(S){return S===null||Me(S)?(e.exit("definition"),s.parser.defined.push(c),r(S)):i(S)}}function Q2(e,r,i){return s;function s(l){return yt(l)?Ba(e,c)(l):i(l)}function c(l){return Ob(e,d,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function d(l){return Xe(l)?rt(e,p,"whitespace")(l):p(l)}function p(l){return l===null||Me(l)?r(l):i(l)}}const J2={name:"hardBreakEscape",tokenize:eC};function eC(e,r,i){return s;function s(d){return e.enter("hardBreakEscape"),e.consume(d),c}function c(d){return Me(d)?(e.exit("hardBreakEscape"),r(d)):i(d)}}const tC={name:"headingAtx",resolve:nC,tokenize:rC};function nC(e,r){let i=e.length-2,s=3,c,d;return e[s][1].type==="whitespace"&&(s+=2),i-2>s&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(s===i-1||i-4>s&&e[i-2][1].type==="whitespace")&&(i-=s+1===i?2:4),i>s&&(c={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},d={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},Dn(e,s,i-s+1,[["enter",c,r],["enter",d,r],["exit",d,r],["exit",c,r]])),e}function rC(e,r,i){let s=0;return c;function c(g){return e.enter("atxHeading"),d(g)}function d(g){return e.enter("atxHeadingSequence"),p(g)}function p(g){return g===35&&s++<6?(e.consume(g),p):g===null||yt(g)?(e.exit("atxHeadingSequence"),l(g)):i(g)}function l(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||Me(g)?(e.exit("atxHeading"),r(g)):Xe(g)?rt(e,l,"whitespace")(g):(e.enter("atxHeadingText"),f(g))}function h(g){return g===35?(e.consume(g),h):(e.exit("atxHeadingSequence"),l(g))}function f(g){return g===null||g===35||yt(g)?(e.exit("atxHeadingText"),l(g)):(e.consume(g),f)}}const iC=["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"],Jx=["pre","script","style","textarea"],sC={concrete:!0,name:"htmlFlow",resolveTo:lC,tokenize:cC},aC={partial:!0,tokenize:dC},oC={partial:!0,tokenize:uC};function lC(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 cC(e,r,i){const s=this;let c,d,p,l,h;return f;function f(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),b):F===47?(e.consume(F),d=!0,C):F===63?(e.consume(F),c=3,s.interrupt?r:D):cn(F)?(e.consume(F),p=String.fromCharCode(F),x):i(F)}function b(F){return F===45?(e.consume(F),c=2,S):F===91?(e.consume(F),c=5,l=0,E):cn(F)?(e.consume(F),c=4,s.interrupt?r:D):i(F)}function S(F){return F===45?(e.consume(F),s.interrupt?r:D):i(F)}function E(F){const K="CDATA[";return F===K.charCodeAt(l++)?(e.consume(F),l===K.length?s.interrupt?r:Y:E):i(F)}function C(F){return cn(F)?(e.consume(F),p=String.fromCharCode(F),x):i(F)}function x(F){if(F===null||F===47||F===62||yt(F)){const K=F===47,te=p.toLowerCase();return!K&&!d&&Jx.includes(te)?(c=1,s.interrupt?r(F):Y(F)):iC.includes(p.toLowerCase())?(c=6,K?(e.consume(F),_):s.interrupt?r(F):Y(F)):(c=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(F):d?v(F):y(F))}return F===45||sn(F)?(e.consume(F),p+=String.fromCharCode(F),x):i(F)}function _(F){return F===62?(e.consume(F),s.interrupt?r:Y):i(F)}function v(F){return Xe(F)?(e.consume(F),v):H(F)}function y(F){return F===47?(e.consume(F),H):F===58||F===95||cn(F)?(e.consume(F),j):Xe(F)?(e.consume(F),y):H(F)}function j(F){return F===45||F===46||F===58||F===95||sn(F)?(e.consume(F),j):A(F)}function A(F){return F===61?(e.consume(F),N):Xe(F)?(e.consume(F),A):y(F)}function N(F){return F===null||F===60||F===61||F===62||F===96?i(F):F===34||F===39?(e.consume(F),h=F,L):Xe(F)?(e.consume(F),N):T(F)}function L(F){return F===h?(e.consume(F),h=null,B):F===null||Me(F)?i(F):(e.consume(F),L)}function T(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||yt(F)?A(F):(e.consume(F),T)}function B(F){return F===47||F===62||Xe(F)?y(F):i(F)}function H(F){return F===62?(e.consume(F),W):i(F)}function W(F){return F===null||Me(F)?Y(F):Xe(F)?(e.consume(F),W):i(F)}function Y(F){return F===45&&c===2?(e.consume(F),V):F===60&&c===1?(e.consume(F),Z):F===62&&c===4?(e.consume(F),O):F===63&&c===3?(e.consume(F),D):F===93&&c===5?(e.consume(F),R):Me(F)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check(aC,q,$)(F)):F===null||Me(F)?(e.exit("htmlFlowData"),$(F)):(e.consume(F),Y)}function $(F){return e.check(oC,I,q)(F)}function I(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),P}function P(F){return F===null||Me(F)?$(F):(e.enter("htmlFlowData"),Y(F))}function V(F){return F===45?(e.consume(F),D):Y(F)}function Z(F){return F===47?(e.consume(F),p="",ee):Y(F)}function ee(F){if(F===62){const K=p.toLowerCase();return Jx.includes(K)?(e.consume(F),O):Y(F)}return cn(F)&&p.length<8?(e.consume(F),p+=String.fromCharCode(F),ee):Y(F)}function R(F){return F===93?(e.consume(F),D):Y(F)}function D(F){return F===62?(e.consume(F),O):F===45&&c===2?(e.consume(F),D):Y(F)}function O(F){return F===null||Me(F)?(e.exit("htmlFlowData"),q(F)):(e.consume(F),O)}function q(F){return e.exit("htmlFlow"),r(F)}}function uC(e,r,i){const s=this;return c;function c(p){return Me(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):i(p)}function d(p){return s.parser.lazy[s.now().line]?i(p):r(p)}}function dC(e,r,i){return s;function s(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(Ya,r,i)}}const hC={name:"htmlText",tokenize:fC};function fC(e,r,i){const s=this;let c,d,p;return l;function l(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),h}function h(D){return D===33?(e.consume(D),f):D===47?(e.consume(D),A):D===63?(e.consume(D),y):cn(D)?(e.consume(D),T):i(D)}function f(D){return D===45?(e.consume(D),g):D===91?(e.consume(D),d=0,E):cn(D)?(e.consume(D),v):i(D)}function g(D){return D===45?(e.consume(D),S):i(D)}function m(D){return D===null?i(D):D===45?(e.consume(D),b):Me(D)?(p=m,Z(D)):(e.consume(D),m)}function b(D){return D===45?(e.consume(D),S):m(D)}function S(D){return D===62?V(D):D===45?b(D):m(D)}function E(D){const O="CDATA[";return D===O.charCodeAt(d++)?(e.consume(D),d===O.length?C:E):i(D)}function C(D){return D===null?i(D):D===93?(e.consume(D),x):Me(D)?(p=C,Z(D)):(e.consume(D),C)}function x(D){return D===93?(e.consume(D),_):C(D)}function _(D){return D===62?V(D):D===93?(e.consume(D),_):C(D)}function v(D){return D===null||D===62?V(D):Me(D)?(p=v,Z(D)):(e.consume(D),v)}function y(D){return D===null?i(D):D===63?(e.consume(D),j):Me(D)?(p=y,Z(D)):(e.consume(D),y)}function j(D){return D===62?V(D):y(D)}function A(D){return cn(D)?(e.consume(D),N):i(D)}function N(D){return D===45||sn(D)?(e.consume(D),N):L(D)}function L(D){return Me(D)?(p=L,Z(D)):Xe(D)?(e.consume(D),L):V(D)}function T(D){return D===45||sn(D)?(e.consume(D),T):D===47||D===62||yt(D)?B(D):i(D)}function B(D){return D===47?(e.consume(D),V):D===58||D===95||cn(D)?(e.consume(D),H):Me(D)?(p=B,Z(D)):Xe(D)?(e.consume(D),B):V(D)}function H(D){return D===45||D===46||D===58||D===95||sn(D)?(e.consume(D),H):W(D)}function W(D){return D===61?(e.consume(D),Y):Me(D)?(p=W,Z(D)):Xe(D)?(e.consume(D),W):B(D)}function Y(D){return D===null||D===60||D===61||D===62||D===96?i(D):D===34||D===39?(e.consume(D),c=D,$):Me(D)?(p=Y,Z(D)):Xe(D)?(e.consume(D),Y):(e.consume(D),I)}function $(D){return D===c?(e.consume(D),c=void 0,P):D===null?i(D):Me(D)?(p=$,Z(D)):(e.consume(D),$)}function I(D){return D===null||D===34||D===39||D===60||D===61||D===96?i(D):D===47||D===62||yt(D)?B(D):(e.consume(D),I)}function P(D){return D===47||D===62||yt(D)?B(D):i(D)}function V(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),r):i(D)}function Z(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),ee}function ee(D){return Xe(D)?rt(e,R,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):R(D)}function R(D){return e.enter("htmlTextData"),p(D)}}const vh={name:"labelEnd",resolveAll:xC,resolveTo:vC,tokenize:bC},pC={tokenize:yC},mC={tokenize:_C},gC={tokenize:SC};function xC(e){let r=-1;const i=[];for(;++r<e.length;){const s=e[r][1];if(i.push(e[r]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const c=s.type==="labelImage"?4:2;s.type="data",r+=c}}return e.length!==i.length&&Dn(e,0,e.length,i),e}function vC(e,r){let i=e.length,s=0,c,d,p,l;for(;i--;)if(c=e[i][1],d){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;e[i][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(p){if(e[i][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(d=i,c.type!=="labelLink")){s=2;break}}else c.type==="labelEnd"&&(p=i);const h={type:e[d][1].type==="labelLink"?"link":"image",start:{...e[d][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[d][1].start},end:{...e[p][1].end}},g={type:"labelText",start:{...e[d+s+2][1].end},end:{...e[p-2][1].start}};return l=[["enter",h,r],["enter",f,r]],l=$n(l,e.slice(d+1,d+s+3)),l=$n(l,[["enter",g,r]]),l=$n(l,Il(r.parser.constructs.insideSpan.null,e.slice(d+s+4,p-3),r)),l=$n(l,[["exit",g,r],e[p-2],e[p-1],["exit",f,r]]),l=$n(l,e.slice(p+1)),l=$n(l,[["exit",h,r]]),Dn(e,d,e.length,l),e}function bC(e,r,i){const s=this;let c=s.events.length,d,p;for(;c--;)if((s.events[c][1].type==="labelImage"||s.events[c][1].type==="labelLink")&&!s.events[c][1]._balanced){d=s.events[c][1];break}return l;function l(b){return d?d._inactive?m(b):(p=s.parser.defined.includes(Kn(s.sliceSerialize({start:d.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),h):i(b)}function h(b){return b===40?e.attempt(pC,g,p?g:m)(b):b===91?e.attempt(mC,g,p?f:m)(b):p?g(b):m(b)}function f(b){return e.attempt(gC,g,m)(b)}function g(b){return r(b)}function m(b){return d._balanced=!0,i(b)}}function yC(e,r,i){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),c}function c(m){return yt(m)?Ba(e,d)(m):d(m)}function d(m){return m===41?g(m):Rb(e,p,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function p(m){return yt(m)?Ba(e,h)(m):g(m)}function l(m){return i(m)}function h(m){return m===34||m===39||m===40?Ob(e,f,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function f(m){return yt(m)?Ba(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 _C(e,r,i){const s=this;return c;function c(l){return Mb.call(s,e,d,p,"reference","referenceMarker","referenceString")(l)}function d(l){return s.parser.defined.includes(Kn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(l):i(l)}function p(l){return i(l)}}function SC(e,r,i){return s;function s(d){return e.enter("reference"),e.enter("referenceMarker"),e.consume(d),e.exit("referenceMarker"),c}function c(d){return d===93?(e.enter("referenceMarker"),e.consume(d),e.exit("referenceMarker"),e.exit("reference"),r):i(d)}}const wC={name:"labelStartImage",resolveAll:vh.resolveAll,tokenize:CC};function CC(e,r,i){const s=this;return c;function c(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),d}function d(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),p):i(l)}function p(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(l):r(l)}}const kC={name:"labelStartLink",resolveAll:vh.resolveAll,tokenize:EC};function EC(e,r,i){const s=this;return c;function c(p){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelLink"),d}function d(p){return p===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(p):r(p)}}const Sd={name:"lineEnding",tokenize:jC};function jC(e,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),rt(e,r,"linePrefix")}}const yl={name:"thematicBreak",tokenize:NC};function NC(e,r,i){let s=0,c;return d;function d(f){return e.enter("thematicBreak"),p(f)}function p(f){return c=f,l(f)}function l(f){return f===c?(e.enter("thematicBreakSequence"),h(f)):s>=3&&(f===null||Me(f))?(e.exit("thematicBreak"),r(f)):i(f)}function h(f){return f===c?(e.consume(f),s++,h):(e.exit("thematicBreakSequence"),Xe(f)?rt(e,l,"whitespace")(f):l(f))}}const vn={continuation:{tokenize:LC},exit:MC,name:"list",tokenize:DC},TC={partial:!0,tokenize:OC},AC={partial:!0,tokenize:RC};function DC(e,r,i){const s=this,c=s.events[s.events.length-1];let d=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,p=0;return l;function l(S){const E=s.containerState.type||(S===42||S===43||S===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!s.containerState.marker||S===s.containerState.marker:Gd(S)){if(s.containerState.type||(s.containerState.type=E,e.enter(E,{_container:!0})),E==="listUnordered")return e.enter("listItemPrefix"),S===42||S===45?e.check(yl,i,f)(S):f(S);if(!s.interrupt||S===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(S)}return i(S)}function h(S){return Gd(S)&&++p<10?(e.consume(S),h):(!s.interrupt||p<2)&&(s.containerState.marker?S===s.containerState.marker:S===41||S===46)?(e.exit("listItemValue"),f(S)):i(S)}function f(S){return e.enter("listItemMarker"),e.consume(S),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||S,e.check(Ya,s.interrupt?i:g,e.attempt(TC,b,m))}function g(S){return s.containerState.initialBlankLine=!0,d++,b(S)}function m(S){return Xe(S)?(e.enter("listItemPrefixWhitespace"),e.consume(S),e.exit("listItemPrefixWhitespace"),b):i(S)}function b(S){return s.containerState.size=d+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(S)}}function LC(e,r,i){const s=this;return s.containerState._closeFlow=void 0,e.check(Ya,c,d);function c(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,rt(e,r,"listItemIndent",s.containerState.size+1)(l)}function d(l){return s.containerState.furtherBlankLines||!Xe(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,p(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(AC,r,p)(l))}function p(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,rt(e,e.attempt(vn,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function RC(e,r,i){const s=this;return rt(e,c,"listItemIndent",s.containerState.size+1);function c(d){const p=s.events[s.events.length-1];return p&&p[1].type==="listItemIndent"&&p[2].sliceSerialize(p[1],!0).length===s.containerState.size?r(d):i(d)}}function MC(e){e.exit(this.containerState.type)}function OC(e,r,i){const s=this;return rt(e,c,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(d){const p=s.events[s.events.length-1];return!Xe(d)&&p&&p[1].type==="listItemPrefixWhitespace"?r(d):i(d)}}const ev={name:"setextUnderline",resolveTo:BC,tokenize:IC};function BC(e,r){let i=e.length,s,c,d;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){s=i;break}e[i][1].type==="paragraph"&&(c=i)}else e[i][1].type==="content"&&e.splice(i,1),!d&&e[i][1].type==="definition"&&(d=i);const p={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[c][1].type="setextHeadingText",d?(e.splice(c,0,["enter",p,r]),e.splice(d+1,0,["exit",e[s][1],r]),e[s][1].end={...e[d][1].end}):e[s][1]=p,e.push(["exit",p,r]),e}function IC(e,r,i){const s=this;let c;return d;function d(f){let g=s.events.length,m;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){m=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),c=f,p(f)):i(f)}function p(f){return e.enter("setextHeadingLineSequence"),l(f)}function l(f){return f===c?(e.consume(f),l):(e.exit("setextHeadingLineSequence"),Xe(f)?rt(e,h,"lineSuffix")(f):h(f))}function h(f){return f===null||Me(f)?(e.exit("setextHeadingLine"),r(f)):i(f)}}const zC={tokenize:HC};function HC(e){const r=this,i=e.attempt(Ya,s,e.attempt(this.parser.constructs.flowInitial,c,rt(e,e.attempt(this.parser.constructs.flow,c,e.attempt(q2,c)),"linePrefix")));return i;function s(d){if(d===null){e.consume(d);return}return e.enter("lineEndingBlank"),e.consume(d),e.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function c(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),r.currentConstruct=void 0,i}}const PC={resolveAll:Ib()},FC=Bb("string"),UC=Bb("text");function Bb(e){return{resolveAll:Ib(e==="text"?$C:void 0),tokenize:r};function r(i){const s=this,c=this.parser.constructs[e],d=i.attempt(c,p,l);return p;function p(g){return f(g)?d(g):l(g)}function l(g){if(g===null){i.consume(g);return}return i.enter("data"),i.consume(g),h}function h(g){return f(g)?(i.exit("data"),d(g)):(i.consume(g),h)}function f(g){if(g===null)return!0;const m=c[g];let b=-1;if(m)for(;++b<m.length;){const S=m[b];if(!S.previous||S.previous.call(s,s.previous))return!0}return!1}}}function Ib(e){return r;function r(i,s){let c=-1,d;for(;++c<=i.length;)d===void 0?i[c]&&i[c][1].type==="data"&&(d=c,c++):(!i[c]||i[c][1].type!=="data")&&(c!==d+2&&(i[d][1].end=i[c-1][1].end,i.splice(d+2,c-d-2),c=d+2),d=void 0);return e?e(i,s):i}}function $C(e,r){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const s=e[i-1][1],c=r.sliceStream(s);let d=c.length,p=-1,l=0,h;for(;d--;){const f=c[d];if(typeof f=="string"){for(p=f.length;f.charCodeAt(p-1)===32;)l++,p--;if(p)break;p=-1}else if(f===-2)h=!0,l++;else if(f!==-1){d++;break}}if(r._contentTypeTextTrailing&&i===e.length&&(l=0),l){const f={type:i===e.length||h||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:d?p:s.start._bufferIndex+p,_index:s.start._index+d,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...f.start},s.start.offset===s.end.offset?Object.assign(s,f):(e.splice(i,0,["enter",f,r],["exit",f,r]),i+=2)}i++}return e}const qC={42:vn,43:vn,45:vn,48:vn,49:vn,50:vn,51:vn,52:vn,53:vn,54:vn,55:vn,56:vn,57:vn,62:Tb},WC={91:K2},GC={[-2]:_d,[-1]:_d,32:_d},VC={35:tC,42:yl,45:[ev,yl],60:sC,61:ev,95:yl,96:Qx,126:Qx},YC={38:Db,92:Ab},KC={[-5]:Sd,[-4]:Sd,[-3]:Sd,33:wC,38:Db,42:Vd,60:[k2,hC],91:kC,92:[J2,Ab],93:vh,95:Vd,96:z2},XC={null:[Vd,PC]},ZC={null:[42,95]},QC={null:[]},JC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ZC,contentInitial:WC,disable:QC,document:qC,flow:VC,flowInitial:GC,insideSpan:XC,string:YC,text:KC},Symbol.toStringTag,{value:"Module"}));function ek(e,r,i){let s={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const c={},d=[];let p=[],l=[];const h={attempt:L(A),check:L(N),consume:v,enter:y,exit:j,interrupt:L(N,{interrupt:!0})},f={code:null,containerState:{},defineSkip:C,events:[],now:E,parser:e,previous:null,sliceSerialize:b,sliceStream:S,write:m};let g=r.tokenize.call(f,h);return r.resolveAll&&d.push(r),f;function m(W){return p=$n(p,W),x(),p[p.length-1]!==null?[]:(T(r,0),f.events=Il(d,f.events,f),f.events)}function b(W,Y){return nk(S(W),Y)}function S(W){return tk(p,W)}function E(){const{_bufferIndex:W,_index:Y,line:$,column:I,offset:P}=s;return{_bufferIndex:W,_index:Y,line:$,column:I,offset:P}}function C(W){c[W.line]=W.column,H()}function x(){let W;for(;s._index<p.length;){const Y=p[s._index];if(typeof Y=="string")for(W=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===W&&s._bufferIndex<Y.length;)_(Y.charCodeAt(s._bufferIndex));else _(Y)}}function _(W){g=g(W)}function v(W){Me(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===p[s._index].length&&(s._bufferIndex=-1,s._index++)),f.previous=W}function y(W,Y){const $=Y||{};return $.type=W,$.start=E(),f.events.push(["enter",$,f]),l.push($),$}function j(W){const Y=l.pop();return Y.end=E(),f.events.push(["exit",Y,f]),Y}function A(W,Y){T(W,Y.from)}function N(W,Y){Y.restore()}function L(W,Y){return $;function $(I,P,V){let Z,ee,R,D;return Array.isArray(I)?q(I):"tokenize"in I?q([I]):O(I);function O(Q){return X;function X(z){const ae=z!==null&&Q[z],se=z!==null&&Q.null,ge=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(se)?se:se?[se]:[]];return q(ge)(z)}}function q(Q){return Z=Q,ee=0,Q.length===0?V:F(Q[ee])}function F(Q){return X;function X(z){return D=B(),R=Q,Q.partial||(f.currentConstruct=Q),Q.name&&f.parser.constructs.disable.null.includes(Q.name)?te():Q.tokenize.call(Y?Object.assign(Object.create(f),Y):f,h,K,te)(z)}}function K(Q){return W(R,D),P}function te(Q){return D.restore(),++ee<Z.length?F(Z[ee]):V}}}function T(W,Y){W.resolveAll&&!d.includes(W)&&d.push(W),W.resolve&&Dn(f.events,Y,f.events.length-Y,W.resolve(f.events.slice(Y),f)),W.resolveTo&&(f.events=W.resolveTo(f.events,f))}function B(){const W=E(),Y=f.previous,$=f.currentConstruct,I=f.events.length,P=Array.from(l);return{from:I,restore:V};function V(){s=W,f.previous=Y,f.currentConstruct=$,f.events.length=I,l=P,H()}}function H(){s.line in c&&s.column<2&&(s.column=c[s.line],s.offset+=c[s.line]-1)}}function tk(e,r){const i=r.start._index,s=r.start._bufferIndex,c=r.end._index,d=r.end._bufferIndex;let p;if(i===c)p=[e[i].slice(s,d)];else{if(p=e.slice(i,c),s>-1){const l=p[0];typeof l=="string"?p[0]=l.slice(s):p.shift()}d>0&&p.push(e[c].slice(0,d))}return p}function nk(e,r){let i=-1;const s=[];let c;for(;++i<e.length;){const d=e[i];let p;if(typeof d=="string")p=d;else switch(d){case-5:{p="\r";break}case-4:{p=`
|
|
92
|
-
`;break}case-3:{p=`\r
|
|
93
|
-
`;break}case-2:{p=r?" ":" ";break}case-1:{if(!r&&c)continue;p=" ";break}default:p=String.fromCharCode(d)}c=d===-2,s.push(p)}return s.join("")}function rk(e){const s={constructs:jb([JC,...(e||{}).extensions||[]]),content:c(v2),defined:[],document:c(y2),flow:c(zC),lazy:{},string:c(FC),text:c(UC)};return s;function c(d){return p;function p(l){return ek(s,d,l)}}}function ik(e){for(;!Lb(e););return e}const tv=/[\0\t\n\r]/g;function sk(){let e=1,r="",i=!0,s;return c;function c(d,p,l){const h=[];let f,g,m,b,S;for(d=r+(typeof d=="string"?d.toString():new TextDecoder(p||void 0).decode(d)),m=0,r="",i&&(d.charCodeAt(0)===65279&&m++,i=void 0);m<d.length;){if(tv.lastIndex=m,f=tv.exec(d),b=f&&f.index!==void 0?f.index:d.length,S=d.charCodeAt(b),!f){r=d.slice(m);break}if(S===10&&m===b&&s)h.push(-3),s=void 0;else switch(s&&(h.push(-5),s=void 0),m<b&&(h.push(d.slice(m,b)),e+=b-m),S){case 0:{h.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,h.push(-2);e++<g;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:s=!0,e=1}m=b+1}return l&&(s&&h.push(-5),r&&h.push(r),h.push(null)),h}}const ak=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ok(e){return e.replace(ak,lk)}function lk(e,r,i){if(r)return r;if(i.charCodeAt(0)===35){const c=i.charCodeAt(1),d=c===120||c===88;return Nb(i.slice(d?2:1),d?16:10)}return Fa(i)||e}const zb={}.hasOwnProperty;function ck(e,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),uk(i)(ik(rk(i).document().write(sk()(e,r,!0))))}function uk(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d(ht),autolinkProtocol:B,autolinkEmail:B,atxHeading:d(Oe),blockQuote:d(se),characterEscape:B,characterReference:B,codeFenced:d(ge),codeFencedFenceInfo:p,codeFencedFenceMeta:p,codeIndented:d(ge,p),codeText:d(ve,p),codeTextData:B,data:B,codeFlowValue:B,definition:d(Ne),definitionDestinationString:p,definitionLabelString:p,definitionTitleString:p,emphasis:d(De),hardBreakEscape:d(Fe),hardBreakTrailing:d(Fe),htmlFlow:d(ke,p),htmlFlowData:B,htmlText:d(ke,p),htmlTextData:B,image:d(lt),label:p,link:d(ht),listItem:d(Re),listItemValue:b,listOrdered:d(fe,m),listUnordered:d(fe),paragraph:d(Je),reference:F,referenceString:p,resourceDestinationString:p,resourceTitleString:p,setextHeading:d(Oe),strong:d(et),thematicBreak:d(ct)},exit:{atxHeading:h(),atxHeadingSequence:A,autolink:h(),autolinkEmail:ae,autolinkProtocol:z,blockQuote:h(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:Q,characterReference:X,codeFenced:h(x),codeFencedFence:C,codeFencedFenceInfo:S,codeFencedFenceMeta:E,codeFlowValue:H,codeIndented:h(_),codeText:h(P),codeTextData:H,data:H,definition:h(),definitionDestinationString:j,definitionLabelString:v,definitionTitleString:y,emphasis:h(),hardBreakEscape:h(Y),hardBreakTrailing:h(Y),htmlFlow:h($),htmlFlowData:H,htmlText:h(I),htmlTextData:H,image:h(Z),label:R,labelText:ee,lineEnding:W,link:h(V),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:K,resourceDestinationString:D,resourceTitleString:O,resource:q,setextHeading:h(T),setextHeadingLineSequence:L,setextHeadingText:N,strong:h(),thematicBreak:h()}};Hb(r,(e||{}).mdastExtensions||[]);const i={};return s;function s(de){let be={type:"root",children:[]};const re={stack:[be],tokenStack:[],config:r,enter:l,exit:f,buffer:p,resume:g,data:i},Se=[];let Ce=-1;for(;++Ce<de.length;)if(de[Ce][1].type==="listOrdered"||de[Ce][1].type==="listUnordered")if(de[Ce][0]==="enter")Se.push(Ce);else{const He=Se.pop();Ce=c(de,He,Ce)}for(Ce=-1;++Ce<de.length;){const He=r[de[Ce][0]];zb.call(He,de[Ce][1].type)&&He[de[Ce][1].type].call(Object.assign({sliceSerialize:de[Ce][2].sliceSerialize},re),de[Ce][1])}if(re.tokenStack.length>0){const He=re.tokenStack[re.tokenStack.length-1];(He[1]||nv).call(re,void 0,He[0])}for(be.position={start:Jr(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:Jr(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},Ce=-1;++Ce<r.transforms.length;)be=r.transforms[Ce](be)||be;return be}function c(de,be,re){let Se=be-1,Ce=-1,He=!1,Ae,st,it,Ct;for(;++Se<=re;){const $e=de[Se];switch($e[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{$e[0]==="enter"?Ce++:Ce--,Ct=void 0;break}case"lineEndingBlank":{$e[0]==="enter"&&(Ae&&!Ct&&!Ce&&!it&&(it=Se),Ct=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ct=void 0}if(!Ce&&$e[0]==="enter"&&$e[1].type==="listItemPrefix"||Ce===-1&&$e[0]==="exit"&&($e[1].type==="listUnordered"||$e[1].type==="listOrdered")){if(Ae){let Ln=Se;for(st=void 0;Ln--;){const pe=de[Ln];if(pe[1].type==="lineEnding"||pe[1].type==="lineEndingBlank"){if(pe[0]==="exit")continue;st&&(de[st][1].type="lineEndingBlank",He=!0),pe[1].type="lineEnding",st=Ln}else if(!(pe[1].type==="linePrefix"||pe[1].type==="blockQuotePrefix"||pe[1].type==="blockQuotePrefixWhitespace"||pe[1].type==="blockQuoteMarker"||pe[1].type==="listItemIndent"))break}it&&(!st||it<st)&&(Ae._spread=!0),Ae.end=Object.assign({},st?de[st][1].start:$e[1].end),de.splice(st||Se,0,["exit",Ae,$e[2]]),Se++,re++}if($e[1].type==="listItemPrefix"){const Ln={type:"listItem",_spread:!1,start:Object.assign({},$e[1].start),end:void 0};Ae=Ln,de.splice(Se,0,["enter",Ln,$e[2]]),Se++,re++,it=void 0,Ct=!0}}}return de[be][1]._spread=He,re}function d(de,be){return re;function re(Se){l.call(this,de(Se),Se),be&&be.call(this,Se)}}function p(){this.stack.push({type:"fragment",children:[]})}function l(de,be,re){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([be,re||void 0]),de.position={start:Jr(be.start),end:void 0}}function h(de){return be;function be(re){de&&de.call(this,re),f.call(this,re)}}function f(de,be){const re=this.stack.pop(),Se=this.tokenStack.pop();if(Se)Se[0].type!==de.type&&(be?be.call(this,de,Se[0]):(Se[1]||nv).call(this,de,Se[0]));else throw new Error("Cannot close `"+de.type+"` ("+Oa({start:de.start,end:de.end})+"): it’s not open");re.position.end=Jr(de.end)}function g(){return xh(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function b(de){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(de),10),this.data.expectingFirstListItemValue=void 0}}function S(){const de=this.resume(),be=this.stack[this.stack.length-1];be.lang=de}function E(){const de=this.resume(),be=this.stack[this.stack.length-1];be.meta=de}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de.replace(/(\r?\n|\r)$/g,"")}function v(de){const be=this.resume(),re=this.stack[this.stack.length-1];re.label=be,re.identifier=Kn(this.sliceSerialize(de)).toLowerCase()}function y(){const de=this.resume(),be=this.stack[this.stack.length-1];be.title=de}function j(){const de=this.resume(),be=this.stack[this.stack.length-1];be.url=de}function A(de){const be=this.stack[this.stack.length-1];if(!be.depth){const re=this.sliceSerialize(de).length;be.depth=re}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function L(de){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(de).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function B(de){const re=this.stack[this.stack.length-1].children;let Se=re[re.length-1];(!Se||Se.type!=="text")&&(Se=Ge(),Se.position={start:Jr(de.start),end:void 0},re.push(Se)),this.stack.push(Se)}function H(de){const be=this.stack.pop();be.value+=this.sliceSerialize(de),be.position.end=Jr(de.end)}function W(de){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const re=be.children[be.children.length-1];re.position.end=Jr(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(be.type)&&(B.call(this,de),H.call(this,de))}function Y(){this.data.atHardBreak=!0}function $(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de}function I(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de}function P(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de}function V(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=be,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function Z(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=be,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function ee(de){const be=this.sliceSerialize(de),re=this.stack[this.stack.length-2];re.label=ok(be),re.identifier=Kn(be).toLowerCase()}function R(){const de=this.stack[this.stack.length-1],be=this.resume(),re=this.stack[this.stack.length-1];if(this.data.inReference=!0,re.type==="link"){const Se=de.children;re.children=Se}else re.alt=be}function D(){const de=this.resume(),be=this.stack[this.stack.length-1];be.url=de}function O(){const de=this.resume(),be=this.stack[this.stack.length-1];be.title=de}function q(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function K(de){const be=this.resume(),re=this.stack[this.stack.length-1];re.label=be,re.identifier=Kn(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function te(de){this.data.characterReferenceType=de.type}function Q(de){const be=this.sliceSerialize(de),re=this.data.characterReferenceType;let Se;re?(Se=Nb(be,re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Se=Fa(be);const Ce=this.stack[this.stack.length-1];Ce.value+=Se}function X(de){const be=this.stack.pop();be.position.end=Jr(de.end)}function z(de){H.call(this,de);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(de)}function ae(de){H.call(this,de);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(de)}function se(){return{type:"blockquote",children:[]}}function ge(){return{type:"code",lang:null,meta:null,value:""}}function ve(){return{type:"inlineCode",value:""}}function Ne(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function Oe(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function ke(){return{type:"html",value:""}}function lt(){return{type:"image",title:null,url:"",alt:null}}function ht(){return{type:"link",title:null,url:"",children:[]}}function fe(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[]}}function Re(de){return{type:"listItem",spread:de._spread,checked:null,children:[]}}function Je(){return{type:"paragraph",children:[]}}function et(){return{type:"strong",children:[]}}function Ge(){return{type:"text",value:""}}function ct(){return{type:"thematicBreak"}}}function Jr(e){return{line:e.line,column:e.column,offset:e.offset}}function Hb(e,r){let i=-1;for(;++i<r.length;){const s=r[i];Array.isArray(s)?Hb(e,s):dk(e,s)}}function dk(e,r){let i;for(i in r)if(zb.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 nv(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Oa({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Oa({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Oa({start:r.start,end:r.end})+") is still open")}function hk(e){const r=this;r.parser=i;function i(s){return ck(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function fk(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 pk(e,r){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,i),[e.applyData(r,i),{type:"text",value:`
|
|
94
|
-
`}]}function mk(e,r){const i=r.value?r.value+`
|
|
95
|
-
`:"",s={},c=r.lang?r.lang.split(/\s+/):[];c.length>0&&(s.className=["language-"+c[0]]);let d={type:"element",tagName:"code",properties:s,children:[{type:"text",value:i}]};return r.meta&&(d.data={meta:r.meta}),e.patch(r,d),d=e.applyData(r,d),d={type:"element",tagName:"pre",properties:{},children:[d]},e.patch(r,d),d}function gk(e,r){const i={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function xk(e,r){const i={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function vk(e,r){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),c=As(s.toLowerCase()),d=e.footnoteOrder.indexOf(s);let p,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),p=e.footnoteOrder.length):p=d+1,l+=1,e.footnoteCounts.set(s,l);const h={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+c,id:i+"fnref-"+c+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(p)}]};e.patch(r,h);const f={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(r,f),e.applyData(r,f)}function bk(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 yk(e,r){if(e.options.allowDangerousHtml){const i={type:"raw",value:r.value};return e.patch(r,i),e.applyData(r,i)}}function Pb(e,r){const i=r.referenceType;let s="]";if(i==="collapsed"?s+="[]":i==="full"&&(s+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+s}];const c=e.all(r),d=c[0];d&&d.type==="text"?d.value="["+d.value:c.unshift({type:"text",value:"["});const p=c[c.length-1];return p&&p.type==="text"?p.value+=s:c.push({type:"text",value:s}),c}function _k(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return Pb(e,r);const c={src:As(s.url||""),alt:r.alt};s.title!==null&&s.title!==void 0&&(c.title=s.title);const d={type:"element",tagName:"img",properties:c,children:[]};return e.patch(r,d),e.applyData(r,d)}function Sk(e,r){const i={src:As(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 wk(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 Ck(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return Pb(e,r);const c={href:As(s.url||"")};s.title!==null&&s.title!==void 0&&(c.title=s.title);const d={type:"element",tagName:"a",properties:c,children:e.all(r)};return e.patch(r,d),e.applyData(r,d)}function kk(e,r){const i={href:As(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 Ek(e,r,i){const s=e.all(r),c=i?jk(i):Fb(r),d={},p=[];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:[]}),d.className=["task-list-item"]}let l=-1;for(;++l<s.length;){const g=s[l];(c||l!==0||g.type!=="element"||g.tagName!=="p")&&p.push({type:"text",value:`
|
|
96
|
-
`}),g.type==="element"&&g.tagName==="p"&&!c?p.push(...g.children):p.push(g)}const h=s[s.length-1];h&&(c||h.type!=="element"||h.tagName!=="p")&&p.push({type:"text",value:`
|
|
97
|
-
`});const f={type:"element",tagName:"li",properties:d,children:p};return e.patch(r,f),e.applyData(r,f)}function jk(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=Fb(i[s])}return r}function Fb(e){const r=e.spread;return r??e.children.length>1}function Nk(e,r){const i={},s=e.all(r);let c=-1;for(typeof r.start=="number"&&r.start!==1&&(i.start=r.start);++c<s.length;){const p=s[c];if(p.type==="element"&&p.tagName==="li"&&p.properties&&Array.isArray(p.properties.className)&&p.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const d={type:"element",tagName:r.ordered?"ol":"ul",properties:i,children:e.wrap(s,!0)};return e.patch(r,d),e.applyData(r,d)}function Tk(e,r){const i={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Ak(e,r){const i={type:"root",children:e.wrap(e.all(r))};return e.patch(r,i),e.applyData(r,i)}function Dk(e,r){const i={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Lk(e,r){const i=e.all(r),s=i.shift(),c=[];if(s){const p={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(r.children[0],p),c.push(p)}if(i.length>0){const p={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},l=fh(r.children[1]),h=yb(r.children[r.children.length-1]);l&&h&&(p.position={start:l,end:h}),c.push(p)}const d={type:"element",tagName:"table",properties:{},children:e.wrap(c,!0)};return e.patch(r,d),e.applyData(r,d)}function Rk(e,r,i){const s=i?i.children:void 0,d=(s?s.indexOf(r):1)===0?"th":"td",p=i&&i.type==="table"?i.align:void 0,l=p?p.length:r.children.length;let h=-1;const f=[];for(;++h<l;){const m=r.children[h],b={},S=p?p[h]:void 0;S&&(b.align=S);let E={type:"element",tagName:d,properties:b,children:[]};m&&(E.children=e.all(m),e.patch(m,E),E=e.applyData(m,E)),f.push(E)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(r,g),e.applyData(r,g)}function Mk(e,r){const i={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}const rv=9,iv=32;function Ok(e){const r=String(e),i=/\r?\n|\r/g;let s=i.exec(r),c=0;const d=[];for(;s;)d.push(sv(r.slice(c,s.index),c>0,!0),s[0]),c=s.index+s[0].length,s=i.exec(r);return d.push(sv(r.slice(c),c>0,!1)),d.join("")}function sv(e,r,i){let s=0,c=e.length;if(r){let d=e.codePointAt(s);for(;d===rv||d===iv;)s++,d=e.codePointAt(s)}if(i){let d=e.codePointAt(c-1);for(;d===rv||d===iv;)c--,d=e.codePointAt(c-1)}return c>s?e.slice(s,c):""}function Bk(e,r){const i={type:"text",value:Ok(String(r.value))};return e.patch(r,i),e.applyData(r,i)}function Ik(e,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,i),e.applyData(r,i)}const zk={blockquote:fk,break:pk,code:mk,delete:gk,emphasis:xk,footnoteReference:vk,heading:bk,html:yk,imageReference:_k,image:Sk,inlineCode:wk,linkReference:Ck,link:kk,listItem:Ek,list:Nk,paragraph:Tk,root:Ak,strong:Dk,table:Lk,tableCell:Mk,tableRow:Rk,text:Bk,thematicBreak:Ik,toml:hl,yaml:hl,definition:hl,footnoteDefinition:hl};function hl(){}const Ub=-1,zl=0,Ia=1,jl=2,bh=3,yh=4,_h=5,Sh=6,$b=7,qb=8,av=typeof self=="object"?self:globalThis,Hk=(e,r)=>{const i=(c,d)=>(e.set(d,c),c),s=c=>{if(e.has(c))return e.get(c);const[d,p]=r[c];switch(d){case zl:case Ub:return i(p,c);case Ia:{const l=i([],c);for(const h of p)l.push(s(h));return l}case jl:{const l=i({},c);for(const[h,f]of p)l[s(h)]=s(f);return l}case bh:return i(new Date(p),c);case yh:{const{source:l,flags:h}=p;return i(new RegExp(l,h),c)}case _h:{const l=i(new Map,c);for(const[h,f]of p)l.set(s(h),s(f));return l}case Sh:{const l=i(new Set,c);for(const h of p)l.add(s(h));return l}case $b:{const{name:l,message:h}=p;return i(new av[l](h),c)}case qb:return i(BigInt(p),c);case"BigInt":return i(Object(BigInt(p)),c);case"ArrayBuffer":return i(new Uint8Array(p).buffer,p);case"DataView":{const{buffer:l}=new Uint8Array(p);return i(new DataView(l),p)}}return i(new av[d](p),c)};return s},ov=e=>Hk(new Map,e)(0),vs="",{toString:Pk}={},{keys:Fk}=Object,La=e=>{const r=typeof e;if(r!=="object"||!e)return[zl,r];const i=Pk.call(e).slice(8,-1);switch(i){case"Array":return[Ia,vs];case"Object":return[jl,vs];case"Date":return[bh,vs];case"RegExp":return[yh,vs];case"Map":return[_h,vs];case"Set":return[Sh,vs];case"DataView":return[Ia,i]}return i.includes("Array")?[Ia,i]:i.includes("Error")?[$b,i]:[jl,i]},fl=([e,r])=>e===zl&&(r==="function"||r==="symbol"),Uk=(e,r,i,s)=>{const c=(p,l)=>{const h=s.push(p)-1;return i.set(l,h),h},d=p=>{if(i.has(p))return i.get(p);let[l,h]=La(p);switch(l){case zl:{let g=p;switch(h){case"bigint":l=qb,g=p.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);g=null;break;case"undefined":return c([Ub],p)}return c([l,g],p)}case Ia:{if(h){let b=p;return h==="DataView"?b=new Uint8Array(p.buffer):h==="ArrayBuffer"&&(b=new Uint8Array(p)),c([h,[...b]],p)}const g=[],m=c([l,g],p);for(const b of p)g.push(d(b));return m}case jl:{if(h)switch(h){case"BigInt":return c([h,p.toString()],p);case"Boolean":case"Number":case"String":return c([h,p.valueOf()],p)}if(r&&"toJSON"in p)return d(p.toJSON());const g=[],m=c([l,g],p);for(const b of Fk(p))(e||!fl(La(p[b])))&&g.push([d(b),d(p[b])]);return m}case bh:return c([l,p.toISOString()],p);case yh:{const{source:g,flags:m}=p;return c([l,{source:g,flags:m}],p)}case _h:{const g=[],m=c([l,g],p);for(const[b,S]of p)(e||!(fl(La(b))||fl(La(S))))&&g.push([d(b),d(S)]);return m}case Sh:{const g=[],m=c([l,g],p);for(const b of p)(e||!fl(La(b)))&&g.push(d(b));return m}}const{message:f}=p;return c([l,{name:h,message:f}],p)};return d},lv=(e,{json:r,lossy:i}={})=>{const s=[];return Uk(!(r||i),!!r,new Map,s)(e),s},Nl=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?ov(lv(e,r)):structuredClone(e):(e,r)=>ov(lv(e,r));function $k(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 qk(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function Wk(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||$k,s=e.options.footnoteBackLabel||qk,c=e.options.footnoteLabel||"Footnotes",d=e.options.footnoteLabelTagName||"h2",p=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let h=-1;for(;++h<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[h]);if(!f)continue;const g=e.all(f),m=String(f.identifier).toUpperCase(),b=As(m.toLowerCase());let S=0;const E=[],C=e.footnoteCounts.get(m);for(;C!==void 0&&++S<=C;){E.length>0&&E.push({type:"text",value:" "});let v=typeof i=="string"?i:i(h,S);typeof v=="string"&&(v={type:"text",value:v}),E.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+b+(S>1?"-"+S:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(h,S),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const x=g[g.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...E)}else g.push(...E);const _={type:"element",tagName:"li",properties:{id:r+"fn-"+b},children:e.wrap(g,!0)};e.patch(f,_),l.push(_)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:d,properties:{...Nl(p),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
|
|
98
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
99
|
-
`}]}}const Hl=(function(e){if(e==null)return Kk;if(typeof e=="function")return Pl(e);if(typeof e=="object")return Array.isArray(e)?Gk(e):Vk(e);if(typeof e=="string")return Yk(e);throw new Error("Expected function, string, or object as test")});function Gk(e){const r=[];let i=-1;for(;++i<e.length;)r[i]=Hl(e[i]);return Pl(s);function s(...c){let d=-1;for(;++d<r.length;)if(r[d].apply(this,c))return!0;return!1}}function Vk(e){const r=e;return Pl(i);function i(s){const c=s;let d;for(d in e)if(c[d]!==r[d])return!1;return!0}}function Yk(e){return Pl(r);function r(i){return i&&i.type===e}}function Pl(e){return r;function r(i,s,c){return!!(Xk(i)&&e.call(this,i,typeof s=="number"?s:void 0,c||void 0))}}function Kk(){return!0}function Xk(e){return e!==null&&typeof e=="object"&&"type"in e}const Wb=[],Zk=!0,Yd=!1,Qk="skip";function Gb(e,r,i,s){let c;typeof r=="function"&&typeof i!="function"?(s=i,i=r):c=r;const d=Hl(c),p=s?-1:1;l(e,void 0,[])();function l(h,f,g){const m=h&&typeof h=="object"?h:{};if(typeof m.type=="string"){const S=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(h.type+(S?"<"+S+">":""))+")"})}return b;function b(){let S=Wb,E,C,x;if((!r||d(h,f,g[g.length-1]||void 0))&&(S=Jk(i(h,g)),S[0]===Yd))return S;if("children"in h&&h.children){const _=h;if(_.children&&S[0]!==Qk)for(C=(s?_.children.length:-1)+p,x=g.concat(_);C>-1&&C<_.children.length;){const v=_.children[C];if(E=l(v,C,x)(),E[0]===Yd)return E;C=typeof E[1]=="number"?E[1]:C+p}}return S}}}function Jk(e){return Array.isArray(e)?e:typeof e=="number"?[Zk,e]:e==null?Wb:[e]}function wh(e,r,i,s){let c,d,p;typeof r=="function"&&typeof i!="function"?(d=void 0,p=r,c=i):(d=r,p=i,c=s),Gb(e,d,l,c);function l(h,f){const g=f[f.length-1],m=g?g.children.indexOf(h):void 0;return p(h,m,g)}}const Kd={}.hasOwnProperty,eE={};function tE(e,r){const i=r||eE,s=new Map,c=new Map,d=new Map,p={...zk,...i.handlers},l={all:f,applyData:rE,definitionById:s,footnoteById:c,footnoteCounts:d,footnoteOrder:[],handlers:p,one:h,options:i,patch:nE,wrap:sE};return wh(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?s:c,b=String(g.identifier).toUpperCase();m.has(b)||m.set(b,g)}}),l;function h(g,m){const b=g.type,S=l.handlers[b];if(Kd.call(l.handlers,b)&&S)return S(l,g,m);if(l.options.passThrough&&l.options.passThrough.includes(b)){if("children"in g){const{children:C,...x}=g,_=Nl(x);return _.children=l.all(g),_}return Nl(g)}return(l.options.unknownHandler||iE)(l,g,m)}function f(g){const m=[];if("children"in g){const b=g.children;let S=-1;for(;++S<b.length;){const E=l.one(b[S],g);if(E){if(S&&b[S-1].type==="break"&&(!Array.isArray(E)&&E.type==="text"&&(E.value=cv(E.value)),!Array.isArray(E)&&E.type==="element")){const C=E.children[0];C&&C.type==="text"&&(C.value=cv(C.value))}Array.isArray(E)?m.push(...E):m.push(E)}}}return m}}function nE(e,r){e.position&&(r.position=qw(e))}function rE(e,r){let i=r;if(e&&e.data){const s=e.data.hName,c=e.data.hChildren,d=e.data.hProperties;if(typeof s=="string")if(i.type==="element")i.tagName=s;else{const p="children"in i?i.children:[i];i={type:"element",tagName:s,properties:{},children:p}}i.type==="element"&&d&&Object.assign(i.properties,Nl(d)),"children"in i&&i.children&&c!==null&&c!==void 0&&(i.children=c)}return i}function iE(e,r){const i=r.data||{},s="value"in r&&!(Kd.call(i,"hProperties")||Kd.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 sE(e,r){const i=[];let s=-1;for(r&&i.push({type:"text",value:`
|
|
100
|
-
`});++s<e.length;)s&&i.push({type:"text",value:`
|
|
101
|
-
`}),i.push(e[s]);return r&&e.length>0&&i.push({type:"text",value:`
|
|
102
|
-
`}),i}function cv(e){let r=0,i=e.charCodeAt(r);for(;i===9||i===32;)r++,i=e.charCodeAt(r);return e.slice(r)}function uv(e,r){const i=tE(e,r),s=i.one(e,void 0),c=Wk(i),d=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return c&&d.children.push({type:"text",value:`
|
|
103
|
-
`},c),d}function aE(e,r){return e&&"run"in e?async function(i,s){const c=uv(i,{file:s,...r});await e.run(c,s)}:function(i,s){return uv(i,{file:s,...e||r})}}function dv(e){if(e)throw e}var wd,hv;function oE(){if(hv)return wd;hv=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=function(f){return typeof Array.isArray=="function"?Array.isArray(f):r.call(f)==="[object Array]"},d=function(f){if(!f||r.call(f)!=="[object Object]")return!1;var g=e.call(f,"constructor"),m=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!g&&!m)return!1;var b;for(b in f);return typeof b>"u"||e.call(f,b)},p=function(f,g){i&&g.name==="__proto__"?i(f,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):f[g.name]=g.newValue},l=function(f,g){if(g==="__proto__")if(e.call(f,g)){if(s)return s(f,g).value}else return;return f[g]};return wd=function h(){var f,g,m,b,S,E,C=arguments[0],x=1,_=arguments.length,v=!1;for(typeof C=="boolean"&&(v=C,C=arguments[1]||{},x=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});x<_;++x)if(f=arguments[x],f!=null)for(g in f)m=l(C,g),b=l(f,g),C!==b&&(v&&b&&(d(b)||(S=c(b)))?(S?(S=!1,E=m&&c(m)?m:[]):E=m&&d(m)?m:{},p(C,{name:g,newValue:h(v,E,b)})):typeof b<"u"&&p(C,{name:g,newValue:b}));return C},wd}var lE=oE();const Cd=Dl(lE);function Xd(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 cE(){const e=[],r={run:i,use:s};return r;function i(...c){let d=-1;const p=c.pop();if(typeof p!="function")throw new TypeError("Expected function as last argument, not "+p);l(null,...c);function l(h,...f){const g=e[++d];let m=-1;if(h){p(h);return}for(;++m<c.length;)(f[m]===null||f[m]===void 0)&&(f[m]=c[m]);c=f,g?uE(g,l)(...f):p(null,...f)}}function s(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return e.push(c),r}}function uE(e,r){let i;return s;function s(...p){const l=e.length>p.length;let h;l&&p.push(c);try{h=e.apply(this,p)}catch(f){const g=f;if(l&&i)throw g;return c(g)}l||(h&&h.then&&typeof h.then=="function"?h.then(d,c):h instanceof Error?c(h):d(h))}function c(p,...l){i||(i=!0,r(p,...l))}function d(p){c(null,p)}}const tr={basename:dE,dirname:hE,extname:fE,join:pE,sep:"/"};function dE(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Ka(e);let i=0,s=-1,c=e.length,d;if(r===void 0||r.length===0||r.length>e.length){for(;c--;)if(e.codePointAt(c)===47){if(d){i=c+1;break}}else s<0&&(d=!0,s=c+1);return s<0?"":e.slice(i,s)}if(r===e)return"";let p=-1,l=r.length-1;for(;c--;)if(e.codePointAt(c)===47){if(d){i=c+1;break}}else p<0&&(d=!0,p=c+1),l>-1&&(e.codePointAt(c)===r.codePointAt(l--)?l<0&&(s=c):(l=-1,s=p));return i===s?s=p:s<0&&(s=e.length),e.slice(i,s)}function hE(e){if(Ka(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 fE(e){Ka(e);let r=e.length,i=-1,s=0,c=-1,d=0,p;for(;r--;){const l=e.codePointAt(r);if(l===47){if(p){s=r+1;break}continue}i<0&&(p=!0,i=r+1),l===46?c<0?c=r:d!==1&&(d=1):c>-1&&(d=-1)}return c<0||i<0||d===0||d===1&&c===i-1&&c===s+1?"":e.slice(c,i)}function pE(...e){let r=-1,i;for(;++r<e.length;)Ka(e[r]),e[r]&&(i=i===void 0?e[r]:i+"/"+e[r]);return i===void 0?".":mE(i)}function mE(e){Ka(e);const r=e.codePointAt(0)===47;let i=gE(e,!r);return i.length===0&&!r&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),r?"/"+i:i}function gE(e,r){let i="",s=0,c=-1,d=0,p=-1,l,h;for(;++p<=e.length;){if(p<e.length)l=e.codePointAt(p);else{if(l===47)break;l=47}if(l===47){if(!(c===p-1||d===1))if(c!==p-1&&d===2){if(i.length<2||s!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(h=i.lastIndexOf("/"),h!==i.length-1){h<0?(i="",s=0):(i=i.slice(0,h),s=i.length-1-i.lastIndexOf("/")),c=p,d=0;continue}}else if(i.length>0){i="",s=0,c=p,d=0;continue}}r&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(c+1,p):i=e.slice(c+1,p),s=p-c-1;c=p,d=0}else l===46&&d>-1?d++:d=-1}return i}function Ka(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const xE={cwd:vE};function vE(){return"/"}function Zd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function bE(e){if(typeof e=="string")e=new URL(e);else if(!Zd(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 yE(e)}function yE(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const r=e.pathname;let i=-1;for(;++i<r.length;)if(r.codePointAt(i)===37&&r.codePointAt(i+1)===50){const s=r.codePointAt(i+2);if(s===70||s===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(r)}const kd=["history","path","basename","stem","extname","dirname"];class Vb{constructor(r){let i;r?Zd(r)?i={path:r}:typeof r=="string"||_E(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":xE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<kd.length;){const d=kd[s];d in i&&i[d]!==void 0&&i[d]!==null&&(this[d]=d==="history"?[...i[d]]:i[d])}let c;for(c in i)kd.includes(c)||(this[c]=i[c])}get basename(){return typeof this.path=="string"?tr.basename(this.path):void 0}set basename(r){jd(r,"basename"),Ed(r,"basename"),this.path=tr.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?tr.dirname(this.path):void 0}set dirname(r){fv(this.basename,"dirname"),this.path=tr.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?tr.extname(this.path):void 0}set extname(r){if(Ed(r,"extname"),fv(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=tr.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){Zd(r)&&(r=bE(r)),jd(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?tr.basename(this.path,this.extname):void 0}set stem(r){jd(r,"stem"),Ed(r,"stem"),this.path=tr.join(this.dirname||"",r+(this.extname||""))}fail(r,i,s){const c=this.message(r,i,s);throw c.fatal=!0,c}info(r,i,s){const c=this.message(r,i,s);return c.fatal=void 0,c}message(r,i,s){const c=new an(r,i,s);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function Ed(e,r){if(e&&e.includes(tr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+tr.sep+"`")}function jd(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function fv(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function _E(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const SE=(function(e){const s=this.constructor.prototype,c=s[e],d=function(){return c.apply(d,arguments)};return Object.setPrototypeOf(d,s),d}),wE={}.hasOwnProperty;class Ch extends SE{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=cE()}copy(){const r=new Ch;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data(Cd(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(Ad("data",this.frozen),this.namespace[r]=i,this):wE.call(this.namespace,r)&&this.namespace[r]||void 0:r?(Ad("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const c=i.call(r,...s);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const i=pl(r),s=this.parser||this.Parser;return Nd("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),Nd("process",this.parser||this.Parser),Td("process",this.compiler||this.Compiler),i?c(void 0,i):new Promise(c);function c(d,p){const l=pl(r),h=s.parse(l);s.run(h,l,function(g,m,b){if(g||!m||!b)return f(g);const S=m,E=s.stringify(S,b);EE(E)?b.value=E:b.result=E,f(g,b)});function f(g,m){g||!m?p(g):d?d(m):i(void 0,m)}}}processSync(r){let i=!1,s;return this.freeze(),Nd("processSync",this.parser||this.Parser),Td("processSync",this.compiler||this.Compiler),this.process(r,c),mv("processSync","process",i),s;function c(d,p){i=!0,dv(d),s=p}}run(r,i,s){pv(r),this.freeze();const c=this.transformers;return!s&&typeof i=="function"&&(s=i,i=void 0),s?d(void 0,s):new Promise(d);function d(p,l){const h=pl(i);c.run(r,h,f);function f(g,m,b){const S=m||r;g?l(g):p?p(S):s(void 0,S,b)}}}runSync(r,i){let s=!1,c;return this.run(r,i,d),mv("runSync","run",s),c;function d(p,l){dv(p),c=l,s=!0}}stringify(r,i){this.freeze();const s=pl(i),c=this.compiler||this.Compiler;return Td("stringify",c),pv(r),c(r,s)}use(r,...i){const s=this.attachers,c=this.namespace;if(Ad("use",this.frozen),r!=null)if(typeof r=="function")h(r,i);else if(typeof r=="object")Array.isArray(r)?l(r):p(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function d(f){if(typeof f=="function")h(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[g,...m]=f;h(g,m)}else p(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function p(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(f.plugins),f.settings&&(c.settings=Cd(!0,c.settings,f.settings))}function l(f){let g=-1;if(f!=null)if(Array.isArray(f))for(;++g<f.length;){const m=f[g];d(m)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function h(f,g){let m=-1,b=-1;for(;++m<s.length;)if(s[m][0]===f){b=m;break}if(b===-1)s.push([f,...g]);else if(g.length>0){let[S,...E]=g;const C=s[b][1];Xd(C)&&Xd(S)&&(S=Cd(!0,C,S)),s[b]=[f,S,...E]}}}}const CE=new Ch().freeze();function Nd(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Td(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ad(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 pv(e){if(!Xd(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 pl(e){return kE(e)?e:new Vb(e)}function kE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function EE(e){return typeof e=="string"||jE(e)}function jE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const NE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",gv=[],xv={allowDangerousHtml:!0},TE=/^(https?|ircs?|mailto|xmpp)$/i,AE=[{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 DE(e){const r=LE(e),i=RE(e);return ME(r.runSync(r.parse(i),i),e)}function LE(e){const r=e.rehypePlugins||gv,i=e.remarkPlugins||gv,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...xv}:xv;return CE().use(hk).use(i).use(aE,s).use(r)}function RE(e){const r=e.children||"",i=new Vb;return typeof r=="string"&&(i.value=r),i}function ME(e,r){const i=r.allowedElements,s=r.allowElement,c=r.components,d=r.disallowedElements,p=r.skipHtml,l=r.unwrapDisallowed,h=r.urlTransform||OE;for(const g of AE)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+NE+g.id,void 0);return wh(e,f),Kw(e,{Fragment:o.Fragment,components:c,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function f(g,m,b){if(g.type==="raw"&&b&&typeof m=="number")return p?b.children.splice(m,1):b.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let S;for(S in yd)if(Object.hasOwn(yd,S)&&Object.hasOwn(g.properties,S)){const E=g.properties[S],C=yd[S];(C===null||C.includes(g.tagName))&&(g.properties[S]=h(String(E||""),S,g))}}if(g.type==="element"){let S=i?!i.includes(g.tagName):d?d.includes(g.tagName):!1;if(!S&&s&&typeof m=="number"&&(S=!s(g,m,b)),S&&b&&typeof m=="number")return l&&g.children?b.children.splice(m,1,...g.children):b.children.splice(m,1),m}}}function OE(e){const r=e.indexOf(":"),i=e.indexOf("?"),s=e.indexOf("#"),c=e.indexOf("/");return r===-1||c!==-1&&r>c||i!==-1&&r>i||s!==-1&&r>s||TE.test(e.slice(0,r))?e:""}function vv(e,r){const i=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,c=i.indexOf(r);for(;c!==-1;)s++,c=i.indexOf(r,c+r.length);return s}function BE(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function IE(e,r,i){const c=Hl((i||{}).ignore||[]),d=zE(r);let p=-1;for(;++p<d.length;)Gb(e,"text",l);function l(f,g){let m=-1,b;for(;++m<g.length;){const S=g[m],E=b?b.children:void 0;if(c(S,E?E.indexOf(S):void 0,b))return;b=S}if(b)return h(f,g)}function h(f,g){const m=g[g.length-1],b=d[p][0],S=d[p][1];let E=0;const x=m.children.indexOf(f);let _=!1,v=[];b.lastIndex=0;let y=b.exec(f.value);for(;y;){const j=y.index,A={index:y.index,input:y.input,stack:[...g,f]};let N=S(...y,A);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?b.lastIndex=j+1:(E!==j&&v.push({type:"text",value:f.value.slice(E,j)}),Array.isArray(N)?v.push(...N):N&&v.push(N),E=j+y[0].length,_=!0),!b.global)break;y=b.exec(f.value)}return _?(E<f.value.length&&v.push({type:"text",value:f.value.slice(E)}),m.children.splice(x,1,...v)):v=[f],x+v.length}}function zE(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<i.length;){const c=i[s];r.push([HE(c[0]),PE(c[1])])}return r}function HE(e){return typeof e=="string"?new RegExp(BE(e),"g"):e}function PE(e){return typeof e=="function"?e:function(){return e}}const Dd="phrasing",Ld=["autolink","link","image","label"];function FE(){return{transforms:[YE],enter:{literalAutolink:$E,literalAutolinkEmail:Rd,literalAutolinkHttp:Rd,literalAutolinkWww:Rd},exit:{literalAutolink:VE,literalAutolinkEmail:GE,literalAutolinkHttp:qE,literalAutolinkWww:WE}}}function UE(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Dd,notInConstruct:Ld},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Dd,notInConstruct:Ld},{character:":",before:"[ps]",after:"\\/",inConstruct:Dd,notInConstruct:Ld}]}}function $E(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Rd(e){this.config.enter.autolinkProtocol.call(this,e)}function qE(e){this.config.exit.autolinkProtocol.call(this,e)}function WE(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 GE(e){this.config.exit.autolinkEmail.call(this,e)}function VE(e){this.exit(e)}function YE(e){IE(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,KE],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),XE]],{ignore:["link","linkReference"]})}function KE(e,r,i,s,c){let d="";if(!Yb(c)||(/^w/i.test(r)&&(i=r+i,r="",d="http://"),!ZE(i)))return!1;const p=QE(i+s);if(!p[0])return!1;const l={type:"link",title:null,url:d+r+p[0],children:[{type:"text",value:r+p[0]}]};return p[1]?[l,{type:"text",value:p[1]}]:l}function XE(e,r,i,s){return!Yb(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function ZE(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 QE(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let i=r[0],s=i.indexOf(")");const c=vv(e,"(");let d=vv(e,")");for(;s!==-1&&c>d;)e+=i.slice(0,s+1),i=i.slice(s+1),s=i.indexOf(")"),d++;return[e,i]}function Yb(e,r){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Ti(i)||Bl(i))&&(!r||i!==47)}Kb.peek=oj;function JE(){this.buffer()}function ej(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function tj(){this.buffer()}function nj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function rj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Kn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function ij(e){this.exit(e)}function sj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Kn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function aj(e){this.exit(e)}function oj(){return"["}function Kb(e,r,i,s){const c=i.createTracker(s);let d=c.move("[^");const p=i.enter("footnoteReference"),l=i.enter("reference");return d+=c.move(i.safe(i.associationId(e),{after:"]",before:d})),l(),p(),d+=c.move("]"),d}function lj(){return{enter:{gfmFootnoteCallString:JE,gfmFootnoteCall:ej,gfmFootnoteDefinitionLabelString:tj,gfmFootnoteDefinition:nj},exit:{gfmFootnoteCallString:rj,gfmFootnoteCall:ij,gfmFootnoteDefinitionLabelString:sj,gfmFootnoteDefinition:aj}}}function cj(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:Kb},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(s,c,d,p){const l=d.createTracker(p);let h=l.move("[^");const f=d.enter("footnoteDefinition"),g=d.enter("label");return h+=l.move(d.safe(d.associationId(s),{before:h,after:"]"})),g(),h+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),h+=l.move((r?`
|
|
104
|
-
`:" ")+d.indentLines(d.containerFlow(s,l.current()),r?Xb:uj))),f(),h}}function uj(e,r,i){return r===0?e:Xb(e,r,i)}function Xb(e,r,i){return(i?"":" ")+e}const dj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Zb.peek=gj;function hj(){return{canContainEols:["delete"],enter:{strikethrough:pj},exit:{strikethrough:mj}}}function fj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:dj}],handlers:{delete:Zb}}}function pj(e){this.enter({type:"delete",children:[]},e)}function mj(e){this.exit(e)}function Zb(e,r,i,s){const c=i.createTracker(s),d=i.enter("strikethrough");let p=c.move("~~");return p+=i.containerPhrasing(e,{...c.current(),before:p,after:"~"}),p+=c.move("~~"),d(),p}function gj(){return"~"}function xj(e){return e.length}function vj(e,r){const i=r||{},s=(i.align||[]).concat(),c=i.stringLength||xj,d=[],p=[],l=[],h=[];let f=0,g=-1;for(;++g<e.length;){const C=[],x=[];let _=-1;for(e[g].length>f&&(f=e[g].length);++_<e[g].length;){const v=bj(e[g][_]);if(i.alignDelimiters!==!1){const y=c(v);x[_]=y,(h[_]===void 0||y>h[_])&&(h[_]=y)}C.push(v)}p[g]=C,l[g]=x}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<f;)d[m]=bv(s[m]);else{const C=bv(s);for(;++m<f;)d[m]=C}m=-1;const b=[],S=[];for(;++m<f;){const C=d[m];let x="",_="";C===99?(x=":",_=":"):C===108?x=":":C===114&&(_=":");let v=i.alignDelimiters===!1?1:Math.max(1,h[m]-x.length-_.length);const y=x+"-".repeat(v)+_;i.alignDelimiters!==!1&&(v=x.length+v+_.length,v>h[m]&&(h[m]=v),S[m]=v),b[m]=y}p.splice(1,0,b),l.splice(1,0,S),g=-1;const E=[];for(;++g<p.length;){const C=p[g],x=l[g];m=-1;const _=[];for(;++m<f;){const v=C[m]||"";let y="",j="";if(i.alignDelimiters!==!1){const A=h[m]-(x[m]||0),N=d[m];N===114?y=" ".repeat(A):N===99?A%2?(y=" ".repeat(A/2+.5),j=" ".repeat(A/2-.5)):(y=" ".repeat(A/2),j=y):j=" ".repeat(A)}i.delimiterStart!==!1&&!m&&_.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&v==="")&&(i.delimiterStart!==!1||m)&&_.push(" "),i.alignDelimiters!==!1&&_.push(y),_.push(v),i.alignDelimiters!==!1&&_.push(j),i.padding!==!1&&_.push(" "),(i.delimiterEnd!==!1||m!==f-1)&&_.push("|")}E.push(i.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return E.join(`
|
|
105
|
-
`)}function bj(e){return e==null?"":String(e)}function bv(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 yj(e,r,i,s){const c=i.enter("blockquote"),d=i.createTracker(s);d.move("> "),d.shift(2);const p=i.indentLines(i.containerFlow(e,d.current()),_j);return c(),p}function _j(e,r,i){return">"+(i?"":" ")+e}function Sj(e,r){return yv(e,r.inConstruct,!0)&&!yv(e,r.notInConstruct,!1)}function yv(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 _v(e,r,i,s){let c=-1;for(;++c<i.unsafe.length;)if(i.unsafe[c].character===`
|
|
106
|
-
`&&Sj(i.stack,i.unsafe[c]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
107
|
-
`}function wj(e,r){const i=String(e);let s=i.indexOf(r),c=s,d=0,p=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===c?++d>p&&(p=d):d=1,c=s+r.length,s=i.indexOf(r,c);return p}function Cj(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 kj(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 Ej(e,r,i,s){const c=kj(i),d=e.value||"",p=c==="`"?"GraveAccent":"Tilde";if(Cj(e,i)){const m=i.enter("codeIndented"),b=i.indentLines(d,jj);return m(),b}const l=i.createTracker(s),h=c.repeat(Math.max(wj(d,c)+1,3)),f=i.enter("codeFenced");let g=l.move(h);if(e.lang){const m=i.enter(`codeFencedLang${p}`);g+=l.move(i.safe(e.lang,{before:g,after:" ",encode:["`"],...l.current()})),m()}if(e.lang&&e.meta){const m=i.enter(`codeFencedMeta${p}`);g+=l.move(" "),g+=l.move(i.safe(e.meta,{before:g,after:`
|
|
108
|
-
`,encode:["`"],...l.current()})),m()}return g+=l.move(`
|
|
109
|
-
`),d&&(g+=l.move(d+`
|
|
110
|
-
`)),g+=l.move(h),f(),g}function jj(e,r,i){return(i?"":" ")+e}function kh(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 Nj(e,r,i,s){const c=kh(i),d=c==='"'?"Quote":"Apostrophe",p=i.enter("definition");let l=i.enter("label");const h=i.createTracker(s);let f=h.move("[");return f+=h.move(i.safe(i.associationId(e),{before:f,after:"]",...h.current()})),f+=h.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=i.enter("destinationLiteral"),f+=h.move("<"),f+=h.move(i.safe(e.url,{before:f,after:">",...h.current()})),f+=h.move(">")):(l=i.enter("destinationRaw"),f+=h.move(i.safe(e.url,{before:f,after:e.title?" ":`
|
|
111
|
-
`,...h.current()}))),l(),e.title&&(l=i.enter(`title${d}`),f+=h.move(" "+c),f+=h.move(i.safe(e.title,{before:f,after:c,...h.current()})),f+=h.move(c),l()),p(),f}function Tj(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 Ua(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Tl(e,r,i){const s=js(e),c=js(r);return s===void 0?c===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Qb.peek=Aj;function Qb(e,r,i,s){const c=Tj(i),d=i.enter("emphasis"),p=i.createTracker(s),l=p.move(c);let h=p.move(i.containerPhrasing(e,{after:c,before:l,...p.current()}));const f=h.charCodeAt(0),g=Tl(s.before.charCodeAt(s.before.length-1),f,c);g.inside&&(h=Ua(f)+h.slice(1));const m=h.charCodeAt(h.length-1),b=Tl(s.after.charCodeAt(0),m,c);b.inside&&(h=h.slice(0,-1)+Ua(m));const S=p.move(c);return d(),i.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},l+h+S}function Aj(e,r,i){return i.options.emphasis||"*"}function Dj(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,Yd}),!!((!e.depth||e.depth<3)&&xh(e)&&(r.options.setext||i))}function Lj(e,r,i,s){const c=Math.max(Math.min(6,e.depth||1),1),d=i.createTracker(s);if(Dj(e,i)){const g=i.enter("headingSetext"),m=i.enter("phrasing"),b=i.containerPhrasing(e,{...d.current(),before:`
|
|
112
|
-
`,after:`
|
|
113
|
-
`});return m(),g(),b+`
|
|
114
|
-
`+(c===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
115
|
-
`))+1))}const p="#".repeat(c),l=i.enter("headingAtx"),h=i.enter("phrasing");d.move(p+" ");let f=i.containerPhrasing(e,{before:"# ",after:`
|
|
116
|
-
`,...d.current()});return/^[\t ]/.test(f)&&(f=Ua(f.charCodeAt(0))+f.slice(1)),f=f?p+" "+f:p,i.options.closeAtx&&(f+=" "+p),h(),l(),f}Jb.peek=Rj;function Jb(e){return e.value||""}function Rj(){return"<"}e0.peek=Mj;function e0(e,r,i,s){const c=kh(i),d=c==='"'?"Quote":"Apostrophe",p=i.enter("image");let l=i.enter("label");const h=i.createTracker(s);let f=h.move("![");return f+=h.move(i.safe(e.alt,{before:f,after:"]",...h.current()})),f+=h.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=i.enter("destinationLiteral"),f+=h.move("<"),f+=h.move(i.safe(e.url,{before:f,after:">",...h.current()})),f+=h.move(">")):(l=i.enter("destinationRaw"),f+=h.move(i.safe(e.url,{before:f,after:e.title?" ":")",...h.current()}))),l(),e.title&&(l=i.enter(`title${d}`),f+=h.move(" "+c),f+=h.move(i.safe(e.title,{before:f,after:c,...h.current()})),f+=h.move(c),l()),f+=h.move(")"),p(),f}function Mj(){return"!"}t0.peek=Oj;function t0(e,r,i,s){const c=e.referenceType,d=i.enter("imageReference");let p=i.enter("label");const l=i.createTracker(s);let h=l.move("![");const f=i.safe(e.alt,{before:h,after:"]",...l.current()});h+=l.move(f+"]["),p();const g=i.stack;i.stack=[],p=i.enter("reference");const m=i.safe(i.associationId(e),{before:h,after:"]",...l.current()});return p(),i.stack=g,d(),c==="full"||!f||f!==m?h+=l.move(m+"]"):c==="shortcut"?h=h.slice(0,-1):h+=l.move("]"),h}function Oj(){return"!"}n0.peek=Bj;function n0(e,r,i){let s=e.value||"",c="`",d=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(s);)c+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++d<i.unsafe.length;){const p=i.unsafe[d],l=i.compilePattern(p);let h;if(p.atBreak)for(;h=l.exec(s);){let f=h.index;s.charCodeAt(f)===10&&s.charCodeAt(f-1)===13&&f--,s=s.slice(0,f)+" "+s.slice(h.index+1)}}return c+s+c}function Bj(){return"`"}function r0(e,r){const i=xh(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))}i0.peek=Ij;function i0(e,r,i,s){const c=kh(i),d=c==='"'?"Quote":"Apostrophe",p=i.createTracker(s);let l,h;if(r0(e,i)){const g=i.stack;i.stack=[],l=i.enter("autolink");let m=p.move("<");return m+=p.move(i.containerPhrasing(e,{before:m,after:">",...p.current()})),m+=p.move(">"),l(),i.stack=g,m}l=i.enter("link"),h=i.enter("label");let f=p.move("[");return f+=p.move(i.containerPhrasing(e,{before:f,after:"](",...p.current()})),f+=p.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=i.enter("destinationLiteral"),f+=p.move("<"),f+=p.move(i.safe(e.url,{before:f,after:">",...p.current()})),f+=p.move(">")):(h=i.enter("destinationRaw"),f+=p.move(i.safe(e.url,{before:f,after:e.title?" ":")",...p.current()}))),h(),e.title&&(h=i.enter(`title${d}`),f+=p.move(" "+c),f+=p.move(i.safe(e.title,{before:f,after:c,...p.current()})),f+=p.move(c),h()),f+=p.move(")"),l(),f}function Ij(e,r,i){return r0(e,i)?"<":"["}s0.peek=zj;function s0(e,r,i,s){const c=e.referenceType,d=i.enter("linkReference");let p=i.enter("label");const l=i.createTracker(s);let h=l.move("[");const f=i.containerPhrasing(e,{before:h,after:"]",...l.current()});h+=l.move(f+"]["),p();const g=i.stack;i.stack=[],p=i.enter("reference");const m=i.safe(i.associationId(e),{before:h,after:"]",...l.current()});return p(),i.stack=g,d(),c==="full"||!f||f!==m?h+=l.move(m+"]"):c==="shortcut"?h=h.slice(0,-1):h+=l.move("]"),h}function zj(){return"["}function Eh(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 Hj(e){const r=Eh(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 Pj(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 a0(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 Fj(e,r,i,s){const c=i.enter("list"),d=i.bulletCurrent;let p=e.ordered?Pj(i):Eh(i);const l=e.ordered?p==="."?")":".":Hj(i);let h=r&&i.bulletLastUsed?p===i.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((p==="*"||p==="-")&&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&&(h=!0),a0(i)===p&&g){let m=-1;for(;++m<e.children.length;){const b=e.children[m];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(p=l),i.bulletCurrent=p;const f=i.containerFlow(e,s);return i.bulletLastUsed=p,i.bulletCurrent=d,c(),f}function Uj(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 $j(e,r,i,s){const c=Uj(i);let d=i.bulletCurrent||Eh(i);r&&r.type==="list"&&r.ordered&&(d=(typeof r.start=="number"&&r.start>-1?r.start:1)+(i.options.incrementListMarker===!1?0:r.children.indexOf(e))+d);let p=d.length+1;(c==="tab"||c==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(p=Math.ceil(p/4)*4);const l=i.createTracker(s);l.move(d+" ".repeat(p-d.length)),l.shift(p);const h=i.enter("listItem"),f=i.indentLines(i.containerFlow(e,l.current()),g);return h(),f;function g(m,b,S){return b?(S?"":" ".repeat(p))+m:(S?d:d+" ".repeat(p-d.length))+m}}function qj(e,r,i,s){const c=i.enter("paragraph"),d=i.enter("phrasing"),p=i.containerPhrasing(e,s);return d(),c(),p}const Wj=Hl(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Gj(e,r,i,s){return(e.children.some(function(p){return Wj(p)})?i.containerPhrasing:i.containerFlow).call(i,e,s)}function Vj(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}o0.peek=Yj;function o0(e,r,i,s){const c=Vj(i),d=i.enter("strong"),p=i.createTracker(s),l=p.move(c+c);let h=p.move(i.containerPhrasing(e,{after:c,before:l,...p.current()}));const f=h.charCodeAt(0),g=Tl(s.before.charCodeAt(s.before.length-1),f,c);g.inside&&(h=Ua(f)+h.slice(1));const m=h.charCodeAt(h.length-1),b=Tl(s.after.charCodeAt(0),m,c);b.inside&&(h=h.slice(0,-1)+Ua(m));const S=p.move(c+c);return d(),i.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},l+h+S}function Yj(e,r,i){return i.options.strong||"*"}function Kj(e,r,i,s){return i.safe(e.value,s)}function Xj(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 Zj(e,r,i){const s=(a0(i)+(i.options.ruleSpaces?" ":"")).repeat(Xj(i));return i.options.ruleSpaces?s.slice(0,-1):s}const l0={blockquote:yj,break:_v,code:Ej,definition:Nj,emphasis:Qb,hardBreak:_v,heading:Lj,html:Jb,image:e0,imageReference:t0,inlineCode:n0,link:i0,linkReference:s0,list:Fj,listItem:$j,paragraph:qj,root:Gj,strong:o0,text:Kj,thematicBreak:Zj};function Qj(){return{enter:{table:Jj,tableData:Sv,tableHeader:Sv,tableRow:tN},exit:{codeText:nN,table:eN,tableData:Md,tableHeader:Md,tableRow:Md}}}function Jj(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 eN(e){this.exit(e),this.data.inTable=void 0}function tN(e){this.enter({type:"tableRow",children:[]},e)}function Md(e){this.exit(e)}function Sv(e){this.enter({type:"tableCell",children:[]},e)}function nN(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,rN));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(e)}function rN(e,r){return r==="|"?r:e}function iN(e){const r=e||{},i=r.tableCellPadding,s=r.tablePipeAlign,c=r.stringLength,d=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
117
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:p,tableCell:h,tableRow:l}};function p(S,E,C,x){return f(g(S,C,x),S.align)}function l(S,E,C,x){const _=m(S,C,x),v=f([_]);return v.slice(0,v.indexOf(`
|
|
118
|
-
`))}function h(S,E,C,x){const _=C.enter("tableCell"),v=C.enter("phrasing"),y=C.containerPhrasing(S,{...x,before:d,after:d});return v(),_(),y}function f(S,E){return vj(S,{align:E,alignDelimiters:s,padding:i,stringLength:c})}function g(S,E,C){const x=S.children;let _=-1;const v=[],y=E.enter("table");for(;++_<x.length;)v[_]=m(x[_],E,C);return y(),v}function m(S,E,C){const x=S.children;let _=-1;const v=[],y=E.enter("tableRow");for(;++_<x.length;)v[_]=h(x[_],S,E,C);return y(),v}function b(S,E,C){let x=l0.inlineCode(S,E,C);return C.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function sN(){return{exit:{taskListCheckValueChecked:wv,taskListCheckValueUnchecked:wv,paragraph:oN}}}function aN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:lN}}}function wv(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function oN(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const s=i.children[0];if(s&&s.type==="text"){const c=r.children;let d=-1,p;for(;++d<c.length;){const l=c[d];if(l.type==="paragraph"){p=l;break}}p===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 lN(e,r,i,s){const c=e.children[0],d=typeof e.checked=="boolean"&&c&&c.type==="paragraph",p="["+(e.checked?"x":" ")+"] ",l=i.createTracker(s);d&&l.move(p);let h=l0.listItem(e,r,i,{...s,...l.current()});return d&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),h;function f(g){return g+p}}function cN(){return[FE(),lj(),hj(),Qj(),sN()]}function uN(e){return{extensions:[UE(),cj(e),fj(),iN(e),aN()]}}const dN={tokenize:xN,partial:!0},c0={tokenize:vN,partial:!0},u0={tokenize:bN,partial:!0},d0={tokenize:yN,partial:!0},hN={tokenize:_N,partial:!0},h0={name:"wwwAutolink",tokenize:mN,previous:p0},f0={name:"protocolAutolink",tokenize:gN,previous:m0},Nr={name:"emailAutolink",tokenize:pN,previous:g0},ar={};function fN(){return{text:ar}}let wi=48;for(;wi<123;)ar[wi]=Nr,wi++,wi===58?wi=65:wi===91&&(wi=97);ar[43]=Nr;ar[45]=Nr;ar[46]=Nr;ar[95]=Nr;ar[72]=[Nr,f0];ar[104]=[Nr,f0];ar[87]=[Nr,h0];ar[119]=[Nr,h0];function pN(e,r,i){const s=this;let c,d;return p;function p(m){return!Qd(m)||!g0.call(s,s.previous)||jh(s.events)?i(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return Qd(m)?(e.consume(m),l):m===64?(e.consume(m),h):i(m)}function h(m){return m===46?e.check(hN,g,f)(m):m===45||m===95||sn(m)?(d=!0,e.consume(m),h):g(m)}function f(m){return e.consume(m),c=!0,h}function g(m){return d&&c&&cn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):i(m)}}function mN(e,r,i){const s=this;return c;function c(p){return p!==87&&p!==119||!p0.call(s,s.previous)||jh(s.events)?i(p):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(dN,e.attempt(c0,e.attempt(u0,d),i),i)(p))}function d(p){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(p)}}function gN(e,r,i){const s=this;let c="",d=!1;return p;function p(m){return(m===72||m===104)&&m0.call(s,s.previous)&&!jh(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(m),e.consume(m),l):i(m)}function l(m){if(cn(m)&&c.length<5)return c+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const b=c.toLowerCase();if(b==="http"||b==="https")return e.consume(m),h}return i(m)}function h(m){return m===47?(e.consume(m),d?f:(d=!0,h)):i(m)}function f(m){return m===null||El(m)||yt(m)||Ti(m)||Bl(m)?i(m):e.attempt(c0,e.attempt(u0,g),i)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function xN(e,r,i){let s=0;return c;function c(p){return(p===87||p===119)&&s<3?(s++,e.consume(p),c):p===46&&s===3?(e.consume(p),d):i(p)}function d(p){return p===null?i(p):r(p)}}function vN(e,r,i){let s,c,d;return p;function p(f){return f===46||f===95?e.check(d0,h,l)(f):f===null||yt(f)||Ti(f)||f!==45&&Bl(f)?h(f):(d=!0,e.consume(f),p)}function l(f){return f===95?s=!0:(c=s,s=void 0),e.consume(f),p}function h(f){return c||s||!d?i(f):r(f)}}function bN(e,r){let i=0,s=0;return c;function c(p){return p===40?(i++,e.consume(p),c):p===41&&s<i?d(p):p===33||p===34||p===38||p===39||p===41||p===42||p===44||p===46||p===58||p===59||p===60||p===63||p===93||p===95||p===126?e.check(d0,r,d)(p):p===null||yt(p)||Ti(p)?r(p):(e.consume(p),c)}function d(p){return p===41&&s++,e.consume(p),c}}function yN(e,r,i){return s;function s(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),s):l===38?(e.consume(l),d):l===93?(e.consume(l),c):l===60||l===null||yt(l)||Ti(l)?r(l):i(l)}function c(l){return l===null||l===40||l===91||yt(l)||Ti(l)?r(l):s(l)}function d(l){return cn(l)?p(l):i(l)}function p(l){return l===59?(e.consume(l),s):cn(l)?(e.consume(l),p):i(l)}}function _N(e,r,i){return s;function s(d){return e.consume(d),c}function c(d){return sn(d)?i(d):r(d)}}function p0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||yt(e)}function m0(e){return!cn(e)}function g0(e){return!(e===47||Qd(e))}function Qd(e){return e===43||e===45||e===46||e===95||sn(e)}function jh(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 SN={tokenize:AN,partial:!0};function wN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:jN,continuation:{tokenize:NN},exit:TN}},text:{91:{name:"gfmFootnoteCall",tokenize:EN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:CN,resolveTo:kN}}}}function CN(e,r,i){const s=this;let c=s.events.length;const d=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let p;for(;c--;){const h=s.events[c][1];if(h.type==="labelImage"){p=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return l;function l(h){if(!p||!p._balanced)return i(h);const f=Kn(s.sliceSerialize({start:p.end,end:s.now()}));return f.codePointAt(0)!==94||!d.includes(f.slice(1))?i(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),r(h))}}function kN(e,r){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const d={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},e[e.length-1][1].start)},p={type:"chunkString",contentType:"string",start:Object.assign({},d.start),end:Object.assign({},d.end)},l=[e[i+1],e[i+2],["enter",s,r],e[i+3],e[i+4],["enter",c,r],["exit",c,r],["enter",d,r],["enter",p,r],["exit",p,r],["exit",d,r],e[e.length-2],e[e.length-1],["exit",s,r]];return e.splice(i,e.length-i+1,...l),e}function EN(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let d=0,p;return l;function l(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),h}function h(m){return m!==94?i(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(m){if(d>999||m===93&&!p||m===null||m===91||yt(m))return i(m);if(m===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return c.includes(Kn(s.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):i(m)}return yt(m)||(p=!0),d++,e.consume(m),m===92?g:f}function g(m){return m===91||m===92||m===93?(e.consume(m),d++,f):f(m)}}function jN(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let d,p=0,l;return h;function h(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(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(p>999||E===93&&!l||E===null||E===91||yt(E))return i(E);if(E===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return d=Kn(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return yt(E)||(l=!0),p++,e.consume(E),E===92?m:g}function m(E){return E===91||E===92||E===93?(e.consume(E),p++,g):g(E)}function b(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),c.includes(d)||c.push(d),rt(e,S,"gfmFootnoteDefinitionWhitespace")):i(E)}function S(E){return r(E)}}function NN(e,r,i){return e.check(Ya,r,e.attempt(SN,r,i))}function TN(e){e.exit("gfmFootnoteDefinition")}function AN(e,r,i){const s=this;return rt(e,c,"gfmFootnoteDefinitionIndent",5);function c(d){const p=s.events[s.events.length-1];return p&&p[1].type==="gfmFootnoteDefinitionIndent"&&p[2].sliceSerialize(p[1],!0).length===4?r(d):i(d)}}function DN(e){let i=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:d,resolveAll:c};return i==null&&(i=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function c(p,l){let h=-1;for(;++h<p.length;)if(p[h][0]==="enter"&&p[h][1].type==="strikethroughSequenceTemporary"&&p[h][1]._close){let f=h;for(;f--;)if(p[f][0]==="exit"&&p[f][1].type==="strikethroughSequenceTemporary"&&p[f][1]._open&&p[h][1].end.offset-p[h][1].start.offset===p[f][1].end.offset-p[f][1].start.offset){p[h][1].type="strikethroughSequence",p[f][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},p[f][1].start),end:Object.assign({},p[h][1].end)},m={type:"strikethroughText",start:Object.assign({},p[f][1].end),end:Object.assign({},p[h][1].start)},b=[["enter",g,l],["enter",p[f][1],l],["exit",p[f][1],l],["enter",m,l]],S=l.parser.constructs.insideSpan.null;S&&Dn(b,b.length,0,Il(S,p.slice(f+1,h),l)),Dn(b,b.length,0,[["exit",m,l],["enter",p[h][1],l],["exit",p[h][1],l],["exit",g,l]]),Dn(p,f-1,h-f+3,b),h=f+b.length-2;break}}for(h=-1;++h<p.length;)p[h][1].type==="strikethroughSequenceTemporary"&&(p[h][1].type="data");return p}function d(p,l,h){const f=this.previous,g=this.events;let m=0;return b;function b(E){return f===126&&g[g.length-1][1].type!=="characterEscape"?h(E):(p.enter("strikethroughSequenceTemporary"),S(E))}function S(E){const C=js(f);if(E===126)return m>1?h(E):(p.consume(E),m++,S);if(m<2&&!i)return h(E);const x=p.exit("strikethroughSequenceTemporary"),_=js(E);return x._open=!_||_===2&&!!C,x._close=!C||C===2&&!!_,l(E)}}}class LN{constructor(){this.map=[]}add(r,i,s){RN(this,r,i,s)}consume(r){if(this.map.sort(function(d,p){return d[0]-p[0]}),this.map.length===0)return;let i=this.map.length;const s=[];for(;i>0;)i-=1,s.push(r.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),r.length=this.map[i][0];s.push(r.slice()),r.length=0;let c=s.pop();for(;c;){for(const d of c)r.push(d);c=s.pop()}this.map.length=0}}function RN(e,r,i,s){let c=0;if(!(i===0&&s.length===0)){for(;c<e.map.length;){if(e.map[c][0]===r){e.map[c][1]+=i,e.map[c][2].push(...s);return}c+=1}e.map.push([r,i,s])}}function MN(e,r){let i=!1;const s=[];for(;r<e.length;){const c=e[r];if(i){if(c[0]==="enter")c[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const d=s.length-1;s[d]=s[d]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return s}function ON(){return{flow:{null:{name:"table",tokenize:BN,resolveAll:IN}}}}function BN(e,r,i){const s=this;let c=0,d=0,p;return l;function l(H){let W=s.events.length-1;for(;W>-1;){const I=s.events[W][1].type;if(I==="lineEnding"||I==="linePrefix")W--;else break}const Y=W>-1?s.events[W][1].type:null,$=Y==="tableHead"||Y==="tableRow"?N:h;return $===N&&s.parser.lazy[s.now().line]?i(H):$(H)}function h(H){return e.enter("tableHead"),e.enter("tableRow"),f(H)}function f(H){return H===124||(p=!0,d+=1),g(H)}function g(H){return H===null?i(H):Me(H)?d>1?(d=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),S):i(H):Xe(H)?rt(e,g,"whitespace")(H):(d+=1,p&&(p=!1,c+=1),H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),p=!0,g):(e.enter("data"),m(H)))}function m(H){return H===null||H===124||yt(H)?(e.exit("data"),g(H)):(e.consume(H),H===92?b:m)}function b(H){return H===92||H===124?(e.consume(H),m):m(H)}function S(H){return s.interrupt=!1,s.parser.lazy[s.now().line]?i(H):(e.enter("tableDelimiterRow"),p=!1,Xe(H)?rt(e,E,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):E(H))}function E(H){return H===45||H===58?x(H):H===124?(p=!0,e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),C):A(H)}function C(H){return Xe(H)?rt(e,x,"whitespace")(H):x(H)}function x(H){return H===58?(d+=1,p=!0,e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),_):H===45?(d+=1,_(H)):H===null||Me(H)?j(H):A(H)}function _(H){return H===45?(e.enter("tableDelimiterFiller"),v(H)):A(H)}function v(H){return H===45?(e.consume(H),v):H===58?(p=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(H))}function y(H){return Xe(H)?rt(e,j,"whitespace")(H):j(H)}function j(H){return H===124?E(H):H===null||Me(H)?!p||c!==d?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"),L(H)}function L(H){return H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),L):H===null||Me(H)?(e.exit("tableRow"),r(H)):Xe(H)?rt(e,L,"whitespace")(H):(e.enter("data"),T(H))}function T(H){return H===null||H===124||yt(H)?(e.exit("data"),L(H)):(e.consume(H),H===92?B:T)}function B(H){return H===92||H===124?(e.consume(H),T):T(H)}}function IN(e,r){let i=-1,s=!0,c=0,d=[0,0,0,0],p=[0,0,0,0],l=!1,h=0,f,g,m;const b=new LN;for(;++i<e.length;){const S=e[i],E=S[1];S[0]==="enter"?E.type==="tableHead"?(l=!1,h!==0&&(Cv(b,r,h,f,g),g=void 0,h=0),f={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},b.add(i,0,[["enter",f,r]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(s=!0,m=void 0,d=[0,0,0,0],p=[0,i+1,0,0],l&&(l=!1,g={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},b.add(i,0,[["enter",g,r]])),c=E.type==="tableDelimiterRow"?2:g?3:1):c&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(s=!1,p[2]===0&&(d[1]!==0&&(p[0]=p[1],m=ml(b,r,d,c,void 0,m),d=[0,0,0,0]),p[2]=i)):E.type==="tableCellDivider"&&(s?s=!1:(d[1]!==0&&(p[0]=p[1],m=ml(b,r,d,c,void 0,m)),d=p,p=[d[1],i,0,0])):E.type==="tableHead"?(l=!0,h=i):E.type==="tableRow"||E.type==="tableDelimiterRow"?(h=i,d[1]!==0?(p[0]=p[1],m=ml(b,r,d,c,i,m)):p[1]!==0&&(m=ml(b,r,p,c,i,m)),c=0):c&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(p[3]=i)}for(h!==0&&Cv(b,r,h,f,g),b.consume(r.events),i=-1;++i<r.events.length;){const S=r.events[i];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=MN(r.events,i))}return e}function ml(e,r,i,s,c,d){const p=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",l="tableContent";i[0]!==0&&(d.end=Object.assign({},Ss(r.events,i[0])),e.add(i[0],0,[["exit",d,r]]));const h=Ss(r.events,i[1]);if(d={type:p,start:Object.assign({},h),end:Object.assign({},h)},e.add(i[1],0,[["enter",d,r]]),i[2]!==0){const f=Ss(r.events,i[2]),g=Ss(r.events,i[3]),m={type:l,start:Object.assign({},f),end:Object.assign({},g)};if(e.add(i[2],0,[["enter",m,r]]),s!==2){const b=r.events[i[2]],S=r.events[i[3]];if(b[1].end=Object.assign({},S[1].end),b[1].type="chunkText",b[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 c!==void 0&&(d.end=Object.assign({},Ss(r.events,c)),e.add(c,0,[["exit",d,r]]),d=void 0),d}function Cv(e,r,i,s,c){const d=[],p=Ss(r.events,i);c&&(c.end=Object.assign({},p),d.push(["exit",c,r])),s.end=Object.assign({},p),d.push(["exit",s,r]),e.add(i+1,0,d)}function Ss(e,r){const i=e[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const zN={name:"tasklistCheck",tokenize:PN};function HN(){return{text:{91:zN}}}function PN(e,r,i){const s=this;return c;function c(h){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?i(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),d)}function d(h){return yt(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),p):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),p):i(h)}function p(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):i(h)}function l(h){return Me(h)?r(h):Xe(h)?e.check({tokenize:FN},r,i)(h):i(h)}}function FN(e,r,i){return rt(e,s,"whitespace");function s(c){return c===null?i(c):r(c)}}function UN(e){return jb([fN(),wN(),DN(e),ON(),HN()])}const $N={};function qN(e){const r=this,i=e||$N,s=r.data(),c=s.micromarkExtensions||(s.micromarkExtensions=[]),d=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),p=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);c.push(UN(i)),d.push(cN()),p.push(uN(i))}function WN(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 GN(e,r){if(e==null)return{};var i,s,c=WN(e,r);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);for(s=0;s<d.length;s++)i=d[s],r.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(c[i]=e[i])}return c}function Jd(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 VN(e){if(Array.isArray(e))return Jd(e)}function YN(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function KN(e,r){if(e){if(typeof e=="string")return Jd(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)?Jd(e,r):void 0}}function XN(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
119
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eh(e){return VN(e)||YN(e)||KN(e)||XN()}function $a(e){"@babel/helpers - typeof";return $a=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},$a(e)}function ZN(e,r){if($a(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var s=i.call(e,r);if($a(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function QN(e){var r=ZN(e,"string");return $a(r)=="symbol"?r:r+""}function x0(e,r,i){return(r=QN(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function th(){return th=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},th.apply(null,arguments)}function kv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),i.push.apply(i,s)}return i}function Cs(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?kv(Object(i),!0).forEach(function(s){x0(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):kv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}function JN(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 Od={};function e5(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return Od[r]||(Od[r]=JN(e)),Od[r]}function t5(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,s=e.filter(function(d){return d!=="token"}),c=e5(s);return c.reduce(function(d,p){return Cs(Cs({},d),i[p])},r)}function Ev(e){return e.join(" ")}function n5(e,r){var i=0;return function(s){return i+=1,s.map(function(c,d){return v0({node:c,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(i,"-").concat(d)})})}}function v0(e){var r=e.node,i=e.stylesheet,s=e.style,c=s===void 0?{}:s,d=e.useInlineStyles,p=e.key,l=r.properties,h=r.type,f=r.tagName,g=r.value;if(h==="text")return g;if(f){var m=n5(i,d),b;if(!d)b=Cs(Cs({},l),{},{className:Ev(l.className)});else{var S=Object.keys(i).reduce(function(_,v){return v.split(".").forEach(function(y){_.includes(y)||_.push(y)}),_},[]),E=l.className&&l.className.includes("token")?["token"]:[],C=l.className&&E.concat(l.className.filter(function(_){return!S.includes(_)}));b=Cs(Cs({},l),{},{className:Ev(C)||void 0,style:t5(l.className,Object.assign({},l.style,c),i)})}var x=m(r.children);return ln.createElement(f,th({key:p},b),x)}}const r5=(function(e,r){var i=e.listLanguages();return i.indexOf(r)!==-1});var i5=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function jv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),i.push.apply(i,s)}return i}function ni(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?jv(Object(i),!0).forEach(function(s){x0(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):jv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var s5=/\n/g;function a5(e){return e.match(s5)}function o5(e){var r=e.lines,i=e.startingLineNumber,s=e.style;return r.map(function(c,d){var p=d+i;return ln.createElement("span",{key:"line-".concat(d),className:"react-syntax-highlighter-line-number",style:typeof s=="function"?s(p):s},"".concat(p,`
|
|
120
|
-
`))})}function l5(e){var r=e.codeString,i=e.codeStyle,s=e.containerStyle,c=s===void 0?{float:"left",paddingRight:"10px"}:s,d=e.numberStyle,p=d===void 0?{}:d,l=e.startingLineNumber;return ln.createElement("code",{style:Object.assign({},i,c)},o5({lines:r.replace(/\n$/,"").split(`
|
|
121
|
-
`),style:p,startingLineNumber:l}))}function c5(e){return"".concat(e.toString().length,".25em")}function b0(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 y0(e,r,i){var s={display:"inline-block",minWidth:c5(i),paddingRight:"1em",textAlign:"right",userSelect:"none"},c=typeof e=="function"?e(r):e,d=ni(ni({},s),c);return d}function _l(e){var r=e.children,i=e.lineNumber,s=e.lineNumberStyle,c=e.largestLineNumber,d=e.showInlineLineNumbers,p=e.lineProps,l=p===void 0?{}:p,h=e.className,f=h===void 0?[]:h,g=e.showLineNumbers,m=e.wrapLongLines,b=e.wrapLines,S=b===void 0?!1:b,E=S?ni({},typeof l=="function"?l(i):l):{};if(E.className=E.className?[].concat(eh(E.className.trim().split(/\s+/)),eh(f)):f,i&&d){var C=y0(s,i,c);r.unshift(b0(i,C))}return m&g&&(E.style=ni({display:"flex"},E.style)),{type:"element",tagName:"span",properties:E,children:r}}function _0(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var s=0;s<e.length;s++){var c=e[s];if(c.type==="text")i.push(_l({children:[c],className:eh(new Set(r))}));else if(c.children){var d,p=r.concat(((d=c.properties)===null||d===void 0?void 0:d.className)||[]);_0(c.children,p).forEach(function(l){return i.push(l)})}}return i}function u5(e,r,i,s,c,d,p,l,h){var f,g=_0(e.value),m=[],b=-1,S=0;function E(A,N){var L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return _l({children:A,lineNumber:N,lineNumberStyle:l,largestLineNumber:p,showInlineLineNumbers:c,lineProps:i,className:L,showLineNumbers:s,wrapLongLines:h,wrapLines:r})}function C(A,N){if(s&&N&&c){var L=y0(l,N,p);A.unshift(b0(N,L))}return A}function x(A,N){var L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return r||L.length>0?E(A,N,L):C(A,N)}for(var _=function(){var N=g[S],L=N.children[0].value,T=a5(L);if(T){var B=L.split(`
|
|
122
|
-
`);B.forEach(function(H,W){var Y=s&&m.length+d,$={type:"text",value:"".concat(H,`
|
|
123
|
-
`)};if(W===0){var I=g.slice(b+1,S).concat(_l({children:[$],className:N.properties.className})),P=x(I,Y);m.push(P)}else if(W===B.length-1){var V=g[S+1]&&g[S+1].children&&g[S+1].children[0],Z={type:"text",value:"".concat(H)};if(V){var ee=_l({children:[Z],className:N.properties.className});g.splice(S+1,0,ee)}else{var R=[Z],D=x(R,Y,N.properties.className);m.push(D)}}else{var O=[$],q=x(O,Y,N.properties.className);m.push(q)}}),b=S}S++};S<g.length;)_();if(b!==g.length-1){var v=g.slice(b+1,g.length);if(v&&v.length){var y=s&&m.length+d,j=x(v,y);m.push(j)}}return r?m:(f=[]).concat.apply(f,m)}function d5(e){var r=e.rows,i=e.stylesheet,s=e.useInlineStyles;return r.map(function(c,d){return v0({node:c,stylesheet:i,useInlineStyles:s,key:"code-segment-".concat(d)})})}function S0(e){return e&&typeof e.highlightAuto<"u"}function h5(e){var r=e.astGenerator,i=e.language,s=e.code,c=e.defaultCodeValue;if(S0(r)){var d=r5(r,i);return i==="text"?{value:c,language:"text"}:d?r.highlight(i,s):r.highlightAuto(s)}try{return i&&i!=="text"?{value:r.highlight(s,i)}:{value:c}}catch{return{value:c}}}function f5(e,r){return function(s){var c,d,p=s.language,l=s.children,h=s.style,f=h===void 0?r:h,g=s.customStyle,m=g===void 0?{}:g,b=s.codeTagProps,S=b===void 0?{className:p?"language-".concat(p):void 0,style:ni(ni({},f['code[class*="language-"]']),f['code[class*="language-'.concat(p,'"]')])}:b,E=s.useInlineStyles,C=E===void 0?!0:E,x=s.showLineNumbers,_=x===void 0?!1:x,v=s.showInlineLineNumbers,y=v===void 0?!0:v,j=s.startingLineNumber,A=j===void 0?1:j,N=s.lineNumberContainerStyle,L=s.lineNumberStyle,T=L===void 0?{}:L,B=s.wrapLines,H=s.wrapLongLines,W=H===void 0?!1:H,Y=s.lineProps,$=Y===void 0?{}:Y,I=s.renderer,P=s.PreTag,V=P===void 0?"pre":P,Z=s.CodeTag,ee=Z===void 0?"code":Z,R=s.code,D=R===void 0?(Array.isArray(l)?l[0]:l)||"":R,O=s.astGenerator,q=GN(s,i5);O=O||e;var F=_?ln.createElement(l5,{containerStyle:N,codeStyle:S.style||{},numberStyle:T,startingLineNumber:A,codeString:D}):null,K=f.hljs||f['pre[class*="language-"]']||{backgroundColor:"#fff"},te=S0(O)?"hljs":"prismjs",Q=C?Object.assign({},q,{style:Object.assign({},K,m)}):Object.assign({},q,{className:q.className?"".concat(te," ").concat(q.className):te,style:Object.assign({},m)});if(W?S.style=ni({whiteSpace:"pre-wrap"},S.style):S.style=ni({whiteSpace:"pre"},S.style),!O)return ln.createElement(V,Q,F,ln.createElement(ee,S,D));(B===void 0&&I||W)&&(B=!0),I=I||d5;var X=[{type:"text",value:D}],z=h5({astGenerator:O,language:p,code:D,defaultCodeValue:X});z.language===null&&(z.value=X);var ae=(c=(d=D.match(/\n/g))===null||d===void 0?void 0:d.length)!==null&&c!==void 0?c:0,se=A+ae,ge=u5(z,B,$,_,y,A,se,T,W);return ln.createElement(V,Q,ln.createElement(ee,S,!y&&F,I({rows:ge,stylesheet:f,useInlineStyles:C})))}}const Nv=/[#.]/g;function p5(e,r){const i=e||"",s={};let c=0,d,p;for(;c<i.length;){Nv.lastIndex=c;const l=Nv.exec(i),h=i.slice(c,l?l.index:i.length);h&&(d?d==="#"?s.id=h:Array.isArray(s.className)?s.className.push(h):s.className=[h]:p=h,c+=h.length),l&&(d=l[0],c++)}return{type:"element",tagName:p||r||"div",properties:s,children:[]}}function w0(e,r,i){const s=i?v5(i):void 0;function c(d,p,...l){let h;if(d==null){h={type:"root",children:[]};const f=p;l.unshift(f)}else{h=p5(d,r);const f=h.tagName.toLowerCase(),g=s?s.get(f):void 0;if(h.tagName=g||f,m5(p))l.unshift(p);else for(const[m,b]of Object.entries(p))g5(e,h.properties,m,b)}for(const f of l)nh(h.children,f);return h.type==="element"&&h.tagName==="template"&&(h.content={type:"root",children:h.children},h.children=[]),h}return c}function m5(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const r=e,i=Object.keys(e);for(const s of i){const c=r[s];if(c&&typeof c=="object"){if(!Array.isArray(c))return!0;const d=c;for(const p of d)if(typeof p!="number"&&typeof p!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function g5(e,r,i,s){const c=vb(e,i);let d;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;d=s}else typeof s=="boolean"?d=s:typeof s=="string"?c.spaceSeparated?d=Hx(s):c.commaSeparated?d=Mx(s):c.commaOrSpaceSeparated?d=Hx(Mx(s).join(" ")):d=Tv(c,c.property,s):Array.isArray(s)?d=[...s]:d=c.property==="style"?x5(s):String(s);if(Array.isArray(d)){const p=[];for(const l of d)p.push(Tv(c,c.property,l));d=p}c.property==="className"&&Array.isArray(r.className)&&(d=r.className.concat(d)),r[c.property]=d}}function nh(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)nh(e,i);else if(typeof r=="object"&&"type"in r)r.type==="root"?nh(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function Tv(e,r,i){if(typeof i=="string"){if(e.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((e.boolean||e.overloadedBoolean)&&(i===""||Ha(i)===Ha(r)))return!0}return i}function x5(e){const r=[];for(const[i,s]of Object.entries(e))r.push([i,s].join(": "));return r.join("; ")}function v5(e){const r=new Map;for(const i of e)r.set(i.toLowerCase(),i);return r}const b5=["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"],y5=w0(bb,"div");w0(Ol,"g",b5);const _5=["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"],Av={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 C0(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function S5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function w5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function Dv(e){return w5(e)||C0(e)}const C5=["","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 k5(e,r){const i={},s=typeof i.additional=="string"?i.additional.charCodeAt(0):i.additional,c=[];let d=0,p=-1,l="",h,f;i.position&&("start"in i.position||"indent"in i.position?(f=i.position.indent,h=i.position.start):h=i.position);let g=(h?h.line:0)||1,m=(h?h.column:0)||1,b=E(),S;for(d--;++d<=e.length;)if(S===10&&(m=(f?f[p]:0)||1),S=e.charCodeAt(d),S===38){const _=e.charCodeAt(d+1);if(_===9||_===10||_===12||_===32||_===38||_===60||Number.isNaN(_)||s&&_===s){l+=String.fromCharCode(S),m++;continue}const v=d+1;let y=v,j=v,A;if(_===35){j=++y;const $=e.charCodeAt(j);$===88||$===120?(A="hexadecimal",j=++y):A="decimal"}else A="named";let N="",L="",T="";const B=A==="named"?Dv:A==="decimal"?C0:S5;for(j--;++j<=e.length;){const $=e.charCodeAt(j);if(!B($))break;T+=String.fromCharCode($),A==="named"&&_5.includes(T)&&(N=T,L=Fa(T))}let H=e.charCodeAt(j)===59;if(H){j++;const $=A==="named"?Fa(T):!1;$&&(N=T,L=$)}let W=1+j-v,Y="";if(!(!H&&i.nonTerminated===!1))if(!T)A!=="named"&&C(4,W);else if(A==="named"){if(H&&!L)C(5,1);else if(N!==T&&(j=y+N.length,W=1+j-y,H=!1),!H){const $=N?1:3;if(i.attribute){const I=e.charCodeAt(j);I===61?(C($,W),L=""):Dv(I)?L="":C($,W)}else C($,W)}Y=L}else{H||C(2,W);let $=Number.parseInt(T,A==="hexadecimal"?16:10);if(E5($))C(7,W),Y="�";else if($ in Av)C(6,W),Y=Av[$];else{let I="";j5($)&&C(6,W),$>65535&&($-=65536,I+=String.fromCharCode($>>>10|55296),$=56320|$&1023),Y=I+String.fromCharCode($)}}if(Y){x(),b=E(),d=j-1,m+=j-v+1,c.push(Y);const $=E();$.offset++,i.reference&&i.reference.call(i.referenceContext||void 0,Y,{start:b,end:$},e.slice(v-1,j)),b=$}else T=e.slice(v-1,j),l+=T,m+=T.length,d=j-1}else S===10&&(g++,p++,m=0),Number.isNaN(S)?x():(l+=String.fromCharCode(S),m++);return c.join("");function E(){return{line:g,column:m,offset:d+((h?h.offset:0)||0)}}function C(_,v){let y;i.warning&&(y=E(),y.column+=v,y.offset+=v,i.warning.call(i.warningContext||void 0,C5[_],y,_))}function x(){l&&(c.push(l),i.text&&i.text.call(i.textContext||void 0,l,{start:b,end:E()}),l="")}}function E5(e){return e>=55296&&e<=57343||e>1114111}function j5(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 N5=0,gl={},Gt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++N5}),e.__id},clone:function e(r,i){i=i||{};var s,c;switch(Gt.util.type(r)){case"Object":if(c=Gt.util.objId(r),i[c])return i[c];s={},i[c]=s;for(var d in r)r.hasOwnProperty(d)&&(s[d]=e(r[d],i));return s;case"Array":return c=Gt.util.objId(r),i[c]?i[c]:(s=[],i[c]=s,r.forEach(function(p,l){s[l]=e(p,i)}),s);default:return r}}},languages:{plain:gl,plaintext:gl,text:gl,txt:gl,extend:function(e,r){var i=Gt.util.clone(Gt.languages[e]);for(var s in r)i[s]=r[s];return i},insertBefore:function(e,r,i,s){s=s||Gt.languages;var c=s[e],d={};for(var p in c)if(c.hasOwnProperty(p)){if(p==r)for(var l in i)i.hasOwnProperty(l)&&(d[l]=i[l]);i.hasOwnProperty(p)||(d[p]=c[p])}var h=s[e];return s[e]=d,Gt.languages.DFS(Gt.languages,function(f,g){g===h&&f!=e&&(this[f]=d)}),d},DFS:function e(r,i,s,c){c=c||{};var d=Gt.util.objId;for(var p in r)if(r.hasOwnProperty(p)){i.call(r,p,r[p],s||p);var l=r[p],h=Gt.util.type(l);h==="Object"&&!c[d(l)]?(c[d(l)]=!0,e(l,i,null,c)):h==="Array"&&!c[d(l)]&&(c[d(l)]=!0,e(l,i,p,c))}}},plugins:{},highlight:function(e,r,i){var s={code:e,grammar:r,language:i};if(Gt.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=Gt.tokenize(s.code,s.grammar),Gt.hooks.run("after-tokenize",s),za.stringify(Gt.util.encode(s.tokens),s.language)},tokenize:function(e,r){var i=r.rest;if(i){for(var s in i)r[s]=i[s];delete r.rest}var c=new T5;return Sl(c,c.head,e),k0(e,c,r,c.head,0),D5(c)},hooks:{all:{},add:function(e,r){var i=Gt.hooks.all;i[e]=i[e]||[],i[e].push(r)},run:function(e,r){var i=Gt.hooks.all[e];if(!(!i||!i.length))for(var s=0,c;c=i[s++];)c(r)}},Token:za};function za(e,r,i,s){this.type=e,this.content=r,this.alias=i,this.length=(s||"").length|0}function Lv(e,r,i,s){e.lastIndex=r;var c=e.exec(i);if(c&&s&&c[1]){var d=c[1].length;c.index+=d,c[0]=c[0].slice(d)}return c}function k0(e,r,i,s,c,d){for(var p in i)if(!(!i.hasOwnProperty(p)||!i[p])){var l=i[p];l=Array.isArray(l)?l:[l];for(var h=0;h<l.length;++h){if(d&&d.cause==p+","+h)return;var f=l[h],g=f.inside,m=!!f.lookbehind,b=!!f.greedy,S=f.alias;if(b&&!f.pattern.global){var E=f.pattern.toString().match(/[imsuy]*$/)[0];f.pattern=RegExp(f.pattern.source,E+"g")}for(var C=f.pattern||f,x=s.next,_=c;x!==r.tail&&!(d&&_>=d.reach);_+=x.value.length,x=x.next){var v=x.value;if(r.length>e.length)return;if(!(v instanceof za)){var y=1,j;if(b){if(j=Lv(C,_,e,m),!j||j.index>=e.length)break;var T=j.index,A=j.index+j[0].length,N=_;for(N+=x.value.length;T>=N;)x=x.next,N+=x.value.length;if(N-=x.value.length,_=N,x.value instanceof za)continue;for(var L=x;L!==r.tail&&(N<A||typeof L.value=="string");L=L.next)y++,N+=L.value.length;y--,v=e.slice(_,N),j.index-=_}else if(j=Lv(C,0,v,m),!j)continue;var T=j.index,B=j[0],H=v.slice(0,T),W=v.slice(T+B.length),Y=_+v.length;d&&Y>d.reach&&(d.reach=Y);var $=x.prev;H&&($=Sl(r,$,H),_+=H.length),A5(r,$,y);var I=new za(p,g?Gt.tokenize(B,g):B,S,B);if(x=Sl(r,$,I),W&&Sl(r,x,W),y>1){var P={cause:p+","+h,reach:Y};k0(e,r,i,x.prev,_,P),d&&P.reach>d.reach&&(d.reach=P.reach)}}}}}}function T5(){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 Sl(e,r,i){var s=r.next,c={value:i,prev:r,next:s};return r.next=c,s.prev=c,e.length++,c}function A5(e,r,i){for(var s=r.next,c=0;c<i&&s!==e.tail;c++)s=s.next;r.next=s,s.prev=r,e.length-=c}function D5(e){for(var r=[],i=e.head.next;i!==e.tail;)r.push(i.value),i=i.next;return r}const E0=Gt;function j0(){}j0.prototype=E0;const $t=new j0;$t.highlight=L5;$t.register=R5;$t.alias=M5;$t.registered=O5;$t.listLanguages=B5;$t.util.encode=I5;$t.Token.stringify=rh;function L5(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($t.languages,s))i=$t.languages[s];else throw new Error("Unknown language: `"+s+"` is not registered")}return{type:"root",children:E0.highlight.call($t,e,i,s)}}function R5(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn($t.languages,e.displayName)||e($t)}function M5(e,r){const i=$t.languages;let s={};typeof e=="string"?r&&(s[e]=r):s=e;let c;for(c in s)if(Object.hasOwn(s,c)){const d=s[c],p=typeof d=="string"?[d]:d;let l=-1;for(;++l<p.length;)i[p[l]]=i[c]}}function O5(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn($t.languages,e)}function B5(){const e=$t.languages,r=[];let i;for(i in e)Object.hasOwn(e,i)&&typeof e[i]=="object"&&r.push(i);return r}function rh(e,r){if(typeof e=="string")return{type:"text",value:e};if(Array.isArray(e)){const s=[];let c=-1;for(;++c<e.length;)e[c]!==null&&e[c]!==void 0&&e[c]!==""&&s.push(rh(e[c],r));return s}const i={attributes:{},classes:["token",e.type],content:rh(e.content,r),language:r,tag:"span",type:e.type};return e.alias&&i.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),$t.hooks.run("wrap",i),y5(i.tag+"."+i.classes.join("."),z5(i.attributes),i.content)}function I5(e){return e}function z5(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=k5(e[r]));return e}var mt=f5($t,{});mt.registerLanguage=function(e,r){return $t.register(r)};mt.alias=function(e,r){return $t.alias(e,r)};Di.displayName="markup";Di.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function Di(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(i,s){var c={};c["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[s]},c.cdata=/^<!\[CDATA\[|\]\]>$/i;var d={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:c}};d["language-"+s]={pattern:/[\s\S]+/,inside:e.languages[s]};var p={};p[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:d},e.languages.insertBefore("markup","cdata",p)}}),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}Fl.displayName="css";Fl.aliases=[];function Fl(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)}Li.displayName="clike";Li.aliases=[];function Li(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:/[{}[\];(),.:]/}}Xa.displayName="javascript";Xa.aliases=["js"];function Xa(e){e.register(Li),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}Nh.displayName="sql";Nh.aliases=[];function Nh(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:/[;[\]()`,.]/}}Ul.displayName="c";Ul.aliases=[];function Ul(e){e.register(Li),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}Th.displayName="cpp";Th.aliases=[];function Th(e){e.register(Ul),(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)}Ah.displayName="bash";Ah.aliases=["sh","shell"];function Ah(e){(function(r){var i="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},c={bash:s,environment:{pattern:RegExp("\\$"+i),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+i),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};r.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+i),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:c},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:c},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:c.entity}}],environment:{pattern:RegExp("\\$?"+i),alias:"constant"},variable:c.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},s.inside=r.languages.bash;for(var d=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],p=c.variable[1].inside,l=0;l<d.length;l++)p[d[l]]=r.languages.bash[d[l]];r.languages.sh=r.languages.bash,r.languages.shell=r.languages.bash})(e)}Dh.displayName="yaml";Dh.aliases=["yml"];function Dh(e){(function(r){var i=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,c="(?:"+s.source+"(?:[ ]+"+i.source+")?|"+i.source+"(?:[ ]+"+s.source+")?)",d=/(?:[^\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}),p=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function l(h,f){f=(f||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return c}).replace(/<<value>>/g,function(){return h});return RegExp(g,f)}r.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return c})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return c}).replace(/<<key>>/g,function(){return"(?:"+d+"|"+p+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:l(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:l(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:l(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:l(p),lookbehind:!0,greedy:!0},number:{pattern:l(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:s,important:i,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},r.languages.yml=r.languages.yaml})(e)}Lh.displayName="markdown";Lh.aliases=["md"];function Lh(e){e.register(Di),(function(r){var i=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(l){return l=l.replace(/<inner>/g,function(){return i}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+l+")")}var c=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,d=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return c}),p=/\|?[ \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("^"+d+p+"(?:"+d+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+d+p+")(?:"+d+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(c),inside:r.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+d+")"+p+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+d+"$"),inside:{"table-header":{pattern:RegExp(c),alias:"important",inside:r.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(l){["url","bold","italic","strike","code-snippet"].forEach(function(h){l!==h&&(r.languages.markdown[l].inside.content.inside[h]=r.languages.markdown[h])})}),r.hooks.add("after-tokenize",function(l){if(l.language!=="markdown"&&l.language!=="md")return;function h(f){if(!(!f||typeof f=="string"))for(var g=0,m=f.length;g<m;g++){var b=f[g];if(b.type!=="code"){h(b.content);continue}var S=b.content[1],E=b.content[3];if(S&&E&&S.type==="code-language"&&E.type==="code-block"&&typeof S.content=="string"){var C=S.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");C=(/[a-z][\w-]*/i.exec(C)||[""])[0].toLowerCase();var x="language-"+C;E.alias?typeof E.alias=="string"?E.alias=[E.alias,x]:E.alias.push(x):E.alias=[x]}}}h(l.tokens)}),r.hooks.add("wrap",function(l){if(l.type==="code-block"){for(var h="",f=0,g=l.classes.length;f<g;f++){var m=l.classes[f],b=/language-(.+)/.exec(m);if(b){h=b[1];break}}var S=r.languages[h];if(S)l.content=r.highlight(l.content.value,S,h);else if(h&&h!=="none"&&r.plugins.autoloader){var E="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);l.attributes.id=E,r.plugins.autoloader.loadLanguages(h,function(){var C=document.getElementById(E);C&&(C.innerHTML=r.highlight(C.textContent,r.languages[h],h))})}}}),RegExp(r.languages.markup.tag.pattern.source,"gi"),r.languages.md=r.languages.markdown})(e)}Rh.displayName="ruby";Rh.aliases=["rb"];function Rh(e){e.register(Li),(function(r){r.languages.ruby=r.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),r.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var i={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:r.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete r.languages.ruby.function;var s="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",c=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;r.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+s+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+c),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+c+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),r.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+s),greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:i,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+s),greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete r.languages.ruby.string,r.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),r.languages.rb=r.languages.ruby})(e)}Mh.displayName="diff";Mh.aliases=[];function Mh(e){(function(r){r.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var i={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(i).forEach(function(s){var c=i[s],d=[];/^\w+$/.test(s)||d.push(/\w+/.exec(s)[0]),s==="diff"&&d.push("bold"),r.languages.diff[s]={pattern:RegExp("^(?:["+c+`].*(?:\r
|
|
124
|
-
?|
|
|
125
|
-
|(?![\\s\\S])))+`,"m"),alias:d,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)}Oh.displayName="docker";Oh.aliases=["dockerfile"];function Oh(e){(function(r){var i=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,s=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return i}),c=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,d=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return c}),p={pattern:RegExp(c),greedy:!0},l={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function h(f,g){return f=f.replace(/<OPT>/g,function(){return d}).replace(/<SP>/g,function(){return s}),RegExp(f,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:h(/(^(?:ONBUILD<SP>)?\w+<SP>)<OPT>(?:<SP><OPT>)*/.source,"i"),lookbehind:!0,greedy:!0,inside:{property:{pattern:/(^|\s)--[\w-]+/,lookbehind:!0},string:[p,{pattern:/(=)(?!["'])(?:[^\s\\]|\\.)+/,lookbehind:!0}],operator:/\\$/m,punctuation:/=/}},keyword:[{pattern:h(/(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\b/.source,"i"),lookbehind:!0,greedy:!0},{pattern:h(/(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \t\\]+<SP>)AS/.source,"i"),lookbehind:!0,greedy:!0},{pattern:h(/(^ONBUILD<SP>)\w+/.source,"i"),lookbehind:!0,greedy:!0},{pattern:/^\w+/,greedy:!0}],comment:l,string:p,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:l},r.languages.dockerfile=r.languages.docker})(e)}Bh.displayName="go";Bh.aliases=[];function Bh(e){e.register(Li),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"]}Ih.displayName="graphql";Ih.aliases=[];function Ih(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(x){return typeof x!="string"&&x.type!=="comment"&&x.type!=="scalar"}),c=0;function d(x){return s[c+x]}function p(x,_){_=_||0;for(var v=0;v<x.length;v++){var y=d(v+_);if(!y||y.type!==x[v])return!1}return!0}function l(x,_){for(var v=1,y=c;y<s.length;y++){var j=s[y],A=j.content;if(j.type==="punctuation"&&typeof A=="string"){if(x.test(A))v++;else if(_.test(A)&&(v--,v===0))return y}}return-1}function h(x,_){var v=x.alias;v?Array.isArray(v)||(x.alias=v=[v]):x.alias=v=[],v.push(_)}for(;c<s.length;){var f=s[c++];if(f.type==="keyword"&&f.content==="mutation"){var g=[];if(p(["definition-mutation","punctuation"])&&d(1).content==="("){c+=2;var m=l(/^\($/,/^\)$/);if(m===-1)continue;for(;c<m;c++){var b=d(0);b.type==="variable"&&(h(b,"variable-input"),g.push(b.content))}c=m+1}if(p(["punctuation","property-query"])&&d(0).content==="{"&&(c++,h(d(0),"property-mutation"),g.length>0)){var S=l(/^\{$/,/^\}$/);if(S===-1)continue;for(var E=c;E<S;E++){var C=s[E];C.type==="variable"&&g.indexOf(C.content)>=0&&h(C,"variable-input")}}}}})}zh.displayName="scss";zh.aliases=[];function zh(e){e.register(Fl),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}Hh.displayName="json";Hh.aliases=["webmanifest"];function Hh(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}Ph.displayName="java";Ph.aliases=[];function Ph(e){e.register(Li),(function(r){var i=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,s=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,c={pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};r.languages.java=r.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[c,{pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:c.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+s+/[A-Z]\w*\b/.source),lookbehind:!0,inside:c.inside}],keyword:i,function:[r.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),r.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),r.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":c,keyword:i,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+s+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:c.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+s+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:c.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return i.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}$l.displayName="typescript";$l.aliases=["ts"];function $l(e){e.register(Xa),(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)}Fh.displayName="python";Fh.aliases=["py"];function Fh(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}ql.displayName="jsx";ql.aliases=[];function ql(e){e.register(Xa),e.register(Di),(function(r){var i=r.util.clone(r.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,c=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,d=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function p(f,g){return f=f.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return c}).replace(/<SPREAD>/g,function(){return d}),RegExp(f,g)}d=p(d).source,r.languages.jsx=r.languages.extend("markup",i),r.languages.jsx.tag.pattern=p(/<\/?(?:[\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:p(/<SPREAD>/.source),inside:r.languages.jsx}},r.languages.jsx.tag),r.languages.insertBefore("inside","special-attr",{script:{pattern:p(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:r.languages.jsx}}},r.languages.jsx.tag);var l=function(f){return f?typeof f=="string"?f:typeof f.content=="string"?f.content:f.content.map(l).join(""):""},h=function(f){for(var g=[],m=0;m<f.length;m++){var b=f[m],S=!1;if(typeof b!="string"&&(b.type==="tag"&&b.content[0]&&b.content[0].type==="tag"?b.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===l(b.content[0].content[1])&&g.pop():b.content[b.content.length-1].content==="/>"||g.push({tagName:l(b.content[0].content[1]),openedBraces:0}):g.length>0&&b.type==="punctuation"&&b.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&b.type==="punctuation"&&b.content==="}"?g[g.length-1].openedBraces--:S=!0),(S||typeof b=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var E=l(b);m<f.length-1&&(typeof f[m+1]=="string"||f[m+1].type==="plain-text")&&(E+=l(f[m+1]),f.splice(m+1,1)),m>0&&(typeof f[m-1]=="string"||f[m-1].type==="plain-text")&&(E=l(f[m-1])+E,f.splice(m-1,1),m--),f[m]=new r.Token("plain-text",E,null,E)}b.content&&typeof b.content!="string"&&h(b.content)}};r.hooks.add("after-tokenize",function(f){f.language!=="jsx"&&f.language!=="tsx"||h(f.tokens)})})(e)}Uh.displayName="tsx";Uh.aliases=[];function Uh(e){e.register(ql),e.register($l),(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)}$h.displayName="rust";$h.aliases=[];function $h(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)}qh.displayName="toml";qh.aliases=[];function qh(e){(function(r){var i=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function s(c){return c.replace(/__/g,function(){return i})}r.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(s(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(s(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(e)}const wl={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}};mt.registerLanguage("typescript",$l);mt.registerLanguage("javascript",Xa);mt.registerLanguage("tsx",Uh);mt.registerLanguage("jsx",ql);mt.registerLanguage("python",Fh);mt.registerLanguage("bash",Ah);mt.registerLanguage("json",Hh);mt.registerLanguage("css",Fl);mt.registerLanguage("html",Di);mt.registerLanguage("markup",Di);mt.registerLanguage("xml",Di);mt.registerLanguage("sql",Nh);mt.registerLanguage("yaml",Dh);mt.registerLanguage("markdown",Lh);mt.registerLanguage("diff",Mh);mt.registerLanguage("rust",$h);mt.registerLanguage("go",Bh);mt.registerLanguage("java",Ph);mt.registerLanguage("c",Ul);mt.registerLanguage("cpp",Th);mt.registerLanguage("ruby",Rh);mt.registerLanguage("toml",qh);mt.registerLanguage("scss",zh);mt.registerLanguage("graphql",Ih);mt.registerLanguage("docker",Oh);function N0(e=2e3){const[r,i]=U.useState(!1),s=U.useCallback(async c=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(c);else{const d=document.createElement("textarea");d.value=c,d.style.position="fixed",d.style.left="-9999px",document.body.appendChild(d),d.select(),document.execCommand("copy"),document.body.removeChild(d)}i(!0),setTimeout(()=>i(!1),e)}catch(d){console.error("Failed to copy:",d)}},[e]);return{copied:r,copy:s}}const H5={code({className:e,children:r,...i}){const s=/language-(\w+)/.exec(e||"");if(!s&&!String(r).includes(`
|
|
126
|
-
`))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 d=(s==null?void 0:s[1])||"text",p=String(r).replace(/\n$/,""),{copied:l,copy:h}=N0();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:d}),o.jsx("button",{type:"button",onClick:f=>{f.preventDefault(),f.stopPropagation(),h(p)},className:"opacity-0 group-hover:opacity-100 transition-opacity hover:text-text-primary p-0.5",title:"Copy code",children:l?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:"M5 13l4 4L19 7"})}):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(mt,{style:wl,language:d,PreTag:"div",customStyle:{margin:0,fontSize:"0.75rem"},codeTagProps:{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:p})})]})},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})}},Ds=U.memo(function({content:r,className:i=""}){const s=U.useMemo(()=>{let c=P5(r);return c=F5(c),c},[r]);return o.jsx("div",{className:`markdown-content [&_li>p]:inline ${i}`,children:o.jsx(DE,{remarkPlugins:[qN],components:H5,children:s})})});function P5(e){let r=e.replace(/^(\s*)•\s/gm,"$1- ");return r=r.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),r}function F5(e){const r=/```/g,i=e.match(r);if(((i==null?void 0:i.length)??0)%2===1){const c=e.lastIndexOf("```");return e.slice(c+3).includes(`
|
|
127
|
-
`),e+"\n```"}return e}const U5=U.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(Ds,{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 T0({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 $5={...wl,'pre[class*="language-"]':{...wl['pre[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflowX:"hidden"},'code[class*="language-"]':{...wl['code[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},q5={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 Wl(e){var c;if(!e)return"text";const r=e.split("/").pop()??"",i=r.toLowerCase();if(i==="dockerfile")return"docker";if(i==="makefile")return"makefile";if(i==="cmakelists.txt")return"cmake";const s=(c=r.split(".").pop())==null?void 0:c.toLowerCase();return s?q5[s]??"text":"text"}const A0={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},W5={...A0,display:"inline"},G5={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},qa=U.memo(function({code:r,language:i,variant:s}){const c=s==="inline"?"span":s==="block-nowrap"?"div":"pre",d=s==="inline"?W5:s==="block-nowrap"?A0:G5;return o.jsx(mt,{style:$5,language:i,PreTag:c,customStyle:d,children:r})});function D0({src:e,alt:r,isOpen:i,onClose:s}){const c=U.useRef(null);U.useEffect(()=>{if(!i)return;const p=l=>{l.key==="Escape"&&s()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[i,s]);const d=p=>{p.target===p.currentTarget&&s()};return i?o.jsx("div",{ref:c,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",onClick:d,role:"dialog","aria-modal":"true","aria-label":"Image viewer",children:o.jsxs("div",{className:"relative max-w-[95vw] max-h-[95vh] flex items-center justify-center",children:[o.jsx("button",{onClick:s,className:"absolute -top-12 right-0 text-white hover:text-gray-300 transition-colors p-2","aria-label":"Close image viewer",children:o.jsx("svg",{className:"w-6 h-6",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"})})}),o.jsx("img",{src:e,alt:r,className:"max-w-full max-h-[90vh] object-contain rounded-lg shadow-2xl"})]})}):null}const V5=U.memo(function({oldString:r,newString:i,filePath:s}){const c=U.useMemo(()=>Wl(s),[s]),d=r.split(`
|
|
128
|
-
`),p=i.split(`
|
|
129
|
-
`),l=r.length>0,h=i.length>0;return!l&&!h?o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):o.jsxs("div",{className:"rounded overflow-hidden border border-border grid grid-cols-[3px_1.5rem_1fr]",children:[l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"bg-red-400/60"}),o.jsx("div",{className:"bg-red-950/30 text-red-400/70 text-sm font-mono text-center",children:d.map((f,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(qa,{code:r,language:c,variant:"block-nowrap"})})]}),h&&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:p.map((f,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(qa,{code:i,language:c,variant:"block-nowrap"})})]})]})}),Y5=U.memo(function({content:r,filePath:i}){const s=U.useMemo(()=>Wl(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(`
|
|
130
|
-
`).map((c,d)=>o.jsx("div",{className:"leading-[1.5rem]",children:"+"},d))}),o.jsx("div",{className:"bg-green-950/30 pr-2 min-w-0 overflow-x-hidden",children:o.jsx(qa,{code:r,language:s,variant:"block"})})]})})}),K5=U.memo(function({regions:r,filePath:i}){const s=U.useMemo(()=>Wl(i),[i]);return r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):o.jsx("div",{className:"space-y-2",children:r.map((c,d)=>o.jsx(X5,{region:c,language:s},d))})}),X5=U.memo(function({region:r,language:i}){const s=Z5(r),c=Math.max(...r.beforeContext.map(p=>p.lineNumber),...r.afterContext.map(p=>p.lineNumber),...r.edits.flatMap(p=>[p.startLine,p.endLine])),d=String(c).length;return o.jsx("div",{className:"rounded overflow-hidden border border-border font-mono text-sm",children:s.map((p,l)=>o.jsx(Q5,{item:p,language:i,lineNumWidth:d},l))})});function Z5(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(`
|
|
131
|
-
`);for(let d=0;d<s.length;d++)r.push({type:"removed",lineNumber:i.startLine+d,content:s[d]});const c=i.newContent.split(`
|
|
132
|
-
`);for(let d=0;d<c.length;d++)r.push({type:"added",lineNumber:i.startLine+d,content:c[d]})}for(const i of e.afterContext)r.push({type:"context",lineNumber:i.lineNumber,content:i.content});return r}const Q5=U.memo(function({item:r,language:i,lineNumWidth:s}){const c=String(r.lineNumber).padStart(s," "),d=r.type==="context"?"bg-bg-secondary":r.type==="removed"?"bg-red-950/30":"bg-green-950/30",p=r.type==="context"?"text-text-muted":r.type==="removed"?"text-red-400/70":"text-green-400/70",l=r.type==="context"?" ":r.type==="removed"?"-":"+",h=r.type==="removed"?"line-through decoration-red-400/30":"",f=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] ${d}`,children:[o.jsx("div",{className:f}),o.jsx("div",{className:"px-2 text-text-muted text-right select-none leading-[1.5rem]",children:c}),o.jsx("div",{className:`text-center select-none leading-[1.5rem] ${p}`,children:l}),o.jsx("div",{className:`pr-2 overflow-x-auto min-w-0 ${h}`,children:o.jsx(qa,{code:r.content||" ",language:i,variant:"inline"})})]})}),J5=U.memo(function({result:r,metadata:i,filePath:s,heightExpanded:c=!1}){const[d,p]=U.useState(!1),l=U.useMemo(()=>Wl(s),[s]),h=i==null?void 0:i.mimeType,f=i==null?void 0:i.base64Data;if(h!=null&&h.startsWith("image/")&&f){const b=`data:${h};base64,${f}`;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`rounded overflow-hidden border border-border ${c?"":"max-h-[45vh]"} flex items-center justify-center cursor-pointer hover:border-accent-primary transition-colors`,onClick:()=>p(!0),children:o.jsx("img",{src:b,alt:s,className:"max-w-full max-h-[45vh] object-contain"})}),o.jsx(D0,{src:b,alt:s,isOpen:d,onClose:()=>p(!1)})]})}if(!r)return o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"Empty file"});const g=r.split(`
|
|
133
|
-
`),m=g.filter(b=>!b.startsWith(`
|
|
134
|
-
[`)&&!b.startsWith("[")).map(b=>b.replace(/^\d+: /,"")).join(`
|
|
135
|
-
`);return o.jsx("div",{className:`rounded overflow-hidden border border-border ${c?"":"max-h-[45vh]"} overflow-y-auto`,children:o.jsxs("div",{className:"grid grid-cols-[2.5rem_1fr]",children:[o.jsx("div",{className:"bg-bg-tertiary text-text-muted text-xs font-mono text-right pr-2 select-none py-0.5",children:g.filter(b=>!b.startsWith(`
|
|
136
|
-
[`)&&!b.startsWith("[")).map((b,S)=>{const E=b.match(/^(\d+): /);return o.jsx("div",{className:"leading-[1.5rem]",children:E?E[1]:S+1},S)})}),o.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:o.jsx(qa,{code:m,language:l,variant:"block"})})]})})}),e3={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"}},Rv=U.memo(function({diagnostics:r}){if(r.length===0)return null;const i=r.filter(d=>d.severity==="error"),s=r.filter(d=>d.severity==="warning"),c=r.filter(d=>d.severity==="info"||d.severity==="hint");return o.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[o.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[o.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),i.length>0&&o.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[i.length," error",i.length!==1?"s":""]}),s.length>0&&o.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[s.length," warning",s.length!==1?"s":""]}),c.length>0&&o.jsxs("span",{className:"text-xs text-text-muted",children:[c.length," info"]})]}),o.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.map((d,p)=>{const l=e3[d.severity];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${l.bg} border-b border-border last:border-b-0`,children:[o.jsx("span",{className:`${l.color} text-xs flex-shrink-0 w-4 text-center`,children:l.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",d.range.start.line+1,":",d.range.start.character+1]}),d.code&&o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",d.code,"]"]})]}),o.jsx("div",{className:"text-xs text-text-primary break-words",children:d.message})]})]},p)})})]})}),t3=U.memo(function({command:r,timeout:i,startedAt:s,streamingOutput:c,status:d,result:p,error:l,durationMs:h}){const f=U.useRef(null),[g,m]=U.useState(0);U.useEffect(()=>{f.current&&d==="pending"&&(f.current.scrollTop=f.current.scrollHeight)},[c,d]),U.useEffect(()=>{if(d!=="pending"||!s)return;const C=setInterval(()=>{m(Date.now()-s)},100);return()=>clearInterval(C)},[d,s]);const b=i/1e3,S=d==="pending"?g/1e3:(h??0)/1e3,E=d==="pending"?(c==null?void 0:c.map(C=>C.content).join(""))??"":p??"";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:[d==="pending"&&o.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),d==="interrupted"&&o.jsx("span",{className:"text-red-400",children:"interrupted"}),o.jsxs("span",{className:d==="pending"?"text-text-secondary":"text-text-muted",children:[S.toFixed(1),"s / ",b,"s"]})]})]}),d==="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||d==="pending")&&o.jsx("pre",{ref:f,className:`text-xs bg-bg-primary p-2 rounded overflow-auto max-h-64 ${d==="pending"?"border border-accent-warning/30":""}`,children:d==="pending"&&c?c.map((C,x)=>o.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:kl(C.content)},x)):kl(E)}),d==="error"&&l&&o.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:l}),d!=="pending"&&h!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(h/1e3).toFixed(2),"s"]})]})});function n3(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 r3({confirmation:e}){const r=Ee(g=>g.confirmPath),i=Ee(g=>g.currentSession),s=Ee(g=>g.switchDangerLevel),{title:c,description:d}=n3(e.reason),p=e.reason==="sensitive_file"||e.reason==="both",l=p?"border-red-500/50":"border-amber-500/50",h=p?"bg-red-500/10":"bg-amber-500/10",f=()=>{i!=null&&i.id&&s("dangerous"),r(e.callId,!0,!1)};return o.jsxs("div",{className:`border ${l} ${h} 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 ${p?"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 ${p?"text-red-400":"text-amber-400"}`,children:c}),o.jsx("div",{className:"text-xs text-text-muted",children:d})]})]}),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 ${p?"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:f,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 i3(e,r){if(e==="read_file"){const s=String(r.path??""),c=r.offset,d=r.limit,p=[];return c!==void 0&&c!==1&&p.push(`offset=${c}`),d!==void 0&&p.push(`limit=${d}`),p.length>0?`${s} [${p.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 Mv(e,r,i){return i3(e,r)}function s3(e){return JSON.stringify(e,null,2)}const a3={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}},o3=U.memo(function({tool:r,args:i,status:s,variant:c="compact",result:d,error:p,durationMs:l,diagnostics:h,editContext:f,startedAt:g,streamingOutput:m,metadata:b,callId:S}){const E=r==="edit_file"||r==="write_file",C=r==="run_command"&&s==="pending",x=r==="read_file",_=r==="return_value",[v,y]=U.useState(E||C||_),j=a3[s],A=Ee(L=>L.pendingPathConfirmation),N=s==="pending"&&A&&S&&A.callId===S?A:null;return c==="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(T0,{tool:r}),o.jsx("span",{className:"text-accent-primary font-medium",children:r}),o.jsx("span",{className:"text-text-muted truncate flex-1",children:Mv(r,i)}),o.jsx("span",{className:`${j.color} ${j.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:()=>y(!v),children:[o.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:j.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:Mv(r,i)}),o.jsx("span",{className:"text-text-muted text-xs",children:v?"▼":"▶"})]}),N&&o.jsx(r3,{confirmation:N}),(v||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(t3,{command:String(i.command??""),timeout:i.timeout??12e4,startedAt:g,streamingOutput:m,status:s,result:d,error:p,durationMs:l}),r==="edit_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[f&&f.regions.length>0?o.jsx(K5,{regions:f.regions,filePath:String(i.path??"")}):o.jsx(V5,{oldString:String(i.old_string??""),newString:String(i.new_string??""),filePath:String(i.path??"")}),h&&h.length>0&&o.jsx(Rv,{diagnostics:h})]}),r==="write_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(Y5,{content:String(i.content??""),filePath:String(i.path??"")}),h&&h.length>0&&o.jsx(Rv,{diagnostics:h})]}),r==="read_file"&&s==="success"&&o.jsx(J5,{result:d,metadata:b,filePath:String(i.path??""),heightExpanded:v}),r==="return_value"&&(()=>{const L=(m==null?void 0:m.map(B=>B.content).join(""))??"",T=s==="pending"&&L?L: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(Ds,{content:T})})]})})(),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:s3(i)})]}),s==="success"&&d!==void 0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",l!==void 0&&` (${l}ms)`,":"]}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto max-h-32",children:d||"No output"})]})]}),s==="success"&&(r==="edit_file"||r==="write_file"||r==="read_file")&&l!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",l,"ms"]}),s==="error"&&p&&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:p})]})]})]})}),l3={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 c3(e){return l3[e]??`Preparing ${e}`}const u3=U.memo(function({name:r}){const i=c3(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(T0,{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,"..."]})]})})}),d3={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},h3=U.memo(function({todos:r}){return Array.isArray(r)?r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),o.jsx("div",{children:r.map((i,s)=>{const c=d3[i.status];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${s>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${(c==null?void 0:c.color)??"text-text-muted"} ${c!=null&&c.animate?"animate-pulse":""} text-sm leading-tight`,children:(c==null?void 0:c.icon)??"○"}),o.jsx("span",{className:`text-sm leading-tight ${i.status==="completed"?"text-text-muted":"text-text-primary"}`,children:i.content})]},s)})})]}):o.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),Ov={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"}},L0=U.memo(function({toolCalls:r,criteria:i}){if(r.length===0)return null;const s=new Map((i==null?void 0:i.map(c=>[c.id,c]))??[]);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:r.map((c,d)=>{const p=c.arguments.action,l=p&&Ov[p]?Ov[p]:{icon:"○",color:"text-text-muted"},h=c.arguments,f=h.id,g=h.description,m=f?s.get(f):void 0,b=g??(m==null?void 0:m.description)??"Criterion updated",S=h.reason,E=p==="remove",C=p==="fail";return 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:`${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:E?"line-through text-text-muted":"",children:o.jsx(Ds,{content:b})}),S&&o.jsxs("div",{className:`mt-1 text-sm ${C?"text-accent-error":"text-text-muted"}`,children:[o.jsx("span",{className:"text-text-muted",children:"└ "}),'"',S,'"']})]})]},c.id??d)})})]})});function f3(e){return e==="criterion"}const p3="#6b7280";function Al(e,r){var i;return((i=e.find(s=>s.id===r))==null?void 0:i.color)??p3}const rn=Xn((e,r)=>({agents:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await _e("/api/agents/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchAgents:async()=>{e({loading:!0});try{const s=await(await _e("/api/agents")).json();e({agents:s.agents??[],defaultIds:s.defaultIds??r().defaultIds,modifiedIds:s.modifiedIds??[],loading:!1})}catch{e({loading:!1})}},fetchAgent:async i=>{try{const s=await _e(`/api/agents/${i}`);return s.ok?await s.json():null}catch{return null}},createAgent:async i=>{try{const s=await _e("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?(await r().fetchAgents(),{success:!0}):{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},updateAgent:async(i,s)=>{try{const c=await _e(`/api/agents/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return c.ok?(await r().fetchAgents(),{success:!0}):{success:!1,error:(await c.json()).error}}catch{return{success:!1,error:"Network error"}}},deleteAgent:async i=>{try{return(await _e(`/api/agents/${i}`,{method:"DELETE"})).ok?(e({agents:r().agents.filter(c=>c.id!==i)}),!0):!1}catch{return!1}},restoreDefault:async i=>{try{return(await _e(`/api/agents/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchAgents(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await _e("/api/agents/restore-all-defaults",{method:"POST"})).ok?(await r().fetchAgents(),!0):!1}catch{return!1}}}));function m3(e){const r=[];let i=[];const s=()=>{i.length>0&&(r.push({type:"criteria_group",toolCalls:i}),i=[])};for(const c of e)c.type==="tool_call"&&f3(c.toolCall.name)?i.push(c.toolCall):(s(),r.push(c));return s(),r}function g3(e,r){if(e.segments&&e.segments.length>0)return x3(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 x3(e,r,i,s,c){const d=[],p=new Map(r.map(l=>[l.id,l]));for(const l of e)switch(l.type){case"text":d.push({type:"text",content:l.content});break;case"thinking":l.content&&l.content.trim().length>0&&d.push({type:"thinking",content:l.content});break;case"tool_call":{const h=p.get(l.toolCallId);h&&d.push({type:"tool_call",toolCall:h});break}}for(const l of i)d.push({type:"preparing_tool_call",preparing:l});return c&&s&&d.push({type:"stats",stats:s}),d}const Wh=U.memo(function({message:r,showStats:i=!0}){const s=Ee(l=>{var h;return(h=l.currentSession)==null?void 0:h.criteria}),c=rn(l=>l.agents),d=g3(r,i),p=m3(d);return p.length===0?null:o.jsx("div",{className:"feed-item",children:o.jsxs("div",{className:"min-w-0",children:[p.map((l,h)=>{var f,g;switch(l.type){case"thinking":return o.jsx(U5,{content:l.content},h);case"text":return o.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:o.jsx(Ds,{content:l.content})},h);case"preparing_tool_call":return o.jsx(u3,{name:l.preparing.name},`preparing-${l.preparing.index}`);case"tool_call":{const m=l.toolCall,b=m.result;if(m.name==="todo_write"){const C=m.arguments.todos,x=Array.isArray(C)?C:[];return o.jsx(h3,{todos:x},h)}const S=(f=b==null?void 0:b.output)==null?void 0:f.includes("[interrupted by user]"),E=b?S?"interrupted":b.success?"success":"error":"pending";return o.jsx(o3,{tool:m.name,args:m.arguments,status:E,variant:"expandable",result:b==null?void 0:b.output,error:b==null?void 0:b.error,durationMs:b==null?void 0:b.durationMs,diagnostics:b==null?void 0:b.diagnostics,editContext:b==null?void 0:b.editContext,startedAt:m.startedAt,streamingOutput:m.streamingOutput,metadata:b==null?void 0:b.metadata,callId:m.id},h)}case"criteria_group":return o.jsx(L0,{toolCalls:l.toolCalls,criteria:s},h);case"stats":{const m=l.stats,b=((g=m.model.split("/").pop())==null?void 0:g.split("-").slice(0,2).join("-"))??m.model,S=Al(c,m.mode),E=x=>x>=1e3?`${(x/1e3).toFixed(1)}k`:x.toString(),C=x=>x>=1e3?`${(x/1e3).toFixed(1)}k`:x.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:b}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("span",{style:{color:S},children:m.mode}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[m.totalTime.toFixed(1),"s"]}),m.toolTime>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[m.toolTime.toFixed(1),"s tools"]})]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[E(m.prefillTokens)," @ ",C(m.prefillSpeed)," pp"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[E(m.generationTokens)," @ ",C(m.generationSpeed)," tg"]}),o.jsx("span",{className:"flex-1 h-px bg-border"})]},h)}}}),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"})]})]})})}),Vt=Xn((e,r)=>({workflows:[],defaultIds:[],modifiedIds:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await _e("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchDefaultIds:async()=>{try{const s=await(await _e("/api/workflows/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await _e("/api/workflows")).json();e({workflows:s.workflows??[],activeWorkflowId:s.activeWorkflowId??"default",defaultIds:s.defaultIds??r().defaultIds,modifiedIds:s.modifiedIds??[],loading:!1})}catch{e({loading:!1})}},fetchWorkflow:async i=>{try{const s=await _e(`/api/workflows/${i}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async i=>{try{const s=await _e("/api/workflows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?(await r().fetchWorkflows(),{success:!0}):{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},updateWorkflow:async(i,s)=>{try{const c=await _e(`/api/workflows/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return c.ok?(await r().fetchWorkflows(),{success:!0}):{success:!1,error:(await c.json()).error}}catch{return{success:!1,error:"Network error"}}},deleteWorkflow:async i=>{try{return(await _e(`/api/workflows/${i}`,{method:"DELETE"})).ok?(e({workflows:r().workflows.filter(c=>c.id!==i)}),!0):!1}catch{return!1}},restoreDefault:async i=>{try{return(await _e(`/api/workflows/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchWorkflows(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await _e("/api/workflows/restore-all-defaults",{method:"POST"})).ok?(await r().fetchWorkflows(),!0):!1}catch{return!1}}}));function v3(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 b3(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Bv(e,r){const i=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),c=parseInt(e.slice(5,7),16);return`rgba(${i},${s},${c},${r})`}const y3=U.memo(function({data:r}){var c;const s=((c=Vt(d=>d.workflows).find(d=>d.id===r.workflowId))==null?void 0:c.color)??r.workflowColor??"#8b949e";return o.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:Bv(s,.3),backgroundColor:Bv(s,.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:s,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:s},children:r.workflowName??"Task Completed"})]}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:[o.jsx(Ra,{label:"Iterations",value:String(r.iterations)}),o.jsx(Ra,{label:"Total time",value:v3(r.totalTimeSeconds)}),o.jsx(Ra,{label:"Tool calls",value:String(r.totalToolCalls)}),o.jsx(Ra,{label:"Tokens",value:b3(r.totalTokensGenerated)}),o.jsx(Ra,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function Ra({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})]})}function Iv(e,r){const i=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),c=parseInt(e.slice(5,7),16);return`rgba(${i},${s},${c},${r})`}const _3=U.memo(function({data:r}){var c;const s=((c=Vt(d=>d.workflows).find(d=>d.id===r.workflowId))==null?void 0:c.color)??r.workflowColor??"#6b7280";return o.jsxs("div",{className:"feed-item flex items-center gap-2 px-3 py-2 rounded border",style:{borderColor:Iv(s,.3),backgroundColor:Iv(s,.08)},children:[o.jsx("svg",{className:"w-3 h-3 shrink-0",fill:s,viewBox:"0 0 24 24",children:o.jsx("path",{d:"M8 5v14l11-7z"})}),o.jsx("span",{className:"text-sm font-medium",style:{color:s},children:r.workflowName}),o.jsx("span",{className:"text-text-muted text-sm",children:"started"})]})});function S3({attachments:e,messageId:r}){const[i,s]=U.useState(null),c=Ee(g=>g.visionFallbackByMessage),d=Ee(g=>g.messages),p=U.useMemo(()=>{const g=d.findIndex(m=>m.id===r);if(g===-1)return null;for(let m=g+1;m<d.length;m++){const b=d[m];if(b&&b.role==="assistant")return b.id}return null},[d,r]),l=g=>{s(g)},h=()=>{s(null)},f=g=>{const m=`${r}-${g}`;if(c[m])return c[m];if(p){const b=`${p}-${g}`;return c[b]}return null};return e.length===0?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(g=>{const m=f(g.id);return o.jsxs("div",{className:"relative inline-block",children:[o.jsxs("button",{onClick:()=>l(g.data),className:"group relative inline-block",title:g.filename,disabled:(m==null?void 0:m.type)==="start",children:[o.jsx("img",{src:g.data,alt:g.filename,className:"max-w-[256px] max-h-[256px] object-contain rounded-lg border border-border hover:border-accent-primary transition-colors cursor-pointer"}),(m==null?void 0:m.type)==="start"&&o.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center rounded-lg",children:o.jsx("span",{className:"text-xs text-text-primary animate-pulse",children:"Describing image..."})})]}),(m==null?void 0:m.type)==="done"&&m.description&&o.jsxs("div",{className:"mt-2 p-2 bg-bg-tertiary rounded text-xs text-text-secondary max-w-[256px]",children:[m.description.slice(0,200),m.description.length>200?"...":""]})]},g.id)})}),i&&o.jsx(D0,{src:i,alt:"Attached image",isOpen:!0,onClose:h})]})}function w3({isOpen:e,onClose:r,promptContext:i}){const[s,c]=U.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),d=p=>{c(l=>({...l,[p]:!l[p]}))};return o.jsx(un,{isOpen:e,onClose:r,title:"Prompt Inspector",size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx(bs,{title:"User Message",expanded:s.userMessage??!0,onToggle:()=>d("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(bs,{title:`Prompt Messages (${i.messages.length})`,expanded:s.messages??!0,onToggle:()=>d("messages"),children:o.jsx("div",{className:"space-y-2",children:i.messages.map((p,l)=>o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-bg-tertiary/50 text-xs text-text-muted",children:[o.jsx("span",{className:"font-mono text-text-primary",children:p.role}),o.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:p.source}),p.toolCallId&&o.jsx("span",{className:"font-mono",children:p.toolCallId}),p.attachments&&p.attachments.length>0&&o.jsxs("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:[p.attachments.length," attachment",p.attachments.length===1?"":"s"]})]}),p.attachments&&p.attachments.length>0&&o.jsx("div",{className:"border-b border-border px-3 py-2 text-xs text-text-muted",children:p.attachments.map(h=>h.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:p.content||"(empty)"})]},`${p.role}-${l}`))})}),o.jsx(bs,{title:`Tools (${i.tools.length})`,expanded:s.tools??!0,onToggle:()=>d("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((p,l)=>o.jsxs("div",{className:"bg-bg-tertiary rounded p-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"font-mono text-sm text-text-primary",children:p.name}),o.jsx("span",{className:"text-xs text-text-muted",children:"parameters"})]}),o.jsx("div",{className:"text-sm text-text-secondary",children:p.description}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-48 overflow-auto font-mono",children:JSON.stringify(p.parameters,null,2)})]},`${p.name}-${l}`))]})}),o.jsx(bs,{title:"Request Options",expanded:s.requestOptions??!0,onToggle:()=>d("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(bs,{title:`Injected Files (${i.injectedFiles.length})`,expanded:s.injectedFiles??!0,onToggle:()=>d("injectedFiles"),children:o.jsx("div",{className:"space-y-2",children:i.injectedFiles.map((p,l)=>o.jsx(C3,{file:p,expanded:s[`file-${l}`]??!1,onToggle:()=>d(`file-${l}`)},l))})}),o.jsx(bs,{title:"System Prompt",expanded:s.systemPrompt??!1,onToggle:()=>d("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 C3({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 bs({title:e,expanded:r,onToggle:i,badge:s,children:c}){return o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsx("button",{onClick:i,className:"w-full flex items-center justify-between p-3 bg-bg-tertiary/50 hover:bg-bg-tertiary transition-colors",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("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:c})]})}function k3({content:e,promptContext:r,align:i="right"}){const[s,c]=U.useState(!1),[d,p]=U.useState(!1),[l,h]=U.useState(!1),f=U.useRef(null);U.useEffect(()=>{const b=S=>{f.current&&!f.current.contains(S.target)&&c(!1)};return s&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]);const g=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const b=document.createElement("textarea");b.value=e,b.style.position="fixed",b.style.left="-999999px",document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b)}h(!0),c(!1),window.setTimeout(()=>h(!1),1500)}catch(b){console.error("Failed to copy:",b)}},m=i==="right";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`flex items-start gap-1.5 ${m?"":"order-first"}`,children:[l&&o.jsx("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:f,className:"relative",children:[o.jsx("button",{onClick:()=>c(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:o.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:()=>{p(!0),c(!1)},className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[o.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(w3,{isOpen:d,onClose:()=>p(!1),promptContext:r})]})}function E3({message:e}){const[r,i]=U.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,c=(s==null?void 0:s.color)??"#6b7280",d=(s==null?void 0:s.name)??"Agent",p=(s==null?void 0:s.type)??"agent",h={agent:"definition injected",workflow:"instructions",compaction:"prompt injected",subagent:"instructions"}[p]??"injected",f=p==="workflow"||p==="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 ${f?"":"cursor-pointer"}`,style:{backgroundColor:c},onClick:()=>!f&&i(!0)}),o.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:c},onClick:()=>!f&&i(!0),children:d}),o.jsx("span",{children:"·"}),o.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!f&&i(!0),children:h}),o.jsx("span",{className:"flex-1 h-px bg-border"})]}),f&&o.jsx("div",{className:"flex justify-center feed-item mb-4",children:o.jsx("div",{className:"max-w-[75%] rounded p-3 bg-bg-tertiary/50 text-text-secondary text-sm",style:{borderLeft:`3px solid ${c}`},children:o.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),o.jsx(un,{isOpen:r,onClose:()=>i(!1),title:`${d} Prompt`,size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:c}}),o.jsx("span",{className:"text-sm text-text-primary font-medium",children:d}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",p,")"]})]}),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 j3({message:e,promptContext:r}){const i=e.messageKind==="auto-prompt",s=e.messageKind==="command",c=e.isSystemGenerated;return o.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!c&&o.jsx(k3,{content:e.content,promptContext:r,align:"right"}),o.jsxs("div",{className:`max-w-[75%] rounded p-2 ${c?s?"bg-teal-500/10 border border-teal-500/30":i?"bg-slate-500/10 border border-slate-500/30":"bg-amber-500/10 border border-amber-500/30":"bg-accent-primary/15 text-white"}`,children:[c&&o.jsx("span",{className:`text-[10px] block mb-0.5 ${s?"text-teal-400":i?"text-slate-400":"text-amber-400"}`,children:s?"Command":i?"Auto":"System"}),o.jsx("div",{className:`whitespace-pre-wrap text-sm ${c?`${s?"text-teal-200":i?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&o.jsx(S3,{attachments:e.attachments,messageId:e.id})]})]})}const R0=U.memo(function({message:r,isLastAssistantMessage:i=!1,promptContext:s}){const c=r.role==="user",d=r.role==="assistant",p=r.role==="system",l=r.role==="tool";if(d)return o.jsx(Wh,{message:r,showStats:i});if(p&&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]
|
|
137
|
-
`,"")})]});if(l)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[o.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",r.toolName]}),o.jsxs("pre",{className:"text-text-secondary text-xs whitespace-pre-wrap overflow-x-auto max-h-32",children:[r.content.slice(0,500),r.content.length>500&&"..."]})]});if(l)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[o.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",r.toolName]}),o.jsxs("pre",{className:"text-text-secondary text-xs whitespace-pre-wrap overflow-x-auto max-h-32",children:[r.content.slice(0,500),r.content.length>500&&"..."]})]});if(r.messageKind==="workflow-started")try{const h=JSON.parse(r.content);return o.jsx(_3,{data:h})}catch{}if(r.messageKind==="task-completed")try{const h=JSON.parse(r.content);return o.jsx(y3,{data:h})}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(E3,{message:r}):c?o.jsx(j3,{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(Ds,{content:r.content})})})}),N3={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function T3(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}const A3=U.memo(function({messages:r,subAgentType:i,isStreaming:s}){const c=U.useRef(null),d=U.useRef(null),[p,l]=U.useState(!1),[h,f]=U.useState(!1),g=rn(y=>y.agents),m=U.useCallback(()=>{const y=!h;f(y),y&&setTimeout(()=>{var j;(j=c.current)==null||j.scrollIntoView({block:"start",behavior:"smooth"})},220)},[h]),b=U.useCallback(()=>{const y=d.current;y&&(y.scrollTop=y.scrollHeight)},[]),S=U.useCallback(y=>{const j=d.current;j&&(y.deltaY<0?l(!0):y.deltaY>0&&p&&requestAnimationFrame(()=>{j.scrollHeight-j.scrollTop-j.clientHeight<50&&l(!1)}))},[p]);U.useEffect(()=>{p||b()},[r,p,b]),U.useEffect(()=>{s||l(!1)},[s]);const E=g.find(y=>y.id===i),C=(E==null?void 0:E.name)??N3[i]??i,x=Al(g,i),_=T3(x),v=r.filter(y=>y.role!=="tool");return o.jsxs("div",{ref:c,className:"feed-item border border-border rounded overflow-hidden bg-bg-secondary",children:[o.jsxs("button",{className:"w-full flex items-center justify-between px-2 py-1 text-xs font-medium border-b hover:opacity-80 transition-opacity",style:_,onClick:m,children:[o.jsx("span",{children:C}),o.jsx("span",{className:"text-[10px]",children:h?"▼":"▶"})]}),o.jsx("div",{ref:d,onWheel:S,className:`${h?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:v.map(y=>y.role==="assistant"?o.jsx(Wh,{message:y,showStats:!0},y.id):o.jsx(R0,{message:y,isLastAssistantMessage:!1},y.id))})]})});function D3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function L3({isOpen:e,onClose:r,initialEditId:i}){const s=rn(fe=>fe.agents),c=rn(fe=>fe.modifiedIds),d=rn(fe=>fe.loading),p=rn(fe=>fe.fetchAgents),l=rn(fe=>fe.fetchAgent),h=rn(fe=>fe.createAgent),f=rn(fe=>fe.updateAgent),g=rn(fe=>fe.deleteAgent),m=rn(fe=>fe.restoreDefault),b=rn(fe=>fe.restoreAllDefaults),[S,E]=U.useState("list"),[C,x]=U.useState(null),[_,v]=U.useState(null),[y,j]=U.useState(""),[A,N]=U.useState(""),[L,T]=U.useState(""),[B,H]=U.useState(!0),[W,Y]=U.useState([]),[$,I]=U.useState("#6b7280"),[P,V]=U.useState(""),[Z,ee]=U.useState(""),[R,D]=U.useState(!1),[O,q]=U.useState(null),[F,K]=U.useState(!1),[te,Q]=U.useState([]);function X(fe){const Re=new Map;for(const Je of fe){const et=Je.indexOf(":");if(et===-1)Re.set(Je,new Set);else{const Ge=Je.slice(0,et),de=Je.slice(et+1).split(",").filter(Boolean);Re.set(Ge,new Set(de))}}return Re}function z(fe){const Re=[];for(const[Je,et]of fe)et.size===0?Re.push(Je):Re.push(`${Je}:${[...et].join(",")}`);return Re}const ae=X(W),se=(fe,Re)=>{const Je=new Map(ae),et=Je.get(fe)||new Set,Ge=new Set(et);Ge.has(Re)?Ge.delete(Re):Ge.add(Re),Ge.size===0?Je.set(fe,new Set):Je.set(fe,Ge),Y(z(Je))};U.useEffect(()=>{e&&(p(),_e("/api/tools").then(fe=>fe.json()).then(fe=>Q(fe.tools||[])).catch(()=>Q([])),v(null),q(null),K(!1),i?(E("edit"),x(i),ee(""),l(i).then(fe=>{fe&&(j(fe.metadata.name),N(fe.metadata.id),T(fe.metadata.description),H(fe.metadata.subagent),Y(fe.metadata.allowedTools),I(fe.metadata.color??"#6b7280"),V(fe.prompt))})):(E("list"),x(null)))},[e,p,l,i]);const ge=()=>{x(null),j(""),N(""),T(""),H(!0),Y(["read_file"]),I("#6b7280"),V(""),ee(""),E("edit")},ve=async fe=>{const Re=await l(fe);Re&&(x(fe),j(Re.metadata.name),N(Re.metadata.id),T(Re.metadata.description),H(Re.metadata.subagent),Y(Re.metadata.allowedTools),I(Re.metadata.color??"#6b7280"),V(Re.prompt),ee(""),E("edit"))},Ne=async fe=>{await g(fe),v(null)},De=async()=>{const fe=C??A;if(!fe||!y||!P){ee("Name and prompt are required.");return}D(!0),ee("");const Re={metadata:{id:fe,name:y,description:L,subagent:B,allowedTools:W,color:$},prompt:P},Je=C?await f(C,Re):await h(Re);if(D(!1),!Je.success){ee(Je.error??"Failed to save agent.");return}i?r():E("list")},Oe=()=>{i?r():E("list")},Fe=fe=>{j(fe),C||N(D3(fe))},ke=fe=>{const Re=new Map(ae);Re.has(fe)?Re.delete(fe):Re.set(fe,new Set),Y(z(Re))};if(S==="edit")return o.jsx(un,{isOpen:e,onClose:Oe,title:C?"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:[Z&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:Z}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),o.jsx("input",{value:y,onChange:fe=>Fe(fe.target.value),placeholder:"My Agent",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"})]}),o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["ID ",C&&o.jsx("span",{className:"text-text-muted",children:"(read-only)"})]}),o.jsx("input",{value:A,onChange:fe=>!C&&N(fe.target.value),readOnly:!!C,placeholder:"my_agent",className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary ${C?"opacity-60":""}`})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Description"}),o.jsx("input",{value:L,onChange:fe=>T(fe.target.value),placeholder:"What this agent does",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"})]}),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:()=>H(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${B?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"}`,children:"Sub-agent"}),o.jsx("button",{onClick:()=>H(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${B?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"}`,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:$,onChange:fe=>I(fe.target.value),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:te.map(fe=>{const Re=ae.has(fe.name),Je=fe.actions.length>0,et=ae.get(fe.name)||new Set,Ge=o.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Re?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"}`,children:[o.jsx("span",{children:fe.name}),Je&&o.jsx("span",{className:`text-[10px] ${Re&&et.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},fe.name);return Je?o.jsx(Ga,{trigger:Ge,minWidth:"160px",items:[...fe.actions.map(ct=>({label:o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${fe.name}-${ct}`,children:[o.jsx("input",{type:"checkbox",id:`${fe.name}-${ct}`,checked:et.has(ct),onChange:()=>se(fe.name,ct),className:"w-3 h-3 rounded accent-accent-primary"}),o.jsx("span",{children:ct})]}),closeOnClick:!1})),{label:Re?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(Re)ke(fe.name);else{const ct=new Map(ae);ct.set(fe.name,new Set(fe.actions)),Y(z(ct))}}}]},fe.name):o.jsx("button",{onClick:()=>ke(fe.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Re?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"}`,children:o.jsx("span",{children:fe.name})},fe.name)})})]})]}),o.jsxs("div",{className:"flex-1 min-h-[150px] mt-5 overflow-hidden",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:P,onChange:fe=>V(fe.target.value),placeholder:"Instructions for this agent...",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"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-5 border-t border-border flex-shrink-0",children:[o.jsx(dt,{variant:"secondary",onClick:Oe,children:"Cancel"}),o.jsx(dt,{variant:"primary",onClick:De,disabled:R||!y||!P,children:R?"Saving...":"Save"})]})]})});const lt=s.filter(fe=>fe.subagent),ht=s.filter(fe=>!fe.subagent);return o.jsxs(un,{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.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[c.length>0&&(F?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await b(),K(!1)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Confirm"}),o.jsx("button",{onClick:()=>K(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:()=>K(!0),className:"px-2 py-1 rounded text-xs text-text-muted hover:text-amber-400 hover:bg-amber-500/10 transition-colors",title:"Restore all agents to defaults",children:"Restore Defaults"})),o.jsx(dt,{variant:"primary",size:"sm",onClick:ge,children:"+ New"})]})]}),d&&s.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):s.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No agents defined."}):o.jsxs("div",{className:"space-y-4",children:[ht.length>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Top-level"}),o.jsx("div",{className:"space-y-2",children:ht.map(fe=>o.jsx(zv,{agent:fe,confirmDeleteId:_,isModified:c.includes(fe.id),confirmRestoreId:O,onRestore:async()=>{await m(fe.id),q(null)},onConfirmRestore:()=>q(fe.id),onCancelRestore:()=>q(null),onEdit:()=>ve(fe.id),onDelete:()=>Ne(fe.id),onConfirmDelete:()=>v(fe.id),onCancelDelete:()=>v(null)},fe.id))})]}),lt.length>0&&o.jsxs("div",{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:lt.map(fe=>o.jsx(zv,{agent:fe,confirmDeleteId:_,isModified:c.includes(fe.id),confirmRestoreId:O,onRestore:async()=>{await m(fe.id),q(null)},onConfirmRestore:()=>q(fe.id),onCancelRestore:()=>q(null),onEdit:()=>ve(fe.id),onDelete:()=>Ne(fe.id),onConfirmDelete:()=>v(fe.id),onCancelDelete:()=>v(null)},fe.id))})]})]})]})}function zv({agent:e,confirmDeleteId:r,isModified:i,confirmRestoreId:s,onRestore:c,onConfirmRestore:d,onCancelRestore:p,onEdit:l,onDelete:h,onConfirmDelete:f,onCancelDelete:g}){return 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:"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}),i&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]}),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(m=>o.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:m},m)),e.allowedTools.length>5&&o.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[i&&(s===e.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:c,className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Restore"}),o.jsx("button",{onClick:p,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:d,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",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:"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(ri,{onClick:l}),r===e.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:h,className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs hover:bg-accent-error/30 transition-colors",children:"Delete"}),o.jsx("button",{onClick:g,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:f,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete agent",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 R3(){const e=Ee(C=>{var x;return(x=C.currentSession)==null?void 0:x.mode}),r=Ee(C=>C.switchMode),i=rn(C=>C.agents),s=rn(C=>C.fetchAgents),[c,d]=U.useState(!1),[p,l]=U.useState(!1),[h,f]=U.useState(null),g=U.useRef(null);if(U.useEffect(()=>{s()},[s]),U.useEffect(()=>{function C(x){g.current&&!g.current.contains(x.target)&&d(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]),!e)return null;const m=i.filter(C=>!C.subagent),b=m.find(C=>C.id===e),S=(b==null?void 0:b.name)??e,E=Al(i,e);return o.jsxs("div",{className:"relative",ref:g,children:[o.jsxs("button",{type:"button",onClick:()=>d(!c),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:E},children:S}),o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${c?"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"})})]}),c&&m.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:[m.map(C=>{const x=C.id===e,_=Al(i,C.id);return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${x?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[o.jsxs("button",{type:"button",onClick:()=>{x||r(C.id),d(!1)},className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"font-medium",style:{color:_},children:C.name}),x&&o.jsx("svg",{className:"w-3.5 h-3.5 text-text-muted ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),o.jsx(ri,{className:"opacity-0 group-hover:opacity-100",onClick:v=>{v.stopPropagation(),d(!1),f(C.id),l(!0)}})]},C.id)}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:()=>{d(!1),l(!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(L3,{isOpen:p,onClose:()=>{l(!1),f(null)},initialEditId:h})]})}function M3(){const e=Ee(s=>s.currentSession),r=Ee(s=>s.switchDangerLevel);if(!e)return null;const i=e.dangerLevel??"normal";return o.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[o.jsx("button",{type:"button",onClick:()=>r("normal"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="normal"?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Normal mode - requires path confirmation",children:"Normal"}),o.jsx("button",{type:"button",onClick:()=>r("dangerous"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="dangerous"?"bg-red-500/20 text-red-400":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Dangerous mode - bypasses all confirmations",children:"Dangerous"})]})}function O3({question:e}){const r=Ee(f=>f.answerQuestion),i=U.useRef(null),s=U.useRef(null),[c,d]=U.useState(""),p=U.useCallback(f=>{f.key},[]);U.useEffect(()=>{var f;return s.current=document.activeElement,(f=i.current)==null||f.focus(),document.body.style.overflow="hidden",()=>{var g;(g=s.current)==null||g.focus(),document.body.style.overflow=""}},[]),U.useEffect(()=>(document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)),[p]);const l=()=>{r(e.callId,c)},h=f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),l())};return ch.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"}),o.jsxs("div",{ref:i,tabIndex:-1,className:"relative w-full max-w-[90vw] md:max-w-md bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]",children:[o.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-5 h-5 text-text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.592.115-1.207.532-1.207 1.093 0 .56.41.978 1.002 1.093 1.728.332 3.006 1.507 3.006 2.907 0 1.657-1.79 3-4 3-1.742 0-3.223-.835-3.772-2m-3.772 2v-2m1.772-12h1.594l1.414 1.414M3 12h.01M21 12h.01M12 3v2m0 14v2M3 6h.01M21 6h.01M3 18h.01M21 18h.01"})}),o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Question from Agent"})]})}),o.jsxs("div",{className:"p-4 overflow-y-auto flex-1 min-h-0 space-y-4",children:[o.jsx("p",{className:"text-sm text-text-primary",children:e.question}),o.jsx("textarea",{value:c,onChange:f=>d(f.target.value),onKeyDown:h,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:"px-4 py-3 border-t border-border flex justify-end gap-2 flex-shrink-0",children:[o.jsx(dt,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),o.jsx(dt,{variant:"primary",size:"sm",onClick:l,children:"Send Answer"})]})]})]}),document.body)}function B3(){const e=sS(),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 I3({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("button",{onClick:()=>r(e.id),className:"absolute -top-2 -right-2 w-5 h-5 bg-accent-error text-white rounded-full flex items-center justify-center hover:bg-accent-error/80 transition-colors","aria-label":`Remove ${e.filename}`,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:"M6 18L18 6M6 6l12 12"})})}),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 z3({history:e,selectedIndex:r,onSelect:i,onEscape:s,onNavigate:c}){const d=U.useRef(null),p=U.useRef(null);U.useEffect(()=>{p.current&&d.current&&p.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[r]);const l=f=>{switch(f.key){case"Enter":f.preventDefault(),e[r]&&i(e[r].content);break;case"Escape":f.preventDefault(),s();break;case"ArrowUp":f.preventDefault(),c("up");break;case"ArrowDown":f.preventDefault(),c("down");break}},h=f=>{i(f)};return o.jsx("div",{ref:d,role:"list",className:"mb-2 p-2 bg-bg-secondary border border-border rounded-lg overflow-y-auto max-h-64",onKeyDown:l,children:e.map((f,g)=>o.jsxs("div",{ref:g===r?p:null,role:"listitem",onClick:()=>h(f.content),className:`
|
|
138
|
-
p-2 rounded cursor-pointer transition-colors
|
|
139
|
-
${g===r?"bg-accent-primary/20 border border-accent-primary":"hover:bg-bg-tertiary"}
|
|
140
|
-
`,children:[o.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[f.formattedTimestamp,f.sessionName&&o.jsxs(o.Fragment,{children:[" | ",o.jsx("span",{className:"text-accent-primary font-medium",children:f.sessionName})]})]}),o.jsx("div",{className:"text-sm text-text-primary mt-1",children:f.trimmedContent})]},f.id))})}const H3={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function Bd(e,r={}){const i={...H3,...r};if(!e.type.startsWith("image/"))throw new Error("File is not an image");if(!["image/png","image/jpeg","image/gif"].includes(e.type))throw new Error(`Unsupported image format: ${e.type}. Only PNG, JPG, and GIF are supported.`);if(e.size<=i.maxSizeBytes){const c=await e.arrayBuffer(),d=G3(c),p=`data:${e.type};base64,${d}`,l=await M0(p);return{dataUrl:p,mimeType:e.type,size:e.size,width:l.width,height:l.height}}return await P3(e,i)}async function P3(e,r){const i=await U3(e),s=await M0(i),{width:c,height:d}=F3(s.width,s.height,r.maxWidth,r.maxHeight),p=$3();p.width=c,p.height=d;const l=p.getContext("2d");if(!l)throw new Error("Failed to get canvas context");l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(s,0,0,c,d);let h=r.quality,f;do{if(f=p.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,h),Hv(f)<=r.maxSizeBytes||h<=.3)break;h-=.1}while(!0);const g=Hv(f);return{dataUrl:f,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:c,height:d}}function F3(e,r,i,s){const c=e/r;return e>r&&e>i?{width:i,height:Math.round(i/c)}:r>e&&r>s?{width:Math.round(s*c),height:s}:{width:e,height:r}}function U3(e){return new Promise((r,i)=>{const s=W3(),c=new s;c.onload=()=>r(c.result),c.onerror=()=>i(new Error("Failed to read file")),c.readAsDataURL(e)})}function M0(e){return new Promise((r,i)=>{const s=q3(),c=new s;c.onload=()=>r(c),c.onerror=()=>i(new Error("Failed to load image")),c.src=e})}function $3(){var r;const e=Gh();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function q3(){const e=Gh();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function W3(){const e=Gh();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function Gh(){return globalThis}function G3(e){const r=new Uint8Array(e);let i="";for(let s=0;s<r.byteLength;s++){const c=r[s];c!==void 0&&(i+=String.fromCharCode(c))}return btoa(i)}function Hv(e){const i=e.split(",")[1];return i?Math.round(i.length*3/4):0}function Id(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function zd(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${Pv(e.size)}). Maximum size is ${Pv(r)}.`}:{valid:!0}}function Pv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function V3(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 Y3({isOpen:e,onClose:r,providerId:i,model:s}){const[c,d]=U.useState(s.contextWindow),[p,l]=U.useState(!1),h=Ht(m=>m.updateModelContext);if(U.useEffect(()=>{d(s.contextWindow)},[s]),!e)return null;const f=async()=>{c<1024||c>1e7||(l(!0),await h(i,s.id,c),l(!1),r())},g=()=>{d(s.contextWindow),r()};return o.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-bg-secondary rounded-lg shadow-xl max-w-md w-full mx-4 border border-border",children:[o.jsx("div",{className:"px-6 py-4 border-b border-border",children:o.jsx("h3",{className:"text-lg font-medium text-text-primary",children:"Model Properties"})}),o.jsxs("div",{className:"px-6 py-4 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",children:s.id})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Context Window"}),o.jsx("input",{type:"number",min:1024,max:1e7,value:c,onChange:m=>d(parseInt(m.target.value)||0),className:"w-full bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary focus:outline-none focus:border-accent-primary"}),o.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Range: 1,024 - 10,000,000 tokens"})]}),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",children:[s.source==="backend"&&"Auto-detected from backend",s.source==="user"&&"Manually set",s.source==="default"&&"Default value"]})]})]}),o.jsxs("div",{className:"px-6 py-4 border-t border-border flex justify-end gap-3",children:[o.jsx("button",{type:"button",onClick:g,disabled:p,className:"px-4 py-2 text-text-secondary hover:text-text-primary transition-colors disabled:opacity-50",children:"Cancel"}),o.jsx("button",{type:"button",onClick:f,disabled:p||c<1024||c>1e7,className:"px-4 py-2 bg-accent-primary text-white rounded hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed",children:p?"Saving...":"Save"})]})]})})}function K3(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function X3(){var I;const[,e]=sr(),r=Ee(P=>P.currentSession),i=Ee(P=>P.setSessionProvider),[s,c]=U.useState(!1),[d,p]=U.useState([]),[l,h]=U.useState(null),f=U.useRef(null),[g,m]=U.useState(null),b=U.useRef(new Set),S=Ht(P=>P.providers),E=Ht(P=>P.activeProviderId),C=Ht(P=>P.model);Ht(P=>P.backend);const x=Ht(P=>P.llmStatus),_=Ht(P=>P.activating),v=Ht(P=>P.activateProvider),y=Ht(P=>P.refreshModel),j=Ht(P=>P.refreshProviderModels);U.useEffect(()=>{function P(V){f.current&&!f.current.contains(V.target)&&(c(!1),p([]),b.current=new Set)}return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]),U.useEffect(()=>{if(s){const P=S.map(V=>V.id);p(P),P.forEach(V=>{b.current.has(V)||(b.current.add(V),L(V))})}},[s,S]),S.find(P=>P.id===E);const A=x==="disconnected",N=C?((I=C.split("/").pop())==null?void 0:I.replace(/-/g," "))??C:"detecting...",L=async P=>{h(P);try{await j(P)}catch{}finally{h(null)}},T=async P=>{if(P.id===E){d.includes(P.id)?p(d.filter(V=>V!==P.id)):(p([...d,P.id]),L(P.id));return}r?(i(P.id,void 0),Ht.getState().syncFromSession(P.id,""),c(!1),p([])):await v(P.id)&&(c(!1),p([]))},B=P=>{d.includes(P.id)?p(d.filter(V=>V!==P.id)):(p([...d,P.id]),L(P.id))},H=async(P,V)=>{P.stopPropagation(),b.current.delete(V),await j(V),await L(V)},W=(P,V)=>{m({providerId:P,model:V})},Y=()=>{m(null)},$=async(P,V)=>{if(console.log("[ProviderSelector.handleModelClick] providerId:",P,"model:",V),r){console.log("[ProviderSelector.handleModelClick] Calling setSessionProvider"),i(P,V),Ht.getState().syncFromSession(P,V),p([]),c(!1);return}h("activating");try{(await _e(`/api/providers/${P}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:V})})).ok&&(await Ht.getState().fetchConfig(),p([]),c(!1))}catch{}finally{h(null)}};return S.length===0?o.jsxs("button",{type:"button",onClick:()=>y(),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:f,children:[o.jsxs("button",{type:"button",onClick:()=>c(!s),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:"Click to switch provider or model",children:[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:S.map(P=>{var V;return o.jsxs("div",{children:[o.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${P.id===E?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${_?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[o.jsxs("div",{onClick:()=>!_&&T(P),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[o.jsx("span",{className:`text-sm font-medium truncate ${P.id===E?"text-accent-primary":"text-text-primary"}`,children:P.name}),o.jsx("span",{className:"text-xs text-text-muted truncate",children:P.backend!=="auto"&&U1(P.backend)})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[P.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(),H(Z,P.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:o.jsx("svg",{className:`w-4 h-4 ${l===P.id?"animate-spin":""} ${P.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(),B(P)},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 ${d.includes(P.id)?"rotate-180":""} ${P.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"})})})]})]}),d.includes(P.id)&&o.jsx("div",{className:"bg-bg-primary border-t border-border",children:l===P.id?o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(V=P.models)!=null&&V.length?P.models.map(Z=>{var ee;return o.jsxs("button",{type:"button",onClick:()=>$(P.id,Z.id),disabled:l==="activating",className:`w-full px-4 py-1.5 text-left hover:bg-bg-tertiary transition-colors text-sm flex items-center justify-between group ${l==="activating"?"opacity-50 cursor-wait":""} ${C===Z.id?"text-accent-primary":"text-text-secondary"}`,children:[o.jsx("span",{className:"truncate flex-1",children:((ee=Z.id.split("/").pop())==null?void 0:ee.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:K3(Z.contextWindow)}),o.jsx("button",{type:"button",onClick:R=>{R.stopPropagation(),W(P.id,Z)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-bg-tertiary rounded transition-opacity",title:"Edit model context",children:o.jsx("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"})})]},P.id)})}),o.jsx("div",{className:"border-t border-border px-3 py-2",children:o.jsx("button",{onClick:()=>e("/onboarding"),className:"text-xs text-accent-primary hover:underline",children:"Manage providers"})})]}),g&&o.jsx(Y3,{isOpen:!0,onClose:Y,providerId:g.providerId,model:g.model})]})}const Tn=Xn((e,r)=>({commands:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await _e("/api/commands/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchCommands:async()=>{e({loading:!0});try{const s=await(await _e("/api/commands")).json();e({commands:s.commands??[],defaultIds:s.defaultIds??r().defaultIds,modifiedIds:s.modifiedIds??[],loading:!1})}catch{e({loading:!1})}},fetchCommand:async i=>{try{const s=await _e(`/api/commands/${i}`);return s.ok?await s.json():null}catch{return null}},createCommand:async i=>{try{const s=await _e("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?(await r().fetchCommands(),{success:!0}):{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},updateCommand:async(i,s)=>{try{const c=await _e(`/api/commands/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return c.ok?(await r().fetchCommands(),{success:!0}):{success:!1,error:(await c.json()).error}}catch{return{success:!1,error:"Network error"}}},deleteCommand:async i=>{try{return(await _e(`/api/commands/${i}`,{method:"DELETE"})).ok?(e({commands:r().commands.filter(c=>c.id!==i)}),!0):!1}catch{return!1}},restoreDefault:async i=>{try{return(await _e(`/api/commands/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchCommands(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await _e("/api/commands/restore-all-defaults",{method:"POST"})).ok?(await r().fetchCommands(),!0):!1}catch{return!1}}}));function Z3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function O0({isOpen:e,onClose:r,initialEditId:i}){const s=Tn(z=>z.commands),c=Tn(z=>z.modifiedIds),d=Tn(z=>z.loading),p=Tn(z=>z.fetchCommands),l=Tn(z=>z.fetchCommand),h=Tn(z=>z.createCommand),f=Tn(z=>z.updateCommand),g=Tn(z=>z.deleteCommand),m=Tn(z=>z.restoreDefault),b=Tn(z=>z.restoreAllDefaults),[S,E]=U.useState("list"),[C,x]=U.useState(null),[_,v]=U.useState(null),y=rn(z=>z.agents),j=rn(z=>z.fetchAgents),A=y.filter(z=>!z.subagent),[N,L]=U.useState(""),[T,B]=U.useState(""),[H,W]=U.useState(""),[Y,$]=U.useState(""),[I,P]=U.useState(""),[V,Z]=U.useState(!1),[ee,R]=U.useState(null),[D,O]=U.useState(!1);U.useEffect(()=>{e&&(p(),j(),v(null),R(null),O(!1),i?(E("edit"),x(i),P(""),l(i).then(z=>{z&&(L(z.metadata.name),B(z.metadata.id),W(z.prompt),$(z.metadata.agentMode??""))})):(E("list"),x(null)))},[e,p,j,l,i]);const q=()=>{x(null),L(""),B(""),W(""),$(""),P(""),E("edit")},F=async z=>{const ae=await l(z);ae&&(x(z),L(ae.metadata.name),B(ae.metadata.id),W(ae.prompt),$(ae.metadata.agentMode??""),P(""),E("edit"))},K=async z=>{await g(z),v(null)},te=async()=>{const z=C??T;if(!z||!N||!H){P("Name and message are required.");return}Z(!0),P("");const ae={metadata:{id:z,name:N,...Y?{agentMode:Y}:{}},prompt:H},se=C?await f(C,ae):await h(ae);if(Z(!1),!se.success){P(se.error??"Failed to save command.");return}i?r():E("list")},Q=()=>{i?r():E("list")},X=z=>{L(z),C||B(Z3(z))};return S==="edit"?o.jsx(un,{isOpen:e,onClose:Q,title:C?"Edit Command":"New Command",size:"xl",children:o.jsxs("div",{className:"space-y-3",children:[I&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:I}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),o.jsx("input",{value:N,onChange:z=>X(z.target.value),placeholder:"My Command",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"})]}),o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["ID ",C&&o.jsx("span",{className:"text-text-muted",children:"(read-only)"})]}),o.jsx("input",{value:T,onChange:z=>!C&&B(z.target.value),readOnly:!!C,placeholder:"my-command",className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary ${C?"opacity-60":""}`})]})]}),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:Y,onChange:z=>$(z.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)"}),A.map(z=>o.jsx("option",{value:z.id,children:z.name},z.id))]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),o.jsx("textarea",{value:H,onChange:z=>W(z.target.value),placeholder:"The message that will be sent when this command is triggered...",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"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[o.jsx(dt,{variant:"secondary",onClick:Q,children:"Cancel"}),o.jsx(dt,{variant:"primary",onClick:te,disabled:V||!N||!H,children:V?"Saving...":"Save"})]})]})}):o.jsxs(un,{isOpen:e,onClose:r,title:"Commands",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:"Commands are pre-defined messages you can send with a single click."}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[c.length>0&&(D?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await b(),O(!1)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Confirm"}),o.jsx("button",{onClick:()=>O(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:()=>O(!0),className:"px-2 py-1 rounded text-xs text-text-muted hover:text-amber-400 hover:bg-amber-500/10 transition-colors",title:"Restore all commands to defaults",children:"Restore Defaults"})),o.jsx(dt,{variant:"primary",size:"sm",onClick:q,children:"+ New"})]})]}),d&&s.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading commands..."}):s.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No commands created yet."}):o.jsx("div",{className:"space-y-2",children:s.map(z=>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.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:z.name}),c.includes(z.id)&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[c.includes(z.id)&&(ee===z.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await m(z.id),R(null)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Restore"}),o.jsx("button",{onClick:()=>R(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:()=>R(z.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",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:"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(ri,{onClick:()=>F(z.id)}),_===z.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:()=>K(z.id),className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs hover:bg-accent-error/30 transition-colors",children:"Delete"}),o.jsx("button",{onClick:()=>v(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:()=>v(z.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete command",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"})})})]})]},z.id))})]})}function Q3({onSendCommand:e,onOpenManager:r,textareaContent:i,attachments:s}){const[c,d]=U.useState(!1),[p,l]=U.useState(""),[h,f]=U.useState(0),[g,m]=U.useState(null),b=U.useRef(null),S=U.useRef(null),E=Tn(j=>j.commands),C=Tn(j=>j.fetchCommands);U.useEffect(()=>{c&&(C(),l(""),f(0),requestAnimationFrame(()=>{var j;return(j=S.current)==null?void 0:j.focus()}))},[c,C]),U.useEffect(()=>{if(!c)return;const j=A=>{b.current&&!b.current.contains(A.target)&&d(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[c]);const x=E.filter(j=>{if(!p)return!0;const A=p.toLowerCase();return j.name.toLowerCase().includes(A)}),_=j=>{switch(j.key){case"ArrowDown":j.preventDefault(),f(A=>Math.min(A+1,x.length-1));break;case"ArrowUp":j.preventDefault(),f(A=>Math.max(A-1,0));break;case"Enter":j.preventDefault(),x[h]&&v(x[h].id);break;case"Escape":j.preventDefault(),d(!1);break}},v=async j=>{const A=await Tn.getState().fetchCommand(j);A&&e(A.prompt,A.metadata.agentMode,i,s),d(!1)},y=()=>{d(!1),r()};return o.jsxs("div",{ref:b,className:"relative",children:[o.jsxs("button",{type:"button",onClick:()=>d(j=>!j),className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors",children:["Commands",o.jsx("svg",{className:`w-3 h-3 transition-transform ${c?"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"})})]}),c&&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:_,children:[o.jsx("div",{className:"p-2 border-b border-border",children:o.jsx("input",{ref:S,value:p,onChange:j=>{l(j.target.value),f(0)},placeholder:"Search commands...",className:"w-full px-2 py-1 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary"})}),o.jsx("div",{className:"overflow-y-auto max-h-64 p-1",children:x.length===0?o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:E.length===0?"No commands yet":"No matches"}):x.map((j,A)=>o.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${A===h?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsx("button",{type:"button",onClick:()=>v(j.id),className:"flex-1 text-left",children:o.jsx("div",{className:"text-sm text-text-primary font-medium",children:j.name})}),o.jsx(ri,{className:"opacity-0 group-hover:opacity-100",onClick:N=>{N.stopPropagation(),d(!1),m(j.id)}})]},j.id))}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:y,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 Commands..."})})]}),o.jsx(O0,{isOpen:!!g,onClose:()=>m(null),initialEditId:g})]})}function J3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function e4(e){let r=1;for(;e.some(i=>i.id===`s${r}`);)r++;return`s${r}`}const t4=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],B0={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"},I0=[{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)"}],Ci=150,jr=54,ys=80,jn=30,_s=70,Fv=100,ki=50,xl=50,Uv=4;function Vh(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 n4(e,r,i,s){const c=xl+ki+Ci+Fv+Ci+ki+xl,d=c/2,p=xl+ki+Ci/2,l=xl+ki+Ci+Fv+Ci/2,h=[],f=[],g=new Map,m=e.filter(I=>I.type==="agent"||I.type==="shell"),b=e.filter(I=>I.type==="sub_agent"),S=b.length>0,E=S?p:d,C=m.length>0?l:d,x=ki+jn/2;if(h.push({id:"$start",type:"terminal",label:"Start",cx:E,cy:x,w:ys,h:jn}),g.set("$start",{cx:E,cy:x,w:ys,h:jn}),e.length===0){const I=x+jn/2+_s*2+jn/2;return h.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:I,w:ys,h:jn}),g.set("$done",{cx:E,cy:I,w:ys,h:jn}),{nodes:h,edges:f,width:c,height:I+jn/2+ki,posMap:g}}const _=x+jn/2+_s,v=(I,P)=>{I.forEach((V,Z)=>{const ee=_+Z*(jr+_s)+jr/2,{name:R,color:D}=Vh(V,s);h.push({id:V.id,type:"step",label:R,color:D,cx:P,cy:ee,w:Ci,h:jr}),g.set(V.id,{cx:P,cy:ee,w:Ci,h:jr})})};v(m,E),v(b,C);const y=m.length>0?_+(m.length-1)*(jr+_s)+jr/2:x,j=S?_+(b.length-1)*(jr+_s)+jr/2:x,A=Math.max(y,j)+jr/2+_s+jn/2;h.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:A,w:ys,h:jn}),g.set("$done",{cx:E,cy:A,w:ys,h:jn});const N=[];r&&g.has(r)&&N.push({from:"$start",to:r,label:i,edgeKey:"start",direction:"down",backEdgeIndex:0});let L=0;for(const I of e)I.transitions.forEach((P,V)=>{if(!P.goto||!g.has(P.goto))return;const Z=g.get(I.id),ee=g.get(P.goto),R=P.when.type==="step_result"?`${P.when.result}`:B0[P.when.type]??P.when.type,D=I.id===P.goto;let O;D?O="back":ee.cy>Z.cy+1?O="down":ee.cy<Z.cy-1?O="back":O="same",N.push({from:I.id,to:P.goto,label:R,edgeKey:`${I.id}:${V}`,direction:O,backEdgeIndex:O==="back"?L++:0})});const T=new Map,B=new Map,H=new Map,W=new Map;for(const I of N)I.direction==="down"&&(T.set(I.from,(T.get(I.from)??0)+1),B.set(I.to,(B.get(I.to)??0)+1));const Y=new Map,$=new Map;for(const I of N){if(I.direction!=="same")continue;const P=[I.from,I.to].sort().join("|");Y.set(P,(Y.get(P)??0)+1)}for(const I of N){if(I.direction==="back"||I.direction==="same"){let O=0;if(I.direction==="same"){const q=[I.from,I.to].sort().join("|");O=$.get(q)??0,$.set(q,O+1)}f.push({...I,fromPort:0,toPort:0,sameEdgeIndex:O});continue}const P=T.get(I.from)??1,V=B.get(I.to)??1,Z=H.get(I.from)??0,ee=W.get(I.to)??0;H.set(I.from,Z+1),W.set(I.to,ee+1);const R=P===1?0:-.6+1.2*Z/(P-1),D=V===1?0:-.6+1.2*ee/(V-1);f.push({...I,fromPort:R,toPort:D,sameEdgeIndex:0})}return{nodes:h,edges:f,width:c,height:A+jn/2+ki,posMap:g}}function r4({steps:e,entryStep:r,selectedNodeId:i,selectedEdgeKey:s,startConditionLabel:c,agentTypes:d,onSelectNode:p,onSelectEdge:l,onRemoveStep:h,onCreateTransition:f,onReconnectTo:g,onReconnectFrom:m,onDeleteTransition:b}){const S=U.useRef(null),E=U.useRef(!1),[C,x]=U.useState(null),[_,v]=U.useState(null),[y,j]=U.useState(null),{nodes:A,edges:N,width:L,height:T,posMap:B}=U.useMemo(()=>n4(e,r,c,d),[e,r,c,d]),H=U.useCallback(K=>{var ae;const te=S.current;if(!te)return{x:0,y:0};const Q=te.createSVGPoint();Q.x=K.clientX,Q.y=K.clientY;const X=(ae=te.getScreenCTM())==null?void 0:ae.inverse();if(!X)return{x:0,y:0};const z=Q.matrixTransform(X);return{x:z.x,y:z.y}},[]),W=U.useCallback(K=>!K||!_||K==="$start"?!1:_.type==="reconnect-from"?K!=="$done":!0,[_]),Y=U.useCallback((K,te)=>{K.stopPropagation(),K.preventDefault();const Q=H(K);v({type:"new",fromNodeId:te,mouseX:Q.x,mouseY:Q.y})},[H]),$=U.useCallback((K,te)=>{K.stopPropagation(),K.preventDefault();const Q=H(K);v({type:"reconnect-to",fromNodeId:te.from,edgeKey:te.edgeKey,mouseX:Q.x,mouseY:Q.y})},[H]),I=U.useCallback((K,te)=>{K.stopPropagation(),K.preventDefault();const Q=H(K);v({type:"reconnect-from",fromNodeId:te.from,fixedTargetId:te.to,edgeKey:te.edgeKey,mouseX:Q.x,mouseY:Q.y})},[H]),P=U.useCallback(K=>{if(!_)return;const te=H(K);v(Q=>Q?{...Q,mouseX:te.x,mouseY:te.y}:null)},[_,H]),V=U.useCallback(()=>{_&&(E.current=!0,y&&W(y)&&(_.type==="new"?f(_.fromNodeId,y):_.type==="reconnect-to"?g(_.edgeKey,y):_.type==="reconnect-from"&&m(_.edgeKey,y)),v(null),j(null))},[_,y,W,f,g,m]),Z=U.useCallback(()=>{if(E.current){E.current=!1;return}p(null),l(null)},[p,l]);U.useEffect(()=>{const K=te=>{te.target instanceof HTMLInputElement||te.target instanceof HTMLTextAreaElement||te.target instanceof HTMLSelectElement||(te.key==="Delete"||te.key==="Backspace")&&s&&s!=="start"&&(te.preventDefault(),b(s),l(null))};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[s,b,l]);const ee=K=>{const te=B.get(K.from),Q=B.get(K.to);if(!te||!Q)return null;let X,z,ae,se="middle",ge,ve;if(K.direction==="down"){const Ne=te.cx+K.fromPort*(te.w/2-10),De=te.cy+te.h/2,Oe=Q.cx+K.toPort*(Q.w/2-10),Fe=Q.cy-Q.h/2,ke=Fe-De,lt=Oe-Ne;X=`M ${Ne} ${De} C ${Ne} ${De+ke*.4}, ${Oe-lt*.2} ${Fe-ke*.1}, ${Oe} ${Fe}`,z=Ne+(Oe-Ne)*.5,ae=De+ke*.6,ge={x:Ne,y:De},ve={x:Oe,y:Fe}}else if(K.direction==="back"){const Ne=K.from===K.to,De=te.cx>=L/2,Oe=K.backEdgeIndex*16,Fe=De?L-20-Oe:20+Oe;if(Ne){const ke=te.cx>=L/2,lt=30+K.backEdgeIndex*14,ht=te.cy-te.h/2,fe=ke?te.cx+te.w/2:te.cx-te.w/2,Re=ke?fe+lt:fe-lt,Je=te.cx+(ke?te.w/4:-te.w/4),et=ht-20-K.backEdgeIndex*10;X=`M ${fe} ${te.cy} C ${Re} ${te.cy}, ${Re} ${et}, ${Je} ${ht}`,z=Re+10,ae=et+4,se="middle",ge={x:fe,y:te.cy},ve={x:Je,y:ht}}else{const ke=De?te.cx+te.w/2:te.cx-te.w/2,lt=Q.cx+(De?Q.w/4:-Q.w/4),ht=Math.min(te.cy,Q.cy)-Q.h/2-18-K.backEdgeIndex*14;X=`M ${ke} ${te.cy} L ${Fe} ${te.cy} L ${Fe} ${ht} L ${lt} ${ht} L ${lt} ${Q.cy-Q.h/2}`,z=Fe,ae=(te.cy+ht)/2,se=De?"start":"end",ge={x:ke,y:te.cy},ve={x:lt,y:Q.cy-Q.h/2}}}else{const Ne=Q.cx>te.cx,De=K.sameEdgeIndex===0?-12:12,Oe=Ne?te.cx+te.w/2:te.cx-te.w/2,Fe=Ne?Q.cx-Q.w/2:Q.cx+Q.w/2,ke=te.cy+De,lt=Q.cy+De,ht=(Oe+Fe)/2;X=`M ${Oe} ${ke} C ${ht} ${ke}, ${ht} ${lt}, ${Fe} ${lt}`,z=ht,ae=(ke+lt)/2-6,ge={x:Oe,y:ke},ve={x:Fe,y:lt}}return{path:X,labelX:z,labelY:ae,labelAnchor:se,fromPt:ge,toPt:ve}},R=(K,te)=>{const Q=ee(K);if(!Q)return null;const{path:X,labelX:z,labelY:ae,labelAnchor:se}=Q,ge=s===K.edgeKey,ve=K.label&&!(K.from==="$start"&&K.label==="Always");return o.jsxs("g",{children:[o.jsx("path",{d:X,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Ne=>{Ne.stopPropagation(),l(ge?null:K.edgeKey)}}),o.jsx("path",{d:X,fill:"none",stroke:ge?"#58a6ff":"#484f58",strokeWidth:ge?2.2:1.2,markerEnd:ge?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),ve&&o.jsx("text",{x:z+(se==="start"?5:se==="end"?-5:0),y:ae+3,textAnchor:se,className:"text-[8px]",fill:ge?"#79c0ff":"#8b949e",style:{paintOrder:"stroke",stroke:"#0d1117",strokeWidth:3,strokeLinejoin:"round"},pointerEvents:"none",children:K.label})]},te)},D=()=>{if(!s||_)return null;const K=N.find(ae=>ae.edgeKey===s);if(!K)return null;const te=ee(K);if(!te)return null;const{fromPt:Q,toPt:X}=te,z=6;return o.jsxs(o.Fragment,{children:[K.edgeKey!=="start"&&o.jsx("circle",{cx:Q.x,cy:Q.y,r:z,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ae=>I(ae,K)}),o.jsx("circle",{cx:X.x,cy:X.y,r:z,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ae=>$(ae,K)})]})},O=()=>{if(!_)return null;let K,te,Q,X;if(_.type==="reconnect-from"){const se=B.get(_.fixedTargetId);if(!se)return null;K=_.mouseX,te=_.mouseY,Q=se.cx,X=se.cy-se.h/2}else{const se=B.get(_.fromNodeId);if(!se)return null;K=se.cx,te=se.cy+se.h/2,Q=_.mouseX,X=_.mouseY}const z=X-te,ae=Math.abs(z)>10?`M ${K} ${te} C ${K} ${te+z*.4}, ${Q} ${X-z*.4}, ${Q} ${X}`:`M ${K} ${te} L ${Q} ${X}`;return o.jsx("path",{d:ae,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},q=K=>{const te=K.cy+K.h/2,Q=(_==null?void 0:_.fromNodeId)===K.id;return o.jsx("circle",{cx:K.cx,cy:te,r:Uv,fill:Q?"#58a6ff":"#1c2128",stroke:Q?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:Q?1:.5,className:"cursor-crosshair",onMouseDown:X=>Y(X,K.id)})},F=K=>{const te=K.cy-K.h/2,Q=_&&y===K.id&&W(K.id);return o.jsx("circle",{cx:K.cx,cy:te,r:Uv,fill:Q?"#3fb950":"#1c2128",stroke:Q?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:Q?1:.5})};return o.jsxs("svg",{ref:S,viewBox:`0 0 ${L} ${T}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:P,onMouseUp:V,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"})})]}),N.map((K,te)=>R(K,te)),A.map(K=>{const te=i===K.id,Q=K.cx-K.w/2,X=K.cy-K.h/2,z=C===K.id,ae=_&&y===K.id&&W(K.id);if(K.type==="terminal"){const ge=K.id==="$start",ve=ge?"#58a6ff":"#3fb950",Ne=ge,De=!ge;return o.jsxs("g",{onClick:Oe=>{Oe.stopPropagation(),ge&&l("start")},className:ge?"cursor-pointer":void 0,children:[ae&&o.jsx("rect",{x:Q-3,y:X-3,width:K.w+6,height:K.h+6,rx:K.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ge&&s==="start"&&o.jsx("rect",{x:Q-3,y:X-3,width:K.w+6,height:K.h+6,rx:K.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:Q,y:X,width:K.w,height:K.h,rx:K.h/2,fill:ve,fillOpacity:.08,stroke:ve,strokeOpacity:.4,strokeWidth:1.5}),o.jsx("text",{x:K.cx,y:K.cy+4,textAnchor:"middle",fill:ve,className:"text-[10px] font-medium",pointerEvents:"none",children:K.label}),Ne&&q(K),De&&F(K)]},K.id)}const se=K.color??"#6b7280";return o.jsxs("g",{onClick:ge=>{ge.stopPropagation(),p(te?null:K.id)},onMouseEnter:()=>x(K.id),onMouseLeave:()=>x(null),className:"cursor-pointer",children:[ae&&o.jsx("rect",{x:Q-3,y:X-3,width:K.w+6,height:K.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),te&&o.jsx("rect",{x:Q-3,y:X-3,width:K.w+6,height:K.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:Q,y:X,width:K.w,height:K.h,rx:10,fill:se,fillOpacity:.08,stroke:se,strokeOpacity:.6,strokeWidth:te?2:1.5}),o.jsx("text",{x:K.cx,y:K.cy+4,textAnchor:"middle",fill:"#c9d1d9",className:"text-[11px] font-medium",pointerEvents:"none",children:K.label}),q(K),F(K),z&&!_&&o.jsxs("g",{onClick:ge=>{ge.stopPropagation(),h(K.id)},className:"cursor-pointer",children:[o.jsx("circle",{cx:Q+K.w-2,cy:X+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),o.jsx("line",{x1:Q+K.w-5,y1:X-1,x2:Q+K.w+1,y2:X+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),o.jsx("line",{x1:Q+K.w+1,y1:X-1,x2:Q+K.w-5,y2:X+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},K.id)}),_&&A.map(K=>W(K.id)?o.jsx("rect",{x:K.cx-K.w/2-8,y:K.cy-K.h/2-8,width:K.w+16,height:K.h+16,fill:"transparent",rx:12,onMouseEnter:()=>j(K.id),onMouseLeave:()=>j(null),onMouseUp:te=>{te.stopPropagation(),V()}},`drop-${K.id}`):null),O(),D()]})}const Yn="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",Ni="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",en="block text-[11px] text-text-secondary mb-0.5";function i4({fromLabel:e,toLabel:r,condition:i,fromStep:s,agentTypes:c,onUpdateCondition:d,onDelete:p}){const l=s&&(s.type==="sub_agent"||s.type==="agent")?c.find(f=>f.id===(s.type==="sub_agent"?s.subAgentType:s.toolMode)):void 0,h=(l==null?void 0:l.results)&&l.results.length>0;return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/15 text-blue-300",children:"Transition"}),o.jsx("button",{onClick:p,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:en,children:"Condition"}),o.jsx("select",{value:i.type,onChange:f=>{d(f.target.value==="step_result"?{type:"step_result",result:"success"}:{type:f.target.value})},className:Ni,children:I0.map(f=>o.jsx("option",{value:f.value,children:f.label},f.value))})]}),i.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Result"}),h?o.jsx("select",{value:i.result??l.results[0],onChange:f=>{d({type:"step_result",result:f.target.value})},className:Ni,children:l.results.map(f=>o.jsx("option",{value:f,children:f},f))}):o.jsx("input",{type:"text",value:i.result??"success",onChange:f=>d({type:"step_result",result:f.target.value}),placeholder:"e.g. success, passed, failed",className:Yn})]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function Hd({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 s4({step:e,isEntry:r,agentTypes:i,transitionCount:s,templateVariables:c,onUpdate:d,onRemove:p,onSetEntry:l}){const{color:h,name:f}=Vh(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:h+"20",color:h},children:f}),r&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-accent-primary/15 text-accent-primary",children:"Entry"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[!r&&o.jsx("button",{onClick:l,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),o.jsx("button",{onClick:p,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Type"}),o.jsx("select",{value:e.type,onChange:g=>{const m=g.target.value,b=m==="sub_agent"?"verification":"build";if(m==="agent"){const S=i.find(E=>!E.subagent);d({...e,type:m,phase:b,toolMode:(S==null?void 0:S.id)??"builder",name:(S==null?void 0:S.name)??"Agent"})}else if(m==="sub_agent"){const S=i.find(E=>E.subagent);d({...e,type:m,phase:b,subAgentType:(S==null?void 0:S.id)??"",name:(S==null?void 0:S.name)??"Sub-Agent"})}else d({...e,type:m,phase:b,name:"Shell"})},className:Ni,children:t4.map(g=>o.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Agent Type"}),o.jsx("select",{value:e.toolMode??"builder",onChange:g=>{const m=i.find(b=>b.id===g.target.value);d({...e,toolMode:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Ni,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:en,children:"Sub-Agent Type"}),o.jsxs("select",{value:e.subAgentType??"",onChange:g=>{const m=i.find(b=>b.id===g.target.value);d({...e,subAgentType:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Ni,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:en,children:"Prompt"}),o.jsx("textarea",{value:e.prompt??"",onChange:g=>d({...e,prompt:g.target.value||void 0}),rows:6,className:`${Yn} resize-y text-xs`,placeholder:"Injected on first entry..."}),o.jsx(Hd,{variables:c,onInsert:g=>d({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Nudge Prompt"}),o.jsx("textarea",{value:e.nudgePrompt??"",onChange:g=>d({...e,nudgePrompt:g.target.value||void 0}),rows:6,className:`${Yn} resize-y text-xs`,placeholder:"Injected on re-entry..."}),o.jsx(Hd,{variables:c,onInsert:g=>d({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Command"}),o.jsx("textarea",{value:e.command??"",onChange:g=>d({...e,command:g.target.value}),rows:3,className:`${Yn} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),o.jsx(Hd,{variables:c,onInsert:g=>d({...e,command:(e.command??"")+`{{${g}}}`})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Timeout (ms)"}),o.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>d({...e,timeout:Number(g.target.value)}),className:`${Yn} font-mono text-xs`})]}),o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Success Codes"}),o.jsx("input",{value:(e.successExitCodes??[0]).join(", "),onChange:g=>d({...e,successExitCodes:g.target.value.split(",").map(m=>Number(m.trim())).filter(m=>!isNaN(m))}),className:`${Yn} 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 $v=[];function z0({isOpen:e,onClose:r,initialEditId:i}){const s=Vt(pe=>pe.workflows),c=Vt(pe=>pe.modifiedIds),d=Vt(pe=>pe.loading),p=Vt(pe=>pe.templateVariables),l=Vt(pe=>pe.fetchWorkflows),h=Vt(pe=>pe.fetchWorkflow),f=Vt(pe=>pe.fetchTemplateVariables),g=Vt(pe=>pe.createWorkflow),m=Vt(pe=>pe.updateWorkflow),b=Vt(pe=>pe.deleteWorkflow),S=Vt(pe=>pe.restoreDefault),E=Vt(pe=>pe.restoreAllDefaults),[C,x]=U.useState("list"),[_,v]=U.useState(null),[y,j]=U.useState(null),[A,N]=U.useState(null),[L,T]=U.useState(null),[B,H]=U.useState(""),[W,Y]=U.useState(""),[$,I]=U.useState(""),[P,V]=U.useState("1.0.0"),[Z,ee]=U.useState("#3b82f6"),[R,D]=U.useState(""),[O,q]=U.useState(50),[F,K]=U.useState($v),[te,Q]=U.useState({type:"always"}),[X,z]=U.useState(""),[ae,se]=U.useState(!1),[ge,ve]=U.useState([]),[Ne,De]=U.useState(null),[Oe,Fe]=U.useState(!1);U.useEffect(()=>{e&&(l(),f(),_e("/api/agents").then(pe=>pe.json()).then(pe=>ve(pe.agents??[])).catch(()=>{}),j(null),De(null),Fe(!1),N(null),T(null),i?(x("edit"),v(i),z(""),h(i).then(pe=>{pe&&(H(pe.metadata.name),Y(pe.metadata.id),I(pe.metadata.description),V(pe.metadata.version),ee(pe.metadata.color??"#3b82f6"),D(pe.entryStep),q(pe.settings.maxIterations),K(pe.steps),Q(pe.startCondition??{type:"always"}))})):(x("list"),v(null)))},[e,l,h,f,i]);const ke=()=>{v(null),H(""),Y(""),I(""),V("1.0.0"),ee("#3b82f6"),D(""),q(50),K(structuredClone($v)),Q({type:"always"}),z(""),N(null),T(null),x("edit")},lt=async pe=>{const we=await h(pe);we&&(v(pe),H(we.metadata.name),Y(we.metadata.id),I(we.metadata.description),V(we.metadata.version),ee(we.metadata.color??"#3b82f6"),D(we.entryStep),q(we.settings.maxIterations),K(we.steps),Q(we.startCondition??{type:"always"}),z(""),N(null),T(null),x("edit"))},ht=async()=>{var tt;const pe=_??W;if(!pe||!B)return z("Name is required."),!1;if(F.length===0)return z("Add at least one step."),!1;let we=R;if(!we||!F.some(Be=>Be.id===we)){if(we=((tt=F.find(Be=>Be.id))==null?void 0:tt.id)??"",!we)return z("All steps need an ID."),!1;D(we)}se(!0),z("");const ze={metadata:{id:pe,name:B,description:$,version:P||"1.0.0",color:Z},entryStep:we,settings:{maxIterations:O},steps:F,startCondition:te},Ve=_?await m(_,ze):await g(ze);return se(!1),Ve.success?(_||v(pe),!0):(z(Ve.error??"Failed to save."),!1)},fe=async()=>{await ht()},Re=async()=>{await ht()&&(i?r():x("list"))},Je=()=>{i?r():x("list")},et=pe=>{H(pe),_||Y(J3(pe))},Ge=U.useCallback(pe=>{N(pe),T(null)},[]),ct=U.useCallback(pe=>{T(pe),N(null)},[]),de=A!==null?Number(A):-1,be=de>=0?F[de]??null:null,re=U.useCallback(pe=>{K(we=>we.map((ze,Ve)=>Ve===de?pe:ze))},[de]),Se=te.type==="step_result"?`${te.result}`:B0[te.type]??te.type,Ce=()=>{const pe=F.length,we=e4(F),ze=ge.find(Ve=>!Ve.subagent);K([...F,{id:we,name:(ze==null?void 0:ze.name)??"Agent",type:"agent",phase:"build",toolMode:(ze==null?void 0:ze.id)??"builder",transitions:[]}]),R||D(we),Ge(String(pe))},He=U.useCallback((pe,we)=>{pe==="$start"?(D(we),ct("start")):K(ze=>{const Ve=ze.find(Be=>Be.id===pe),tt=Ve?Ve.transitions.length:0;return ct(`${pe}:${tt}`),ze.map(Be=>Be.id===pe?{...Be,transitions:[...Be.transitions,{when:{type:"always"},goto:we}]}:Be)})},[ct]),Ae=U.useCallback((pe,we)=>{if(pe==="start")D(we);else{const ze=pe.lastIndexOf(":"),Ve=pe.slice(0,ze),tt=parseInt(pe.slice(ze+1));K(Be=>Be.map(Lt=>Lt.id===Ve?{...Lt,transitions:Lt.transitions.map((Et,Yt)=>Yt===tt?{...Et,goto:we}:Et)}:Lt))}},[]),st=U.useCallback((pe,we)=>{const ze=pe.lastIndexOf(":"),Ve=pe.slice(0,ze),tt=parseInt(pe.slice(ze+1));K(Be=>{const Lt=Be.find(Yt=>Yt.id===Ve);if(!Lt)return Be;const Et=Lt.transitions[tt];return Et?Be.map(Yt=>Yt.id===Ve?{...Yt,transitions:Yt.transitions.filter((Gl,Ls)=>Ls!==tt)}:Yt.id===we?{...Yt,transitions:[...Yt.transitions,Et]}:Yt):Be}),T(null)},[]),it=U.useCallback(pe=>{if(pe==="start")D("");else{const we=pe.lastIndexOf(":"),ze=pe.slice(0,we),Ve=parseInt(pe.slice(we+1));K(tt=>tt.map(Be=>Be.id===ze?{...Be,transitions:Be.transitions.filter((Lt,Et)=>Et!==Ve)}:Be))}T(null)},[]),Ct=U.useCallback((pe,we)=>{if(pe==="start")Q(we);else{const ze=pe.lastIndexOf(":"),Ve=pe.slice(0,ze),tt=parseInt(pe.slice(ze+1));K(Be=>Be.map(Lt=>Lt.id===Ve?{...Lt,transitions:Lt.transitions.map((Et,Yt)=>Yt===tt?{...Et,when:we}:Et)}:Lt))}},[]),$e=pe=>Vh(pe,ge).name,Ln=()=>{if(!L)return null;if(L==="start"){const Et=F.find(Yt=>Yt.id===R);return{type:"start",fromLabel:"Start",toLabel:Et?$e(Et):"(none)",condition:te}}const pe=L.lastIndexOf(":"),we=L.slice(0,pe),ze=parseInt(L.slice(pe+1)),Ve=F.find(Et=>Et.id===we);if(!Ve)return null;const tt=Ve.transitions[ze];if(!tt)return null;const Be=F.find(Et=>Et.id===tt.goto),Lt=tt.goto==="$done"?"Done":Be?$e(Be):tt.goto;return{type:"step",fromLabel:$e(Ve),toLabel:Lt,condition:tt.when}};if(C==="edit"){const pe=Ln();return o.jsxs(un,{isOpen:e,onClose:Je,title:_?"Edit Workflow":"New Workflow",size:"full",children:[X&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:X}),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:en,children:"Name"}),o.jsx("input",{value:B,onChange:we=>et(we.target.value),placeholder:"Workflow name",className:Yn})]}),o.jsxs("div",{className:"min-w-[100px]",children:[o.jsx("label",{className:en,children:"ID"}),o.jsx("input",{value:W,onChange:we=>!_&&Y(we.target.value),readOnly:!!_,className:`${Yn} font-mono ${_?"opacity-50":""}`})]}),o.jsxs("div",{className:"flex-1 min-w-[140px]",children:[o.jsx("label",{className:en,children:"Description"}),o.jsx("input",{value:$,onChange:we=>I(we.target.value),placeholder:"What does this workflow do?",className:Yn})]}),o.jsxs("div",{className:"w-20",children:[o.jsx("label",{className:en,children:"Max Iter."}),o.jsx("input",{type:"number",value:O,onChange:we=>q(Number(we.target.value)),className:`${Yn} font-mono`})]}),o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Color"}),o.jsx("input",{type:"color",value:Z,onChange:we=>ee(we.target.value),className:"w-8 h-8 rounded border border-border cursor-pointer bg-transparent"})]})]}),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"}),o.jsx("button",{onClick:Ce,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(r4,{steps:F,entryStep:R,selectedNodeId:(be==null?void 0:be.id)??null,selectedEdgeKey:L,startConditionLabel:Se,agentTypes:ge,onSelectNode:we=>{if(we===null){Ge(null);return}const ze=F.findIndex(Ve=>Ve.id===we);Ge(ze>=0?String(ze):null)},onSelectEdge:ct,onRemoveStep:we=>{var Ve;const ze=F.findIndex(tt=>tt.id===we);if(K(tt=>tt.filter(Be=>Be.id!==we)),de===ze&&Ge(null),R===we){const tt=F.filter(Be=>Be.id!==we);D(((Ve=tt[0])==null?void 0:Ve.id)??"")}},onCreateTransition:He,onReconnectTo:Ae,onReconnectFrom:st,onDeleteTransition:it}),F.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:Ce,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: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"})}),R&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"text-text-primary font-medium",children:"Start"}),o.jsx("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:en,children:"Activation Condition"}),o.jsx("select",{value:te.type,onChange:we=>Q(we.target.value==="step_result"?{type:"step_result",result:"success"}:{type:we.target.value}),className:Ni,children:I0.map(we=>o.jsx("option",{value:we.value,children:we.label},we.value))})]}),te.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Result"}),R&&(()=>{const we=F.find(Be=>Be.id===R),ze=we&&(we.type==="sub_agent"||we.type==="agent")?ge.find(Be=>Be.id===(we.type==="sub_agent"?we.subAgentType:we.toolMode)):void 0,Ve=(ze==null?void 0:ze.results)&&ze.results.length>0,tt=(ze==null?void 0:ze.results)??[];return Ve?o.jsx("select",{value:te.result??tt[0],onChange:Be=>Q({type:"step_result",result:Be.target.value}),className:Ni,children:tt.map(Be=>o.jsx("option",{value:Be,children:Be},Be))}):o.jsx("input",{type:"text",value:te.result??"success",onChange:Be=>Q({type:"step_result",result:Be.target.value}),placeholder:"e.g. success, passed, failed",className:Yn})})()]}),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(i4,{fromLabel:pe.fromLabel,toLabel:pe.toLabel,condition:pe.condition,fromStep:pe.type==="step"?F.find(we=>we.id===pe.fromLabel):void 0,agentTypes:ge,onUpdateCondition:we=>Ct(L,we),onDelete:()=>it(L)}):be?o.jsx(s4,{step:be,isEntry:be.id===R,agentTypes:ge,transitionCount:be.transitions.length,templateVariables:p,onUpdate:re,onRemove:()=>{var we;if(be&&(K(F.filter((ze,Ve)=>Ve!==de)),Ge(null),R===be.id)){const ze=F.filter((Ve,tt)=>tt!==de);D(((we=ze[0])==null?void 0:we.id)??"")}},onSetEntry:()=>D(be.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(dt,{variant:"secondary",onClick:Je,children:"Cancel"}),o.jsx(dt,{variant:"secondary",onClick:fe,disabled:ae||!B,children:ae?"Saving...":"Save"}),o.jsx(dt,{variant:"primary",onClick:Re,disabled:ae||!B,children:"Save & Close"})]})]})}return o.jsxs(un,{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.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[c.length>0&&(Oe?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await E(),Fe(!1)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Confirm"}),o.jsx("button",{onClick:()=>Fe(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:()=>Fe(!0),className:"px-2 py-1 rounded text-xs text-text-muted hover:text-amber-400 hover:bg-amber-500/10 transition-colors",title:"Restore all workflows to defaults",children:"Restore Defaults"})),o.jsx(dt,{variant:"primary",size:"sm",onClick:ke,children:"+ New"})]})]}),d&&s.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):s.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No workflows installed."}):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]}),c.includes(pe.id)&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]}),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:[c.includes(pe.id)&&(Ne===pe.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await S(pe.id),De(null)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Restore"}),o.jsx("button",{onClick:()=>De(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:()=>De(pe.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",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:"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(ri,{onClick:()=>lt(pe.id)}),pe.id!=="default"&&(y===pe.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:()=>{b(pe.id),j(null)},className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs",children:"Delete"}),o.jsx("button",{onClick:()=>j(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs",children:"Cancel"})]}):o.jsx("button",{onClick:()=>j(pe.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",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"})})}))]})]},pe.id))})]})}function a4(e,r){const i=e.startCondition;if(!i||i.type==="always")return!0;switch(i.type){case"has_pending_criteria":return r.some(s=>s.status.type!=="passed");case"all_criteria_passed":return r.length===0||r.every(s=>s.status.type==="passed");case"all_criteria_completed_or_passed":return r.every(s=>s.status.type==="completed"||s.status.type==="passed");case"any_criteria_blocked":return r.some(s=>s.status.type==="failed"&&s.attempts.filter(c=>c.status==="failed").length>=4);case"step_result":return null;default:return null}}function o4({onSelectWorkflow:e,onOpenManager:r,criteria:i}){const[s,c]=U.useState(!1),[d,p]=U.useState(""),[l,h]=U.useState(0),[f,g]=U.useState(null),m=U.useRef(null),b=U.useRef(null),S=Vt(y=>y.workflows),E=Vt(y=>y.fetchWorkflows);U.useEffect(()=>{s&&(E(),p(""),h(0),requestAnimationFrame(()=>{var y;return(y=b.current)==null?void 0:y.focus()}))},[s,E]),U.useEffect(()=>{if(!s)return;const y=j=>{m.current&&!m.current.contains(j.target)&&c(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]);const C=S.filter(y=>{if(!d)return!0;const j=d.toLowerCase();return y.name.toLowerCase().includes(j)}),x=y=>{switch(y.key){case"ArrowDown":y.preventDefault(),h(j=>Math.min(j+1,C.length-1));break;case"ArrowUp":y.preventDefault(),h(j=>Math.max(j-1,0));break;case"Enter":y.preventDefault(),C[l]&&_(C[l].id);break;case"Escape":y.preventDefault(),c(!1);break}},_=y=>{e(y),c(!1)},v=()=>{c(!1),r()};return o.jsxs("div",{ref:m,className:"relative",children:[o.jsxs("button",{type:"button",onClick:()=>c(y=>!y),className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors",children:["Workflows",o.jsx("svg",{className:`w-3 h-3 transition-transform ${s?"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"})})]}),s&&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:x,children:[o.jsx("div",{className:"p-2 border-b border-border",children:o.jsx("input",{ref:b,value:d,onChange:y=>{p(y.target.value),h(0)},placeholder:"Search workflows...",className:"w-full px-2 py-1 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary"})}),o.jsx("div",{className:"overflow-y-auto max-h-64 p-1",children:C.length===0?o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:S.length===0?"No workflows yet":"No matches"}):C.map((y,j)=>{const A=a4(y,i),N=y.color??"#3b82f6";return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${j===l?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsxs("button",{type:"button",onClick:()=>_(y.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:N}}),o.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:y.name}),A!==null&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:A?"#22c55e":"#6b7280"},title:A?"Entry condition met":"Entry condition not met"})]}),o.jsx(ri,{className:"opacity-0 group-hover:opacity-100",onClick:L=>{L.stopPropagation(),c(!1),g(y.id)}})]},y.id)})}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:v,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 Workflows..."})})]}),o.jsx(z0,{isOpen:!!f,onClose:()=>g(null),initialEditId:f})]})}function l4(e){return e==="criterion"}function c4(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=>l4(s.name))}function u4(e,r=[]){const i=[];let s=null,c=[],d,p=1;const l=new Map,h=new Map,f=[];for(const S of r)S.type==="message"?l.set(S.message.id,S):S.type==="subagent"?h.set(S.subAgentId,S):S.type==="criteria-batch"&&f.push(S);let g=0;const m=()=>{if(c.length>0){const S=f[g];S&&S.type==="criteria-batch"&&S.toolCalls.length===c.length&&S.toolCalls.every((C,x)=>{var _;return C.id===((_=c[x])==null?void 0:_.id)})?i.push(S):i.push({type:"criteria-batch",toolCalls:[...c]}),g++,c=[]}},b=()=>{if(!s)return;const S=s,E=h.get(S.subAgentId);E&&E.type==="subagent"&&E.messages.length===S.messages.length&&E.messages.every((x,_)=>x===S.messages[_])?i.push(E):i.push({type:"subagent",subAgentId:S.subAgentId,subAgentType:S.subAgentType,messages:S.messages}),s=null};for(const S of e)if(S.role!=="tool"){if(S.contextWindowId&&d&&S.contextWindowId!==d&&(m(),b(),p++,i.push({type:"context-divider",windowSequence:p})),d=S.contextWindowId,c4(S)){b();for(const E of S.toolCalls)c.push(E);continue}if(m(),S.subAgentId&&S.subAgentType)s&&s.subAgentId===S.subAgentId?s.messages.push(S):(b(),s={subAgentId:S.subAgentId,subAgentType:S.subAgentType,messages:[S]});else{b();const E=l.get(S.id);E&&E.type==="message"&&E.message===S?i.push(E):i.push({type:"message",message:S})}}return m(),b(),i}function d4(e){const r=new Date(e),i=r.getFullYear(),s=String(r.getMonth()+1).padStart(2,"0"),c=String(r.getDate()).padStart(2,"0"),d=String(r.getHours()).padStart(2,"0"),p=String(r.getMinutes()).padStart(2,"0");return`${i}/${s}/${c} ${d}:${p}`}function h4(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const f4=10,p4=150;function m4(e,r,i){const s=[],c=e.filter(l=>l.role==="user"&&!l.isSystemGenerated&&l.messageKind!=="auto-prompt");for(const l of c)s.push({id:l.id,content:l.content,timestamp:l.timestamp,sessionId:i,sessionName:"This session"});for(const l of r)if(!(i&&l.id===i)&&l.recentUserPrompts)for(const h of l.recentUserPrompts)s.push({id:h.id,content:h.content,timestamp:h.timestamp,sessionId:l.id,sessionName:l.title||l.id});s.sort((l,h)=>new Date(h.timestamp).getTime()-new Date(l.timestamp).getTime());const d=s.slice(0,f4);d.reverse();const p=[];for(const l of d)p.push({id:l.id,content:l.content,timestamp:l.timestamp,formattedTimestamp:d4(l.timestamp),trimmedContent:h4(l.content,p4),sessionId:l.sessionId||void 0,sessionName:l.sessionName});return p}function g4(e,r=[],i=null){const[s,c]=U.useState(0),[d,p]=U.useState(!1),l=U.useMemo(()=>m4(e,r,i),[e,r,i]),h=U.useCallback(()=>{l.length>0&&(c(l.length-1),p(!0))},[l.length]),f=U.useCallback(()=>{p(!1),c(0)},[]),g=U.useCallback(()=>{c(S=>l.length===0?S:S===0?l.length-1:S-1)},[l.length]),m=U.useCallback(()=>{c(S=>l.length===0?S:S===l.length-1?0:S+1)},[l.length]),b=U.useCallback(()=>{if(l.length===0||!d)return null;const S=l[s];return(S==null?void 0:S.content)??null},[l,s,d]);return{history:l,selectedIndex:s,showHistory:d,openHistory:h,closeHistory:f,navigateUp:g,navigateDown:m,selectCurrent:b}}const x4=(e,r)=>{let i,s=!1,c=!1,d=!1,p=!1;const l=()=>{p=!0;const f=e.current;f&&(f.scrollTop=f.scrollHeight),setTimeout(()=>{p=!1},100)},h=()=>{i=requestAnimationFrame(l),setTimeout(()=>{i=requestAnimationFrame(l)},250),setTimeout(()=>{i=requestAnimationFrame(l)},500),setTimeout(()=>{i=requestAnimationFrame(l)},1e3)};return U.useEffect(()=>{const f=e.current;if(!f)return;const g=new MutationObserver(()=>{if(s||c){cancelAnimationFrame(i);return}i=requestAnimationFrame(l)});h(),g.observe(f,{childList:!0,subtree:!0,characterData:!0});const m=setInterval(()=>{if(s||c){cancelAnimationFrame(i);return}l()},1e3),b=C=>{if(d||p)return;f.scrollHeight-f.scrollTop-f.offsetHeight>50?(cancelAnimationFrame(i),s=!0,console.log("Scroll detected!",C)):s=!1},S=()=>c=!0,E=()=>c=!1;return f.addEventListener("wheel",b,{passive:!0}),f.addEventListener("touchstart",S,{passive:!0}),f.addEventListener("touchend",E,{passive:!0}),()=>{f.removeEventListener("wheel",b),f.removeEventListener("touchstart",S),f.removeEventListener("touchend",E),g.disconnect(),clearInterval(m)}},[r==null?void 0:r.id]),{force_scroll_to_bottom:()=>{s=!1,c=!1,d=!0,l(),setTimeout(()=>l(),250),setTimeout(()=>l(),500),setTimeout(()=>l(),750),setTimeout(()=>l(),1e3),setTimeout(()=>{d=!1},1250)}}};function v4({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const i=e??!0,[s,c]=U.useState(""),[d,p]=U.useState([]),[l,h]=U.useState(!1),[f,g]=U.useState(null),[m,b]=U.useState(!1),[S,E]=U.useState(!1),C=U.useRef(null),x=U.useRef(null),_=U.useRef(null),v=Ee(re=>re.currentSession),y=Ee(re=>re.messages),j=Ee(re=>re.streamingMessage),A=Ee(re=>re.sessions),N=Ee(re=>re.error),L=Ee(re=>re.pendingQuestion),T=rb(),B=Ee(re=>re.sendMessage),H=Ee(re=>re.clearError),W=Ee(re=>re.acceptAndBuild),Y=Ee(re=>re.stopGeneration),$=Ee(re=>re.launchRunner),I=Ee(re=>re.cancelQueued),P=iS(),V=Vt(re=>re.workflows),Z=Vt(re=>re.fetchWorkflows);U.useEffect(()=>{Z()},[Z]);const{history:ee,selectedIndex:R,showHistory:D,openHistory:O,closeHistory:q,navigateUp:F,navigateDown:K,selectCurrent:te}=g4(y,A,v==null?void 0:v.id),Q=U.useMemo(()=>j?y.map(re=>re.id===j.id?j:re):y,[y,j]),X=U.useRef([]),z=U.useMemo(()=>{const re=u4(Q,X.current);return X.current=re,re},[Q]),ae=U.useMemo(()=>V3(y),[y]),{force_scroll_to_bottom:se}=x4(C,v),ge=U.useCallback(()=>{const re=x.current;if(!re)return;re.style.height="auto";const Se=Math.min(200,re.scrollHeight);re.style.height=`${Se}px`},[]);U.useEffect(()=>{if(!(v!=null&&v.id))return;const re=`openfox:draft:${v.id}`,Se=localStorage.getItem(re);Se!==null&&c(Se)},[v==null?void 0:v.id]),U.useEffect(()=>{var re;(re=x.current)==null||re.focus(),ge()},[v==null?void 0:v.id,ge]),U.useEffect(()=>{if(!(v!=null&&v.id))return;const re=`openfox:draft:${v.id}`,Se=setTimeout(()=>{s?localStorage.setItem(re,s):localStorage.removeItem(re)},500);return()=>clearTimeout(Se)},[v==null?void 0:v.id,s]),U.useEffect(()=>{ge()},[s,ge]),U.useEffect(()=>{const re=Se=>{Se.key==="Escape"&&T&&Y()};return window.addEventListener("keydown",re),()=>window.removeEventListener("keydown",re)},[T,Y]),U.useEffect(()=>{const re=x.current;if(!re)return;const Se=Ce=>{var Ae;if(document.activeElement!==re)return;const He=(Ae=Ce.clipboardData)==null?void 0:Ae.items;if(He){for(const st of Array.from(He))if(st.type.startsWith("image/")){Ce.preventDefault();const it=st.getAsFile();if(!it)continue;(async()=>{try{if(!Id(it)){g("Only PNG, JPG, and GIF images are supported.");return}const Ct=zd(it,50*1024*1024);if(!Ct.valid){g(Ct.error??"Image file is too large");return}const $e=await Bd(it,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),Ln={id:vl(),filename:"pasted-image",mimeType:$e.mimeType,size:$e.size,data:$e.dataUrl};p(pe=>[...pe,Ln])}catch(Ct){const $e=Ct instanceof Error?Ct.message??"Failed to process image":"Failed to process image";g($e)}})()}}};return re.addEventListener("paste",Se),()=>re.removeEventListener("paste",Se)},[]);const ve=()=>{c(""),p([]),v!=null&&v.id&&localStorage.removeItem(`openfox:draft:${v.id}`)},Ne=async re=>{re.preventDefault(),!(!s.trim()&&d.length===0)&&(se(),B(s,d.length>0?d:void 0),ve())},De=re=>{if(D)switch(re.key){case"Enter":re.preventDefault();const Se=te();Se&&(c(Se),q());return;case"Escape":re.preventDefault(),q(),T&&Y();return;case"ArrowUp":re.preventDefault(),F();return;case"ArrowDown":re.preventDefault(),K();return}if(re.key==="ArrowUp"&&s.trim()===""&&!D){re.preventDefault(),O();return}re.key==="Enter"&&!re.shiftKey&&(re.preventDefault(),Ne(re))},Oe=U.useCallback(async re=>{const Se=re.target.files;if(!(!Se||Se.length===0)){g(null);for(const Ce of Array.from(Se))try{if(!Id(Ce)){g(`Unsupported file type: ${Ce.type}. Only PNG, JPG, and GIF are supported.`);continue}const He=zd(Ce,50*1024*1024);if(!He.valid){g(He.error??"Image file is too large");continue}const Ae=await Bd(Ce,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),st={id:vl(),filename:Ce.name,mimeType:Ae.mimeType,size:Ae.size,data:Ae.dataUrl};p(it=>[...it,st])}catch(He){const Ae=He instanceof Error?He.message??"Failed to process image":"Failed to process image";g(Ae)}_.current&&(_.current.value="")}},[]),Fe=U.useCallback(re=>{re.preventDefault(),re.stopPropagation(),h(!0)},[]),ke=U.useCallback(re=>{re.preventDefault(),re.stopPropagation(),h(!1)},[]),lt=U.useCallback(async re=>{re.preventDefault(),re.stopPropagation(),h(!1),g(null);const Se=re.dataTransfer.files;if(!(!Se||Se.length===0))for(const Ce of Array.from(Se))try{if(!Id(Ce)){g(`Unsupported file type: ${Ce.type}. Only PNG, JPG, and GIF are supported.`);continue}const He=zd(Ce,50*1024*1024);if(!He.valid){g(He.error??"Image file is too large");continue}const Ae=await Bd(Ce,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),st={id:vl(),filename:Ce.name,mimeType:Ae.mimeType,size:Ae.size,data:Ae.dataUrl};p(it=>[...it,st])}catch(He){const Ae=He instanceof Error?He.message??"Failed to process image":"Failed to process image";g(Ae)}},[]),ht=U.useCallback(re=>{p(Se=>Se.filter(Ce=>Ce.id!==re))},[]),fe=U.useCallback(()=>{var re;(re=_.current)==null||re.click()},[]),Re=(v==null?void 0:v.mode)==="planner",Je=(v==null?void 0:v.mode)==="builder",et=((v==null?void 0:v.criteria.length)??0)>0,Ge=(v==null?void 0:v.phase)==="done",ct=z.some(re=>re.type==="message"&&re.message.role==="assistant"),de=Re&&et&&!T&&ct&&!Ge,be=re=>{const Se=s.trim()?s:void 0,Ce=d.length>0?d:void 0;Re?W(re,Se,Ce):Je&&$(Se,Ce,re),ve()};return o.jsxs(yw,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:r,messages:Q,children:[L&&o.jsx(O3,{question:L}),o.jsx(Sw,{}),o.jsxs("div",{ref:C,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto",children:[o.jsx("div",{className:"pt-4",children:z.map((re,Se)=>{if(re.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"})]},Se);if(re.type==="subagent"){const He=re.messages.some(Ae=>Ae.isStreaming);return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(A3,{messages:re.messages,subAgentType:re.subAgentType,isStreaming:He})},Se)}if(re.type==="criteria-batch")return o.jsx("div",{className:"feed-item px-2 md:px-4",children:o.jsx(L0,{toolCalls:re.toolCalls,criteria:v==null?void 0:v.criteria})},Se);const Ce=re.message;return Ce.role==="assistant"?o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(Wh,{message:Ce,showStats:!0})},Se):o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(R0,{message:Ce,isLastAssistantMessage:!1,promptContext:Ce.role==="user"?ae[Ce.id]:void 0})},Se)})}),o.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[N&&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:N.code}),o.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:N.message})]}),o.jsx("button",{onClick:H,className:"text-red-400 hover:text-red-300 p-0.5","aria-label":"Dismiss error",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:"M6 18L18 6M6 6l12 12"})})})]})}),de&&o.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:V.map(re=>{const Se=re.color??"#3b82f6",Ce=parseInt(Se.slice(1,3),16),He=parseInt(Se.slice(3,5),16),Ae=parseInt(Se.slice(5,7),16),st=`rgba(${Ce},${He},${Ae},0.12)`,it=`rgba(${Ce},${He},${Ae},0.22)`,Ct=`rgba(${Ce},${He},${Ae},0.25)`;return o.jsxs("button",{onClick:()=>W(re.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:st,color:Se,border:`1px solid ${Ct}`},onMouseEnter:$e=>{$e.currentTarget.style.backgroundColor=it},onMouseLeave:$e=>{$e.currentTarget.style.backgroundColor=st},children:["▶ ",re.name]},re.id)})}),T&&o.jsx(B3,{})]})]}),o.jsxs("form",{onSubmit:Ne,className:"p-2 md:p-4 border-t border-border bg-gradient-to-t from-bg-secondary/50 to-transparent",children:[o.jsx("input",{ref:_,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:Oe,className:"hidden",multiple:!0}),f&&o.jsx("div",{className:"mb-2 p-2 bg-red-500/10 border border-red-500/50 rounded text-red-300 text-sm",children:f}),d.length>0&&o.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:d.map(re=>o.jsx(I3,{attachment:re,onRemove:ht},re.id))}),D&&o.jsx(z3,{history:ee,selectedIndex:R,onSelect:re=>{c(re),q()},onEscape:q,onNavigate:re=>{re==="up"?F():K()}}),P.length>0&&o.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:P.map(re=>o.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${re.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:[re.mode==="asap"?"ASAP":"Queue",":"]}),o.jsx("span",{className:"truncate max-w-[200px]",children:re.content}),o.jsx("button",{type:"button",onClick:()=>I(re.queueId),className:"hover:text-white transition-colors",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:"M6 18L18 6M6 6l12 12"})})})]},re.queueId))}),o.jsxs("div",{className:`flex items-end gap-3 p-3 rounded border transition-colors ${l?"border-accent-primary/50 bg-accent-primary/10":"border-border bg-bg-tertiary/50"}`,onDragOver:Fe,onDragLeave:ke,onDrop:lt,children:[o.jsx("button",{type:"button",onClick:fe,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:x,value:s,onChange:re=>{c(re.target.value),D&&q()},onKeyDown:De,placeholder:Re?"What would you like to build?":"Send a message...",className:"flex-1 bg-transparent text-sm placeholder:text-text-muted resize-none overflow-y-auto focus:outline-none",style:{minHeight:"24px",maxHeight:"200px"}}),o.jsxs("div",{className:"flex flex-col items-end gap-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Q3,{onSendCommand:(re,Se,Ce,He)=>{var st;Se&&(v==null?void 0:v.mode)!==Se&&Ee.getState().switchMode(Se);const Ae=Ce&&Ce.trim()?`${Ce.trim()}
|
|
141
|
-
|
|
142
|
-
${re}`:re;(st=C.current)==null||st.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),B(Ae,He!=null&&He.length?He:void 0,{messageKind:"command",isSystemGenerated:!0}),ve()},onOpenManager:()=>b(!0),textareaContent:s,attachments:d.length>0?d:void 0}),o.jsx(o4,{onSelectWorkflow:be,onOpenManager:()=>E(!0),criteria:(v==null?void 0:v.criteria)??[]})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("button",{type:"button",onClick:()=>{var re;!s.trim()&&d.length===0||((re=C.current)==null||re.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),B(s,d),ve())},disabled:!s.trim()&&d.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(R3,{}),o.jsx(M3,{})]}),o.jsx(X3,{})]})]}),o.jsx(O0,{isOpen:m,onClose:()=>b(!1)}),o.jsx(z0,{isOpen:S,onClose:()=>E(!1)})]})}U.memo(function({item:r}){const[i,s]=U.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(Ds,{content:r.description})})]})]})});function qv({isOpen:e,isRetry:r,onSubmit:i,onCancel:s}){const[c,d]=U.useState(""),p=U.useRef(null);U.useEffect(()=>{e&&(d(""),setTimeout(()=>{var h;return(h=p.current)==null?void 0:h.focus()},100))},[e]);const l=h=>{h.preventDefault(),c.trim()&&i(c)};return o.jsx(un,{isOpen:e,onClose:s,title:r?"Invalid Password":"Password Required",size:"sm",children:o.jsxs("form",{onSubmit:l,className:"space-y-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:r?"The password you entered was incorrect. Please try again.":"This server requires a password to connect."}),o.jsx(Ml,{ref:p,type:"password",value:c,onChange:h=>d(h.target.value),placeholder:"Enter password",autoFocus:!0}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(dt,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),o.jsx(dt,{type:"submit",disabled:!c.trim(),children:r?"Try Again":"Connect"})]})]})})}const b4=[8e3,11434,8080];function Wv(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"auto":return"Auto";case"unknown":return"Unknown";default:return e}}function Yh({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 y4(){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 _4(){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 Kh({currentStep:e,totalSteps:r,labels:i}){return o.jsx("div",{className:"flex items-center gap-2 mb-8",children:Array.from({length:r},(s,c)=>o.jsxs("div",{className:"flex items-center",children:[o.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors ${c+1<e?"bg-accent-primary text-white":c+1===e?"bg-accent-primary/25 text-white border-2 border-accent-primary":"bg-bg-tertiary text-text-muted"}`,children:c+1<e?"✓":c+1}),o.jsx("span",{className:`ml-2 text-sm ${c+1===e?"text-text-primary":"text-text-muted"}`,children:i[c]}),c<r-1&&o.jsx("div",{className:`w-8 h-px mx-4 ${c+1<e?"bg-accent-primary":"bg-border"}`})]},c))})}function S4({onNext:e}){const[r,i]=U.useState([]),[s,c]=U.useState([]),[d,p]=U.useState(!1),[l,h]=U.useState(""),[f,g]=U.useState(""),[m,b]=U.useState("auto"),[S,E]=U.useState(!1),[C,x]=U.useState(null),[_,v]=U.useState(null),[y,j]=U.useState(null),[A,N]=U.useState("");U.useEffect(()=>{L()},[]);async function L(){try{const $=await _e("/api/providers");if($.ok){const P=(await $.json()).providers.map(V=>({id:V.id,name:V.name,url:V.url,backend:V.backend,model:null}));i(P),c(P)}}catch{}}async function T($){E(!0),x(null);try{const P=await(await _e("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:$})})).json();P.success?(b(P.backend??"auto"),x({success:!0,model:P.model??void 0})):x({success:!1,error:P.error??"Connection failed"})}catch(I){x({success:!1,error:I instanceof Error?I.message:"Connection failed"})}E(!1)}function B(){if(!f)return;const $=l||`Provider ${s.length+1}`,I={id:`temp-${Date.now()}`,name:$,url:f,backend:C!=null&&C.success?m:"auto",model:C!=null&&C.success?C.model??null:null};c([...s,I]),h(""),g(""),x(null)}function H($){v($),r.some(P=>P.id===$)?_e(`/api/providers/${$}`,{method:"DELETE"}).then(()=>{c(s.filter(P=>P.id!==$)),i(r.filter(P=>P.id!==$)),v(null)}).catch(()=>{v(null)}):(c(s.filter(P=>P.id!==$)),v(null))}async function W(){for(const I of s)(I.id.startsWith("temp-")||!r.some(P=>P.id===I.id))&&((await _e("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:I.name,url:I.url,backend:I.backend,model:I.model})})).ok||console.error("Failed to add provider",I));const $=s.filter(I=>!I.id.startsWith("temp-"));e({providers:$})}const Y=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.jsx(Kh,{currentStep:1,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"]}),o.jsxs("div",{className:"space-y-4",children:[s.length>0?o.jsx("div",{className:"space-y-2",children:s.map($=>o.jsxs("div",{className:"flex items-center justify-between bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-2 py-0.5 bg-accent-primary/25 text-accent-primary rounded text-xs font-medium",children:Wv($.backend)}),y===$.id?o.jsx("input",{type:"text",value:A,onChange:I=>N(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(c(s.map(P=>P.id===$.id?{...P,name:A}:P)),j(null)),I.key==="Escape"&&j(null)},onBlur:()=>{c(s.map(I=>I.id===$.id?{...I,name:A}:I)),j(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:()=>{j($.id),N($.name)},title:"Click to edit",children:$.name})]}),o.jsx("p",{className:"text-text-muted text-sm mt-1",children:$.url}),$.model&&o.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",$.model]})]}),o.jsx("button",{onClick:()=>H($.id),disabled:_===$.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:o.jsx(_4,{})})]},$.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"})}),d?o.jsxs("form",{onSubmit:$=>{$.preventDefault(),f&&B()},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:"Presets"}),o.jsx("div",{className:"grid grid-cols-3 gap-2",children:b4.map($=>o.jsxs("button",{type:"button",onClick:()=>{g(`http://localhost:${$}`),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===`http://localhost:${$}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",$]},$))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Or enter address manually"}),o.jsx("input",{type:"text",name:"url",value:f,onChange:$=>{g($.target.value),x(null)},onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),T(f))},placeholder:"http://localhost:8000",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Provider name (optional)"}),o.jsx("input",{type:"text",name:"name",value:l,onChange:$=>h($.target.value),onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),B())},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"})]}),C&&o.jsx("div",{className:`p-3 rounded-lg ${C.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:C.success?o.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",Wv(m),C.model&&` (${C.model})`]}):o.jsx("p",{className:"text-red-500",children:C.error})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{type:"button",onClick:()=>T(f),disabled:!f||S,className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted disabled:opacity-50",children:S?o.jsx(Yh,{size:"sm"}):"Test Connection"}),o.jsx("button",{type:"submit",disabled:!f,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:C!=null&&C.success?"Add Provider ✓":"Add Provider"})]}),o.jsx("button",{type:"button",onClick:()=>{p(!1),h(""),g(""),x(null)},className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]}):o.jsxs("button",{onClick:()=>p(!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(y4,{}),"Add Provider"]}),o.jsx("button",{onClick:W,disabled:!Y,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 w4({onNext:e}){const[r,i]=U.useState(""),[s,c]=U.useState(!1);U.useEffect(()=>{_e("/api/config").then(p=>p.json()).then(p=>{p.workdir?i(p.workdir):fetch("/api/directories?path="+encodeURIComponent("/home")).then(l=>l.json()).then(l=>{l.current&&i(l.current)}).catch(()=>{})}).catch(()=>{fetch("/api/directories?path="+encodeURIComponent("/home")).then(p=>p.json()).then(p=>{p.current&&i(p.current)}).catch(()=>{})})},[]);async function d(){c(!0);const p=document.createElement("input");p.type="file",p.webkitdirectory=!0,p.onchange=l=>{const h=l.target.files;if(h&&h.length>0){const f=h[0].path;f&&i(f.replace(/\/[^/]*$/,""))}c(!1)},p.click()}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:"Your Projects Folder"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Where should OpenFox create project folders?"}),o.jsx(Kh,{currentStep:2,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"]}),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:p=>i(p.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:d,disabled:s,className:"px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted disabled:opacity-50",children:s?o.jsx(Yh,{size:"sm"}):"Browse"})]})]}),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 C4({onNext:e}){const[r,i]=U.useState(!1),[s,c]=U.useState("http://localhost:11434"),[d,p]=U.useState("qwen3-vl:2b"),{copied:l,copy:h}=N0();U.useEffect(()=>{_e("/api/config").then(g=>g.json()).then(g=>{g.visionFallback&&(i(g.visionFallback.enabled),c(g.visionFallback.url),p(g.visionFallback.model))}).catch(()=>{})},[]);function f(g){if(g){e({});return}e({visionFallback:{enabled:r,url:s,model:d,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.jsx(Kh,{currentStep:3,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"]}),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:()=>h("ollama pull qwen3-vl:2b"),className:"text-text-muted hover:text-text-primary transition-colors",title:"Copy",children:l?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:"M5 13l4 4L19 7"})}):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=>c(g.target.value),placeholder:"http://localhost:11434",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision model name"}),o.jsx("input",{type:"text",value:d,onChange:g=>p(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:()=>f(!0),className:"text-text-muted hover:text-text-secondary text-sm underline",children:"Skip for now"}),o.jsx("button",{onClick:()=>f(!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 k4({onClick:e}){return o.jsx("button",{onClick:e,className:"absolute top-4 right-4 p-2 text-text-muted hover:text-text-primary transition-colors",title:"Close",children:o.jsx("svg",{className:"w-6 h-6",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 E4({onComplete:e}){const[r,i]=U.useState(1),[s,c]=U.useState(!1),[d,p]=U.useState({});async function l(g){p(m=>({...m,providers:g.providers})),i(2)}async function h(g){p(m=>({...m,...g})),i(3)}async function f(g){c(!0);try{if(!(await _e("/api/init/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:d.workdir,visionFallback:g.visionFallback})})).ok)throw new Error("Failed to save config");e()}catch(m){console.error("Failed to save onboarding data:",m),c(!1)}}return o.jsxs("div",{className:"min-h-screen bg-bg-primary flex items-center justify-center p-8 relative",children:[o.jsx(k4,{onClick:e}),o.jsx("div",{className:"w-full max-w-2xl",children:s?o.jsxs("div",{className:"text-center",children:[o.jsx(Yh,{size:"md"}),o.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):o.jsxs(o.Fragment,{children:[r===1&&o.jsx(S4,{onNext:l}),r===2&&o.jsx(w4,{onNext:h}),r===3&&o.jsx(C4,{onNext:f})]})})]})}function Xh(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function H0(){return o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(dh,{})})}function j4({sidebarOpen:e,onSidebarToggle:r}){const[,i]=oh("/p/:projectId"),s=i==null?void 0:i.projectId,c=Ee(m=>m.connectionStatus),d=Ee(m=>m.listSessions),p=Ee(m=>m.clearSession),l=Ut(m=>m.currentProject),h=Ut(m=>m.loadProject),f=Xh(),g=c==="connected"||f;return U.useEffect(()=>{g&&s&&((l==null?void 0:l.id)!==s&&h(s),d(s),p())},[g,s,l==null?void 0:l.id,h,d,p]),!l||l.id!==s?o.jsx(H0,{}):o.jsxs(o.Fragment,{children:[o.jsx(cb,{projectId:s,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(US,{})})]})}function N4({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:i,onRightSidebarToggle:s}){const[,c]=oh("/p/:projectId/s/:sessionId"),d=c==null?void 0:c.projectId,p=c==null?void 0:c.sessionId,[,l]=sr(),h=Ee(y=>y.connectionStatus),f=Ee(y=>y.currentSession),g=Ee(y=>y.loadSession),m=Ee(y=>y.listSessions),b=Ee(y=>y.pendingSessionCreate),S=Ee(y=>y.error),E=Ee(y=>y.clearError),C=Ut(y=>y.currentProject),x=Ut(y=>y.loadProject),_=Xh(),v=h==="connected"||_;return U.useEffect(()=>{v&&d&&(C==null?void 0:C.id)!==d&&x(d)},[v,d,C==null?void 0:C.id,x]),U.useEffect(()=>{v&&p&&(f==null?void 0:f.id)!==p&&!b&&g(p),v&&d&&m(d)},[v,p,f==null?void 0:f.id,g,m,b,d]),U.useEffect(()=>{(S==null?void 0:S.code)==="NOT_FOUND"&&d&&(E(),l(`/p/${d}`))},[S,d,E,l]),!C||C.id!==d?o.jsx(H0,{}):o.jsxs(o.Fragment,{children:[o.jsx(cb,{projectId:d,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(v4,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:s})})]})}function T4(){const e=Ht(i=>i.fetchConfig);function r(){e(),window.history.back()}return o.jsx("div",{className:"flex-1 flex flex-col",children:o.jsx(E4,{onComplete:r})})}function A4(){const{connectionStatus:e}=aS(),r=Ht(W=>W.fetchConfig),i=Ht(W=>W.providers),[,s]=sr(),c=Xh(),[d,p]=U.useState(!1);U.useEffect(()=>{(e==="connected"||c)&&r().then(()=>{p(!0)})},[e,c,r]),U.useEffect(()=>{d&&i.length===0&&s("/onboarding")},[d,i.length]);const l=()=>{const W=localStorage.getItem("openfox:leftSidebar");return W!==null?W==="true":!1},h=()=>{const W=localStorage.getItem("openfox:rightSidebar");return W!==null?W==="true":!0},[f,g]=U.useState(l),[m,b]=U.useState(h),[S,E]=U.useState(!1),[C,x]=U.useState(!1),[_,v]=U.useState(!1);U.useEffect(()=>{const W=()=>{v(window.innerWidth<768)};return W(),window.addEventListener("resize",W),()=>window.removeEventListener("resize",W)},[]);const y=_?S:f,j=_?C:m,A=()=>{_?E(!S):g(!f)},N=()=>{_?x(!C):b(!m)};U.useEffect(()=>{_||localStorage.setItem("openfox:leftSidebar",String(f))},[f,_]),U.useEffect(()=>{_||localStorage.setItem("openfox:rightSidebar",String(m))},[m,_]),U.useEffect(()=>{(e==="connected"||c)&&r()},[e,r,c]);const L=Ee(W=>W.showPasswordModal),T=Ee(W=>W.passwordModalRetry),B=Ee(W=>W.submitPassword),H=Ee(W=>W.cancelPassword);return e!=="connected"&&!L&&!c?o.jsxs(o.Fragment,{children:[o.jsx(qv,{isOpen:!0,isRetry:T,onSubmit:B,onCancel:H}),o.jsx("div",{className:"h-screen flex items-center justify-center",children:o.jsx(PS,{text:"Connecting to server..."})})]}):o.jsxs(o.Fragment,{children:[o.jsx(qv,{isOpen:L,isRetry:T,onSubmit:B,onCancel:H}),o.jsxs("div",{className:"h-screen flex flex-col",children:[o.jsx(RS,{}),o.jsx(TS,{onMenuClick:A,onCriteriaToggle:N}),o.jsx("div",{className:"flex-1 flex overflow-hidden",children:o.jsxs(R1,{children:[o.jsx(ka,{path:"/onboarding",children:o.jsx(T4,{})}),o.jsx(ka,{path:"/p/:projectId/s/:sessionId",children:o.jsx(N4,{sidebarOpen:y,onSidebarToggle:A,rightSidebarOpen:j,onRightSidebarToggle:N})}),o.jsx(ka,{path:"/p/:projectId/new",children:o.jsx(FS,{})}),o.jsx(ka,{path:"/p/:projectId",children:o.jsx(j4,{sidebarOpen:y,onSidebarToggle:A})}),o.jsx(ka,{path:"/",children:o.jsx(zS,{})})]})})]})]})}d1.createRoot(document.getElementById("root")).render(o.jsx(ln.StrictMode,{children:o.jsx(A4,{})}));
|