openfox 1.6.14 → 1.6.16
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-C4PMBB24.js → auto-compaction-2RKC6DC2.js} +5 -5
- package/dist/{chat-handler-US3QOOE4.js → chat-handler-IY2XVOO6.js} +26 -56
- package/dist/{chunk-7HLRI6JM.js → chunk-2KP34IDL.js} +161 -204
- package/dist/{chunk-N25QUEPO.js → chunk-4OI4VPZ6.js} +434 -812
- package/dist/{chunk-XFXOSPYH.js → chunk-55N6FAAZ.js} +1 -1
- package/dist/{chunk-5GE3QJSZ.js → chunk-6L3X7T4K.js} +82 -160
- package/dist/{chunk-QDEKU5RL.js → chunk-F54ZJN4X.js} +38 -2
- package/dist/{chunk-UL4JYQKK.js → chunk-IN5EP4ZB.js} +2 -2
- package/dist/{chunk-OOIRCXAY.js → chunk-KOUMYBYM.js} +53 -112
- package/dist/{chunk-3JU6H6A4.js → chunk-NN65D5SI.js} +426 -448
- package/dist/{chunk-3XZ23PXM.js → chunk-OVLFEBRR.js} +76 -92
- package/dist/chunk-SN7OBEVL.js +44 -0
- package/dist/{chunk-PCOG5FQD.js → chunk-T5PBG2PE.js} +6 -6
- package/dist/{chunk-H22VHHQ4.js → chunk-U54QVKL2.js} +4 -4
- package/dist/{chunk-J2DHVXRX.js → chunk-ZDNXCVW4.js} +2 -2
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{config-DEM6ASQM.js → config-67AX6CNS.js} +5 -5
- package/dist/{events-VDAC7E7K.js → events-2ETDOE5B.js} +3 -3
- package/dist/{folding-NDFQCISZ.js → folding-M7FMUBOL.js} +6 -4
- package/dist/{orchestrator-KZI7B5IS.js → orchestrator-U5VCLBYQ.js} +6 -6
- package/dist/package.json +13 -3
- package/dist/{processor-KBSF2HFD.js → processor-VUEJM73B.js} +24 -49
- package/dist/{provider-K3PHZO27.js → provider-DKGBQHUS.js} +7 -7
- package/dist/{serve-DERN4AB6.js → serve-GOLQMQFA.js} +12 -12
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +10 -10
- package/dist/{tools-PLVK22CF.js → tools-55YICCVH.js} +5 -5
- package/dist/{vision-fallback-NOC3YYIB.js → vision-fallback-ADYRFFD4.js} +2 -2
- package/dist/web/assets/index-CZBXRYpK.js +150 -0
- package/dist/web/assets/{index-MCWDS5UQ.css → index-D4V7Gtvt.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +13 -3
- package/dist/web/assets/index-Ccy2Csbl.js +0 -150
- /package/dist/{command-defaults → server/commands/defaults}/commit-push.command.md +0 -0
- /package/dist/{command-defaults → server/commands/defaults}/init.command.md +0 -0
- /package/dist/{command-defaults → server/commands/defaults}/test-ui.command.md +0 -0
- /package/dist/{skill-defaults → server/skills/defaults}/browser.skill.md +0 -0
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
var i1=Object.defineProperty;var s1=(e,r,i)=>r in e?i1(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i;var tr=(e,r,i)=>s1(e,typeof r!="symbol"?r+"":r,i);function a1(e,r){for(var i=0;i<r.length;i++){const s=r[i];if(typeof s!="string"&&!Array.isArray(s)){for(const c in s)if(c!=="default"&&!(c in e)){const u=Object.getOwnPropertyDescriptor(s,c);u&&Object.defineProperty(e,c,u.get?u:{enumerable:!0,get:()=>s[c]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))s(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const p of u.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&s(p)}).observe(document,{childList:!0,subtree:!0});function i(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();function Il(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dd={exports:{}},Ca={};/**
|
|
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 Xg;function o1(){if(Xg)return Ca;Xg=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(s,c,u){var p=null;if(u!==void 0&&(p=""+u),c.key!==void 0&&(p=""+c.key),"key"in c){u={};for(var l in c)l!=="key"&&(u[l]=c[l])}else u=c;return c=u.ref,{$$typeof:e,type:s,key:p,ref:c!==void 0?c:null,props:u}}return Ca.Fragment=r,Ca.jsx=i,Ca.jsxs=i,Ca}var Zg;function l1(){return Zg||(Zg=1,dd.exports=o1()),dd.exports}var o=l1(),hd={exports:{}},Ue={};/**
|
|
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 Qg;function c1(){if(Qg)return Ue;Qg=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),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"),v=Symbol.iterator;function S(O){return O===null||typeof O!="object"?null:(O=v&&O[v]||O["@@iterator"],typeof O=="function"?O:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,b={};function y(O,W,U){this.props=O,this.context=W,this.refs=b,this.updater=U||E}y.prototype.isReactComponent={},y.prototype.setState=function(O,W){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,W,"setState")},y.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function x(){}x.prototype=y.prototype;function _(O,W,U){this.props=O,this.context=W,this.refs=b,this.updater=U||E}var j=_.prototype=new x;j.constructor=_,C(j,y.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 I(O,W,U){var K=U.ref;return{$$typeof:e,type:O,key:W,ref:K!==void 0?K:null,props:U}}function z(O,W){return I(O.type,W,O.props)}function V(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function Y(O){var W={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(U){return W[U]})}var $=/\/+/g;function F(O,W){return typeof O=="object"&&O!==null&&O.key!=null?Y(""+O.key):W.toString(36)}function B(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(W){O.status==="pending"&&(O.status="fulfilled",O.value=W)},function(W){O.status==="pending"&&(O.status="rejected",O.reason=W)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function q(O,W,U,K,te){var Q=typeof O;(Q==="undefined"||Q==="boolean")&&(O=null);var Z=!1;if(O===null)Z=!0;else switch(Q){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(O.$$typeof){case e:case r:Z=!0;break;case g:return Z=O._init,q(Z(O._payload),W,U,K,te)}}if(Z)return te=te(O),Z=K===""?"."+F(O,0):K,A(te)?(U="",Z!=null&&(U=Z.replace($,"$&/")+"/"),q(te,W,U,"",function(ie){return ie})):te!=null&&(V(te)&&(te=z(te,U+(te.key==null||O&&O.key===te.key?"":(""+te.key).replace($,"$&/")+"/")+Z)),W.push(te)),1;Z=0;var H=K===""?".":K+":";if(A(O))for(var se=0;se<O.length;se++)K=O[se],Q=H+F(K,se),Z+=q(K,W,U,Q,te);else if(se=S(O),typeof se=="function")for(O=se.call(O),se=0;!(K=O.next()).done;)K=K.value,Q=H+F(K,se++),Z+=q(K,W,U,Q,te);else if(Q==="object"){if(typeof O.then=="function")return q(B(O),W,U,K,te);throw W=String(O),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return Z}function X(O,W,U){if(O==null)return O;var K=[],te=0;return q(O,K,"","",function(Q){return W.call(U,Q,te++)}),K}function J(O){if(O._status===-1){var W=O._result;W=W(),W.then(function(U){(O._status===0||O._status===-1)&&(O._status=1,O._result=U)},function(U){(O._status===0||O._status===-1)&&(O._status=2,O._result=U)}),O._status===-1&&(O._status=0,O._result=W)}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 W=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(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},D={map:X,forEach:function(O,W,U){X(O,function(){W.apply(this,arguments)},U)},count:function(O){var W=0;return X(O,function(){W++}),W},toArray:function(O){return X(O,function(W){return W})||[]},only:function(O){if(!V(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return Ue.Activity=m,Ue.Children=D,Ue.Component=y,Ue.Fragment=i,Ue.Profiler=c,Ue.PureComponent=_,Ue.StrictMode=s,Ue.Suspense=h,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(O){return L.H.useMemoCache(O)}},Ue.cache=function(O){return function(){return O.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(O,W,U){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(W!=null)for(Q in W.key!==void 0&&(te=""+W.key),W)!T.call(W,Q)||Q==="key"||Q==="__self"||Q==="__source"||Q==="ref"&&W.ref===void 0||(K[Q]=W[Q]);var Q=arguments.length-2;if(Q===1)K.children=U;else if(1<Q){for(var Z=Array(Q),H=0;H<Q;H++)Z[H]=arguments[H+2];K.children=Z}return I(O.type,te,K)},Ue.createContext=function(O){return O={$$typeof:p,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:u,_context:O},O},Ue.createElement=function(O,W,U){var K,te={},Q=null;if(W!=null)for(K in W.key!==void 0&&(Q=""+W.key),W)T.call(W,K)&&K!=="key"&&K!=="__self"&&K!=="__source"&&(te[K]=W[K]);var Z=arguments.length-2;if(Z===1)te.children=U;else if(1<Z){for(var H=Array(Z),se=0;se<Z;se++)H[se]=arguments[se+2];te.children=H}if(O&&O.defaultProps)for(K in Z=O.defaultProps,Z)te[K]===void 0&&(te[K]=Z[K]);return I(O,Q,te)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(O){return{$$typeof:l,render:O}},Ue.isValidElement=V,Ue.lazy=function(O){return{$$typeof:g,_payload:{_status:-1,_result:O},_init:J}},Ue.memo=function(O,W){return{$$typeof:f,type:O,compare:W===void 0?null:W}},Ue.startTransition=function(O){var W=L.T,U={};L.T=U;try{var K=O(),te=L.S;te!==null&&te(U,K),typeof K=="object"&&K!==null&&typeof K.then=="function"&&K.then(N,R)}catch(Q){R(Q)}finally{W!==null&&U.types!==null&&(W.types=U.types),L.T=W}},Ue.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Ue.use=function(O){return L.H.use(O)},Ue.useActionState=function(O,W,U){return L.H.useActionState(O,W,U)},Ue.useCallback=function(O,W){return L.H.useCallback(O,W)},Ue.useContext=function(O){return L.H.useContext(O)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(O,W){return L.H.useDeferredValue(O,W)},Ue.useEffect=function(O,W){return L.H.useEffect(O,W)},Ue.useEffectEvent=function(O){return L.H.useEffectEvent(O)},Ue.useId=function(){return L.H.useId()},Ue.useImperativeHandle=function(O,W,U){return L.H.useImperativeHandle(O,W,U)},Ue.useInsertionEffect=function(O,W){return L.H.useInsertionEffect(O,W)},Ue.useLayoutEffect=function(O,W){return L.H.useLayoutEffect(O,W)},Ue.useMemo=function(O,W){return L.H.useMemo(O,W)},Ue.useOptimistic=function(O,W){return L.H.useOptimistic(O,W)},Ue.useReducer=function(O,W,U){return L.H.useReducer(O,W,U)},Ue.useRef=function(O){return L.H.useRef(O)},Ue.useState=function(O){return L.H.useState(O)},Ue.useSyncExternalStore=function(O,W,U){return L.H.useSyncExternalStore(O,W,U)},Ue.useTransition=function(){return L.H.useTransition()},Ue.version="19.2.4",Ue}var Jg;function Bl(){return Jg||(Jg=1,hd.exports=c1()),hd.exports}var P=Bl();const cn=Il(P),u1=a1({__proto__:null,default:cn},[P]);var fd={exports:{}},ka={},pd={exports:{}},md={};/**
|
|
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 ex;function d1(){return ex||(ex=1,(function(e){function r(q,X){var J=q.length;q.push(X);e:for(;0<J;){var R=J-1>>>1,D=q[R];if(0<c(D,X))q[R]=X,q[J]=D,J=R;else break e}}function i(q){return q.length===0?null:q[0]}function s(q){if(q.length===0)return null;var X=q[0],J=q.pop();if(J!==X){q[0]=J;e:for(var R=0,D=q.length,O=D>>>1;R<O;){var W=2*(R+1)-1,U=q[W],K=W+1,te=q[K];if(0>c(U,J))K<D&&0>c(te,U)?(q[R]=te,q[K]=J,R=K):(q[R]=U,q[W]=J,R=W);else if(K<D&&0>c(te,J))q[R]=te,q[K]=J,R=K;else break e}}return X}function c(q,X){var J=q.sortIndex-X.sortIndex;return J!==0?J:q.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var p=Date,l=p.now();e.unstable_now=function(){return p.now()-l}}var h=[],f=[],g=1,m=null,v=3,S=!1,E=!1,C=!1,b=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function j(q){for(var X=i(f);X!==null;){if(X.callback===null)s(f);else if(X.startTime<=q)s(f),X.sortIndex=X.expirationTime,r(h,X);else break;X=i(f)}}function A(q){if(C=!1,j(q),!E)if(i(h)!==null)E=!0,N||(N=!0,Y());else{var X=i(f);X!==null&&B(A,X.startTime-q)}}var N=!1,L=-1,T=5,I=-1;function z(){return b?!0:!(e.unstable_now()-I<T)}function V(){if(b=!1,N){var q=e.unstable_now();I=q;var X=!0;try{e:{E=!1,C&&(C=!1,x(L),L=-1),S=!0;var J=v;try{t:{for(j(q),m=i(h);m!==null&&!(m.expirationTime>q&&z());){var R=m.callback;if(typeof R=="function"){m.callback=null,v=m.priorityLevel;var D=R(m.expirationTime<=q);if(q=e.unstable_now(),typeof D=="function"){m.callback=D,j(q),X=!0;break t}m===i(h)&&s(h),j(q)}else s(h);m=i(h)}if(m!==null)X=!0;else{var O=i(f);O!==null&&B(A,O.startTime-q),X=!1}}break e}finally{m=null,v=J,S=!1}X=void 0}}finally{X?Y():N=!1}}}var Y;if(typeof _=="function")Y=function(){_(V)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,F=$.port2;$.port1.onmessage=V,Y=function(){F.postMessage(null)}}else Y=function(){y(V,0)};function B(q,X){L=y(function(){q(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(q){switch(v){case 1:case 2:case 3:var X=3;break;default:X=v}var J=v;v=X;try{return q()}finally{v=J}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(q,X){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var J=v;v=q;try{return X()}finally{v=J}},e.unstable_scheduleCallback=function(q,X,J){var R=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?R+J:R):J=R,q){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=J+D,q={id:g++,callback:X,priorityLevel:q,startTime:J,expirationTime:D,sortIndex:-1},J>R?(q.sortIndex=J,r(f,q),i(h)===null&&q===i(f)&&(C?(x(L),L=-1):C=!0,B(A,J-R))):(q.sortIndex=D,r(h,q),E||S||(E=!0,N||(N=!0,Y()))),q},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(q){var X=v;return function(){var J=v;v=X;try{return q.apply(this,arguments)}finally{v=J}}}})(md)),md}var tx;function h1(){return tx||(tx=1,pd.exports=d1()),pd.exports}var gd={exports:{}},nn={};/**
|
|
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 nx;function f1(){if(nx)return nn;nx=1;var e=Bl();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 u(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 nn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,nn.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 u(h,f,null,g)},nn.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()}},nn.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))},nn.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},nn.preinit=function(h,f){if(typeof h=="string"&&f&&typeof f.as=="string"){var g=f.as,m=l(g,f.crossOrigin),v=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:v,fetchPriority:S}):g==="script"&&s.d.X(h,{crossOrigin:m,integrity:v,fetchPriority:S,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},nn.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)},nn.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})}},nn.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)},nn.requestFormReset=function(h){s.d.r(h)},nn.unstable_batchedUpdates=function(h,f){return h(f)},nn.useFormState=function(h,f,g){return p.H.useFormState(h,f,g)},nn.useFormStatus=function(){return p.H.useHostTransitionStatus()},nn.version="19.2.4",nn}var rx;function Yv(){if(rx)return gd.exports;rx=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(),gd.exports=f1(),gd.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 ix;function p1(){if(ix)return ka;ix=1;var e=h1(),r=Bl(),i=Yv();function s(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var n=t,a=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(a=n.return),t=n.return;while(t)}return n.tag===3?a:null}function 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(u(t)!==t)throw Error(s(188))}function f(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(s(188));return n!==t?null:t}for(var a=t,d=n;;){var w=a.return;if(w===null)break;var k=w.alternate;if(k===null){if(d=w.return,d!==null){a=d;continue}break}if(w.child===k.child){for(k=w.child;k;){if(k===a)return h(w),t;if(k===d)return h(w),n;k=k.sibling}throw Error(s(188))}if(a.return!==d.return)a=w,d=k;else{for(var M=!1,G=w.child;G;){if(G===a){M=!0,a=w,d=k;break}if(G===d){M=!0,d=w,a=k;break}G=G.sibling}if(!M){for(G=k.child;G;){if(G===a){M=!0,a=k,d=w;break}if(G===d){M=!0,d=k,a=w;break}G=G.sibling}if(!M)throw Error(s(189))}}if(a.alternate!==d)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?t:n}function g(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=g(t),n!==null)return n;t=t.sibling}return null}var m=Object.assign,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),_=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"),I=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function Y(t){return t===null||typeof t!="object"?null:(t=V&&t[V]||t["@@iterator"],typeof t=="function"?t:null)}var $=Symbol.for("react.client.reference");function F(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 y:return"Profiler";case b:return"StrictMode";case A:return"Suspense";case N:return"SuspenseList";case I:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case E:return"Portal";case _:return t.displayName||"Context";case x:return(t._context.displayName||"Context")+".Consumer";case j:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case L:return n=t.displayName||null,n!==null?n:F(t.type)||"Memo";case T:n=t._payload,t=t._init;try{return F(t(n))}catch{}}return null}var B=Array.isArray,q=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},R=[],D=-1;function O(t){return{current:t}}function W(t){0>D||(t.current=R[D],R[D]=null,D--)}function U(t,n){D++,R[D]=t.current,t.current=n}var K=O(null),te=O(null),Q=O(null),Z=O(null);function H(t,n){switch(U(Q,n),U(te,t),U(K,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?bg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=bg(n),t=yg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}W(K),U(K,t)}function se(){W(K),W(te),W(Q)}function ie(t){t.memoizedState!==null&&U(Z,t);var n=K.current,a=yg(n,t.type);n!==a&&(U(te,t),U(K,a))}function ge(t){te.current===t&&(W(K),W(te)),Z.current===t&&(W(Z),ya._currentValue=J)}var ve,Ee;function De(t){if(ve===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);ve=n&&n[1]||"",Ee=-1<a.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+ve+t+Ee}var Re=!1;function $e(t,n){if(!t||Re)return"";Re=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={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]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=d.DetermineComponentFrameRoot(),M=k[0],G=k[1];if(M&&G){var ee=M.split(`
|
|
44
|
-
`),le=G.split(`
|
|
45
|
-
`);for(w=d=0;d<ee.length&&!ee[d].includes("DetermineComponentFrameRoot");)d++;for(;w<le.length&&!le[w].includes("DetermineComponentFrameRoot");)w++;if(d===ee.length||w===le.length)for(d=ee.length-1,w=le.length-1;1<=d&&0<=w&&ee[d]!==le[w];)w--;for(;1<=d&&0<=w;d--,w--)if(ee[d]!==le[w]){if(d!==1||w!==1)do if(d--,w--,0>w||ee[d]!==le[w]){var fe=`
|
|
46
|
-
`+ee[d].replace(" at new "," at ");return t.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",t.displayName)),fe}while(1<=d&&0<=w);break}}}finally{Re=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?De(a):""}function we(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 $e(t.type,!1);case 11:return $e(t.type.render,!1);case 1:return $e(t.type,!0);case 31:return De("Activity");default:return""}}function lt(t){try{var n="",a=null;do n+=we(t,a),a=t,t=t.return;while(t);return n}catch(d){return`
|
|
47
|
-
Error generating stack: `+d.message+`
|
|
48
|
-
`+d.stack}}var ht=Object.prototype.hasOwnProperty,pe=e.unstable_scheduleCallback,Me=e.unstable_cancelCallback,nt=e.unstable_shouldYield,Ke=e.unstable_requestPaint,Ye=e.unstable_now,ct=e.unstable_getCurrentPriorityLevel,de=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Te=e.unstable_NormalPriority,He=e.unstable_LowPriority,ae=e.unstable_IdlePriority,je=e.log,ke=e.unstable_setDisableYieldValue,Pe=null,Fe=null;function ft(t){if(typeof je=="function"&&ke(t),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(Pe,t)}catch{}}var qe=Math.clz32?Math.clz32:Se,qt=Math.log,he=Math.LN2;function Se(t){return t>>>=0,t===0?32:31-(qt(t)/he|0)|0}var ze=256,Xe=262144,rt=4194304;function Ie(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 Rt(t,n,a){var d=t.pendingLanes;if(d===0)return 0;var w=0,k=t.suspendedLanes,M=t.pingedLanes;t=t.warmLanes;var G=d&134217727;return G!==0?(d=G&~k,d!==0?w=Ie(d):(M&=G,M!==0?w=Ie(M):a||(a=G&~t,a!==0&&(w=Ie(a))))):(G=d&~k,G!==0?w=Ie(G):M!==0?w=Ie(M):a||(a=d&~t,a!==0&&(w=Ie(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 Kt(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 Jl(){var t=rt;return rt<<=1,(rt&62914560)===0&&(rt=4194304),t}function Rs(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function Ms(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function G0(t,n,a,d,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,ee=t.expirationTimes,le=t.hiddenUpdates;for(a=M&~a;0<a;){var fe=31-qe(a),xe=1<<fe;G[fe]=0,ee[fe]=-1;var ce=le[fe];if(ce!==null)for(le[fe]=null,fe=0;fe<ce.length;fe++){var ue=ce[fe];ue!==null&&(ue.lane&=-536870913)}a&=~xe}d!==0&&ef(t,d,0),k!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=k&~(M&~n))}function ef(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var d=31-qe(n);t.entangledLanes|=n,t.entanglements[d]=t.entanglements[d]|1073741824|a&261930}function tf(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var d=31-qe(a),w=1<<d;w&n|t[d]&n&&(t[d]|=n),a&=~w}}function nf(t,n){var a=n&-n;return a=(a&42)!==0?1:ec(a),(a&(t.suspendedLanes|n))!==0?0:a}function ec(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 tc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function rf(){var t=X.p;return t!==0?t:(t=window.event,t===void 0?32:$g(t.type))}function sf(t,n){var a=X.p;try{return X.p=t,n()}finally{X.p=a}}var Tr=Math.random().toString(36).slice(2),Xt="__reactFiber$"+Tr,hn="__reactProps$"+Tr,Oi="__reactContainer$"+Tr,nc="__reactEvents$"+Tr,V0="__reactListeners$"+Tr,Y0="__reactHandles$"+Tr,af="__reactResources$"+Tr,Os="__reactMarker$"+Tr;function rc(t){delete t[Xt],delete t[hn],delete t[nc],delete t[V0],delete t[Y0]}function Ii(t){var n=t[Xt];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Oi]||a[Xt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=jg(t);t!==null;){if(a=t[Xt])return a;t=jg(t)}return n}t=a,a=t.parentNode}return null}function Bi(t){if(t=t[Xt]||t[Oi]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Is(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function zi(t){var n=t[af];return n||(n=t[af]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Wt(t){t[Os]=!0}var of=new Set,lf={};function ai(t,n){Hi(t,n),Hi(t+"Capture",n)}function Hi(t,n){for(lf[t]=n,t=0;t<n.length;t++)of.add(n[t])}var K0=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]*$"),cf={},uf={};function X0(t){return ht.call(uf,t)?!0:ht.call(cf,t)?!1:K0.test(t)?uf[t]=!0:(cf[t]=!0,!1)}function eo(t,n,a){if(X0(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var d=n.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function to(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 lr(t,n,a,d){if(d===null)t.removeAttribute(a);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+d)}}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 df(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Z0(t,n,a){var d=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var w=d.get,k=d.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:d.enumerable}),{getValue:function(){return a},setValue:function(M){a=""+M},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function ic(t){if(!t._valueTracker){var n=df(t)?"checked":"value";t._valueTracker=Z0(t,n,""+t[n])}}function hf(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),d="";return t&&(d=df(t)?t.checked?"true":"false":t.value),t=d,t!==a?(n.setValue(t),!0):!1}function no(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Q0=/[\n"\\]/g;function Mn(t){return t.replace(Q0,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function sc(t,n,a,d,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?ac(t,M,Rn(n)):a!=null?ac(t,M,Rn(a)):d!=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 ff(t,n,a,d,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)){ic(t);return}a=a!=null?""+Rn(a):"",n=n!=null?""+Rn(n):a,G||n===t.value||(t.value=n),t.defaultValue=n}d=d??w,d=typeof d!="function"&&typeof d!="symbol"&&!!d,t.checked=G?t.checked:!!d,t.defaultChecked=!!d,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(t.name=M),ic(t)}function ac(t,n,a){n==="number"&&no(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Pi(t,n,a,d){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&&d&&(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,d&&(t[w].defaultSelected=!0);return}n!==null||t[w].disabled||(n=t[w])}n!==null&&(n.selected=!0)}}function pf(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 mf(t,n,a,d){if(n==null){if(d!=null){if(a!=null)throw Error(s(92));if(B(d)){if(1<d.length)throw Error(s(93));d=d[0]}a=d}a==null&&(a=""),n=a}a=Rn(n),t.defaultValue=a,d=t.textContent,d===a&&d!==""&&d!==null&&(t.value=d),ic(t)}function Fi(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var J0=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 gf(t,n,a){var d=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?d?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":d?t.setProperty(n,a):typeof a!="number"||a===0||J0.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function xf(t,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(t=t.style,a!=null){for(var d in a)!a.hasOwnProperty(d)||n!=null&&n.hasOwnProperty(d)||(d.indexOf("--")===0?t.setProperty(d,""):d==="float"?t.cssFloat="":t[d]="");for(var w in n)d=n[w],n.hasOwnProperty(w)&&a[w]!==d&&gf(t,w,d)}else for(var k in n)n.hasOwnProperty(k)&&gf(t,k,n[k])}function oc(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 ey=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"]]),ty=/^[\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 ro(t){return ty.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function cr(){}var lc=null;function cc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ui=null,$i=null;function vf(t){var n=Bi(t);if(n&&(t=n.stateNode)){var a=t[hn]||null;e:switch(t=n.stateNode,n.type){case"input":if(sc(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 d=a[n];if(d!==t&&d.form===t.form){var w=d[hn]||null;if(!w)throw Error(s(90));sc(d,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(n=0;n<a.length;n++)d=a[n],d.form===t.form&&hf(d)}break e;case"textarea":pf(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Pi(t,!!a.multiple,n,!1)}}}var uc=!1;function bf(t,n,a){if(uc)return t(n,a);uc=!0;try{var d=t(n);return d}finally{if(uc=!1,(Ui!==null||$i!==null)&&(Wo(),Ui&&(n=Ui,t=$i,$i=Ui=null,vf(n),t)))for(n=0;n<t.length;n++)vf(t[n])}}function Bs(t,n){var a=t.stateNode;if(a===null)return null;var d=a[hn]||null;if(d===null)return null;a=d[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":(d=!d.disabled)||(t=t.type,d=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!d;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var ur=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),dc=!1;if(ur)try{var zs={};Object.defineProperty(zs,"passive",{get:function(){dc=!0}}),window.addEventListener("test",zs,zs),window.removeEventListener("test",zs,zs)}catch{dc=!1}var Ar=null,hc=null,io=null;function yf(){if(io)return io;var t,n=hc,a=n.length,d,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(d=1;d<=M&&n[a-d]===w[k-d];d++);return io=w.slice(t,1<d?1-d:void 0)}function so(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 ao(){return!0}function _f(){return!1}function fn(t){function n(a,d,w,k,M){this._reactName=a,this._targetInst=w,this.type=d,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)?ao:_f,this.isPropagationStopped=_f,this}return m(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=ao)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ao)},persist:function(){},isPersistent:ao}),n}var oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},oo=fn(oi),Hs=m({},oi,{view:0,detail:0}),ny=fn(Hs),fc,pc,Ps,lo=m({},Hs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gc,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!==Ps&&(Ps&&t.type==="mousemove"?(fc=t.screenX-Ps.screenX,pc=t.screenY-Ps.screenY):pc=fc=0,Ps=t),fc)},movementY:function(t){return"movementY"in t?t.movementY:pc}}),Sf=fn(lo),ry=m({},lo,{dataTransfer:0}),iy=fn(ry),sy=m({},Hs,{relatedTarget:0}),mc=fn(sy),ay=m({},oi,{animationName:0,elapsedTime:0,pseudoElement:0}),oy=fn(ay),ly=m({},oi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),cy=fn(ly),uy=m({},oi,{data:0}),wf=fn(uy),dy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hy={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"},fy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function py(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=fy[t])?!!n[t]:!1}function gc(){return py}var my=m({},Hs,{key:function(t){if(t.key){var n=dy[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=so(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?hy[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gc,charCode:function(t){return t.type==="keypress"?so(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?so(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),gy=fn(my),xy=m({},lo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cf=fn(xy),vy=m({},Hs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gc}),by=fn(vy),yy=m({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),_y=fn(yy),Sy=m({},lo,{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}),wy=fn(Sy),Cy=m({},oi,{newState:0,oldState:0}),ky=fn(Cy),Ey=[9,13,27,32],xc=ur&&"CompositionEvent"in window,Fs=null;ur&&"documentMode"in document&&(Fs=document.documentMode);var jy=ur&&"TextEvent"in window&&!Fs,kf=ur&&(!xc||Fs&&8<Fs&&11>=Fs),Ef=" ",jf=!1;function Nf(t,n){switch(t){case"keyup":return Ey.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Tf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var qi=!1;function Ny(t,n){switch(t){case"compositionend":return Tf(n);case"keypress":return n.which!==32?null:(jf=!0,Ef);case"textInput":return t=n.data,t===Ef&&jf?null:t;default:return null}}function Ty(t,n){if(qi)return t==="compositionend"||!xc&&Nf(t,n)?(t=yf(),io=hc=Ar=null,qi=!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 kf&&n.locale!=="ko"?null:n.data;default:return null}}var Ay={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 Af(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!Ay[t.type]:n==="textarea"}function Df(t,n,a,d){Ui?$i?$i.push(d):$i=[d]:Ui=d,n=Qo(n,"onChange"),0<n.length&&(a=new oo("onChange","change",null,a,d),t.push({event:a,listeners:n}))}var Us=null,$s=null;function Dy(t){fg(t,0)}function co(t){var n=Is(t);if(hf(n))return t}function Lf(t,n){if(t==="change")return n}var Rf=!1;if(ur){var vc;if(ur){var bc="oninput"in document;if(!bc){var Mf=document.createElement("div");Mf.setAttribute("oninput","return;"),bc=typeof Mf.oninput=="function"}vc=bc}else vc=!1;Rf=vc&&(!document.documentMode||9<document.documentMode)}function Of(){Us&&(Us.detachEvent("onpropertychange",If),$s=Us=null)}function If(t){if(t.propertyName==="value"&&co($s)){var n=[];Df(n,$s,t,cc(t)),bf(Dy,n)}}function Ly(t,n,a){t==="focusin"?(Of(),Us=n,$s=a,Us.attachEvent("onpropertychange",If)):t==="focusout"&&Of()}function Ry(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return co($s)}function My(t,n){if(t==="click")return co(n)}function Oy(t,n){if(t==="input"||t==="change")return co(n)}function Iy(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var _n=typeof Object.is=="function"?Object.is:Iy;function qs(t,n){if(_n(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),d=Object.keys(n);if(a.length!==d.length)return!1;for(d=0;d<a.length;d++){var w=a[d];if(!ht.call(n,w)||!_n(t[w],n[w]))return!1}return!0}function Bf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function zf(t,n){var a=Bf(t);t=0;for(var d;a;){if(a.nodeType===3){if(d=t+a.textContent.length,t<=n&&d>=n)return{node:a,offset:n-t};t=d}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Bf(a)}}function Hf(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Hf(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Pf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=no(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=no(t.document)}return n}function yc(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 By=ur&&"documentMode"in document&&11>=document.documentMode,Wi=null,_c=null,Ws=null,Sc=!1;function Ff(t,n,a){var d=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Sc||Wi==null||Wi!==no(d)||(d=Wi,"selectionStart"in d&&yc(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Ws&&qs(Ws,d)||(Ws=d,d=Qo(_c,"onSelect"),0<d.length&&(n=new oo("onSelect","select",null,n,a),t.push({event:n,listeners:d}),n.target=Wi)))}function li(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var Gi={animationend:li("Animation","AnimationEnd"),animationiteration:li("Animation","AnimationIteration"),animationstart:li("Animation","AnimationStart"),transitionrun:li("Transition","TransitionRun"),transitionstart:li("Transition","TransitionStart"),transitioncancel:li("Transition","TransitionCancel"),transitionend:li("Transition","TransitionEnd")},wc={},Uf={};ur&&(Uf=document.createElement("div").style,"AnimationEvent"in window||(delete Gi.animationend.animation,delete Gi.animationiteration.animation,delete Gi.animationstart.animation),"TransitionEvent"in window||delete Gi.transitionend.transition);function ci(t){if(wc[t])return wc[t];if(!Gi[t])return t;var n=Gi[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in Uf)return wc[t]=n[a];return t}var $f=ci("animationend"),qf=ci("animationiteration"),Wf=ci("animationstart"),zy=ci("transitionrun"),Hy=ci("transitionstart"),Py=ci("transitioncancel"),Gf=ci("transitionend"),Vf=new Map,Cc="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(" ");Cc.push("scrollEnd");function Wn(t,n){Vf.set(t,n),ai(n,[t])}var uo=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=[],Vi=0,kc=0;function ho(){for(var t=Vi,n=kc=Vi=0;n<t;){var a=On[n];On[n++]=null;var d=On[n];On[n++]=null;var w=On[n];On[n++]=null;var k=On[n];if(On[n++]=null,d!==null&&w!==null){var M=d.pending;M===null?w.next=w:(w.next=M.next,M.next=w),d.pending=w}k!==0&&Yf(a,w,k)}}function fo(t,n,a,d){On[Vi++]=t,On[Vi++]=n,On[Vi++]=a,On[Vi++]=d,kc|=d,t.lanes|=d,t=t.alternate,t!==null&&(t.lanes|=d)}function Ec(t,n,a,d){return fo(t,n,a,d),po(t)}function ui(t,n){return fo(t,null,null,n),po(t)}function Yf(t,n,a){t.lanes|=a;var d=t.alternate;d!==null&&(d.lanes|=a);for(var w=!1,k=t.return;k!==null;)k.childLanes|=a,d=k.alternate,d!==null&&(d.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-qe(a),t=k.hiddenUpdates,d=t[w],d===null?t[w]=[n]:d.push(n),n.lane=a|536870912),k):null}function po(t){if(50<fa)throw fa=0,Ou=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Yi={};function Fy(t,n,a,d){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=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sn(t,n,a,d){return new Fy(t,n,a,d)}function jc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function dr(t,n){var a=t.alternate;return a===null?(a=Sn(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 Kf(t,n){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,n=a.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function mo(t,n,a,d,w,k){var M=0;if(d=t,typeof t=="function")jc(t)&&(M=1);else if(typeof t=="string")M=G_(t,a,K.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case I:return t=Sn(31,a,n,w),t.elementType=I,t.lanes=k,t;case C:return di(a.children,w,k,n);case b:M=8,w|=24;break;case y:return t=Sn(12,a,n,w|2),t.elementType=y,t.lanes=k,t;case A:return t=Sn(13,a,n,w),t.elementType=A,t.lanes=k,t;case N:return t=Sn(19,a,n,w),t.elementType=N,t.lanes=k,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case _:M=10;break e;case x:M=9;break e;case j:M=11;break e;case L:M=14;break e;case T:M=16,d=null;break e}M=29,a=Error(s(130,t===null?"null":typeof t,"")),d=null}return n=Sn(M,a,n,w),n.elementType=t,n.type=d,n.lanes=k,n}function di(t,n,a,d){return t=Sn(7,t,d,n),t.lanes=a,t}function Nc(t,n,a){return t=Sn(6,t,null,n),t.lanes=a,t}function Xf(t){var n=Sn(18,null,null,0);return n.stateNode=t,n}function Tc(t,n,a){return n=Sn(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var Zf=new WeakMap;function In(t,n){if(typeof t=="object"&&t!==null){var a=Zf.get(t);return a!==void 0?a:(n={value:t,source:n,stack:lt(n)},Zf.set(t,n),n)}return{value:t,source:n,stack:lt(n)}}var Ki=[],Xi=0,go=null,Gs=0,Bn=[],zn=0,Dr=null,Zn=1,Qn="";function hr(t,n){Ki[Xi++]=Gs,Ki[Xi++]=go,go=t,Gs=n}function Qf(t,n,a){Bn[zn++]=Zn,Bn[zn++]=Qn,Bn[zn++]=Dr,Dr=t;var d=Zn;t=Qn;var w=32-qe(d)-1;d&=~(1<<w),a+=1;var k=32-qe(n)+w;if(30<k){var M=w-w%5;k=(d&(1<<M)-1).toString(32),d>>=M,w-=M,Zn=1<<32-qe(n)+w|a<<w|d,Qn=k+t}else Zn=1<<k|a<<w|d,Qn=t}function Ac(t){t.return!==null&&(hr(t,1),Qf(t,1,0))}function Dc(t){for(;t===go;)go=Ki[--Xi],Ki[Xi]=null,Gs=Ki[--Xi],Ki[Xi]=null;for(;t===Dr;)Dr=Bn[--zn],Bn[zn]=null,Qn=Bn[--zn],Bn[zn]=null,Zn=Bn[--zn],Bn[zn]=null}function Jf(t,n){Bn[zn++]=Zn,Bn[zn++]=Qn,Bn[zn++]=Dr,Zn=n.id,Qn=n.overflow,Dr=t}var Zt=null,wt=null,it=!1,Lr=null,Hn=!1,Lc=Error(s(519));function Rr(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vs(In(n,t)),Lc}function ep(t){var n=t.stateNode,a=t.type,d=t.memoizedProps;switch(n[Xt]=t,n[hn]=d,a){case"dialog":Qe("cancel",n),Qe("close",n);break;case"iframe":case"object":case"embed":Qe("load",n);break;case"video":case"audio":for(a=0;a<ma.length;a++)Qe(ma[a],n);break;case"source":Qe("error",n);break;case"img":case"image":case"link":Qe("error",n),Qe("load",n);break;case"details":Qe("toggle",n);break;case"input":Qe("invalid",n),ff(n,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Qe("invalid",n);break;case"textarea":Qe("invalid",n),mf(n,d.value,d.defaultValue,d.children)}a=d.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||d.suppressHydrationWarning===!0||xg(n.textContent,a)?(d.popover!=null&&(Qe("beforetoggle",n),Qe("toggle",n)),d.onScroll!=null&&Qe("scroll",n),d.onScrollEnd!=null&&Qe("scrollend",n),d.onClick!=null&&(n.onclick=cr),n=!0):n=!1,n||Rr(t,!0)}function tp(t){for(Zt=t.return;Zt;)switch(Zt.tag){case 5:case 31:case 13:Hn=!1;return;case 27:case 3:Hn=!0;return;default:Zt=Zt.return}}function Zi(t){if(t!==Zt)return!1;if(!it)return tp(t),it=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Xu(t.type,t.memoizedProps)),a=!a),a&&wt&&Rr(t),tp(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));wt=Eg(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));wt=Eg(t)}else n===27?(n=wt,Vr(t.type)?(t=td,td=null,wt=t):wt=n):wt=Zt?Fn(t.stateNode.nextSibling):null;return!0}function hi(){wt=Zt=null,it=!1}function Rc(){var t=Lr;return t!==null&&(xn===null?xn=t:xn.push.apply(xn,t),Lr=null),t}function Vs(t){Lr===null?Lr=[t]:Lr.push(t)}var Mc=O(null),fi=null,fr=null;function Mr(t,n,a){U(Mc,n._currentValue),n._currentValue=a}function pr(t){t._currentValue=Mc.current,W(Mc)}function Oc(t,n,a){for(;t!==null;){var d=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,d!==null&&(d.childLanes|=n)):d!==null&&(d.childLanes&n)!==n&&(d.childLanes|=n),t===a)break;t=t.return}}function Ic(t,n,a,d){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 ee=0;ee<n.length;ee++)if(G.context===n[ee]){k.lanes|=a,G=k.alternate,G!==null&&(G.lanes|=a),Oc(k.return,a,t),d||(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),Oc(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 Qi(t,n,a,d){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;_n(w.pendingProps.value,M.value)||(t!==null?t.push(G):t=[G])}}else if(w===Z.current){if(M=w.alternate,M===null)throw Error(s(387));M.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(ya):t=[ya])}w=w.return}t!==null&&Ic(n,t,a,d),n.flags|=262144}function xo(t){for(t=t.firstContext;t!==null;){if(!_n(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function pi(t){fi=t,fr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Qt(t){return np(fi,t)}function vo(t,n){return fi===null&&pi(t),np(t,n)}function np(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},fr===null){if(t===null)throw Error(s(308));fr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else fr=fr.next=n;return a}var Uy=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,d){t.push(d)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},$y=e.unstable_scheduleCallback,qy=e.unstable_NormalPriority,Mt={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Bc(){return{controller:new Uy,data:new Map,refCount:0}}function Ys(t){t.refCount--,t.refCount===0&&$y(qy,function(){t.controller.abort()})}var Ks=null,zc=0,Ji=0,es=null;function Wy(t,n){if(Ks===null){var a=Ks=[];zc=0,Ji=Fu(),es={status:"pending",value:void 0,then:function(d){a.push(d)}}}return zc++,n.then(rp,rp),n}function rp(){if(--zc===0&&Ks!==null){es!==null&&(es.status="fulfilled");var t=Ks;Ks=null,Ji=0,es=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function Gy(t,n){var a=[],d={status:"pending",value:null,reason:null,then:function(w){a.push(w)}};return t.then(function(){d.status="fulfilled",d.value=n;for(var w=0;w<a.length;w++)(0,a[w])(n)},function(w){for(d.status="rejected",d.reason=w,w=0;w<a.length;w++)(0,a[w])(void 0)}),d}var ip=q.S;q.S=function(t,n){Fm=Ye(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Wy(t,n),ip!==null&&ip(t,n)};var mi=O(null);function Hc(){var t=mi.current;return t!==null?t:yt.pooledCache}function bo(t,n){n===null?U(mi,mi.current):U(mi,n.pool)}function sp(){var t=Hc();return t===null?null:{parent:Mt._currentValue,pool:t}}var ts=Error(s(460)),Pc=Error(s(474)),yo=Error(s(542)),_o={then:function(){}};function ap(t){return t=t.status,t==="fulfilled"||t==="rejected"}function op(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(cr,cr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,cp(t),t;default:if(typeof n.status=="string")n.then(cr,cr);else{if(t=yt,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=n,t.status="pending",t.then(function(d){if(n.status==="pending"){var w=n;w.status="fulfilled",w.value=d}},function(d){if(n.status==="pending"){var w=n;w.status="rejected",w.reason=d}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,cp(t),t}throw xi=n,ts}}function gi(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(xi=a,ts):a}}var xi=null;function lp(){if(xi===null)throw Error(s(459));var t=xi;return xi=null,t}function cp(t){if(t===ts||t===yo)throw Error(s(483))}var ns=null,Xs=0;function So(t){var n=Xs;return Xs+=1,ns===null&&(ns=[]),op(ns,t,n)}function Zs(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function wo(t,n){throw n.$$typeof===v?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function up(t){function n(re,ne){if(t){var oe=re.deletions;oe===null?(re.deletions=[ne],re.flags|=16):oe.push(ne)}}function a(re,ne){if(!t)return null;for(;ne!==null;)n(re,ne),ne=ne.sibling;return null}function d(re){for(var ne=new Map;re!==null;)re.key!==null?ne.set(re.key,re):ne.set(re.index,re),re=re.sibling;return ne}function w(re,ne){return re=dr(re,ne),re.index=0,re.sibling=null,re}function k(re,ne,oe){return re.index=oe,t?(oe=re.alternate,oe!==null?(oe=oe.index,oe<ne?(re.flags|=67108866,ne):oe):(re.flags|=67108866,ne)):(re.flags|=1048576,ne)}function M(re){return t&&re.alternate===null&&(re.flags|=67108866),re}function G(re,ne,oe,me){return ne===null||ne.tag!==6?(ne=Nc(oe,re.mode,me),ne.return=re,ne):(ne=w(ne,oe),ne.return=re,ne)}function ee(re,ne,oe,me){var Le=oe.type;return Le===C?fe(re,ne,oe.props.children,me,oe.key):ne!==null&&(ne.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===T&&gi(Le)===ne.type)?(ne=w(ne,oe.props),Zs(ne,oe),ne.return=re,ne):(ne=mo(oe.type,oe.key,oe.props,null,re.mode,me),Zs(ne,oe),ne.return=re,ne)}function le(re,ne,oe,me){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==oe.containerInfo||ne.stateNode.implementation!==oe.implementation?(ne=Tc(oe,re.mode,me),ne.return=re,ne):(ne=w(ne,oe.children||[]),ne.return=re,ne)}function fe(re,ne,oe,me,Le){return ne===null||ne.tag!==7?(ne=di(oe,re.mode,me,Le),ne.return=re,ne):(ne=w(ne,oe),ne.return=re,ne)}function xe(re,ne,oe){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ne=Nc(""+ne,re.mode,oe),ne.return=re,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:return oe=mo(ne.type,ne.key,ne.props,null,re.mode,oe),Zs(oe,ne),oe.return=re,oe;case E:return ne=Tc(ne,re.mode,oe),ne.return=re,ne;case T:return ne=gi(ne),xe(re,ne,oe)}if(B(ne)||Y(ne))return ne=di(ne,re.mode,oe,null),ne.return=re,ne;if(typeof ne.then=="function")return xe(re,So(ne),oe);if(ne.$$typeof===_)return xe(re,vo(re,ne),oe);wo(re,ne)}return null}function ce(re,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(re,ne,""+oe,me);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:return oe.key===Le?ee(re,ne,oe,me):null;case E:return oe.key===Le?le(re,ne,oe,me):null;case T:return oe=gi(oe),ce(re,ne,oe,me)}if(B(oe)||Y(oe))return Le!==null?null:fe(re,ne,oe,me,null);if(typeof oe.then=="function")return ce(re,ne,So(oe),me);if(oe.$$typeof===_)return ce(re,ne,vo(re,oe),me);wo(re,oe)}return null}function ue(re,ne,oe,me,Le){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return re=re.get(oe)||null,G(ne,re,""+me,Le);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case S:return re=re.get(me.key===null?oe:me.key)||null,ee(ne,re,me,Le);case E:return re=re.get(me.key===null?oe:me.key)||null,le(ne,re,me,Le);case T:return me=gi(me),ue(re,ne,oe,me,Le)}if(B(me)||Y(me))return re=re.get(oe)||null,fe(ne,re,me,Le,null);if(typeof me.then=="function")return ue(re,ne,oe,So(me),Le);if(me.$$typeof===_)return ue(re,ne,oe,vo(ne,me),Le);wo(ne,me)}return null}function Ne(re,ne,oe,me){for(var Le=null,at=null,Ae=ne,Ge=ne=0,tt=null;Ae!==null&&Ge<oe.length;Ge++){Ae.index>Ge?(tt=Ae,Ae=null):tt=Ae.sibling;var ot=ce(re,Ae,oe[Ge],me);if(ot===null){Ae===null&&(Ae=tt);break}t&&Ae&&ot.alternate===null&&n(re,Ae),ne=k(ot,ne,Ge),at===null?Le=ot:at.sibling=ot,at=ot,Ae=tt}if(Ge===oe.length)return a(re,Ae),it&&hr(re,Ge),Le;if(Ae===null){for(;Ge<oe.length;Ge++)Ae=xe(re,oe[Ge],me),Ae!==null&&(ne=k(Ae,ne,Ge),at===null?Le=Ae:at.sibling=Ae,at=Ae);return it&&hr(re,Ge),Le}for(Ae=d(Ae);Ge<oe.length;Ge++)tt=ue(Ae,re,Ge,oe[Ge],me),tt!==null&&(t&&tt.alternate!==null&&Ae.delete(tt.key===null?Ge:tt.key),ne=k(tt,ne,Ge),at===null?Le=tt:at.sibling=tt,at=tt);return t&&Ae.forEach(function(Qr){return n(re,Qr)}),it&&hr(re,Ge),Le}function Be(re,ne,oe,me){if(oe==null)throw Error(s(151));for(var Le=null,at=null,Ae=ne,Ge=ne=0,tt=null,ot=oe.next();Ae!==null&&!ot.done;Ge++,ot=oe.next()){Ae.index>Ge?(tt=Ae,Ae=null):tt=Ae.sibling;var Qr=ce(re,Ae,ot.value,me);if(Qr===null){Ae===null&&(Ae=tt);break}t&&Ae&&Qr.alternate===null&&n(re,Ae),ne=k(Qr,ne,Ge),at===null?Le=Qr:at.sibling=Qr,at=Qr,Ae=tt}if(ot.done)return a(re,Ae),it&&hr(re,Ge),Le;if(Ae===null){for(;!ot.done;Ge++,ot=oe.next())ot=xe(re,ot.value,me),ot!==null&&(ne=k(ot,ne,Ge),at===null?Le=ot:at.sibling=ot,at=ot);return it&&hr(re,Ge),Le}for(Ae=d(Ae);!ot.done;Ge++,ot=oe.next())ot=ue(Ae,re,Ge,ot.value,me),ot!==null&&(t&&ot.alternate!==null&&Ae.delete(ot.key===null?Ge:ot.key),ne=k(ot,ne,Ge),at===null?Le=ot:at.sibling=ot,at=ot);return t&&Ae.forEach(function(r1){return n(re,r1)}),it&&hr(re,Ge),Le}function bt(re,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(re,ne.sibling),me=w(ne,oe.props.children),me.return=re,re=me;break e}}else if(ne.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===T&&gi(Le)===ne.type){a(re,ne.sibling),me=w(ne,oe.props),Zs(me,oe),me.return=re,re=me;break e}a(re,ne);break}else n(re,ne);ne=ne.sibling}oe.type===C?(me=di(oe.props.children,re.mode,me,oe.key),me.return=re,re=me):(me=mo(oe.type,oe.key,oe.props,null,re.mode,me),Zs(me,oe),me.return=re,re=me)}return M(re);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(re,ne.sibling),me=w(ne,oe.children||[]),me.return=re,re=me;break e}else{a(re,ne);break}else n(re,ne);ne=ne.sibling}me=Tc(oe,re.mode,me),me.return=re,re=me}return M(re);case T:return oe=gi(oe),bt(re,ne,oe,me)}if(B(oe))return Ne(re,ne,oe,me);if(Y(oe)){if(Le=Y(oe),typeof Le!="function")throw Error(s(150));return oe=Le.call(oe),Be(re,ne,oe,me)}if(typeof oe.then=="function")return bt(re,ne,So(oe),me);if(oe.$$typeof===_)return bt(re,ne,vo(re,oe),me);wo(re,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,ne!==null&&ne.tag===6?(a(re,ne.sibling),me=w(ne,oe),me.return=re,re=me):(a(re,ne),me=Nc(oe,re.mode,me),me.return=re,re=me),M(re)):a(re,ne)}return function(re,ne,oe,me){try{Xs=0;var Le=bt(re,ne,oe,me);return ns=null,Le}catch(Ae){if(Ae===ts||Ae===yo)throw Ae;var at=Sn(29,Ae,null,re.mode);return at.lanes=me,at.return=re,at}finally{}}}var vi=up(!0),dp=up(!1),Or=!1;function Fc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Uc(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 Ir(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Br(t,n,a){var d=t.updateQueue;if(d===null)return null;if(d=d.shared,(ut&2)!==0){var w=d.pending;return w===null?n.next=n:(n.next=w.next,w.next=n),d.pending=n,n=po(t),Yf(t,null,a),n}return fo(t,d,n,a),po(t)}function Qs(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var d=n.lanes;d&=t.pendingLanes,a|=d,n.lanes=a,tf(t,a)}}function $c(t,n){var a=t.updateQueue,d=t.alternate;if(d!==null&&(d=d.updateQueue,a===d)){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:d.baseState,firstBaseUpdate:w,lastBaseUpdate:k,shared:d.shared,callbacks:d.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var qc=!1;function Js(){if(qc){var t=es;if(t!==null)throw t}}function ea(t,n,a,d){qc=!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 ee=G,le=ee.next;ee.next=null,M===null?k=le:M.next=le,M=ee;var fe=t.alternate;fe!==null&&(fe=fe.updateQueue,G=fe.lastBaseUpdate,G!==M&&(G===null?fe.firstBaseUpdate=le:G.next=le,fe.lastBaseUpdate=ee))}if(k!==null){var xe=w.baseState;M=0,fe=le=ee=null,G=k;do{var ce=G.lane&-536870913,ue=ce!==G.lane;if(ue?(et&ce)===ce:(d&ce)===ce){ce!==0&&ce===Ji&&(qc=!0),fe!==null&&(fe=fe.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var Ne=t,Be=G;ce=n;var bt=a;switch(Be.tag){case 1:if(Ne=Be.payload,typeof Ne=="function"){xe=Ne.call(bt,xe,ce);break e}xe=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Be.payload,ce=typeof Ne=="function"?Ne.call(bt,xe,ce):Ne,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},fe===null?(le=fe=ue,ee=xe):fe=fe.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);fe===null&&(ee=xe),w.baseState=ee,w.firstBaseUpdate=le,w.lastBaseUpdate=fe,k===null&&(w.shared.lanes=0),Ur|=M,t.lanes=M,t.memoizedState=xe}}function hp(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function fp(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)hp(a[t],n)}var rs=O(null),Co=O(0);function pp(t,n){t=wr,U(Co,t),U(rs,n),wr=t|n.baseLanes}function Wc(){U(Co,wr),U(rs,rs.current)}function Gc(){wr=Co.current,W(rs),W(Co)}var wn=O(null),Pn=null;function zr(t){var n=t.alternate;U(At,At.current&1),U(wn,t),Pn===null&&(n===null||rs.current!==null||n.memoizedState!==null)&&(Pn=t)}function Vc(t){U(At,At.current),U(wn,t),Pn===null&&(Pn=t)}function mp(t){t.tag===22?(U(At,At.current),U(wn,t),Pn===null&&(Pn=t)):Hr()}function Hr(){U(At,At.current),U(wn,wn.current)}function Cn(t){W(wn),Pn===t&&(Pn=null),W(At)}var At=O(0);function ko(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Ju(a)||ed(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 mr=0,We=null,xt=null,Ot=null,Eo=!1,is=!1,bi=!1,jo=0,ta=0,ss=null,Vy=0;function Nt(){throw Error(s(321))}function Yc(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!_n(t[a],n[a]))return!1;return!0}function Kc(t,n,a,d,w,k){return mr=k,We=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,q.H=t===null||t.memoizedState===null?Qp:uu,bi=!1,k=a(d,w),bi=!1,is&&(k=xp(n,a,d,w)),gp(t),k}function gp(t){q.H=ia;var n=xt!==null&&xt.next!==null;if(mr=0,Ot=xt=We=null,Eo=!1,ta=0,ss=null,n)throw Error(s(300));t===null||It||(t=t.dependencies,t!==null&&xo(t)&&(It=!0))}function xp(t,n,a,d){We=t;var w=0;do{if(is&&(ss=null),ta=0,is=!1,25<=w)throw Error(s(301));if(w+=1,Ot=xt=null,t.updateQueue!=null){var k=t.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}q.H=Jp,k=n(a,d)}while(is);return k}function Yy(){var t=q.H,n=t.useState()[0];return n=typeof n.then=="function"?na(n):n,t=t.useState()[0],(xt!==null?xt.memoizedState:null)!==t&&(We.flags|=1024),n}function Xc(){var t=jo!==0;return jo=0,t}function Zc(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function Qc(t){if(Eo){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Eo=!1}mr=0,Ot=xt=We=null,is=!1,ta=jo=0,ss=null}function ln(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ot===null?We.memoizedState=Ot=t:Ot=Ot.next=t,Ot}function Dt(){if(xt===null){var t=We.alternate;t=t!==null?t.memoizedState:null}else t=xt.next;var n=Ot===null?We.memoizedState:Ot.next;if(n!==null)Ot=n,xt=t;else{if(t===null)throw We.alternate===null?Error(s(467)):Error(s(310));xt=t,t={memoizedState:xt.memoizedState,baseState:xt.baseState,baseQueue:xt.baseQueue,queue:xt.queue,next:null},Ot===null?We.memoizedState=Ot=t:Ot=Ot.next=t}return Ot}function No(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function na(t){var n=ta;return ta+=1,ss===null&&(ss=[]),t=op(ss,t,n),n=We,(Ot===null?n.memoizedState:Ot.next)===null&&(n=n.alternate,q.H=n===null||n.memoizedState===null?Qp:uu),t}function To(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return na(t);if(t.$$typeof===_)return Qt(t)}throw Error(s(438,String(t)))}function Jc(t){var n=null,a=We.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var d=We.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(n={data:d.data.map(function(w){return w.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=No(),We.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),d=0;d<t;d++)a[d]=z;return n.index++,a}function gr(t,n){return typeof n=="function"?n(t):n}function Ao(t){var n=Dt();return eu(n,xt,t)}function eu(t,n,a){var d=t.queue;if(d===null)throw Error(s(311));d.lastRenderedReducer=a;var w=t.baseQueue,k=d.pending;if(k!==null){if(w!==null){var M=w.next;w.next=k.next,k.next=M}n.baseQueue=w=k,d.pending=null}if(k=t.baseState,w===null)t.memoizedState=k;else{n=w.next;var G=M=null,ee=null,le=n,fe=!1;do{var xe=le.lane&-536870913;if(xe!==le.lane?(et&xe)===xe:(mr&xe)===xe){var ce=le.revertLane;if(ce===0)ee!==null&&(ee=ee.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),xe===Ji&&(fe=!0);else if((mr&ce)===ce){le=le.next,ce===Ji&&(fe=!0);continue}else xe={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},ee===null?(G=ee=xe,M=k):ee=ee.next=xe,We.lanes|=ce,Ur|=ce;xe=le.action,bi&&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},ee===null?(G=ee=ce,M=k):ee=ee.next=ce,We.lanes|=xe,Ur|=xe;le=le.next}while(le!==null&&le!==n);if(ee===null?M=k:ee.next=G,!_n(k,t.memoizedState)&&(It=!0,fe&&(a=es,a!==null)))throw a;t.memoizedState=k,t.baseState=M,t.baseQueue=ee,d.lastRenderedState=k}return w===null&&(d.lanes=0),[t.memoizedState,d.dispatch]}function tu(t){var n=Dt(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var d=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);_n(k,n.memoizedState)||(It=!0),n.memoizedState=k,n.baseQueue===null&&(n.baseState=k),a.lastRenderedState=k}return[k,d]}function vp(t,n,a){var d=We,w=Dt(),k=it;if(k){if(a===void 0)throw Error(s(407));a=a()}else a=n();var M=!_n((xt||w).memoizedState,a);if(M&&(w.memoizedState=a,It=!0),w=w.queue,iu(_p.bind(null,d,w,t),[t]),w.getSnapshot!==n||M||Ot!==null&&Ot.memoizedState.tag&1){if(d.flags|=2048,as(9,{destroy:void 0},yp.bind(null,d,w,a,n),null),yt===null)throw Error(s(349));k||(mr&127)!==0||bp(d,n,a)}return a}function bp(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=We.updateQueue,n===null?(n=No(),We.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function yp(t,n,a,d){n.value=a,n.getSnapshot=d,Sp(n)&&wp(t)}function _p(t,n,a){return a(function(){Sp(n)&&wp(t)})}function Sp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!_n(t,a)}catch{return!0}}function wp(t){var n=ui(t,2);n!==null&&vn(n,t,2)}function nu(t){var n=ln();if(typeof t=="function"){var a=t;if(t=a(),bi){ft(!0);try{a()}finally{ft(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:t},n}function Cp(t,n,a,d){return t.baseState=a,eu(t,xt,typeof d=="function"?d:gr)}function Ky(t,n,a,d,w){if(Ro(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)}};q.T!==null?a(!0):k.isTransition=!1,d(k),a=n.pending,a===null?(k.next=n.pending=k,kp(n,k)):(k.next=a.next,n.pending=a.next=k)}}function kp(t,n){var a=n.action,d=n.payload,w=t.state;if(n.isTransition){var k=q.T,M={};q.T=M;try{var G=a(w,d),ee=q.S;ee!==null&&ee(M,G),Ep(t,n,G)}catch(le){ru(t,n,le)}finally{k!==null&&M.types!==null&&(k.types=M.types),q.T=k}}else try{k=a(w,d),Ep(t,n,k)}catch(le){ru(t,n,le)}}function Ep(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(d){jp(t,n,d)},function(d){return ru(t,n,d)}):jp(t,n,a)}function jp(t,n,a){n.status="fulfilled",n.value=a,Np(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,kp(t,a)))}function ru(t,n,a){var d=t.pending;if(t.pending=null,d!==null){d=d.next;do n.status="rejected",n.reason=a,Np(n),n=n.next;while(n!==d)}t.action=null}function Np(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Tp(t,n){return n}function Ap(t,n){if(it){var a=yt.formState;if(a!==null){e:{var d=We;if(it){if(wt){t:{for(var w=wt,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){wt=Fn(w.nextSibling),d=w.data==="F!";break e}}Rr(d)}d=!1}d&&(n=a[0])}}return a=ln(),a.memoizedState=a.baseState=n,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Tp,lastRenderedState:n},a.queue=d,a=Kp.bind(null,We,d),d.dispatch=a,d=nu(!1),k=cu.bind(null,We,!1,d.queue),d=ln(),w={state:n,dispatch:null,action:t,pending:null},d.queue=w,a=Ky.bind(null,We,w,k,a),w.dispatch=a,d.memoizedState=t,[n,a,!1]}function Dp(t){var n=Dt();return Lp(n,xt,t)}function Lp(t,n,a){if(n=eu(t,n,Tp)[0],t=Ao(gr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var d=na(n)}catch(M){throw M===ts?yo:M}else d=n;n=Dt();var w=n.queue,k=w.dispatch;return a!==n.memoizedState&&(We.flags|=2048,as(9,{destroy:void 0},Xy.bind(null,w,a),null)),[d,k,t]}function Xy(t,n){t.action=n}function Rp(t){var n=Dt(),a=xt;if(a!==null)return Lp(n,a,t);Dt(),n=n.memoizedState,a=Dt();var d=a.queue.dispatch;return a.memoizedState=t,[n,d,!1]}function as(t,n,a,d){return t={tag:t,create:a,deps:d,inst:n,next:null},n=We.updateQueue,n===null&&(n=No(),We.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(d=a.next,a.next=t,t.next=d,n.lastEffect=t),t}function Mp(){return Dt().memoizedState}function Do(t,n,a,d){var w=ln();We.flags|=t,w.memoizedState=as(1|n,{destroy:void 0},a,d===void 0?null:d)}function Lo(t,n,a,d){var w=Dt();d=d===void 0?null:d;var k=w.memoizedState.inst;xt!==null&&d!==null&&Yc(d,xt.memoizedState.deps)?w.memoizedState=as(n,k,a,d):(We.flags|=t,w.memoizedState=as(1|n,k,a,d))}function Op(t,n){Do(8390656,8,t,n)}function iu(t,n){Lo(2048,8,t,n)}function Zy(t){We.flags|=4;var n=We.updateQueue;if(n===null)n=No(),We.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Ip(t){var n=Dt().memoizedState;return Zy({ref:n,nextImpl:t}),function(){if((ut&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Bp(t,n){return Lo(4,2,t,n)}function zp(t,n){return Lo(4,4,t,n)}function Hp(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 Pp(t,n,a){a=a!=null?a.concat([t]):null,Lo(4,4,Hp.bind(null,n,t),a)}function su(){}function Fp(t,n){var a=Dt();n=n===void 0?null:n;var d=a.memoizedState;return n!==null&&Yc(n,d[1])?d[0]:(a.memoizedState=[t,n],t)}function Up(t,n){var a=Dt();n=n===void 0?null:n;var d=a.memoizedState;if(n!==null&&Yc(n,d[1]))return d[0];if(d=t(),bi){ft(!0);try{t()}finally{ft(!1)}}return a.memoizedState=[d,n],d}function au(t,n,a){return a===void 0||(mr&1073741824)!==0&&(et&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=$m(),We.lanes|=t,Ur|=t,a)}function $p(t,n,a,d){return _n(a,n)?a:rs.current!==null?(t=au(t,a,d),_n(t,n)||(It=!0),t):(mr&42)===0||(mr&1073741824)!==0&&(et&261930)===0?(It=!0,t.memoizedState=a):(t=$m(),We.lanes|=t,Ur|=t,n)}function qp(t,n,a,d,w){var k=X.p;X.p=k!==0&&8>k?k:8;var M=q.T,G={};q.T=G,cu(t,!1,n,a);try{var ee=w(),le=q.S;if(le!==null&&le(G,ee),ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var fe=Gy(ee,d);ra(t,n,fe,jn(t))}else ra(t,n,d,jn(t))}catch(xe){ra(t,n,{then:function(){},status:"rejected",reason:xe},jn())}finally{X.p=k,M!==null&&G.types!==null&&(M.types=G.types),q.T=M}}function Qy(){}function ou(t,n,a,d){if(t.tag!==5)throw Error(s(476));var w=Wp(t).queue;qp(t,w,n,J,a===null?Qy:function(){return Gp(t),a(d)})}function Wp(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:J},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function Gp(t){var n=Wp(t);n.next===null&&(n=t.alternate.memoizedState),ra(t,n.next.queue,{},jn())}function lu(){return Qt(ya)}function Vp(){return Dt().memoizedState}function Yp(){return Dt().memoizedState}function Jy(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=jn();t=Ir(a);var d=Br(n,t,a);d!==null&&(vn(d,n,a),Qs(d,n,a)),n={cache:Bc()},t.payload=n;return}n=n.return}}function e_(t,n,a){var d=jn();a={lane:d,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ro(t)?Xp(n,a):(a=Ec(t,n,a,d),a!==null&&(vn(a,t,d),Zp(a,n,d)))}function Kp(t,n,a){var d=jn();ra(t,n,a,d)}function ra(t,n,a,d){var w={lane:d,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ro(t))Xp(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,_n(G,M))return fo(t,n,w,0),yt===null&&ho(),!1}catch{}finally{}if(a=Ec(t,n,w,d),a!==null)return vn(a,t,d),Zp(a,n,d),!0}return!1}function cu(t,n,a,d){if(d={lane:2,revertLane:Fu(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ro(t)){if(n)throw Error(s(479))}else n=Ec(t,a,d,2),n!==null&&vn(n,t,2)}function Ro(t){var n=t.alternate;return t===We||n!==null&&n===We}function Xp(t,n){is=Eo=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function Zp(t,n,a){if((a&4194048)!==0){var d=n.lanes;d&=t.pendingLanes,a|=d,n.lanes=a,tf(t,a)}}var ia={readContext:Qt,use:To,useCallback:Nt,useContext:Nt,useEffect:Nt,useImperativeHandle:Nt,useLayoutEffect:Nt,useInsertionEffect:Nt,useMemo:Nt,useReducer:Nt,useRef:Nt,useState:Nt,useDebugValue:Nt,useDeferredValue:Nt,useTransition:Nt,useSyncExternalStore:Nt,useId:Nt,useHostTransitionStatus:Nt,useFormState:Nt,useActionState:Nt,useOptimistic:Nt,useMemoCache:Nt,useCacheRefresh:Nt};ia.useEffectEvent=Nt;var Qp={readContext:Qt,use:To,useCallback:function(t,n){return ln().memoizedState=[t,n===void 0?null:n],t},useContext:Qt,useEffect:Op,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Do(4194308,4,Hp.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Do(4194308,4,t,n)},useInsertionEffect:function(t,n){Do(4,2,t,n)},useMemo:function(t,n){var a=ln();n=n===void 0?null:n;var d=t();if(bi){ft(!0);try{t()}finally{ft(!1)}}return a.memoizedState=[d,n],d},useReducer:function(t,n,a){var d=ln();if(a!==void 0){var w=a(n);if(bi){ft(!0);try{a(n)}finally{ft(!1)}}}else w=n;return d.memoizedState=d.baseState=w,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:w},d.queue=t,t=t.dispatch=e_.bind(null,We,t),[d.memoizedState,t]},useRef:function(t){var n=ln();return t={current:t},n.memoizedState=t},useState:function(t){t=nu(t);var n=t.queue,a=Kp.bind(null,We,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:su,useDeferredValue:function(t,n){var a=ln();return au(a,t,n)},useTransition:function(){var t=nu(!1);return t=qp.bind(null,We,t.queue,!0,!1),ln().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var d=We,w=ln();if(it){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),yt===null)throw Error(s(349));(et&127)!==0||bp(d,n,a)}w.memoizedState=a;var k={value:a,getSnapshot:n};return w.queue=k,Op(_p.bind(null,d,k,t),[t]),d.flags|=2048,as(9,{destroy:void 0},yp.bind(null,d,k,a,n),null),a},useId:function(){var t=ln(),n=yt.identifierPrefix;if(it){var a=Qn,d=Zn;a=(d&~(1<<32-qe(d)-1)).toString(32)+a,n="_"+n+"R_"+a,a=jo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Vy++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:lu,useFormState:Ap,useActionState:Ap,useOptimistic:function(t){var n=ln();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=cu.bind(null,We,!0,a),a.dispatch=n,[t,n]},useMemoCache:Jc,useCacheRefresh:function(){return ln().memoizedState=Jy.bind(null,We)},useEffectEvent:function(t){var n=ln(),a={impl:t};return n.memoizedState=a,function(){if((ut&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},uu={readContext:Qt,use:To,useCallback:Fp,useContext:Qt,useEffect:iu,useImperativeHandle:Pp,useInsertionEffect:Bp,useLayoutEffect:zp,useMemo:Up,useReducer:Ao,useRef:Mp,useState:function(){return Ao(gr)},useDebugValue:su,useDeferredValue:function(t,n){var a=Dt();return $p(a,xt.memoizedState,t,n)},useTransition:function(){var t=Ao(gr)[0],n=Dt().memoizedState;return[typeof t=="boolean"?t:na(t),n]},useSyncExternalStore:vp,useId:Vp,useHostTransitionStatus:lu,useFormState:Dp,useActionState:Dp,useOptimistic:function(t,n){var a=Dt();return Cp(a,xt,t,n)},useMemoCache:Jc,useCacheRefresh:Yp};uu.useEffectEvent=Ip;var Jp={readContext:Qt,use:To,useCallback:Fp,useContext:Qt,useEffect:iu,useImperativeHandle:Pp,useInsertionEffect:Bp,useLayoutEffect:zp,useMemo:Up,useReducer:tu,useRef:Mp,useState:function(){return tu(gr)},useDebugValue:su,useDeferredValue:function(t,n){var a=Dt();return xt===null?au(a,t,n):$p(a,xt.memoizedState,t,n)},useTransition:function(){var t=tu(gr)[0],n=Dt().memoizedState;return[typeof t=="boolean"?t:na(t),n]},useSyncExternalStore:vp,useId:Vp,useHostTransitionStatus:lu,useFormState:Rp,useActionState:Rp,useOptimistic:function(t,n){var a=Dt();return xt!==null?Cp(a,xt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Jc,useCacheRefresh:Yp};Jp.useEffectEvent=Ip;function du(t,n,a,d){n=t.memoizedState,a=a(d,n),a=a==null?n:m({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var hu={enqueueSetState:function(t,n,a){t=t._reactInternals;var d=jn(),w=Ir(d);w.payload=n,a!=null&&(w.callback=a),n=Br(t,w,d),n!==null&&(vn(n,t,d),Qs(n,t,d))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var d=jn(),w=Ir(d);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=Br(t,w,d),n!==null&&(vn(n,t,d),Qs(n,t,d))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=jn(),d=Ir(a);d.tag=2,n!=null&&(d.callback=n),n=Br(t,d,a),n!==null&&(vn(n,t,a),Qs(n,t,a))}};function em(t,n,a,d,w,k,M){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(d,k,M):n.prototype&&n.prototype.isPureReactComponent?!qs(a,d)||!qs(w,k):!0}function tm(t,n,a,d){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,d),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,d),n.state!==t&&hu.enqueueReplaceState(n,n.state,null)}function yi(t,n){var a=n;if("ref"in n){a={};for(var d in n)d!=="ref"&&(a[d]=n[d])}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 nm(t){uo(t)}function rm(t){console.error(t)}function im(t){uo(t)}function Mo(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(d){setTimeout(function(){throw d})}}function sm(t,n,a){try{var d=t.onCaughtError;d(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function fu(t,n,a){return a=Ir(a),a.tag=3,a.payload={element:null},a.callback=function(){Mo(t,n)},a}function am(t){return t=Ir(t),t.tag=3,t}function om(t,n,a,d){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var k=d.value;t.payload=function(){return w(k)},t.callback=function(){sm(n,a,d)}}var M=a.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(t.callback=function(){sm(n,a,d),typeof w!="function"&&($r===null?$r=new Set([this]):$r.add(this));var G=d.stack;this.componentDidCatch(d.value,{componentStack:G!==null?G:""})})}function t_(t,n,a,d,w){if(a.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(n=a.alternate,n!==null&&Qi(n,a,w,!0),a=wn.current,a!==null){switch(a.tag){case 31:case 13:return Pn===null?Go():a.alternate===null&&Tt===0&&(Tt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,d===_o?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([d]):n.add(d),zu(t,d,w)),!1;case 22:return a.flags|=65536,d===_o?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([d])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([d]):a.add(d)),zu(t,d,w)),!1}throw Error(s(435,a.tag))}return zu(t,d,w),Go(),!1}if(it)return n=wn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,d!==Lc&&(t=Error(s(422),{cause:d}),Vs(In(t,a)))):(d!==Lc&&(n=Error(s(423),{cause:d}),Vs(In(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,d=In(d,a),w=fu(t.stateNode,d,w),$c(t,w),Tt!==4&&(Tt=2)),!1;var k=Error(s(520),{cause:d});if(k=In(k,a),ha===null?ha=[k]:ha.push(k),Tt!==4&&(Tt=2),n===null)return!0;d=In(d,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=fu(a.stateNode,d,t),$c(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=am(w),om(w,t,a,d),$c(a,w),!1}a=a.return}while(a!==null);return!1}var pu=Error(s(461)),It=!1;function Jt(t,n,a,d){n.child=t===null?dp(n,null,a,d):vi(n,t.child,a,d)}function lm(t,n,a,d,w){a=a.render;var k=n.ref;if("ref"in d){var M={};for(var G in d)G!=="ref"&&(M[G]=d[G])}else M=d;return pi(n),d=Kc(t,n,a,M,k,w),G=Xc(),t!==null&&!It?(Zc(t,n,w),xr(t,n,w)):(it&&G&&Ac(n),n.flags|=1,Jt(t,n,d,w),n.child)}function cm(t,n,a,d,w){if(t===null){var k=a.type;return typeof k=="function"&&!jc(k)&&k.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=k,um(t,n,k,d,w)):(t=mo(a.type,null,d,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(k=t.child,!Su(t,w)){var M=k.memoizedProps;if(a=a.compare,a=a!==null?a:qs,a(M,d)&&t.ref===n.ref)return xr(t,n,w)}return n.flags|=1,t=dr(k,d),t.ref=n.ref,t.return=n,n.child=t}function um(t,n,a,d,w){if(t!==null){var k=t.memoizedProps;if(qs(k,d)&&t.ref===n.ref)if(It=!1,n.pendingProps=d=k,Su(t,w))(t.flags&131072)!==0&&(It=!0);else return n.lanes=t.lanes,xr(t,n,w)}return mu(t,n,a,d,w)}function dm(t,n,a,d){var w=d.children,k=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((n.flags&128)!==0){if(k=k!==null?k.baseLanes|a:a,t!==null){for(d=n.child=t.child,w=0;d!==null;)w=w|d.lanes|d.childLanes,d=d.sibling;d=w&~k}else d=0,n.child=null;return hm(t,n,k,a,d)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&bo(n,k!==null?k.cachePool:null),k!==null?pp(n,k):Wc(),mp(n);else return d=n.lanes=536870912,hm(t,n,k!==null?k.baseLanes|a:a,a,d)}else k!==null?(bo(n,k.cachePool),pp(n,k),Hr(),n.memoizedState=null):(t!==null&&bo(n,null),Wc(),Hr());return Jt(t,n,w,a),n.child}function sa(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function hm(t,n,a,d,w){var k=Hc();return k=k===null?null:{parent:Mt._currentValue,pool:k},n.memoizedState={baseLanes:a,cachePool:k},t!==null&&bo(n,null),Wc(),mp(n),t!==null&&Qi(t,n,d,!0),n.childLanes=w,null}function Oo(t,n){return n=Bo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function fm(t,n,a){return vi(n,t.child,null,a),t=Oo(n,n.pendingProps),t.flags|=2,Cn(n),n.memoizedState=null,t}function n_(t,n,a){var d=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(it){if(d.mode==="hidden")return t=Oo(n,d),n.lanes=536870912,sa(null,t);if(Vc(n),(t=wt)?(t=kg(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=Xf(t),a.return=n,n.child=a,Zt=n,wt=null)):t=null,t===null)throw Rr(n);return n.lanes=536870912,null}return Oo(n,d)}var k=t.memoizedState;if(k!==null){var M=k.dehydrated;if(Vc(n),w)if(n.flags&256)n.flags&=-257,n=fm(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(It||Qi(t,n,a,!1),w=(a&t.childLanes)!==0,It||w){if(d=yt,d!==null&&(M=nf(d,a),M!==0&&M!==k.retryLane))throw k.retryLane=M,ui(t,M),vn(d,t,M),pu;Go(),n=fm(t,n,a)}else t=k.treeContext,wt=Fn(M.nextSibling),Zt=n,it=!0,Lr=null,Hn=!1,t!==null&&Jf(n,t),n=Oo(n,d),n.flags|=4096;return n}return t=dr(t.child,{mode:d.mode,children:d.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Io(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 mu(t,n,a,d,w){return pi(n),a=Kc(t,n,a,d,void 0,w),d=Xc(),t!==null&&!It?(Zc(t,n,w),xr(t,n,w)):(it&&d&&Ac(n),n.flags|=1,Jt(t,n,a,w),n.child)}function pm(t,n,a,d,w,k){return pi(n),n.updateQueue=null,a=xp(n,d,a,w),gp(t),d=Xc(),t!==null&&!It?(Zc(t,n,k),xr(t,n,k)):(it&&d&&Ac(n),n.flags|=1,Jt(t,n,a,k),n.child)}function mm(t,n,a,d,w){if(pi(n),n.stateNode===null){var k=Yi,M=a.contextType;typeof M=="object"&&M!==null&&(k=Qt(M)),k=new a(d,k),n.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=hu,n.stateNode=k,k._reactInternals=n,k=n.stateNode,k.props=d,k.state=n.memoizedState,k.refs={},Fc(n),M=a.contextType,k.context=typeof M=="object"&&M!==null?Qt(M):Yi,k.state=n.memoizedState,M=a.getDerivedStateFromProps,typeof M=="function"&&(du(n,a,M,d),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&&hu.enqueueReplaceState(k,k.state,null),ea(n,d,k,w),Js(),k.state=n.memoizedState),typeof k.componentDidMount=="function"&&(n.flags|=4194308),d=!0}else if(t===null){k=n.stateNode;var G=n.memoizedProps,ee=yi(a,G);k.props=ee;var le=k.context,fe=a.contextType;M=Yi,typeof fe=="object"&&fe!==null&&(M=Qt(fe));var xe=a.getDerivedStateFromProps;fe=typeof xe=="function"||typeof k.getSnapshotBeforeUpdate=="function",G=n.pendingProps!==G,fe||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(G||le!==M)&&tm(n,k,d,M),Or=!1;var ce=n.memoizedState;k.state=ce,ea(n,d,k,w),Js(),le=n.memoizedState,G||ce!==le||Or?(typeof xe=="function"&&(du(n,a,xe,d),le=n.memoizedState),(ee=Or||em(n,a,ee,d,ce,le,M))?(fe||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=d,n.memoizedState=le),k.props=d,k.state=le,k.context=M,d=ee):(typeof k.componentDidMount=="function"&&(n.flags|=4194308),d=!1)}else{k=n.stateNode,Uc(t,n),M=n.memoizedProps,fe=yi(a,M),k.props=fe,xe=n.pendingProps,ce=k.context,le=a.contextType,ee=Yi,typeof le=="object"&&le!==null&&(ee=Qt(le)),G=a.getDerivedStateFromProps,(le=typeof G=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(M!==xe||ce!==ee)&&tm(n,k,d,ee),Or=!1,ce=n.memoizedState,k.state=ce,ea(n,d,k,w),Js();var ue=n.memoizedState;M!==xe||ce!==ue||Or||t!==null&&t.dependencies!==null&&xo(t.dependencies)?(typeof G=="function"&&(du(n,a,G,d),ue=n.memoizedState),(fe=Or||em(n,a,fe,d,ce,ue,ee)||t!==null&&t.dependencies!==null&&xo(t.dependencies))?(le||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(d,ue,ee),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(d,ue,ee)),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=d,n.memoizedState=ue),k.props=d,k.state=ue,k.context=ee,d=fe):(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),d=!1)}return k=d,Io(t,n),d=(n.flags&128)!==0,k||d?(k=n.stateNode,a=d&&typeof a.getDerivedStateFromError!="function"?null:k.render(),n.flags|=1,t!==null&&d?(n.child=vi(n,t.child,null,w),n.child=vi(n,null,a,w)):Jt(t,n,a,w),n.memoizedState=k.state,t=n.child):t=xr(t,n,w),t}function gm(t,n,a,d){return hi(),n.flags|=256,Jt(t,n,a,d),n.child}var gu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xu(t){return{baseLanes:t,cachePool:sp()}}function vu(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=En),t}function xm(t,n,a){var d=n.pendingProps,w=!1,k=(n.flags&128)!==0,M;if((M=k)||(M=t!==null&&t.memoizedState===null?!1:(At.current&2)!==0),M&&(w=!0,n.flags&=-129),M=(n.flags&32)!==0,n.flags&=-33,t===null){if(it){if(w?zr(n):Hr(),(t=wt)?(t=kg(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=Xf(t),a.return=n,n.child=a,Zt=n,wt=null)):t=null,t===null)throw Rr(n);return ed(t)?n.lanes=32:n.lanes=536870912,null}var G=d.children;return d=d.fallback,w?(Hr(),w=n.mode,G=Bo({mode:"hidden",children:G},w),d=di(d,w,a,null),G.return=n,d.return=n,G.sibling=d,n.child=G,d=n.child,d.memoizedState=xu(a),d.childLanes=vu(t,M,a),n.memoizedState=gu,sa(null,d)):(zr(n),bu(n,G))}var ee=t.memoizedState;if(ee!==null&&(G=ee.dehydrated,G!==null)){if(k)n.flags&256?(zr(n),n.flags&=-257,n=yu(t,n,a)):n.memoizedState!==null?(Hr(),n.child=t.child,n.flags|=128,n=null):(Hr(),G=d.fallback,w=n.mode,d=Bo({mode:"visible",children:d.children},w),G=di(G,w,a,null),G.flags|=2,d.return=n,G.return=n,d.sibling=G,n.child=d,vi(n,t.child,null,a),d=n.child,d.memoizedState=xu(a),d.childLanes=vu(t,M,a),n.memoizedState=gu,n=sa(null,d));else if(zr(n),ed(G)){if(M=G.nextSibling&&G.nextSibling.dataset,M)var le=M.dgst;M=le,d=Error(s(419)),d.stack="",d.digest=M,Vs({value:d,source:null,stack:null}),n=yu(t,n,a)}else if(It||Qi(t,n,a,!1),M=(a&t.childLanes)!==0,It||M){if(M=yt,M!==null&&(d=nf(M,a),d!==0&&d!==ee.retryLane))throw ee.retryLane=d,ui(t,d),vn(M,t,d),pu;Ju(G)||Go(),n=yu(t,n,a)}else Ju(G)?(n.flags|=192,n.child=t.child,n=null):(t=ee.treeContext,wt=Fn(G.nextSibling),Zt=n,it=!0,Lr=null,Hn=!1,t!==null&&Jf(n,t),n=bu(n,d.children),n.flags|=4096);return n}return w?(Hr(),G=d.fallback,w=n.mode,ee=t.child,le=ee.sibling,d=dr(ee,{mode:"hidden",children:d.children}),d.subtreeFlags=ee.subtreeFlags&65011712,le!==null?G=dr(le,G):(G=di(G,w,a,null),G.flags|=2),G.return=n,d.return=n,d.sibling=G,n.child=d,sa(null,d),d=n.child,G=t.child.memoizedState,G===null?G=xu(a):(w=G.cachePool,w!==null?(ee=Mt._currentValue,w=w.parent!==ee?{parent:ee,pool:ee}:w):w=sp(),G={baseLanes:G.baseLanes|a,cachePool:w}),d.memoizedState=G,d.childLanes=vu(t,M,a),n.memoizedState=gu,sa(t.child,d)):(zr(n),a=t.child,t=a.sibling,a=dr(a,{mode:"visible",children:d.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 bu(t,n){return n=Bo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Bo(t,n){return t=Sn(22,t,null,n),t.lanes=0,t}function yu(t,n,a){return vi(n,t.child,null,a),t=bu(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function vm(t,n,a){t.lanes|=n;var d=t.alternate;d!==null&&(d.lanes|=n),Oc(t.return,n,a)}function _u(t,n,a,d,w,k){var M=t.memoizedState;M===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:d,tail:a,tailMode:w,treeForkCount:k}:(M.isBackwards=n,M.rendering=null,M.renderingStartTime=0,M.last=d,M.tail=a,M.tailMode=w,M.treeForkCount=k)}function bm(t,n,a){var d=n.pendingProps,w=d.revealOrder,k=d.tail;d=d.children;var M=At.current,G=(M&2)!==0;if(G?(M=M&1|2,n.flags|=128):M&=1,U(At,M),Jt(t,n,d,a),d=it?Gs:0,!G&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&vm(t,a,n);else if(t.tag===19)vm(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&&ko(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),_u(n,!1,w,a,k,d);break;case"backwards":case"unstable_legacy-backwards":for(a=null,w=n.child,n.child=null;w!==null;){if(t=w.alternate,t!==null&&ko(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}_u(n,!0,a,null,k,d);break;case"together":_u(n,!1,null,null,void 0,d);break;default:n.memoizedState=null}return n.child}function xr(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),Ur|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(Qi(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=dr(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=dr(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function Su(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&xo(t)))}function r_(t,n,a){switch(n.tag){case 3:H(n,n.stateNode.containerInfo),Mr(n,Mt,t.memoizedState.cache),hi();break;case 27:case 5:ie(n);break;case 4:H(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,Vc(n),null;break;case 13:var d=n.memoizedState;if(d!==null)return d.dehydrated!==null?(zr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?xm(t,n,a):(zr(n),t=xr(t,n,a),t!==null?t.sibling:null);zr(n);break;case 19:var w=(t.flags&128)!==0;if(d=(a&n.childLanes)!==0,d||(Qi(t,n,a,!1),d=(a&n.childLanes)!==0),w){if(d)return bm(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),U(At,At.current),d)break;return null;case 22:return n.lanes=0,dm(t,n,a,n.pendingProps);case 24:Mr(n,Mt,t.memoizedState.cache)}return xr(t,n,a)}function ym(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)It=!0;else{if(!Su(t,a)&&(n.flags&128)===0)return It=!1,r_(t,n,a);It=(t.flags&131072)!==0}else It=!1,it&&(n.flags&1048576)!==0&&Qf(n,Gs,n.index);switch(n.lanes=0,n.tag){case 16:e:{var d=n.pendingProps;if(t=gi(n.elementType),n.type=t,typeof t=="function")jc(t)?(d=yi(t,d),n.tag=1,n=mm(null,n,t,d,a)):(n.tag=0,n=mu(null,n,t,d,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=lm(null,n,t,d,a);break e}else if(w===L){n.tag=14,n=cm(null,n,t,d,a);break e}}throw n=F(t)||t,Error(s(306,n,""))}}return n;case 0:return mu(t,n,n.type,n.pendingProps,a);case 1:return d=n.type,w=yi(d,n.pendingProps),mm(t,n,d,w,a);case 3:e:{if(H(n,n.stateNode.containerInfo),t===null)throw Error(s(387));d=n.pendingProps;var k=n.memoizedState;w=k.element,Uc(t,n),ea(n,d,null,a);var M=n.memoizedState;if(d=M.cache,Mr(n,Mt,d),d!==k.cache&&Ic(n,[Mt],a,!0),Js(),d=M.element,k.isDehydrated)if(k={element:d,isDehydrated:!1,cache:M.cache},n.updateQueue.baseState=k,n.memoizedState=k,n.flags&256){n=gm(t,n,d,a);break e}else if(d!==w){w=In(Error(s(424)),n),Vs(w),n=gm(t,n,d,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(wt=Fn(t.firstChild),Zt=n,it=!0,Lr=null,Hn=!0,a=dp(n,null,d,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(hi(),d===w){n=xr(t,n,a);break e}Jt(t,n,d,a)}n=n.child}return n;case 26:return Io(t,n),t===null?(a=Dg(n.type,null,n.pendingProps,null))?n.memoizedState=a:it||(a=n.type,t=n.pendingProps,d=Jo(Q.current).createElement(a),d[Xt]=n,d[hn]=t,en(d,a,t),Wt(d),n.stateNode=d):n.memoizedState=Dg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return ie(n),t===null&&it&&(d=n.stateNode=Ng(n.type,n.pendingProps,Q.current),Zt=n,Hn=!0,w=wt,Vr(n.type)?(td=w,wt=Fn(d.firstChild)):wt=w),Jt(t,n,n.pendingProps.children,a),Io(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&it&&((w=d=wt)&&(d=R_(d,n.type,n.pendingProps,Hn),d!==null?(n.stateNode=d,Zt=n,wt=Fn(d.firstChild),Hn=!1,w=!0):w=!1),w||Rr(n)),ie(n),w=n.type,k=n.pendingProps,M=t!==null?t.memoizedProps:null,d=k.children,Xu(w,k)?d=null:M!==null&&Xu(w,M)&&(n.flags|=32),n.memoizedState!==null&&(w=Kc(t,n,Yy,null,null,a),ya._currentValue=w),Io(t,n),Jt(t,n,d,a),n.child;case 6:return t===null&&it&&((t=a=wt)&&(a=M_(a,n.pendingProps,Hn),a!==null?(n.stateNode=a,Zt=n,wt=null,t=!0):t=!1),t||Rr(n)),null;case 13:return xm(t,n,a);case 4:return H(n,n.stateNode.containerInfo),d=n.pendingProps,t===null?n.child=vi(n,null,d,a):Jt(t,n,d,a),n.child;case 11:return lm(t,n,n.type,n.pendingProps,a);case 7:return Jt(t,n,n.pendingProps,a),n.child;case 8:return Jt(t,n,n.pendingProps.children,a),n.child;case 12:return Jt(t,n,n.pendingProps.children,a),n.child;case 10:return d=n.pendingProps,Mr(n,n.type,d.value),Jt(t,n,d.children,a),n.child;case 9:return w=n.type._context,d=n.pendingProps.children,pi(n),w=Qt(w),d=d(w),n.flags|=1,Jt(t,n,d,a),n.child;case 14:return cm(t,n,n.type,n.pendingProps,a);case 15:return um(t,n,n.type,n.pendingProps,a);case 19:return bm(t,n,a);case 31:return n_(t,n,a);case 22:return dm(t,n,a,n.pendingProps);case 24:return pi(n),d=Qt(Mt),t===null?(w=Hc(),w===null&&(w=yt,k=Bc(),w.pooledCache=k,k.refCount++,k!==null&&(w.pooledCacheLanes|=a),w=k),n.memoizedState={parent:d,cache:w},Fc(n),Mr(n,Mt,w)):((t.lanes&a)!==0&&(Uc(t,n),ea(n,null,null,a),Js()),w=t.memoizedState,k=n.memoizedState,w.parent!==d?(w={parent:d,cache:d},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),Mr(n,Mt,d)):(d=k.cache,Mr(n,Mt,d),d!==w.cache&&Ic(n,[Mt],a,!0))),Jt(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function vr(t){t.flags|=4}function wu(t,n,a,d,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(Vm())t.flags|=8192;else throw xi=_o,Pc}else t.flags&=-16777217}function _m(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Ig(n))if(Vm())t.flags|=8192;else throw xi=_o,Pc}function zo(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?Jl():536870912,t.lanes|=n,us|=n)}function aa(t,n){if(!it)switch(t.tailMode){case"hidden":n=t.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var d=null;a!==null;)a.alternate!==null&&(d=a),a=a.sibling;d===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:d.sibling=null}}function Ct(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,d=0;if(n)for(var w=t.child;w!==null;)a|=w.lanes|w.childLanes,d|=w.subtreeFlags&65011712,d|=w.flags&65011712,w.return=t,w=w.sibling;else for(w=t.child;w!==null;)a|=w.lanes|w.childLanes,d|=w.subtreeFlags,d|=w.flags,w.return=t,w=w.sibling;return t.subtreeFlags|=d,t.childLanes=a,n}function i_(t,n,a){var d=n.pendingProps;switch(Dc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ct(n),null;case 1:return Ct(n),null;case 3:return a=n.stateNode,d=null,t!==null&&(d=t.memoizedState.cache),n.memoizedState.cache!==d&&(n.flags|=2048),pr(Mt),se(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Zi(n)?vr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Rc())),Ct(n),null;case 26:var w=n.type,k=n.memoizedState;return t===null?(vr(n),k!==null?(Ct(n),_m(n,k)):(Ct(n),wu(n,w,null,d,a))):k?k!==t.memoizedState?(vr(n),Ct(n),_m(n,k)):(Ct(n),n.flags&=-16777217):(t=t.memoizedProps,t!==d&&vr(n),Ct(n),wu(n,w,t,d,a)),null;case 27:if(ge(n),a=Q.current,w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==d&&vr(n);else{if(!d){if(n.stateNode===null)throw Error(s(166));return Ct(n),null}t=K.current,Zi(n)?ep(n):(t=Ng(w,d,a),n.stateNode=t,vr(n))}return Ct(n),null;case 5:if(ge(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==d&&vr(n);else{if(!d){if(n.stateNode===null)throw Error(s(166));return Ct(n),null}if(k=K.current,Zi(n))ep(n);else{var M=Jo(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 d.is=="string"?M.createElement("select",{is:d.is}):M.createElement("select"),d.multiple?k.multiple=!0:d.size&&(k.size=d.size);break;default:k=typeof d.is=="string"?M.createElement(w,{is:d.is}):M.createElement(w)}}k[Xt]=n,k[hn]=d;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(en(k,w,d),w){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&vr(n)}}return Ct(n),wu(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==d&&vr(n);else{if(typeof d!="string"&&n.stateNode===null)throw Error(s(166));if(t=Q.current,Zi(n)){if(t=n.stateNode,a=n.memoizedProps,d=null,w=Zt,w!==null)switch(w.tag){case 27:case 5:d=w.memoizedProps}t[Xt]=n,t=!!(t.nodeValue===a||d!==null&&d.suppressHydrationWarning===!0||xg(t.nodeValue,a)),t||Rr(n,!0)}else t=Jo(t).createTextNode(d),t[Xt]=n,n.stateNode=t}return Ct(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(d=Zi(n),a!==null){if(t===null){if(!d)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Xt]=n}else hi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ct(n),t=!1}else a=Rc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(Cn(n),n):(Cn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return Ct(n),null;case 13:if(d=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=Zi(n),d!==null&&d.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[Xt]=n}else hi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ct(n),w=!1}else w=Rc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=w),w=!0;if(!w)return n.flags&256?(Cn(n),n):(Cn(n),null)}return Cn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=d!==null,t=t!==null&&t.memoizedState!==null,a&&(d=n.child,w=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(w=d.alternate.memoizedState.cachePool.pool),k=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(k=d.memoizedState.cachePool.pool),k!==w&&(d.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),zo(n,n.updateQueue),Ct(n),null);case 4:return se(),t===null&&Wu(n.stateNode.containerInfo),Ct(n),null;case 10:return pr(n.type),Ct(n),null;case 19:if(W(At),d=n.memoizedState,d===null)return Ct(n),null;if(w=(n.flags&128)!==0,k=d.rendering,k===null)if(w)aa(d,!1);else{if(Tt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(k=ko(t),k!==null){for(n.flags|=128,aa(d,!1),t=k.updateQueue,n.updateQueue=t,zo(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)Kf(a,t),a=a.sibling;return U(At,At.current&1|2),it&&hr(n,d.treeForkCount),n.child}t=t.sibling}d.tail!==null&&Ye()>$o&&(n.flags|=128,w=!0,aa(d,!1),n.lanes=4194304)}else{if(!w)if(t=ko(k),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,zo(n,t),aa(d,!0),d.tail===null&&d.tailMode==="hidden"&&!k.alternate&&!it)return Ct(n),null}else 2*Ye()-d.renderingStartTime>$o&&a!==536870912&&(n.flags|=128,w=!0,aa(d,!1),n.lanes=4194304);d.isBackwards?(k.sibling=n.child,n.child=k):(t=d.last,t!==null?t.sibling=k:n.child=k,d.last=k)}return d.tail!==null?(t=d.tail,d.rendering=t,d.tail=t.sibling,d.renderingStartTime=Ye(),t.sibling=null,a=At.current,U(At,w?a&1|2:a&1),it&&hr(n,d.treeForkCount),t):(Ct(n),null);case 22:case 23:return Cn(n),Gc(),d=n.memoizedState!==null,t!==null?t.memoizedState!==null!==d&&(n.flags|=8192):d&&(n.flags|=8192),d?(a&536870912)!==0&&(n.flags&128)===0&&(Ct(n),n.subtreeFlags&6&&(n.flags|=8192)):Ct(n),a=n.updateQueue,a!==null&&zo(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),d=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(d=n.memoizedState.cachePool.pool),d!==a&&(n.flags|=2048),t!==null&&W(mi),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),pr(Mt),Ct(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function s_(t,n){switch(Dc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return pr(Mt),se(),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(Cn(n),n.alternate===null)throw Error(s(340));hi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(Cn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));hi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return W(At),null;case 4:return se(),null;case 10:return pr(n.type),null;case 22:case 23:return Cn(n),Gc(),t!==null&&W(mi),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return pr(Mt),null;case 25:return null;default:return null}}function Sm(t,n){switch(Dc(n),n.tag){case 3:pr(Mt),se();break;case 26:case 27:case 5:ge(n);break;case 4:se();break;case 31:n.memoizedState!==null&&Cn(n);break;case 13:Cn(n);break;case 19:W(At);break;case 10:pr(n.type);break;case 22:case 23:Cn(n),Gc(),t!==null&&W(mi);break;case 24:pr(Mt)}}function oa(t,n){try{var a=n.updateQueue,d=a!==null?a.lastEffect:null;if(d!==null){var w=d.next;a=w;do{if((a.tag&t)===t){d=void 0;var k=a.create,M=a.inst;d=k(),M.destroy=d}a=a.next}while(a!==w)}}catch(G){mt(n,n.return,G)}}function Pr(t,n,a){try{var d=n.updateQueue,w=d!==null?d.lastEffect:null;if(w!==null){var k=w.next;d=k;do{if((d.tag&t)===t){var M=d.inst,G=M.destroy;if(G!==void 0){M.destroy=void 0,w=n;var ee=a,le=G;try{le()}catch(fe){mt(w,ee,fe)}}}d=d.next}while(d!==k)}}catch(fe){mt(n,n.return,fe)}}function wm(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{fp(n,a)}catch(d){mt(t,t.return,d)}}}function Cm(t,n,a){a.props=yi(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(d){mt(t,n,d)}}function la(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var d=t.stateNode;break;case 30:d=t.stateNode;break;default:d=t.stateNode}typeof a=="function"?t.refCleanup=a(d):a.current=d}}catch(w){mt(t,n,w)}}function Jn(t,n){var a=t.ref,d=t.refCleanup;if(a!==null)if(typeof d=="function")try{d()}catch(w){mt(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){mt(t,n,w)}else a.current=null}function km(t){var n=t.type,a=t.memoizedProps,d=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&d.focus();break e;case"img":a.src?d.src=a.src:a.srcSet&&(d.srcset=a.srcSet)}}catch(w){mt(t,t.return,w)}}function Cu(t,n,a){try{var d=t.stateNode;j_(d,t.type,a,n),d[hn]=n}catch(w){mt(t,t.return,w)}}function Em(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Vr(t.type)||t.tag===4}function ku(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Em(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 Eu(t,n,a){var d=t.tag;if(d===5||d===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=cr));else if(d!==4&&(d===27&&Vr(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(Eu(t,n,a),t=t.sibling;t!==null;)Eu(t,n,a),t=t.sibling}function Ho(t,n,a){var d=t.tag;if(d===5||d===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(d!==4&&(d===27&&Vr(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Ho(t,n,a),t=t.sibling;t!==null;)Ho(t,n,a),t=t.sibling}function jm(t){var n=t.stateNode,a=t.memoizedProps;try{for(var d=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);en(n,d,a),n[Xt]=t,n[hn]=a}catch(k){mt(t,t.return,k)}}var br=!1,Bt=!1,ju=!1,Nm=typeof WeakSet=="function"?WeakSet:Set,Gt=null;function a_(t,n){if(t=t.containerInfo,Yu=al,t=Pf(t),yc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var d=a.getSelection&&a.getSelection();if(d&&d.rangeCount!==0){a=d.anchorNode;var w=d.anchorOffset,k=d.focusNode;d=d.focusOffset;try{a.nodeType,k.nodeType}catch{a=null;break e}var M=0,G=-1,ee=-1,le=0,fe=0,xe=t,ce=null;t:for(;;){for(var ue;xe!==a||w!==0&&xe.nodeType!==3||(G=M+w),xe!==k||d!==0&&xe.nodeType!==3||(ee=M+d),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&&++fe===d&&(ee=M),(ue=xe.nextSibling)!==null)break;xe=ce,ce=xe.parentNode}xe=ue}a=G===-1||ee===-1?null:{start:G,end:ee}}else a=null}a=a||{start:0,end:0}}else a=null;for(Ku={focusedElem:t,selectionRange:a},al=!1,Gt=n;Gt!==null;)if(n=Gt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Gt=t;else for(;Gt!==null;){switch(n=Gt,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,d=a.stateNode;try{var Ne=yi(a.type,w);t=d.getSnapshotBeforeUpdate(Ne,k),d.__reactInternalSnapshotBeforeUpdate=t}catch(Be){mt(a,a.return,Be)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)Qu(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Qu(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,Gt=t;break}Gt=n.return}}function Tm(t,n,a){var d=a.flags;switch(a.tag){case 0:case 11:case 15:_r(t,a),d&4&&oa(5,a);break;case 1:if(_r(t,a),d&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(M){mt(a,a.return,M)}else{var w=yi(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(M){mt(a,a.return,M)}}d&64&&wm(a),d&512&&la(a,a.return);break;case 3:if(_r(t,a),d&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{fp(t,n)}catch(M){mt(a,a.return,M)}}break;case 27:n===null&&d&4&&jm(a);case 26:case 5:_r(t,a),n===null&&d&4&&km(a),d&512&&la(a,a.return);break;case 12:_r(t,a);break;case 31:_r(t,a),d&4&&Lm(t,a);break;case 13:_r(t,a),d&4&&Rm(t,a),d&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=m_.bind(null,a),O_(t,a))));break;case 22:if(d=a.memoizedState!==null||br,!d){n=n!==null&&n.memoizedState!==null||Bt,w=br;var k=Bt;br=d,(Bt=n)&&!k?Sr(t,a,(a.subtreeFlags&8772)!==0):_r(t,a),br=w,Bt=k}break;case 30:break;default:_r(t,a)}}function Am(t){var n=t.alternate;n!==null&&(t.alternate=null,Am(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&rc(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,pn=!1;function yr(t,n,a){for(a=a.child;a!==null;)Dm(t,n,a),a=a.sibling}function Dm(t,n,a){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(Pe,a)}catch{}switch(a.tag){case 26:Bt||Jn(a,n),yr(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 d=kt,w=pn;Vr(a.type)&&(kt=a.stateNode,pn=!1),yr(t,n,a),xa(a.stateNode),kt=d,pn=w;break;case 5:Bt||Jn(a,n);case 6:if(d=kt,w=pn,kt=null,yr(t,n,a),kt=d,pn=w,kt!==null)if(pn)try{(kt.nodeType===9?kt.body:kt.nodeName==="HTML"?kt.ownerDocument.body:kt).removeChild(a.stateNode)}catch(k){mt(a,n,k)}else try{kt.removeChild(a.stateNode)}catch(k){mt(a,n,k)}break;case 18:kt!==null&&(pn?(t=kt,wg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),vs(t)):wg(kt,a.stateNode));break;case 4:d=kt,w=pn,kt=a.stateNode.containerInfo,pn=!0,yr(t,n,a),kt=d,pn=w;break;case 0:case 11:case 14:case 15:Pr(2,a,n),Bt||Pr(4,a,n),yr(t,n,a);break;case 1:Bt||(Jn(a,n),d=a.stateNode,typeof d.componentWillUnmount=="function"&&Cm(a,n,d)),yr(t,n,a);break;case 21:yr(t,n,a);break;case 22:Bt=(d=Bt)||a.memoizedState!==null,yr(t,n,a),Bt=d;break;default:yr(t,n,a)}}function Lm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{vs(t)}catch(a){mt(n,n.return,a)}}}function Rm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{vs(t)}catch(a){mt(n,n.return,a)}}function o_(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Nm),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Nm),n;default:throw Error(s(435,t.tag))}}function Po(t,n){var a=o_(t);n.forEach(function(d){if(!a.has(d)){a.add(d);var w=g_.bind(null,t,d);d.then(w,w)}})}function mn(t,n){var a=n.deletions;if(a!==null)for(var d=0;d<a.length;d++){var w=a[d],k=t,M=n,G=M;e:for(;G!==null;){switch(G.tag){case 27:if(Vr(G.type)){kt=G.stateNode,pn=!1;break e}break;case 5:kt=G.stateNode,pn=!1;break e;case 3:case 4:kt=G.stateNode.containerInfo,pn=!0;break e}G=G.return}if(kt===null)throw Error(s(160));Dm(k,M,w),kt=null,pn=!1,k=w.alternate,k!==null&&(k.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Mm(n,t),n=n.sibling}var Gn=null;function Mm(t,n){var a=t.alternate,d=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:mn(n,t),gn(t),d&4&&(Pr(3,t,t.return),oa(3,t),Pr(5,t,t.return));break;case 1:mn(n,t),gn(t),d&512&&(Bt||a===null||Jn(a,a.return)),d&64&&br&&(t=t.updateQueue,t!==null&&(d=t.callbacks,d!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?d:a.concat(d))));break;case 26:var w=Gn;if(mn(n,t),gn(t),d&512&&(Bt||a===null||Jn(a,a.return)),d&4){var k=a!==null?a.memoizedState:null;if(d=t.memoizedState,a===null)if(d===null)if(t.stateNode===null){e:{d=t.type,a=t.memoizedProps,w=w.ownerDocument||w;t:switch(d){case"title":k=w.getElementsByTagName("title")[0],(!k||k[Os]||k[Xt]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=w.createElement(d),w.head.insertBefore(k,w.querySelector("head > title"))),en(k,d,a),k[Xt]=t,Wt(k),d=k;break e;case"link":var M=Mg("link","href",w).get(d+(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(d),en(k,d,a),w.head.appendChild(k);break;case"meta":if(M=Mg("meta","content",w).get(d+(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(d),en(k,d,a),w.head.appendChild(k);break;default:throw Error(s(468,d))}k[Xt]=t,Wt(k),d=k}t.stateNode=d}else Og(w,t.type,t.stateNode);else t.stateNode=Rg(w,d,t.memoizedProps);else k!==d?(k===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):k.count--,d===null?Og(w,t.type,t.stateNode):Rg(w,d,t.memoizedProps)):d===null&&t.stateNode!==null&&Cu(t,t.memoizedProps,a.memoizedProps)}break;case 27:mn(n,t),gn(t),d&512&&(Bt||a===null||Jn(a,a.return)),a!==null&&d&4&&Cu(t,t.memoizedProps,a.memoizedProps);break;case 5:if(mn(n,t),gn(t),d&512&&(Bt||a===null||Jn(a,a.return)),t.flags&32){w=t.stateNode;try{Fi(w,"")}catch(Ne){mt(t,t.return,Ne)}}d&4&&t.stateNode!=null&&(w=t.memoizedProps,Cu(t,w,a!==null?a.memoizedProps:w)),d&1024&&(ju=!0);break;case 6:if(mn(n,t),gn(t),d&4){if(t.stateNode===null)throw Error(s(162));d=t.memoizedProps,a=t.stateNode;try{a.nodeValue=d}catch(Ne){mt(t,t.return,Ne)}}break;case 3:if(nl=null,w=Gn,Gn=el(n.containerInfo),mn(n,t),Gn=w,gn(t),d&4&&a!==null&&a.memoizedState.isDehydrated)try{vs(n.containerInfo)}catch(Ne){mt(t,t.return,Ne)}ju&&(ju=!1,Om(t));break;case 4:d=Gn,Gn=el(t.stateNode.containerInfo),mn(n,t),gn(t),Gn=d;break;case 12:mn(n,t),gn(t);break;case 31:mn(n,t),gn(t),d&4&&(d=t.updateQueue,d!==null&&(t.updateQueue=null,Po(t,d)));break;case 13:mn(n,t),gn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Uo=Ye()),d&4&&(d=t.updateQueue,d!==null&&(t.updateQueue=null,Po(t,d)));break;case 22:w=t.memoizedState!==null;var ee=a!==null&&a.memoizedState!==null,le=br,fe=Bt;if(br=le||w,Bt=fe||ee,mn(n,t),Bt=fe,br=le,gn(t),d&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||ee||br||Bt||_i(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){ee=a=n;try{if(k=ee.stateNode,w)M=k.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{G=ee.stateNode;var xe=ee.memoizedProps.style,ce=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;G.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(Ne){mt(ee,ee.return,Ne)}}}else if(n.tag===6){if(a===null){ee=n;try{ee.stateNode.nodeValue=w?"":ee.memoizedProps}catch(Ne){mt(ee,ee.return,Ne)}}}else if(n.tag===18){if(a===null){ee=n;try{var ue=ee.stateNode;w?Cg(ue,!0):Cg(ee.stateNode,!1)}catch(Ne){mt(ee,ee.return,Ne)}}}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}d&4&&(d=t.updateQueue,d!==null&&(a=d.retryQueue,a!==null&&(d.retryQueue=null,Po(t,a))));break;case 19:mn(n,t),gn(t),d&4&&(d=t.updateQueue,d!==null&&(t.updateQueue=null,Po(t,d)));break;case 30:break;case 21:break;default:mn(n,t),gn(t)}}function gn(t){var n=t.flags;if(n&2){try{for(var a,d=t.return;d!==null;){if(Em(d)){a=d;break}d=d.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var w=a.stateNode,k=ku(t);Ho(t,k,w);break;case 5:var M=a.stateNode;a.flags&32&&(Fi(M,""),a.flags&=-33);var G=ku(t);Ho(t,G,M);break;case 3:case 4:var ee=a.stateNode.containerInfo,le=ku(t);Eu(t,le,ee);break;default:throw Error(s(161))}}catch(fe){mt(t,t.return,fe)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Om(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Om(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function _r(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Tm(t,n.alternate,n),n=n.sibling}function _i(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),_i(n);break;case 1:Jn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Cm(n,n.return,a),_i(n);break;case 27:xa(n.stateNode);case 26:case 5:Jn(n,n.return),_i(n);break;case 22:n.memoizedState===null&&_i(n);break;case 30:_i(n);break;default:_i(n)}t=t.sibling}}function Sr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var d=n.alternate,w=t,k=n,M=k.flags;switch(k.tag){case 0:case 11:case 15:Sr(w,k,a),oa(4,k);break;case 1:if(Sr(w,k,a),d=k,w=d.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(le){mt(d,d.return,le)}if(d=k,w=d.updateQueue,w!==null){var G=d.stateNode;try{var ee=w.shared.hiddenCallbacks;if(ee!==null)for(w.shared.hiddenCallbacks=null,w=0;w<ee.length;w++)hp(ee[w],G)}catch(le){mt(d,d.return,le)}}a&&M&64&&wm(k),la(k,k.return);break;case 27:jm(k);case 26:case 5:Sr(w,k,a),a&&d===null&&M&4&&km(k),la(k,k.return);break;case 12:Sr(w,k,a);break;case 31:Sr(w,k,a),a&&M&4&&Lm(w,k);break;case 13:Sr(w,k,a),a&&M&4&&Rm(w,k);break;case 22:k.memoizedState===null&&Sr(w,k,a),la(k,k.return);break;case 30:break;default:Sr(w,k,a)}n=n.sibling}}function Nu(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&&Ys(a))}function Tu(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Ys(t))}function Vn(t,n,a,d){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Im(t,n,a,d),n=n.sibling}function Im(t,n,a,d){var w=n.flags;switch(n.tag){case 0:case 11:case 15:Vn(t,n,a,d),w&2048&&oa(9,n);break;case 1:Vn(t,n,a,d);break;case 3:Vn(t,n,a,d),w&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Ys(t)));break;case 12:if(w&2048){Vn(t,n,a,d),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(ee){mt(n,n.return,ee)}}else Vn(t,n,a,d);break;case 31:Vn(t,n,a,d);break;case 13:Vn(t,n,a,d);break;case 23:break;case 22:k=n.stateNode,M=n.alternate,n.memoizedState!==null?k._visibility&2?Vn(t,n,a,d):ca(t,n):k._visibility&2?Vn(t,n,a,d):(k._visibility|=2,os(t,n,a,d,(n.subtreeFlags&10256)!==0||!1)),w&2048&&Nu(M,n);break;case 24:Vn(t,n,a,d),w&2048&&Tu(n.alternate,n);break;default:Vn(t,n,a,d)}}function os(t,n,a,d,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var k=t,M=n,G=a,ee=d,le=M.flags;switch(M.tag){case 0:case 11:case 15:os(k,M,G,ee,w),oa(8,M);break;case 23:break;case 22:var fe=M.stateNode;M.memoizedState!==null?fe._visibility&2?os(k,M,G,ee,w):ca(k,M):(fe._visibility|=2,os(k,M,G,ee,w)),w&&le&2048&&Nu(M.alternate,M);break;case 24:os(k,M,G,ee,w),w&&le&2048&&Tu(M.alternate,M);break;default:os(k,M,G,ee,w)}n=n.sibling}}function ca(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,d=n,w=d.flags;switch(d.tag){case 22:ca(a,d),w&2048&&Nu(d.alternate,d);break;case 24:ca(a,d),w&2048&&Tu(d.alternate,d);break;default:ca(a,d)}n=n.sibling}}var ua=8192;function ls(t,n,a){if(t.subtreeFlags&ua)for(t=t.child;t!==null;)Bm(t,n,a),t=t.sibling}function Bm(t,n,a){switch(t.tag){case 26:ls(t,n,a),t.flags&ua&&t.memoizedState!==null&&V_(a,Gn,t.memoizedState,t.memoizedProps);break;case 5:ls(t,n,a);break;case 3:case 4:var d=Gn;Gn=el(t.stateNode.containerInfo),ls(t,n,a),Gn=d;break;case 22:t.memoizedState===null&&(d=t.alternate,d!==null&&d.memoizedState!==null?(d=ua,ua=16777216,ls(t,n,a),ua=d):ls(t,n,a));break;default:ls(t,n,a)}}function zm(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function da(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var d=n[a];Gt=d,Pm(d,t)}zm(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Hm(t),t=t.sibling}function Hm(t){switch(t.tag){case 0:case 11:case 15:da(t),t.flags&2048&&Pr(9,t,t.return);break;case 3:da(t);break;case 12:da(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Fo(t)):da(t);break;default:da(t)}}function Fo(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var d=n[a];Gt=d,Pm(d,t)}zm(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Pr(8,n,n.return),Fo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Fo(n));break;default:Fo(n)}t=t.sibling}}function Pm(t,n){for(;Gt!==null;){var a=Gt;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 d=a.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Ys(a.memoizedState.cache)}if(d=a.child,d!==null)d.return=a,Gt=d;else e:for(a=t;Gt!==null;){d=Gt;var w=d.sibling,k=d.return;if(Am(d),d===a){Gt=null;break e}if(w!==null){w.return=k,Gt=w;break e}Gt=k}}}var l_={getCacheForType:function(t){var n=Qt(Mt),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return Qt(Mt).controller.signal}},c_=typeof WeakMap=="function"?WeakMap:Map,ut=0,yt=null,Ze=null,et=0,pt=0,kn=null,Fr=!1,cs=!1,Au=!1,wr=0,Tt=0,Ur=0,Si=0,Du=0,En=0,us=0,ha=null,xn=null,Lu=!1,Uo=0,Fm=0,$o=1/0,qo=null,$r=null,Ft=0,qr=null,ds=null,Cr=0,Ru=0,Mu=null,Um=null,fa=0,Ou=null;function jn(){return(ut&2)!==0&&et!==0?et&-et:q.T!==null?Fu():rf()}function $m(){if(En===0)if((et&536870912)===0||it){var t=Xe;Xe<<=1,(Xe&3932160)===0&&(Xe=262144),En=t}else En=536870912;return t=wn.current,t!==null&&(t.flags|=32),En}function vn(t,n,a){(t===yt&&(pt===2||pt===9)||t.cancelPendingCommit!==null)&&(hs(t,0),Wr(t,et,En,!1)),Ms(t,a),((ut&2)===0||t!==yt)&&(t===yt&&((ut&2)===0&&(Si|=a),Tt===4&&Wr(t,et,En,!1)),er(t))}function qm(t,n,a){if((ut&6)!==0)throw Error(s(327));var d=!a&&(n&127)===0&&(n&t.expiredLanes)===0||Et(t,n),w=d?h_(t,n):Bu(t,n,!0),k=d;do{if(w===0){cs&&!d&&Wr(t,n,0,!1);break}else{if(a=t.current.alternate,k&&!u_(a)){w=Bu(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=ha;var ee=G.current.memoizedState.isDehydrated;if(ee&&(hs(G,M).flags|=256),M=Bu(G,M,!1),M!==2){if(Au&&!ee){G.errorRecoveryDisabledLanes|=k,Si|=k,w=4;break e}k=xn,xn=w,k!==null&&(xn===null?xn=k:xn.push.apply(xn,k))}w=M}if(k=!1,w!==2)continue}}if(w===1){hs(t,0),Wr(t,n,0,!0);break}e:{switch(d=t,k=w,k){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Wr(d,n,En,!Fr);break e;case 2:xn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(w=Uo+300-Ye(),10<w)){if(Wr(d,n,En,!Fr),Rt(d,0,!0)!==0)break e;Cr=n,d.timeoutHandle=_g(Wm.bind(null,d,a,xn,qo,Lu,n,En,Si,us,Fr,k,"Throttled",-0,0),w);break e}Wm(d,a,xn,qo,Lu,n,En,Si,us,Fr,k,null,-0,0)}}break}while(!0);er(t)}function Wm(t,n,a,d,w,k,M,G,ee,le,fe,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:cr},Bm(n,k,xe);var Ne=(k&62914560)===k?Uo-Ye():(k&4194048)===k?Fm-Ye():0;if(Ne=Y_(xe,Ne),Ne!==null){Cr=k,t.cancelPendingCommit=Ne(Jm.bind(null,t,n,k,a,d,w,M,G,ee,fe,xe,null,ce,ue)),Wr(t,k,M,!le);return}}Jm(t,n,k,a,d,w,M,G,ee)}function u_(t){for(var n=t;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var d=0;d<a.length;d++){var w=a[d],k=w.getSnapshot;w=w.value;try{if(!_n(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,d){n&=~Du,n&=~Si,t.suspendedLanes|=n,t.pingedLanes&=~n,d&&(t.warmLanes|=n),d=t.expirationTimes;for(var w=n;0<w;){var k=31-qe(w),M=1<<k;d[k]=-1,w&=~M}a!==0&&ef(t,a,n)}function Wo(){return(ut&6)===0?(pa(0),!1):!0}function Iu(){if(Ze!==null){if(pt===0)var t=Ze.return;else t=Ze,fr=fi=null,Qc(t),ns=null,Xs=0,t=Ze;for(;t!==null;)Sm(t.alternate,t),t=t.return;Ze=null}}function hs(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,A_(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Cr=0,Iu(),yt=t,Ze=a=dr(t.current,null),et=n,pt=0,kn=null,Fr=!1,cs=Et(t,n),Au=!1,us=En=Du=Si=Ur=Tt=0,xn=ha=null,Lu=!1,(n&8)!==0&&(n|=n&32);var d=t.entangledLanes;if(d!==0)for(t=t.entanglements,d&=n;0<d;){var w=31-qe(d),k=1<<w;n|=t[w],d&=~k}return wr=n,ho(),a}function Gm(t,n){We=null,q.H=ia,n===ts||n===yo?(n=lp(),pt=3):n===Pc?(n=lp(),pt=4):pt=n===pu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,kn=n,Ze===null&&(Tt=1,Mo(t,In(n,t.current)))}function Vm(){var t=wn.current;return t===null?!0:(et&4194048)===et?Pn===null:(et&62914560)===et||(et&536870912)!==0?t===Pn:!1}function Ym(){var t=q.H;return q.H=ia,t===null?ia:t}function Km(){var t=q.A;return q.A=l_,t}function Go(){Tt=4,Fr||(et&4194048)!==et&&wn.current!==null||(cs=!0),(Ur&134217727)===0&&(Si&134217727)===0||yt===null||Wr(yt,et,En,!1)}function Bu(t,n,a){var d=ut;ut|=2;var w=Ym(),k=Km();(yt!==t||et!==n)&&(qo=null,hs(t,n)),n=!1;var M=Tt;e:do try{if(pt!==0&&Ze!==null){var G=Ze,ee=kn;switch(pt){case 8:Iu(),M=6;break e;case 3:case 2:case 9:case 6:wn.current===null&&(n=!0);var le=pt;if(pt=0,kn=null,fs(t,G,ee,le),a&&cs){M=0;break e}break;default:le=pt,pt=0,kn=null,fs(t,G,ee,le)}}d_(),M=Tt;break}catch(fe){Gm(t,fe)}while(!0);return n&&t.shellSuspendCounter++,fr=fi=null,ut=d,q.H=w,q.A=k,Ze===null&&(yt=null,et=0,ho()),M}function d_(){for(;Ze!==null;)Xm(Ze)}function h_(t,n){var a=ut;ut|=2;var d=Ym(),w=Km();yt!==t||et!==n?(qo=null,$o=Ye()+500,hs(t,n)):cs=Et(t,n);e:do try{if(pt!==0&&Ze!==null){n=Ze;var k=kn;t:switch(pt){case 1:pt=0,kn=null,fs(t,n,k,1);break;case 2:case 9:if(ap(k)){pt=0,kn=null,Zm(n);break}n=function(){pt!==2&&pt!==9||yt!==t||(pt=7),er(t)},k.then(n,n);break e;case 3:pt=7;break e;case 4:pt=5;break e;case 7:ap(k)?(pt=0,kn=null,Zm(n)):(pt=0,kn=null,fs(t,n,k,7));break;case 5:var M=null;switch(Ze.tag){case 26:M=Ze.memoizedState;case 5:case 27:var G=Ze;if(M?Ig(M):G.stateNode.complete){pt=0,kn=null;var ee=G.sibling;if(ee!==null)Ze=ee;else{var le=G.return;le!==null?(Ze=le,Vo(le)):Ze=null}break t}}pt=0,kn=null,fs(t,n,k,5);break;case 6:pt=0,kn=null,fs(t,n,k,6);break;case 8:Iu(),Tt=6;break e;default:throw Error(s(462))}}f_();break}catch(fe){Gm(t,fe)}while(!0);return fr=fi=null,q.H=d,q.A=w,ut=a,Ze!==null?0:(yt=null,et=0,ho(),Tt)}function f_(){for(;Ze!==null&&!nt();)Xm(Ze)}function Xm(t){var n=ym(t.alternate,t,wr);t.memoizedProps=t.pendingProps,n===null?Vo(t):Ze=n}function Zm(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=pm(a,n,n.pendingProps,n.type,void 0,et);break;case 11:n=pm(a,n,n.pendingProps,n.type.render,n.ref,et);break;case 5:Qc(n);default:Sm(a,n),n=Ze=Kf(n,wr),n=ym(a,n,wr)}t.memoizedProps=t.pendingProps,n===null?Vo(t):Ze=n}function fs(t,n,a,d){fr=fi=null,Qc(n),ns=null,Xs=0;var w=n.return;try{if(t_(t,w,n,a,et)){Tt=1,Mo(t,In(a,t.current)),Ze=null;return}}catch(k){if(w!==null)throw Ze=w,k;Tt=1,Mo(t,In(a,t.current)),Ze=null;return}n.flags&32768?(it||d===1?t=!0:cs||(et&536870912)!==0?t=!1:(Fr=t=!0,(d===2||d===9||d===3||d===6)&&(d=wn.current,d!==null&&d.tag===13&&(d.flags|=16384))),Qm(n,t)):Vo(n)}function Vo(t){var n=t;do{if((n.flags&32768)!==0){Qm(n,Fr);return}t=n.return;var a=i_(n.alternate,n,wr);if(a!==null){Ze=a;return}if(n=n.sibling,n!==null){Ze=n;return}Ze=n=t}while(n!==null);Tt===0&&(Tt=5)}function Qm(t,n){do{var a=s_(t.alternate,t);if(a!==null){a.flags&=32767,Ze=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Ze=t;return}Ze=t=a}while(t!==null);Tt=6,Ze=null}function Jm(t,n,a,d,w,k,M,G,ee){t.cancelPendingCommit=null;do Yo();while(Ft!==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|=kc,G0(t,a,k,M,G,ee),t===yt&&(Ze=yt=null,et=0),ds=n,qr=t,Cr=a,Ru=k,Mu=w,Um=d,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,x_(Te,function(){return ig(),null})):(t.callbackNode=null,t.callbackPriority=0),d=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||d){d=q.T,q.T=null,w=X.p,X.p=2,M=ut,ut|=4;try{a_(t,n,a)}finally{ut=M,X.p=w,q.T=d}}Ft=1,eg(),tg(),ng()}}function eg(){if(Ft===1){Ft=0;var t=qr,n=ds,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=q.T,q.T=null;var d=X.p;X.p=2;var w=ut;ut|=4;try{Mm(n,t);var k=Ku,M=Pf(t.containerInfo),G=k.focusedElem,ee=k.selectionRange;if(M!==G&&G&&G.ownerDocument&&Hf(G.ownerDocument.documentElement,G)){if(ee!==null&&yc(G)){var le=ee.start,fe=ee.end;if(fe===void 0&&(fe=le),"selectionStart"in G)G.selectionStart=le,G.selectionEnd=Math.min(fe,G.value.length);else{var xe=G.ownerDocument||document,ce=xe&&xe.defaultView||window;if(ce.getSelection){var ue=ce.getSelection(),Ne=G.textContent.length,Be=Math.min(ee.start,Ne),bt=ee.end===void 0?Be:Math.min(ee.end,Ne);!ue.extend&&Be>bt&&(M=bt,bt=Be,Be=M);var re=zf(G,Be),ne=zf(G,bt);if(re&&ne&&(ue.rangeCount!==1||ue.anchorNode!==re.node||ue.anchorOffset!==re.offset||ue.focusNode!==ne.node||ue.focusOffset!==ne.offset)){var oe=xe.createRange();oe.setStart(re.node,re.offset),ue.removeAllRanges(),Be>bt?(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}}al=!!Yu,Ku=Yu=null}finally{ut=w,X.p=d,q.T=a}}t.current=n,Ft=2}}function tg(){if(Ft===2){Ft=0;var t=qr,n=ds,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=q.T,q.T=null;var d=X.p;X.p=2;var w=ut;ut|=4;try{Tm(t,n.alternate,n)}finally{ut=w,X.p=d,q.T=a}}Ft=3}}function ng(){if(Ft===4||Ft===3){Ft=0,Ke();var t=qr,n=ds,a=Cr,d=Um;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Ft=5:(Ft=0,ds=qr=null,rg(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&($r=null),tc(a),n=n.stateNode,Fe&&typeof Fe.onCommitFiberRoot=="function")try{Fe.onCommitFiberRoot(Pe,n,void 0,(n.current.flags&128)===128)}catch{}if(d!==null){n=q.T,w=X.p,X.p=2,q.T=null;try{for(var k=t.onRecoverableError,M=0;M<d.length;M++){var G=d[M];k(G.value,{componentStack:G.stack})}}finally{q.T=n,X.p=w}}(Cr&3)!==0&&Yo(),er(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===Ou?fa++:(fa=0,Ou=t):fa=0,pa(0)}}function rg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Ys(n)))}function Yo(){return eg(),tg(),ng(),ig()}function ig(){if(Ft!==5)return!1;var t=qr,n=Ru;Ru=0;var a=tc(Cr),d=q.T,w=X.p;try{X.p=32>a?32:a,q.T=null,a=Mu,Mu=null;var k=qr,M=Cr;if(Ft=0,ds=qr=null,Cr=0,(ut&6)!==0)throw Error(s(331));var G=ut;if(ut|=4,Hm(k.current),Im(k,k.current,M,a),ut=G,pa(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(Pe,k)}catch{}return!0}finally{X.p=w,q.T=d,rg(t,n)}}function sg(t,n,a){n=In(a,n),n=fu(t.stateNode,n,2),t=Br(t,n,2),t!==null&&(Ms(t,2),er(t))}function mt(t,n,a){if(t.tag===3)sg(t,t,a);else for(;n!==null;){if(n.tag===3){sg(n,t,a);break}else if(n.tag===1){var d=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&($r===null||!$r.has(d))){t=In(a,t),a=am(2),d=Br(n,a,2),d!==null&&(om(a,d,n,t),Ms(d,2),er(d));break}}n=n.return}}function zu(t,n,a){var d=t.pingCache;if(d===null){d=t.pingCache=new c_;var w=new Set;d.set(n,w)}else w=d.get(n),w===void 0&&(w=new Set,d.set(n,w));w.has(a)||(Au=!0,w.add(a),t=p_.bind(null,t,n,a),n.then(t,t))}function p_(t,n,a){var d=t.pingCache;d!==null&&d.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,yt===t&&(et&a)===a&&(Tt===4||Tt===3&&(et&62914560)===et&&300>Ye()-Uo?(ut&2)===0&&hs(t,0):Du|=a,us===et&&(us=0)),er(t)}function ag(t,n){n===0&&(n=Jl()),t=ui(t,n),t!==null&&(Ms(t,n),er(t))}function m_(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),ag(t,a)}function g_(t,n){var a=0;switch(t.tag){case 31:case 13:var d=t.stateNode,w=t.memoizedState;w!==null&&(a=w.retryLane);break;case 19:d=t.stateNode;break;case 22:d=t.stateNode._retryCache;break;default:throw Error(s(314))}d!==null&&d.delete(n),ag(t,a)}function x_(t,n){return pe(t,n)}var Ko=null,ps=null,Hu=!1,Xo=!1,Pu=!1,Gr=0;function er(t){t!==ps&&t.next===null&&(ps===null?Ko=ps=t:ps=ps.next=t),Xo=!0,Hu||(Hu=!0,b_())}function pa(t,n){if(!Pu&&Xo){Pu=!0;do for(var a=!1,d=Ko;d!==null;){if(t!==0){var w=d.pendingLanes;if(w===0)var k=0;else{var M=d.suspendedLanes,G=d.pingedLanes;k=(1<<31-qe(42|t)+1)-1,k&=w&~(M&~G),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(a=!0,ug(d,k))}else k=et,k=Rt(d,d===yt?k:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(k&3)===0||Et(d,k)||(a=!0,ug(d,k));d=d.next}while(a);Pu=!1}}function v_(){og()}function og(){Xo=Hu=!1;var t=0;Gr!==0&&T_()&&(t=Gr);for(var n=Ye(),a=null,d=Ko;d!==null;){var w=d.next,k=lg(d,n);k===0?(d.next=null,a===null?Ko=w:a.next=w,w===null&&(ps=a)):(a=d,(t!==0||(k&3)!==0)&&(Xo=!0)),d=w}Ft!==0&&Ft!==5||pa(t),Gr!==0&&(Gr=0)}function lg(t,n){for(var a=t.suspendedLanes,d=t.pingedLanes,w=t.expirationTimes,k=t.pendingLanes&-62914561;0<k;){var M=31-qe(k),G=1<<M,ee=w[M];ee===-1?((G&a)===0||(G&d)!==0)&&(w[M]=Kt(G,n)):ee<=n&&(t.expiredLanes|=G),k&=~G}if(n=yt,a=et,a=Rt(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),d=t.callbackNode,a===0||t===n&&(pt===2||pt===9)||t.cancelPendingCommit!==null)return d!==null&&d!==null&&Me(d),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Et(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(d!==null&&Me(d),tc(a)){case 2:case 8:a=be;break;case 32:a=Te;break;case 268435456:a=ae;break;default:a=Te}return d=cg.bind(null,t),a=pe(a,d),t.callbackPriority=n,t.callbackNode=a,n}return d!==null&&d!==null&&Me(d),t.callbackPriority=2,t.callbackNode=null,2}function cg(t,n){if(Ft!==0&&Ft!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(Yo()&&t.callbackNode!==a)return null;var d=et;return d=Rt(t,t===yt?d:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),d===0?null:(qm(t,d,n),lg(t,Ye()),t.callbackNode!=null&&t.callbackNode===a?cg.bind(null,t):null)}function ug(t,n){if(Yo())return null;qm(t,n,!0)}function b_(){D_(function(){(ut&6)!==0?pe(de,v_):og()})}function Fu(){if(Gr===0){var t=Ji;t===0&&(t=ze,ze<<=1,(ze&261888)===0&&(ze=256)),Gr=t}return Gr}function dg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:ro(""+t)}function hg(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 y_(t,n,a,d,w){if(n==="submit"&&a&&a.stateNode===w){var k=dg((w[hn]||null).action),M=d.submitter;M&&(n=(n=M[hn]||null)?dg(n.formAction):M.getAttribute("formAction"),n!==null&&(k=n,M=null));var G=new oo("action","action",null,d,w);t.push({event:G,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Gr!==0){var ee=M?hg(w,M):new FormData(w);ou(a,{pending:!0,data:ee,method:w.method,action:k},null,ee)}}else typeof k=="function"&&(G.preventDefault(),ee=M?hg(w,M):new FormData(w),ou(a,{pending:!0,data:ee,method:w.method,action:k},k,ee))},currentTarget:w}]})}}for(var Uu=0;Uu<Cc.length;Uu++){var $u=Cc[Uu],__=$u.toLowerCase(),S_=$u[0].toUpperCase()+$u.slice(1);Wn(__,"on"+S_)}Wn($f,"onAnimationEnd"),Wn(qf,"onAnimationIteration"),Wn(Wf,"onAnimationStart"),Wn("dblclick","onDoubleClick"),Wn("focusin","onFocus"),Wn("focusout","onBlur"),Wn(zy,"onTransitionRun"),Wn(Hy,"onTransitionStart"),Wn(Py,"onTransitionCancel"),Wn(Gf,"onTransitionEnd"),Hi("onMouseEnter",["mouseout","mouseover"]),Hi("onMouseLeave",["mouseout","mouseover"]),Hi("onPointerEnter",["pointerout","pointerover"]),Hi("onPointerLeave",["pointerout","pointerover"]),ai("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ai("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ai("onBeforeInput",["compositionend","keypress","textInput","paste"]),ai("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ai("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ai("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ma="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(" "),w_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ma));function fg(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var d=t[a],w=d.event;d=d.listeners;e:{var k=void 0;if(n)for(var M=d.length-1;0<=M;M--){var G=d[M],ee=G.instance,le=G.currentTarget;if(G=G.listener,ee!==k&&w.isPropagationStopped())break e;k=G,w.currentTarget=le;try{k(w)}catch(fe){uo(fe)}w.currentTarget=null,k=ee}else for(M=0;M<d.length;M++){if(G=d[M],ee=G.instance,le=G.currentTarget,G=G.listener,ee!==k&&w.isPropagationStopped())break e;k=G,w.currentTarget=le;try{k(w)}catch(fe){uo(fe)}w.currentTarget=null,k=ee}}}}function Qe(t,n){var a=n[nc];a===void 0&&(a=n[nc]=new Set);var d=t+"__bubble";a.has(d)||(pg(n,t,2,!1),a.add(d))}function qu(t,n,a){var d=0;n&&(d|=4),pg(a,t,d,n)}var Zo="_reactListening"+Math.random().toString(36).slice(2);function Wu(t){if(!t[Zo]){t[Zo]=!0,of.forEach(function(a){a!=="selectionchange"&&(w_.has(a)||qu(a,!1,t),qu(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[Zo]||(n[Zo]=!0,qu("selectionchange",!1,n))}}function pg(t,n,a,d){switch($g(n)){case 2:var w=Z_;break;case 8:w=Q_;break;default:w=ad}a=w.bind(null,n,a,t),w=void 0,!dc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(w=!0),d?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 Gu(t,n,a,d,w){var k=d;if((n&1)===0&&(n&2)===0&&d!==null)e:for(;;){if(d===null)return;var M=d.tag;if(M===3||M===4){var G=d.stateNode.containerInfo;if(G===w)break;if(M===4)for(M=d.return;M!==null;){var ee=M.tag;if((ee===3||ee===4)&&M.stateNode.containerInfo===w)return;M=M.return}for(;G!==null;){if(M=Ii(G),M===null)return;if(ee=M.tag,ee===5||ee===6||ee===26||ee===27){d=k=M;continue e}G=G.parentNode}}d=d.return}bf(function(){var le=k,fe=cc(a),xe=[];e:{var ce=Vf.get(t);if(ce!==void 0){var ue=oo,Ne=t;switch(t){case"keypress":if(so(a)===0)break e;case"keydown":case"keyup":ue=gy;break;case"focusin":Ne="focus",ue=mc;break;case"focusout":Ne="blur",ue=mc;break;case"beforeblur":case"afterblur":ue=mc;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=Sf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=iy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=by;break;case $f:case qf:case Wf:ue=oy;break;case Gf:ue=_y;break;case"scroll":case"scrollend":ue=ny;break;case"wheel":ue=wy;break;case"copy":case"cut":case"paste":ue=cy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=Cf;break;case"toggle":case"beforetoggle":ue=ky}var Be=(n&4)!==0,bt=!Be&&(t==="scroll"||t==="scrollend"),re=Be?ce!==null?ce+"Capture":null:ce;Be=[];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||re===null||(me=Bs(ne,re),me!=null&&Be.push(ga(ne,me,oe))),bt)break;ne=ne.return}0<Be.length&&(ce=new ue(ce,Ne,null,a,fe),xe.push({event:ce,listeners:Be}))}}if((n&7)===0){e:{if(ce=t==="mouseover"||t==="pointerover",ue=t==="mouseout"||t==="pointerout",ce&&a!==lc&&(Ne=a.relatedTarget||a.fromElement)&&(Ii(Ne)||Ne[Oi]))break e;if((ue||ce)&&(ce=fe.window===fe?fe:(ce=fe.ownerDocument)?ce.defaultView||ce.parentWindow:window,ue?(Ne=a.relatedTarget||a.toElement,ue=le,Ne=Ne?Ii(Ne):null,Ne!==null&&(bt=u(Ne),Be=Ne.tag,Ne!==bt||Be!==5&&Be!==27&&Be!==6)&&(Ne=null)):(ue=null,Ne=le),ue!==Ne)){if(Be=Sf,me="onMouseLeave",re="onMouseEnter",ne="mouse",(t==="pointerout"||t==="pointerover")&&(Be=Cf,me="onPointerLeave",re="onPointerEnter",ne="pointer"),bt=ue==null?ce:Is(ue),oe=Ne==null?ce:Is(Ne),ce=new Be(me,ne+"leave",ue,a,fe),ce.target=bt,ce.relatedTarget=oe,me=null,Ii(fe)===le&&(Be=new Be(re,ne+"enter",Ne,a,fe),Be.target=oe,Be.relatedTarget=bt,me=Be),bt=me,ue&&Ne)t:{for(Be=C_,re=ue,ne=Ne,oe=0,me=re;me;me=Be(me))oe++;me=0;for(var Le=ne;Le;Le=Be(Le))me++;for(;0<oe-me;)re=Be(re),oe--;for(;0<me-oe;)ne=Be(ne),me--;for(;oe--;){if(re===ne||ne!==null&&re===ne.alternate){Be=re;break t}re=Be(re),ne=Be(ne)}Be=null}else Be=null;ue!==null&&mg(xe,ce,ue,Be,!1),Ne!==null&&bt!==null&&mg(xe,bt,Ne,Be,!0)}}e:{if(ce=le?Is(le):window,ue=ce.nodeName&&ce.nodeName.toLowerCase(),ue==="select"||ue==="input"&&ce.type==="file")var at=Lf;else if(Af(ce))if(Rf)at=Oy;else{at=Ry;var Ae=Ly}else ue=ce.nodeName,!ue||ue.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&oc(le.elementType)&&(at=Lf):at=My;if(at&&(at=at(t,le))){Df(xe,at,a,fe);break e}Ae&&Ae(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&ac(ce,"number",ce.value)}switch(Ae=le?Is(le):window,t){case"focusin":(Af(Ae)||Ae.contentEditable==="true")&&(Wi=Ae,_c=le,Ws=null);break;case"focusout":Ws=_c=Wi=null;break;case"mousedown":Sc=!0;break;case"contextmenu":case"mouseup":case"dragend":Sc=!1,Ff(xe,a,fe);break;case"selectionchange":if(By)break;case"keydown":case"keyup":Ff(xe,a,fe)}var Ge;if(xc)e:{switch(t){case"compositionstart":var tt="onCompositionStart";break e;case"compositionend":tt="onCompositionEnd";break e;case"compositionupdate":tt="onCompositionUpdate";break e}tt=void 0}else qi?Nf(t,a)&&(tt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(tt="onCompositionStart");tt&&(kf&&a.locale!=="ko"&&(qi||tt!=="onCompositionStart"?tt==="onCompositionEnd"&&qi&&(Ge=yf()):(Ar=fe,hc="value"in Ar?Ar.value:Ar.textContent,qi=!0)),Ae=Qo(le,tt),0<Ae.length&&(tt=new wf(tt,t,null,a,fe),xe.push({event:tt,listeners:Ae}),Ge?tt.data=Ge:(Ge=Tf(a),Ge!==null&&(tt.data=Ge)))),(Ge=jy?Ny(t,a):Ty(t,a))&&(tt=Qo(le,"onBeforeInput"),0<tt.length&&(Ae=new wf("onBeforeInput","beforeinput",null,a,fe),xe.push({event:Ae,listeners:tt}),Ae.data=Ge)),y_(xe,t,le,a,fe)}fg(xe,n)})}function ga(t,n,a){return{instance:t,listener:n,currentTarget:a}}function Qo(t,n){for(var a=n+"Capture",d=[];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&&d.unshift(ga(t,w,k)),w=Bs(t,n),w!=null&&d.push(ga(t,w,k))),t.tag===3)return d;t=t.return}return[]}function C_(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function mg(t,n,a,d,w){for(var k=n._reactName,M=[];a!==null&&a!==d;){var G=a,ee=G.alternate,le=G.stateNode;if(G=G.tag,ee!==null&&ee===d)break;G!==5&&G!==26&&G!==27||le===null||(ee=le,w?(le=Bs(a,k),le!=null&&M.unshift(ga(a,le,ee))):w||(le=Bs(a,k),le!=null&&M.push(ga(a,le,ee)))),a=a.return}M.length!==0&&t.push({event:n,listeners:M})}var k_=/\r\n?/g,E_=/\u0000|\uFFFD/g;function gg(t){return(typeof t=="string"?t:""+t).replace(k_,`
|
|
49
|
-
`).replace(E_,"")}function xg(t,n){return n=gg(n),gg(t)===n}function vt(t,n,a,d,w,k){switch(a){case"children":typeof d=="string"?n==="body"||n==="textarea"&&d===""||Fi(t,d):(typeof d=="number"||typeof d=="bigint")&&n!=="body"&&Fi(t,""+d);break;case"className":to(t,"class",d);break;case"tabIndex":to(t,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":to(t,a,d);break;case"style":xf(t,d,k);break;case"data":if(n!=="object"){to(t,"data",d);break}case"src":case"href":if(d===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){t.removeAttribute(a);break}d=ro(""+d),t.setAttribute(a,d);break;case"action":case"formAction":if(typeof d=="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"&&vt(t,n,"name",w.name,w,null),vt(t,n,"formEncType",w.formEncType,w,null),vt(t,n,"formMethod",w.formMethod,w,null),vt(t,n,"formTarget",w.formTarget,w,null)):(vt(t,n,"encType",w.encType,w,null),vt(t,n,"method",w.method,w,null),vt(t,n,"target",w.target,w,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){t.removeAttribute(a);break}d=ro(""+d),t.setAttribute(a,d);break;case"onClick":d!=null&&(t.onclick=cr);break;case"onScroll":d!=null&&Qe("scroll",t);break;case"onScrollEnd":d!=null&&Qe("scrollend",t);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(s(61));if(a=d.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"multiple":t.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":t.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){t.removeAttribute("xlink:href");break}a=ro(""+d),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":d!=null&&typeof d!="function"&&typeof d!="symbol"?t.setAttribute(a,""+d):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":d&&typeof d!="function"&&typeof d!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":d===!0?t.setAttribute(a,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?t.setAttribute(a,d):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?t.setAttribute(a,d):t.removeAttribute(a);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?t.removeAttribute(a):t.setAttribute(a,d);break;case"popover":Qe("beforetoggle",t),Qe("toggle",t),eo(t,"popover",d);break;case"xlinkActuate":lr(t,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":lr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":lr(t,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":lr(t,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":lr(t,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":lr(t,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":lr(t,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":lr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":lr(t,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":eo(t,"is",d);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=ey.get(a)||a,eo(t,a,d))}}function Vu(t,n,a,d,w,k){switch(a){case"style":xf(t,d,k);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(s(61));if(a=d.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"children":typeof d=="string"?Fi(t,d):(typeof d=="number"||typeof d=="bigint")&&Fi(t,""+d);break;case"onScroll":d!=null&&Qe("scroll",t);break;case"onScrollEnd":d!=null&&Qe("scrollend",t);break;case"onClick":d!=null&&(t.onclick=cr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!lf.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[hn]||null,k=k!=null?k[a]:null,typeof k=="function"&&t.removeEventListener(n,k,w),typeof d=="function")){typeof k!="function"&&k!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,d,w);break e}a in t?t[a]=d:d===!0?t.setAttribute(a,""):eo(t,a,d)}}}function en(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",t),Qe("load",t);var d=!1,w=!1,k;for(k in a)if(a.hasOwnProperty(k)){var M=a[k];if(M!=null)switch(k){case"src":d=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:vt(t,n,k,M,a,null)}}w&&vt(t,n,"srcSet",a.srcSet,a,null),d&&vt(t,n,"src",a.src,a,null);return;case"input":Qe("invalid",t);var G=k=M=w=null,ee=null,le=null;for(d in a)if(a.hasOwnProperty(d)){var fe=a[d];if(fe!=null)switch(d){case"name":w=fe;break;case"type":M=fe;break;case"checked":ee=fe;break;case"defaultChecked":le=fe;break;case"value":k=fe;break;case"defaultValue":G=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(s(137,n));break;default:vt(t,n,d,fe,a,null)}}ff(t,k,G,ee,le,M,w,!1);return;case"select":Qe("invalid",t),d=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":d=G;default:vt(t,n,w,G,a,null)}n=k,a=M,t.multiple=!!d,n!=null?Pi(t,!!d,n,!1):a!=null&&Pi(t,!!d,a,!0);return;case"textarea":Qe("invalid",t),k=w=d=null;for(M in a)if(a.hasOwnProperty(M)&&(G=a[M],G!=null))switch(M){case"value":d=G;break;case"defaultValue":w=G;break;case"children":k=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(91));break;default:vt(t,n,M,G,a,null)}mf(t,d,w,k);return;case"option":for(ee in a)if(a.hasOwnProperty(ee)&&(d=a[ee],d!=null))switch(ee){case"selected":t.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:vt(t,n,ee,d,a,null)}return;case"dialog":Qe("beforetoggle",t),Qe("toggle",t),Qe("cancel",t),Qe("close",t);break;case"iframe":case"object":Qe("load",t);break;case"video":case"audio":for(d=0;d<ma.length;d++)Qe(ma[d],t);break;case"image":Qe("error",t),Qe("load",t);break;case"details":Qe("toggle",t);break;case"embed":case"source":case"link":Qe("error",t),Qe("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)&&(d=a[le],d!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:vt(t,n,le,d,a,null)}return;default:if(oc(n)){for(fe in a)a.hasOwnProperty(fe)&&(d=a[fe],d!==void 0&&Vu(t,n,fe,d,a,void 0));return}}for(G in a)a.hasOwnProperty(G)&&(d=a[G],d!=null&&vt(t,n,G,d,a,null))}function j_(t,n,a,d){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,ee=null,le=null,fe=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":ee=xe;default:d.hasOwnProperty(ue)||vt(t,n,ue,null,d,xe)}}for(var ce in d){var ue=d[ce];if(xe=a[ce],d.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":fe=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&&vt(t,n,ce,ue,d,xe)}}sc(t,M,G,ee,le,fe,k,w);return;case"select":ue=M=G=ce=null;for(k in a)if(ee=a[k],a.hasOwnProperty(k)&&ee!=null)switch(k){case"value":break;case"multiple":ue=ee;default:d.hasOwnProperty(k)||vt(t,n,k,null,d,ee)}for(w in d)if(k=d[w],ee=a[w],d.hasOwnProperty(w)&&(k!=null||ee!=null))switch(w){case"value":ce=k;break;case"defaultValue":G=k;break;case"multiple":M=k;default:k!==ee&&vt(t,n,w,k,d,ee)}n=G,a=M,d=ue,ce!=null?Pi(t,!!a,ce,!1):!!d!=!!a&&(n!=null?Pi(t,!!a,n,!0):Pi(t,!!a,a?[]:"",!1));return;case"textarea":ue=ce=null;for(G in a)if(w=a[G],a.hasOwnProperty(G)&&w!=null&&!d.hasOwnProperty(G))switch(G){case"value":break;case"children":break;default:vt(t,n,G,null,d,w)}for(M in d)if(w=d[M],k=a[M],d.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&&vt(t,n,M,w,d,k)}pf(t,ce,ue);return;case"option":for(var Ne in a)if(ce=a[Ne],a.hasOwnProperty(Ne)&&ce!=null&&!d.hasOwnProperty(Ne))switch(Ne){case"selected":t.selected=!1;break;default:vt(t,n,Ne,null,d,ce)}for(ee in d)if(ce=d[ee],ue=a[ee],d.hasOwnProperty(ee)&&ce!==ue&&(ce!=null||ue!=null))switch(ee){case"selected":t.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:vt(t,n,ee,ce,d,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 Be in a)ce=a[Be],a.hasOwnProperty(Be)&&ce!=null&&!d.hasOwnProperty(Be)&&vt(t,n,Be,null,d,ce);for(le in d)if(ce=d[le],ue=a[le],d.hasOwnProperty(le)&&ce!==ue&&(ce!=null||ue!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,n));break;default:vt(t,n,le,ce,d,ue)}return;default:if(oc(n)){for(var bt in a)ce=a[bt],a.hasOwnProperty(bt)&&ce!==void 0&&!d.hasOwnProperty(bt)&&Vu(t,n,bt,void 0,d,ce);for(fe in d)ce=d[fe],ue=a[fe],!d.hasOwnProperty(fe)||ce===ue||ce===void 0&&ue===void 0||Vu(t,n,fe,ce,d,ue);return}}for(var re in a)ce=a[re],a.hasOwnProperty(re)&&ce!=null&&!d.hasOwnProperty(re)&&vt(t,n,re,null,d,ce);for(xe in d)ce=d[xe],ue=a[xe],!d.hasOwnProperty(xe)||ce===ue||ce==null&&ue==null||vt(t,n,xe,ce,d,ue)}function vg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function N_(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),d=0;d<a.length;d++){var w=a[d],k=w.transferSize,M=w.initiatorType,G=w.duration;if(k&&G&&vg(M)){for(M=0,G=w.responseEnd,d+=1;d<a.length;d++){var ee=a[d],le=ee.startTime;if(le>G)break;var fe=ee.transferSize,xe=ee.initiatorType;fe&&vg(xe)&&(ee=ee.responseEnd,M+=fe*(ee<G?1:(G-le)/(ee-le)))}if(--d,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 Yu=null,Ku=null;function Jo(t){return t.nodeType===9?t:t.ownerDocument}function bg(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 yg(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 Xu(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 Zu=null;function T_(){var t=window.event;return t&&t.type==="popstate"?t===Zu?!1:(Zu=t,!0):(Zu=null,!1)}var _g=typeof setTimeout=="function"?setTimeout:void 0,A_=typeof clearTimeout=="function"?clearTimeout:void 0,Sg=typeof Promise=="function"?Promise:void 0,D_=typeof queueMicrotask=="function"?queueMicrotask:typeof Sg<"u"?function(t){return Sg.resolve(null).then(t).catch(L_)}:_g;function L_(t){setTimeout(function(){throw t})}function Vr(t){return t==="head"}function wg(t,n){var a=n,d=0;do{var w=a.nextSibling;if(t.removeChild(a),w&&w.nodeType===8)if(a=w.data,a==="/$"||a==="/&"){if(d===0){t.removeChild(w),vs(n);return}d--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")d++;else if(a==="html")xa(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,xa(a);for(var k=a.firstChild;k;){var M=k.nextSibling,G=k.nodeName;k[Os]||G==="SCRIPT"||G==="STYLE"||G==="LINK"&&k.rel.toLowerCase()==="stylesheet"||a.removeChild(k),k=M}}else a==="body"&&xa(t.ownerDocument.body);a=w}while(a);vs(n)}function Cg(t,n){var a=t;t=0;do{var d=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||""),d&&d.nodeType===8)if(a=d.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=d}while(a)}function Qu(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":Qu(a),rc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function R_(t,n,a,d){for(;t.nodeType===1;){var w=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!d&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(d){if(!t[Os])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 M_(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 kg(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 Ju(t){return t.data==="$?"||t.data==="$~"}function ed(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function O_(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var d=function(){n(),a.removeEventListener("DOMContentLoaded",d)};a.addEventListener("DOMContentLoaded",d),t._reactRetry=d}}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 td=null;function Eg(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 jg(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 Ng(t,n,a){switch(n=Jo(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 xa(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);rc(t)}var Un=new Map,Tg=new Set;function el(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var kr=X.d;X.d={f:I_,r:B_,D:z_,C:H_,L:P_,m:F_,X:$_,S:U_,M:q_};function I_(){var t=kr.f(),n=Wo();return t||n}function B_(t){var n=Bi(t);n!==null&&n.tag===5&&n.type==="form"?Gp(n):kr.r(t)}var ms=typeof document>"u"?null:document;function Ag(t,n,a){var d=ms;if(d&&typeof n=="string"&&n){var w=Mn(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),Tg.has(w)||(Tg.add(w),t={rel:t,crossOrigin:a,href:n},d.querySelector(w)===null&&(n=d.createElement("link"),en(n,"link",t),Wt(n),d.head.appendChild(n)))}}function z_(t){kr.D(t),Ag("dns-prefetch",t,null)}function H_(t,n){kr.C(t,n),Ag("preconnect",t,n)}function P_(t,n,a){kr.L(t,n,a);var d=ms;if(d&&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=gs(t);break;case"script":k=xs(t)}Un.has(k)||(t=m({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),Un.set(k,t),d.querySelector(w)!==null||n==="style"&&d.querySelector(va(k))||n==="script"&&d.querySelector(ba(k))||(n=d.createElement("link"),en(n,"link",t),Wt(n),d.head.appendChild(n)))}}function F_(t,n){kr.m(t,n);var a=ms;if(a&&t){var d=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+Mn(d)+'"][href="'+Mn(t)+'"]',k=w;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=xs(t)}if(!Un.has(k)&&(t=m({rel:"modulepreload",href:t},n),Un.set(k,t),a.querySelector(w)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ba(k)))return}d=a.createElement("link"),en(d,"link",t),Wt(d),a.head.appendChild(d)}}}function U_(t,n,a){kr.S(t,n,a);var d=ms;if(d&&t){var w=zi(d).hoistableStyles,k=gs(t);n=n||"default";var M=w.get(k);if(!M){var G={loading:0,preload:null};if(M=d.querySelector(va(k)))G.loading=5;else{t=m({rel:"stylesheet",href:t,"data-precedence":n},a),(a=Un.get(k))&&nd(t,a);var ee=M=d.createElement("link");Wt(ee),en(ee,"link",t),ee._p=new Promise(function(le,fe){ee.onload=le,ee.onerror=fe}),ee.addEventListener("load",function(){G.loading|=1}),ee.addEventListener("error",function(){G.loading|=2}),G.loading|=4,tl(M,n,d)}M={type:"stylesheet",instance:M,count:1,state:G},w.set(k,M)}}}function $_(t,n){kr.X(t,n);var a=ms;if(a&&t){var d=zi(a).hoistableScripts,w=xs(t),k=d.get(w);k||(k=a.querySelector(ba(w)),k||(t=m({src:t,async:!0},n),(n=Un.get(w))&&rd(t,n),k=a.createElement("script"),Wt(k),en(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},d.set(w,k))}}function q_(t,n){kr.M(t,n);var a=ms;if(a&&t){var d=zi(a).hoistableScripts,w=xs(t),k=d.get(w);k||(k=a.querySelector(ba(w)),k||(t=m({src:t,async:!0,type:"module"},n),(n=Un.get(w))&&rd(t,n),k=a.createElement("script"),Wt(k),en(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},d.set(w,k))}}function Dg(t,n,a,d){var w=(w=Q.current)?el(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=gs(a.href),a=zi(w).hoistableStyles,d=a.get(n),d||(d={type:"style",instance:null,count:0,state:null},a.set(n,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=gs(a.href);var k=zi(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(va(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||W_(w,t,a,M.state))),n&&d===null)throw Error(s(528,""));return M}if(n&&d!==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=xs(a),a=zi(w).hoistableScripts,d=a.get(n),d||(d={type:"script",instance:null,count:0,state:null},a.set(n,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function gs(t){return'href="'+Mn(t)+'"'}function va(t){return'link[rel="stylesheet"]['+t+"]"}function Lg(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function W_(t,n,a,d){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?d.loading=1:(n=t.createElement("link"),d.preload=n,n.addEventListener("load",function(){return d.loading|=1}),n.addEventListener("error",function(){return d.loading|=2}),en(n,"link",a),Wt(n),t.head.appendChild(n))}function xs(t){return'[src="'+Mn(t)+'"]'}function ba(t){return"script[async]"+t}function Rg(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var d=t.querySelector('style[data-href~="'+Mn(a.href)+'"]');if(d)return n.instance=d,Wt(d),d;var w=m({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return d=(t.ownerDocument||t).createElement("style"),Wt(d),en(d,"style",w),tl(d,a.precedence,t),n.instance=d;case"stylesheet":w=gs(a.href);var k=t.querySelector(va(w));if(k)return n.state.loading|=4,n.instance=k,Wt(k),k;d=Lg(a),(w=Un.get(w))&&nd(d,w),k=(t.ownerDocument||t).createElement("link"),Wt(k);var M=k;return M._p=new Promise(function(G,ee){M.onload=G,M.onerror=ee}),en(k,"link",d),n.state.loading|=4,tl(k,a.precedence,t),n.instance=k;case"script":return k=xs(a.src),(w=t.querySelector(ba(k)))?(n.instance=w,Wt(w),w):(d=a,(w=Un.get(k))&&(d=m({},a),rd(d,w)),t=t.ownerDocument||t,w=t.createElement("script"),Wt(w),en(w,"link",d),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&&(d=n.instance,n.state.loading|=4,tl(d,a.precedence,t));return n.instance}function tl(t,n,a){for(var d=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=d.length?d[d.length-1]:null,k=w,M=0;M<d.length;M++){var G=d[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 nd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function rd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var nl=null;function Mg(t,n,a){if(nl===null){var d=new Map,w=nl=new Map;w.set(a,d)}else w=nl,d=w.get(a),d||(d=new Map,w.set(a,d));if(d.has(t))return d;for(d.set(t,null),a=a.getElementsByTagName(t),w=0;w<a.length;w++){var k=a[w];if(!(k[Os]||k[Xt]||t==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var M=k.getAttribute(n)||"";M=t+M;var G=d.get(M);G?G.push(k):d.set(M,[k])}}return d}function Og(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function G_(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 Ig(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function V_(t,n,a,d){if(a.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var w=gs(d.href),k=n.querySelector(va(w));if(k){n=k._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=rl.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=k,Wt(k);return}k=n.ownerDocument||n,d=Lg(d),(w=Un.get(w))&&nd(d,w),k=k.createElement("link"),Wt(k);var M=k;M._p=new Promise(function(G,ee){M.onload=G,M.onerror=ee}),en(k,"link",d),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=rl.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var id=0;function Y_(t,n){return t.stylesheets&&t.count===0&&sl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var d=setTimeout(function(){if(t.stylesheets&&sl(t,t.stylesheets),t.unsuspend){var k=t.unsuspend;t.unsuspend=null,k()}},6e4+n);0<t.imgBytes&&id===0&&(id=62500*N_());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&sl(t,t.stylesheets),t.unsuspend)){var k=t.unsuspend;t.unsuspend=null,k()}},(t.imgBytes>id?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(d),clearTimeout(w)}}:null}function rl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)sl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var il=null;function sl(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,il=new Map,n.forEach(K_,t),il=null,rl.call(t))}function K_(t,n){if(!(n.state.loading&4)){var a=il.get(t);if(a)var d=a.get(null);else{a=new Map,il.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),d=M)}d&&a.set(null,d)}w=n.instance,M=w.getAttribute("data-precedence"),k=a.get(M)||d,k===d&&a.set(null,w),a.set(M,w),this.count++,d=rl.bind(this),w.addEventListener("load",d),w.addEventListener("error",d),k?k.parentNode.insertBefore(w,k.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(w,t.firstChild)),n.state.loading|=4}}var ya={$$typeof:_,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function X_(t,n,a,d,w,k,M,G,ee){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=Rs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rs(0),this.hiddenUpdates=Rs(null),this.identifierPrefix=d,this.onUncaughtError=w,this.onCaughtError=k,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ee,this.incompleteTransitions=new Map}function Bg(t,n,a,d,w,k,M,G,ee,le,fe,xe){return t=new X_(t,n,a,M,ee,le,fe,xe,G),n=1,k===!0&&(n|=24),k=Sn(3,null,null,n),t.current=k,k.stateNode=t,n=Bc(),n.refCount++,t.pooledCache=n,n.refCount++,k.memoizedState={element:d,isDehydrated:a,cache:n},Fc(k),t}function zg(t){return t?(t=Yi,t):Yi}function Hg(t,n,a,d,w,k){w=zg(w),d.context===null?d.context=w:d.pendingContext=w,d=Ir(n),d.payload={element:a},k=k===void 0?null:k,k!==null&&(d.callback=k),a=Br(t,d,n),a!==null&&(vn(a,t,n),Qs(a,t,n))}function Pg(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function sd(t,n){Pg(t,n),(t=t.alternate)&&Pg(t,n)}function Fg(t){if(t.tag===13||t.tag===31){var n=ui(t,67108864);n!==null&&vn(n,t,67108864),sd(t,67108864)}}function Ug(t){if(t.tag===13||t.tag===31){var n=jn();n=ec(n);var a=ui(t,n);a!==null&&vn(a,t,n),sd(t,n)}}var al=!0;function Z_(t,n,a,d){var w=q.T;q.T=null;var k=X.p;try{X.p=2,ad(t,n,a,d)}finally{X.p=k,q.T=w}}function Q_(t,n,a,d){var w=q.T;q.T=null;var k=X.p;try{X.p=8,ad(t,n,a,d)}finally{X.p=k,q.T=w}}function ad(t,n,a,d){if(al){var w=od(d);if(w===null)Gu(t,n,d,ol,a),qg(t,d);else if(e1(w,t,n,a,d))d.stopPropagation();else if(qg(t,d),n&4&&-1<J_.indexOf(t)){for(;w!==null;){var k=Bi(w);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var M=Ie(k.pendingLanes);if(M!==0){var G=k;for(G.pendingLanes|=2,G.entangledLanes|=2;M;){var ee=1<<31-qe(M);G.entanglements[1]|=ee,M&=~ee}er(k),(ut&6)===0&&($o=Ye()+500,pa(0))}}break;case 31:case 13:G=ui(k,2),G!==null&&vn(G,k,2),Wo(),sd(k,2)}if(k=od(d),k===null&&Gu(t,n,d,ol,a),k===w)break;w=k}w!==null&&d.stopPropagation()}else Gu(t,n,d,null,a)}}function od(t){return t=cc(t),ld(t)}var ol=null;function ld(t){if(ol=null,t=Ii(t),t!==null){var n=u(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 ol=t,null}function $g(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 Te:case He:return 32;case ae:return 268435456;default:return 32}default:return 32}}var cd=!1,Yr=null,Kr=null,Xr=null,_a=new Map,Sa=new Map,Zr=[],J_="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 qg(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":_a.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Sa.delete(n.pointerId)}}function wa(t,n,a,d,w,k){return t===null||t.nativeEvent!==k?(t={blockedOn:n,domEventName:a,eventSystemFlags:d,nativeEvent:k,targetContainers:[w]},n!==null&&(n=Bi(n),n!==null&&Fg(n)),t):(t.eventSystemFlags|=d,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function e1(t,n,a,d,w){switch(n){case"focusin":return Yr=wa(Yr,t,n,a,d,w),!0;case"dragenter":return Kr=wa(Kr,t,n,a,d,w),!0;case"mouseover":return Xr=wa(Xr,t,n,a,d,w),!0;case"pointerover":var k=w.pointerId;return _a.set(k,wa(_a.get(k)||null,t,n,a,d,w)),!0;case"gotpointercapture":return k=w.pointerId,Sa.set(k,wa(Sa.get(k)||null,t,n,a,d,w)),!0}return!1}function Wg(t){var n=Ii(t.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=p(a),n!==null){t.blockedOn=n,sf(t.priority,function(){Ug(a)});return}}else if(n===31){if(n=l(a),n!==null){t.blockedOn=n,sf(t.priority,function(){Ug(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 ll(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=od(t.nativeEvent);if(a===null){a=t.nativeEvent;var d=new a.constructor(a.type,a);lc=d,a.target.dispatchEvent(d),lc=null}else return n=Bi(a),n!==null&&Fg(n),t.blockedOn=a,!1;n.shift()}return!0}function Gg(t,n,a){ll(t)&&a.delete(n)}function t1(){cd=!1,Yr!==null&&ll(Yr)&&(Yr=null),Kr!==null&&ll(Kr)&&(Kr=null),Xr!==null&&ll(Xr)&&(Xr=null),_a.forEach(Gg),Sa.forEach(Gg)}function cl(t,n){t.blockedOn===n&&(t.blockedOn=null,cd||(cd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,t1)))}var ul=null;function Vg(t){ul!==t&&(ul=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ul===t&&(ul=null);for(var n=0;n<t.length;n+=3){var a=t[n],d=t[n+1],w=t[n+2];if(typeof d!="function"){if(ld(d||a)===null)continue;break}var k=Bi(a);k!==null&&(t.splice(n,3),n-=3,ou(k,{pending:!0,data:w,method:a.method,action:d},d,w))}}))}function vs(t){function n(ee){return cl(ee,t)}Yr!==null&&cl(Yr,t),Kr!==null&&cl(Kr,t),Xr!==null&&cl(Xr,t),_a.forEach(n),Sa.forEach(n);for(var a=0;a<Zr.length;a++){var d=Zr[a];d.blockedOn===t&&(d.blockedOn=null)}for(;0<Zr.length&&(a=Zr[0],a.blockedOn===null);)Wg(a),a.blockedOn===null&&Zr.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(d=0;d<a.length;d+=3){var w=a[d],k=a[d+1],M=w[hn]||null;if(typeof k=="function")M||Vg(a);else if(M){var G=null;if(k&&k.hasAttribute("formAction")){if(w=k,M=k[hn]||null)G=M.formAction;else if(ld(w)!==null)continue}else G=M.action;typeof G=="function"?a[d+1]=G:(a.splice(d,3),d-=3),Vg(a)}}}function Yg(){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),d||setTimeout(a,20)}function a(){if(!d&&!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 d=!1,w=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){d=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),w!==null&&(w(),w=null)}}}function ud(t){this._internalRoot=t}dl.prototype.render=ud.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,d=jn();Hg(a,d,t,n,null,null)},dl.prototype.unmount=ud.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Hg(t.current,2,null,t,null,null),Wo(),n[Oi]=null}};function dl(t){this._internalRoot=t}dl.prototype.unstable_scheduleHydration=function(t){if(t){var n=rf();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&&Wg(t)}};var Kg=r.version;if(Kg!=="19.2.4")throw Error(s(527,Kg,"19.2.4"));X.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=f(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var n1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var hl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!hl.isDisabled&&hl.supportsFiber)try{Pe=hl.inject(n1),Fe=hl}catch{}}return ka.createRoot=function(t,n){if(!c(t))throw Error(s(299));var a=!1,d="",w=nm,k=rm,M=im;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(d=n.identifierPrefix),n.onUncaughtError!==void 0&&(w=n.onUncaughtError),n.onCaughtError!==void 0&&(k=n.onCaughtError),n.onRecoverableError!==void 0&&(M=n.onRecoverableError)),n=Bg(t,1,!1,null,null,a,d,null,w,k,M,Yg),t[Oi]=n.current,Wu(t),new ud(n)},ka.hydrateRoot=function(t,n,a){if(!c(t))throw Error(s(299));var d=!1,w="",k=nm,M=rm,G=im,ee=null;return a!=null&&(a.unstable_strictMode===!0&&(d=!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&&(ee=a.formState)),n=Bg(t,1,!0,n,a??null,d,w,ee,k,M,G,Yg),n.context=zg(null),a=n.current,d=jn(),d=ec(d),w=Ir(d),w.callback=null,Br(a,w,d),a=d,n.current.lanes=a,Ms(n,a),er(n),t[Oi]=n.current,Wu(t),new dl(n)},ka.version="19.2.4",ka}var sx;function m1(){if(sx)return fd.exports;sx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),fd.exports=p1(),fd.exports}var g1=m1();const x1=Il(g1);function v1(e,r){if(e instanceof RegExp)return{keys:!1,pattern:e};var i,s,c,u,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),u=c.indexOf(".",1),p.push(c.substring(1,~s?s:~u?u:c.length)),l+=~s&&!~u?"(?:/([^/]+?))?":"/([^/]+?)",~u&&(l+=(~s?"?":"")+"\\"+c.substring(u))):l+="/"+c;return{keys:p,pattern:new RegExp("^"+l+(r?"(?=$|/)":"/?$"),"i")}}var xd={exports:{}},vd={};/**
|
|
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 ax;function b1(){if(ax)return vd;ax=1;var e=Bl();function r(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var i=typeof Object.is=="function"?Object.is:r,s=e.useState,c=e.useEffect,u=e.useLayoutEffect,p=e.useDebugValue;function l(m,v){var S=v(),E=s({inst:{value:S,getSnapshot:v}}),C=E[0].inst,b=E[1];return u(function(){C.value=S,C.getSnapshot=v,h(C)&&b({inst:C})},[m,S,v]),c(function(){return h(C)&&b({inst:C}),m(function(){h(C)&&b({inst:C})})},[m]),p(S),S}function h(m){var v=m.getSnapshot;m=m.value;try{var S=v();return!i(m,S)}catch{return!0}}function f(m,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:l;return vd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,vd}var ox;function y1(){return ox||(ox=1,xd.exports=b1()),xd.exports}var _1=y1();const S1=u1.useInsertionEffect,w1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",C1=w1?P.useLayoutEffect:P.useEffect,k1=S1||C1,Kv=e=>{const r=P.useRef([e,(...i)=>r[0](...i)]).current;return k1(()=>{r[0]=e}),r[1]},E1="popstate",hh="pushState",fh="replaceState",j1="hashchange",lx=[E1,hh,fh,j1],N1=e=>{for(const r of lx)addEventListener(r,e);return()=>{for(const r of lx)removeEventListener(r,e)}},Xv=(e,r)=>_1.useSyncExternalStore(N1,e,r),cx=()=>location.search,T1=({ssrSearch:e}={})=>Xv(cx,e!=null?()=>e:cx),ux=()=>location.pathname,A1=({ssrPath:e}={})=>Xv(ux,e!=null?()=>e:ux),D1=(e,{replace:r=!1,state:i=null}={})=>history[r?fh:hh](i,"",e),L1=(e={})=>[A1(e),D1],dx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[dx]>"u"){for(const e of[hh,fh]){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,dx,{value:!0})}const R1=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",Zv=(e="")=>e==="/"?"":e,M1=(e,r)=>e[0]==="~"?e.slice(1):Zv(r)+e,O1=(e="",r)=>R1(hx(Zv(e)),hx(r)),hx=e=>{try{return decodeURI(e)}catch{return e}},Qv={hook:L1,searchHook:T1,parser:v1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,i)=>e(r,i)},Jv=P.createContext(Qv),As=()=>P.useContext(Jv),eb={},tb=P.createContext(eb),I1=()=>P.useContext(tb),zl=e=>{const[r,i]=e.hook(e);return[O1(e.base,r),Kv((s,c)=>e.aroundNav(i,M1(s,e.base),c))]},ar=()=>zl(As()),ph=(e,r,i,s)=>{const{pattern:c,keys:u}=r instanceof RegExp?{keys:!1,pattern:r}:e(r||"*",s),p=c.exec(i)||[],[l,...h]=p;return l!==void 0?[!0,(()=>{const f=u!==!1?Object.fromEntries(u.map((m,v)=>[m,h[v]])):p.groups;let g={...h};return f&&Object.assign(g,f),g})(),...s?[l]:[]]:[!1,null]},mh=e=>ph(As().parser,e,ar()[0]),B1=({children:e,...r})=>{var g,m,v;const i=As(),s=r.hook?Qv:i;let c=s;const[u,p=r.ssrSearch??""]=((g=r.ssrPath)==null?void 0:g.split("?"))??[];u&&(r.ssrSearch=p,r.ssrPath=u),r.hrefs=r.hrefs??((m=r.hook)==null?void 0:m.hrefs),r.searchHook=r.searchHook??((v=r.hook)==null?void 0:v.searchHook);let l=P.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 P.createElement(Jv.Provider,{value:c,children:e})},fx=({children:e,component:r},i)=>r?P.createElement(r,{params:i}):typeof e=="function"?e(i):e,z1=e=>{let r=P.useRef(eb);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},Ea=({path:e,nest:r,match:i,...s})=>{const c=As(),[u]=zl(c),[p,l,h]=i??ph(c.parser,e,u,r),f=z1({...I1(),...l});if(!p)return null;const g=h?P.createElement(B1,{base:h},fx(s,f)):fx(s,f);return P.createElement(tb.Provider,{value:f,children:g})},Dn=P.forwardRef((e,r)=>{const i=As(),[s,c]=zl(i),{to:u="",href:p=u,onClick:l,asChild:h,children:f,className:g,replace:m,state:v,transition:S,...E}=e,C=Kv(y=>{y.ctrlKey||y.metaKey||y.altKey||y.shiftKey||y.button!==0||(l==null||l(y),y.defaultPrevented||(y.preventDefault(),c(p,e)))}),b=i.hrefs(p[0]==="~"?p.slice(1):i.base+p,i);return h&&P.isValidElement(f)?P.cloneElement(f,{onClick:C,href:b}):P.createElement("a",{...E,onClick:C,href:b,className:g!=null&&g.call?g(s===p):g,children:f,ref:r})}),nb=e=>Array.isArray(e)?e.flatMap(r=>nb(r&&r.type===P.Fragment?r.props.children:r)):[e],H1=({children:e,location:r})=>{const i=As(),[s]=zl(i);for(const c of nb(e)){let u=0;if(P.isValidElement(c)&&(u=ph(i.parser,c.props.path,r||s,c.props.nest))[0])return P.cloneElement(c,{match:u})}return null},px=e=>{let r;const i=new Set,s=(f,g)=>{const m=typeof f=="function"?f(r):f;if(!Object.is(m,r)){const v=r;r=g??(typeof m!="object"||m===null)?m:Object.assign({},r,m),i.forEach(S=>S(r,v))}},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},P1=(e=>e?px(e):px),F1=e=>e;function U1(e,r=F1){const i=cn.useSyncExternalStore(e.subscribe,cn.useCallback(()=>r(e.getState()),[e,r]),cn.useCallback(()=>r(e.getInitialState()),[e,r]));return cn.useDebugValue(i),i}const mx=e=>{const r=P1(e),i=s=>U1(r,s);return Object.assign(i,r),i},qn=(e=>e?mx(e):mx);async function ye(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 $1(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function Sl(){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 q1{constructor(r){tr(this,"ws",null);tr(this,"handlers",new Set);tr(this,"statusHandler",null);tr(this,"baseUrl");tr(this,"isReconnecting",!1);tr(this,"connectingPromise",null);tr(this,"lastCloseCode",0);tr(this,"reconnectAttempts",0);tr(this,"manualReconnectScheduled",!1);this.baseUrl=r}getUrl(){const r=localStorage.getItem("openfox_token");if(r){const i=this.baseUrl.includes("?")?"&":"?";return`${this.baseUrl}${i}token=${encodeURIComponent(r)}`}return this.baseUrl}setToken(r){localStorage.setItem("openfox_token",r)}clearToken(){localStorage.removeItem("openfox_token")}hasToken(){return!!localStorage.getItem("openfox_token")}getLastCloseCode(){return this.lastCloseCode}onStatusChange(r){this.statusHandler=r}connect(){var r,i;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN?Promise.resolve():(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.CONNECTING?this.connectingPromise:(this.connectingPromise=new Promise((s,c)=>{try{const u=this.getUrl();this.ws=new WebSocket(u);const 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);$1(h)&&this.handlers.forEach(f=>f(h))}catch(h){console.error("Failed to parse WebSocket message:",h)}}}catch(u){this.connectingPromise=null,c(u)}}),this.connectingPromise))}attemptReconnect(){var c;if(([1e3,1005,1006,4e3].includes(this.lastCloseCode)||this.lastCloseCode===0)&&this.hasToken()){console.log("[WS] Auth failure or initial failure with token - not auto-reconnecting, awaiting user action");return}if(this.isReconnecting||this.manualReconnectScheduled)return;this.isReconnecting=!0,(c=this.statusHandler)==null||c.call(this,"reconnecting");const s=Math.min(1e3*Math.pow(2,this.reconnectAttempts||0),3e4);this.reconnectAttempts=(this.reconnectAttempts||0)+1,setTimeout(()=>{this.isReconnecting=!1,this.manualReconnectScheduled=!1,this.connect().catch(()=>{})},s)}reconnect(){this.manualReconnectScheduled=!0,this.isReconnecting=!1,this.lastCloseCode=0,this.connectingPromise=null,this.connect().catch(()=>{})}disconnect(){this.isReconnecting=!1,this.reconnectAttempts=0,this.ws&&(this.ws.close(),this.ws=null)}resetReconnectAttempts(){this.reconnectAttempts=0}send(r,i){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");const s=Sl(),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 W1=`ws://${window.location.hostname}:${window.location.port||"10469"}/ws`,Ht=new q1(W1);let fl=[],bd=null,wl=null;function G1(){bd===null&&(bd=requestAnimationFrame(()=>{bd=null,wl==null||wl()}))}const ir=qn()((e,r)=>(wl=()=>{if(fl.length===0)return;const i=fl;fl=[],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 ye(`/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 ye(`/api/dev-server/config?workdir=${encodeURIComponent(i)}`)).json();e({config:c.config??null})}catch{}},fetchLogs:async()=>{const i=r().workdir;if(i)try{const u=(await(await ye(`/api/dev-server/logs?workdir=${encodeURIComponent(i)}`)).json()).logs.map(p=>({stream:p.stream,content:p.content}));e({logs:u})}catch{}},start:async()=>{const i=r().workdir;if(i)try{const c=await(await ye(`/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 ye(`/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 ye(`/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 u=await(await ye(`/api/dev-server/config?workdir=${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})).json();e({config:u.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;fl.push({stream:c.stream,content:c.content}),G1();break}case"devServer.state":{const c=i.payload;if(c.workdir!==s)return;e(u=>({status:u.status?{...u.status,state:c.state,errorMessage:c.errorMessage}:u.status}));break}}}})),V1=3e4;function Y1(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return""}}const jt=qn((e,r)=>({version:null,model:null,maxContext:2e5,llmUrl:null,llmStatus:"unknown",backend:"unknown",providers:[],activeProviderId:null,defaultModelSelection:null,loading:!1,activating:!1,error:null,autoRefreshInterval:null,fetchConfig:async()=>{e({loading:!0,error:null});try{const i=await ye("/api/config");if(!i.ok)throw new Error("Failed to fetch config");const s=await i.json();e({version:s.version,model:s.model,maxContext:s.maxContext,llmUrl:s.llmUrl,llmStatus:s.llmStatus,backend:s.backend,providers:s.providers??[],activeProviderId:s.activeProviderId??null,defaultModelSelection:s.defaultModelSelection??null,loading:!1})}catch(i){e({error:i instanceof Error?i.message:"Unknown error",loading:!1})}},refreshModel:async()=>{try{const i=await ye("/api/model/refresh",{method:"POST"});if(!i.ok)throw new Error("Failed to refresh model");const s=await i.json(),u=Ce.getState().currentSession;if(u!=null&&u.providerId&&u.providerModel){e({llmStatus:s.llmStatus,backend:s.backend});return}e({model:s.model,llmStatus:s.llmStatus,backend:s.backend})}catch(i){console.error("Failed to refresh model:",i)}},activateProvider:async i=>{const{activeProviderId:s,providers:c}=r();if(i===s)return!0;e({activating:!0,error:null});try{const u=await ye(`/api/providers/${i}/activate`,{method:"POST"});if(!u.ok){const l=await u.json();throw new Error(l.error??"Failed to activate provider")}const p=await u.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(u){return e({error:u instanceof Error?u.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(i,s)=>{const{providers:c}=r();e({activeProviderId:i,model:s,defaultModelSelection:`${i}/${s}`,providers:c.map(u=>({...u,isActive:u.id===i}))})},updateModelContext:async(i,s,c)=>{e({activating:!0,error:null});try{const u=await ye(`/api/providers/${i}/models/${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contextWindow:c})});if(!u.ok){const h=await u.json();throw new Error(h.error??"Failed to update model context")}const p=await u.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&&Ce.getState().updateContextState(p.contextState),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to update model context",activating:!1}),!1}},refreshProviderModels:async i=>{e({activating:!0,error:null});try{const s=await ye(`/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:u}=r();return e({providers:u.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()},V1);e({autoRefreshInterval:c})},stopAutoRefresh:()=>{const{autoRefreshInterval:i}=r();i&&(clearInterval(i),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:i,activeProviderId:s}=r();return i.find(c=>c.id===s)},getModelContext:i=>{const{providers:s,activeProviderId:c}=r(),u=s.find(l=>l.id===c);if(!u)return 2e5;const p=u.models.find(l=>l.id===i);return(p==null?void 0:p.contextWindow)??2e5}})),Ut=qn((e,r)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await ye("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch{e({loading:!1})}},createProject:async(i,s)=>{try{const c=await ye("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,workdir:s})});if(!c.ok)return null;const u=await c.json();return await r().listProjects(),u.project}catch{return null}},loadProject:async i=>{try{const s=await ye(`/api/projects/${i}`);if(!s.ok)return null;const c=await s.json();return e({currentProject:c.project}),r().projects.length===0&&await r().listProjects(),c.project}catch{return null}},updateProject:async(i,s)=>{var c;try{const u=await ye(`/api/projects/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!u.ok)return null;const p=await u.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 ye(`/api/projects/${i}`,{method:"DELETE"})).ok?(await r().listProjects(),((s=r().currentProject)==null?void 0:s.id)===i&&e({currentProject:null}),!0):!1}catch{return!1}},clearProject:()=>{e({currentProject:null})}}));let pl=[],yd=null,Cl=null;function K1(){yd===null&&(yd=requestAnimationFrame(()=>{yd=null,Cl==null||Cl()}))}const Ba=qn()((e,r)=>(Cl=()=>{if(pl.length===0)return;const i=pl;pl=[],e(s=>{const c={...s.logs};for(const u of i){const p=c[u.processId]??[];c[u.processId]=[...p,{offset:p.length,content:u.content,timestamp:Date.now(),stream:u.stream}]}return{logs:c}})},{processes:[],logs:{},loading:!1,setProcesses:i=>e({processes:i}),addProcess:i=>e(s=>({processes:[...s.processes,i]})),updateProcess:(i,s)=>e(c=>({processes:c.processes.map(u=>u.id===i?{...u,...s}:u)})),removeProcess:i=>e(s=>({processes:s.processes.filter(c=>c.id!==i),logs:Object.fromEntries(Object.entries(s.logs).filter(([c])=>c!==i))})),stopProcess:async(i,s)=>{try{(await ye(`/api/sessions/${s}/background-process/${i}/stop`,{method:"POST"})).ok&&r().removeProcess(i)}catch{}},appendLog:(i,s,c)=>{pl.push({processId:i,stream:s,content:c}),K1()},setLogs:(i,s)=>e(c=>({logs:{...c.logs,[i]:s}})),clearLogs:i=>e(s=>({logs:{...s.logs,[i]:[]}})),handleMessage:(i,s)=>{switch(i){case"backgroundProcess.started":{const{processId:c,name:u,pid:p,status:l}=s;e(h=>({processes:[...h.processes,{id:c,sessionId:"",name:u,command:"",cwd:"",pid:p,status:l,exitCode:null,createdAt:Date.now(),startedAt:Date.now(),endedAt:null}]}));break}case"backgroundProcess.output":{const c=s.processId,u=s.stream,p=s.content;r().appendLog(c,u,p);break}case"backgroundProcess.exited":{const c=s.processId,u=s.exitCode;e(p=>({processes:p.processes.map(l=>l.id===c?{...l,status:"exited",exitCode:u}:l)}));break}case"backgroundProcess.removed":{const c=s.processId;r().removeProcess(c);break}}}})),ei={GLOBAL_INSTRUCTIONS:"global_instructions",NOTIFICATION_SETTINGS:"notification_settings"},ti=qn(e=>({settings:{},loading:{},getSetting:async r=>{e(i=>({loading:{...i.loading,[r]:!0}}));try{const s=await(await ye(`/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 ye(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:i})})).json();e(u=>({settings:{...u.settings,[r]:c.value??""},loading:{...u.loading,[r]:!1}}))}catch{e(s=>({loading:{...s.loading,[r]:!1}}))}}})),X1=[{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"}],Z1=[{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"}],rb={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"},ni={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},ib={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},Yd={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...ni},waiting_for_user:{...ni},phase_done:{...ni},phase_blocked:{...ni},new_message:{...ib}},agentOverrides:{}};function sb(e,r,i){var u;const s=e.events[r];if(!i)return s;const c=(u=e.agentOverrides[i])==null?void 0:u[r];return c?{soundEnabled:c.soundEnabled??s.soundEnabled,browserNotification:c.browserNotification??s.browserNotification,customSoundUrl:c.customSoundUrl!==void 0?c.customSoundUrl:s.customSoundUrl}:s}const ji=qn((e,r)=>({settings:Yd,loaded:!1,load:()=>{ti.getState().getSetting(ei.NOTIFICATION_SETTINGS);const s=ti.subscribe(u=>{const p=u.settings[ei.NOTIFICATION_SETTINGS];if(p!==void 0)try{const l=JSON.parse(p);e({settings:gx(l),loaded:!0})}catch{e({loaded:!0})}}),c=ti.getState().settings[ei.NOTIFICATION_SETTINGS];if(c)try{const u=JSON.parse(c);e({settings:gx(u),loaded:!0})}catch{e({loaded:!0})}return s},update:i=>{e({settings:i}),_d(i)},updateEvent:(i,s)=>{const c=r().settings,u={...c,events:{...c.events,[i]:{...c.events[i],...s}}};e({settings:u}),_d(u)},updateAgentOverride:(i,s,c)=>{var h;const u=r().settings,p={...u.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={...u,agentOverrides:p};e({settings:l}),_d(l)}}));function _d(e){ti.getState().setSetting(ei.NOTIFICATION_SETTINGS,JSON.stringify(e))}function gx(e){var r,i,s,c,u;return{soundEnabled:e.soundEnabled??Yd.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??Yd.browserNotificationEnabled,events:{complete:{...ni,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...ni,...(i=e.events)==null?void 0:i.waiting_for_user},phase_done:{...ni,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...ni,...(c=e.events)==null?void 0:c.phase_blocked},new_message:{...ib,...(u=e.events)==null?void 0:u.new_message}},agentOverrides:e.agentOverrides??{}}}const xx=new Map;function Q1(e){let r=xx.get(e);return r||(r=new Audio(e),r.volume=.5,xx.set(e,r)),r}let ab=typeof Notification<"u"?Notification.permission:"denied";function J1(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(ab=e,e))}const eS={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},tS={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 nS(e){typeof Notification>"u"||ab==="granted"&&(document.hasFocus()||new Notification(eS[e],{body:tS[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function Ya(e,r){const{settings:i}=ji.getState(),s=sb(i,e,r);if(i.soundEnabled&&s.soundEnabled){const c=s.customSoundUrl??rb[e],u=Q1(c);u.currentTime=0,u.play().catch(()=>{})}i.browserNotificationEnabled&&s.browserNotification&&nS(e)}const rS=e=>Ya("complete",e),iS=e=>Ya("phase_done",e),sS=e=>Ya("phase_blocked",e),vx=e=>Ya("waiting_for_user",e),aS=e=>Ya("new_message",e);let ja=!1,nr=null;const Sd=new Set,zt={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Es=null,rn=null;function wd(){Es===null&&(Es=requestAnimationFrame(()=>{Es=null,rn==null||rn()}))}function wi(){Es!==null&&(cancelAnimationFrame(Es),Es=null)}function Lt(e,r){return r!==null&&e.sessionId===r}function oS(e,r,i){return e.id!==void 0||Lt(e,r)||i===!0&&e.sessionId!==void 0}function lS(e,r){return e.includes(r)?e:[...e,r]}function Na(e,r){return e.filter(i=>i!==r)}function cS(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 uS(e,r,i){return e.map(s=>{const c=(i==null?void 0:i.id)===s.id?i:null,u=r.find(p=>p.id===s.id);return{...s,title:s.title??(u==null?void 0:u.title),mode:(c==null?void 0:c.mode)??(u==null?void 0:u.mode)??s.mode,phase:(c==null?void 0:c.phase)??(u==null?void 0:u.phase)??s.phase,isRunning:(c==null?void 0:c.isRunning)??(u==null?void 0:u.isRunning)??s.isRunning,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}const bx=new Map;function Oa(e,r){var u;const i=r===((u=e.currentSession)==null?void 0:u.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 dS(e,r){if(e.type==="chat.done"){const i=e.payload,s=Oa(r,e.sessionId),c=i.agentType??s;i.reason==="complete"&&rS(c),i.reason==="waiting_for_user"&&vx(c);return}if(e.type==="chat.path_confirmation"){const i=Oa(r,e.sessionId);vx(i);return}if(e.type==="task.completed"){const i=Oa(r,e.sessionId);iS(i);return}if(e.type==="phase.changed"&&e.sessionId){const i=e.payload,s=bx.get(e.sessionId)??null;if(bx.set(e.sessionId,i.phase),s===i.phase)return;const c=Oa(r,e.sessionId);i.phase==="blocked"&&sS(c)}}const Ce=qn((e,r)=>(rn=()=>{const i=zt;if(!i.messageId)return;const s=i.deltaContent.length>0,c=i.thinkingContent.length>0,u=i.toolOutput.length>0;if(!s&&!c&&!u)return;const 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 v={...g};if(s&&(v.content=v.content+p),c&&(v.thinkingContent=(v.thinkingContent??"")+l),u){const S=new Set;v.toolCalls=(m=v.toolCalls)==null?void 0:m.map(C=>{const b=h.filter(y=>y.callId===C.id);return b.length===0?C:(S.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...b.map(y=>({stream:y.stream,content:y.content}))]})});const E=h.filter(C=>!S.has(C.callId));E.length>0&&zt.toolOutput.push(...E)}return{streamingMessage:v}}if(u){const v=new Set,S=f.messages.map(C=>{var y;if(C.id!==i.messageId)return C;const b=(y=C.toolCalls)==null?void 0:y.map(x=>{const _=h.filter(j=>j.callId===x.id);return _.length===0?x:(v.add(x.id),{...x,streamingOutput:[...x.streamingOutput??[],..._.map(j=>({stream:j.stream,content:j.content}))]})});return{...C,toolCalls:b}}),E=h.filter(C=>!v.has(C.callId));return E.length>0&&zt.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,subAgentContextStates:{},pendingPathConfirmation:null,pendingQuestion:null,visionFallbackByMessage:{},queuedMessages:[],abortInProgress:!1,error:null,sessionsHasMore:!0,sessionsPaginationLoading:!1,pendingSessionCreate:!1,connect:async()=>{const i=r().connectionStatus;if(i==="connected"||i==="reconnecting")return;e({connectionStatus:"reconnecting"});let s=!1;try{s=(await(await ye("/api/auth")).json()).requiresAuth}catch{}if(s&&!Ht.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Ht.onStatusChange(c=>{e({connectionStatus:c}),c==="connected"&&r().listSessions(void 0)});try{if(await Ht.connect(),!ja){ja=!0;const c=r().handleServerMessage;nr=Ht.subscribe(c)}}catch(c){console.error("Failed to connect:",c);const u=Ht.getLastCloseCode();if(!Ht.hasToken()&&(u===1006||u===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}nr&&(nr(),nr=null),ja=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{Ht.disconnect(),nr&&(nr(),nr=null),ja=!1,e({connectionStatus:"reconnecting"}),r().connect()},disconnect:()=>{Ht.disconnect(),nr&&(nr(),nr=null),ja=!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();Ht.setToken(c),e({showPasswordModal:!1}),r().connect();const{listProjects:u}=Ut.getState(),{fetchConfig:p}=jt.getState();u(),p(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Ht.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(i,s)=>{try{e({pendingSessionCreate:!0});const c=await ye("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:i,title:s})});if(!c.ok)return e({pendingSessionCreate:!1}),null;const u=await c.json();return Ht.send("session.load",{sessionId:u.session.id}),u.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async i=>{try{const s=r().currentSession;!s||s.id!==i?(wi(),e({currentSession:null,unreadSessionIds:Na(r().unreadSessionIds,i),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:Na(r().unreadSessionIds,i)});const c=await ye(`/api/sessions/${i}`);if(!c.ok)return;const u=await c.json();e({currentSession:u.session,messages:u.messages??[],contextState:u.contextState,queuedMessages:u.queueState??[]}),Ht.send("session.load",{sessionId:i});try{const p=await ye(`/api/sessions/${i}/background-processes`);if(p.ok){const l=await p.json();Ba.getState().setProcesses(l.processes??[])}}catch{}}catch{}},listSessions:async(i,s=20)=>{try{const c=new URLSearchParams;c.set("limit",String(s)),i&&c.set("projectId",i);const p=await(await ye(`/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 ye(`/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 ye(`/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 ye(`/api/projects/${i}/sessions`,{method:"DELETE"})).ok?(await r().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{wi(),e(i=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:i.currentSession?Na(i.unreadSessionIds,i.currentSession.id):i.unreadSessionIds}))},sendMessage:async(i,s,c)=>{var p;const u=(p=r().currentSession)==null?void 0:p.id;if(u){e({streamingMessageId:null});try{const h=await(await ye(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c==null?void 0:c.messageKind})})).json();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){wi(),rn==null||rn(),e({abortInProgress:!0});try{await ye(`/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 ye(`/api/sessions/${i}/continue`,{method:"POST"})}catch(c){console.error("Error continuing generation:",c)}}},launchRunner:(i,s,c)=>{e({streamingMessageId:null});const u={};i!=null&&i.trim()&&(u.content=i),s&&s.length>0&&(u.attachments=s),c&&(u.workflowId=c),Ht.send("runner.launch",u)},switchMode:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await ye(`/api/sessions/${s}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:i})});if(!u.ok){console.error("Failed to switch mode:",await u.json());return}const p=await u.json();p.session&&e({currentSession:p.session})}catch(u){console.error("Error switching mode:",u)}},switchDangerLevel:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await ye(`/api/sessions/${s}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:i})});if(!u.ok){console.error("Failed to switch danger level:",await u.json());return}const p=await u.json();p.session&&e({currentSession:p.session})}catch(u){console.error("Error switching danger level:",u)}},acceptAndBuild:(i,s,c)=>{e({streamingMessageId:null});const u={};i&&(u.workflowId=i),s!=null&&s.trim()&&(u.content=s),c&&c.length>0&&(u.attachments=c),Ht.send("mode.accept",u)},editCriteria:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await ye(`/api/sessions/${s}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:i})});u.ok||console.error("Failed to update criteria:",await u.json())}catch(u){console.error("Error updating criteria:",u)}},compactContext:()=>{Ht.send("context.compact",{})},setSessionProvider:async(i,s)=>{var c;try{const u=(c=r().currentSession)==null?void 0:c.id;if(!u)return null;const p=await ye(`/api/sessions/${u}/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})},updateSubAgentContextState:(i,s)=>{e(c=>({subAgentContextStates:{...c.subAgentContextStates,[i]:s}}))},clearSubAgentContextState:i=>{e(s=>{const c={...s.subAgentContextStates};return delete c[i],{subAgentContextStates:c}})},confirmPath:async(i,s,c=!1)=>{var p;const u=(p=r().currentSession)==null?void 0:p.id;if(u)try{await ye(`/api/sessions/${u}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,approved:s,alwaysAllow:c})})}catch(l){console.error("Error confirming path:",l)}},answerQuestion:async(i,s)=>{var u;const c=(u=r().currentSession)==null?void 0:u.id;if(c){try{await ye(`/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 u=(p=r().currentSession)==null?void 0:p.id;if(u)try{const h=await(await ye(`/api/sessions/${u}/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 u=(p=r().currentSession)==null?void 0:p.id;if(u)try{const h=await(await ye(`/api/sessions/${u}/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 ye(`/api/sessions/${s}/queue/${i}`,{method:"DELETE"})).json();p.queueState&&e({queuedMessages:p.queueState})}catch(u){console.error("Error canceling queued message:",u)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:i=>{var p,l,h,f,g,m,v,S,E,C,b,y,x,_,j,A,N,L,T,I,z,V,Y,$;const s=r();dS(i,s);const c=((p=s.currentSession)==null?void 0:p.id)??null,u=()=>{const F=i.sessionId;!F||F===c||e(B=>({unreadSessionIds:lS(B.unreadSessionIds,F)}))};switch(i.type){case"session.state":{const F=i.payload;if(!oS(i,c,s.pendingSessionCreate))break;wi();const B=F.messages.find(D=>D.isStreaming)??null,q=r().pendingSessionCreate===!0,X=F.pendingConfirmations??[],R=s.pendingPathConfirmation??(X.length>0?X[0]??null:null);if(e({currentSession:F.session,sessions:cS(r().sessions,F.session),unreadSessionIds:Na(r().unreadSessionIds,F.session.id),messages:F.messages,streamingMessageId:(B==null?void 0:B.id)??null,streamingMessage:B,currentTodos:[],pendingPathConfirmation:R,error:null,...q?{pendingSessionCreate:F.session.id}:{}}),F.session.providerId&&F.session.providerModel){const D=jt.getState();D.providers.find(W=>W.id===F.session.providerId)&&D.syncFromSession(F.session.providerId,F.session.providerModel)}break}case"session.list":{const F=i.payload;e(B=>({sessions:uS(F.sessions,B.sessions,B.currentSession)}));break}case"session.deleted":{const F=i.payload;e(B=>({unreadSessionIds:Na(B.unreadSessionIds,F.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const F=i.payload,B=i.sessionId,q=(l=r().currentSession)==null?void 0:l.id,X=B&&B!==q;e(J=>({sessions:J.sessions.map(R=>R.id===B?{...R,isRunning:F.isRunning}:R)})),X||e(J=>({currentSession:J.currentSession?{...J.currentSession,isRunning:F.isRunning}:null,...F.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!Lt(i,((h=r().currentSession)==null?void 0:h.id)??null)){u();break}const F=i.payload;e(B=>B.messages.some(q=>q.id===F.message.id)?B:{messages:[...B.messages,F.message],streamingMessageId:F.message.isStreaming?F.message.id:B.streamingMessageId,streamingMessage:F.message.isStreaming?F.message:B.streamingMessage});break}case"chat.message_updated":{if(!Lt(i,((f=r().currentSession)==null?void 0:f.id)??null)){u();break}const F=i.payload,B=F.updates.isStreaming===!1&&r().streamingMessageId===F.messageId;B&&(wi(),rn==null||rn()),e(q=>{const X=q.streamingMessage,J=B;if(X&&X.id===F.messageId){const R={...X,...F.updates};return{messages:q.messages.map(D=>D.id===F.messageId?R:D),streamingMessageId:J?null:q.streamingMessageId,streamingMessage:J?null:{...X,...F.updates}}}return{messages:q.messages.map(R=>R.id===F.messageId?{...R,...F.updates}:R),streamingMessageId:J?null:q.streamingMessageId}});break}case"chat.delta":{if(!Lt(i,((g=r().currentSession)==null?void 0:g.id)??null)){u();break}const F=i.payload;if(!Sd.has(F.messageId)){Sd.add(F.messageId);const B=Oa(r(),i.sessionId);aS(B)}zt.messageId=F.messageId,zt.deltaContent+=F.content,wd();break}case"chat.thinking":{if(!Lt(i,((m=r().currentSession)==null?void 0:m.id)??null)){u();break}const F=i.payload;zt.messageId=F.messageId,zt.thinkingContent+=F.content,wd();break}case"chat.tool_preparing":{if(!Lt(i,((v=r().currentSession)==null?void 0:v.id)??null)){u();break}const F=i.payload;e(B=>{const q=B.streamingMessage;return q&&q.id===F.messageId?{streamingMessage:{...q,preparingToolCalls:[...q.preparingToolCalls??[],{index:F.index,name:F.name}]}}:{messages:B.messages.map(X=>X.id===F.messageId?{...X,preparingToolCalls:[...X.preparingToolCalls??[],{index:F.index,name:F.name}]}:X)}});break}case"chat.tool_call":{if(!Lt(i,((S=r().currentSession)==null?void 0:S.id)??null)){u();break}const F=i.payload,B=q=>{var R;const X=(R=q.preparingToolCalls)==null?void 0:R.filter((D,O)=>{var W;return D.name===F.tool?(W=q.preparingToolCalls)==null?void 0:W.slice(0,O).some(K=>K.name===F.tool):!0}),J=zt.toolOutput.filter(D=>D.callId===F.callId);return J.length>0&&(zt.toolOutput=zt.toolOutput.filter(D=>D.callId!==F.callId)),{...q,toolCalls:[...q.toolCalls??[],{id:F.callId,name:F.tool,arguments:F.args,startedAt:Date.now(),...J.length>0?{streamingOutput:J.map(D=>({stream:D.stream,content:D.content}))}:{}}],...X&&X.length>0?{preparingToolCalls:X}:{preparingToolCalls:void 0}}};e(q=>{const X=q.streamingMessage;return X&&X.id===F.messageId?{streamingMessage:B(X)}:{messages:q.messages.map(J=>J.id===F.messageId?B(J):J)}});break}case"chat.tool_output":{if(!Lt(i,((E=r().currentSession)==null?void 0:E.id)??null)){u();break}const F=i.payload;zt.messageId=F.messageId,zt.toolOutput.push({messageId:F.messageId,callId:F.callId,stream:F.stream,content:F.output}),wd();break}case"chat.tool_result":{if(!Lt(i,((C=r().currentSession)==null?void 0:C.id)??null)){u();break}const F=i.payload,B=q=>{var J;const X=(J=q.toolCalls)==null?void 0:J.map(R=>R.id===F.callId?{...R,result:F.result}:R);return{...q,toolCalls:X}};e(q=>{const X=q.streamingMessage;return X&&X.id===F.messageId?{streamingMessage:B(X)}:{messages:q.messages.map(J=>J.id===F.messageId?B(J):J)}});break}case"chat.vision_fallback":{if(!Lt(i,((b=r().currentSession)==null?void 0:b.id)??null)){u();break}const F=i.payload;e(B=>{const q=`${F.messageId}-${F.attachmentId}`,X={...B.visionFallbackByMessage};return X[q]={type:F.type,attachmentId:F.attachmentId,filename:F.filename,description:F.description},{visionFallbackByMessage:X}});break}case"chat.todo":{if(!Lt(i,((y=r().currentSession)==null?void 0:y.id)??null)){u();break}const F=i.payload;e({currentTodos:F.todos});break}case"chat.summary":{if(!Lt(i,((x=r().currentSession)==null?void 0:x.id)??null)){u();break}const F=i.payload;e(B=>({currentSession:B.currentSession?{...B.currentSession,summary:F.summary}:null}));break}case"chat.progress":{if(!Lt(i,((_=r().currentSession)==null?void 0:_.id)??null)){u();break}const F=i.payload;console.log("Progress:",F.message,F.phase);break}case"chat.format_retry":{if(!Lt(i,((j=r().currentSession)==null?void 0:j.id)??null)){u();break}const F=i.payload;console.log("Format retry:",F.attempt,"/",F.maxAttempts);break}case"chat.done":{if(!Lt(i,((A=r().currentSession)==null?void 0:A.id)??null)){u();break}wi(),rn==null||rn();const F=i.payload,B=F.stats;zt.messageId=null,zt.deltaContent="",zt.thinkingContent="",zt.toolOutput=[],Sd.delete(F.messageId),e(q=>{const X=q.streamingMessage,J=X&&X.id===F.messageId?{...X,isStreaming:!1,stats:B??X.stats}:null;return{messages:q.messages.map(R=>R.id===F.messageId?J??{...R,isStreaming:!1,stats:B??R.stats}:R),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!Lt(i,((N=r().currentSession)==null?void 0:N.id)??null)){u();break}wi(),rn==null||rn();const F=i.payload;console.error("Chat error:",F.error,"recoverable:",F.recoverable),F.recoverable||(zt.messageId=null,zt.deltaContent="",zt.thinkingContent="",zt.toolOutput=[]),e(B=>({error:{code:"CHAT_ERROR",message:F.error},streamingMessageId:F.recoverable?B.streamingMessageId:null,...F.recoverable?{}:{messages:B.streamingMessage?B.messages.map(q=>q.id===B.streamingMessage.id?B.streamingMessage:q):B.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!Lt(i,((L=r().currentSession)==null?void 0:L.id)??null)){u();break}const F=i.payload;e({pendingPathConfirmation:{callId:F.callId,tool:F.tool,paths:F.paths,workdir:F.workdir,reason:F.reason}});break}case"chat.ask_user":{if(!Lt(i,((T=r().currentSession)==null?void 0:T.id)??null)){u();return}const F=i.payload;e({pendingQuestion:{callId:F.callId,question:F.question}});break}case"mode.changed":{if(!Lt(i,((I=r().currentSession)==null?void 0:I.id)??null)){u();break}const F=i.payload;e(B=>({currentSession:B.currentSession?{...B.currentSession,mode:F.mode}:null}));break}case"phase.changed":{const F=i.payload,B=i.sessionId,q=(z=r().currentSession)==null?void 0:z.id,X=B&&B!==q;e(J=>({sessions:J.sessions.map(R=>R.id===B?{...R,phase:F.phase}:R)})),X||e(J=>({currentSession:J.currentSession?{...J.currentSession,phase:F.phase}:null}));break}case"criteria.updated":{if(!Lt(i,((V=r().currentSession)==null?void 0:V.id)??null)){u();break}const F=i.payload;e(B=>({currentSession:B.currentSession?{...B.currentSession,criteria:F.criteria}:null}));break}case"context.state":{const F=i.payload,B=Lt(i,((Y=r().currentSession)==null?void 0:Y.id)??null);F.subAgentId?B&&r().updateSubAgentContextState(F.subAgentId,F.context):B?e({contextState:F.context}):u();break}case"session.name_generated":{const F=i.payload,B=i.sessionId,q=($=r().currentSession)==null?void 0:$.id;e(X=>{const J=X.sessions.map(D=>D.id===B?{...D,title:F.name,updatedAt:new Date().toISOString()}:D),R=q===B?X.currentSession?{...X.currentSession,title:F.name,updatedAt:new Date().toISOString()}:null:X.currentSession;return{sessions:J,currentSession:R}});break}case"queue.state":{const F=i.payload;e({queuedMessages:F.messages});break}case"devServer.output":case"devServer.state":{ir.getState().handleMessage(i);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{Ba.getState().handleMessage(i.type,i.payload);break}case"error":{const F=i.payload;console.error("Server error:",F),e({error:{code:F.code,message:F.message},streamingMessageId:null});break}}}}));function ob(){return Ce(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function hS(){return Ce(e=>e.queuedMessages)}function fS(){return Ce(e=>e.abortInProgress)}function pS(){const e=Ce(s=>s.connect),r=Ce(s=>s.connectionStatus),i=ji(s=>s.load);return P.useEffect(()=>{e()},[e]),P.useEffect(()=>{r==="connected"&&i()},[r,i]),{connectionStatus:r}}function Kd(){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 yx(e,r){const i=Ht.ws;!i||i.readyState!==WebSocket.OPEN||i.send(JSON.stringify({id:Kd(),type:e,payload:r}))}const sr=qn((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 ye("/api/terminals");if(i.ok){const s=await i.json();e({sessions:s});const c=Ht.ws;if(c&&c.readyState===WebSocket.OPEN)for(const u of s)c.send(JSON.stringify({id:Kd(),type:"terminal.subscribe",payload:{sessionId:u.id}}))}}catch(i){console.error("Failed to fetch terminals:",i)}},createSession:async i=>{try{const s=await ye("/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 u=Ht.ws;u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({id:Kd(),type:"terminal.subscribe",payload:{sessionId:c.id}}))}}catch(s){console.error("Failed to create terminal:",s)}},writeSession:(i,s)=>{yx("terminal.write",{sessionId:i,data:s})},resizeSession:(i,s,c)=>{yx("terminal.resize",{sessionId:i,cols:s,rows:c})},killSession:async i=>{try{(await ye(`/api/terminals/${i}`,{method:"DELETE"})).ok&&e(c=>({sessions:c.sessions.filter(u=>u.id!==i)}))}catch(s){console.error("Failed to kill terminal:",s)}},handleMessage:i=>{switch(i.type){case"terminal.exit":{const{sessionId:s}=i.payload||{};s&&e(c=>{const u=c.sessions.filter(p=>p.id!==s);return u.length===0&&c.isOpen?{sessions:[],isOpen:!1}:{sessions:u}});break}}}}));Ht.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&sr.getState().handleMessage(e)});var Hl=Yv();function dn({isOpen:e,onClose:r,title:i,children:s,size:c="md"}){const u=P.useRef(null),p=P.useRef(null),l=P.useCallback(f=>{f.key==="Escape"&&r()},[r]);if(P.useEffect(()=>{var f,g;return e?(p.current=document.activeElement,(f=u.current)==null||f.focus(),document.body.style.overflow="hidden"):((g=p.current)==null||g.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}},[e]),P.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 Hl.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:u,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=P.forwardRef(({variant:e="secondary",size:r="md",className:i="",children:s,...c},u)=>{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:u,className:`${p} ${l[e]} ${h[r]} ${i}`,...c,children:s})});dt.displayName="Button";function mS({value:e,defaultUrl:r,disabled:i,onChange:s}){const c=e??r;return o.jsxs("div",{className:"relative",children:[o.jsx("select",{value:c,disabled:i,onChange:u=>{const p=u.target.value;s(p===r?null:p)},className:"appearance-none bg-bg-tertiary border border-border rounded px-1.5 pr-5 text-xs focus:outline-none focus:ring-1 focus:ring-accent-primary disabled:opacity-40 cursor-pointer",style:{width:"60px"},children:Z1.map(({url:u,label:p})=>o.jsx("option",{value:u,title:p,children:p.split(" ")[0]},u))}),o.jsx("svg",{className:"absolute right-0.5 top-1/2 -translate-y-1/2 w-3 h-3 pointer-events-none text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}const _x=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function gS(){const e=ji(h=>h.settings),r=ji(h=>h.update),i=ji(h=>h.updateEvent),s=ji(h=>h.updateAgentOverride),c=ji(h=>h.load);P.useEffect(()=>{c()},[c]);const u=async()=>{await J1()==="granted"&&r({...e,browserNotificationEnabled:!0})},p=(h,f,g,m)=>{h==="general"?i(f,{[g]:m}):s(h,f,{[g]:m})},l=(h,f,g)=>{h==="general"?i(f,{customSoundUrl:g}):s(h,f,{customSoundUrl:g})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Master Controls"}),o.jsx(Sx,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:h=>r({...e,soundEnabled:h})}),o.jsx(Sx,{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"?u():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:"Notification Settings"}),o.jsx("div",{className:"border border-border rounded overflow-hidden",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{className:"sticky top-0 bg-bg-tertiary",children:o.jsxs("tr",{className:"border-b border-border",children:[o.jsx("th",{className:"text-left px-3 py-2 text-text-primary font-medium w-40",children:"Event"}),_x.map(h=>o.jsx("th",{className:"text-center px-2 py-2 text-text-primary font-medium",children:h.label},h.key))]})}),o.jsx("tbody",{children:X1.map(h=>o.jsxs("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-secondary/50",children:[o.jsx("td",{className:"px-3 py-2",children:o.jsx("div",{className:"text-text-primary text-xs",children:h.label})}),_x.map(f=>{const g=sb(e,h.key,f.key==="general"?void 0:f.key),m=rb[h.key];return o.jsx("td",{className:"px-2 py-2 align-top",children:o.jsxs("div",{className:"flex flex-col items-center gap-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.soundEnabled,onChange:v=>p(f.key,h.key,"soundEnabled",v.target.checked),disabled:!e.soundEnabled,className:"rounded border-border",title:"Sound"})}),o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.browserNotification,onChange:v=>p(f.key,h.key,"browserNotification",v.target.checked),disabled:!e.browserNotificationEnabled,className:"rounded border-border",title:"Browser"})})]}),g.soundEnabled&&e.soundEnabled&&o.jsx(mS,{value:g.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:v=>l(f.key,h.key,v)})]})},f.key)})]},h.key))})]})})]})]})}function Sx({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})]})]})}const lb=P.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})})}));lb.displayName="IconButton";const xS="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",ii=P.forwardRef((e,r)=>o.jsx(lb,{ref:r,icon:xS,title:"Edit",...e}));ii.displayName="EditButton";const Yn=qn((e,r)=>({skills:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await ye("/api/skills/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchSkills:async()=>{e({loading:!0});try{const s=await(await ye("/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 ye(`/api/skills/${i}/toggle`,{method:"POST"})).json();e({skills:r().skills.map(u=>u.id===i?{...u,enabled:c.enabled}:u)})}catch{}},fetchSkill:async i=>{try{const s=await ye(`/api/skills/${i}`);return s.ok?await s.json():null}catch{return null}},createSkill:async i=>{try{const s=await ye("/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 ye(`/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 ye(`/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 ye(`/api/skills/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchSkills(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await ye("/api/skills/restore-all-defaults",{method:"POST"})).ok?(await r().fetchSkills(),!0):!1}catch{return!1}}}));function vS(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function bS({isOpen:e}){const r=Yn(Q=>Q.skills),i=Yn(Q=>Q.modifiedIds),s=Yn(Q=>Q.loading),c=Yn(Q=>Q.fetchSkills),u=Yn(Q=>Q.toggleSkill),p=Yn(Q=>Q.fetchSkill),l=Yn(Q=>Q.createSkill),h=Yn(Q=>Q.updateSkill),f=Yn(Q=>Q.deleteSkill),g=Yn(Q=>Q.restoreDefault),m=Yn(Q=>Q.restoreAllDefaults),[v,S]=P.useState("list"),[E,C]=P.useState(null),[b,y]=P.useState(null),[x,_]=P.useState(""),[j,A]=P.useState(""),[N,L]=P.useState(""),[T,I]=P.useState("1.0.0"),[z,V]=P.useState(""),[Y,$]=P.useState(""),[F,B]=P.useState(!1),[q,X]=P.useState(null),[J,R]=P.useState(!1);P.useEffect(()=>{e&&(c(),S("list"),C(null),y(null),X(null),R(!1))},[e,c]);const D=()=>{C(null),_(""),A(""),L(""),I("1.0.0"),V(""),$(""),S("edit")},O=async Q=>{const Z=await p(Q);Z&&(C(Q),_(Z.metadata.name),A(Z.metadata.id),L(Z.metadata.description),I(Z.metadata.version),V(Z.prompt),$(""),S("edit"))},W=async Q=>{await f(Q),y(null)},U=async()=>{const Q=E??j;if(!Q||!x||!z){$("Name and prompt are required.");return}B(!0),$("");const Z={metadata:{id:Q,name:x,description:N,version:T||"1.0.0"},prompt:z},H=E?await h(E,Z):await l(Z);if(B(!1),!H.success){$(H.error??"Failed to save skill.");return}S("list")},K=()=>{S("list")},te=Q=>{_(Q),E||A(vS(Q))};return v==="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:x,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=>I(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:z,onChange:Q=>V(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:U,disabled:F||!x||!z,children:F?"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&&(J?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)&&(q===Q.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await g(Q.id),X(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:()=>X(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:()=>X(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(ii,{onClick:()=>O(Q.id)}),b===Q.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:()=>W(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:()=>y(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:()=>y(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:()=>u(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 yS({isOpen:e,onClose:r}){const[i,s]=P.useState("instructions");return o.jsx(dn,{isOpen:e,onClose:r,title:"Settings",size:"xl",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(ml,{label:"Instructions",active:i==="instructions",onClick:()=>s("instructions")}),o.jsx(ml,{label:"Skills",active:i==="skills",onClick:()=>s("skills")}),o.jsx(ml,{label:"Notifications",active:i==="notifications",onClick:()=>s("notifications")}),o.jsx(ml,{label:"Advanced",active:i==="advanced",onClick:()=>s("advanced")})]}),i==="instructions"&&o.jsx(SS,{isOpen:e}),i==="skills"&&o.jsx(bS,{isOpen:e}),i==="notifications"&&o.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:o.jsx(gS,{})}),i==="advanced"&&o.jsx(_S,{onClose:r})]})})}function _S({onClose:e}){const[,r]=ar();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 ml({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 SS({isOpen:e}){const r=ti(b=>b.settings),i=ti(b=>b.loading),s=ti(b=>b.getSetting),c=ti(b=>b.setSetting),u=r[ei.GLOBAL_INSTRUCTIONS]??"",p=i[ei.GLOBAL_INSTRUCTIONS]??!1,[l,h]=P.useState(u),[f,g]=P.useState(!1),[m,v]=P.useState(!1);P.useEffect(()=>{e&&s(ei.GLOBAL_INSTRUCTIONS)},[e,s]),P.useEffect(()=>{h(u),g(!1)},[u]);const S=async()=>{v(!0),c(ei.GLOBAL_INSTRUCTIONS,l),v(!1),g(!1)},E=()=>{h(u),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:b=>{h(b.target.value),g(!0)},placeholder:"Enter global instructions that apply to all projects...",className:"w-full h-64 px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:C})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(dt,{variant:"secondary",onClick:E,disabled:!f,children:"Discard"}),o.jsx(dt,{variant:"primary",onClick:S,disabled:!f||C,children:m?"Saving...":"Save"})]})]})}var Cd={exports:{}},wx;function wS(){return wx||(wx=1,(function(e,r){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(p,l,h){var f=this&&this.__decorate||function(x,_,j,A){var N,L=arguments.length,T=L<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,_,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(L<3?N(T):L>3?N(_,j,T):N(_,j))||T);return L>3&&T&&Object.defineProperty(_,j,T),T},g=this&&this.__param||function(x,_){return function(j,A){_(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const m=h(9042),v=h(9924),S=h(844),E=h(4725),C=h(2585),b=h(3656);let y=l.AccessibilityManager=class extends S.Disposable{constructor(x,_,j,A){super(),this._terminal=x,this._coreBrowserService=j,this._renderService=A,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let N=0;N<this._terminal.rows;N++)this._rowElements[N]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[N]);if(this._topBoundaryFocusListener=N=>this._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new v.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
58
|
-
`)))),this.register(this._terminal.onA11yTab((N=>this._handleTab(N)))),this.register(this._terminal.onKey((N=>this._handleKey(N.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,b.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(x){for(let _=0;_<x;_++)this._handleChar(" ")}_handleChar(x){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===`
|
|
59
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,_){this._liveRegionDebouncer.refresh(x,_,this._terminal.rows)}_renderRows(x,_){const j=this._terminal.buffer,A=j.lines.length.toString();for(let N=x;N<=_;N++){const L=j.lines.get(j.ydisp+N),T=[],I=(L==null?void 0:L.translateToString(!0,void 0,void 0,T))||"",z=(j.ydisp+N+1).toString(),V=this._rowElements[N];V&&(I.length===0?(V.innerText=" ",this._rowColumns.set(V,[0,1])):(V.textContent=I,this._rowColumns.set(V,T)),V.setAttribute("aria-posinset",z),V.setAttribute("aria-setsize",A))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,_){const j=x.target,A=this._rowElements[_===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(_===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==A)return;let N,L;if(_===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),_===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(_===0?-1:1),this._rowElements[_===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var I;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let _={node:x.anchorNode,offset:x.anchorOffset},j={node:x.focusNode,offset:x.focusOffset};if((_.node.compareDocumentPosition(j.node)&Node.DOCUMENT_POSITION_PRECEDING||_.node===j.node&&_.offset>j.offset)&&([_,j]=[j,_]),_.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(_={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(_.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:((I=A.textContent)==null?void 0:I.length)??0}),!this._rowContainer.contains(j.node))return;const N=({node:z,offset:V})=>{const Y=z instanceof Text?z.parentNode:z;let $=parseInt(Y==null?void 0:Y.getAttribute("aria-posinset"),10)-1;if(isNaN($))return console.warn("row is invalid. Race condition?"),null;const F=this._rowColumns.get(Y);if(!F)return console.warn("columns is null. Race condition?"),null;let B=V<F.length?F[V]:F.slice(-1)[0]+1;return B>=this._terminal.cols&&(++$,B=0),{row:$,column:B}},L=N(_),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(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let _=this._rowContainer.children.length;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let x=0;x<this._terminal.rows;x++)this._refreshRowDimensions(this._rowElements[x])}}_refreshRowDimensions(x){x.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=y=f([g(1,C.IInstantiationService),g(2,E.ICoreBrowserService),g(3,E.IRenderService)],y)},3614:(p,l)=>{function h(v){return v.replace(/\r?\n/g,"\r")}function f(v,S){return S?"\x1B[200~"+v+"\x1B[201~":v}function g(v,S,E,C){v=f(v=h(v),E.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),E.triggerDataEvent(v,!0),S.value=""}function m(v,S,E){const C=E.getBoundingClientRect(),b=v.clientX-C.left-10,y=v.clientY-C.top-10;S.style.width="20px",S.style.height="20px",S.style.left=`${b}px`,S.style.top=`${y}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(v,S){v.clipboardData&&v.clipboardData.setData("text/plain",S.selectionText),v.preventDefault()},l.handlePasteEvent=function(v,S,E,C){v.stopPropagation(),v.clipboardData&&g(v.clipboardData.getData("text/plain"),S,E,C)},l.paste=g,l.moveTextAreaUnderMouseCursor=m,l.rightClickHandler=function(v,S,E,C,b){m(v,S,E),b&&C.rightClickSelect(v),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,v){this._css.set(g,m,v)}getCss(g,m){return this._css.get(g,m)}setColor(g,m,v){this._color.set(g,m,v)}getColor(g,m){return this._color.get(g,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(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 v=!1;return{dispose:()=>{v||(v=!0,h.removeEventListener(f,g,m))}}}},3551:function(p,l,h){var f=this&&this.__decorate||function(y,x,_,j){var A,N=arguments.length,L=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,_):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(y,x,_,j);else for(var T=y.length-1;T>=0;T--)(A=y[T])&&(L=(N<3?A(L):N>3?A(x,_,L):A(x,_))||L);return N>3&&L&&Object.defineProperty(x,_,L),L},g=this&&this.__param||function(y,x){return function(_,j){x(_,j,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const m=h(3656),v=h(8460),S=h(844),E=h(2585),C=h(4725);let b=l.Linkifier=class extends S.Disposable{get currentLink(){return this._currentLink}constructor(y,x,_,j,A){super(),this._element=y,this._mouseService=x,this._renderService=_,this._bufferService=j,this._linkProviderService=A,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new v.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new v.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,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(y){this._lastMouseEvent=y;const x=this._positionFromMouseEvent(y,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const _=y.composedPath();for(let j=0;j<_.length;j++){const A=_[j];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&x.x===this._lastBufferCell.x&&x.y===this._lastBufferCell.y||(this._handleHover(x),this._lastBufferCell=x)}_handleHover(y){if(this._activeLine!==y.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(y,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,y)||(this._clearCurrentLink(),this._askForLink(y,!0))}_askForLink(y,x){var j,A;this._activeProviderReplies&&x||((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.y);let _=!1;for(const[N,L]of this._linkProviderService.linkProviders.entries())x?(A=this._activeProviderReplies)!=null&&A.get(N)&&(_=this._checkLinkProviderResult(N,y,_)):L.provideLinks(y.y,(T=>{var z,V;if(this._isMouseOut)return;const I=T==null?void 0:T.map((Y=>({link:Y})));(z=this._activeProviderReplies)==null||z.set(N,I),_=this._checkLinkProviderResult(N,y,_),((V=this._activeProviderReplies)==null?void 0:V.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(y.y,this._activeProviderReplies)}))}_removeIntersectingLinks(y,x){const _=new Set;for(let j=0;j<x.size;j++){const A=x.get(j);if(A)for(let N=0;N<A.length;N++){const L=A[N],T=L.link.range.start.y<y?0:L.link.range.start.x,I=L.link.range.end.y>y?this._bufferService.cols:L.link.range.end.x;for(let z=T;z<=I;z++){if(_.has(z)){A.splice(N--,1);break}_.add(z)}}}}_checkLinkProviderResult(y,x,_){var N;if(!this._activeProviderReplies)return _;const j=this._activeProviderReplies.get(y);let A=!1;for(let L=0;L<y;L++)this._activeProviderReplies.has(L)&&!this._activeProviderReplies.get(L)||(A=!0);if(!A&&j){const L=j.find((T=>this._linkAtPosition(T.link,x)));L&&(_=!0,this._handleNewLink(L))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!_)for(let L=0;L<this._activeProviderReplies.size;L++){const T=(N=this._activeProviderReplies.get(L))==null?void 0:N.find((I=>this._linkAtPosition(I.link,x)));if(T){_=!0,this._handleNewLink(T);break}}return _}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(y){if(!this._currentLink)return;const x=this._positionFromMouseEvent(y,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(y,this._currentLink.link.text)}_clearCurrentLink(y,x){this._currentLink&&this._lastMouseEvent&&(!y||!x||this._currentLink.link.range.start.y>=y&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,S.disposeArray)(this._linkCacheDisposables))}_handleNewLink(y){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(y.link,x)&&(this._currentLink=y,this._currentLink.state={decorations:{underline:y.link.decorations===void 0||y.link.decorations.underline,pointerCursor:y.link.decorations===void 0||y.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,y.link,this._lastMouseEvent),y.link.decorations={},Object.defineProperties(y.link.decorations,{pointerCursor:{get:()=>{var _,j;return(j=(_=this._currentLink)==null?void 0:_.state)==null?void 0:j.decorations.pointerCursor},set:_=>{var j;(j=this._currentLink)!=null&&j.state&&this._currentLink.state.decorations.pointerCursor!==_&&(this._currentLink.state.decorations.pointerCursor=_,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",_))}},underline:{get:()=>{var _,j;return(j=(_=this._currentLink)==null?void 0:_.state)==null?void 0:j.decorations.underline},set:_=>{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)!==_&&(this._currentLink.state.decorations.underline=_,this._currentLink.state.isHovered&&this._fireUnderlineEvent(y.link,_))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((_=>{if(!this._currentLink)return;const j=_.start===0?0:_.start+1+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.ydisp+1+_.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(y,x,_){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&y.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(_,x.text)}_fireUnderlineEvent(y,x){const _=y.range,j=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(_.start.x-1,_.start.y-j-1,_.end.x,_.end.y-j-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(y,x,_){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&y.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(_,x.text)}_linkAtPosition(y,x){const _=y.range.start.y*this._bufferService.cols+y.range.start.x,j=y.range.end.y*this._bufferService.cols+y.range.end.x,A=x.y*this._bufferService.cols+x.x;return _<=A&&A<=j}_positionFromMouseEvent(y,x,_){const j=_.getCoords(y,x,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(y,x,_,j,A){return{x1:y,y1:x,x2:_,y2:j,cols:this._bufferService.cols,fg:A}}};l.Linkifier=b=f([g(1,C.IMouseService),g(2,C.IRenderService),g(3,E.IBufferService),g(4,C.ILinkProviderService)],b)},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,b,y,x){var _,j=arguments.length,A=j<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,y):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,y,x);else for(var N=C.length-1;N>=0;N--)(_=C[N])&&(A=(j<3?_(A):j>3?_(b,y,A):_(b,y))||A);return j>3&&A&&Object.defineProperty(b,y,A),A},g=this&&this.__param||function(C,b){return function(y,x){b(y,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const m=h(511),v=h(2585);let S=l.OscLinkProvider=class{constructor(C,b,y){this._bufferService=C,this._optionsService=b,this._oscLinkService=y}provideLinks(C,b){var I;const y=this._bufferService.buffer.lines.get(C-1);if(!y)return void b(void 0);const x=[],_=this._optionsService.rawOptions.linkHandler,j=new m.CellData,A=y.getTrimmedLength();let N=-1,L=-1,T=!1;for(let z=0;z<A;z++)if(L!==-1||y.hasContent(z)){if(y.loadCell(z,j),j.hasExtendedAttrs()&&j.extended.urlId){if(L===-1){L=z,N=j.extended.urlId;continue}T=j.extended.urlId!==N}else L!==-1&&(T=!0);if(T||L!==-1&&z===A-1){const V=(I=this._oscLinkService.getLinkData(N))==null?void 0:I.uri;if(V){const Y={start:{x:L+1,y:C},end:{x:z+(T||z!==A-1?0:1),y:C}};let $=!1;if(!(_!=null&&_.allowNonHttpProtocols))try{const F=new URL(V);["http:","https:"].includes(F.protocol)||($=!0)}catch{$=!0}$||x.push({text:V,range:Y,activate:(F,B)=>_?_.activate(F,B,Y):E(0,B),hover:(F,B)=>{var q;return(q=_==null?void 0:_.hover)==null?void 0:q.call(_,F,B,Y)},leave:(F,B)=>{var q;return(q=_==null?void 0:_.leave)==null?void 0:q.call(_,F,B,Y)}})}T=!1,j.hasExtendedAttrs()&&j.extended.urlId?(L=z,N=j.extended.urlId):(L=-1,N=-1)}}b(x)}};function E(C,b){if(confirm(`Do you want to navigate to ${b}?
|
|
60
|
-
|
|
61
|
-
WARNING: This link could potentially be dangerous`)){const y=window.open();if(y){try{y.opener=null}catch{}y.location.href=b}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=S=f([g(0,v.IBufferService),g(1,v.IOptionsService),g(2,v.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),v=h(9042),S=h(3730),E=h(1680),C=h(3107),b=h(5744),y=h(2950),x=h(1296),_=h(428),j=h(4269),A=h(5114),N=h(8934),L=h(3230),T=h(9312),I=h(4725),z=h(6731),V=h(8055),Y=h(8969),$=h(8460),F=h(844),B=h(6114),q=h(8437),X=h(2584),J=h(7399),R=h(5941),D=h(9074),O=h(2585),W=h(5435),U=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(Z={}){super(Z),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new F.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(I.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(S.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((H,se)=>this.refresh(H,se)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((H=>this._reportWindowsOptions(H)))),this.register(this._inputHandler.onColor((H=>this._handleColorEvent(H)))),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((H=>this._afterResize(H.cols,H.rows)))),this.register((0,F.toDisposable)((()=>{var H,se;this._customKeyEventHandler=void 0,(se=(H=this.element)==null?void 0:H.parentNode)==null||se.removeChild(this.element)})))}_handleColorEvent(Z){if(this._themeService)for(const H of Z){let se,ie="";switch(H.index){case 256:se="foreground",ie="10";break;case 257:se="background",ie="11";break;case 258:se="cursor",ie="12";break;default:se="ansi",ie="4;"+H.index}switch(H.type){case 0:const ge=V.color.toColorRGB(se==="ansi"?this._themeService.colors.ansi[H.index]:this._themeService.colors[se]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${ie};${(0,R.toRgbString)(ge)}${X.C1_ESCAPED.ST}`);break;case 1:if(se==="ansi")this._themeService.modifyColors((ve=>ve.ansi[H.index]=V.channels.toColor(...H.color)));else{const ve=se;this._themeService.modifyColors((Ee=>Ee[ve]=V.channels.toColor(...H.color)))}break;case 2:this._themeService.restoreColor(H.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Z){Z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Z;return(Z=this.textarea)==null?void 0:Z.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Z=this.buffer.ybase+this.buffer.y,H=this.buffer.lines.get(Z);if(!H)return;const se=Math.min(this.buffer.x,this.cols-1),ie=this._renderService.dimensions.css.cell.height,ge=H.getWidth(se),ve=this._renderService.dimensions.css.cell.width*ge,Ee=this.buffer.y*this._renderService.dimensions.css.cell.height,De=se*this._renderService.dimensions.css.cell.width;this.textarea.style.left=De+"px",this.textarea.style.top=Ee+"px",this.textarea.style.width=ve+"px",this.textarea.style.height=ie+"px",this.textarea.style.lineHeight=ie+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(H=>{this.hasSelection()&&(0,f.copyHandler)(H,this._selectionService)})));const Z=H=>(0,f.handlePasteEvent)(H,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",Z)),this.register((0,g.addDisposableDomListener)(this.element,"paste",Z)),B.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(H=>{H.button===2&&(0,f.rightClickHandler)(H,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(H=>{(0,f.rightClickHandler)(H,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(H=>{H.button===1&&(0,f.moveTextAreaUnderMouseCursor)(H,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(Z=>this._keyUp(Z)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(Z=>this._keyDown(Z)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(Z=>this._keyPress(Z)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(Z=>this._compositionHelper.compositionupdate(Z)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(Z=>this._inputEvent(Z)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Z){var se;if(!Z)throw new Error("Terminal requires a parent element.");if(Z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((se=this.element)==null?void 0:se.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Z.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"),Z.appendChild(this.element);const H=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),H.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",(ie=>this.updateCursorStyle(ie)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),H.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",v.promptLabel),B.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,Z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(I.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(ie=>this._handleTextAreaFocus(ie)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(_.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(I.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(z.ThemeService),this._instantiationService.setService(I.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(j.CharacterJoinerService),this._instantiationService.setService(I.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(L.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(I.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ie=>this._onRender.fire(ie)))),this.onResize((ie=>this._renderService.resize(ie.cols,ie.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(y.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N.MouseService),this._instantiationService.setService(I.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild(H);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((ie=>this.scrollLines(ie.amount,ie.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(I.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ie=>this.scrollLines(ie.amount,ie.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ie=>this._renderService.handleSelectionChanged(ie.start,ie.end,ie.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ie=>{this.textarea.value=ie,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ie=>{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",(ie=>this._selectionService.handleMouseDown(ie)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ie=>this._handleScreenReaderModeOptionChange(ie)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ie=>{!this._overviewRulerRenderer&&ie&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Z=this,H=this.element;function se(ve){const Ee=Z._mouseService.getMouseReportCoords(ve,Z.screenElement);if(!Ee)return!1;let De,Re;switch(ve.overrideType||ve.type){case"mousemove":Re=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":Re=0,De=ve.button<3?ve.button:3;break;case"mousedown":Re=1,De=ve.button<3?ve.button:3;break;case"wheel":if(Z._customWheelEventHandler&&Z._customWheelEventHandler(ve)===!1||Z.viewport.getLinesScrolled(ve)===0)return!1;Re=ve.deltaY<0?0:1,De=4;break;default:return!1}return!(Re===void 0||De===void 0||De>4)&&Z.coreMouseService.triggerMouseEvent({col:Ee.col,row:Ee.row,x:Ee.x,y:Ee.y,button:De,action:Re,ctrl:ve.ctrlKey,alt:ve.altKey,shift:ve.shiftKey})}const ie={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ge={mouseup:ve=>(se(ve),ve.buttons||(this._document.removeEventListener("mouseup",ie.mouseup),ie.mousedrag&&this._document.removeEventListener("mousemove",ie.mousedrag)),this.cancel(ve)),wheel:ve=>(se(ve),this.cancel(ve,!0)),mousedrag:ve=>{ve.buttons&&se(ve)},mousemove:ve=>{ve.buttons||se(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?ie.mousemove||(H.addEventListener("mousemove",ge.mousemove),ie.mousemove=ge.mousemove):(H.removeEventListener("mousemove",ie.mousemove),ie.mousemove=null),16&ve?ie.wheel||(H.addEventListener("wheel",ge.wheel,{passive:!1}),ie.wheel=ge.wheel):(H.removeEventListener("wheel",ie.wheel),ie.wheel=null),2&ve?ie.mouseup||(ie.mouseup=ge.mouseup):(this._document.removeEventListener("mouseup",ie.mouseup),ie.mouseup=null),4&ve?ie.mousedrag||(ie.mousedrag=ge.mousedrag):(this._document.removeEventListener("mousemove",ie.mousedrag),ie.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(H,"mousedown",(ve=>{if(ve.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ve))return se(ve),ie.mouseup&&this._document.addEventListener("mouseup",ie.mouseup),ie.mousedrag&&this._document.addEventListener("mousemove",ie.mousedrag),this.cancel(ve)}))),this.register((0,g.addDisposableDomListener)(H,"wheel",(ve=>{if(!ie.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ve)===!1)return!1;if(!this.buffer.hasScrollback){const Ee=this.viewport.getLinesScrolled(ve);if(Ee===0)return;const De=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ve.deltaY<0?"A":"B");let Re="";for(let $e=0;$e<Math.abs(Ee);$e++)Re+=De;return this.coreService.triggerDataEvent(Re,!0),this.cancel(ve,!0)}return this.viewport.handleWheel(ve)?this.cancel(ve):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)(H,"touchstart",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ve),this.cancel(ve)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(H,"touchmove",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ve)?void 0:this.cancel(ve)}),{passive:!1}))}refresh(Z,H){var se;(se=this._renderService)==null||se.refreshRows(Z,H)}updateCursorStyle(Z){var H;(H=this._selectionService)!=null&&H.shouldColumnSelect(Z)?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(Z,H,se=0){var ie;se===1?(super.scrollLines(Z,H,se),this.refresh(0,this.rows-1)):(ie=this.viewport)==null||ie.scrollLines(Z)}paste(Z){(0,f.paste)(Z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Z){this._customKeyEventHandler=Z}attachCustomWheelEventHandler(Z){this._customWheelEventHandler=Z}registerLinkProvider(Z){return this._linkProviderService.registerLinkProvider(Z)}registerCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const H=this._characterJoinerService.register(Z);return this.refresh(0,this.rows-1),H}deregisterCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Z)}registerDecoration(Z){return this._decorationService.registerDecoration(Z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Z,H,se){this._selectionService.setSelection(Z,H,se)}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 Z;(Z=this._selectionService)==null||Z.clearSelection()}selectAll(){var Z;(Z=this._selectionService)==null||Z.selectAll()}selectLines(Z,H){var se;(se=this._selectionService)==null||se.selectLines(Z,H)}_keyDown(Z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;const H=this.browser.isMac&&this.options.macOptionIsMeta&&Z.altKey;if(!H&&!this._compositionHelper.keydown(Z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;H||Z.key!=="Dead"&&Z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const se=(0,J.evaluateKeyboardEvent)(Z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Z),se.type===3||se.type===2){const ie=this.rows-1;return this.scrollLines(se.type===2?-ie:ie),this.cancel(Z,!0)}return se.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Z)||(se.cancel&&this.cancel(Z,!0),!se.key||!!(Z.key&&!Z.ctrlKey&&!Z.altKey&&!Z.metaKey&&Z.key.length===1&&Z.key.charCodeAt(0)>=65&&Z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(se.key!==X.C0.ETX&&se.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:se.key,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(se.key,!0),!this.optionsService.rawOptions.screenReaderMode||Z.altKey||Z.ctrlKey?this.cancel(Z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Z,H){const se=Z.isMac&&!this.options.macOptionIsMeta&&H.altKey&&!H.ctrlKey&&!H.metaKey||Z.isWindows&&H.altKey&&H.ctrlKey&&!H.metaKey||Z.isWindows&&H.getModifierState("AltGraph");return H.type==="keypress"?se:se&&(!H.keyCode||H.keyCode>47)}_keyUp(Z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1||((function(H){return H.keyCode===16||H.keyCode===17||H.keyCode===18})(Z)||this.focus(),this.updateCursorStyle(Z),this._keyPressHandled=!1)}_keyPress(Z){let H;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;if(this.cancel(Z),Z.charCode)H=Z.charCode;else if(Z.which===null||Z.which===void 0)H=Z.keyCode;else{if(Z.which===0||Z.charCode===0)return!1;H=Z.which}return!(!H||(Z.altKey||Z.ctrlKey||Z.metaKey)&&!this._isThirdLevelShift(this.browser,Z)||(H=String.fromCharCode(H),this._onKey.fire({key:H,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(H,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Z){if(Z.data&&Z.inputType==="insertText"&&(!Z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const H=Z.data;return this.coreService.triggerDataEvent(H,!0),this.cancel(Z),!0}return!1}resize(Z,H){Z!==this.cols||H!==this.rows?super.resize(Z,H):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Z,H){var se,ie;(se=this._charSizeService)==null||se.measure(),(ie=this.viewport)==null||ie.syncScrollArea(!0)}clear(){var Z;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 H=1;H<this.rows;H++)this.buffer.lines.push(this.buffer.getBlankLine(q.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(Z=this.viewport)==null||Z.reset(),this.refresh(0,this.rows-1)}}reset(){var H,se;this.options.rows=this.rows,this.options.cols=this.cols;const Z=this._customKeyEventHandler;this._setup(),super.reset(),(H=this._selectionService)==null||H.reset(),this._decorationService.reset(),(se=this.viewport)==null||se.reset(),this._customKeyEventHandler=Z,this.refresh(0,this.rows-1)}clearTextureAtlas(){var Z;(Z=this._renderService)==null||Z.clearTextureAtlas()}_reportFocus(){var Z;(Z=this.element)!=null&&Z.classList.contains("focus")?this.coreService.triggerDataEvent(X.C0.ESC+"[I"):this.coreService.triggerDataEvent(X.C0.ESC+"[O")}_reportWindowsOptions(Z){if(this._renderService)switch(Z){case W.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const H=this._renderService.dimensions.css.canvas.width.toFixed(0),se=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[4;${se};${H}t`);break;case W.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ie=this._renderService.dimensions.css.cell.width.toFixed(0),ge=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[6;${ge};${ie}t`)}}cancel(Z,H){if(this.options.cancelEvents||H)return Z.preventDefault(),Z.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 v=m-this._lastRefreshMs,S=this._debounceThresholdMS-v;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(y,x,_,j){var A,N=arguments.length,L=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,_):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(y,x,_,j);else for(var T=y.length-1;T>=0;T--)(A=y[T])&&(L=(N<3?A(L):N>3?A(x,_,L):A(x,_))||L);return N>3&&L&&Object.defineProperty(x,_,L),L},g=this&&this.__param||function(y,x){return function(_,j){x(_,j,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const m=h(3656),v=h(4725),S=h(8460),E=h(844),C=h(2585);let b=l.Viewport=class extends E.Disposable{constructor(y,x,_,j,A,N,L,T){super(),this._viewportElement=y,this._scrollArea=x,this._bufferService=_,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((I=>this._activeBuffer=I.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((I=>this._renderDimensions=I))),this._handleThemeChange(T.colors),this.register(T.onChangeColors((I=>this._handleThemeChange(I)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(y){this._viewportElement.style.backgroundColor=y.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(y){if(y)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const y=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==y&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=y),this._refreshAnimationFrame=null}syncScrollArea(y=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(y);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(y)}_handleScroll(y){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const y=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(y*(this._smoothScrollState.target-this._smoothScrollState.origin)),y<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(y,x){const _=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&_<this._lastRecordedBufferHeight)||(y.cancelable&&y.preventDefault(),!1)}handleWheel(y){const x=this._getPixelsScrolled(y);return x!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+x:this._smoothScrollState.target+=x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=x,this._bubbleScroll(y,x))}scrollLines(y){if(y!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const x=y*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:y,suppressScrollEvent:!1})}_getPixelsScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let x=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_LINE?x*=this._currentRowHeight:y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._currentRowHeight*this._bufferService.rows),x}getBufferElements(y,x){var T;let _,j="";const A=[],N=x??this._bufferService.buffer.lines.length,L=this._bufferService.buffer.lines;for(let I=y;I<N;I++){const z=L.get(I);if(!z)continue;const V=(T=L.get(I+1))==null?void 0:T.isWrapped;if(j+=z.translateToString(!V),!V||I===L.length-1){const Y=document.createElement("div");Y.textContent=j,A.push(Y),j.length>0&&(_=Y),j=""}}return{bufferElements:A,cursorElement:_}}getLinesScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let x=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(y,x){const _=this._optionsService.rawOptions.fastScrollModifier;return _==="alt"&&x.altKey||_==="ctrl"&&x.ctrlKey||_==="shift"&&x.shiftKey?y*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:y*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(y){this._lastTouchY=y.touches[0].pageY}handleTouchMove(y){const x=this._lastTouchY-y.touches[0].pageY;return this._lastTouchY=y.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(y,x))}};l.Viewport=b=f([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,v.ICharSizeService),g(5,v.IRenderService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],b)},3107:function(p,l,h){var f=this&&this.__decorate||function(C,b,y,x){var _,j=arguments.length,A=j<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,y):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,y,x);else for(var N=C.length-1;N>=0;N--)(_=C[N])&&(A=(j<3?_(A):j>3?_(b,y,A):_(b,y))||A);return j>3&&A&&Object.defineProperty(b,y,A),A},g=this&&this.__param||function(C,b){return function(y,x){b(y,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const m=h(4725),v=h(844),S=h(2585);let E=l.BufferDecorationRenderer=class extends v.Disposable{constructor(C,b,y,x,_){super(),this._screenElement=C,this._bufferService=b,this._coreBrowserService=y,this._decorationService=x,this._renderService=_,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((j=>this._removeDecoration(j)))),this.register((0,v.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var x;const b=this._coreBrowserService.mainDocument.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",((x=C==null?void 0:C.options)==null?void 0:x.layer)==="top"),b.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,b.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",b.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",b.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const y=C.options.x??0;return y&&y>this._bufferService.cols&&(b.style.display="none"),this._refreshXPosition(C,b),b}_refreshStyle(C){const b=C.marker.line-this._bufferService.buffers.active.ydisp;if(b<0||b>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let y=this._decorationElements.get(C);y||(y=this._createElement(C),C.element=y,this._decorationElements.set(C,y),this._container.appendChild(y),C.onDispose((()=>{this._decorationElements.delete(C),y.remove()}))),y.style.top=b*this._renderService.dimensions.css.cell.height+"px",y.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(y)}}_refreshXPosition(C,b=C.element){if(!b)return;const y=C.options.x??0;(C.options.anchor||"left")==="right"?b.style.right=y?y*this._renderService.dimensions.css.cell.width+"px":"":b.style.left=y?y*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var b;(b=this._decorationElements.get(C))==null||b.remove(),this._decorationElements.delete(C),C.dispose()}};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(_,j,A,N){var L,T=arguments.length,I=T<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,A):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(_,j,A,N);else for(var z=_.length-1;z>=0;z--)(L=_[z])&&(I=(T<3?L(I):T>3?L(j,A,I):L(j,A))||I);return T>3&&I&&Object.defineProperty(j,A,I),I},g=this&&this.__param||function(_,j){return function(A,N){j(A,N,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const m=h(5871),v=h(4725),S=h(844),E=h(2585),C={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0};let x=l.OverviewRulerRenderer=class extends S.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(_,j,A,N,L,T,I){var V;super(),this._viewportElement=_,this._screenElement=j,this._bufferService=A,this._decorationService=N,this._renderService=L,this._optionsService=T,this._coreBrowserService=I,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(),(V=this._viewportElement.parentElement)==null||V.insertBefore(this._canvas,this._viewportElement);const z=this._canvas.getContext("2d");if(!z)throw new Error("Ctx cannot be null");this._ctx=z,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 _=Math.floor(this._canvas.width/3),j=Math.ceil(this._canvas.width/3);b.full=this._canvas.width,b.left=_,b.center=j,b.right=_,this._refreshDrawHeightConstants(),y.full=0,y.left=0,y.center=b.left,y.right=b.left+b.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const _=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(_,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 _=this._colorZoneStore.zones;for(const j of _)j.position!=="full"&&this._renderColorZone(j);for(const j of _)j.position==="full"&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(_){this._ctx.fillStyle=_.color,this._ctx.fillRect(y[_.position||"full"],Math.round((this._canvas.height-1)*(_.startBufferLine/this._bufferService.buffers.active.lines.length)-C[_.position||"full"]/2),b[_.position||"full"],Math.round((this._canvas.height-1)*((_.endBufferLine-_.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[_.position||"full"]))}_queueRefresh(_,j){this._shouldUpdateDimensions=_||this._shouldUpdateDimensions,this._shouldUpdateAnchor=j||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=x=f([g(2,E.IBufferService),g(3,E.IDecorationService),g(4,v.IRenderService),g(5,E.IOptionsService),g(6,v.ICoreBrowserService)],x)},2950:function(p,l,h){var f=this&&this.__decorate||function(C,b,y,x){var _,j=arguments.length,A=j<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,y):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,y,x);else for(var N=C.length-1;N>=0;N--)(_=C[N])&&(A=(j<3?_(A):j>3?_(b,y,A):_(b,y))||A);return j>3&&A&&Object.defineProperty(b,y,A),A},g=this&&this.__param||function(C,b){return function(y,x){b(y,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const m=h(4725),v=h(2585),S=h(2584);let E=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,b,y,x,_,j){this._textarea=C,this._compositionView=b,this._bufferService=y,this._optionsService=x,this._coreService=_,this._renderService=j,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const b={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let y;this._isSendingComposition=!1,b.start+=this._dataAlreadySent.length,y=this._isComposing?this._textarea.value.substring(b.start,b.end):this._textarea.value.substring(b.start),y.length>0&&this._coreService.triggerDataEvent(y,!0)}}),0)}else{this._isSendingComposition=!1;const b=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(b,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const b=this._textarea.value,y=b.replace(C,"");this._dataAlreadySent=y,b.length>C.length?this._coreService.triggerDataEvent(y,!0):b.length<C.length?this._coreService.triggerDataEvent(`${S.C0.DEL}`,!0):b.length===C.length&&b!==C&&this._coreService.triggerDataEvent(b,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const b=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),y=this._renderService.dimensions.css.cell.height,x=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,_=b*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=_+"px",this._compositionView.style.top=x+"px",this._compositionView.style.height=y+"px",this._compositionView.style.lineHeight=y+"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=_+"px",this._textarea.style.top=x+"px",this._textarea.style.width=Math.max(j.width,1)+"px",this._textarea.style.height=Math.max(j.height,1)+"px",this._textarea.style.lineHeight=j.height+"px"}C||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=E=f([g(2,v.IBufferService),g(3,v.IOptionsService),g(4,v.ICoreService),g(5,m.IRenderService)],E)},9806:(p,l)=>{function h(f,g,m){const v=m.getBoundingClientRect(),S=f.getComputedStyle(m),E=parseInt(S.getPropertyValue("padding-left")),C=parseInt(S.getPropertyValue("padding-top"));return[g.clientX-v.left-E,g.clientY-v.top-C]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=h,l.getCoords=function(f,g,m,v,S,E,C,b,y){if(!E)return;const x=h(f,g,m);return x?(x[0]=Math.ceil((x[0]+(y?C/2:0))/C),x[1]=Math.ceil(x[1]/b),x[0]=Math.min(Math.max(x[0],1),v+(y?1:0)),x[1]=Math.min(Math.max(x[1],1),S),x):void 0}},9504:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const f=h(2584);function g(b,y,x,_){const j=b-m(b,x),A=y-m(y,x),N=Math.abs(j-A)-(function(L,T,I){let z=0;const V=L-m(L,I),Y=T-m(T,I);for(let $=0;$<Math.abs(V-Y);$++){const F=v(L,T)==="A"?-1:1,B=I.buffer.lines.get(V+F*$);B!=null&&B.isWrapped&&z++}return z})(b,y,x);return C(N,E(v(b,y),_))}function m(b,y){let x=0,_=y.buffer.lines.get(b),j=_==null?void 0:_.isWrapped;for(;j&&b>=0&&b<y.rows;)x++,_=y.buffer.lines.get(--b),j=_==null?void 0:_.isWrapped;return x}function v(b,y){return b>y?"A":"B"}function S(b,y,x,_,j,A){let N=b,L=y,T="";for(;N!==x||L!==_;)N+=j?1:-1,j&&N>A.cols-1?(T+=A.buffer.translateBufferLineToString(L,!1,b,N),N=0,b=0,L++):!j&&N<0&&(T+=A.buffer.translateBufferLineToString(L,!1,0,b+1),N=A.cols-1,b=N,L--);return T+A.buffer.translateBufferLineToString(L,!1,b,N)}function E(b,y){const x=y?"O":"[";return f.C0.ESC+x+b}function C(b,y){b=Math.floor(b);let x="";for(let _=0;_<b;_++)x+=y;return x}l.moveToCellSequence=function(b,y,x,_){const j=x.buffer.x,A=x.buffer.y;if(!x.buffer.hasScrollback)return(function(T,I,z,V,Y,$){return g(I,V,Y,$).length===0?"":C(S(T,I,T,I-m(I,Y),!1,Y).length,E("D",$))})(j,A,0,y,x,_)+g(A,y,x,_)+(function(T,I,z,V,Y,$){let F;F=g(I,V,Y,$).length>0?V-m(V,Y):I;const B=V,q=(function(X,J,R,D,O,W){let U;return U=g(R,D,O,W).length>0?D-m(D,O):J,X<R&&U<=D||X>=R&&U<D?"C":"D"})(T,I,z,V,Y,$);return C(S(T,F,z,B,q==="C",Y).length,E(q,$))})(j,A,b,y,x,_);let N;if(A===y)return N=j>b?"D":"C",C(Math.abs(j-b),E(N,_));N=A>y?"D":"C";const L=Math.abs(A-y);return C((function(T,I){return I.cols-T})(A>y?b:j,x)+(L-1)*x.cols+1+((A>y?j:b)-1),E(N,_))}},1296:function(p,l,h){var f=this&&this.__decorate||function($,F,B,q){var X,J=arguments.length,R=J<3?F:q===null?q=Object.getOwnPropertyDescriptor(F,B):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate($,F,B,q);else for(var D=$.length-1;D>=0;D--)(X=$[D])&&(R=(J<3?X(R):J>3?X(F,B,R):X(F,B))||R);return J>3&&R&&Object.defineProperty(F,B,R),R},g=this&&this.__param||function($,F){return function(B,q){F(B,q,$)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const m=h(3787),v=h(2550),S=h(2223),E=h(6171),C=h(6052),b=h(4725),y=h(8055),x=h(8460),_=h(844),j=h(2585),A="xterm-dom-renderer-owner-",N="xterm-rows",L="xterm-fg-",T="xterm-bg-",I="xterm-focus",z="xterm-selection";let V=1,Y=l.DomRenderer=class extends _.Disposable{constructor($,F,B,q,X,J,R,D,O,W,U,K,te){super(),this._terminal=$,this._document=F,this._element=B,this._screenElement=q,this._viewportElement=X,this._helperContainer=J,this._linkifier2=R,this._charSizeService=O,this._optionsService=W,this._bufferService=U,this._coreBrowserService=K,this._themeService=te,this._terminalClass=V++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(N),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(z),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,_.toDisposable)((()=>{this._element.classList.remove(A+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new v.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const $=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 B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const F=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=F,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 F=`${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}`;F+=`${this._terminalSelector} .${N} .xterm-dim { color: ${y.color.multiplyOpacity($.foreground,.5).css};}`,F+=`${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 B=`blink_underline_${this._terminalClass}`,q=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;F+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,F+=`@keyframes ${q} { 50% { box-shadow: none; }}`,F+=`@keyframes ${X} { 0% { background-color: ${$.cursor.css}; color: ${$.cursorAccent.css}; } 50% { background-color: inherit; color: ${$.cursor.css}; }}`,F+=`${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 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);}`,F+=`${this._terminalSelector} .${z} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${z} div { position: absolute; background-color: ${$.selectionBackgroundOpaque.css};}${this._terminalSelector} .${z} div { position: absolute; background-color: ${$.selectionInactiveBackgroundOpaque.css};}`;for(const[J,R]of $.ansi.entries())F+=`${this._terminalSelector} .${L}${J} { color: ${R.css}; }${this._terminalSelector} .${L}${J}.xterm-dim { color: ${y.color.multiplyOpacity(R,.5).css}; }${this._terminalSelector} .${T}${J} { background-color: ${R.css}; }`;F+=`${this._terminalSelector} .${L}${S.INVERTED_DEFAULT_COLOR} { color: ${y.color.opaque($.background).css}; }${this._terminalSelector} .${L}${S.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${y.color.multiplyOpacity(y.color.opaque($.background),.5).css}; }${this._terminalSelector} .${T}${S.INVERTED_DEFAULT_COLOR} { background-color: ${$.foreground.css}; }`,this._themeStyleElement.textContent=F}_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($,F){for(let B=this._rowElements.length;B<=F;B++){const q=this._document.createElement("div");this._rowContainer.appendChild(q),this._rowElements.push(q)}for(;this._rowElements.length>F;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize($,F){this._refreshRowElements($,F),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(I),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(I),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged($,F,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged($,F,B),this.renderRows(0,this._bufferService.rows-1),!$||!F)return;this._selectionRenderModel.update(this._terminal,$,F,B);const q=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,J=this._selectionRenderModel.viewportCappedStartRow,R=this._selectionRenderModel.viewportCappedEndRow;if(J>=this._bufferService.rows||R<0)return;const D=this._document.createDocumentFragment();if(B){const O=$[0]>F[0];D.appendChild(this._createSelectionElement(J,O?F[0]:$[0],O?$[0]:F[0],R-J+1))}else{const O=q===J?$[0]:0,W=J===X?F[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(J,O,W));const U=R-J-1;if(D.appendChild(this._createSelectionElement(J+1,0,this._bufferService.cols,U)),J!==R){const K=X===R?F[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(R,0,K))}}this._selectionContainer.appendChild(D)}_createSelectionElement($,F,B,q=1){const X=this._document.createElement("div"),J=F*this.dimensions.css.cell.width;let R=this.dimensions.css.cell.width*(B-F);return J+R>this.dimensions.css.canvas.width&&(R=this.dimensions.css.canvas.width-J),X.style.height=q*this.dimensions.css.cell.height+"px",X.style.top=$*this.dimensions.css.cell.height+"px",X.style.left=`${J}px`,X.style.width=`${R}px`,X}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const $ of this._rowElements)$.replaceChildren()}renderRows($,F){const B=this._bufferService.buffer,q=B.ybase+B.y,X=Math.min(B.x,this._bufferService.cols-1),J=this._optionsService.rawOptions.cursorBlink,R=this._optionsService.rawOptions.cursorStyle,D=this._optionsService.rawOptions.cursorInactiveStyle;for(let O=$;O<=F;O++){const W=O+B.ydisp,U=this._rowElements[O],K=B.lines.get(W);if(!U||!K)break;U.replaceChildren(...this._rowFactory.createRow(K,W,W===q,R,D,X,J,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($,F,B,q,X,J){B<0&&($=0),q<0&&(F=0);const R=this._bufferService.rows-1;B=Math.max(Math.min(B,R),0),q=Math.max(Math.min(q,R),0),X=Math.min(X,this._bufferService.cols);const D=this._bufferService.buffer,O=D.ybase+D.y,W=Math.min(D.x,X-1),U=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,te=this._optionsService.rawOptions.cursorInactiveStyle;for(let Q=B;Q<=q;++Q){const Z=Q+D.ydisp,H=this._rowElements[Q],se=D.lines.get(Z);if(!H||!se)break;H.replaceChildren(...this._rowFactory.createRow(se,Z,Z===O,K,te,W,U,this.dimensions.css.cell.width,this._widthCache,J?Q===B?$:0:-1,J?(Q===q?F:X)-1:-1))}}};l.DomRenderer=Y=f([g(7,j.IInstantiationService),g(8,b.ICharSizeService),g(9,j.IOptionsService),g(10,j.IBufferService),g(11,b.ICoreBrowserService),g(12,b.IThemeService)],Y)},3787:function(p,l,h){var f=this&&this.__decorate||function(N,L,T,I){var z,V=arguments.length,Y=V<3?L:I===null?I=Object.getOwnPropertyDescriptor(L,T):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(N,L,T,I);else for(var $=N.length-1;$>=0;$--)(z=N[$])&&(Y=(V<3?z(Y):V>3?z(L,T,Y):z(L,T))||Y);return V>3&&Y&&Object.defineProperty(L,T,Y),Y},g=this&&this.__param||function(N,L){return function(T,I){L(T,I,N)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const m=h(2223),v=h(643),S=h(511),E=h(2585),C=h(8055),b=h(4725),y=h(4269),x=h(6171),_=h(3734);let j=l.DomRendererRowFactory=class{constructor(N,L,T,I,z,V,Y){this._document=N,this._characterJoinerService=L,this._optionsService=T,this._coreBrowserService=I,this._coreService=z,this._decorationService=V,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,I,z,V,Y,$,F,B,q){const X=[],J=this._characterJoinerService.getJoinedCharacters(L),R=this._themeService.colors;let D,O=N.getNoBgTrimmedLength();T&&O<V+1&&(O=V+1);let W=0,U="",K=0,te=0,Q=0,Z=!1,H=0,se=!1,ie=0;const ge=[],ve=B!==-1&&q!==-1;for(let Ee=0;Ee<O;Ee++){N.loadCell(Ee,this._workCell);let De=this._workCell.getWidth();if(De===0)continue;let Re=!1,$e=Ee,we=this._workCell;if(J.length>0&&Ee===J[0][0]){Re=!0;const ke=J.shift();we=new y.JoinedCellData(this._workCell,N.translateToString(!0,ke[0],ke[1]),ke[1]-ke[0]),$e=ke[1]-1,De=we.getWidth()}const lt=this._isCellInSelection(Ee,L),ht=T&&Ee===V,pe=ve&&Ee>=B&&Ee<=q;let Me=!1;this._decorationService.forEachDecorationAtCell(Ee,L,void 0,(ke=>{Me=!0}));let nt=we.getChars()||v.WHITESPACE_CELL_CHAR;if(nt===" "&&(we.isUnderline()||we.isOverline())&&(nt=" "),ie=De*$-F.get(nt,we.isBold(),we.isItalic()),D){if(W&&(lt&&se||!lt&&!se&&we.bg===K)&&(lt&&se&&R.selectionForeground||we.fg===te)&&we.extended.ext===Q&&pe===Z&&ie===H&&!ht&&!Re&&!Me){we.isInvisible()?U+=v.WHITESPACE_CELL_CHAR:U+=nt,W++;continue}W&&(D.textContent=U),D=this._document.createElement("span"),W=0,U=""}else D=this._document.createElement("span");if(K=we.bg,te=we.fg,Q=we.extended.ext,Z=pe,H=ie,se=lt,Re&&V>=Ee&&V<=$e&&(V=Ee),!this._coreService.isCursorHidden&&ht&&this._coreService.isCursorInitialized){if(ge.push("xterm-cursor"),this._coreBrowserService.isFocused)Y&&ge.push("xterm-cursor-blink"),ge.push(I==="bar"?"xterm-cursor-bar":I==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(z)switch(z){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(we.isBold()&&ge.push("xterm-bold"),we.isItalic()&&ge.push("xterm-italic"),we.isDim()&&ge.push("xterm-dim"),U=we.isInvisible()?v.WHITESPACE_CELL_CHAR:we.getChars()||v.WHITESPACE_CELL_CHAR,we.isUnderline()&&(ge.push(`xterm-underline-${we.extended.underlineStyle}`),U===" "&&(U=" "),!we.isUnderlineColorDefault()))if(we.isUnderlineColorRGB())D.style.textDecorationColor=`rgb(${_.AttributeData.toColorRGB(we.getUnderlineColor()).join(",")})`;else{let ke=we.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&we.isBold()&&ke<8&&(ke+=8),D.style.textDecorationColor=R.ansi[ke].css}we.isOverline()&&(ge.push("xterm-overline"),U===" "&&(U=" ")),we.isStrikethrough()&&ge.push("xterm-strikethrough"),pe&&(D.style.textDecoration="underline");let Ke=we.getFgColor(),Ye=we.getFgColorMode(),ct=we.getBgColor(),de=we.getBgColorMode();const be=!!we.isInverse();if(be){const ke=Ke;Ke=ct,ct=ke;const Pe=Ye;Ye=de,de=Pe}let Te,He,ae,je=!1;switch(this._decorationService.forEachDecorationAtCell(Ee,L,void 0,(ke=>{ke.options.layer!=="top"&&je||(ke.backgroundColorRGB&&(de=50331648,ct=ke.backgroundColorRGB.rgba>>8&16777215,Te=ke.backgroundColorRGB),ke.foregroundColorRGB&&(Ye=50331648,Ke=ke.foregroundColorRGB.rgba>>8&16777215,He=ke.foregroundColorRGB),je=ke.options.layer==="top")})),!je&<&&(Te=this._coreBrowserService.isFocused?R.selectionBackgroundOpaque:R.selectionInactiveBackgroundOpaque,ct=Te.rgba>>8&16777215,de=50331648,je=!0,R.selectionForeground&&(Ye=50331648,Ke=R.selectionForeground.rgba>>8&16777215,He=R.selectionForeground)),je&&ge.push("xterm-decoration-top"),de){case 16777216:case 33554432:ae=R.ansi[ct],ge.push(`xterm-bg-${ct}`);break;case 50331648:ae=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?(ae=R.foreground,ge.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):ae=R.background}switch(Te||we.isDim()&&(Te=C.color.multiplyOpacity(ae,.5)),Ye){case 16777216:case 33554432:we.isBold()&&Ke<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ke+=8),this._applyMinimumContrast(D,ae,R.ansi[Ke],we,Te,void 0)||ge.push(`xterm-fg-${Ke}`);break;case 50331648:const ke=C.channels.toColor(Ke>>16&255,Ke>>8&255,255&Ke);this._applyMinimumContrast(D,ae,ke,we,Te,He)||this._addStyle(D,`color:#${A(Ke.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(D,ae,R.foreground,we,Te,He)||be&&ge.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}ge.length&&(D.className=ge.join(" "),ge.length=0),ht||Re||Me?D.textContent=U:W++,ie!==this.defaultSpacing&&(D.style.letterSpacing=`${ie}px`),X.push(D),Ee=$e}return D&&W&&(D.textContent=U),X}_applyMinimumContrast(N,L,T,I,z,V){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(I.getCode()))return!1;const Y=this._getContrastCache(I);let $;if(z||V||($=Y.getColor(L.rgba,T.rgba)),$===void 0){const F=this._optionsService.rawOptions.minimumContrastRatio/(I.isDim()?2:1);$=C.color.ensureContrastRatio(z||L,V||T,F),Y.setColor((z||L).rgba,(V||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,I=this._selectionEnd;return!(!T||!I)&&(this._columnSelectMode?T[0]<=I[0]?N>=T[0]&&L>=T[1]&&N<I[0]&&L<=I[1]:N<T[0]&&L>=T[1]&&N>=I[0]&&L<=I[1]:L>T[1]&&L<I[1]||T[1]===I[1]&&L===T[1]&&N>=T[0]&&N<I[0]||T[1]<I[1]&&L===I[1]&&N<I[0]||T[1]<I[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,b.ICharacterJoinerService),g(2,E.IOptionsService),g(3,b.ICoreBrowserService),g(4,E.ICoreService),g(5,E.IDecorationService),g(6,b.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 v=h.createElement("span");v.classList.add("xterm-char-measure-element"),v.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,v,S],this._container.appendChild(g),this._container.appendChild(m),this._container.appendChild(v),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 v=h;f&&(v+="B"),g&&(v+="I");let S=this._holey.get(v);if(S===void 0){let E=0;f&&(E|=1),g&&(E|=2),S=this._measure(h,E),S>0&&this._holey.set(v,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,v,S){return m===1&&v>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,v=0){return(g-(2*Math.round(m)-v))%(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,v,S=!1){if(this.selectionStart=m,this.selectionEnd=v,!m||!v||m[0]===v[0]&&m[1]===v[1])return void this.clear();const E=g.buffers.active.ydisp,C=m[1]-E,b=v[1]-E,y=Math.max(C,0),x=Math.min(b,g.rows-1);y>=g.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=S,this.viewportStartRow=C,this.viewportEndRow=b,this.viewportCappedStartRow=y,this.viewportCappedEndRow=x,this.startCol=m[0],this.endCol=v[0])}isCellSelected(g,m,v){return!!this.hasSelection&&(v-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&v>=this.viewportCappedStartRow&&m<this.endCol&&v<=this.viewportCappedEndRow:m<this.startCol&&v>=this.viewportCappedStartRow&&m>=this.endCol&&v<=this.viewportCappedEndRow:v>this.viewportStartRow&&v<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&v===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportStartRow&&m>=this.startCol)}}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(x,_,j,A){var N,L=arguments.length,T=L<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,_,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(L<3?N(T):L>3?N(_,j,T):N(_,j))||T);return L>3&&T&&Object.defineProperty(_,j,T),T},g=this&&this.__param||function(x,_){return function(j,A){_(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const m=h(2585),v=h(8460),S=h(844);let E=l.CharSizeService=class extends S.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,_,j){super(),this._optionsService=j,this.width=0,this.height=0,this._onCharSizeChange=this.register(new v.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new y(this._optionsService))}catch{this._measureStrategy=this.register(new b(x,_,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};l.CharSizeService=E=f([g(2,m.IOptionsService)],E);class C extends S.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(_,j){_!==void 0&&_>0&&j!==void 0&&j>0&&(this._result.width=_,this._result.height=j)}}class b extends C{constructor(_,j,A){super(),this._document=_,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 y extends C{constructor(_){super(),this._optionsService=_,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 _=this._ctx.measureText("W");return this._validateAndSet(_.width,_.fontBoundingBoxAscent+_.fontBoundingBoxDescent),this._result}}},4269:function(p,l,h){var f=this&&this.__decorate||function(y,x,_,j){var A,N=arguments.length,L=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,_):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(y,x,_,j);else for(var T=y.length-1;T>=0;T--)(A=y[T])&&(L=(N<3?A(L):N>3?A(x,_,L):A(x,_))||L);return N>3&&L&&Object.defineProperty(x,_,L),L},g=this&&this.__param||function(y,x){return function(_,j){x(_,j,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const m=h(3734),v=h(643),S=h(511),E=h(2585);class C extends m.AttributeData{constructor(x,_,j){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=_,this._width=j}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=C;let b=l.CharacterJoinerService=class cb{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new S.CellData}register(x){const _={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(_),_.id}deregister(x){for(let _=0;_<this._characterJoiners.length;_++)if(this._characterJoiners[_].id===x)return this._characterJoiners.splice(_,1),!0;return!1}getJoinedCharacters(x){if(this._characterJoiners.length===0)return[];const _=this._bufferService.buffer.lines.get(x);if(!_||_.length===0)return[];const j=[],A=_.translateToString(!0);let N=0,L=0,T=0,I=_.getFg(0),z=_.getBg(0);for(let V=0;V<_.getTrimmedLength();V++)if(_.loadCell(V,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==I||this._workCell.bg!==z){if(V-N>1){const Y=this._getJoinedRanges(A,T,L,_,N);for(let $=0;$<Y.length;$++)j.push(Y[$])}N=V,T=L,I=this._workCell.fg,z=this._workCell.bg}L+=this._workCell.getChars().length||v.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const V=this._getJoinedRanges(A,T,L,_,N);for(let Y=0;Y<V.length;Y++)j.push(V[Y])}return j}_getJoinedRanges(x,_,j,A,N){const L=x.substring(_,j);let T=[];try{T=this._characterJoiners[0].handler(L)}catch(I){console.error(I)}for(let I=1;I<this._characterJoiners.length;I++)try{const z=this._characterJoiners[I].handler(L);for(let V=0;V<z.length;V++)cb._mergeRanges(T,z[V])}catch(z){console.error(z)}return this._stringRangesToCellRanges(T,A,N),T}_stringRangesToCellRanges(x,_,j){let A=0,N=!1,L=0,T=x[A];if(T){for(let I=j;I<this._bufferService.cols;I++){const z=_.getWidth(I),V=_.getString(I).length||v.WHITESPACE_CELL_CHAR.length;if(z!==0){if(!N&&T[0]<=L&&(T[0]=I,N=!0),T[1]<=L){if(T[1]=I,T=x[++A],!T)break;T[0]<=L?(T[0]=I,N=!0):N=!1}L+=V}}T&&(T[1]=this._bufferService.cols)}}static _mergeRanges(x,_){let j=!1;for(let A=0;A<x.length;A++){const N=x[A];if(j){if(_[1]<=N[0])return x[A-1][1]=_[1],x;if(_[1]<=N[1])return x[A-1][1]=Math.max(_[1],N[1]),x.splice(A,1),x;x.splice(A,1),A--}else{if(_[1]<=N[0])return x.splice(A,0,_),x;if(_[1]<=N[1])return N[0]=Math.min(_[0],N[0]),x;_[0]<N[1]&&(N[0]=Math.min(_[0],N[0]),j=!0)}}return j?x[x.length-1][1]=_[1]:x.push(_),x}};l.CharacterJoinerService=b=f([g(0,E.IBufferService)],b)},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 v extends f.Disposable{constructor(C,b,y){super(),this._textarea=C,this._window=b,this.mainDocument=y,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((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(C){this._window!==C&&(this._window=C,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}l.CoreBrowserService=v;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(v){return this.linkProviders.push(v),{dispose:()=>{const S=this.linkProviders.indexOf(v);S!==-1&&this.linkProviders.splice(S,1)}}}}l.LinkProviderService=g},8934:function(p,l,h){var f=this&&this.__decorate||function(E,C,b,y){var x,_=arguments.length,j=_<3?C:y===null?y=Object.getOwnPropertyDescriptor(C,b):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(E,C,b,y);else for(var A=E.length-1;A>=0;A--)(x=E[A])&&(j=(_<3?x(j):_>3?x(C,b,j):x(C,b))||j);return _>3&&j&&Object.defineProperty(C,b,j),j},g=this&&this.__param||function(E,C){return function(b,y){C(b,y,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const m=h(4725),v=h(9806);let S=l.MouseService=class{constructor(E,C){this._renderService=E,this._charSizeService=C}getCoords(E,C,b,y,x){return(0,v.getCoords)(window,E,C,b,y,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(E,C){const b=(0,v.getCoordsRelativeToElement)(window,E,C);if(this._charSizeService.hasValidSize)return b[0]=Math.min(Math.max(b[0],0),this._renderService.dimensions.css.canvas.width-1),b[1]=Math.min(Math.max(b[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(b[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(b[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(b[0]),y:Math.floor(b[1])}}};l.MouseService=S=f([g(0,m.IRenderService),g(1,m.ICharSizeService)],S)},3230:function(p,l,h){var f=this&&this.__decorate||function(x,_,j,A){var N,L=arguments.length,T=L<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,_,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(L<3?N(T):L>3?N(_,j,T):N(_,j))||T);return L>3&&T&&Object.defineProperty(_,j,T),T},g=this&&this.__param||function(x,_){return function(j,A){_(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const m=h(6193),v=h(4725),S=h(8460),E=h(844),C=h(7226),b=h(2585);let y=l.RenderService=class extends E.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,_,j,A,N,L,T,I){super(),this._rowCount=x,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(((z,V)=>this._renderRows(z,V)),T),this.register(this._renderDebouncer),this.register(T.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(L.onResize((()=>this._fullRefresh()))),this.register(L.buffers.onBufferActivate((()=>{var z;return(z=this._renderer.value)==null?void 0:z.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(I.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(T.window,_),this.register(T.onWindowChange((z=>this._registerIntersectionObserver(z,_))))}_registerIntersectionObserver(x,_){if("IntersectionObserver"in x){const j=new x.IntersectionObserver((A=>this._handleIntersectionChange(A[A.length-1])),{threshold:0});j.observe(_),this._observerDisposable.value=(0,E.toDisposable)((()=>j.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(x,_,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,_,this._rowCount))}_renderRows(x,_){this._renderer.value&&(x=Math.min(x,this._rowCount-1),_=Math.min(_,this._rowCount-1),this._renderer.value.renderRows(x,_),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:x,end:_}),this._onRender.fire({start:x,end:_}),this._isNextRenderRedrawOnly=!0)}resize(x,_){this._rowCount=_,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((_=>this.refreshRows(_.start,_.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,_;this._renderer.value&&((_=(x=this._renderer.value).clearTextureAtlas)==null||_.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,_){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(x,_)})):this._renderer.value.handleResize(x,_),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,_,j){var A;this._selectionState.start=x,this._selectionState.end=_,this._selectionState.columnSelectMode=j,(A=this._renderer.value)==null||A.handleSelectionChanged(x,_,j)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};l.RenderService=y=f([g(2,b.IOptionsService),g(3,v.ICharSizeService),g(4,b.IDecorationService),g(5,b.IBufferService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],y)},9312:function(p,l,h){var f=this&&this.__decorate||function(T,I,z,V){var Y,$=arguments.length,F=$<3?I:V===null?V=Object.getOwnPropertyDescriptor(I,z):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(T,I,z,V);else for(var B=T.length-1;B>=0;B--)(Y=T[B])&&(F=($<3?Y(F):$>3?Y(I,z,F):Y(I,z))||F);return $>3&&F&&Object.defineProperty(I,z,F),F},g=this&&this.__param||function(T,I){return function(z,V){I(z,V,T)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const m=h(9806),v=h(9504),S=h(456),E=h(4725),C=h(8460),b=h(844),y=h(6114),x=h(4841),_=h(511),j=h(2585),A=" ",N=new RegExp(A,"g");let L=l.SelectionService=class extends b.Disposable{constructor(T,I,z,V,Y,$,F,B,q){super(),this._element=T,this._screenElement=I,this._linkifier=z,this._bufferService=V,this._coreService=Y,this._mouseService=$,this._optionsService=F,this._renderService=B,this._coreBrowserService=q,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new _.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new S.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,b.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!T||!I||T[0]===I[0]&&T[1]===I[1])}get selectionText(){const T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;if(!T||!I)return"";const z=this._bufferService.buffer,V=[];if(this._activeSelectionMode===3){if(T[0]===I[0])return"";const Y=T[0]<I[0]?T[0]:I[0],$=T[0]<I[0]?I[0]:T[0];for(let F=T[1];F<=I[1];F++){const B=z.translateBufferLineToString(F,!0,Y,$);V.push(B)}}else{const Y=T[1]===I[1]?I[0]:void 0;V.push(z.translateBufferLineToString(T[1],!0,T[0],Y));for(let $=T[1]+1;$<=I[1]-1;$++){const F=z.lines.get($),B=z.translateBufferLineToString($,!0);F!=null&&F.isWrapped?V[V.length-1]+=B:V.push(B)}if(T[1]!==I[1]){const $=z.lines.get(I[1]),F=z.translateBufferLineToString(I[1],!0,0,I[0]);$&&$.isWrapped?V[V.length-1]+=F:V.push(F)}}return V.map((Y=>Y.replace(N," "))).join(y.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()))),y.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 I=this._getMouseBufferCoords(T),z=this._model.finalSelectionStart,V=this._model.finalSelectionEnd;return!!(z&&V&&I)&&this._areCoordsInSelection(I,z,V)}isCellInSelection(T,I){const z=this._model.finalSelectionStart,V=this._model.finalSelectionEnd;return!(!z||!V)&&this._areCoordsInSelection([T,I],z,V)}_areCoordsInSelection(T,I,z){return T[1]>I[1]&&T[1]<z[1]||I[1]===z[1]&&T[1]===I[1]&&T[0]>=I[0]&&T[0]<z[0]||I[1]<z[1]&&T[1]===z[1]&&T[0]<z[0]||I[1]<z[1]&&T[1]===I[1]&&T[0]>=I[0]}_selectWordAtCursor(T,I){var Y,$;const z=($=(Y=this._linkifier.currentLink)==null?void 0:Y.link)==null?void 0:$.range;if(z)return this._model.selectionStart=[z.start.x-1,z.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(z,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const V=this._getMouseBufferCoords(T);return!!V&&(this._selectWordAt(V,I),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(T,I){this._model.clearSelection(),T=Math.max(T,0),I=Math.min(I,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,T],this._model.selectionEnd=[this._bufferService.cols,I],this.refresh(),this._onSelectionChange.fire()}_handleTrim(T){this._model.handleTrim(T)&&this.refresh()}_getMouseBufferCoords(T){const I=this._mouseService.getCoords(T,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(I)return I[0]--,I[1]--,I[1]+=this._bufferService.buffer.ydisp,I}_getMouseEventScrollAmount(T){let I=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,T,this._screenElement)[1];const z=this._renderService.dimensions.css.canvas.height;return I>=0&&I<=z?0:(I>z&&(I-=z),I=Math.min(Math.max(I,-50),50),I/=50,I/Math.abs(I)+Math.round(14*I))}shouldForceSelection(T){return y.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 I=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);I&&I.length!==this._model.selectionStart[0]&&I.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(T){this._selectWordAtCursor(T,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(T){const I=this._getMouseBufferCoords(T);I&&(this._activeSelectionMode=2,this._selectLineAt(I[1]))}shouldColumnSelect(T){return T.altKey&&!(y.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(T){if(T.stopImmediatePropagation(),!this._model.selectionStart)return;const I=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 z=this._bufferService.buffer;if(this._model.selectionEnd[1]<z.lines.length){const V=z.lines.get(this._model.selectionEnd[1]);V&&V.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}I&&I[0]===this._model.selectionEnd[0]&&I[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 I=T.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&I<500&&T.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const z=this._mouseService.getCoords(T,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(z&&z[0]!==void 0&&z[1]!==void 0){const V=(0,v.moveToCellSequence)(z[0]-1,z[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(V,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd,z=!(!T||!I||T[0]===I[0]&&T[1]===I[1]);z?T&&I&&(this._oldSelectionStart&&this._oldSelectionEnd&&T[0]===this._oldSelectionStart[0]&&T[1]===this._oldSelectionStart[1]&&I[0]===this._oldSelectionEnd[0]&&I[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(T,I,z)):this._oldHasSelection&&this._fireOnSelectionChange(T,I,z)}_fireOnSelectionChange(T,I,z){this._oldSelectionStart=T,this._oldSelectionEnd=I,this._oldHasSelection=z,this._onSelectionChange.fire()}_handleBufferActivate(T){this.clearSelection(),this._trimListener.dispose(),this._trimListener=T.activeBuffer.lines.onTrim((I=>this._handleTrim(I)))}_convertViewportColToCharacterIndex(T,I){let z=I;for(let V=0;I>=V;V++){const Y=T.loadCell(V,this._workCell).getChars().length;this._workCell.getWidth()===0?z--:Y>1&&I!==V&&(z+=Y-1)}return z}setSelection(T,I,z){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[T,I],this._model.selectionStartLength=z,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(T){this._isClickInSelection(T)||(this._selectWordAtCursor(T,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(T,I,z=!0,V=!0){if(T[0]>=this._bufferService.cols)return;const Y=this._bufferService.buffer,$=Y.lines.get(T[1]);if(!$)return;const F=Y.translateBufferLineToString(T[1],!1);let B=this._convertViewportColToCharacterIndex($,T[0]),q=B;const X=T[0]-B;let J=0,R=0,D=0,O=0;if(F.charAt(B)===" "){for(;B>0&&F.charAt(B-1)===" ";)B--;for(;q<F.length&&F.charAt(q+1)===" ";)q++}else{let K=T[0],te=T[0];$.getWidth(K)===0&&(J++,K--),$.getWidth(te)===2&&(R++,te++);const Q=$.getString(te).length;for(Q>1&&(O+=Q-1,q+=Q-1);K>0&&B>0&&!this._isCharWordSeparator($.loadCell(K-1,this._workCell));){$.loadCell(K-1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===0?(J++,K--):Z>1&&(D+=Z-1,B-=Z-1),B--,K--}for(;te<$.length&&q+1<F.length&&!this._isCharWordSeparator($.loadCell(te+1,this._workCell));){$.loadCell(te+1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===2?(R++,te++):Z>1&&(O+=Z-1,q+=Z-1),q++,te++}}q++;let W=B+X-J+D,U=Math.min(this._bufferService.cols,q-B+J+R-D-O);if(I||F.slice(B,q).trim()!==""){if(z&&W===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;W-=Q,U+=Q}}}if(V&&W+U===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&&(U+=te.length)}}return{start:W,length:U}}}_selectWordAt(T,I){const z=this._getWordAt(T,I);if(z){for(;z.start<0;)z.start+=this._bufferService.cols,T[1]--;this._model.selectionStart=[z.start,T[1]],this._model.selectionStartLength=z.length}}_selectToWordAt(T){const I=this._getWordAt(T,!0);if(I){let z=T[1];for(;I.start<0;)I.start+=this._bufferService.cols,z--;if(!this._model.areSelectionValuesReversed())for(;I.start+I.length>this._bufferService.cols;)I.length-=this._bufferService.cols,z++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?I.start:I.start+I.length,z]}}_isCharWordSeparator(T){return T.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(T.getChars())>=0}_selectLineAt(T){const I=this._bufferService.buffer.getWrappedRangeForLine(T),z={start:{x:0,y:I.first},end:{x:this._bufferService.cols-1,y:I.last}};this._model.selectionStart=[0,I.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(z,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,I,z){var V,Y=arguments.length,$=Y<3?T:z===null?z=Object.getOwnPropertyDescriptor(T,I):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(L,T,I,z);else for(var F=L.length-1;F>=0;F--)(V=L[F])&&($=(Y<3?V($):Y>3?V(T,I,$):V(T,I))||$);return Y>3&&$&&Object.defineProperty(T,I,$),$},g=this&&this.__param||function(L,T){return function(I,z){T(I,z,L)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const m=h(7239),v=h(8055),S=h(8460),E=h(844),C=h(2585),b=v.css.toColor("#ffffff"),y=v.css.toColor("#000000"),x=v.css.toColor("#ffffff"),_=v.css.toColor("#000000"),j={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const L=[v.css.toColor("#2e3436"),v.css.toColor("#cc0000"),v.css.toColor("#4e9a06"),v.css.toColor("#c4a000"),v.css.toColor("#3465a4"),v.css.toColor("#75507b"),v.css.toColor("#06989a"),v.css.toColor("#d3d7cf"),v.css.toColor("#555753"),v.css.toColor("#ef2929"),v.css.toColor("#8ae234"),v.css.toColor("#fce94f"),v.css.toColor("#729fcf"),v.css.toColor("#ad7fa8"),v.css.toColor("#34e2e2"),v.css.toColor("#eeeeec")],T=[0,95,135,175,215,255];for(let I=0;I<216;I++){const z=T[I/36%6|0],V=T[I/6%6|0],Y=T[I%6];L.push({css:v.channels.toCss(z,V,Y),rgba:v.channels.toRgba(z,V,Y)})}for(let I=0;I<24;I++){const z=8+10*I;L.push({css:v.channels.toCss(z,z,z),rgba:v.channels.toRgba(z,z,z)})}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:b,background:y,cursor:x,cursorAccent:_,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:v.color.blend(y,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:v.color.blend(y,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,b),T.background=N(L.background,y),T.cursor=N(L.cursor,x),T.cursorAccent=N(L.cursorAccent,_),T.selectionBackgroundTransparent=N(L.selectionBackground,j),T.selectionBackgroundOpaque=v.color.blend(T.background,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundTransparent=N(L.selectionInactiveBackground,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundOpaque=v.color.blend(T.background,T.selectionInactiveBackgroundTransparent),T.selectionForeground=L.selectionForeground?N(L.selectionForeground,v.NULL_COLOR):void 0,T.selectionForeground===v.NULL_COLOR&&(T.selectionForeground=void 0),v.color.isOpaque(T.selectionBackgroundTransparent)&&(T.selectionBackgroundTransparent=v.color.opacity(T.selectionBackgroundTransparent,.3)),v.color.isOpaque(T.selectionInactiveBackgroundTransparent)&&(T.selectionInactiveBackgroundTransparent=v.color.opacity(T.selectionInactiveBackgroundTransparent,.3)),T.ansi=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 I=Math.min(T.ansi.length-16,L.extendedAnsi.length);for(let z=0;z<I;z++)T.ansi[z+16]=N(L.extendedAnsi[z],l.DEFAULT_ANSI_COLORS[z+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 v.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 b=S;b<this._length-E;b++)this._array[this._getCyclicIndex(b)]=this._array[this._getCyclicIndex(b+E)];this._length-=E,this.onDeleteEmitter.fire({index:S,amount:E})}for(let b=this._length-1;b>=S;b--)this._array[this._getCyclicIndex(b+C.length)]=this._array[this._getCyclicIndex(b)];for(let b=0;b<C.length;b++)this._array[this._getCyclicIndex(S+b)]=C[b];if(C.length&&this.onInsertEmitter.fire({index:S,amount:C.length}),this._length+C.length>this._maxLength){const b=this._length+C.length-this._maxLength;this._startIndex+=b,this._length=this._maxLength,this.onTrimEmitter.fire(b)}else this._length+=C.length}trimStart(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 y=E-1;y>=0;y--)this.set(S+y+C,this.get(S+y));const b=S+E+C-this._length;if(b>0)for(this._length+=b;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let b=0;b<E;b++)this.set(S+b+C,this.get(S+b))}}_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 v in f)m[v]=g<=1?f[v]:f[v]&&h(f[v],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 v,S,E,C,b;function y(_){const j=_.toString(16);return j.length<2?"0"+j:j}function x(_,j){return _<j?(j+.05)/(_+.05):(_+.05)/(j+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(_){_.toCss=function(j,A,N,L){return L!==void 0?`#${y(j)}${y(A)}${y(N)}${y(L)}`:`#${y(j)}${y(A)}${y(N)}`},_.toRgba=function(j,A,N,L=255){return(j<<24|A<<16|N<<8|L)>>>0},_.toColor=function(j,A,N,L){return{css:_.toCss(j,A,N,L),rgba:_.toRgba(j,A,N,L)}}})(v||(l.channels=v={})),(function(_){function j(A,N){return m=Math.round(255*N),[h,f,g]=b.toChannels(A.rgba),{css:v.toCss(h,f,g,m),rgba:v.toRgba(h,f,g,m)}}_.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,I=N.rgba>>8&255,z=A.rgba>>24&255,V=A.rgba>>16&255,Y=A.rgba>>8&255;return h=z+Math.round((L-z)*m),f=V+Math.round((T-V)*m),g=Y+Math.round((I-Y)*m),{css:v.toCss(h,f,g),rgba:v.toRgba(h,f,g)}},_.isOpaque=function(A){return(255&A.rgba)==255},_.ensureContrastRatio=function(A,N,L){const T=b.ensureContrastRatio(A.rgba,N.rgba,L);if(T)return v.toColor(T>>24&255,T>>16&255,T>>8&255)},_.opaque=function(A){const N=(255|A.rgba)>>>0;return[h,f,g]=b.toChannels(N),{css:v.toCss(h,f,g),rgba:N}},_.opacity=j,_.multiplyOpacity=function(A,N){return m=255&A.rgba,j(A,m*N/255)},_.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(S||(l.color=S={})),(function(_){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{}_.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),v.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),v.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]))),v.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:v.toRgba(h,f,g,m),css:N}}})(E||(l.css=E={})),(function(_){function j(A,N,L){const T=A/255,I=N/255,z=L/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.7152*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))+.0722*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))}_.relativeLuminance=function(A){return j(A>>16&255,A>>8&255,255&A)},_.relativeLuminance2=j})(C||(l.rgb=C={})),(function(_){function j(N,L,T){const I=N>>24&255,z=N>>16&255,V=N>>8&255;let Y=L>>24&255,$=L>>16&255,F=L>>8&255,B=x(C.relativeLuminance2(Y,$,F),C.relativeLuminance2(I,z,V));for(;B<T&&(Y>0||$>0||F>0);)Y-=Math.max(0,Math.ceil(.1*Y)),$-=Math.max(0,Math.ceil(.1*$)),F-=Math.max(0,Math.ceil(.1*F)),B=x(C.relativeLuminance2(Y,$,F),C.relativeLuminance2(I,z,V));return(Y<<24|$<<16|F<<8|255)>>>0}function A(N,L,T){const I=N>>24&255,z=N>>16&255,V=N>>8&255;let Y=L>>24&255,$=L>>16&255,F=L>>8&255,B=x(C.relativeLuminance2(Y,$,F),C.relativeLuminance2(I,z,V));for(;B<T&&(Y<255||$<255||F<255);)Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),$=Math.min(255,$+Math.ceil(.1*(255-$))),F=Math.min(255,F+Math.ceil(.1*(255-F))),B=x(C.relativeLuminance2(Y,$,F),C.relativeLuminance2(I,z,V));return(Y<<24|$<<16|F<<8|255)>>>0}_.blend=function(N,L){if(m=(255&L)/255,m===1)return L;const T=L>>24&255,I=L>>16&255,z=L>>8&255,V=N>>24&255,Y=N>>16&255,$=N>>8&255;return h=V+Math.round((T-V)*m),f=Y+Math.round((I-Y)*m),g=$+Math.round((z-$)*m),v.toRgba(h,f,g)},_.ensureContrastRatio=function(N,L,T){const I=C.relativeLuminance(N>>8),z=C.relativeLuminance(L>>8);if(x(I,z)<T){if(z<I){const $=j(N,L,T),F=x(I,C.relativeLuminance($>>8));if(F<T){const B=A(N,L,T);return F>x(I,C.relativeLuminance(B>>8))?$:B}return $}const V=A(N,L,T),Y=x(I,C.relativeLuminance(V>>8));if(Y<T){const $=j(N,L,T);return Y>x(I,C.relativeLuminance($>>8))?V:$}return V}},_.reduceLuminance=j,_.increaseLuminance=A,_.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(b||(l.rgba=b={})),l.toPaddedHex=y,l.contrastRatio=x},8969:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const f=h(844),g=h(2585),m=h(4348),v=h(7866),S=h(744),E=h(7302),C=h(6975),b=h(8460),y=h(1753),x=h(1480),_=h(7994),j=h(9282),A=h(5435),N=h(5981),L=h(2660);let T=!1;class I extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event((V=>{var Y;(Y=this._onScrollApi)==null||Y.fire(V.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(V){for(const Y in V)this.optionsService.options[Y]=V[Y]}constructor(V){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new b.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new b.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new b.EventEmitter),this._instantiationService=new m.InstantiationService,this.optionsService=this.register(new E.OptionsService(V)),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(v.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(y.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(_.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,b.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,b.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,b.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,b.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((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,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(V,Y){this._writeBuffer.write(V,Y)}writeSync(V,Y){this._logService.logLevel<=g.LogLevelEnum.WARN&&!T&&(this._logService.warn("writeSync is unreliable and will be removed soon."),T=!0),this._writeBuffer.writeSync(V,Y)}input(V,Y=!0){this.coreService.triggerDataEvent(V,Y)}resize(V,Y){isNaN(V)||isNaN(Y)||(V=Math.max(V,S.MINIMUM_COLS),Y=Math.max(Y,S.MINIMUM_ROWS),this._bufferService.resize(V,Y))}scroll(V,Y=!1){this._bufferService.scroll(V,Y)}scrollLines(V,Y,$){this._bufferService.scrollLines(V,Y,$)}scrollPages(V){this.scrollLines(V*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(V){const Y=V-this._bufferService.buffer.ydisp;Y!==0&&this.scrollLines(Y)}registerEscHandler(V,Y){return this._inputHandler.registerEscHandler(V,Y)}registerDcsHandler(V,Y){return this._inputHandler.registerDcsHandler(V,Y)}registerCsiHandler(V,Y){return this._inputHandler.registerCsiHandler(V,Y)}registerOscHandler(V,Y){return this._inputHandler.registerOscHandler(V,Y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let V=!1;const Y=this.optionsService.rawOptions.windowsPty;Y&&Y.buildNumber!==void 0&&Y.buildNumber!==void 0?V=Y.backend==="conpty"&&Y.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(V=!0),V?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const V=[];V.push(this.onLineFeed(j.updateWindowsModeWrappedState.bind(null,this._bufferService))),V.push(this.registerCsiHandler({final:"H"},(()=>((0,j.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const Y of V)Y.dispose()}))}}}l.CoreTerminal=I},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(J,R,D,O){var W,U=arguments.length,K=U<3?R:O===null?O=Object.getOwnPropertyDescriptor(R,D):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(J,R,D,O);else for(var te=J.length-1;te>=0;te--)(W=J[te])&&(K=(U<3?W(K):U>3?W(R,D,K):W(R,D))||K);return U>3&&K&&Object.defineProperty(R,D,K),K},g=this&&this.__param||function(J,R){return function(D,O){R(D,O,J)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const m=h(2584),v=h(7116),S=h(2015),E=h(844),C=h(482),b=h(8437),y=h(8460),x=h(643),_=h(511),j=h(3734),A=h(2585),N=h(1480),L=h(6242),T=h(6351),I=h(5941),z={"(":0,")":1,"*":2,"+":3,"-":1,".":2},V=131072;function Y(J,R){if(J>24)return R.setWinLines||!1;switch(J){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(J){J[J.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",J[J.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})($||(l.WindowsOptionsReportType=$={}));let F=0;class B extends E.Disposable{getAttrData(){return this._curAttrData}constructor(R,D,O,W,U,K,te,Q,Z=new S.EscapeSequenceParser){super(),this._bufferService=R,this._charsetService=D,this._coreService=O,this._logService=W,this._optionsService=U,this._oscLinkService=K,this._coreMouseService=te,this._unicodeService=Q,this._parser=Z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new _.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new y.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new y.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new y.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new y.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new y.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new y.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new y.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new y.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new y.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new y.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new y.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new y.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 q(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((H=>this._activeBuffer=H.activeBuffer))),this._parser.setCsiHandlerFallback(((H,se)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(H),params:se.toArray()})})),this._parser.setEscHandlerFallback((H=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(H)})})),this._parser.setExecuteHandlerFallback((H=>{this._logService.debug("Unknown EXECUTE code: ",{code:H})})),this._parser.setOscHandlerFallback(((H,se,ie)=>{this._logService.debug("Unknown OSC code: ",{identifier:H,action:se,data:ie})})),this._parser.setDcsHandlerFallback(((H,se,ie)=>{se==="HOOK"&&(ie=ie.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(H),action:se,payload:ie})})),this._parser.setPrintHandler(((H,se,ie)=>this.print(H,se,ie))),this._parser.registerCsiHandler({final:"@"},(H=>this.insertChars(H))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(H=>this.scrollLeft(H))),this._parser.registerCsiHandler({final:"A"},(H=>this.cursorUp(H))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(H=>this.scrollRight(H))),this._parser.registerCsiHandler({final:"B"},(H=>this.cursorDown(H))),this._parser.registerCsiHandler({final:"C"},(H=>this.cursorForward(H))),this._parser.registerCsiHandler({final:"D"},(H=>this.cursorBackward(H))),this._parser.registerCsiHandler({final:"E"},(H=>this.cursorNextLine(H))),this._parser.registerCsiHandler({final:"F"},(H=>this.cursorPrecedingLine(H))),this._parser.registerCsiHandler({final:"G"},(H=>this.cursorCharAbsolute(H))),this._parser.registerCsiHandler({final:"H"},(H=>this.cursorPosition(H))),this._parser.registerCsiHandler({final:"I"},(H=>this.cursorForwardTab(H))),this._parser.registerCsiHandler({final:"J"},(H=>this.eraseInDisplay(H,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(H=>this.eraseInDisplay(H,!0))),this._parser.registerCsiHandler({final:"K"},(H=>this.eraseInLine(H,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(H=>this.eraseInLine(H,!0))),this._parser.registerCsiHandler({final:"L"},(H=>this.insertLines(H))),this._parser.registerCsiHandler({final:"M"},(H=>this.deleteLines(H))),this._parser.registerCsiHandler({final:"P"},(H=>this.deleteChars(H))),this._parser.registerCsiHandler({final:"S"},(H=>this.scrollUp(H))),this._parser.registerCsiHandler({final:"T"},(H=>this.scrollDown(H))),this._parser.registerCsiHandler({final:"X"},(H=>this.eraseChars(H))),this._parser.registerCsiHandler({final:"Z"},(H=>this.cursorBackwardTab(H))),this._parser.registerCsiHandler({final:"`"},(H=>this.charPosAbsolute(H))),this._parser.registerCsiHandler({final:"a"},(H=>this.hPositionRelative(H))),this._parser.registerCsiHandler({final:"b"},(H=>this.repeatPrecedingCharacter(H))),this._parser.registerCsiHandler({final:"c"},(H=>this.sendDeviceAttributesPrimary(H))),this._parser.registerCsiHandler({prefix:">",final:"c"},(H=>this.sendDeviceAttributesSecondary(H))),this._parser.registerCsiHandler({final:"d"},(H=>this.linePosAbsolute(H))),this._parser.registerCsiHandler({final:"e"},(H=>this.vPositionRelative(H))),this._parser.registerCsiHandler({final:"f"},(H=>this.hVPosition(H))),this._parser.registerCsiHandler({final:"g"},(H=>this.tabClear(H))),this._parser.registerCsiHandler({final:"h"},(H=>this.setMode(H))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(H=>this.setModePrivate(H))),this._parser.registerCsiHandler({final:"l"},(H=>this.resetMode(H))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(H=>this.resetModePrivate(H))),this._parser.registerCsiHandler({final:"m"},(H=>this.charAttributes(H))),this._parser.registerCsiHandler({final:"n"},(H=>this.deviceStatus(H))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(H=>this.deviceStatusPrivate(H))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(H=>this.softReset(H))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(H=>this.setCursorStyle(H))),this._parser.registerCsiHandler({final:"r"},(H=>this.setScrollRegion(H))),this._parser.registerCsiHandler({final:"s"},(H=>this.saveCursor(H))),this._parser.registerCsiHandler({final:"t"},(H=>this.windowOptions(H))),this._parser.registerCsiHandler({final:"u"},(H=>this.restoreCursor(H))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(H=>this.insertColumns(H))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(H=>this.deleteColumns(H))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(H=>this.selectProtected(H))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(H=>this.requestMode(H,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(H=>this.requestMode(H,!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((H=>(this.setTitle(H),this.setIconName(H),!0)))),this._parser.registerOscHandler(1,new L.OscHandler((H=>this.setIconName(H)))),this._parser.registerOscHandler(2,new L.OscHandler((H=>this.setTitle(H)))),this._parser.registerOscHandler(4,new L.OscHandler((H=>this.setOrReportIndexedColor(H)))),this._parser.registerOscHandler(8,new L.OscHandler((H=>this.setHyperlink(H)))),this._parser.registerOscHandler(10,new L.OscHandler((H=>this.setOrReportFgColor(H)))),this._parser.registerOscHandler(11,new L.OscHandler((H=>this.setOrReportBgColor(H)))),this._parser.registerOscHandler(12,new L.OscHandler((H=>this.setOrReportCursorColor(H)))),this._parser.registerOscHandler(104,new L.OscHandler((H=>this.restoreIndexedColor(H)))),this._parser.registerOscHandler(110,new L.OscHandler((H=>this.restoreFgColor(H)))),this._parser.registerOscHandler(111,new L.OscHandler((H=>this.restoreBgColor(H)))),this._parser.registerOscHandler(112,new L.OscHandler((H=>this.restoreCursorColor(H)))),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 H in v.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:H},(()=>this.selectCharset("("+H))),this._parser.registerEscHandler({intermediates:")",final:H},(()=>this.selectCharset(")"+H))),this._parser.registerEscHandler({intermediates:"*",final:H},(()=>this.selectCharset("*"+H))),this._parser.registerEscHandler({intermediates:"+",final:H},(()=>this.selectCharset("+"+H))),this._parser.registerEscHandler({intermediates:"-",final:H},(()=>this.selectCharset("-"+H))),this._parser.registerEscHandler({intermediates:".",final:H},(()=>this.selectCharset("."+H))),this._parser.registerEscHandler({intermediates:"/",final:H},(()=>this.selectCharset("/"+H)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((H=>(this._logService.error("Parsing error: ",H),H))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler(((H,se)=>this.requestStatusString(H,se))))}_preserveStack(R,D,O,W){this._parseStack.paused=!0,this._parseStack.cursorStartX=R,this._parseStack.cursorStartY=D,this._parseStack.decodedLength=O,this._parseStack.position=W}_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,W=this._activeBuffer.x,U=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;W=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,R.length>V&&(K=this._parseStack.position+V)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof R=="string"?` "${R}"`:` "${Array.prototype.map.call(R,(H=>String.fromCharCode(H))).join("")}"`),typeof R=="string"?R.split("").map((H=>H.charCodeAt(0))):R),this._parseBuffer.length<R.length&&this._parseBuffer.length<V&&(this._parseBuffer=new Uint32Array(Math.min(R.length,V))),te||this._dirtyRowTracker.clearRange(),R.length>V)for(let H=K;H<R.length;H+=V){const se=H+V<R.length?H+V:R.length,ie=typeof R=="string"?this._stringDecoder.decode(R.substring(H,se),this._parseBuffer):this._utf8Decoder.decode(R.subarray(H,se),this._parseBuffer);if(O=this._parser.parse(this._parseBuffer,ie))return this._preserveStack(W,U,ie,H),this._logSlowResolvingAsync(O),O}else if(!te){const H=typeof R=="string"?this._stringDecoder.decode(R,this._parseBuffer):this._utf8Decoder.decode(R,this._parseBuffer);if(O=this._parser.parse(this._parseBuffer,H))return this._preserveStack(W,U,H,0),this._logSlowResolvingAsync(O),O}this._activeBuffer.x===W&&this._activeBuffer.y===U||this._onCursorMove.fire();const Q=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Z=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Z<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Z,this._bufferService.rows-1),Math.min(Q,this._bufferService.rows-1))}print(R,D,O){let W,U;const K=this._charsetService.charset,te=this._optionsService.rawOptions.screenReaderMode,Q=this._bufferService.cols,Z=this._coreService.decPrivateModes.wraparound,H=this._coreService.modes.insertMode,se=this._curAttrData;let ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&O-D>0&&ie.getWidth(this._activeBuffer.x-1)===2&&ie.setCellFromCodepoint(this._activeBuffer.x-1,0,1,se);let ge=this._parser.precedingJoinState;for(let ve=D;ve<O;++ve){if(W=R[ve],W<127&&K){const $e=K[String.fromCharCode(W)];$e&&(W=$e.charCodeAt(0))}const Ee=this._unicodeService.charProperties(W,ge);U=N.UnicodeService.extractWidth(Ee);const De=N.UnicodeService.extractShouldJoin(Ee),Re=De?N.UnicodeService.extractWidth(ge):0;if(ge=Ee,te&&this._onA11yChar.fire((0,C.stringFromCodePoint)(W)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-Re>Q){if(Z){const $e=ie;let we=this._activeBuffer.x-Re;for(this._activeBuffer.x=Re,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),ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Re>0&&ie instanceof b.BufferLine&&ie.copyCellsFrom($e,we,0,Re,!1);we<Q;)$e.setCellFromCodepoint(we++,0,1,se)}else if(this._activeBuffer.x=Q-1,U===2)continue}if(De&&this._activeBuffer.x){const $e=ie.getWidth(this._activeBuffer.x-1)?1:2;ie.addCodepointToCell(this._activeBuffer.x-$e,W,U);for(let we=U-Re;--we>=0;)ie.setCellFromCodepoint(this._activeBuffer.x++,0,0,se)}else if(H&&(ie.insertCells(this._activeBuffer.x,U-Re,this._activeBuffer.getNullCell(se)),ie.getWidth(Q-1)===2&&ie.setCellFromCodepoint(Q-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,se)),ie.setCellFromCodepoint(this._activeBuffer.x++,W,U,se),U>0)for(;--U;)ie.setCellFromCodepoint(this._activeBuffer.x++,0,0,se)}this._parser.precedingJoinState=ge,this._activeBuffer.x<Q&&O-D>0&&ie.getWidth(this._activeBuffer.x)===0&&!ie.hasContent(this._activeBuffer.x)&&ie.setCellFromCodepoint(this._activeBuffer.x,0,1,se),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,W=!1,U=!1){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);K.replaceCells(D,O,this._activeBuffer.getNullCell(this._eraseAttrData()),U),W&&(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 W=this._activeBuffer.lines.length-this._bufferService.rows;W>0&&(this._activeBuffer.lines.trimStart(W),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-W,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-W,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,W=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-W+1;for(;D--;)this._activeBuffer.lines.splice(U-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 W;for(W=this._bufferService.rows-1-this._activeBuffer.scrollBottom,W=this._bufferService.rows-1+this._activeBuffer.ybase-W;D--;)this._activeBuffer.lines.splice(O,1),this._activeBuffer.lines.splice(W,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(b.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 W=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);W.deleteCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData())),W.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 W=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);W.insertCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData())),W.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 W=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);W.insertCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData())),W.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 W=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);W.deleteCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData())),W.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,W=N.UnicodeService.extractWidth(D),U=this._activeBuffer.x-W,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),te=new Uint32Array(K.length*O);let Q=0;for(let H=0;H<K.length;){const se=K.codePointAt(H)||0;te[Q++]=se,H+=se>65535?2:1}let Z=Q;for(let H=1;H<O;++H)te.copyWithin(Z,0,Q),Z+=Q;return this.print(te,0,Z),!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,v.DEFAULT_CHARSET),this._charsetService.setgCharset(1,v.DEFAULT_CHARSET),this._charsetService.setgCharset(2,v.DEFAULT_CHARSET),this._charsetService.setgCharset(3,v.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(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:W,activeEncoding:U}=this._coreMouseService,K=this._coreService,{buffers:te,cols:Q}=this._bufferService,{active:Z,alt:H}=te,se=this._optionsService.rawOptions,ie=De=>De?1:2,ge=R.params[0];return ve=ge,Ee=D?ge===2?4:ge===4?ie(K.modes.insertMode):ge===12?3:ge===20?ie(se.convertEol):0:ge===1?ie(O.applicationCursorKeys):ge===3?se.windowOptions.setWinLines?Q===80?2:Q===132?1:0:0:ge===6?ie(O.origin):ge===7?ie(O.wraparound):ge===8?3:ge===9?ie(W==="X10"):ge===12?ie(se.cursorBlink):ge===25?ie(!K.isCursorHidden):ge===45?ie(O.reverseWraparound):ge===66?ie(O.applicationKeypad):ge===67?4:ge===1e3?ie(W==="VT200"):ge===1002?ie(W==="DRAG"):ge===1003?ie(W==="ANY"):ge===1004?ie(O.sendFocus):ge===1005?4:ge===1006?ie(U==="SGR"):ge===1015?4:ge===1016?ie(U==="SGR_PIXELS"):ge===1048?1:ge===47||ge===1047||ge===1049?ie(Z===H):ge===2004?ie(O.bracketedPasteMode):0,K.triggerDataEvent(`${m.C0.ESC}[${D?"":"?"}${ve};${Ee}$y`),!0;var ve,Ee}_updateAttrColor(R,D,O,W,U){return D===2?(R|=50331648,R&=-16777216,R|=j.AttributeData.fromColorRGB([O,W,U])):D===5&&(R&=-50331904,R|=33554432|255&O),R}_extractColor(R,D,O){const W=[0,0,-1,0,0,0];let U=0,K=0;do{if(W[K+U]=R.params[D+K],R.hasSubParams(D+K)){const te=R.getSubParams(D+K);let Q=0;do W[1]===5&&(U=1),W[K+Q+1+U]=te[Q];while(++Q<te.length&&Q+K+1+U<W.length);break}if(W[1]===5&&K+U>=2||W[1]===2&&K+U>=5)break;W[1]&&(U=1)}while(++K+D<R.length&&K+U<W.length);for(let te=2;te<W.length;++te)W[te]===-1&&(W[te]=0);switch(W[0]){case 38:O.fg=this._updateAttrColor(O.fg,W[1],W[3],W[4],W[5]);break;case 48:O.bg=this._updateAttrColor(O.bg,W[1],W[3],W[4],W[5]);break;case 58:O.extended=O.extended.clone(),O.extended.underlineColor=this._updateAttrColor(O.extended.underlineColor,W[1],W[3],W[4],W[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=b.DEFAULT_ATTR_DATA.fg,R.bg=b.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 W=this._curAttrData;for(let U=0;U<D;U++)O=R.params[U],O>=30&&O<=37?(W.fg&=-50331904,W.fg|=16777216|O-30):O>=40&&O<=47?(W.bg&=-50331904,W.bg|=16777216|O-40):O>=90&&O<=97?(W.fg&=-50331904,W.fg|=16777224|O-90):O>=100&&O<=107?(W.bg&=-50331904,W.bg|=16777224|O-100):O===0?this._processSGR0(W):O===1?W.fg|=134217728:O===3?W.bg|=67108864:O===4?(W.fg|=268435456,this._processUnderline(R.hasSubParams(U)?R.getSubParams(U)[0]:1,W)):O===5?W.fg|=536870912:O===7?W.fg|=67108864:O===8?W.fg|=1073741824:O===9?W.fg|=2147483648:O===2?W.bg|=134217728:O===21?this._processUnderline(2,W):O===22?(W.fg&=-134217729,W.bg&=-134217729):O===23?W.bg&=-67108865:O===24?(W.fg&=-268435457,this._processUnderline(0,W)):O===25?W.fg&=-536870913:O===27?W.fg&=-67108865:O===28?W.fg&=-1073741825:O===29?W.fg&=2147483647:O===39?(W.fg&=-67108864,W.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):O===49?(W.bg&=-67108864,W.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):O===38||O===48||O===58?U+=this._extractColor(R,U,W):O===53?W.bg|=1073741824:O===55?W.bg&=-1073741825:O===59?(W.extended=W.extended.clone(),W.extended.underlineColor=-1,W.updateExtended()):O===100?(W.fg&=-67108864,W.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,W.bg&=-67108864,W.bg|=16777215&b.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=b.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(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 W=O.shift(),U=O.shift();if(/^\d+$/.exec(W)){const K=parseInt(W);if(X(K))if(U==="?")D.push({type:0,index:K});else{const te=(0,I.parseColor)(U);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 W;const U=O.findIndex((K=>K.startsWith("id=")));return U!==-1&&(W=O[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:W,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 W=0;W<O.length&&!(D>=this._specialColors.length);++W,++D)if(O[W]==="?")this._onColor.fire([{type:0,index:this._specialColors[D]}]);else{const U=(0,I.parseColor)(O[W]);U&&this._onColor.fire([{type:1,index:this._specialColors[D],color:U}])}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 W=0;W<O.length;++W)if(/^\d+$/.exec(O[W])){const U=parseInt(O[W]);X(U)&&D.push({type:2,index:U})}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,v.DEFAULT_CHARSET),!0}selectCharset(R){return R.length!==2?(this.selectDefaultCharset(),!0):(R[0]==="/"||this._charsetService.setgCharset(z[R[0]],v.CHARSETS[R[1]]||v.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const 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=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(R){return this._charsetService.setgLevel(R),!0}screenAlignmentPattern(){const R=new _.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,W=this._activeBuffer.lines.get(O);W&&(W.fill(R),W.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(R,D){const O=this._bufferService.buffer,W=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${U}${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}[W.cursorStyle]-(W.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(R,D){this._dirtyRowTracker.markRangeDirty(R,D)}}l.InputHandler=B;let q=class{constructor(J){this._bufferService=J,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(J){J<this.start?this.start=J:J>this.end&&(this.end=J)}markRangeDirty(J,R){J>R&&(F=J,J=R,R=F),J<this.start&&(this.start=J),R>this.end&&(this.end=R)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(J){return 0<=J&&J<256}q=f([g(0,A.IBufferService)],q)},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,v){this._data[g]||(this._data[g]={}),this._data[g][m]=v}get(g,m){return this._data[g]?this._data[g][m]:void 0}clear(){this._data={}}}l.TwoKeyMap=h,l.FourKeyMap=class{constructor(){this._data=new h}set(f,g,m,v,S){this._data.get(f,g)||this._data.set(f,g,new h),this._data.get(f,g).set(m,v,S)}get(f,g,m,v){var S;return(S=this._data.get(f,g))==null?void 0:S.get(m,v)}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 v=g+m>>1;const S=this._getKey(this._array[v]);if(S>f)m=v-1;else{if(!(S<f)){for(;v>0&&this._getKey(this._array[v-1])===f;)v--;return v}g=v+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,b=S.timeRemaining(),y=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),y=S.timeRemaining(),1.5*C>y)return b-E<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-E))}ms`),void this._start();b=y}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(v){return requestIdleCallback(v)}_cancelCallback(v){cancelIdleCallback(v)}}:m,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(v){this._queue.clear(),this._queue.enqueue(v)}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),v=m==null?void 0:m.get(g.cols-1),S=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);S&&v&&(S.isWrapped=v[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&v[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,v=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=v}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),v=h(8437),S=h(4634),E=h(511),C=h(643),b=h(4863),y=h(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(x,_,j){this._hasScrollback=x,this._optionsService=_,this._bufferService=j,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=v.DEFAULT_ATTR_DATA.clone(),this.savedCharset=y.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(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,_){return new v.BufferLine(this._bufferService.cols,this.getNullCell(x),_)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&x<this._rows}_getCorrectBufferLength(x){if(!this._hasScrollback)return x;const _=x+this._optionsService.rawOptions.scrollback;return _>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:_}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=v.DEFAULT_ATTR_DATA);let _=this._rows;for(;_--;)this.lines.push(this.getBlankLine(x))}}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(x,_){const j=this.getNullCell(v.DEFAULT_ATTR_DATA);let A=0;const N=this._getCorrectBufferLength(_);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols<x)for(let T=0;T<this.lines.length;T++)A+=+this.lines.get(T).resize(x,j);let L=0;if(this._rows<_)for(let T=this._rows;T<_;T++)this.lines.length<_+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new v.BufferLine(x,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 v.BufferLine(x,j)));else for(let T=this._rows;T>_;T--)this.lines.length>_+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,x-1),this.y=Math.min(this.y,_-1),L&&(this.y+=L),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=_-1,this._isReflowEnabled&&(this._reflow(x,_),this._cols>x))for(let L=0;L<this.lines.length;L++)A+=+this.lines.get(L).resize(x,j);this._cols=x,this._rows=_,this._memoryCleanupQueue.clear(),A>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let _=0;for(;this._memoryCleanupPosition<this.lines.length;)if(_+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),_>100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,_){this._cols!==x&&(x>this._cols?this._reflowLarger(x,_):this._reflowSmaller(x,_))}_reflowLarger(x,_){const j=(0,S.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(v.DEFAULT_ATTR_DATA));if(j.length>0){const A=(0,S.reflowLargerCreateNewLayout)(this.lines,j);(0,S.reflowLargerApplyNewLayout)(this.lines,A.layout),this._reflowLargerAdjustViewport(x,_,A.countRemoved)}}_reflowLargerAdjustViewport(x,_,j){const A=this.getNullCell(v.DEFAULT_ATTR_DATA);let N=j;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<_&&this.lines.push(new v.BufferLine(x,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(x,_){const j=this.getNullCell(v.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()<=x)continue;const I=[T];for(;T.isWrapped&&L>0;)T=this.lines.get(--L),I.unshift(T);const z=this.ybase+this.y;if(z>=L&&z<L+I.length)continue;const V=I[I.length-1].getTrimmedLength(),Y=(0,S.reflowSmallerGetNewLineLengths)(I,this._cols,x),$=Y.length-I.length;let F;F=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 B=[];for(let O=0;O<$;O++){const W=this.getBlankLine(v.DEFAULT_ATTR_DATA,!0);B.push(W)}B.length>0&&(A.push({start:L+I.length+N,newLines:B}),N+=B.length),I.push(...B);let q=Y.length-1,X=Y[q];X===0&&(q--,X=Y[q]);let J=I.length-$-1,R=V;for(;J>=0;){const O=Math.min(R,X);if(I[q]===void 0)break;if(I[q].copyCellsFrom(I[J],R-O,X-O,O,!0),X-=O,X===0&&(q--,X=Y[q]),R-=O,R===0){J--;const W=Math.max(J,0);R=(0,S.getWrappedLineTrimmedLength)(I,W,this._cols)}}for(let O=0;O<I.length;O++)Y[O]<x&&I[O].setCell(Y[O],j);let D=$-F;for(;D-- >0;)this.ybase===0?this.y<_-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+N)-_&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+$,this.ybase+_-1)}if(A.length>0){const L=[],T=[];for(let q=0;q<this.lines.length;q++)T.push(this.lines.get(q));const I=this.lines.length;let z=I-1,V=0,Y=A[V];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let $=0;for(let q=Math.min(this.lines.maxLength-1,I+N-1);q>=0;q--)if(Y&&Y.start>z+$){for(let X=Y.newLines.length-1;X>=0;X--)this.lines.set(q--,Y.newLines[X]);q++,L.push({index:z+1,amount:Y.newLines.length}),$+=Y.newLines.length,Y=A[++V]}else this.lines.set(q,T[z--]);let F=0;for(let q=L.length-1;q>=0;q--)L[q].index+=F,this.lines.onInsertEmitter.fire(L[q]),F+=L[q].amount;const B=Math.max(0,I+N-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(x,_,j=0,A){const N=this.lines.get(x);return N?N.translateToString(_,j,A):""}getWrappedRangeForLine(x){let _=x,j=x;for(;_>0&&this.lines.get(_).isWrapped;)_--;for(;j+1<this.lines.length&&this.lines.get(j+1).isWrapped;)j++;return{first:_,last:j}}setupTabStops(x){for(x!=null?this.tabs[x]||(x=this.prevStop(x)):(this.tabs={},x=0);x<this._cols;x+=this._optionsService.rawOptions.tabStopWidth)this.tabs[x]=!0}prevStop(x){for(x==null&&(x=this.x);!this.tabs[--x]&&x>0;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x<this._cols;);return x>=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let _=0;_<this.markers.length;_++)this.markers[_].line===x&&(this.markers[_].dispose(),this.markers.splice(_--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let x=0;x<this.markers.length;x++)this.markers[x].dispose(),this.markers.splice(x--,1);this._isClearing=!1}addMarker(x){const _=new b.Marker(x);return this.markers.push(_),_.register(this.lines.onTrim((j=>{_.line-=j,_.line<0&&_.dispose()}))),_.register(this.lines.onInsert((j=>{_.line>=j.index&&(_.line+=j.amount)}))),_.register(this.lines.onDelete((j=>{_.line>=j.index&&_.line<j.index+j.amount&&_.dispose(),_.line>j.index&&(_.line-=j.amount)}))),_.register(_.onDispose((()=>this._removeMarker(_)))),_}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),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),v=h(482);l.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let S=0;class E{constructor(b,y,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);const _=y||g.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let j=0;j<b;++j)this.setCell(j,_);this.length=b}get(b){const y=this._data[3*b+0],x=2097151&y;return[this._data[3*b+1],2097152&y?this._combined[b]:x?(0,v.stringFromCodePoint)(x):"",y>>22,2097152&y?this._combined[b].charCodeAt(this._combined[b].length-1):x]}set(b,y){this._data[3*b+1]=y[m.CHAR_DATA_ATTR_INDEX],y[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=y[1],this._data[3*b+0]=2097152|b|y[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=y[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(b){return this._data[3*b+0]>>22}hasWidth(b){return 12582912&this._data[3*b+0]}getFg(b){return this._data[3*b+1]}getBg(b){return this._data[3*b+2]}hasContent(b){return 4194303&this._data[3*b+0]}getCodePoint(b){const y=this._data[3*b+0];return 2097152&y?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&y}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){const y=this._data[3*b+0];return 2097152&y?this._combined[b]:2097151&y?(0,v.stringFromCodePoint)(2097151&y):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,y){return S=3*b,y.content=this._data[S+0],y.fg=this._data[S+1],y.bg=this._data[S+2],2097152&y.content&&(y.combinedData=this._combined[b]),268435456&y.bg&&(y.extended=this._extendedAttrs[b]),y}setCell(b,y){2097152&y.content&&(this._combined[b]=y.combinedData),268435456&y.bg&&(this._extendedAttrs[b]=y.extended),this._data[3*b+0]=y.content,this._data[3*b+1]=y.fg,this._data[3*b+2]=y.bg}setCellFromCodepoint(b,y,x,_){268435456&_.bg&&(this._extendedAttrs[b]=_.extended),this._data[3*b+0]=y|x<<22,this._data[3*b+1]=_.fg,this._data[3*b+2]=_.bg}addCodepointToCell(b,y,x){let _=this._data[3*b+0];2097152&_?this._combined[b]+=(0,v.stringFromCodePoint)(y):2097151&_?(this._combined[b]=(0,v.stringFromCodePoint)(2097151&_)+(0,v.stringFromCodePoint)(y),_&=-2097152,_|=2097152):_=y|4194304,x&&(_&=-12582913,_|=x<<22),this._data[3*b+0]=_}insertCells(b,y,x){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,x),y<this.length-b){const _=new g.CellData;for(let j=this.length-b-y-1;j>=0;--j)this.setCell(b+y+j,this.loadCell(b+j,_));for(let j=0;j<y;++j)this.setCell(b+j,x)}else for(let _=b;_<this.length;++_)this.setCell(_,x);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,x)}deleteCells(b,y,x){if(b%=this.length,y<this.length-b){const _=new g.CellData;for(let j=0;j<this.length-b-y;++j)this.setCell(b+j,this.loadCell(b+y+j,_));for(let j=this.length-y;j<this.length;++j)this.setCell(j,x)}else for(let _=b;_<this.length;++_)this.setCell(_,x);b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,x),this.getWidth(b)!==0||this.hasContent(b)||this.setCellFromCodepoint(b,0,1,x)}replaceCells(b,y,x,_=!1){if(_)for(b&&this.getWidth(b-1)===2&&!this.isProtected(b-1)&&this.setCellFromCodepoint(b-1,0,1,x),y<this.length&&this.getWidth(y-1)===2&&!this.isProtected(y)&&this.setCellFromCodepoint(y,0,1,x);b<y&&b<this.length;)this.isProtected(b)||this.setCell(b,x),b++;else for(b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,x),y<this.length&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y,0,1,x);b<y&&b<this.length;)this.setCell(b++,x)}resize(b,y){if(b===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const x=3*b;if(b>this.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const _=new Uint32Array(x);_.set(this._data),this._data=_}for(let _=this.length;_<b;++_)this.setCell(_,y)}else{this._data=this._data.subarray(0,x);const _=Object.keys(this._combined);for(let A=0;A<_.length;A++){const N=parseInt(_[A],10);N>=b&&delete this._combined[N]}const j=Object.keys(this._extendedAttrs);for(let A=0;A<j.length;A++){const N=parseInt(j[A],10);N>=b&&delete this._extendedAttrs[N]}}return this.length=b,4*x*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const b=new Uint32Array(this._data.length);return b.set(this._data),this._data=b,1}return 0}fill(b,y=!1){if(y)for(let x=0;x<this.length;++x)this.isProtected(x)||this.setCell(x,b);else{this._combined={},this._extendedAttrs={};for(let x=0;x<this.length;++x)this.setCell(x,b)}}copyFrom(b){this.length!==b.length?this._data=new Uint32Array(b._data):this._data.set(b._data),this.length=b.length,this._combined={};for(const y in b._combined)this._combined[y]=b._combined[y];this._extendedAttrs={};for(const y in b._extendedAttrs)this._extendedAttrs[y]=b._extendedAttrs[y];this.isWrapped=b.isWrapped}clone(){const b=new E(0);b._data=new Uint32Array(this._data),b.length=this.length;for(const y in this._combined)b._combined[y]=this._combined[y];for(const y in this._extendedAttrs)b._extendedAttrs[y]=this._extendedAttrs[y];return b.isWrapped=this.isWrapped,b}getTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0])return b+(this._data[3*b+0]>>22);return 0}getNoBgTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0]||50331648&this._data[3*b+2])return b+(this._data[3*b+0]>>22);return 0}copyCellsFrom(b,y,x,_,j){const A=b._data;if(j)for(let L=_-1;L>=0;L--){for(let T=0;T<3;T++)this._data[3*(x+L)+T]=A[3*(y+L)+T];268435456&A[3*(y+L)+2]&&(this._extendedAttrs[x+L]=b._extendedAttrs[y+L])}else for(let L=0;L<_;L++){for(let T=0;T<3;T++)this._data[3*(x+L)+T]=A[3*(y+L)+T];268435456&A[3*(y+L)+2]&&(this._extendedAttrs[x+L]=b._extendedAttrs[y+L])}const N=Object.keys(b._combined);for(let L=0;L<N.length;L++){const T=parseInt(N[L],10);T>=y&&(this._combined[T-y+x]=b._combined[T])}}translateToString(b,y,x,_){y=y??0,x=x??this.length,b&&(x=Math.min(x,this.getTrimmedLength())),_&&(_.length=0);let j="";for(;y<x;){const A=this._data[3*y+0],N=2097151&A,L=2097152&A?this._combined[y]:N?(0,v.stringFromCodePoint)(N):m.WHITESPACE_CELL_CHAR;if(j+=L,_)for(let T=0;T<L.length;++T)_.push(y);y+=A>>22||1}return _&&_.push(y),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 v=!f[g].hasContent(m-1)&&f[g].getWidth(m-1)===1,S=f[g+1].getWidth(0)===2;return v&&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,v,S){const E=[];for(let C=0;C<f.length-1;C++){let b=C,y=f.get(++b);if(!y.isWrapped)continue;const x=[f.get(C)];for(;b<f.length&&y.isWrapped;)x.push(y),y=f.get(++b);if(v>=C&&v<b){C+=x.length-1;continue}let _=0,j=h(x,_,g),A=1,N=0;for(;A<x.length;){const T=h(x,A,g),I=T-N,z=m-j,V=Math.min(I,z);x[_].copyCellsFrom(x[A],N,j,V,!1),j+=V,j===m&&(_++,j=0),N+=V,N===T&&(A++,N=0),j===0&&_!==0&&x[_-1].getWidth(m-1)===2&&(x[_].copyCellsFrom(x[_-1],m-1,j++,1,!1),x[_-1].setCell(m-1,S))}x[_].replaceCells(j,m,S);let L=0;for(let T=x.length-1;T>0&&(T>_||x[T].getTrimmedLength()===0);T--)L++;L>0&&(E.push(C+x.length-L),E.push(L)),C+=x.length-1}return E},l.reflowLargerCreateNewLayout=function(f,g){const m=[];let v=0,S=g[v],E=0;for(let C=0;C<f.length;C++)if(S===C){const b=g[++v];f.onDeleteEmitter.fire({index:C-E,amount:b}),C+=b-1,E+=b,S=g[++v]}else m.push(C);return{layout:m,countRemoved:E}},l.reflowLargerApplyNewLayout=function(f,g){const m=[];for(let v=0;v<g.length;v++)m.push(f.get(g[v]));for(let v=0;v<m.length;v++)f.set(v,m[v]);f.length=g.length},l.reflowSmallerGetNewLineLengths=function(f,g,m){const v=[],S=f.map(((y,x)=>h(f,x,g))).reduce(((y,x)=>y+x));let E=0,C=0,b=0;for(;b<S;){if(S-b<m){v.push(S-b);break}E+=m;const y=h(f,C,g);E>y&&(E-=y,C++);const x=f[C].getWidth(E-1)===2;x&&E--;const _=x?m-1:m;v.push(_),b+=_}return v},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 v 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=v},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 v extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(E){const C=new v;return C.setFromCharData(E),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,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 b=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=b&&b<=56319){const y=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=y&&y<=57343?this.content=1024*(b-55296)+y-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=v},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,v,S,E){const C={type:0,cancel:!1,key:void 0},b=(m.shiftKey?1:0)|(m.altKey?2:0)|(m.ctrlKey?4:0)|(m.metaKey?8:0);switch(m.keyCode){case 0:m.key==="UIKeyInputUpArrow"?C.key=v?f.C0.ESC+"OA":f.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?C.key=v?f.C0.ESC+"OD":f.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?C.key=v?f.C0.ESC+"OC":f.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(C.key=v?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;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"D",C.key===f.C0.ESC+"[1;3D"&&(C.key=f.C0.ESC+(S?"b":"[1;5D"))):C.key=v?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(m.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"C",C.key===f.C0.ESC+"[1;3C"&&(C.key=f.C0.ESC+(S?"f":"[1;5C"))):C.key=v?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(m.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"A",S||C.key!==f.C0.ESC+"[1;3A"||(C.key=f.C0.ESC+"[1;5A")):C.key=v?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(m.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"B",S||C.key!==f.C0.ESC+"[1;3B"||(C.key=f.C0.ESC+"[1;5B")):C.key=v?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=b?f.C0.ESC+"[3;"+(b+1)+"~":f.C0.ESC+"[3~";break;case 36:C.key=b?f.C0.ESC+"[1;"+(b+1)+"H":v?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:C.key=b?f.C0.ESC+"[1;"+(b+1)+"F":v?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:m.shiftKey?C.type=2:m.ctrlKey?C.key=f.C0.ESC+"[5;"+(b+1)+"~":C.key=f.C0.ESC+"[5~";break;case 34:m.shiftKey?C.type=3:m.ctrlKey?C.key=f.C0.ESC+"[6;"+(b+1)+"~":C.key=f.C0.ESC+"[6~";break;case 112:C.key=b?f.C0.ESC+"[1;"+(b+1)+"P":f.C0.ESC+"OP";break;case 113:C.key=b?f.C0.ESC+"[1;"+(b+1)+"Q":f.C0.ESC+"OQ";break;case 114:C.key=b?f.C0.ESC+"[1;"+(b+1)+"R":f.C0.ESC+"OR";break;case 115:C.key=b?f.C0.ESC+"[1;"+(b+1)+"S":f.C0.ESC+"OS";break;case 116:C.key=b?f.C0.ESC+"[15;"+(b+1)+"~":f.C0.ESC+"[15~";break;case 117:C.key=b?f.C0.ESC+"[17;"+(b+1)+"~":f.C0.ESC+"[17~";break;case 118:C.key=b?f.C0.ESC+"[18;"+(b+1)+"~":f.C0.ESC+"[18~";break;case 119:C.key=b?f.C0.ESC+"[19;"+(b+1)+"~":f.C0.ESC+"[19~";break;case 120:C.key=b?f.C0.ESC+"[20;"+(b+1)+"~":f.C0.ESC+"[20~";break;case 121:C.key=b?f.C0.ESC+"[21;"+(b+1)+"~":f.C0.ESC+"[21~";break;case 122:C.key=b?f.C0.ESC+"[23;"+(b+1)+"~":f.C0.ESC+"[23~";break;case 123:C.key=b?f.C0.ESC+"[24;"+(b+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 y=g[m.keyCode],x=y==null?void 0:y[m.shiftKey?1:0];if(x)C.key=f.C0.ESC+x;else if(m.keyCode>=65&&m.keyCode<=90){const _=m.ctrlKey?m.keyCode-64:m.keyCode+32;let j=String.fromCharCode(_);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 _=m.code.slice(3,4);m.shiftKey||(_=_.toLowerCase()),C.key=f.C0.ESC+_,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 v=f;v<g;++v){let S=h[v];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,v=0;if(this._interim){const S=h.charCodeAt(v++);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=v;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,v,S,E,C=0,b=0,y=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,I=T-L;for(;y<I;){if(y>=g)return 0;if(N=h[y++],(192&N)!=128){y--,j=!0;break}this.interim[L++]=N,A<<=6,A|=63&N}j||(T===2?A<128?y--: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 x=g-4;let _=y;for(;_<g;){for(;!(!(_<x)||128&(m=h[_])||128&(v=h[_+1])||128&(S=h[_+2])||128&(E=h[_+3]));)f[C++]=m,f[C++]=v,f[C++]=S,f[C++]=E,_+=4;if(m=h[_++],m<128)f[C++]=m;else if((224&m)==192){if(_>=g)return this.interim[0]=m,C;if(v=h[_++],(192&v)!=128){_--;continue}if(b=(31&m)<<6|63&v,b<128){_--;continue}f[C++]=b}else if((240&m)==224){if(_>=g)return this.interim[0]=m,C;if(v=h[_++],(192&v)!=128){_--;continue}if(_>=g)return this.interim[0]=m,this.interim[1]=v,C;if(S=h[_++],(192&S)!=128){_--;continue}if(b=(15&m)<<12|(63&v)<<6|63&S,b<2048||b>=55296&&b<=57343||b===65279)continue;f[C++]=b}else if((248&m)==240){if(_>=g)return this.interim[0]=m,C;if(v=h[_++],(192&v)!=128){_--;continue}if(_>=g)return this.interim[0]=m,this.interim[1]=v,C;if(S=h[_++],(192&S)!=128){_--;continue}if(_>=g)return this.interim[0]=m,this.interim[1]=v,this.interim[2]=S,C;if(E=h[_++],(192&E)!=128){_--;continue}if(b=(7&m)<<18|(63&v)<<12|(63&S)<<6|63&E,b<65536||b>1114111)continue;f[C++]=b}}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 v;l.UnicodeV6=class{constructor(){if(this.version="6",!v){v=new Uint8Array(65536),v.fill(1),v[0]=0,v.fill(0,1,32),v.fill(0,127,160),v.fill(2,4352,4448),v[9001]=2,v[9002]=2,v.fill(2,11904,42192),v[12351]=1,v.fill(2,44032,55204),v.fill(2,63744,64256),v.fill(2,65040,65050),v.fill(2,65072,65136),v.fill(2,65280,65377),v.fill(2,65504,65511);for(let S=0;S<g.length;++S)v.fill(0,g[S][0],g[S][1]+1)}}wcwidth(S){return S<32?0:S<127?1:S<65536?v[S]:(function(E,C){let b,y=0,x=C.length-1;if(E<C[0][0]||E>C[x][1])return!1;for(;x>=y;)if(b=y+x>>1,E>C[b][1])y=b+1;else{if(!(E<C[b][0]))return!0;x=b-1}return!1})(S,m)?0:S>=131072&&S<=196605||S>=196608&&S<=262141?2:1}charProperties(S,E){let C=this.wcwidth(S),b=C===0&&E!==0;if(b){const y=f.UnicodeService.extractWidth(E);y===0?b=!1:y>C&&(C=y)}return f.UnicodeService.createPropertyValue(0,C,b)}}},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 b=this._callbacks.shift();b&&b()}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 b=this._writeBuffer[this._bufferOffset],y=this._action(b,E);if(y){const _=j=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,j))):this._innerWrite(C,j);return void y.catch((j=>(queueMicrotask((()=>{throw j})),Promise.resolve(!1)))).then(_)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=b.length,Date.now()-C>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}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,v){const S=m.toString(16),E=S.length<2?"0"+S:S;switch(v){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 v=m.toLowerCase();if(v.indexOf("rgb:")===0){v=v.slice(4);const S=h.exec(v);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(v.indexOf("#")===0&&(v=v.slice(1),f.exec(v)&&[3,6,9,12].includes(v.length))){const S=v.length/3,E=[0,0,0];for(let C=0;C<3;++C){const b=parseInt(v.slice(S*C,S*C+S),16);E[C]=S===1?b<<4:S===2?b:S===3?b>>4:b>>8}return E}},l.toRgbString=function(m,v=16){const[S,E,C]=m;return`rgb:${g(S,v)}/${g(E,v)}/${g(C,v)}`}},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),v=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=v,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=v}registerHandler(E,C){this._handlers[E]===void 0&&(this._handlers[E]=[]);const b=this._handlers[E];return b.push(C),{dispose:()=>{const y=b.indexOf(C);y!==-1&&b.splice(y,1)}}}clearHandler(E){this._handlers[E]&&delete this._handlers[E]}setHandlerFallback(E){this._handlerFb=E}reset(){if(this._active.length)for(let E=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;E>=0;--E)this._active[E].unhook(!1);this._stack.paused=!1,this._active=v,this._ident=0}hook(E,C){if(this.reset(),this._ident=E,this._active=this._handlers[E]||v,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(E,C,b){if(this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].put(E,C,b);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(E,C,b))}unhook(E,C=!0){if(this._active.length){let b=!1,y=this._active.length-1,x=!1;if(this._stack.paused&&(y=this._stack.loopPosition-1,b=C,x=this._stack.fallThrough,this._stack.paused=!1),!x&&b===!1){for(;y>=0&&(b=this._active[y].unhook(E),b!==!0);y--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!1,b;y--}for(;y>=0;y--)if(b=this._active[y].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",E);this._active=v,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,b){this._hitLimit||(this._data+=(0,f.utf32ToString)(E,C,b),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((b=>(this._params=S,this._data="",this._hitLimit=!1,b)));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),v=h(6351);class S{constructor(y){this.table=new Uint8Array(y)}setDefault(y,x){this.table.fill(y<<4|x)}add(y,x,_,j){this.table[x<<8|y]=_<<4|j}addMany(y,x,_,j){for(let A=0;A<y.length;A++)this.table[x<<8|y[A]]=_<<4|j}}l.TransitionTable=S;const E=160;l.VT500_TRANSITION_TABLE=(function(){const b=new S(4095),y=Array.apply(null,Array(256)).map(((L,T)=>T)),x=(L,T)=>y.slice(L,T),_=x(32,127),j=x(0,24);j.push(25),j.push.apply(j,x(28,32));const A=x(0,14);let N;for(N in b.setDefault(1,0),b.addMany(_,0,2,0),A)b.addMany([24,26,153,154],N,3,0),b.addMany(x(128,144),N,3,0),b.addMany(x(144,152),N,3,0),b.add(156,N,0,0),b.add(27,N,11,1),b.add(157,N,4,8),b.addMany([152,158,159],N,0,7),b.add(155,N,11,3),b.add(144,N,11,9);return b.addMany(j,0,3,0),b.addMany(j,1,3,1),b.add(127,1,0,1),b.addMany(j,8,0,8),b.addMany(j,3,3,3),b.add(127,3,0,3),b.addMany(j,4,3,4),b.add(127,4,0,4),b.addMany(j,6,3,6),b.addMany(j,5,3,5),b.add(127,5,0,5),b.addMany(j,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(_,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(x(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(_,7,0,7),b.addMany(j,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(x(64,127),3,7,0),b.addMany(x(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(x(48,60),4,8,4),b.addMany(x(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(x(32,64),6,0,6),b.add(127,6,0,6),b.addMany(x(64,127),6,0,0),b.addMany(x(32,48),3,9,5),b.addMany(x(32,48),5,9,5),b.addMany(x(48,64),5,0,6),b.addMany(x(64,127),5,7,0),b.addMany(x(32,48),4,9,5),b.addMany(x(32,48),1,9,2),b.addMany(x(32,48),2,9,2),b.addMany(x(48,127),2,10,0),b.addMany(x(48,80),1,10,0),b.addMany(x(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(x(96,127),1,10,0),b.add(80,1,11,9),b.addMany(j,9,0,9),b.add(127,9,0,9),b.addMany(x(28,32),9,0,9),b.addMany(x(32,48),9,9,12),b.addMany(x(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(j,11,0,11),b.addMany(x(32,128),11,0,11),b.addMany(x(28,32),11,0,11),b.addMany(j,10,0,10),b.add(127,10,0,10),b.addMany(x(28,32),10,0,10),b.addMany(x(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(x(32,48),10,9,12),b.addMany(j,12,0,12),b.add(127,12,0,12),b.addMany(x(28,32),12,0,12),b.addMany(x(32,48),12,9,12),b.addMany(x(48,64),12,0,11),b.addMany(x(64,127),12,12,13),b.addMany(x(64,127),10,12,13),b.addMany(x(64,127),9,12,13),b.addMany(j,13,13,13),b.addMany(_,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(E,0,2,0),b.add(E,8,5,8),b.add(E,6,0,6),b.add(E,11,0,11),b.add(E,13,13,13),b})();class C extends f.Disposable{constructor(y=l.VT500_TRANSITION_TABLE){super(),this._transitions=y,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,_,j)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,_)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,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 v.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(y,x=[64,126]){let _=0;if(y.prefix){if(y.prefix.length>1)throw new Error("only one byte as prefix supported");if(_=y.prefix.charCodeAt(0),_&&60>_||_>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(y.intermediates){if(y.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let A=0;A<y.intermediates.length;++A){const N=y.intermediates.charCodeAt(A);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");_<<=8,_|=N}}if(y.final.length!==1)throw new Error("final must be a single byte");const j=y.final.charCodeAt(0);if(x[0]>j||j>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return _<<=8,_|=j,_}identToString(y){const x=[];for(;y;)x.push(String.fromCharCode(255&y)),y>>=8;return x.reverse().join("")}setPrintHandler(y){this._printHandler=y}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(y,x){const _=this._identifier(y,[48,126]);this._escHandlers[_]===void 0&&(this._escHandlers[_]=[]);const j=this._escHandlers[_];return j.push(x),{dispose:()=>{const A=j.indexOf(x);A!==-1&&j.splice(A,1)}}}clearEscHandler(y){this._escHandlers[this._identifier(y,[48,126])]&&delete this._escHandlers[this._identifier(y,[48,126])]}setEscHandlerFallback(y){this._escHandlerFb=y}setExecuteHandler(y,x){this._executeHandlers[y.charCodeAt(0)]=x}clearExecuteHandler(y){this._executeHandlers[y.charCodeAt(0)]&&delete this._executeHandlers[y.charCodeAt(0)]}setExecuteHandlerFallback(y){this._executeHandlerFb=y}registerCsiHandler(y,x){const _=this._identifier(y);this._csiHandlers[_]===void 0&&(this._csiHandlers[_]=[]);const j=this._csiHandlers[_];return j.push(x),{dispose:()=>{const A=j.indexOf(x);A!==-1&&j.splice(A,1)}}}clearCsiHandler(y){this._csiHandlers[this._identifier(y)]&&delete this._csiHandlers[this._identifier(y)]}setCsiHandlerFallback(y){this._csiHandlerFb=y}registerDcsHandler(y,x){return this._dcsParser.registerHandler(this._identifier(y),x)}clearDcsHandler(y){this._dcsParser.clearHandler(this._identifier(y))}setDcsHandlerFallback(y){this._dcsParser.setHandlerFallback(y)}registerOscHandler(y,x){return this._oscParser.registerHandler(y,x)}clearOscHandler(y){this._oscParser.clearHandler(y)}setOscHandlerFallback(y){this._oscParser.setHandlerFallback(y)}setErrorHandler(y){this._errorHandler=y}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(y,x,_,j,A){this._parseStack.state=y,this._parseStack.handlers=x,this._parseStack.handlerPos=_,this._parseStack.transition=j,this._parseStack.chunkPos=A}parse(y,x,_){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(_===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 I=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(_===!1&&I>-1){for(;I>=0&&(j=T[I](this._params),j!==!0);I--)if(j instanceof Promise)return this._parseStack.handlerPos=I,j}this._parseStack.handlers=[];break;case 4:if(_===!1&&I>-1){for(;I>=0&&(j=T[I](),j!==!0);I--)if(j instanceof Promise)return this._parseStack.handlerPos=I,j}this._parseStack.handlers=[];break;case 6:if(A=y[this._parseStack.chunkPos],j=this._dcsParser.unhook(A!==24&&A!==26,_),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(A=y[this._parseStack.chunkPos],j=this._oscParser.end(A!==24&&A!==26,_),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<x;++T){switch(A=y[T],N=this._transitions.table[this.currentState<<8|(A<160?A:E)],N>>4){case 2:for(let $=T+1;;++$){if($>=x||(A=y[$])<32||A>126&&A<E){this._printHandler(y,T,$),T=$-1;break}if(++$>=x||(A=y[$])<32||A>126&&A<E){this._printHandler(y,T,$),T=$-1;break}if(++$>=x||(A=y[$])<32||A>126&&A<E){this._printHandler(y,T,$),T=$-1;break}if(++$>=x||(A=y[$])<32||A>126&&A<E){this._printHandler(y,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 I=this._csiHandlers[this._collect<<8|A];let z=I?I.length-1:-1;for(;z>=0&&(j=I[z](this._params),j!==!0);z--)if(j instanceof Promise)return this._preserveStack(3,I,z,N,T),j;z<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<x&&(A=y[T])>47&&A<60);T--;break;case 9:this._collect<<=8,this._collect|=A;break;case 10:const V=this._escHandlers[this._collect<<8|A];let Y=V?V.length-1:-1;for(;Y>=0&&(j=V[Y](),j!==!0);Y--)if(j instanceof Promise)return this._preserveStack(4,V,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($>=x||(A=y[$])===24||A===26||A===27||A>127&&A<E){this._dcsParser.put(y,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($>=x||(A=y[$])<32||A>127&&A<E){this._oscParser.put(y,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(v,S){this._handlers[v]===void 0&&(this._handlers[v]=[]);const E=this._handlers[v];return E.push(S),{dispose:()=>{const C=E.indexOf(S);C!==-1&&E.splice(C,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].start();else this._handlerFb(this._id,"START")}_put(v,S,E){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(v,S,E);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(v,S,E))}start(){this.reset(),this._state=1}put(v,S,E){if(this._state!==3){if(this._state===1)for(;S<E;){const C=v[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(v,S,E)}}end(v,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,b=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,E=S,b=this._stack.fallThrough,this._stack.paused=!1),!b&&E===!1){for(;C>=0&&(E=this._active[C].end(v),E!==!0);C--)if(E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,E;C--}for(;C>=0;C--)if(E=this._active[C].end(!1),E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,E}else this._handlerFb(this._id,"END",v);this._active=m,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(v){this._handler=v,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(v,S,E){this._hitLimit||(this._data+=(0,g.utf32ToString)(v,S,E),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(v){let S=!1;if(this._hitLimit)S=!1;else if(v&&(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 v=new f;if(!m.length)return v;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)v.addSubParam(E[C]);else v.addParam(E)}return v}constructor(m=32,v=32){if(this.maxLength=m,this.maxSubParamsLength=v,v>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(v),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new 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 v=0;v<this.length;++v){m.push(this.params[v]);const S=this._subParamsIdx[v]>>8,E=255&this._subParamsIdx[v];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 v=this._subParamsIdx[m]>>8,S=255&this._subParamsIdx[m];return S-v>0?this._subParams.subarray(v,S):null}getSubParamsAll(){const m={};for(let v=0;v<this.length;++v){const S=this._subParamsIdx[v]>>8,E=255&this._subParamsIdx[v];E-S>0&&(m[v]=this._subParams.slice(S,E))}return m}addDigit(m){let v;if(this._rejectDigits||!(v=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const S=this._digitIsSub?this._subParams:this.params,E=S[v-1];S[v-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,v){this._buffer=m,this.type=v}init(m){return this._buffer=m,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(m){const v=this._buffer.lines.get(m);if(v)return new f.BufferLineApiView(v)}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,v){return this._line.translateToString(g,m,v)}}},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 v extends m.Disposable{constructor(E){super(),this._core=E,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new 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=v},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(b,y,x,_){var j,A=arguments.length,N=A<3?y:_===null?_=Object.getOwnPropertyDescriptor(y,x):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,y,x,_);else for(var L=b.length-1;L>=0;L--)(j=b[L])&&(N=(A<3?j(N):A>3?j(y,x,N):j(y,x))||N);return A>3&&N&&Object.defineProperty(y,x,N),N},g=this&&this.__param||function(b,y){return function(x,_){y(x,_,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const m=h(8460),v=h(844),S=h(5295),E=h(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let C=l.BufferService=class extends v.Disposable{get buffer(){return this.buffers.active}constructor(b){super(),this.isUserScrolling=!1,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(b.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new S.BufferSet(b,this))}resize(b,y){this.cols=b,this.rows=y,this.buffers.resize(b,y),this._onResize.fire({cols:b,rows:y})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,y=!1){const x=this.buffer;let _;_=this._cachedBlankLine,_&&_.length===this.cols&&_.getFg(0)===b.fg&&_.getBg(0)===b.bg||(_=x.getBlankLine(b,y),this._cachedBlankLine=_),_.isWrapped=y;const j=x.ybase+x.scrollTop,A=x.ybase+x.scrollBottom;if(x.scrollTop===0){const N=x.lines.isFull;A===x.lines.length-1?N?x.lines.recycle().copyFrom(_):x.lines.push(_.clone()):x.lines.splice(A+1,0,_.clone()),N?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const N=A-j+1;x.lines.shiftElements(j+1,N-1,-1),x.lines.set(A,_.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(b,y,x){const _=this.buffer;if(b<0){if(_.ydisp===0)return;this.isUserScrolling=!0}else b+_.ydisp>=_.ybase&&(this.isUserScrolling=!1);const j=_.ydisp;_.ydisp=Math.max(Math.min(_.ydisp+b,_.ybase),0),j!==_.ydisp&&(y||this._onScroll.fire(_.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(_,j,A,N){var L,T=arguments.length,I=T<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,A):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(_,j,A,N);else for(var z=_.length-1;z>=0;z--)(L=_[z])&&(I=(T<3?L(I):T>3?L(j,A,I):L(j,A))||I);return T>3&&I&&Object.defineProperty(j,A,I),I},g=this&&this.__param||function(_,j){return function(A,N){j(A,N,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const m=h(2585),v=h(8460),S=h(844),E={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:_=>_.button!==4&&_.action===1&&(_.ctrl=!1,_.alt=!1,_.shift=!1,!0)},VT200:{events:19,restrict:_=>_.action!==32},DRAG:{events:23,restrict:_=>_.action!==32||_.button!==3},ANY:{events:31,restrict:_=>!0}};function C(_,j){let A=(_.ctrl?16:0)|(_.shift?4:0)|(_.alt?8:0);return _.button===4?(A|=64,A|=_.action):(A|=3&_.button,4&_.button&&(A|=64),8&_.button&&(A|=128),_.action===32?A|=32:_.action!==0||j||(A|=3)),A}const b=String.fromCharCode,y={DEFAULT:_=>{const j=[C(_,!1)+32,_.col+32,_.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`\x1B[M${b(j[0])}${b(j[1])}${b(j[2])}`},SGR:_=>{const j=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${C(_,!0)};${_.col};${_.row}${j}`},SGR_PIXELS:_=>{const j=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${C(_,!0)};${_.x};${_.y}${j}`}};let x=l.CoreMouseService=class extends S.Disposable{constructor(_,j){super(),this._bufferService=_,this._coreService=j,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new v.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const A of Object.keys(E))this.addProtocol(A,E[A]);for(const A of Object.keys(y))this.addEncoding(A,y[A]);this.reset()}addProtocol(_,j){this._protocols[_]=j}addEncoding(_,j){this._encodings[_]=j}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(_){if(!this._protocols[_])throw new Error(`unknown protocol "${_}"`);this._activeProtocol=_,this._onProtocolChange.fire(this._protocols[_].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(_){if(!this._encodings[_])throw new Error(`unknown encoding "${_}"`);this._activeEncoding=_}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(_){if(_.col<0||_.col>=this._bufferService.cols||_.row<0||_.row>=this._bufferService.rows||_.button===4&&_.action===32||_.button===3&&_.action!==32||_.button!==4&&(_.action===2||_.action===3)||(_.col++,_.row++,_.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,_,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(_))return!1;const j=this._encodings[this._activeEncoding](_);return j&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(j):this._coreService.triggerDataEvent(j,!0)),this._lastEvent=_,!0}explainEvents(_){return{down:!!(1&_),up:!!(2&_),drag:!!(4&_),move:!!(8&_),wheel:!!(16&_)}}_equalEvents(_,j,A){if(A){if(_.x!==j.x||_.y!==j.y)return!1}else if(_.col!==j.col||_.row!==j.row)return!1;return _.button===j.button&&_.action===j.action&&_.ctrl===j.ctrl&&_.alt===j.alt&&_.shift===j.shift}};l.CoreMouseService=x=f([g(0,m.IBufferService),g(1,m.ICoreService)],x)},6975:function(p,l,h){var f=this&&this.__decorate||function(x,_,j,A){var N,L=arguments.length,T=L<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,_,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(L<3?N(T):L>3?N(_,j,T):N(_,j))||T);return L>3&&T&&Object.defineProperty(_,j,T),T},g=this&&this.__param||function(x,_){return function(j,A){_(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const m=h(1439),v=h(8460),S=h(844),E=h(2585),C=Object.freeze({insertMode:!1}),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let y=l.CoreService=class extends S.Disposable{constructor(x,_,j){super(),this._bufferService=x,this._logService=_,this._optionsService=j,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new v.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new v.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(b)}reset(){this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(b)}triggerDataEvent(x,_=!1){if(this._optionsService.rawOptions.disableStdin)return;const j=this._bufferService.buffer;_&&this._optionsService.rawOptions.scrollOnUserInput&&j.ybase!==j.ydisp&&this._onRequestScrollToBottom.fire(),_&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((A=>A.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((_=>_.charCodeAt(0))))),this._onBinary.fire(x))}};l.CoreService=y=f([g(0,E.IBufferService),g(1,E.ILogService),g(2,E.IOptionsService)],y)},9074:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const f=h(8055),g=h(8460),m=h(844),v=h(6106);let S=0,E=0;class C extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new v.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,m.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const _=new b(x);if(_){const j=_.marker.onDispose((()=>_.dispose()));_.onDispose((()=>{_&&(this._decorations.delete(_)&&this._onDecorationRemoved.fire(_),j.dispose())})),this._decorations.insert(_),this._onDecorationRegistered.fire(_)}return _}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,_,j){let A=0,N=0;for(const L of this._decorations.getKeyIterator(_))A=L.options.x??0,N=A+(L.options.width??1),x>=A&&x<N&&(!j||(L.options.layer??"bottom")===j)&&(yield L)}forEachDecorationAtCell(x,_,j,A){this._decorations.forEachByKey(_,(N=>{S=N.options.x??0,E=S+(N.options.width??1),x>=S&&x<E&&(!j||(N.options.layer??"bottom")===j)&&A(N)}))}}l.DecorationService=C;class b 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(x){super(),this.options=x,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=x.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(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(v,S){this._services.set(v,S)}getService(v){return this._services.get(v)}createInstance(v,...S){const E=(0,g.getServiceDependencies)(v).sort(((y,x)=>y.index-x.index)),C=[];for(const y of E){const x=this._services.get(y.id);if(!x)throw new Error(`[createInstance] ${v.name} depends on UNKNOWN service ${y.id}.`);C.push(x)}const b=E.length>0?E[0].index:S.length;if(S.length!==b)throw new Error(`[createInstance] First service dependency of ${v.name} at position ${b+1} conflicts with ${S.length} static arguments`);return new v(...S,...C)}}},7866:function(p,l,h){var f=this&&this.__decorate||function(b,y,x,_){var j,A=arguments.length,N=A<3?y:_===null?_=Object.getOwnPropertyDescriptor(y,x):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,y,x,_);else for(var L=b.length-1;L>=0;L--)(j=b[L])&&(N=(A<3?j(N):A>3?j(y,x,N):j(y,x))||N);return A>3&&N&&Object.defineProperty(y,x,N),N},g=this&&this.__param||function(b,y){return function(x,_){y(x,_,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const m=h(844),v=h(2585),S={trace:v.LogLevelEnum.TRACE,debug:v.LogLevelEnum.DEBUG,info:v.LogLevelEnum.INFO,warn:v.LogLevelEnum.WARN,error:v.LogLevelEnum.ERROR,off:v.LogLevelEnum.OFF};let E,C=l.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=v.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),E=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let y=0;y<b.length;y++)typeof b[y]=="function"&&(b[y]=b[y]())}_log(b,y,x){this._evalLazyOptionalParams(x),b.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+y,...x)}trace(b,...y){var x;this._logLevel<=v.LogLevelEnum.TRACE&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.trace.bind(this._optionsService.options.logger))??console.log,b,y)}debug(b,...y){var x;this._logLevel<=v.LogLevelEnum.DEBUG&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.debug.bind(this._optionsService.options.logger))??console.log,b,y)}info(b,...y){var x;this._logLevel<=v.LogLevelEnum.INFO&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.info.bind(this._optionsService.options.logger))??console.info,b,y)}warn(b,...y){var x;this._logLevel<=v.LogLevelEnum.WARN&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.warn.bind(this._optionsService.options.logger))??console.warn,b,y)}error(b,...y){var x;this._logLevel<=v.LogLevelEnum.ERROR&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.error.bind(this._optionsService.options.logger))??console.error,b,y)}};l.LogService=C=f([g(0,v.IOptionsService)],C),l.setTraceLogger=function(b){E=b},l.traceCall=function(b,y,x){if(typeof x.value!="function")throw new Error("not supported");const _=x.value;x.value=function(...j){if(E.logLevel!==v.LogLevelEnum.TRACE)return _.apply(this,j);E.trace(`GlyphRenderer#${_.name}(${j.map((N=>JSON.stringify(N))).join(", ")})`);const A=_.apply(this,j);return E.trace(`GlyphRenderer#${_.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 v=["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 b={...l.DEFAULT_OPTIONS};for(const y in C)if(y in b)try{const x=C[y];b[y]=this._sanitizeAndValidateOption(y,x)}catch(x){console.error(x)}this.rawOptions=b,this.options={...b},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,b){return this.onOptionChange((y=>{y===C&&b(this.rawOptions[C])}))}onMultipleOptionChange(C,b){return this.onOptionChange((y=>{C.indexOf(y)!==-1&&b()}))}_setupOptions(){const C=y=>{if(!(y in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);return this.rawOptions[y]},b=(y,x)=>{if(!(y in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);x=this._sanitizeAndValidateOption(y,x),this.rawOptions[y]!==x&&(this.rawOptions[y]=x,this._onOptionChange.fire(y))};for(const y in this.rawOptions){const x={get:C.bind(this,y),set:b.bind(this,y)};Object.defineProperty(this.options,y,x)}}_sanitizeAndValidateOption(C,b){switch(C){case"cursorStyle":if(b||(b=l.DEFAULT_OPTIONS[C]),!(function(y){return y==="block"||y==="underline"||y==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${C}`);break;case"wordSeparator":b||(b=l.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=v.includes(b)?b:l.DEFAULT_OPTIONS[C];break;case"cursorWidth":b=Math.floor(b);case"lineHeight":case"tabStopWidth":if(b<1)throw new Error(`${C} cannot be less than 1, value: ${b}`);break;case"minimumContrastRatio":b=Math.max(1,Math.min(21,Math.round(10*b)/10));break;case"scrollback":if((b=Math.min(b,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${b}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(b<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${b}`);break;case"rows":case"cols":if(!b&&b!==0)throw new Error(`${C} must be numeric, value: ${b}`);break;case"windowsPty":b=b??{}}return b}}l.OptionsService=S},2660:function(p,l,h){var f=this&&this.__decorate||function(S,E,C,b){var y,x=arguments.length,_=x<3?E:b===null?b=Object.getOwnPropertyDescriptor(E,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(S,E,C,b);else for(var j=S.length-1;j>=0;j--)(y=S[j])&&(_=(x<3?y(_):x>3?y(E,C,_):y(E,C))||_);return x>3&&_&&Object.defineProperty(E,C,_),_},g=this&&this.__param||function(S,E){return function(C,b){E(C,b,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const m=h(2585);let v=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,b=this._getEntryIdKey(C),y=this._entriesWithId.get(b);if(y)return this.addLineToLink(y.id,E.ybase+E.y),y.id;const x=E.addMarker(E.ybase+E.y),_={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(_,x))),this._entriesWithId.set(_.key,_),this._dataByLinkId.set(_.id,_),_.id}addLineToLink(S,E){const C=this._dataByLinkId.get(S);if(C&&C.lines.every((b=>b.line!==E))){const b=this._bufferService.buffer.addMarker(E);C.lines.push(b),b.onDispose((()=>this._removeMarkerFromLink(C,b)))}}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=v=f([g(0,m.IBufferService)],v)},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(v,S,E){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,b,y){b[h]===b?b[f].push({id:C,index:y}):(b[f]=[{id:C,index:y}],b[h]=b)})(m,v,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 b=S.length;for(let y=0;y<b;++y){let x=S.charCodeAt(y);if(55296<=x&&x<=56319){if(++y>=b)return E+this.wcwidth(x);const A=S.charCodeAt(y);56320<=A&&A<=57343?x=1024*(x-55296)+A-56320+65536:E+=this.wcwidth(A)}const _=this.charProperties(x,C);let j=m.extractWidth(_);m.extractShouldJoin(_)&&(j-=m.extractWidth(C)),E+=j,C=_}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 u={};return(()=>{var p=u;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),v=c(7975),S=c(7090),E=["cols","rows"];class C extends f.Disposable{constructor(y){super(),this._core=this.register(new h.Terminal(y)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const x=j=>this._core.options[j],_=(j,A)=>{this._checkReadonlyOptions(j),this._core.options[j]=A};for(const j in this._core.options){const A={get:x.bind(this,j),set:_.bind(this,j)};Object.defineProperty(this._publicOptions,j,A)}}_checkReadonlyOptions(y){if(E.includes(y))throw new Error(`Option "${y}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new v.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new 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 y=this._core.coreService.decPrivateModes;let x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:y.applicationCursorKeys,applicationKeypadMode:y.applicationKeypad,bracketedPasteMode:y.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:y.origin,reverseWraparoundMode:y.reverseWraparound,sendFocusMode:y.sendFocus,wraparoundMode:y.wraparound}}get options(){return this._publicOptions}set options(y){for(const x in y)this._publicOptions[x]=y[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(y,x=!0){this._core.input(y,x)}resize(y,x){this._verifyIntegers(y,x),this._core.resize(y,x)}open(y){this._core.open(y)}attachCustomKeyEventHandler(y){this._core.attachCustomKeyEventHandler(y)}attachCustomWheelEventHandler(y){this._core.attachCustomWheelEventHandler(y)}registerLinkProvider(y){return this._core.registerLinkProvider(y)}registerCharacterJoiner(y){return this._checkProposedApi(),this._core.registerCharacterJoiner(y)}deregisterCharacterJoiner(y){this._checkProposedApi(),this._core.deregisterCharacterJoiner(y)}registerMarker(y=0){return this._verifyIntegers(y),this._core.registerMarker(y)}registerDecoration(y){return this._checkProposedApi(),this._verifyPositiveIntegers(y.x??0,y.width??0,y.height??0),this._core.registerDecoration(y)}hasSelection(){return this._core.hasSelection()}select(y,x,_){this._verifyIntegers(y,x,_),this._core.select(y,x,_)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(y,x){this._verifyIntegers(y,x),this._core.selectLines(y,x)}dispose(){super.dispose()}scrollLines(y){this._verifyIntegers(y),this._core.scrollLines(y)}scrollPages(y){this._verifyIntegers(y),this._core.scrollPages(y)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(y){this._verifyIntegers(y),this._core.scrollToLine(y)}clear(){this._core.clear()}write(y,x){this._core.write(y,x)}writeln(y,x){this._core.write(y),this._core.write(`\r
|
|
65
|
-
`,x)}paste(y){this._core.paste(y)}refresh(y,x){this._verifyIntegers(y,x),this._core.refresh(y,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(y){this._addonManager.loadAddon(this,y)}static get strings(){return l}_verifyIntegers(...y){for(const x of y)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...y){for(const x of y)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}p.Terminal=C})(),u})()))})(Cd)),Cd.exports}var CS=wS();/**
|
|
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 kS=2,ES=1,jS=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let r=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var m;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let r=this._terminal.options.scrollback===0?0:((m=this._terminal.options.overviewRuler)==null?void 0:m.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),c=Math.max(0,parseInt(i.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),p={top:parseInt(u.getPropertyValue("padding-top")),bottom:parseInt(u.getPropertyValue("padding-bottom")),right:parseInt(u.getPropertyValue("padding-right")),left:parseInt(u.getPropertyValue("padding-left"))},l=p.top+p.bottom,h=p.right+p.left,f=s-l,g=c-h-r;return{cols:Math.max(kS,Math.floor(g/e.css.cell.width)),rows:Math.max(ES,Math.floor(f/e.css.cell.height))}}};function NS({sessionId:e,onClose:r,onEscape:i,autoFocus:s}){const c=P.useRef(null),u=P.useRef(e),p=P.useRef(null),l=P.useRef(null),h=sr(g=>g.writeSession),f=sr(g=>g.resizeSession);return P.useEffect(()=>{u.current=e},[e]),P.useEffect(()=>{if(!i)return;const g=m=>{(m.key==="²"||m.key==="`")&&(m.preventDefault(),m.stopPropagation(),i())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i]),P.useEffect(()=>{if(!c.current)return;const g=new CS.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new jS;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 v=c.current.querySelector(".xterm");v&&(v.style.padding="8px"),m.fit(),s&&setTimeout(()=>{g.focus()},150);const S=new ResizeObserver(()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{requestAnimationFrame(()=>{var b;m.fit&&m.fit();const C=(b=p.current)==null?void 0:b.term;C&&C.cols>0&&C.rows>0&&f(u.current,C.cols,C.rows)})},100)});S.observe(c.current),g.onData(C=>{if((C==="\x1B"||C==="²"||C==="`")&&i){i();return}h(u.current,C)}),g.onKey(C=>{(C.key==="\x1B"||C.key==="²"||C.key==="`")&&i&&(C.domEvent.stopPropagation(),i())});const E=Ht.subscribe(C=>{var b,y;if(C.type==="terminal.output"&&((b=C.payload)==null?void 0:b.sessionId)===u.current){const x=(y=C.payload)==null?void 0:y.data;x&&g.write(x)}});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 TS(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 AS({isOpen:e,onClose:r,onFocusChat:i}){const s=sr(C=>C.createSession),c=sr(C=>C.killSession),u=sr(C=>C.sessions),p=sr(C=>C.setWorkdir),l=sr(C=>C.fetchSessions),h=Ut(C=>C.currentProject),[f,g]=P.useState(!0),m=P.useRef(null),v=P.useRef(!1),S=P.useRef(!1),E=P.useCallback(()=>{r(),i()},[r,i]);return P.useEffect(()=>{h!=null&&h.workdir&&p(h.workdir)},[h==null?void 0:h.workdir,p]),P.useEffect(()=>{e&&(g(!0),l().finally(()=>g(!1)))},[e,l]),P.useEffect(()=>{e&&u.length===0&&!f&&!S.current&&(S.current=!0,s())},[e,u.length,f,s]),P.useEffect(()=>{e?(v.current=!0,setTimeout(()=>{var C;(C=m.current)==null||C.focus(),setTimeout(()=>{v.current=!1},200)},100)):S.current=!1},[e]),P.useEffect(()=>{if(!e)return;const C=b=>{v.current||(b.key==="Escape"||b.key==="²"||b.key==="`")&&(b.preventDefault(),r(),i())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,r,i]),e?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-x-0 top-[50vh] bottom-0 z-[100] bg-black/40",style:{pointerEvents:"auto"},onClick:E}),o.jsxs("div",{ref:m,tabIndex:-1,className:"fixed inset-x-0 top-0 z-[100] h-[50vh] bg-bg-primary border-b border-border flex flex-col animate-slide-down outline-none",onClick:C=>C.stopPropagation(),onKeyDown:C=>{(C.key==="Escape"||C.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..."}):u.length===0?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"mb-4",children:"No terminal sessions"}),o.jsx("button",{onClick:()=>s(),className:"px-4 py-2 bg-accent-primary/25 text-white rounded hover:bg-accent-primary/40 transition-colors",children:"Create Terminal"})]})}):o.jsx("div",{className:`grid ${TS(u.length)} gap-2 h-full auto-rows-fr`,children:u.map(C=>o.jsx(NS,{sessionId:C.id,onClose:()=>c(C.id),onEscape:E,autoFocus:u.length===1},C.id))})})]})]}):null}function Ka({items:e,trigger:r,minWidth:i="120px"}){const[s,c]=P.useState(!1),[u,p]=P.useState(null),l=P.useRef(null),h=P.useRef(null);P.useEffect(()=>{function v(S){h.current&&!h.current.contains(S.target)&&c(!1)}return s&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[s]);const f=P.useCallback(()=>{if(!l.current)return;const v=l.current.getBoundingClientRect(),S=200,C=window.innerHeight-v.bottom<S;p({top:C?v.top-S-4:v.bottom+4,left:v.left,alignToTop:C})},[]),g=v=>{v.stopPropagation(),s||f(),c(!s)},m=u&&o.jsx("div",{ref:h,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${u.alignToTop?"mb-1":"mt-1"}`,style:{top:u.top,left:u.left,minWidth:i},children:e.map((v,S)=>{const E=o.jsxs(o.Fragment,{children:[v.icon&&o.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:v.icon}),v.label]});return v.href?o.jsx(Dn,{href:v.href,onClick:C=>{var b;(b=v.onClick)==null||b.call(v,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 ${v.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 b;(b=v.onClick)==null||b.call(v,C),v.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 ${v.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&&Hl.createPortal(m,document.body)]})}function ub(e){const r=new Date(e),s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],c=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),p=String(r.getDate()).padStart(2,"0");return`${s} ${c}/${u}/${p}`}function gh(e){const r=new Date(e),i=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0");return`${i}:${s}`}function DS(e){const r=new Date(e),i=new Date,s=new Date(i.getFullYear(),i.getMonth(),i.getDate()),c=new Date(r.getFullYear(),r.getMonth(),r.getDate()),u=Math.floor((s.getTime()-c.getTime())/(1e3*60*60*24)),p=gh(e);if(u===0)return`today ${p}`;if(u===1)return`yesterday ${p}`;if(u<7)return`${u} 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 LS(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 db(e){const r=new Map;for(const c of e){const u=LS(c.updatedAt);r.has(u)||r.set(u,[]),r.get(u).push(c)}for(const[c,u]of r)u.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,u)=>u.localeCompare(c)),s=new Map;for(const c of i)s.set(c,r.get(c));return s}function RS({projects:e,currentProject:r}){const i=Ut(u=>u.loadProject),c=[...e].sort((u,p)=>u.name.localeCompare(p.name)).map(u=>({label:u.name,icon:u.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/${u.id}`,onClick:()=>{i(u.id)}}));return o.jsx(Ka,{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 MS({currentProject:e,sessions:r,currentSession:i,projectIdFromUrl:s}){const[c,u]=P.useState(!1),p=P.useRef(null);if(P.useEffect(()=>{function f(g){p.current&&!p.current.contains(g.target)&&u(!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(Dn,{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(Dn,{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(Dn,{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:()=>u(!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===Dn){const m=f.label,v=m.props.href||"";return o.jsxs(Dn,{href:v,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),u(!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 OS({sessions:e,currentProject:r,currentSession:i}){var h;const s=Ce(f=>f.loadSession),c=e.filter(f=>f.projectId===r.id).slice(0,15),u=db(c),p=[];p.push({label:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New session"})]}),href:`/p/${r.id}/new`,onClick:()=>{}});for(const[f,g]of u){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:ub(m.updatedAt)}),onClick:()=>{}});for(const v of g)p.push({label:o.jsxs("div",{className:"min-w-[160px]",children:[o.jsx("div",{className:"truncate text-sm",children:v.title??v.id.slice(0,8)}),o.jsx("div",{className:"text-text-muted text-xs",children:gh(v.updatedAt)})]}),icon:v.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/${v.id}`,onClick:()=>{s(v.id)}})}}const l=i?((h=i.metadata)==null?void 0:h.title)??i.id.slice(0,8):"No session selected";return o.jsx(Ka,{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 IS({onMenuClick:e,onCriteriaToggle:r}){const[i,s]=P.useState(!1),[c]=ar(),u=c.startsWith("/p/"),p=/^\/p\/[^/]+\/s\/[^/]+$/.test(c),l=Ce(b=>b.currentSession),h=Ce(b=>b.sessions),f=Ut(b=>b.currentProject),g=Ut(b=>b.projects),m=jt(b=>b.startAutoRefresh),v=jt(b=>b.stopAutoRefresh),S=sr(b=>b.setOpen),E=sr(b=>b.isOpen),C=P.useCallback(()=>{const b=document.querySelector('textarea[placeholder*="What would you like to build"], textarea[placeholder*="Send a message"]');b&&b.focus()},[]);return P.useEffect(()=>{const b=y=>{(y.key==="²"||y.key==="`")&&(y.preventDefault(),E||S(!0))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[E,S]),P.useEffect(()=>(m(),()=>v()),[m,v]),o.jsxs("header",{className:"h-8 bg-bg-secondary border-b border-border flex items-center justify-between px-2",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e&&u&&o.jsx("button",{onClick:e,className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle session list",children:o.jsx("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(Dn,{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(RS,{projects:g,currentProject:f})}),o.jsx("span",{className:"md:hidden",children:o.jsx(MS,{currentProject:f,sessions:h,currentSession:l,projectIdFromUrl:u&&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(OS,{sessions:h,currentProject:f,currentSession:l})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u&&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(yS,{isOpen:i,onClose:()=>s(!1)}),o.jsx(AS,{isOpen:E,onClose:()=>S(!1),onFocusChat:C})]})}function BS({isOpen:e,onClose:r,title:i,label:s,description:c,placeholder:u,value:p,isLoading:l=!1,onSave:h}){const[f,g]=P.useState(p),[m,v]=P.useState(!1),[S,E]=P.useState(!1);P.useEffect(()=>{g(p),v(!1)},[p]);const C=_=>{g(_.target.value),v(!0)},b=async()=>{E(!0),await h(f),E(!1),v(!1),r()},y=()=>{g(p),v(!1),r()},x=l||S;return o.jsx(dn,{isOpen:e,onClose:y,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:u,className:"w-full h-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:x})}),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:y,children:"Cancel"}),o.jsx(dt,{variant:"primary",onClick:b,disabled:!m||x,children:S?"Saving...":"Save"})]})]})})}function zS({isOpen:e,onClose:r,project:i}){const s=Ut(u=>u.updateProject),c=async u=>{s(i.id,{customInstructions:u||null}),await new Promise(p=>setTimeout(p,100))};return o.jsx(BS,{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 hb({projectId:e,isOpen:r=!0,onClose:i}){const[,s]=ar(),[c,u]=P.useState(!1),p=Ce(j=>j.sessions),l=Ce(j=>j.currentSession),h=Ce(j=>j.unreadSessionIds),f=Ce(j=>j.deleteSession),g=Ce(j=>j.deleteAllSessions),m=Ce(j=>j.loadMoreSessions),v=Ce(j=>j.sessionsHasMore),S=Ce(j=>j.sessionsPaginationLoading),E=Ut(j=>j.currentProject),C=P.useRef(null),b=P.useCallback(()=>{v&&!S&&E&&m(E.id)},[v,S,E,m]);P.useEffect(()=>{if(!C.current||!v)return;const j=new IntersectionObserver(A=>{const N=A[0];N&&N.isIntersecting&&b()},{threshold:.1});return j.observe(C.current),()=>j.disconnect()},[v,b]);const y=p.filter(j=>j.projectId===(E==null?void 0:E.id)),x=(j,A)=>{A==null||A.stopPropagation(),confirm("Delete this session?")&&(f(j),(l==null?void 0:l.id)===j&&s(`/p/${e}`))},_=()=>{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(Dn,{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(Ka,{items:[{label:"Edit project settings",onClick:()=>u(!0)},{label:"Delete all sessions",onClick:_,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(zS,{isOpen:c,onClose:()=>u(!1),project:E}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:y.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:HS(y,l,h,x,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 HS(e,r,i,s,c){const u=db(e);return Array.from(u).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:ub(h.updatedAt)}),l.map(f=>{const g=(r==null?void 0:r.id)===f.id,m=i.includes(f.id),v=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(Dn,{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(Ka,{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:[v?o.jsxs("svg",{"aria-label":"Session running",className:"w-3 h-3 text-blue-400 animate-spin flex-shrink-0",viewBox:"0 0 24 24",fill:"none",children:[o.jsx("title",{children:"Running"}),o.jsx("circle",{className:"opacity-30",cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3"}),o.jsx("path",{d:"M21 12a9 9 0 00-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}):m&&!g?o.jsx("span",{"aria-label":"Unread activity",title:"Unread activity",className:"w-2 h-2 rounded-full bg-amber-400 flex-shrink-0"}):null,o.jsx("span",{className:"text-text-muted text-xs flex-shrink-0",children:gh(f.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[f.messageCount," messages"]})]})]})},f.id)})]},p):null})}const Cx=["⠋","⠙","⠹","⠸","⠼","⠴"];function PS(){var l;const e=Ut(h=>h.currentProject),r=Ce(h=>h.currentSession),i=ob(),s=!1,c=P.useRef(0),u=P.useRef(null);P.useEffect(()=>(i?(u.current=window.setInterval(()=>{c.current=(c.current+1)%Cx.length,p()},150),p()):(u.current&&(clearInterval(u.current),u.current=null),p()),()=>{u.current&&(clearInterval(u.current),u.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?`${Cx[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 Pl=P.forwardRef(({className:e="",...r},i)=>o.jsx("input",{ref:i,className:`bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 focus:border-accent-primary ${e}`,...r}));Pl.displayName="Input";function FS({isOpen:e,onClose:r,projectName:i,onConfirm:s}){const c=()=>{s(),r()};return o.jsx(dn,{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 US(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 $S({isOpen:e,onClose:r}){const[,i]=ar(),[s,c]=P.useState(""),[u,p]=P.useState(null),[l,h]=P.useState(!1),[f,g]=P.useState(""),m=P.useRef(null);P.useEffect(()=>{e&&(ye("/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 v=P.useCallback(async C=>{C.preventDefault();const b=US(s);if(!b.valid){p(b.error);return}h(!0),p(null);const y=`${f}/${s}`;try{const x=await ye("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:y})});if(!x.ok){const A=await x.json().catch(()=>({}));throw new Error(A.error||"Failed to create project")}const j=(await x.json()).project;r(),i(`/p/${j.id}`)}catch(x){p(x instanceof Error?x.message:"Failed to create project"),h(!1)}},[s,i,r,f]),S=P.useCallback(()=>{c(""),p(null),r()},[r]),E=s?`${f}/${s}`:"";return o.jsx(dn,{isOpen:e,onClose:S,title:"Create New Project",size:"sm",children:o.jsxs("form",{onSubmit:v,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),o.jsx(Pl,{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})]}),u&&o.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:u})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(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"})]})]})})}const qS={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function Fl({size:e="md",className:r=""}){return o.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${qS[e]} ${r}`})}function WS({text:e,...r}){return o.jsxs("div",{className:"text-center",children:[o.jsx(Fl,{...r,className:"mx-auto mb-4"}),e&&o.jsx("div",{className:"text-text-secondary",children:e})]})}function fb({onSelect:e,onClose:r,initialPath:i}){const[s,c]=P.useState(null),[u,p]=P.useState(!0),l=P.useCallback(async E=>{p(!0);try{const C=E?`/api/directories?path=${encodeURIComponent(E)}`:"/api/directories",y=await(await ye(C)).json();c(y)}catch(C){console.error("Failed to load directories:",C)}finally{p(!1)}},[]);P.useEffect(()=>{l(i)},[i,l]);const h=E=>{l(E)},f=E=>{e(E)},m=((s==null?void 0:s.current)??"").split("/").filter(Boolean),S=m.map((E,C)=>({name:E,path:"/"+m.slice(0,C+1).join("/")}));return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",onClick:r,children:o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg w-full max-w-2xl max-h-[80vh] flex flex-col",onClick:E=>E.stopPropagation(),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:"Select Folder"}),o.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",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"})})})]}),s&&o.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 border-b border-border",children:o.jsxs("div",{className:"flex items-center text-xs overflow-x-auto",children:[S.map((E,C)=>o.jsxs("span",{className:"flex items-center shrink-0",children:[o.jsx("span",{className:"text-text-muted",children:"/"}),o.jsx("button",{onClick:()=>h(E.path),className:`px-1 ${C===S.length-1?"text-accent-primary font-medium":"text-text-secondary hover:text-accent-primary"}`,children:E.name})]},E.path)),S.length===0&&o.jsx("button",{onClick:()=>h("/"),className:"text-text-muted hover:text-accent-primary",children:"/"})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:u?o.jsx("div",{className:"p-8 text-center",children:o.jsx(Fl,{size:"sm"})}):o.jsxs("div",{className:"divide-y divide-border",children:[(s==null?void 0:s.parent)&&o.jsxs("button",{onClick:()=>h(s.parent),className:"w-full p-3 flex items-center gap-3 hover:bg-bg-tertiary/50 text-text-muted",children:[o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),o.jsx("span",{children:".."})]}),s==null?void 0:s.directories.map(E=>o.jsxs("div",{className:"group flex items-center gap-2 hover:bg-bg-tertiary/50",children:[o.jsxs("button",{onClick:()=>h(E.path),className:"flex-1 p-3 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsx("span",{children:E.name})]}),o.jsx("button",{onClick:()=>f(E.path),className:"px-3 py-1 text-xs bg-accent-primary/10 text-accent-primary rounded opacity-0 group-hover:opacity-100 transition-opacity mr-3",children:"Select"})]},E.path)),(s==null?void 0:s.directories.length)===0&&o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:"No subdirectories"})]})}),o.jsxs("div",{className:"p-4 border-t border-border space-y-2",children:[(s==null?void 0:s.current)&&o.jsx("button",{onClick:()=>f(s.current),className:"w-full px-4 py-2 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Select this folder"}),o.jsx("button",{onClick:r,className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]})]})})}function GS({isOpen:e,onClose:r}){const[,i]=ar(),[s,c]=P.useState(!1),[u,p]=P.useState(""),[l,h]=P.useState(null),[f,g]=P.useState(!1),[m,v]=P.useState(null),S=Ut(R=>R.projects),E=Ut(R=>R.createProject),C=Ut(R=>R.listProjects),b=Ut(R=>R.deleteProject),[y,x]=P.useState(null),[_,j]=P.useState(-1),[A,N]=P.useState(null),[L,T]=P.useState(!1),I=P.useRef([]);P.useEffect(()=>{ye("/api/config").then(R=>R.json()).then(R=>{R.workdir&&v(R.workdir)})},[]);const z=P.useCallback(async R=>{g(!0);try{const D=R?`/api/directories?path=${encodeURIComponent(R)}`:m?`/api/directories?path=${encodeURIComponent(m)}`:"/api/directories",W=await(await ye(D)).json();h(W)}catch(D){console.error("Failed to load directories:",D)}finally{g(!1)}},[m]);P.useEffect(()=>{e&&m&&(z(m),C())},[e,m,z,C]);const V=(l==null?void 0:l.directories.filter(R=>u===""||R.name.toLowerCase().includes(u.toLowerCase())))??[],Y=[...l!=null&&l.parent&&!u?[{type:"parent",path:l.parent,name:".."}]:[],...V.map(R=>({type:"directory",path:R.path,name:R.name}))],$=R=>{i(`/p/${R}`),r()},F=(R,D)=>{D.stopPropagation(),N(R)},B=()=>{A&&(b(A.id),N(null))},q=R=>{const D=R.split("/").filter(Boolean).pop()??"";E(D,R),C(),x(R)};P.useEffect(()=>{if(y){const R=S.find(D=>D.workdir===y);R&&(i(`/p/${R.id}`),r(),x(null))}},[S,y,i,r]),P.useEffect(()=>{j(Y.length>0?0:-1)},[u,Y.length]);const X=R=>{p(""),z(R)},J=P.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 W=O+1;return W>=Y.length?0:W});else if(R.key==="ArrowUp")j(O=>{const W=O-1;return W<0?Y.length-1:W});else if(R.key==="Enter"&&_>=0&&_<Y.length){const O=Y[_];(O==null?void 0:O.type)==="parent"?X(O.path):O&&q(O.path)}}},[e,Y.length,_,X,q,r]);return P.useEffect(()=>{if(e)return document.addEventListener("keydown",J),()=>document.removeEventListener("keydown",J)},[e,J]),P.useEffect(()=>{_>=0&&I.current[_]&&I.current[_].scrollIntoView({behavior:"smooth",block:"nearest"})},[_]),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:()=>$(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=>F(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.jsxs("div",{className:"p-3 border-b border-border bg-bg-tertiary/30 flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Browse Projects"}),o.jsx("button",{onClick:()=>T(!0),className:"text-xs text-accent-primary hover:underline",children:"Open in dialog"})]}),o.jsx("div",{className:"p-3 border-b border-border",children:o.jsx(Pl,{value:u,onChange:R=>p(R.target.value),placeholder:"Filter directories...",className:"w-full"})}),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"})}):Y.length===0?o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:u?"No matching directories":"No subdirectories"}):o.jsx("div",{className:"divide-y divide-border",children:Y.map((R,D)=>o.jsxs("button",{ref:O=>{I.current[D]=O},onClick:()=>R.type==="parent"?X(R.path):q(R.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${D===_?"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($S,{isOpen:s,onClose:()=>c(!1)}),A&&o.jsx(FS,{isOpen:!0,onClose:()=>N(null),projectName:A.name,onConfirm:B}),L&&o.jsx(fb,{initialPath:m??void 0,onSelect:R=>{q(R),T(!1)},onClose:()=>T(!1)})]}):null}function VS(){const[e,r]=P.useState(!1),i=Ce(g=>g.sessions),s=Ut(g=>g.projects),c=Ut(g=>g.listProjects),u=Ce(g=>g.listSessions),p=Ce(g=>g.connectionStatus);P.useEffect(()=>{p==="connected"&&(c(),u())},[p,c,u]);const l=[...s].sort((g,m)=>{const v=i.filter(b=>b.workdir.startsWith(g.workdir)),S=i.filter(b=>b.workdir.startsWith(m.workdir)),E=v.length>0?new Date(v.reduce((b,y)=>new Date(y.updatedAt)>new Date(b.updatedAt)?y:b).updatedAt).getTime():new Date(g.updatedAt).getTime();return(S.length>0?new Date(S.reduce((b,y)=>new Date(y.updatedAt)>new Date(b.updatedAt)?y:b).updatedAt).getTime():new Date(m.updatedAt).getTime())-E}),h=g=>{const m=s.find(v=>v.id===g);return m?i.filter(v=>v.workdir.startsWith(m.workdir)).sort((v,S)=>new Date(S.updatedAt).getTime()-new Date(v.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(Dn,{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(Dn,{href:`/p/${g.id}/new`,className:"rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-1.5 py-1 text-xs",children:"+ New Session"})]}),o.jsx("div",{className:"divide-y divide-border",children:m.length>0?m.map(v=>{const S=s.find(C=>v.workdir.startsWith(C.workdir)),E=S?`/p/${S.id}/s/${v.id}`:"#";return o.jsx(Dn,{href:E,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm text-text-muted truncate",children:v.title??v.id.slice(0,8)})})}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-text-muted text-xs",children:DS(v.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs",children:[v.messageCount," msgs"]})]})]})},v.id)}):o.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},g.id)}),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(GS,{isOpen:e,onClose:()=>r(!1)})]})}function YS(){const[,e]=mh("/p/:projectId/new"),[,r]=ar(),i=e==null?void 0:e.projectId,s=Ce(c=>c.createSession);return P.useEffect(()=>{i&&(async()=>{const u=await s(i);r(u?`/p/${i}/s/${u.id}`:`/p/${i}`)})()},[i,s,r]),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Fl,{})})}function KS(){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(Dn,{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 Ta=e=>Math.round(e*10)/10;function Xd(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function XS(e){return`${e.providerId}::${e.model}`}function ZS(e){return`${e.providerName} > ${e.model}`}function kx(e){let r=0,i=0,s=0,c=0,u=0,p=0;const l=[],h=[];let f=0;for(const[v,S]of e.entries()){const E=S.stats,C=Xd(E);r+=E.totalTime,i+=E.toolTime,s+=E.prefillTokens,c+=E.generationTokens;const b=E.prefillSpeed>0?E.prefillTokens/E.prefillSpeed:0,y=E.generationSpeed>0?E.generationTokens/E.generationSpeed:0;u+=b,p+=y,l.push({messageId:S.id,timestamp:S.timestamp,...C,mode:E.mode,responseIndex:v+1,prefillTokens:E.prefillTokens,generationTokens:E.generationTokens,prefillSpeed:E.prefillSpeed,generationSpeed:E.generationSpeed,totalTime:E.totalTime,aiTime:E.totalTime-E.toolTime,toolTime:E.toolTime});const x=E.llmCalls??[];for(const _ of x)f+=1,h.push({messageId:S.id,timestamp:_.timestamp??S.timestamp,providerId:_.providerId,providerName:_.providerName,backend:_.backend,model:_.model,mode:E.mode,responseIndex:v+1,sessionCallIndex:f,callIndex:_.callIndex,promptTokens:_.promptTokens,completionTokens:_.completionTokens,ttft:_.ttft,completionTime:_.completionTime,prefillSpeed:_.prefillSpeed,generationSpeed:_.generationSpeed,totalTime:_.totalTime})}const g=u>0?Ta(s/u):0,m=p>0?Ta(c/p):0;return{totalTime:Ta(r),aiTime:Ta(r-i),toolTime:Ta(i),prefillTokens:s,generationTokens:c,avgPrefillSpeed:g,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:h.length,dataPoints:l,callDataPoints:h}}function QS(e){const r=e.filter(c=>c.stats!==void 0&&c.stats!==null).sort((c,u)=>new Date(c.timestamp).getTime()-new Date(u.timestamp).getTime());if(r.length===0)return null;const i=new Map;for(const c of r){const u=XS(Xd(c.stats)),p=i.get(u)??[];i.set(u,[...p,c])}const s=Array.from(i.entries()).map(([c,u])=>{const p=Xd(u[0].stats),l=kx(u);return{...p,key:c,label:ZS(p),...l}});return{...kx(r),modelGroups:s}}function JS(e){return P.useMemo(()=>QS(e),[e])}function ew(e){const[r,i]=P.useState(null),[s,c]=P.useState(!0),[u,p]=P.useState(null),l=e||"";return P.useEffect(()=>{if(!l){c(!1);return}let h=!0,f=null;const g=async()=>{try{const v=await(await ye(`/api/branch?workdir=${encodeURIComponent(l)}`)).json();h&&(i(v.branch),p(v.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:u}}function Tl(e){return e.toLocaleString("en-US").replace(/,/g," ")}function Ex(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function tw(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 nw="modulepreload",rw=function(e){return"/"+e},jx={},iw=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=rw(f),f in jx)return;jx[f]=!0;const g=f.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const v=document.createElement("link");if(v.rel=g?"stylesheet":nw,g||(v.as="script"),v.crossOrigin="",v.href=f,h&&v.setAttribute("nonce",h),document.head.appendChild(v),g)return new Promise((S,E)=>{v.addEventListener("load",S),v.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${f}`)))})}))}function u(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"&&u(l.reason);return r().catch(u)})},Nx=["▁","▂","▃","▄","▅","▆","▇","█"];function sw(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 aw(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 ow(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const i=[...e].sort((m,v)=>m.x-v.x),s=i[0].x,c=i[i.length-1].x,u=Math.min(...i.map(m=>m.y)),p=Math.max(...i.map(m=>m.y)),{minY:l,maxY:h}=aw(u,p),f=Array.from({length:r},()=>" "),g=new Map;for(const m of i){const v=c===s?0:Math.round((m.x-s)/(c-s)*(r-1)),S=g.get(v)??[];g.set(v,[...S,m.y])}for(const[m,v]of g){const S=Math.max(...v);f[m]=Nx[sw(S,l,h)]??Nx[0]}return{blocks:f.join(""),minX:s,maxX:c,minY:l,maxY:h}}function Tx(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Ax({data:e,width:r=60,height:i=78,label:s,xLabel:c,yLabel:u,showAxes:p=!0,formatY:l=Tx,formatX:h=Tx}){const f=P.useMemo(()=>{const g=ow(e,r),m=Math.max(r*6,240),v=10,S=8,C=[...e].sort((_,j)=>_.x-j.x).map(_=>{const j=g.maxX===g.minX?m/2:v+(_.x-g.minX)/(g.maxX-g.minX)*(m-v*2),A=g.maxY===g.minY?i/2:S+(g.maxY-_.y)/(g.maxY-g.minY)*(i-S*2);return{..._,cx:j,cy:A,leftPercent:j/m*100,topPercent:A/i*100}}),b=C.map((_,j)=>`${j===0?"M":"L"} ${_.cx.toFixed(1)} ${_.cy.toFixed(1)}`).join(" "),x=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(_=>({value:_,y:g.maxY===g.minY?i/2:S+(g.maxY-_)/(g.maxY-g.minY)*(i-S*2)}));return{...g,chartWidth:m,points:C,path:b,gridLines:x}},[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)})]})]}),u&&p&&o.jsx("div",{className:"text-text-muted mt-1 text-center",children:u})]})}function lw({data:e,prefillLabel:r="Prefill Speed (tok/s) by Response",generationLabel:i="Generation Speed (tok/s) by Response",xLabel:s="response",width:c=60}){const u=e.map(l=>({x:l.x,y:l.ppSpeed})),p=e.map(l=>({x:l.x,y:l.tgSpeed}));return o.jsxs("div",{className:"space-y-5",children:[o.jsx(Ax,{data:u,width:c,label:r,xLabel:s}),o.jsx(Ax,{data:p,width:c,label:i,xLabel:s})]})}function cw(e){const r=new Map;for(const i of e.callDataPoints){const s=r.get(i.messageId)??[];r.set(i.messageId,[...s,i])}return e.dataPoints.map(i=>{const s=[...r.get(i.messageId)??[]].sort((c,u)=>c.callIndex-u.callIndex);return{...i,callCount:s.length,calls:s,isExpandable:s.length>1}})}function uw(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 dw(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 hw(e){return e.callDataPoints.length>0?dw(e):uw(e)}function kd(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 Ni(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function Ia(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function fw(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),i=Math.max(...e);return r===i?`${Ni(r)} ctx`:`${Ni(r)}-${Ni(i)} ctx`}function Al(e){return`${Ia(e)} t/s`}function pb(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function pw(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 mw({isOpen:e,onClose:r,stats:i}){const s=P.useRef(null),[c,u]=P.useState({}),[p,l]=P.useState(()=>{var E;return((E=i.modelGroups[0])==null?void 0:E.key)??""});P.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=P.useMemo(()=>i.modelGroups.find(E=>E.key===p)??i.modelGroups[0],[p,i.modelGroups]),f=P.useMemo(()=>h?cw(h):[],[h]),g=P.useMemo(()=>h?hw(h):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[h]),m=P.useCallback(E=>{u(C=>({...C,[E]:!C[E]}))},[]),v=P.useCallback(()=>{if(!h)return;const E=pw(h);navigator.clipboard.writeText(JSON.stringify(E,null,2)).catch(C=>console.error("Failed to copy:",C))},[h]),S=P.useCallback(async()=>{if(s.current)try{const E=(await iw(async()=>{const{default:y}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:y}},[])).default,C=await E(s.current,{backgroundColor:"#1a1a1a",scale:2}),b=document.createElement("a");b.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,b.href=C.toDataURL("image/png"),b.click()}catch(E){console.error("Failed to export PNG:",E),v()}},[v]);return o.jsx(dn,{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:kd(h.aiTime)}),o.jsx(Er,{label:"Total Time",value:kd(h.totalTime)}),o.jsx(Er,{label:"Tool Time",value:kd(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:Ni(h.prefillTokens),subValue:`@ ${Ia(h.avgPrefillSpeed)} tok/s`}),o.jsx(Er,{label:"Gen Tokens",value:Ni(h.generationTokens),subValue:`@ ${Ia(h.avgGenerationSpeed)} tok/s`}),o.jsx(Er,{label:"Avg PP Speed",value:`${Ia(h.avgPrefillSpeed)}`,subValue:"tok/s"}),o.jsx(Er,{label:"Avg TG Speed",value:`${Ia(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:v,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Copy JSON"}),o.jsx("button",{onClick: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(lw,{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(P.Fragment,{children:[o.jsx(gw,{row:E,index:C,isExpanded:c[E.messageId]??!1,onToggle:E.isExpandable?()=>m(E.messageId):void 0}),(c[E.messageId]??!1)&&E.calls.map((b,y)=>o.jsx(xw,{dataPoint:b,index:y},`${b.messageId}-${b.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 gw({row:e,index:r,isExpanded:i,onToggle:s}){const c=e.calls.length>0?fw(e.calls.map(u=>u.promptTokens)):`${Ni(e.prefillTokens)} ctx`;return o.jsxs("tr",{onClick:s,className:`${r%2===0?"bg-bg-tertiary/20":""} ${s?"cursor-pointer hover:bg-bg-tertiary/35 transition-colors":""}`,children:[o.jsx("td",{className:"px-3 py-2 text-center text-text-muted align-middle",children:e.responseIndex}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:pb(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:c.replace(/ ctx$/,"")}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Al(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Al(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 xw({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:pb(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Ni(e.promptTokens)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Al(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Al(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 vw={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"}},bw=P.memo(function({criteria:r}){if(r.length===0)return o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No criteria yet"});const i={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const c of r){const u=c.status.type;u in i&&i[u]++}const s=Object.keys(i).filter(c=>i[c]>0);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"font-semibold text-text-primary",children:"Total:"}),o.jsx("span",{className:"text-text-secondary",children:r.length})]}),o.jsx("div",{className:"space-y-1",children:s.map(c=>{const u=vw[c];return o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:`${u.color} ${u.animate?"animate-pulse":""} text-sm leading-tight`,children:u.icon}),o.jsxs("span",{className:"text-text-muted",children:[u.label,":"]}),o.jsx("span",{className:"text-text-primary font-medium",children:i[c]})]},c)})})]})});function yw({isOpen:e,onClose:r}){const i=ir(S=>S.config),s=ir(S=>S.saveConfig),[c,u]=P.useState(""),[p,l]=P.useState(""),[h,f]=P.useState(!1),[g,m]=P.useState(!1);P.useEffect(()=>{e&&(u((i==null?void 0:i.command)??""),l((i==null?void 0:i.url)??""),f((i==null?void 0:i.hotReload)??!1))},[e,i]);const v=async()=>{!c.trim()||!p.trim()||(m(!0),await s({command:c.trim(),url:p.trim(),hotReload:h}),m(!1),r())};return o.jsx(dn,{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=>u(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:v,disabled:g||!c.trim()||!p.trim(),children:g?"Saving...":"Save"})]})]})})}const Dx={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"},_w={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"},Lx={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},Sw="text-text-primary";function ww(e){const r=[],i=/\x1b\[([0-9;]+)m/g;let s=0,c="text-text-primary",u;try{for(;(u=i.exec(e))!==null;){if(u.index>s){const f=e.slice(s,u.index);f&&r.push({text:f,className:c})}const p=u[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=Dx[f];g&&h.push(g)}else if(f>=40&&f<=47){const g=_w[f];g&&h.push(g)}else if(f>=90&&f<=97){const g=Dx[f];g&&h.push(g)}else if(f in Lx){const g=Lx[f];g&&h.push(g)}else f===39?h.push(Sw):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:Cw(e),className:"text-text-primary"}]}}function Cw(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function Ns(e){var i,s;const r=ww(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,u)=>cn.createElement("span",{key:u,className:c.className},c.text))}const kw=P.memo(function({logs:r,onClose:i}){const s=P.useRef(null);return P.useEffect(()=>{const c=u=>{u.key==="Escape"&&i()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[i]),P.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,u)=>o.jsx("span",{className:c.stream==="stderr"?"text-accent-warning":"",children:Ns(c.content)},u))})]})})}),Ew=P.memo(function({logs:r,anchorRef:i,isHiding:s,onExpand:c,onClose:u}){const[p,l]=P.useState(null),h=P.useRef(null);return P.useEffect(()=>{var g;const f=(g=i.current)==null?void 0:g.getBoundingClientRect();f&&l({bottom:window.innerHeight-f.bottom,right:window.innerWidth-f.right,width:f.width,height:f.height})},[i]),P.useEffect(()=>{h.current&&(h.current.scrollTop=h.current.scrollHeight)},[r]),p?o.jsxs("div",{className:"relative",children:[o.jsx("pre",{ref:h,className:"fixed z-50 text-sm font-mono text-text-primary bg-bg-primary p-2 rounded border border-border overflow-auto transition-all duration-150 ease-out select-text",style:{bottom:p.bottom,right:p.right,width:p.width*2,maxHeight:p.height*3,transformOrigin:"bottom right",transform:s?"scale(0.01)":"scale(1)",opacity:s?0:1},children:r.map((f,g)=>o.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:Ns(f.content)},g))}),o.jsx("button",{onClick:()=>{u(),c()},className:"fixed z-50 px-2 py-1 rounded text-xs font-medium bg-accent-primary/30 text-white hover:bg-accent-primary/50 transition-colors duration-150",style:{bottom:p.bottom+8,right:p.right+8},children:"Expand"})]}):null}),jw=P.memo(function({workdir:r}){const i=ir(z=>z.setWorkdir),s=ir(z=>z.status),c=ir(z=>z.config),u=ir(z=>z.logs),p=ir(z=>z.start),l=ir(z=>z.stop),h=ir(z=>z.fetchLogs),[f,g]=P.useState(!1),[m,v]=P.useState(!1),[S,E]=P.useState(!1),[C,b]=P.useState(!1),y=P.useRef(null),x=P.useRef(null),_=P.useRef(null),j=P.useRef(null),A=(s==null?void 0:s.state)??"off",N=c!==null,L=A==="running"||A==="warning";P.useEffect(()=>{i(r??null)},[r,i]),P.useEffect(()=>{L&&h()},[L,h]),P.useEffect(()=>{_.current&&L&&(_.current.scrollTop=_.current.scrollHeight)},[u,L]);const T=()=>{L?l():p()},I=o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.1-.303c.652-.18 1.37.008 1.755.653a8.043 8.043 0 0 1 .683 1.18c.227.568.096 1.26-.378 1.726l-.812.804a.312.312 0 0 0-.081.283c.024.166.04.335.04.507s-.016.341-.04.507a.312.312 0 0 0 .08.283l.813.804c.474.466.605 1.158.378 1.726a8.07 8.07 0 0 1-.683 1.18c-.385.645-1.103.833-1.755.653l-1.1-.303c-.066-.019-.176-.011-.299.071a5.1 5.1 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.107c-.168.645-.714 1.196-1.458 1.26a8.094 8.094 0 0 1-1.402 0c-.744-.064-1.29-.615-1.458-1.26l-.29-1.107a.426.426 0 0 0-.211-.224 5.11 5.11 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.1.303c-.652.18-1.37-.008-1.755-.653a8.044 8.044 0 0 1-.683-1.18c-.227-.568-.096-1.26.378-1.726l.812-.804a.312.312 0 0 0 .081-.283A5.18 5.18 0 0 1 2.3 8c0-.172.016-.341.04-.507a.312.312 0 0 0-.08-.283l-.813-.804C.973 5.94.842 5.248 1.069 4.68c.181-.452.395-.882.683-1.18.385-.645 1.103-.833 1.755-.653l1.1.303c.066.019.176.011.299-.071.214-.143.437-.272.668-.386a.426.426 0 0 0 .211-.224l.29-1.107C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm0 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z"})});return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 ${A==="running"?"bg-accent-success":A==="warning"?"bg-accent-warning":A==="error"?"bg-accent-error":"bg-text-muted"}`}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server"})]}),o.jsx("button",{onClick:()=>g(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:I})]}),N?o.jsxs(o.Fragment,{children:[A==="running"||A==="warning"?o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{onClick:T,className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-primary hover:bg-border transition-colors",children:[o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),"Stop"]}),(s==null?void 0:s.url)&&o.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-white hover:bg-accent-primary/40 transition-colors",title:s.url,children:[o.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M6.5 3.5H3a1 1 0 0 0-1 1V13a1 1 0 0 0 1 1h8.5a1 1 0 0 0 1-1V9.5"}),o.jsx("path",{d:"M9.5 2h4.5v4.5"}),o.jsx("path",{d:"M14 2L7.5 8.5"})]}),"Open"]})]}):o.jsx("button",{onClick:T,className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-white hover:bg-accent-primary/40 transition-colors",children:"Start"}),L&&o.jsxs("div",{ref:j,className:"relative",onMouseEnter:()=>{x.current&&clearTimeout(x.current),y.current=setTimeout(()=>{E(!0),b(!1)},500)},onMouseLeave:()=>{y.current&&clearTimeout(y.current),b(!0),x.current=setTimeout(()=>E(!1),150)},children:[o.jsx("pre",{ref:_,className:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border",children:u.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):u.map((z,V)=>o.jsx("span",{className:z.stream==="stderr"?"text-accent-warning":"",children:Ns(z.content)},V))}),(S||C)&&j.current&&Hl.createPortal(o.jsx(Ew,{logs:u,anchorRef:j,isHiding:C,onExpand:()=>v(!0),onClose:()=>E(!1)}),document.body)]})]}):o.jsx("button",{onClick:()=>g(!0),className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-muted hover:bg-border transition-colors",children:"Configure"}),o.jsx(yw,{isOpen:f,onClose:()=>g(!1)}),m&&o.jsx(kw,{logs:u,onClose:()=>v(!1)})]})}),Nw=P.memo(function({isOpen:r,onClose:i,processName:s,logs:c}){const u=P.useRef(null);return P.useEffect(()=>{const p=l=>{l.key==="Escape"&&i()};if(r)return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r,i]),P.useEffect(()=>{u.current&&r&&(u.current.scrollTop=u.current.scrollHeight)},[c,r]),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:p=>p.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 truncate",children:s}),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:u,className:"flex-1 overflow-auto p-4 text-sm font-mono text-text-primary whitespace-pre-wrap",children:c.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):c.map((p,l)=>o.jsx("span",{className:p.stream==="stderr"?"text-accent-warning":"",children:Ns(p.content)},l))})]})}):null}),Tw=P.memo(function({sessionId:r}){var S;const i=Ba(E=>E.processes),s=Ba(E=>E.stopProcess),[c,u]=P.useState(null),[p,l]=P.useState([]),h=i.filter(E=>E.status!=="exited"),f=h.filter(E=>E.status==="running").length;if(i.length===0)return null;const g=E=>{switch(E){case"running":return"bg-accent-success";case"starting":return"bg-accent-warning";case"stopping":return"bg-accent-warning";case"exited":return"bg-text-muted";default:return"bg-text-muted"}},m=E=>{const C=Ba.getState().logs[E]??[];l(C.map(b=>({content:b.content,stream:b.stream}))),u(E)},v=E=>{r&&s(E,r)};return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 bg-accent-primary"}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Background"}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",f," running)"]})]})}),o.jsx("div",{className:"space-y-2",children:h.map(E=>o.jsx("div",{className:"border border-border rounded p-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${g(E.status)}`}),o.jsx("span",{className:"text-sm text-text-primary truncate",title:E.name,children:E.name}),o.jsxs("span",{className:"text-xs text-text-muted",children:["[",E.status,"]"]})]}),o.jsxs("div",{className:"flex gap-1 ml-2",children:[o.jsx("button",{onClick:()=>m(E.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-border text-text-secondary transition-colors",title:"View logs",children:"Logs"}),o.jsx("button",{onClick:()=>v(E.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-accent-error/20 text-text-secondary hover:text-accent-error transition-colors",title:"Stop process",children:"Stop"})]})]})},E.id))}),c&&o.jsx(Nw,{isOpen:!!c,onClose:()=>{u(null),l([])},processName:((S=h.find(E=>E.id===c))==null?void 0:S.name)??"",logs:p})]})});function Rx({summary:e,messages:r,workdir:i}){const[s,c]=P.useState(!1),u=JS(r),{branch:p}=ew(i),l=jt(f=>f.version),h=Ce(f=>f.currentSession);return o.jsxs("div",{className:"flex flex-col h-full",children:[u&&o.jsxs("div",{className:"mb-4",children:[o.jsx("button",{onClick:()=>c(!0),className:"w-full flex items-center justify-center px-3 py-2 rounded bg-bg-tertiary hover:bg-bg-secondary transition-colors",title:"View detailed response and call-level stats",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[o.jsx("span",{className:"text-text-secondary",children:tw(u.aiTime)}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Ex(u.avgPrefillSpeed)}),o.jsx("span",{children:"pp"}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Ex(u.avgGenerationSpeed)}),o.jsx("span",{children:"tg"})]})}),o.jsx(mw,{isOpen:s,onClose:()=>c(!1),stats:u})]}),o.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto",children:[o.jsx("div",{className:"flex items-center justify-between mb-2",children:o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Summary"})}),e?o.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e}):o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No summary yet"}),o.jsxs("div",{className:"mt-4",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary mb-2",children:"Progress"}),o.jsx(bw,{criteria:(h==null?void 0:h.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(jw,{workdir:i}),o.jsx(Tw,{sessionId:h==null?void 0:h.id}),l&&o.jsxs("div",{className:"mt-4 pt-4 border-t border-border text-center text-xs text-text-muted",children:[o.jsx("a",{href:"https://github.com/co-l/openfox",target:"_blank",rel:"noopener noreferrer",className:"hover:text-accent-primary transition-colors",children:"OpenFox"})," - ",o.jsxs("span",{children:["v",l]})]})]})}function Aw({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:i,messages:s}){const c=Ce(u=>u.currentSession);return o.jsxs("div",{className:"relative h-full overflow-hidden",children:[r&&o.jsx("div",{className:"fixed md:hidden inset-0 bg-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(Rx,{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(Rx,{summary:(c==null?void 0:c.summary)??null,messages:s,workdir:c==null?void 0:c.workdir})})]})]})}function Dw(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function Mx(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function Lw(){const e=Ce(f=>f.contextState),r=Ce(f=>f.currentSession),i=Ce(f=>f.compactContext);if(!e||!r)return null;const{currentTokens:s,maxTokens:c,compactionCount:u,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:Mx(l,p),children:[Tl(s)," / ",Tl(c)]}),o.jsxs("span",{className:Mx(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 ${Dw(l,p)}`,style:{width:`${Math.min(l,100)}%`}})}),p&&o.jsx("span",{className:"text-[10px] text-accent-error font-medium animate-pulse",children:"Low!"}),u>0&&o.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[u,"x"]}),o.jsx(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 Ox(e){const r=[],i=String(e||"");let s=i.indexOf(","),c=0,u=!1;for(;!u;){s===-1&&(s=i.length,u=!0);const p=i.slice(c,s).trim();(p||!u)&&r.push(p),c=s+1,s=i.indexOf(",",c)}return r}function Rw(e,r){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const Mw=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ow=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Iw={};function Ix(e,r){return(Iw.jsx?Ow:Mw).test(e)}const Bw=/[ \t\n\f\r]/g;function zw(e){return typeof e=="object"?e.type==="text"?Bx(e.value):!1:Bx(e)}function Bx(e){return e.replace(Bw,"")===""}class Xa{constructor(r,i,s){this.normal=i,this.property=r,s&&(this.space=s)}}Xa.prototype.normal={};Xa.prototype.property={};Xa.prototype.space=void 0;function mb(e,r){const i={},s={};for(const c of e)Object.assign(i,c.property),Object.assign(s,c.normal);return new Xa(i,s,r)}function Ua(e){return e.toLowerCase()}class yn{constructor(r,i){this.attribute=i,this.property=r}}yn.prototype.attribute="";yn.prototype.booleanish=!1;yn.prototype.boolean=!1;yn.prototype.commaOrSpaceSeparated=!1;yn.prototype.commaSeparated=!1;yn.prototype.defined=!1;yn.prototype.mustUseProperty=!1;yn.prototype.number=!1;yn.prototype.overloadedBoolean=!1;yn.prototype.property="";yn.prototype.spaceSeparated=!1;yn.prototype.space=void 0;let Hw=0;const Ve=Di(),Pt=Di(),Zd=Di(),_e=Di(),St=Di(),js=Di(),Tn=Di();function Di(){return 2**++Hw}const Qd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:Pt,commaOrSpaceSeparated:Tn,commaSeparated:js,number:_e,overloadedBoolean:Zd,spaceSeparated:St},Symbol.toStringTag,{value:"Module"})),Ed=Object.keys(Qd);class xh extends yn{constructor(r,i,s,c){let u=-1;if(super(r,i),zx(this,"space",c),typeof s=="number")for(;++u<Ed.length;){const p=Ed[u];zx(this,Ed[u],(s&Qd[p])===Qd[p])}}}xh.prototype.defined=!0;function zx(e,r,i){i&&(e[r]=i)}function Ds(e){const r={},i={};for(const[s,c]of Object.entries(e.properties)){const u=new xh(s,e.transform(e.attributes||{},s),c,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),r[s]=u,i[Ua(s)]=s,i[Ua(u.attribute)]=s}return new Xa(r,i,e.space)}const gb=Ds({properties:{ariaActiveDescendant:null,ariaAtomic:Pt,ariaAutoComplete:null,ariaBusy:Pt,ariaChecked:Pt,ariaColCount:_e,ariaColIndex:_e,ariaColSpan:_e,ariaControls:St,ariaCurrent:null,ariaDescribedBy:St,ariaDetails:null,ariaDisabled:Pt,ariaDropEffect:St,ariaErrorMessage:null,ariaExpanded:Pt,ariaFlowTo:St,ariaGrabbed:Pt,ariaHasPopup:null,ariaHidden:Pt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:St,ariaLevel:_e,ariaLive:null,ariaModal:Pt,ariaMultiLine:Pt,ariaMultiSelectable:Pt,ariaOrientation:null,ariaOwns:St,ariaPlaceholder:null,ariaPosInSet:_e,ariaPressed:Pt,ariaReadOnly:Pt,ariaRelevant:null,ariaRequired:Pt,ariaRoleDescription:St,ariaRowCount:_e,ariaRowIndex:_e,ariaRowSpan:_e,ariaSelected:Pt,ariaSetSize:_e,ariaSort:null,ariaValueMax:_e,ariaValueMin:_e,ariaValueNow:_e,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function xb(e,r){return r in e?e[r]:r}function vb(e,r){return xb(e,r.toLowerCase())}const Pw=Ds({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:js,acceptCharset:St,accessKey:St,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:St,autoFocus:Ve,autoPlay:Ve,blocking:St,capture:null,charSet:null,checked:Ve,cite:null,className:St,cols:_e,colSpan:null,content:null,contentEditable:Pt,controls:Ve,controlsList:St,coords:_e|js,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:Zd,draggable:Pt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:St,height:_e,hidden:Zd,high:_e,href:null,hrefLang:null,htmlFor:St,httpEquiv:St,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:St,itemRef:St,itemScope:Ve,itemType:St,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:_e,manifest:null,max:null,maxLength:_e,media:null,method:null,min:null,minLength:_e,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,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:Ve,optimum:_e,pattern:null,ping:St,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:St,required:Ve,reversed:Ve,rows:_e,rowSpan:_e,sandbox:St,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shape:null,size:_e,sizes:null,slot:null,span:_e,spellCheck:Pt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:_e,step:null,style:null,tabIndex:_e,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:Pt,width:_e,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:St,axis:null,background:null,bgColor:null,border:_e,borderColor:null,bottomMargin:_e,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:_e,leftMargin:_e,link:null,longDesc:null,lowSrc:null,marginHeight:_e,marginWidth:_e,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:_e,rules:null,scheme:null,scrolling:Pt,standby:null,summary:null,text:null,topMargin:_e,valueType:null,version:null,vAlign:null,vLink:null,vSpace:_e,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ve,disableRemotePlayback:Ve,prefix:null,property:null,results:_e,security:null,unselectable:null},space:"html",transform:vb}),Fw=Ds({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:Tn,accentHeight:_e,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:_e,amplitude:_e,arabicForm:null,ascent:_e,attributeName:null,attributeType:null,azimuth:_e,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:_e,by:null,calcMode:null,capHeight:_e,className:St,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:_e,diffuseConstant:_e,direction:null,display:null,dur:null,divisor:_e,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:_e,enableBackground:null,end:null,event:null,exponent:_e,externalResourcesRequired:null,fill:null,fillOpacity:_e,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:js,g2:js,glyphName:js,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:_e,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:_e,horizOriginX:_e,horizOriginY:_e,id:null,ideographic:_e,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:_e,k:_e,k1:_e,k2:_e,k3:_e,k4:_e,kernelMatrix:Tn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:_e,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:_e,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:_e,overlineThickness:_e,paintOrder:null,panose1:null,path:null,pathLength:_e,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:St,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:_e,pointsAtY:_e,pointsAtZ:_e,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Tn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Tn,rev:Tn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Tn,requiredFeatures:Tn,requiredFonts:Tn,requiredFormats:Tn,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:_e,specularExponent:_e,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:_e,strikethroughThickness:_e,string:null,stroke:null,strokeDashArray:Tn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:_e,strokeOpacity:_e,strokeWidth:null,style:null,surfaceScale:_e,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Tn,tabIndex:_e,tableValues:null,target:null,targetX:_e,targetY:_e,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Tn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:_e,underlineThickness:_e,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:_e,values:null,vAlphabetic:_e,vMathematical:_e,vectorEffect:null,vHanging:_e,vIdeographic:_e,version:null,vertAdvY:_e,vertOriginX:_e,vertOriginY:_e,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:_e,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:xb}),bb=Ds({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()}}),yb=Ds({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:vb}),_b=Ds({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),Uw={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"},$w=/[A-Z]/g,Hx=/-[a-z]/g,qw=/^data[-\w.:]+$/i;function Sb(e,r){const i=Ua(r);let s=r,c=yn;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&qw.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(Hx,Gw);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!Hx.test(u)){let p=u.replace($w,Ww);p.charAt(0)!=="-"&&(p="-"+p),r="data"+p}}c=xh}return new c(s,r)}function Ww(e){return"-"+e.toLowerCase()}function Gw(e){return e.charAt(1).toUpperCase()}const wb=mb([gb,Pw,bb,yb,_b],"html"),Ul=mb([gb,Fw,bb,yb,_b],"svg");function Px(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function Vw(e){return e.join(" ").trim()}var bs={},jd,Fx;function Yw(){if(Fx)return jd;Fx=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,p=/^[;\s]*/,l=/^\s+|\s+$/g,h=`
|
|
91
|
-
`,f="/",g="*",m="",v="comment",S="declaration";function E(b,y){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];y=y||{};var x=1,_=1;function j(F){var B=F.match(r);B&&(x+=B.length);var q=F.lastIndexOf(h);_=~q?F.length-q:_+F.length}function A(){var F={line:x,column:_};return function(B){return B.position=new N(F),I(),B}}function N(F){this.start=F,this.end={line:x,column:_},this.source=y.source}N.prototype.content=b;function L(F){var B=new Error(y.source+":"+x+":"+_+": "+F);if(B.reason=F,B.filename=y.source,B.line=x,B.column=_,B.source=b,!y.silent)throw B}function T(F){var B=F.exec(b);if(B){var q=B[0];return j(q),b=b.slice(q.length),B}}function I(){T(i)}function z(F){var B;for(F=F||[];B=V();)B!==!1&&F.push(B);return F}function V(){var F=A();if(!(f!=b.charAt(0)||g!=b.charAt(1))){for(var B=2;m!=b.charAt(B)&&(g!=b.charAt(B)||f!=b.charAt(B+1));)++B;if(B+=2,m===b.charAt(B-1))return L("End of comment missing");var q=b.slice(2,B-2);return _+=2,j(q),b=b.slice(B),_+=2,F({type:v,comment:q})}}function Y(){var F=A(),B=T(s);if(B){if(V(),!T(c))return L("property missing ':'");var q=T(u),X=F({type:S,property:C(B[0].replace(e,m)),value:q?C(q[0].replace(e,m)):m});return T(p),X}}function $(){var F=[];z(F);for(var B;B=Y();)B!==!1&&(F.push(B),z(F));return F}return I(),$()}function C(b){return b?b.replace(l,m):m}return jd=E,jd}var Ux;function Kw(){if(Ux)return bs;Ux=1;var e=bs&&bs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(bs,"__esModule",{value:!0}),bs.default=i;const r=e(Yw());function i(s,c){let u=null;if(!s||typeof s!="string")return u;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&&(u=u||{},u[f]=g)}),u}return bs}var Aa={},$x;function Xw(){if($x)return Aa;$x=1,Object.defineProperty(Aa,"__esModule",{value:!0}),Aa.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=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={}),u(f)?f:(f=f.toLowerCase(),g.reactCompat?f=f.replace(c,l):f=f.replace(s,l),f.replace(r,p))};return Aa.camelCase=h,Aa}var Da,qx;function Zw(){if(qx)return Da;qx=1;var e=Da&&Da.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},r=e(Kw()),i=Xw();function s(c,u){var p={};return!c||typeof c!="string"||(0,r.default)(c,function(l,h){l&&h&&(p[(0,i.camelCase)(l,u)]=h)}),p}return s.default=s,Da=s,Da}var Qw=Zw();const Jw=Il(Qw),Cb=kb("end"),vh=kb("start");function kb(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 e2(e){const r=vh(e),i=Cb(e);if(r&&i)return{start:r,end:i}}function za(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Wx(e.position):"start"in e||"end"in e?Wx(e):"line"in e||"column"in e?Jd(e):""}function Jd(e){return Gx(e&&e.line)+":"+Gx(e&&e.column)}function Wx(e){return Jd(e&&e.start)+"-"+Jd(e&&e.end)}function Gx(e){return e&&typeof e=="number"?e:1}class on extends Error{constructor(r,i,s){super(),typeof i=="string"&&(s=i,i=void 0);let c="",u={},p=!1;if(i&&("line"in i&&"column"in i?u={place:i}:"start"in i&&"end"in i?u={place:i}:"type"in i?u={ancestors:[i],place:i.position}:u={...i}),typeof r=="string"?c=r:!u.cause&&r&&(p=!0,c=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof s=="string"){const h=s.indexOf(":");h===-1?u.ruleId=s:(u.source=s.slice(0,h),u.ruleId=s.slice(h+1))}if(!u.place&&u.ancestors&&u.ancestors){const h=u.ancestors[u.ancestors.length-1];h&&(u.place=h.position)}const l=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=l?l.line:void 0,this.name=za(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=p&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}on.prototype.file="";on.prototype.name="";on.prototype.reason="";on.prototype.message="";on.prototype.stack="";on.prototype.column=void 0;on.prototype.line=void 0;on.prototype.ancestors=void 0;on.prototype.cause=void 0;on.prototype.fatal=void 0;on.prototype.place=void 0;on.prototype.ruleId=void 0;on.prototype.source=void 0;const bh={}.hasOwnProperty,t2=new Map,n2=/[A-Z]/g,r2=new Set(["table","tbody","thead","tfoot","tr"]),i2=new Set(["td","th"]),Eb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function s2(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=f2(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=h2(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"?Ul:wb,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=jb(c,e,void 0);return u&&typeof u!="string"?u:c.create(e,c.Fragment,{children:u||void 0},void 0)}function jb(e,r,i){if(r.type==="element")return a2(e,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return o2(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return c2(e,r,i);if(r.type==="mdxjsEsm")return l2(e,r);if(r.type==="root")return u2(e,r,i);if(r.type==="text")return d2(e,r)}function a2(e,r,i){const s=e.schema;let c=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(c=Ul,e.schema=c),e.ancestors.push(r);const u=Tb(e,r.tagName,!1),p=p2(e,r);let l=_h(e,r);return r2.has(r.tagName)&&(l=l.filter(function(h){return typeof h=="string"?!zw(h):!0})),Nb(e,p,u,r),yh(p,l),e.ancestors.pop(),e.schema=s,e.create(r,u,p,i)}function o2(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)}$a(e,r.position)}function l2(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);$a(e,r.position)}function c2(e,r,i){const s=e.schema;let c=s;r.name==="svg"&&s.space==="html"&&(c=Ul,e.schema=c),e.ancestors.push(r);const u=r.name===null?e.Fragment:Tb(e,r.name,!0),p=m2(e,r),l=_h(e,r);return Nb(e,p,u,r),yh(p,l),e.ancestors.pop(),e.schema=s,e.create(r,u,p,i)}function u2(e,r,i){const s={};return yh(s,_h(e,r)),e.create(r,e.Fragment,s,i)}function d2(e,r){return r.value}function Nb(e,r,i,s){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(r.node=s)}function yh(e,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(e.children=i)}}function h2(e,r,i){return s;function s(c,u,p,l){const f=Array.isArray(p.children)?i:r;return l?f(u,p,l):f(u,p)}}function f2(e,r){return i;function i(s,c,u,p){const l=Array.isArray(u.children),h=vh(s);return r(c,u,p,l,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function p2(e,r){const i={};let s,c;for(c in r.properties)if(c!=="children"&&bh.call(r.properties,c)){const u=g2(e,c,r.properties[c]);if(u){const[p,l]=u;e.tableCellAlignToStyle&&p==="align"&&typeof l=="string"&&i2.has(r.tagName)?s=l:i[p]=l}}if(s){const u=i.style||(i.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return i}function m2(e,r){const i={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const p=u.expression;p.type;const l=p.properties[0];l.type,Object.assign(i,e.evaluater.evaluateExpression(l.argument))}else $a(e,r.position);else{const c=s.name;let u;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,u=e.evaluater.evaluateExpression(l.expression)}else $a(e,r.position);else u=s.value===null?!0:s.value;i[c]=u}return i}function _h(e,r){const i=[];let s=-1;const c=e.passKeys?new Map:t2;for(;++s<r.children.length;){const u=r.children[s];let p;if(e.passKeys){const h=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(h){const f=c.get(h)||0;p=h+"-"+f,c.set(h,f+1)}}const l=jb(e,u,p);l!==void 0&&i.push(l)}return i}function g2(e,r,i){const s=Sb(e.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?Rw(i):Vw(i)),s.property==="style"){let c=typeof i=="object"?i:x2(e,String(i));return e.stylePropertyNameCase==="css"&&(c=v2(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&s.space?Uw[s.property]||s.property:s.attribute,i]}}function x2(e,r){try{return Jw(r,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const s=i,c=new on("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=Eb+"#cannot-parse-style-attribute",c}}function Tb(e,r,i){let s;if(!i)s={type:"Literal",value:r};else if(r.includes(".")){const c=r.split(".");let u=-1,p;for(;++u<c.length;){const l=Ix(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};p=p?{type:"MemberExpression",object:p,property:l,computed:!!(u&&l.type==="Literal"),optional:!1}:l}s=p}else s=Ix(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const c=s.value;return bh.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(s);$a(e)}function $a(e,r){const i=new on("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=Eb+"#cannot-handle-mdx-estrees-without-createevaluater",i}function v2(e){const r={};let i;for(i in e)bh.call(e,i)&&(r[b2(i)]=e[i]);return r}function b2(e){let r=e.replace(n2,y2);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function y2(e){return"-"+e.toLowerCase()}const Nd={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"]},_2={};function Sh(e,r){const i=_2,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,c=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return Ab(e,s,c)}function Ab(e,r,i){if(S2(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 Vx(e.children,r,i)}return Array.isArray(e)?Vx(e,r,i):""}function Vx(e,r,i){const s=[];let c=-1;for(;++c<e.length;)s[c]=Ab(e[c],r,i);return s.join("")}function S2(e){return!!(e&&typeof e=="object")}const Yx=document.createElement("i");function qa(e){const r="&"+e+";";Yx.innerHTML=r;const i=Yx.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===r?!1:i}function Ln(e,r,i,s){const c=e.length;let u=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);u<s.length;)p=s.slice(u,u+1e4),p.unshift(r,0),e.splice(...p),u+=1e4,r+=1e4}function $n(e,r){return e.length>0?(Ln(e,e.length,0,r),e):r}const Kx={}.hasOwnProperty;function Db(e){const r={};let i=-1;for(;++i<e.length;)w2(r,e[i]);return r}function w2(e,r){let i;for(i in r){const c=(Kx.call(e,i)?e[i]:void 0)||(e[i]={}),u=r[i];let p;if(u)for(p in u){Kx.call(c,p)||(c[p]=[]);const l=u[p];C2(c[p],Array.isArray(l)?l:l?[l]:[])}}}function C2(e,r){let i=-1;const s=[];for(;++i<r.length;)(r[i].add==="after"?e:s).push(r[i]);Ln(e,0,0,s)}function Lb(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 Xn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const un=si(/[A-Za-z]/),an=si(/[\dA-Za-z]/),k2=si(/[#-'*+\--9=?A-Z^-~]/);function Dl(e){return e!==null&&(e<32||e===127)}const eh=si(/\d/),E2=si(/[\dA-Fa-f]/),j2=si(/[!-/:-@[-`{-~]/);function Oe(e){return e!==null&&e<-2}function _t(e){return e!==null&&(e<0||e===32)}function Je(e){return e===-2||e===-1||e===32}const $l=si(new RegExp("\\p{P}|\\p{S}","u")),Ai=si(/\s/);function si(e){return r;function r(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function Ls(e){const r=[];let i=-1,s=0,c=0;for(;++i<e.length;){const u=e.charCodeAt(i);let p="";if(u===37&&an(e.charCodeAt(i+1))&&an(e.charCodeAt(i+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(p=String.fromCharCode(u));else if(u>55295&&u<57344){const l=e.charCodeAt(i+1);u<56320&&l>56319&&l<57344?(p=String.fromCharCode(u,l),c=1):p="�"}else p=String.fromCharCode(u);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 st(e,r,i,s){const c=s?s-1:Number.POSITIVE_INFINITY;let u=0;return p;function p(h){return Je(h)?(e.enter(i),l(h)):r(h)}function l(h){return Je(h)&&u++<c?(e.consume(h),l):(e.exit(i),r(h))}}const N2={tokenize:T2};function T2(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"),st(e,r,"linePrefix")}function c(l){return e.enter("paragraph"),u(l)}function u(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 Oe(l)?(e.consume(l),e.exit("chunkText"),u):(e.consume(l),p)}}const A2={tokenize:D2},Xx={tokenize:L2};function D2(e){const r=this,i=[];let s=0,c,u,p;return l;function l(_){if(s<i.length){const j=i[s];return r.containerState=j[1],e.attempt(j[0].continuation,h,f)(_)}return f(_)}function h(_){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,c&&x();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}y(s);let L=j;for(;L<r.events.length;)r.events[L][1].end={...N},L++;return Ln(r.events,A+1,0,r.events.slice(j)),r.events.length=L,f(_)}return l(_)}function f(_){if(s===i.length){if(!c)return v(_);if(c.currentConstruct&&c.currentConstruct.concrete)return E(_);r.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(Xx,g,m)(_)}function g(_){return c&&x(),y(s),v(_)}function m(_){return r.parser.lazy[r.now().line]=s!==i.length,p=r.now().offset,E(_)}function v(_){return r.containerState={},e.attempt(Xx,S,E)(_)}function S(_){return s++,i.push([r.currentConstruct,r.containerState]),v(_)}function E(_){if(_===null){c&&x(),y(0),e.consume(_);return}return c=c||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),C(_)}function C(_){if(_===null){b(e.exit("chunkFlow"),!0),y(0),e.consume(_);return}return Oe(_)?(e.consume(_),b(e.exit("chunkFlow")),s=0,r.interrupt=void 0,l):(e.consume(_),C)}function b(_,j){const A=r.sliceStream(_);if(j&&A.push(null),_.previous=u,u&&(u.next=_),u=_,c.defineSkip(_.start),c.write(A),r.parser.lazy[_.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,I,z;for(;T--;)if(r.events[T][0]==="exit"&&r.events[T][1].type==="chunkFlow"){if(I){z=r.events[T][1].end;break}I=!0}for(y(s),N=L;N<r.events.length;)r.events[N][1].end={...z},N++;Ln(r.events,T+1,0,r.events.slice(L)),r.events.length=N}}function y(_){let j=i.length;for(;j-- >_;){const A=i[j];r.containerState=A[1],A[0].exit.call(r,e)}i.length=_}function x(){c.write([null]),u=void 0,c=void 0,r.containerState._closeFlow=void 0}}function L2(e,r,i){return st(e,e.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ts(e){if(e===null||_t(e)||Ai(e))return 1;if($l(e))return 2}function ql(e,r,i){const s=[];let c=-1;for(;++c<e.length;){const u=e[c].resolveAll;u&&!s.includes(u)&&(r=u(r,i),s.push(u))}return r}const th={name:"attention",resolveAll:R2,tokenize:M2};function R2(e,r){let i=-1,s,c,u,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},v={...e[i][1].start};Zx(m,-h),Zx(v,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:v},u={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",u,r]]),f=$n(f,ql(r.parser.constructs.insideSpan.null,e.slice(s+1,i),r)),f=$n(f,[["exit",u,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,Ln(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 M2(e,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,c=Ts(s);let u;return p;function p(h){return u=h,e.enter("attentionSequence"),l(h)}function l(h){if(h===u)return e.consume(h),l;const f=e.exit("attentionSequence"),g=Ts(h),m=!g||g===2&&c||i.includes(h),v=!c||c===2&&g||i.includes(s);return f._open=!!(u===42?m:m&&(c||!v)),f._close=!!(u===42?v:v&&(g||!m)),r(h)}}function Zx(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const O2={name:"autolink",tokenize:I2};function I2(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"),u}function u(S){return un(S)?(e.consume(S),p):S===64?i(S):f(S)}function p(S){return S===43||S===45||S===46||an(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||an(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||Dl(S)?i(S):(e.consume(S),h)}function f(S){return S===64?(e.consume(S),g):k2(S)?(e.consume(S),f):i(S)}function g(S){return an(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):v(S)}function v(S){if((S===45||an(S))&&s++<63){const E=S===45?v:m;return e.consume(S),E}return i(S)}}const Za={partial:!0,tokenize:B2};function B2(e,r,i){return s;function s(u){return Je(u)?st(e,c,"linePrefix")(u):c(u)}function c(u){return u===null||Oe(u)?r(u):i(u)}}const Rb={continuation:{tokenize:H2},exit:P2,name:"blockQuote",tokenize:z2};function z2(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"),u}return i(p)}function u(p){return Je(p)?(e.enter("blockQuotePrefixWhitespace"),e.consume(p),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(p))}}function H2(e,r,i){const s=this;return c;function c(p){return Je(p)?st(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(p):u(p)}function u(p){return e.attempt(Rb,r,i)(p)}}function P2(e){e.exit("blockQuote")}const Mb={name:"characterEscape",tokenize:F2};function F2(e,r,i){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),c}function c(u){return j2(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):i(u)}}const Ob={name:"characterReference",tokenize:U2};function U2(e,r,i){const s=this;let c=0,u,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"),u=31,p=an,g(m))}function f(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,p=E2,g):(e.enter("characterReferenceValue"),u=7,p=eh,g(m))}function g(m){if(m===59&&c){const v=e.exit("characterReferenceValue");return p===an&&!qa(s.sliceSerialize(v))?i(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return p(m)&&c++<u?(e.consume(m),g):i(m)}}const Qx={partial:!0,tokenize:q2},Jx={concrete:!0,name:"codeFenced",tokenize:$2};function $2(e,r,i){const s=this,c={partial:!0,tokenize:A};let u=0,p=0,l;return h;function h(N){return f(N)}function f(N){const L=s.events[s.events.length-1];return u=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"),Je(N)?st(e,m,"whitespace")(N):m(N))}function m(N){return N===null||Oe(N)?(e.exit("codeFencedFence"),s.interrupt?r(N):e.check(Qx,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(N))}function v(N){return N===null||Oe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(N)):Je(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),st(e,S,"whitespace")(N)):N===96&&N===l?i(N):(e.consume(N),v)}function S(N){return N===null||Oe(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),E(N))}function E(N){return N===null||Oe(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,b)(N)}function b(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),y}function y(N){return u>0&&Je(N)?st(e,x,"linePrefix",u+1)(N):x(N)}function x(N){return N===null||Oe(N)?e.check(Qx,C,j)(N):(e.enter("codeFlowValue"),_(N))}function _(N){return N===null||Oe(N)?(e.exit("codeFlowValue"),x(N)):(e.consume(N),_)}function j(N){return e.exit("codeFenced"),r(N)}function A(N,L,T){let I=0;return z;function z(B){return N.enter("lineEnding"),N.consume(B),N.exit("lineEnding"),V}function V(B){return N.enter("codeFencedFence"),Je(B)?st(N,Y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):Y(B)}function Y(B){return B===l?(N.enter("codeFencedFenceSequence"),$(B)):T(B)}function $(B){return B===l?(I++,N.consume(B),$):I>=p?(N.exit("codeFencedFenceSequence"),Je(B)?st(N,F,"whitespace")(B):F(B)):T(B)}function F(B){return B===null||Oe(B)?(N.exit("codeFencedFence"),L(B)):T(B)}}}function q2(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"),u)}function u(p){return s.parser.lazy[s.now().line]?i(p):r(p)}}const Td={name:"codeIndented",tokenize:G2},W2={partial:!0,tokenize:V2};function G2(e,r,i){const s=this;return c;function c(f){return e.enter("codeIndented"),st(e,u,"linePrefix",5)(f)}function u(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):Oe(f)?e.attempt(W2,p,h)(f):(e.enter("codeFlowValue"),l(f))}function l(f){return f===null||Oe(f)?(e.exit("codeFlowValue"),p(f)):(e.consume(f),l)}function h(f){return e.exit("codeIndented"),r(f)}}function V2(e,r,i){const s=this;return c;function c(p){return s.parser.lazy[s.now().line]?i(p):Oe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):st(e,u,"linePrefix",5)(p)}function u(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):Oe(p)?c(p):i(p)}}const Y2={name:"codeText",previous:X2,resolve:K2,tokenize:Z2};function K2(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 X2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Z2(e,r,i){let s=0,c,u;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?(u=e.enter("codeTextSequence"),c=0,g(m)):Oe(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||Oe(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)):(u.type="codeTextData",f(m))}}class Q2{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,i){const s=i??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(r,s):r>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(r,i,s){const c=i||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return s&&La(this.left,s),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),La(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),La(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);La(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);La(this.left,i.reverse())}}}function La(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 Ib(e){const r={};let i=-1,s,c,u,p,l,h,f;const g=new Q2(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,u=0,u<h.length&&h[u][1].type==="lineEndingBlank"&&(u+=2),u<h.length&&h[u][1].type==="content"))for(;++u<h.length&&h[u][1].type!=="content";)h[u][1].type==="chunkText"&&(h[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(r,J2(g,i)),i=r[i],f=!0);else if(s[1]._container){for(u=i,c=void 0;u--;)if(p=g.get(u),p[1].type==="lineEnding"||p[1].type==="lineEndingBlank")p[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),p[1].type="lineEnding",c=u);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 Ln(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!f}function J2(e,r){const i=e.get(r)[1],s=e.get(r)[2];let c=r-1;const u=[];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,v=-1,S=i,E=0,C=0;const b=[C];for(;S;){for(;e.get(++c)[1]!==S;);u.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;++v<l.length;)l[v][0]==="exit"&&l[v-1][0]==="enter"&&l[v][1].type===l[v-1][1].type&&l[v][1].start.line!==l[v][1].end.line&&(C=v+1,b.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):b.pop(),v=b.length;v--;){const y=l.slice(b[v],b[v+1]),x=u.pop();h.push([x,x+y.length-1]),e.splice(x,2,y)}for(h.reverse(),v=-1;++v<h.length;)f[E+h[v][0]]=E+h[v][1],E+=h[v][1]-h[v][0]-1;return f}const eC={resolve:nC,tokenize:rC},tC={partial:!0,tokenize:iC};function nC(e){return Ib(e),e}function rC(e,r){let i;return s;function s(l){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),c(l)}function c(l){return l===null?u(l):Oe(l)?e.check(tC,p,u)(l):(e.consume(l),c)}function u(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 iC(e,r,i){const s=this;return c;function c(p){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),st(e,u,"linePrefix")}function u(p){if(p===null||Oe(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 Bb(e,r,i,s,c,u,p,l,h){const f=h||Number.POSITIVE_INFINITY;let g=0;return m;function m(y){return y===60?(e.enter(s),e.enter(c),e.enter(u),e.consume(y),e.exit(u),v):y===null||y===32||y===41||Dl(y)?i(y):(e.enter(s),e.enter(p),e.enter(l),e.enter("chunkString",{contentType:"string"}),C(y))}function v(y){return y===62?(e.enter(u),e.consume(y),e.exit(u),e.exit(c),e.exit(s),r):(e.enter(l),e.enter("chunkString",{contentType:"string"}),S(y))}function S(y){return y===62?(e.exit("chunkString"),e.exit(l),v(y)):y===null||y===60||Oe(y)?i(y):(e.consume(y),y===92?E:S)}function E(y){return y===60||y===62||y===92?(e.consume(y),S):S(y)}function C(y){return!g&&(y===null||y===41||_t(y))?(e.exit("chunkString"),e.exit(l),e.exit(p),e.exit(s),r(y)):g<f&&y===40?(e.consume(y),g++,C):y===41?(e.consume(y),g--,C):y===null||y===32||y===40||Dl(y)?i(y):(e.consume(y),y===92?b:C)}function b(y){return y===40||y===41||y===92?(e.consume(y),C):C(y)}}function zb(e,r,i,s,c,u){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(u),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(u),e.enter(c),e.consume(S),e.exit(c),e.exit(s),r):Oe(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||Oe(S)||l++>999?(e.exit("chunkString"),g(S)):(e.consume(S),h||(h=!Je(S)),S===92?v:m)}function v(S){return S===91||S===92||S===93?(e.consume(S),l++,m):m(S)}}function Hb(e,r,i,s,c,u){let p;return l;function l(v){return v===34||v===39||v===40?(e.enter(s),e.enter(c),e.consume(v),e.exit(c),p=v===40?41:v,h):i(v)}function h(v){return v===p?(e.enter(c),e.consume(v),e.exit(c),e.exit(s),r):(e.enter(u),f(v))}function f(v){return v===p?(e.exit(u),h(p)):v===null?i(v):Oe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),st(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===p||v===null||Oe(v)?(e.exit("chunkString"),f(v)):(e.consume(v),v===92?m:g)}function m(v){return v===p||v===92?(e.consume(v),g):g(v)}}function Ha(e,r){let i;return s;function s(c){return Oe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i=!0,s):Je(c)?st(e,s,i?"linePrefix":"lineSuffix")(c):r(c)}}const sC={name:"definition",tokenize:oC},aC={partial:!0,tokenize:lC};function oC(e,r,i){const s=this;let c;return u;function u(S){return e.enter("definition"),p(S)}function p(S){return zb.call(s,e,l,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(S)}function l(S){return c=Xn(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 _t(S)?Ha(e,f)(S):f(S)}function f(S){return Bb(e,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(S)}function g(S){return e.attempt(aC,m,m)(S)}function m(S){return Je(S)?st(e,v,"whitespace")(S):v(S)}function v(S){return S===null||Oe(S)?(e.exit("definition"),s.parser.defined.push(c),r(S)):i(S)}}function lC(e,r,i){return s;function s(l){return _t(l)?Ha(e,c)(l):i(l)}function c(l){return Hb(e,u,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function u(l){return Je(l)?st(e,p,"whitespace")(l):p(l)}function p(l){return l===null||Oe(l)?r(l):i(l)}}const cC={name:"hardBreakEscape",tokenize:uC};function uC(e,r,i){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),c}function c(u){return Oe(u)?(e.exit("hardBreakEscape"),r(u)):i(u)}}const dC={name:"headingAtx",resolve:hC,tokenize:fC};function hC(e,r){let i=e.length-2,s=3,c,u;return e[s][1].type==="whitespace"&&(s+=2),i-2>s&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(s===i-1||i-4>s&&e[i-2][1].type==="whitespace")&&(i-=s+1===i?2:4),i>s&&(c={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},u={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},Ln(e,s,i-s+1,[["enter",c,r],["enter",u,r],["exit",u,r],["exit",c,r]])),e}function fC(e,r,i){let s=0;return c;function c(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),p(g)}function p(g){return g===35&&s++<6?(e.consume(g),p):g===null||_t(g)?(e.exit("atxHeadingSequence"),l(g)):i(g)}function l(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||Oe(g)?(e.exit("atxHeading"),r(g)):Je(g)?st(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||_t(g)?(e.exit("atxHeadingText"),l(g)):(e.consume(g),f)}}const pC=["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"],ev=["pre","script","style","textarea"],mC={concrete:!0,name:"htmlFlow",resolveTo:vC,tokenize:bC},gC={partial:!0,tokenize:_C},xC={partial:!0,tokenize:yC};function vC(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 bC(e,r,i){const s=this;let c,u,p,l,h;return f;function f(U){return g(U)}function g(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),m}function m(U){return U===33?(e.consume(U),v):U===47?(e.consume(U),u=!0,C):U===63?(e.consume(U),c=3,s.interrupt?r:D):un(U)?(e.consume(U),p=String.fromCharCode(U),b):i(U)}function v(U){return U===45?(e.consume(U),c=2,S):U===91?(e.consume(U),c=5,l=0,E):un(U)?(e.consume(U),c=4,s.interrupt?r:D):i(U)}function S(U){return U===45?(e.consume(U),s.interrupt?r:D):i(U)}function E(U){const K="CDATA[";return U===K.charCodeAt(l++)?(e.consume(U),l===K.length?s.interrupt?r:Y:E):i(U)}function C(U){return un(U)?(e.consume(U),p=String.fromCharCode(U),b):i(U)}function b(U){if(U===null||U===47||U===62||_t(U)){const K=U===47,te=p.toLowerCase();return!K&&!u&&ev.includes(te)?(c=1,s.interrupt?r(U):Y(U)):pC.includes(p.toLowerCase())?(c=6,K?(e.consume(U),y):s.interrupt?r(U):Y(U)):(c=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(U):u?x(U):_(U))}return U===45||an(U)?(e.consume(U),p+=String.fromCharCode(U),b):i(U)}function y(U){return U===62?(e.consume(U),s.interrupt?r:Y):i(U)}function x(U){return Je(U)?(e.consume(U),x):z(U)}function _(U){return U===47?(e.consume(U),z):U===58||U===95||un(U)?(e.consume(U),j):Je(U)?(e.consume(U),_):z(U)}function j(U){return U===45||U===46||U===58||U===95||an(U)?(e.consume(U),j):A(U)}function A(U){return U===61?(e.consume(U),N):Je(U)?(e.consume(U),A):_(U)}function N(U){return U===null||U===60||U===61||U===62||U===96?i(U):U===34||U===39?(e.consume(U),h=U,L):Je(U)?(e.consume(U),N):T(U)}function L(U){return U===h?(e.consume(U),h=null,I):U===null||Oe(U)?i(U):(e.consume(U),L)}function T(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||_t(U)?A(U):(e.consume(U),T)}function I(U){return U===47||U===62||Je(U)?_(U):i(U)}function z(U){return U===62?(e.consume(U),V):i(U)}function V(U){return U===null||Oe(U)?Y(U):Je(U)?(e.consume(U),V):i(U)}function Y(U){return U===45&&c===2?(e.consume(U),q):U===60&&c===1?(e.consume(U),X):U===62&&c===4?(e.consume(U),O):U===63&&c===3?(e.consume(U),D):U===93&&c===5?(e.consume(U),R):Oe(U)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check(gC,W,$)(U)):U===null||Oe(U)?(e.exit("htmlFlowData"),$(U)):(e.consume(U),Y)}function $(U){return e.check(xC,F,W)(U)}function F(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),B}function B(U){return U===null||Oe(U)?$(U):(e.enter("htmlFlowData"),Y(U))}function q(U){return U===45?(e.consume(U),D):Y(U)}function X(U){return U===47?(e.consume(U),p="",J):Y(U)}function J(U){if(U===62){const K=p.toLowerCase();return ev.includes(K)?(e.consume(U),O):Y(U)}return un(U)&&p.length<8?(e.consume(U),p+=String.fromCharCode(U),J):Y(U)}function R(U){return U===93?(e.consume(U),D):Y(U)}function D(U){return U===62?(e.consume(U),O):U===45&&c===2?(e.consume(U),D):Y(U)}function O(U){return U===null||Oe(U)?(e.exit("htmlFlowData"),W(U)):(e.consume(U),O)}function W(U){return e.exit("htmlFlow"),r(U)}}function yC(e,r,i){const s=this;return c;function c(p){return Oe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):i(p)}function u(p){return s.parser.lazy[s.now().line]?i(p):r(p)}}function _C(e,r,i){return s;function s(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(Za,r,i)}}const SC={name:"htmlText",tokenize:wC};function wC(e,r,i){const s=this;let c,u,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),_):un(D)?(e.consume(D),T):i(D)}function f(D){return D===45?(e.consume(D),g):D===91?(e.consume(D),u=0,E):un(D)?(e.consume(D),x):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),v):Oe(D)?(p=m,X(D)):(e.consume(D),m)}function v(D){return D===45?(e.consume(D),S):m(D)}function S(D){return D===62?q(D):D===45?v(D):m(D)}function E(D){const O="CDATA[";return D===O.charCodeAt(u++)?(e.consume(D),u===O.length?C:E):i(D)}function C(D){return D===null?i(D):D===93?(e.consume(D),b):Oe(D)?(p=C,X(D)):(e.consume(D),C)}function b(D){return D===93?(e.consume(D),y):C(D)}function y(D){return D===62?q(D):D===93?(e.consume(D),y):C(D)}function x(D){return D===null||D===62?q(D):Oe(D)?(p=x,X(D)):(e.consume(D),x)}function _(D){return D===null?i(D):D===63?(e.consume(D),j):Oe(D)?(p=_,X(D)):(e.consume(D),_)}function j(D){return D===62?q(D):_(D)}function A(D){return un(D)?(e.consume(D),N):i(D)}function N(D){return D===45||an(D)?(e.consume(D),N):L(D)}function L(D){return Oe(D)?(p=L,X(D)):Je(D)?(e.consume(D),L):q(D)}function T(D){return D===45||an(D)?(e.consume(D),T):D===47||D===62||_t(D)?I(D):i(D)}function I(D){return D===47?(e.consume(D),q):D===58||D===95||un(D)?(e.consume(D),z):Oe(D)?(p=I,X(D)):Je(D)?(e.consume(D),I):q(D)}function z(D){return D===45||D===46||D===58||D===95||an(D)?(e.consume(D),z):V(D)}function V(D){return D===61?(e.consume(D),Y):Oe(D)?(p=V,X(D)):Je(D)?(e.consume(D),V):I(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,$):Oe(D)?(p=Y,X(D)):Je(D)?(e.consume(D),Y):(e.consume(D),F)}function $(D){return D===c?(e.consume(D),c=void 0,B):D===null?i(D):Oe(D)?(p=$,X(D)):(e.consume(D),$)}function F(D){return D===null||D===34||D===39||D===60||D===61||D===96?i(D):D===47||D===62||_t(D)?I(D):(e.consume(D),F)}function B(D){return D===47||D===62||_t(D)?I(D):i(D)}function q(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),r):i(D)}function X(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),J}function J(D){return Je(D)?st(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 wh={name:"labelEnd",resolveAll:jC,resolveTo:NC,tokenize:TC},CC={tokenize:AC},kC={tokenize:DC},EC={tokenize:LC};function jC(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&&Ln(e,0,e.length,i),e}function NC(e,r){let i=e.length,s=0,c,u,p,l;for(;i--;)if(c=e[i][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;e[i][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(p){if(e[i][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=i,c.type!=="labelLink")){s=2;break}}else c.type==="labelEnd"&&(p=i);const h={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[u][1].start},end:{...e[p][1].end}},g={type:"labelText",start:{...e[u+s+2][1].end},end:{...e[p-2][1].start}};return l=[["enter",h,r],["enter",f,r]],l=$n(l,e.slice(u+1,u+s+3)),l=$n(l,[["enter",g,r]]),l=$n(l,ql(r.parser.constructs.insideSpan.null,e.slice(u+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]]),Ln(e,u,e.length,l),e}function TC(e,r,i){const s=this;let c=s.events.length,u,p;for(;c--;)if((s.events[c][1].type==="labelImage"||s.events[c][1].type==="labelLink")&&!s.events[c][1]._balanced){u=s.events[c][1];break}return l;function l(v){return u?u._inactive?m(v):(p=s.parser.defined.includes(Xn(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),h):i(v)}function h(v){return v===40?e.attempt(CC,g,p?g:m)(v):v===91?e.attempt(kC,g,p?f:m)(v):p?g(v):m(v)}function f(v){return e.attempt(EC,g,m)(v)}function g(v){return r(v)}function m(v){return u._balanced=!0,i(v)}}function AC(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 _t(m)?Ha(e,u)(m):u(m)}function u(m){return m===41?g(m):Bb(e,p,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function p(m){return _t(m)?Ha(e,h)(m):g(m)}function l(m){return i(m)}function h(m){return m===34||m===39||m===40?Hb(e,f,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function f(m){return _t(m)?Ha(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 DC(e,r,i){const s=this;return c;function c(l){return zb.call(s,e,u,p,"reference","referenceMarker","referenceString")(l)}function u(l){return s.parser.defined.includes(Xn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(l):i(l)}function p(l){return i(l)}}function LC(e,r,i){return s;function s(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),c}function c(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),r):i(u)}}const RC={name:"labelStartImage",resolveAll:wh.resolveAll,tokenize:MC};function MC(e,r,i){const s=this;return c;function c(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),u}function u(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),p):i(l)}function p(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(l):r(l)}}const OC={name:"labelStartLink",resolveAll:wh.resolveAll,tokenize:IC};function IC(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"),u}function u(p){return p===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(p):r(p)}}const Ad={name:"lineEnding",tokenize:BC};function BC(e,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),st(e,r,"linePrefix")}}const kl={name:"thematicBreak",tokenize:zC};function zC(e,r,i){let s=0,c;return u;function u(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||Oe(f))?(e.exit("thematicBreak"),r(f)):i(f)}function h(f){return f===c?(e.consume(f),s++,h):(e.exit("thematicBreakSequence"),Je(f)?st(e,l,"whitespace")(f):l(f))}}const bn={continuation:{tokenize:UC},exit:qC,name:"list",tokenize:FC},HC={partial:!0,tokenize:WC},PC={partial:!0,tokenize:$C};function FC(e,r,i){const s=this,c=s.events[s.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,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:eh(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(kl,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 eh(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(Za,s.interrupt?i:g,e.attempt(HC,v,m))}function g(S){return s.containerState.initialBlankLine=!0,u++,v(S)}function m(S){return Je(S)?(e.enter("listItemPrefixWhitespace"),e.consume(S),e.exit("listItemPrefixWhitespace"),v):i(S)}function v(S){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(S)}}function UC(e,r,i){const s=this;return s.containerState._closeFlow=void 0,e.check(Za,c,u);function c(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,st(e,r,"listItemIndent",s.containerState.size+1)(l)}function u(l){return s.containerState.furtherBlankLines||!Je(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(PC,r,p)(l))}function p(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,st(e,e.attempt(bn,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function $C(e,r,i){const s=this;return st(e,c,"listItemIndent",s.containerState.size+1);function c(u){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(u):i(u)}}function qC(e){e.exit(this.containerState.type)}function WC(e,r,i){const s=this;return st(e,c,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const p=s.events[s.events.length-1];return!Je(u)&&p&&p[1].type==="listItemPrefixWhitespace"?r(u):i(u)}}const tv={name:"setextUnderline",resolveTo:GC,tokenize:VC};function GC(e,r){let i=e.length,s,c,u;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){s=i;break}e[i][1].type==="paragraph"&&(c=i)}else e[i][1].type==="content"&&e.splice(i,1),!u&&e[i][1].type==="definition"&&(u=i);const p={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[c][1].type="setextHeadingText",u?(e.splice(c,0,["enter",p,r]),e.splice(u+1,0,["exit",e[s][1],r]),e[s][1].end={...e[u][1].end}):e[s][1]=p,e.push(["exit",p,r]),e}function VC(e,r,i){const s=this;let c;return u;function u(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"),Je(f)?st(e,h,"lineSuffix")(f):h(f))}function h(f){return f===null||Oe(f)?(e.exit("setextHeadingLine"),r(f)):i(f)}}const YC={tokenize:KC};function KC(e){const r=this,i=e.attempt(Za,s,e.attempt(this.parser.constructs.flowInitial,c,st(e,e.attempt(this.parser.constructs.flow,c,e.attempt(eC,c)),"linePrefix")));return i;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function c(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,i}}const XC={resolveAll:Fb()},ZC=Pb("string"),QC=Pb("text");function Pb(e){return{resolveAll:Fb(e==="text"?JC:void 0),tokenize:r};function r(i){const s=this,c=this.parser.constructs[e],u=i.attempt(c,p,l);return p;function p(g){return f(g)?u(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"),u(g)):(i.consume(g),h)}function f(g){if(g===null)return!0;const m=c[g];let v=-1;if(m)for(;++v<m.length;){const S=m[v];if(!S.previous||S.previous.call(s,s.previous))return!0}return!1}}}function Fb(e){return r;function r(i,s){let c=-1,u;for(;++c<=i.length;)u===void 0?i[c]&&i[c][1].type==="data"&&(u=c,c++):(!i[c]||i[c][1].type!=="data")&&(c!==u+2&&(i[u][1].end=i[c-1][1].end,i.splice(u+2,c-u-2),c=u+2),u=void 0);return e?e(i,s):i}}function JC(e,r){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const s=e[i-1][1],c=r.sliceStream(s);let u=c.length,p=-1,l=0,h;for(;u--;){const f=c[u];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){u++;break}}if(r._contentTypeTextTrailing&&i===e.length&&(l=0),l){const f={type:i===e.length||h||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?p:s.start._bufferIndex+p,_index:s.start._index+u,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 ek={42:bn,43:bn,45:bn,48:bn,49:bn,50:bn,51:bn,52:bn,53:bn,54:bn,55:bn,56:bn,57:bn,62:Rb},tk={91:sC},nk={[-2]:Td,[-1]:Td,32:Td},rk={35:dC,42:kl,45:[tv,kl],60:mC,61:tv,95:kl,96:Jx,126:Jx},ik={38:Ob,92:Mb},sk={[-5]:Ad,[-4]:Ad,[-3]:Ad,33:RC,38:Ob,42:th,60:[O2,SC],91:OC,92:[cC,Mb],93:wh,95:th,96:Y2},ak={null:[th,XC]},ok={null:[42,95]},lk={null:[]},ck=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ok,contentInitial:tk,disable:lk,document:ek,flow:rk,flowInitial:nk,insideSpan:ak,string:ik,text:sk},Symbol.toStringTag,{value:"Module"}));function uk(e,r,i){let s={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const c={},u=[];let p=[],l=[];const h={attempt:L(A),check:L(N),consume:x,enter:_,exit:j,interrupt:L(N,{interrupt:!0})},f={code:null,containerState:{},defineSkip:C,events:[],now:E,parser:e,previous:null,sliceSerialize:v,sliceStream:S,write:m};let g=r.tokenize.call(f,h);return r.resolveAll&&u.push(r),f;function m(V){return p=$n(p,V),b(),p[p.length-1]!==null?[]:(T(r,0),f.events=ql(u,f.events,f),f.events)}function v(V,Y){return hk(S(V),Y)}function S(V){return dk(p,V)}function E(){const{_bufferIndex:V,_index:Y,line:$,column:F,offset:B}=s;return{_bufferIndex:V,_index:Y,line:$,column:F,offset:B}}function C(V){c[V.line]=V.column,z()}function b(){let V;for(;s._index<p.length;){const Y=p[s._index];if(typeof Y=="string")for(V=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===V&&s._bufferIndex<Y.length;)y(Y.charCodeAt(s._bufferIndex));else y(Y)}}function y(V){g=g(V)}function x(V){Oe(V)?(s.line++,s.column=1,s.offset+=V===-3?2:1,z()):V!==-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=V}function _(V,Y){const $=Y||{};return $.type=V,$.start=E(),f.events.push(["enter",$,f]),l.push($),$}function j(V){const Y=l.pop();return Y.end=E(),f.events.push(["exit",Y,f]),Y}function A(V,Y){T(V,Y.from)}function N(V,Y){Y.restore()}function L(V,Y){return $;function $(F,B,q){let X,J,R,D;return Array.isArray(F)?W(F):"tokenize"in F?W([F]):O(F);function O(Q){return Z;function Z(H){const se=H!==null&&Q[H],ie=H!==null&&Q.null,ge=[...Array.isArray(se)?se:se?[se]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return W(ge)(H)}}function W(Q){return X=Q,J=0,Q.length===0?q:U(Q[J])}function U(Q){return Z;function Z(H){return D=I(),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)(H)}}function K(Q){return V(R,D),B}function te(Q){return D.restore(),++J<X.length?U(X[J]):q}}}function T(V,Y){V.resolveAll&&!u.includes(V)&&u.push(V),V.resolve&&Ln(f.events,Y,f.events.length-Y,V.resolve(f.events.slice(Y),f)),V.resolveTo&&(f.events=V.resolveTo(f.events,f))}function I(){const V=E(),Y=f.previous,$=f.currentConstruct,F=f.events.length,B=Array.from(l);return{from:F,restore:q};function q(){s=V,f.previous=Y,f.currentConstruct=$,f.events.length=F,l=B,z()}}function z(){s.line in c&&s.column<2&&(s.column=c[s.line],s.offset+=c[s.line]-1)}}function dk(e,r){const i=r.start._index,s=r.start._bufferIndex,c=r.end._index,u=r.end._bufferIndex;let p;if(i===c)p=[e[i].slice(s,u)];else{if(p=e.slice(i,c),s>-1){const l=p[0];typeof l=="string"?p[0]=l.slice(s):p.shift()}u>0&&p.push(e[c].slice(0,u))}return p}function hk(e,r){let i=-1;const s=[];let c;for(;++i<e.length;){const u=e[i];let p;if(typeof u=="string")p=u;else switch(u){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(u)}c=u===-2,s.push(p)}return s.join("")}function fk(e){const s={constructs:Db([ck,...(e||{}).extensions||[]]),content:c(N2),defined:[],document:c(A2),flow:c(YC),lazy:{},string:c(ZC),text:c(QC)};return s;function c(u){return p;function p(l){return uk(s,u,l)}}}function pk(e){for(;!Ib(e););return e}const nv=/[\0\t\n\r]/g;function mk(){let e=1,r="",i=!0,s;return c;function c(u,p,l){const h=[];let f,g,m,v,S;for(u=r+(typeof u=="string"?u.toString():new TextDecoder(p||void 0).decode(u)),m=0,r="",i&&(u.charCodeAt(0)===65279&&m++,i=void 0);m<u.length;){if(nv.lastIndex=m,f=nv.exec(u),v=f&&f.index!==void 0?f.index:u.length,S=u.charCodeAt(v),!f){r=u.slice(m);break}if(S===10&&m===v&&s)h.push(-3),s=void 0;else switch(s&&(h.push(-5),s=void 0),m<v&&(h.push(u.slice(m,v)),e+=v-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=v+1}return l&&(s&&h.push(-5),r&&h.push(r),h.push(null)),h}}const gk=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function xk(e){return e.replace(gk,vk)}function vk(e,r,i){if(r)return r;if(i.charCodeAt(0)===35){const c=i.charCodeAt(1),u=c===120||c===88;return Lb(i.slice(u?2:1),u?16:10)}return qa(i)||e}const Ub={}.hasOwnProperty;function bk(e,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),yk(i)(pk(fk(i).document().write(mk()(e,r,!0))))}function yk(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(ht),autolinkProtocol:I,autolinkEmail:I,atxHeading:u(Re),blockQuote:u(ie),characterEscape:I,characterReference:I,codeFenced:u(ge),codeFencedFenceInfo:p,codeFencedFenceMeta:p,codeIndented:u(ge,p),codeText:u(ve,p),codeTextData:I,data:I,codeFlowValue:I,definition:u(Ee),definitionDestinationString:p,definitionLabelString:p,definitionTitleString:p,emphasis:u(De),hardBreakEscape:u($e),hardBreakTrailing:u($e),htmlFlow:u(we,p),htmlFlowData:I,htmlText:u(we,p),htmlTextData:I,image:u(lt),label:p,link:u(ht),listItem:u(Me),listItemValue:v,listOrdered:u(pe,m),listUnordered:u(pe),paragraph:u(nt),reference:U,referenceString:p,resourceDestinationString:p,resourceTitleString:p,setextHeading:u(Re),strong:u(Ke),thematicBreak:u(ct)},exit:{atxHeading:h(),atxHeadingSequence:A,autolink:h(),autolinkEmail:se,autolinkProtocol:H,blockQuote:h(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:Q,characterReference:Z,codeFenced:h(b),codeFencedFence:C,codeFencedFenceInfo:S,codeFencedFenceMeta:E,codeFlowValue:z,codeIndented:h(y),codeText:h(B),codeTextData:z,data:z,definition:h(),definitionDestinationString:j,definitionLabelString:x,definitionTitleString:_,emphasis:h(),hardBreakEscape:h(Y),hardBreakTrailing:h(Y),htmlFlow:h($),htmlFlowData:z,htmlText:h(F),htmlTextData:z,image:h(X),label:R,labelText:J,lineEnding:V,link:h(q),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:K,resourceDestinationString:D,resourceTitleString:O,resource:W,setextHeading:h(T),setextHeadingLineSequence:L,setextHeadingText:N,strong:h(),thematicBreak:h()}};$b(r,(e||{}).mdastExtensions||[]);const i={};return s;function s(de){let be={type:"root",children:[]};const Te={stack:[be],tokenStack:[],config:r,enter:l,exit:f,buffer:p,resume:g,data:i},He=[];let ae=-1;for(;++ae<de.length;)if(de[ae][1].type==="listOrdered"||de[ae][1].type==="listUnordered")if(de[ae][0]==="enter")He.push(ae);else{const je=He.pop();ae=c(de,je,ae)}for(ae=-1;++ae<de.length;){const je=r[de[ae][0]];Ub.call(je,de[ae][1].type)&&je[de[ae][1].type].call(Object.assign({sliceSerialize:de[ae][2].sliceSerialize},Te),de[ae][1])}if(Te.tokenStack.length>0){const je=Te.tokenStack[Te.tokenStack.length-1];(je[1]||rv).call(Te,void 0,je[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})},ae=-1;++ae<r.transforms.length;)be=r.transforms[ae](be)||be;return be}function c(de,be,Te){let He=be-1,ae=-1,je=!1,ke,Pe,Fe,ft;for(;++He<=Te;){const qe=de[He];switch(qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{qe[0]==="enter"?ae++:ae--,ft=void 0;break}case"lineEndingBlank":{qe[0]==="enter"&&(ke&&!ft&&!ae&&!Fe&&(Fe=He),ft=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ft=void 0}if(!ae&&qe[0]==="enter"&&qe[1].type==="listItemPrefix"||ae===-1&&qe[0]==="exit"&&(qe[1].type==="listUnordered"||qe[1].type==="listOrdered")){if(ke){let qt=He;for(Pe=void 0;qt--;){const he=de[qt];if(he[1].type==="lineEnding"||he[1].type==="lineEndingBlank"){if(he[0]==="exit")continue;Pe&&(de[Pe][1].type="lineEndingBlank",je=!0),he[1].type="lineEnding",Pe=qt}else if(!(he[1].type==="linePrefix"||he[1].type==="blockQuotePrefix"||he[1].type==="blockQuotePrefixWhitespace"||he[1].type==="blockQuoteMarker"||he[1].type==="listItemIndent"))break}Fe&&(!Pe||Fe<Pe)&&(ke._spread=!0),ke.end=Object.assign({},Pe?de[Pe][1].start:qe[1].end),de.splice(Pe||He,0,["exit",ke,qe[2]]),He++,Te++}if(qe[1].type==="listItemPrefix"){const qt={type:"listItem",_spread:!1,start:Object.assign({},qe[1].start),end:void 0};ke=qt,de.splice(He,0,["enter",qt,qe[2]]),He++,Te++,Fe=void 0,ft=!0}}}return de[be][1]._spread=je,Te}function u(de,be){return Te;function Te(He){l.call(this,de(He),He),be&&be.call(this,He)}}function p(){this.stack.push({type:"fragment",children:[]})}function l(de,be,Te){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([be,Te||void 0]),de.position={start:Jr(be.start),end:void 0}}function h(de){return be;function be(Te){de&&de.call(this,Te),f.call(this,Te)}}function f(de,be){const Te=this.stack.pop(),He=this.tokenStack.pop();if(He)He[0].type!==de.type&&(be?be.call(this,de,He[0]):(He[1]||rv).call(this,de,He[0]));else throw new Error("Cannot close `"+de.type+"` ("+za({start:de.start,end:de.end})+"): it’s not open");Te.position.end=Jr(de.end)}function g(){return Sh(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function v(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 b(){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 y(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de.replace(/(\r?\n|\r)$/g,"")}function x(de){const be=this.resume(),Te=this.stack[this.stack.length-1];Te.label=be,Te.identifier=Xn(this.sliceSerialize(de)).toLowerCase()}function _(){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 Te=this.sliceSerialize(de).length;be.depth=Te}}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 I(de){const Te=this.stack[this.stack.length-1].children;let He=Te[Te.length-1];(!He||He.type!=="text")&&(He=Ye(),He.position={start:Jr(de.start),end:void 0},Te.push(He)),this.stack.push(He)}function z(de){const be=this.stack.pop();be.value+=this.sliceSerialize(de),be.position.end=Jr(de.end)}function V(de){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=be.children[be.children.length-1];Te.position.end=Jr(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(be.type)&&(I.call(this,de),z.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 F(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de}function B(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de}function q(){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 X(){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 J(de){const be=this.sliceSerialize(de),Te=this.stack[this.stack.length-2];Te.label=xk(be),Te.identifier=Xn(be).toLowerCase()}function R(){const de=this.stack[this.stack.length-1],be=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const He=de.children;Te.children=He}else Te.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 W(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function K(de){const be=this.resume(),Te=this.stack[this.stack.length-1];Te.label=be,Te.identifier=Xn(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function te(de){this.data.characterReferenceType=de.type}function Q(de){const be=this.sliceSerialize(de),Te=this.data.characterReferenceType;let He;Te?(He=Lb(be,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):He=qa(be);const ae=this.stack[this.stack.length-1];ae.value+=He}function Z(de){const be=this.stack.pop();be.position.end=Jr(de.end)}function H(de){z.call(this,de);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(de)}function se(de){z.call(this,de);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(de)}function ie(){return{type:"blockquote",children:[]}}function ge(){return{type:"code",lang:null,meta:null,value:""}}function ve(){return{type:"inlineCode",value:""}}function Ee(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function Re(){return{type:"heading",depth:0,children:[]}}function $e(){return{type:"break"}}function we(){return{type:"html",value:""}}function lt(){return{type:"image",title:null,url:"",alt:null}}function ht(){return{type:"link",title:null,url:"",children:[]}}function pe(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[]}}function Me(de){return{type:"listItem",spread:de._spread,checked:null,children:[]}}function nt(){return{type:"paragraph",children:[]}}function Ke(){return{type:"strong",children:[]}}function Ye(){return{type:"text",value:""}}function ct(){return{type:"thematicBreak"}}}function Jr(e){return{line:e.line,column:e.column,offset:e.offset}}function $b(e,r){let i=-1;for(;++i<r.length;){const s=r[i];Array.isArray(s)?$b(e,s):_k(e,s)}}function _k(e,r){let i;for(i in r)if(Ub.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 rv(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+za({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+za({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+za({start:r.start,end:r.end})+") is still open")}function Sk(e){const r=this;r.parser=i;function i(s){return bk(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function wk(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 Ck(e,r){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,i),[e.applyData(r,i),{type:"text",value:`
|
|
94
|
-
`}]}function kk(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 u={type:"element",tagName:"code",properties:s,children:[{type:"text",value:i}]};return r.meta&&(u.data={meta:r.meta}),e.patch(r,u),u=e.applyData(r,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(r,u),u}function Ek(e,r){const i={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function jk(e,r){const i={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Nk(e,r){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),c=Ls(s.toLowerCase()),u=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=u+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 Tk(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 Ak(e,r){if(e.options.allowDangerousHtml){const i={type:"raw",value:r.value};return e.patch(r,i),e.applyData(r,i)}}function qb(e,r){const i=r.referenceType;let s="]";if(i==="collapsed"?s+="[]":i==="full"&&(s+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+s}];const c=e.all(r),u=c[0];u&&u.type==="text"?u.value="["+u.value:c.unshift({type:"text",value:"["});const p=c[c.length-1];return p&&p.type==="text"?p.value+=s:c.push({type:"text",value:s}),c}function Dk(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return qb(e,r);const c={src:Ls(s.url||""),alt:r.alt};s.title!==null&&s.title!==void 0&&(c.title=s.title);const u={type:"element",tagName:"img",properties:c,children:[]};return e.patch(r,u),e.applyData(r,u)}function Lk(e,r){const i={src:Ls(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 Rk(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 Mk(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return qb(e,r);const c={href:Ls(s.url||"")};s.title!==null&&s.title!==void 0&&(c.title=s.title);const u={type:"element",tagName:"a",properties:c,children:e.all(r)};return e.patch(r,u),e.applyData(r,u)}function Ok(e,r){const i={href:Ls(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 Ik(e,r,i){const s=e.all(r),c=i?Bk(i):Wb(r),u={},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:[]}),u.className=["task-list-item"]}let l=-1;for(;++l<s.length;){const g=s[l];(c||l!==0||g.type!=="element"||g.tagName!=="p")&&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:u,children:p};return e.patch(r,f),e.applyData(r,f)}function Bk(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=Wb(i[s])}return r}function Wb(e){const r=e.spread;return r??e.children.length>1}function zk(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 u={type:"element",tagName:r.ordered?"ol":"ul",properties:i,children:e.wrap(s,!0)};return e.patch(r,u),e.applyData(r,u)}function Hk(e,r){const i={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Pk(e,r){const i={type:"root",children:e.wrap(e.all(r))};return e.patch(r,i),e.applyData(r,i)}function Fk(e,r){const i={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Uk(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=vh(r.children[1]),h=Cb(r.children[r.children.length-1]);l&&h&&(p.position={start:l,end:h}),c.push(p)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(c,!0)};return e.patch(r,u),e.applyData(r,u)}function $k(e,r,i){const s=i?i.children:void 0,u=(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],v={},S=p?p[h]:void 0;S&&(v.align=S);let E={type:"element",tagName:u,properties:v,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 qk(e,r){const i={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}const iv=9,sv=32;function Wk(e){const r=String(e),i=/\r?\n|\r/g;let s=i.exec(r),c=0;const u=[];for(;s;)u.push(av(r.slice(c,s.index),c>0,!0),s[0]),c=s.index+s[0].length,s=i.exec(r);return u.push(av(r.slice(c),c>0,!1)),u.join("")}function av(e,r,i){let s=0,c=e.length;if(r){let u=e.codePointAt(s);for(;u===iv||u===sv;)s++,u=e.codePointAt(s)}if(i){let u=e.codePointAt(c-1);for(;u===iv||u===sv;)c--,u=e.codePointAt(c-1)}return c>s?e.slice(s,c):""}function Gk(e,r){const i={type:"text",value:Wk(String(r.value))};return e.patch(r,i),e.applyData(r,i)}function Vk(e,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,i),e.applyData(r,i)}const Yk={blockquote:wk,break:Ck,code:kk,delete:Ek,emphasis:jk,footnoteReference:Nk,heading:Tk,html:Ak,imageReference:Dk,image:Lk,inlineCode:Rk,linkReference:Mk,link:Ok,listItem:Ik,list:zk,paragraph:Hk,root:Pk,strong:Fk,table:Uk,tableCell:qk,tableRow:$k,text:Gk,thematicBreak:Vk,toml:gl,yaml:gl,definition:gl,footnoteDefinition:gl};function gl(){}const Gb=-1,Wl=0,Pa=1,Ll=2,Ch=3,kh=4,Eh=5,jh=6,Vb=7,Yb=8,ov=typeof self=="object"?self:globalThis,Kk=(e,r)=>{const i=(c,u)=>(e.set(u,c),c),s=c=>{if(e.has(c))return e.get(c);const[u,p]=r[c];switch(u){case Wl:case Gb:return i(p,c);case Pa:{const l=i([],c);for(const h of p)l.push(s(h));return l}case Ll:{const l=i({},c);for(const[h,f]of p)l[s(h)]=s(f);return l}case Ch:return i(new Date(p),c);case kh:{const{source:l,flags:h}=p;return i(new RegExp(l,h),c)}case Eh:{const l=i(new Map,c);for(const[h,f]of p)l.set(s(h),s(f));return l}case jh:{const l=i(new Set,c);for(const h of p)l.add(s(h));return l}case Vb:{const{name:l,message:h}=p;return i(new ov[l](h),c)}case Yb: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 ov[u](p),c)};return s},lv=e=>Kk(new Map,e)(0),ys="",{toString:Xk}={},{keys:Zk}=Object,Ra=e=>{const r=typeof e;if(r!=="object"||!e)return[Wl,r];const i=Xk.call(e).slice(8,-1);switch(i){case"Array":return[Pa,ys];case"Object":return[Ll,ys];case"Date":return[Ch,ys];case"RegExp":return[kh,ys];case"Map":return[Eh,ys];case"Set":return[jh,ys];case"DataView":return[Pa,i]}return i.includes("Array")?[Pa,i]:i.includes("Error")?[Vb,i]:[Ll,i]},xl=([e,r])=>e===Wl&&(r==="function"||r==="symbol"),Qk=(e,r,i,s)=>{const c=(p,l)=>{const h=s.push(p)-1;return i.set(l,h),h},u=p=>{if(i.has(p))return i.get(p);let[l,h]=Ra(p);switch(l){case Wl:{let g=p;switch(h){case"bigint":l=Yb,g=p.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);g=null;break;case"undefined":return c([Gb],p)}return c([l,g],p)}case Pa:{if(h){let v=p;return h==="DataView"?v=new Uint8Array(p.buffer):h==="ArrayBuffer"&&(v=new Uint8Array(p)),c([h,[...v]],p)}const g=[],m=c([l,g],p);for(const v of p)g.push(u(v));return m}case Ll:{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 u(p.toJSON());const g=[],m=c([l,g],p);for(const v of Zk(p))(e||!xl(Ra(p[v])))&&g.push([u(v),u(p[v])]);return m}case Ch:return c([l,p.toISOString()],p);case kh:{const{source:g,flags:m}=p;return c([l,{source:g,flags:m}],p)}case Eh:{const g=[],m=c([l,g],p);for(const[v,S]of p)(e||!(xl(Ra(v))||xl(Ra(S))))&&g.push([u(v),u(S)]);return m}case jh:{const g=[],m=c([l,g],p);for(const v of p)(e||!xl(Ra(v)))&&g.push(u(v));return m}}const{message:f}=p;return c([l,{name:h,message:f}],p)};return u},cv=(e,{json:r,lossy:i}={})=>{const s=[];return Qk(!(r||i),!!r,new Map,s)(e),s},Rl=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?lv(cv(e,r)):structuredClone(e):(e,r)=>lv(cv(e,r));function Jk(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 eE(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function tE(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||Jk,s=e.options.footnoteBackLabel||eE,c=e.options.footnoteLabel||"Footnotes",u=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(),v=Ls(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 x=typeof i=="string"?i:i(h,S);typeof x=="string"&&(x={type:"text",value:x}),E.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+v+(S>1?"-"+S:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(h,S),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const b=g[g.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const x=b.children[b.children.length-1];x&&x.type==="text"?x.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...E)}else g.push(...E);const y={type:"element",tagName:"li",properties:{id:r+"fn-"+v},children:e.wrap(g,!0)};e.patch(f,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Rl(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 Gl=(function(e){if(e==null)return sE;if(typeof e=="function")return Vl(e);if(typeof e=="object")return Array.isArray(e)?nE(e):rE(e);if(typeof e=="string")return iE(e);throw new Error("Expected function, string, or object as test")});function nE(e){const r=[];let i=-1;for(;++i<e.length;)r[i]=Gl(e[i]);return Vl(s);function s(...c){let u=-1;for(;++u<r.length;)if(r[u].apply(this,c))return!0;return!1}}function rE(e){const r=e;return Vl(i);function i(s){const c=s;let u;for(u in e)if(c[u]!==r[u])return!1;return!0}}function iE(e){return Vl(r);function r(i){return i&&i.type===e}}function Vl(e){return r;function r(i,s,c){return!!(aE(i)&&e.call(this,i,typeof s=="number"?s:void 0,c||void 0))}}function sE(){return!0}function aE(e){return e!==null&&typeof e=="object"&&"type"in e}const Kb=[],oE=!0,nh=!1,lE="skip";function Xb(e,r,i,s){let c;typeof r=="function"&&typeof i!="function"?(s=i,i=r):c=r;const u=Gl(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(v,"name",{value:"node ("+(h.type+(S?"<"+S+">":""))+")"})}return v;function v(){let S=Kb,E,C,b;if((!r||u(h,f,g[g.length-1]||void 0))&&(S=cE(i(h,g)),S[0]===nh))return S;if("children"in h&&h.children){const y=h;if(y.children&&S[0]!==lE)for(C=(s?y.children.length:-1)+p,b=g.concat(y);C>-1&&C<y.children.length;){const x=y.children[C];if(E=l(x,C,b)(),E[0]===nh)return E;C=typeof E[1]=="number"?E[1]:C+p}}return S}}}function cE(e){return Array.isArray(e)?e:typeof e=="number"?[oE,e]:e==null?Kb:[e]}function Nh(e,r,i,s){let c,u,p;typeof r=="function"&&typeof i!="function"?(u=void 0,p=r,c=i):(u=r,p=i,c=s),Xb(e,u,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 rh={}.hasOwnProperty,uE={};function dE(e,r){const i=r||uE,s=new Map,c=new Map,u=new Map,p={...Yk,...i.handlers},l={all:f,applyData:fE,definitionById:s,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:p,one:h,options:i,patch:hE,wrap:mE};return Nh(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?s:c,v=String(g.identifier).toUpperCase();m.has(v)||m.set(v,g)}}),l;function h(g,m){const v=g.type,S=l.handlers[v];if(rh.call(l.handlers,v)&&S)return S(l,g,m);if(l.options.passThrough&&l.options.passThrough.includes(v)){if("children"in g){const{children:C,...b}=g,y=Rl(b);return y.children=l.all(g),y}return Rl(g)}return(l.options.unknownHandler||pE)(l,g,m)}function f(g){const m=[];if("children"in g){const v=g.children;let S=-1;for(;++S<v.length;){const E=l.one(v[S],g);if(E){if(S&&v[S-1].type==="break"&&(!Array.isArray(E)&&E.type==="text"&&(E.value=uv(E.value)),!Array.isArray(E)&&E.type==="element")){const C=E.children[0];C&&C.type==="text"&&(C.value=uv(C.value))}Array.isArray(E)?m.push(...E):m.push(E)}}}return m}}function hE(e,r){e.position&&(r.position=e2(e))}function fE(e,r){let i=r;if(e&&e.data){const s=e.data.hName,c=e.data.hChildren,u=e.data.hProperties;if(typeof s=="string")if(i.type==="element")i.tagName=s;else{const p="children"in i?i.children:[i];i={type:"element",tagName:s,properties:{},children:p}}i.type==="element"&&u&&Object.assign(i.properties,Rl(u)),"children"in i&&i.children&&c!==null&&c!==void 0&&(i.children=c)}return i}function pE(e,r){const i=r.data||{},s="value"in r&&!(rh.call(i,"hProperties")||rh.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 mE(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 uv(e){let r=0,i=e.charCodeAt(r);for(;i===9||i===32;)r++,i=e.charCodeAt(r);return e.slice(r)}function dv(e,r){const i=dE(e,r),s=i.one(e,void 0),c=tE(i),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
|
|
103
|
-
`},c),u}function gE(e,r){return e&&"run"in e?async function(i,s){const c=dv(i,{file:s,...r});await e.run(c,s)}:function(i,s){return dv(i,{file:s,...e||r})}}function hv(e){if(e)throw e}var Dd,fv;function xE(){if(fv)return Dd;fv=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]"},u=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 v;for(v in f);return typeof v>"u"||e.call(f,v)},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 Dd=function h(){var f,g,m,v,S,E,C=arguments[0],b=1,y=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},b=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});b<y;++b)if(f=arguments[b],f!=null)for(g in f)m=l(C,g),v=l(f,g),C!==v&&(x&&v&&(u(v)||(S=c(v)))?(S?(S=!1,E=m&&c(m)?m:[]):E=m&&u(m)?m:{},p(C,{name:g,newValue:h(x,E,v)})):typeof v<"u"&&p(C,{name:g,newValue:v}));return C},Dd}var vE=xE();const Ld=Il(vE);function ih(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 bE(){const e=[],r={run:i,use:s};return r;function i(...c){let u=-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[++u];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?yE(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 yE(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(u,c):h instanceof Error?c(h):u(h))}function c(p,...l){i||(i=!0,r(p,...l))}function u(p){c(null,p)}}const rr={basename:_E,dirname:SE,extname:wE,join:CE,sep:"/"};function _E(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Qa(e);let i=0,s=-1,c=e.length,u;if(r===void 0||r.length===0||r.length>e.length){for(;c--;)if(e.codePointAt(c)===47){if(u){i=c+1;break}}else s<0&&(u=!0,s=c+1);return s<0?"":e.slice(i,s)}if(r===e)return"";let p=-1,l=r.length-1;for(;c--;)if(e.codePointAt(c)===47){if(u){i=c+1;break}}else p<0&&(u=!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 SE(e){if(Qa(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 wE(e){Qa(e);let r=e.length,i=-1,s=0,c=-1,u=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:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||i<0||u===0||u===1&&c===i-1&&c===s+1?"":e.slice(c,i)}function CE(...e){let r=-1,i;for(;++r<e.length;)Qa(e[r]),e[r]&&(i=i===void 0?e[r]:i+"/"+e[r]);return i===void 0?".":kE(i)}function kE(e){Qa(e);const r=e.codePointAt(0)===47;let i=EE(e,!r);return i.length===0&&!r&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),r?"/"+i:i}function EE(e,r){let i="",s=0,c=-1,u=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||u===1))if(c!==p-1&&u===2){if(i.length<2||s!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(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,u=0;continue}}else if(i.length>0){i="",s=0,c=p,u=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,u=0}else l===46&&u>-1?u++:u=-1}return i}function Qa(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const jE={cwd:NE};function NE(){return"/"}function sh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function TE(e){if(typeof e=="string")e=new URL(e);else if(!sh(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return AE(e)}function AE(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 Rd=["history","path","basename","stem","extname","dirname"];class Zb{constructor(r){let i;r?sh(r)?i={path:r}:typeof r=="string"||DE(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":jE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Rd.length;){const u=Rd[s];u in i&&i[u]!==void 0&&i[u]!==null&&(this[u]=u==="history"?[...i[u]]:i[u])}let c;for(c in i)Rd.includes(c)||(this[c]=i[c])}get basename(){return typeof this.path=="string"?rr.basename(this.path):void 0}set basename(r){Od(r,"basename"),Md(r,"basename"),this.path=rr.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?rr.dirname(this.path):void 0}set dirname(r){pv(this.basename,"dirname"),this.path=rr.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?rr.extname(this.path):void 0}set extname(r){if(Md(r,"extname"),pv(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=rr.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){sh(r)&&(r=TE(r)),Od(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?rr.basename(this.path,this.extname):void 0}set stem(r){Od(r,"stem"),Md(r,"stem"),this.path=rr.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 on(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 Md(e,r){if(e&&e.includes(rr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+rr.sep+"`")}function Od(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function pv(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function DE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const LE=(function(e){const s=this.constructor.prototype,c=s[e],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),RE={}.hasOwnProperty;class Th extends LE{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=bE()}copy(){const r=new Th;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data(Ld(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(zd("data",this.frozen),this.namespace[r]=i,this):RE.call(this.namespace,r)&&this.namespace[r]||void 0:r?(zd("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=vl(r),s=this.parser||this.Parser;return Id("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),Id("process",this.parser||this.Parser),Bd("process",this.compiler||this.Compiler),i?c(void 0,i):new Promise(c);function c(u,p){const l=vl(r),h=s.parse(l);s.run(h,l,function(g,m,v){if(g||!m||!v)return f(g);const S=m,E=s.stringify(S,v);IE(E)?v.value=E:v.result=E,f(g,v)});function f(g,m){g||!m?p(g):u?u(m):i(void 0,m)}}}processSync(r){let i=!1,s;return this.freeze(),Id("processSync",this.parser||this.Parser),Bd("processSync",this.compiler||this.Compiler),this.process(r,c),gv("processSync","process",i),s;function c(u,p){i=!0,hv(u),s=p}}run(r,i,s){mv(r),this.freeze();const c=this.transformers;return!s&&typeof i=="function"&&(s=i,i=void 0),s?u(void 0,s):new Promise(u);function u(p,l){const h=vl(i);c.run(r,h,f);function f(g,m,v){const S=m||r;g?l(g):p?p(S):s(void 0,S,v)}}}runSync(r,i){let s=!1,c;return this.run(r,i,u),gv("runSync","run",s),c;function u(p,l){hv(p),c=l,s=!0}}stringify(r,i){this.freeze();const s=vl(i),c=this.compiler||this.Compiler;return Bd("stringify",c),mv(r),c(r,s)}use(r,...i){const s=this.attachers,c=this.namespace;if(zd("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 u(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=Ld(!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];u(m)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function h(f,g){let m=-1,v=-1;for(;++m<s.length;)if(s[m][0]===f){v=m;break}if(v===-1)s.push([f,...g]);else if(g.length>0){let[S,...E]=g;const C=s[v][1];ih(C)&&ih(S)&&(S=Ld(!0,C,S)),s[v]=[f,S,...E]}}}}const ME=new Th().freeze();function Id(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Bd(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function zd(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 mv(e){if(!ih(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function gv(e,r,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function vl(e){return OE(e)?e:new Zb(e)}function OE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function IE(e){return typeof e=="string"||BE(e)}function BE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const zE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",xv=[],vv={allowDangerousHtml:!0},HE=/^(https?|ircs?|mailto|xmpp)$/i,PE=[{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 FE(e){const r=UE(e),i=$E(e);return qE(r.runSync(r.parse(i),i),e)}function UE(e){const r=e.rehypePlugins||xv,i=e.remarkPlugins||xv,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...vv}:vv;return ME().use(Sk).use(i).use(gE,s).use(r)}function $E(e){const r=e.children||"",i=new Zb;return typeof r=="string"&&(i.value=r),i}function qE(e,r){const i=r.allowedElements,s=r.allowElement,c=r.components,u=r.disallowedElements,p=r.skipHtml,l=r.unwrapDisallowed,h=r.urlTransform||WE;for(const g of PE)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+zE+g.id,void 0);return Nh(e,f),s2(e,{Fragment:o.Fragment,components:c,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function f(g,m,v){if(g.type==="raw"&&v&&typeof m=="number")return p?v.children.splice(m,1):v.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let S;for(S in Nd)if(Object.hasOwn(Nd,S)&&Object.hasOwn(g.properties,S)){const E=g.properties[S],C=Nd[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):u?u.includes(g.tagName):!1;if(!S&&s&&typeof m=="number"&&(S=!s(g,m,v)),S&&v&&typeof m=="number")return l&&g.children?v.children.splice(m,1,...g.children):v.children.splice(m,1),m}}}function WE(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||HE.test(e.slice(0,r))?e:""}function bv(e,r){const i=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,c=i.indexOf(r);for(;c!==-1;)s++,c=i.indexOf(r,c+r.length);return s}function GE(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function VE(e,r,i){const c=Gl((i||{}).ignore||[]),u=YE(r);let p=-1;for(;++p<u.length;)Xb(e,"text",l);function l(f,g){let m=-1,v;for(;++m<g.length;){const S=g[m],E=v?v.children:void 0;if(c(S,E?E.indexOf(S):void 0,v))return;v=S}if(v)return h(f,g)}function h(f,g){const m=g[g.length-1],v=u[p][0],S=u[p][1];let E=0;const b=m.children.indexOf(f);let y=!1,x=[];v.lastIndex=0;let _=v.exec(f.value);for(;_;){const j=_.index,A={index:_.index,input:_.input,stack:[...g,f]};let N=S(..._,A);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?v.lastIndex=j+1:(E!==j&&x.push({type:"text",value:f.value.slice(E,j)}),Array.isArray(N)?x.push(...N):N&&x.push(N),E=j+_[0].length,y=!0),!v.global)break;_=v.exec(f.value)}return y?(E<f.value.length&&x.push({type:"text",value:f.value.slice(E)}),m.children.splice(b,1,...x)):x=[f],b+x.length}}function YE(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([KE(c[0]),XE(c[1])])}return r}function KE(e){return typeof e=="string"?new RegExp(GE(e),"g"):e}function XE(e){return typeof e=="function"?e:function(){return e}}const Hd="phrasing",Pd=["autolink","link","image","label"];function ZE(){return{transforms:[ij],enter:{literalAutolink:JE,literalAutolinkEmail:Fd,literalAutolinkHttp:Fd,literalAutolinkWww:Fd},exit:{literalAutolink:rj,literalAutolinkEmail:nj,literalAutolinkHttp:ej,literalAutolinkWww:tj}}}function QE(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Hd,notInConstruct:Pd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Hd,notInConstruct:Pd},{character:":",before:"[ps]",after:"\\/",inConstruct:Hd,notInConstruct:Pd}]}}function JE(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Fd(e){this.config.enter.autolinkProtocol.call(this,e)}function ej(e){this.config.exit.autolinkProtocol.call(this,e)}function tj(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 nj(e){this.config.exit.autolinkEmail.call(this,e)}function rj(e){this.exit(e)}function ij(e){VE(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,sj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),aj]],{ignore:["link","linkReference"]})}function sj(e,r,i,s,c){let u="";if(!Qb(c)||(/^w/i.test(r)&&(i=r+i,r="",u="http://"),!oj(i)))return!1;const p=lj(i+s);if(!p[0])return!1;const l={type:"link",title:null,url:u+r+p[0],children:[{type:"text",value:r+p[0]}]};return p[1]?[l,{type:"text",value:p[1]}]:l}function aj(e,r,i,s){return!Qb(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function oj(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 lj(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=bv(e,"(");let u=bv(e,")");for(;s!==-1&&c>u;)e+=i.slice(0,s+1),i=i.slice(s+1),s=i.indexOf(")"),u++;return[e,i]}function Qb(e,r){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Ai(i)||$l(i))&&(!r||i!==47)}Jb.peek=xj;function cj(){this.buffer()}function uj(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function dj(){this.buffer()}function hj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function fj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function pj(e){this.exit(e)}function mj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function gj(e){this.exit(e)}function xj(){return"["}function Jb(e,r,i,s){const c=i.createTracker(s);let u=c.move("[^");const p=i.enter("footnoteReference"),l=i.enter("reference");return u+=c.move(i.safe(i.associationId(e),{after:"]",before:u})),l(),p(),u+=c.move("]"),u}function vj(){return{enter:{gfmFootnoteCallString:cj,gfmFootnoteCall:uj,gfmFootnoteDefinitionLabelString:dj,gfmFootnoteDefinition:hj},exit:{gfmFootnoteCallString:fj,gfmFootnoteCall:pj,gfmFootnoteDefinitionLabelString:mj,gfmFootnoteDefinition:gj}}}function bj(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:Jb},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(s,c,u,p){const l=u.createTracker(p);let h=l.move("[^");const f=u.enter("footnoteDefinition"),g=u.enter("label");return h+=l.move(u.safe(u.associationId(s),{before:h,after:"]"})),g(),h+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),h+=l.move((r?`
|
|
104
|
-
`:" ")+u.indentLines(u.containerFlow(s,l.current()),r?e0:yj))),f(),h}}function yj(e,r,i){return r===0?e:e0(e,r,i)}function e0(e,r,i){return(i?"":" ")+e}const _j=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];t0.peek=Ej;function Sj(){return{canContainEols:["delete"],enter:{strikethrough:Cj},exit:{strikethrough:kj}}}function wj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:_j}],handlers:{delete:t0}}}function Cj(e){this.enter({type:"delete",children:[]},e)}function kj(e){this.exit(e)}function t0(e,r,i,s){const c=i.createTracker(s),u=i.enter("strikethrough");let p=c.move("~~");return p+=i.containerPhrasing(e,{...c.current(),before:p,after:"~"}),p+=c.move("~~"),u(),p}function Ej(){return"~"}function jj(e){return e.length}function Nj(e,r){const i=r||{},s=(i.align||[]).concat(),c=i.stringLength||jj,u=[],p=[],l=[],h=[];let f=0,g=-1;for(;++g<e.length;){const C=[],b=[];let y=-1;for(e[g].length>f&&(f=e[g].length);++y<e[g].length;){const x=Tj(e[g][y]);if(i.alignDelimiters!==!1){const _=c(x);b[y]=_,(h[y]===void 0||_>h[y])&&(h[y]=_)}C.push(x)}p[g]=C,l[g]=b}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<f;)u[m]=yv(s[m]);else{const C=yv(s);for(;++m<f;)u[m]=C}m=-1;const v=[],S=[];for(;++m<f;){const C=u[m];let b="",y="";C===99?(b=":",y=":"):C===108?b=":":C===114&&(y=":");let x=i.alignDelimiters===!1?1:Math.max(1,h[m]-b.length-y.length);const _=b+"-".repeat(x)+y;i.alignDelimiters!==!1&&(x=b.length+x+y.length,x>h[m]&&(h[m]=x),S[m]=x),v[m]=_}p.splice(1,0,v),l.splice(1,0,S),g=-1;const E=[];for(;++g<p.length;){const C=p[g],b=l[g];m=-1;const y=[];for(;++m<f;){const x=C[m]||"";let _="",j="";if(i.alignDelimiters!==!1){const A=h[m]-(b[m]||0),N=u[m];N===114?_=" ".repeat(A):N===99?A%2?(_=" ".repeat(A/2+.5),j=" ".repeat(A/2-.5)):(_=" ".repeat(A/2),j=_):j=" ".repeat(A)}i.delimiterStart!==!1&&!m&&y.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&x==="")&&(i.delimiterStart!==!1||m)&&y.push(" "),i.alignDelimiters!==!1&&y.push(_),y.push(x),i.alignDelimiters!==!1&&y.push(j),i.padding!==!1&&y.push(" "),(i.delimiterEnd!==!1||m!==f-1)&&y.push("|")}E.push(i.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return E.join(`
|
|
105
|
-
`)}function Tj(e){return e==null?"":String(e)}function yv(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 Aj(e,r,i,s){const c=i.enter("blockquote"),u=i.createTracker(s);u.move("> "),u.shift(2);const p=i.indentLines(i.containerFlow(e,u.current()),Dj);return c(),p}function Dj(e,r,i){return">"+(i?"":" ")+e}function Lj(e,r){return _v(e,r.inConstruct,!0)&&!_v(e,r.notInConstruct,!1)}function _v(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 Sv(e,r,i,s){let c=-1;for(;++c<i.unsafe.length;)if(i.unsafe[c].character===`
|
|
106
|
-
`&&Lj(i.stack,i.unsafe[c]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
107
|
-
`}function Rj(e,r){const i=String(e);let s=i.indexOf(r),c=s,u=0,p=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===c?++u>p&&(p=u):u=1,c=s+r.length,s=i.indexOf(r,c);return p}function Mj(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 Oj(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 Ij(e,r,i,s){const c=Oj(i),u=e.value||"",p=c==="`"?"GraveAccent":"Tilde";if(Mj(e,i)){const m=i.enter("codeIndented"),v=i.indentLines(u,Bj);return m(),v}const l=i.createTracker(s),h=c.repeat(Math.max(Rj(u,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
|
-
`),u&&(g+=l.move(u+`
|
|
110
|
-
`)),g+=l.move(h),f(),g}function Bj(e,r,i){return(i?"":" ")+e}function Ah(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 zj(e,r,i,s){const c=Ah(i),u=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${u}`),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 Hj(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 Wa(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ml(e,r,i){const s=Ts(e),c=Ts(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}}n0.peek=Pj;function n0(e,r,i,s){const c=Hj(i),u=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=Ml(s.before.charCodeAt(s.before.length-1),f,c);g.inside&&(h=Wa(f)+h.slice(1));const m=h.charCodeAt(h.length-1),v=Ml(s.after.charCodeAt(0),m,c);v.inside&&(h=h.slice(0,-1)+Wa(m));const S=p.move(c);return u(),i.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},l+h+S}function Pj(e,r,i){return i.options.emphasis||"*"}function Fj(e,r){let i=!1;return Nh(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return i=!0,nh}),!!((!e.depth||e.depth<3)&&Sh(e)&&(r.options.setext||i))}function Uj(e,r,i,s){const c=Math.max(Math.min(6,e.depth||1),1),u=i.createTracker(s);if(Fj(e,i)){const g=i.enter("headingSetext"),m=i.enter("phrasing"),v=i.containerPhrasing(e,{...u.current(),before:`
|
|
112
|
-
`,after:`
|
|
113
|
-
`});return m(),g(),v+`
|
|
114
|
-
`+(c===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
|
|
115
|
-
`))+1))}const p="#".repeat(c),l=i.enter("headingAtx"),h=i.enter("phrasing");u.move(p+" ");let f=i.containerPhrasing(e,{before:"# ",after:`
|
|
116
|
-
`,...u.current()});return/^[\t ]/.test(f)&&(f=Wa(f.charCodeAt(0))+f.slice(1)),f=f?p+" "+f:p,i.options.closeAtx&&(f+=" "+p),h(),l(),f}r0.peek=$j;function r0(e){return e.value||""}function $j(){return"<"}i0.peek=qj;function i0(e,r,i,s){const c=Ah(i),u=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${u}`),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 qj(){return"!"}s0.peek=Wj;function s0(e,r,i,s){const c=e.referenceType,u=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,u(),c==="full"||!f||f!==m?h+=l.move(m+"]"):c==="shortcut"?h=h.slice(0,-1):h+=l.move("]"),h}function Wj(){return"!"}a0.peek=Gj;function a0(e,r,i){let s=e.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(s);)c+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++u<i.unsafe.length;){const p=i.unsafe[u],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 Gj(){return"`"}function o0(e,r){const i=Sh(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))}l0.peek=Vj;function l0(e,r,i,s){const c=Ah(i),u=c==='"'?"Quote":"Apostrophe",p=i.createTracker(s);let l,h;if(o0(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${u}`),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 Vj(e,r,i){return o0(e,i)?"<":"["}c0.peek=Yj;function c0(e,r,i,s){const c=e.referenceType,u=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,u(),c==="full"||!f||f!==m?h+=l.move(m+"]"):c==="shortcut"?h=h.slice(0,-1):h+=l.move("]"),h}function Yj(){return"["}function Dh(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 Kj(e){const r=Dh(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 Xj(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 u0(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 Zj(e,r,i,s){const c=i.enter("list"),u=i.bulletCurrent;let p=e.ordered?Xj(i):Dh(i);const l=e.ordered?p==="."?")":".":Kj(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),u0(i)===p&&g){let m=-1;for(;++m<e.children.length;){const v=e.children[m];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(p=l),i.bulletCurrent=p;const f=i.containerFlow(e,s);return i.bulletLastUsed=p,i.bulletCurrent=u,c(),f}function Qj(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 Jj(e,r,i,s){const c=Qj(i);let u=i.bulletCurrent||Dh(i);r&&r.type==="list"&&r.ordered&&(u=(typeof r.start=="number"&&r.start>-1?r.start:1)+(i.options.incrementListMarker===!1?0:r.children.indexOf(e))+u);let p=u.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(u+" ".repeat(p-u.length)),l.shift(p);const h=i.enter("listItem"),f=i.indentLines(i.containerFlow(e,l.current()),g);return h(),f;function g(m,v,S){return v?(S?"":" ".repeat(p))+m:(S?u:u+" ".repeat(p-u.length))+m}}function eN(e,r,i,s){const c=i.enter("paragraph"),u=i.enter("phrasing"),p=i.containerPhrasing(e,s);return u(),c(),p}const tN=Gl(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function nN(e,r,i,s){return(e.children.some(function(p){return tN(p)})?i.containerPhrasing:i.containerFlow).call(i,e,s)}function rN(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}d0.peek=iN;function d0(e,r,i,s){const c=rN(i),u=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=Ml(s.before.charCodeAt(s.before.length-1),f,c);g.inside&&(h=Wa(f)+h.slice(1));const m=h.charCodeAt(h.length-1),v=Ml(s.after.charCodeAt(0),m,c);v.inside&&(h=h.slice(0,-1)+Wa(m));const S=p.move(c+c);return u(),i.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},l+h+S}function iN(e,r,i){return i.options.strong||"*"}function sN(e,r,i,s){return i.safe(e.value,s)}function aN(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 oN(e,r,i){const s=(u0(i)+(i.options.ruleSpaces?" ":"")).repeat(aN(i));return i.options.ruleSpaces?s.slice(0,-1):s}const h0={blockquote:Aj,break:Sv,code:Ij,definition:zj,emphasis:n0,hardBreak:Sv,heading:Uj,html:r0,image:i0,imageReference:s0,inlineCode:a0,link:l0,linkReference:c0,list:Zj,listItem:Jj,paragraph:eN,root:nN,strong:d0,text:sN,thematicBreak:oN};function lN(){return{enter:{table:cN,tableData:wv,tableHeader:wv,tableRow:dN},exit:{codeText:hN,table:uN,tableData:Ud,tableHeader:Ud,tableRow:Ud}}}function cN(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 uN(e){this.exit(e),this.data.inTable=void 0}function dN(e){this.enter({type:"tableRow",children:[]},e)}function Ud(e){this.exit(e)}function wv(e){this.enter({type:"tableCell",children:[]},e)}function hN(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,fN));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(e)}function fN(e,r){return r==="|"?r:e}function pN(e){const r=e||{},i=r.tableCellPadding,s=r.tablePipeAlign,c=r.stringLength,u=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:v,table:p,tableCell:h,tableRow:l}};function p(S,E,C,b){return f(g(S,C,b),S.align)}function l(S,E,C,b){const y=m(S,C,b),x=f([y]);return x.slice(0,x.indexOf(`
|
|
118
|
-
`))}function h(S,E,C,b){const y=C.enter("tableCell"),x=C.enter("phrasing"),_=C.containerPhrasing(S,{...b,before:u,after:u});return x(),y(),_}function f(S,E){return Nj(S,{align:E,alignDelimiters:s,padding:i,stringLength:c})}function g(S,E,C){const b=S.children;let y=-1;const x=[],_=E.enter("table");for(;++y<b.length;)x[y]=m(b[y],E,C);return _(),x}function m(S,E,C){const b=S.children;let y=-1;const x=[],_=E.enter("tableRow");for(;++y<b.length;)x[y]=h(b[y],S,E,C);return _(),x}function v(S,E,C){let b=h0.inlineCode(S,E,C);return C.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function mN(){return{exit:{taskListCheckValueChecked:Cv,taskListCheckValueUnchecked:Cv,paragraph:xN}}}function gN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:vN}}}function Cv(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function xN(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const s=i.children[0];if(s&&s.type==="text"){const c=r.children;let u=-1,p;for(;++u<c.length;){const l=c[u];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 vN(e,r,i,s){const c=e.children[0],u=typeof e.checked=="boolean"&&c&&c.type==="paragraph",p="["+(e.checked?"x":" ")+"] ",l=i.createTracker(s);u&&l.move(p);let h=h0.listItem(e,r,i,{...s,...l.current()});return u&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),h;function f(g){return g+p}}function bN(){return[ZE(),vj(),Sj(),lN(),mN()]}function yN(e){return{extensions:[QE(),bj(e),wj(),pN(e),gN()]}}const _N={tokenize:jN,partial:!0},f0={tokenize:NN,partial:!0},p0={tokenize:TN,partial:!0},m0={tokenize:AN,partial:!0},SN={tokenize:DN,partial:!0},g0={name:"wwwAutolink",tokenize:kN,previous:v0},x0={name:"protocolAutolink",tokenize:EN,previous:b0},Nr={name:"emailAutolink",tokenize:CN,previous:y0},or={};function wN(){return{text:or}}let Ci=48;for(;Ci<123;)or[Ci]=Nr,Ci++,Ci===58?Ci=65:Ci===91&&(Ci=97);or[43]=Nr;or[45]=Nr;or[46]=Nr;or[95]=Nr;or[72]=[Nr,x0];or[104]=[Nr,x0];or[87]=[Nr,g0];or[119]=[Nr,g0];function CN(e,r,i){const s=this;let c,u;return p;function p(m){return!ah(m)||!y0.call(s,s.previous)||Lh(s.events)?i(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return ah(m)?(e.consume(m),l):m===64?(e.consume(m),h):i(m)}function h(m){return m===46?e.check(SN,g,f)(m):m===45||m===95||an(m)?(u=!0,e.consume(m),h):g(m)}function f(m){return e.consume(m),c=!0,h}function g(m){return u&&c&&un(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):i(m)}}function kN(e,r,i){const s=this;return c;function c(p){return p!==87&&p!==119||!v0.call(s,s.previous)||Lh(s.events)?i(p):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(_N,e.attempt(f0,e.attempt(p0,u),i),i)(p))}function u(p){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(p)}}function EN(e,r,i){const s=this;let c="",u=!1;return p;function p(m){return(m===72||m===104)&&b0.call(s,s.previous)&&!Lh(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(m),e.consume(m),l):i(m)}function l(m){if(un(m)&&c.length<5)return c+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const v=c.toLowerCase();if(v==="http"||v==="https")return e.consume(m),h}return i(m)}function h(m){return m===47?(e.consume(m),u?f:(u=!0,h)):i(m)}function f(m){return m===null||Dl(m)||_t(m)||Ai(m)||$l(m)?i(m):e.attempt(f0,e.attempt(p0,g),i)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function jN(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),u):i(p)}function u(p){return p===null?i(p):r(p)}}function NN(e,r,i){let s,c,u;return p;function p(f){return f===46||f===95?e.check(m0,h,l)(f):f===null||_t(f)||Ai(f)||f!==45&&$l(f)?h(f):(u=!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||!u?i(f):r(f)}}function TN(e,r){let i=0,s=0;return c;function c(p){return p===40?(i++,e.consume(p),c):p===41&&s<i?u(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(m0,r,u)(p):p===null||_t(p)||Ai(p)?r(p):(e.consume(p),c)}function u(p){return p===41&&s++,e.consume(p),c}}function AN(e,r,i){return s;function s(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),s):l===38?(e.consume(l),u):l===93?(e.consume(l),c):l===60||l===null||_t(l)||Ai(l)?r(l):i(l)}function c(l){return l===null||l===40||l===91||_t(l)||Ai(l)?r(l):s(l)}function u(l){return un(l)?p(l):i(l)}function p(l){return l===59?(e.consume(l),s):un(l)?(e.consume(l),p):i(l)}}function DN(e,r,i){return s;function s(u){return e.consume(u),c}function c(u){return an(u)?i(u):r(u)}}function v0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||_t(e)}function b0(e){return!un(e)}function y0(e){return!(e===47||ah(e))}function ah(e){return e===43||e===45||e===46||e===95||an(e)}function Lh(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 LN={tokenize:PN,partial:!0};function RN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:BN,continuation:{tokenize:zN},exit:HN}},text:{91:{name:"gfmFootnoteCall",tokenize:IN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:MN,resolveTo:ON}}}}function MN(e,r,i){const s=this;let c=s.events.length;const u=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=Xn(s.sliceSerialize({start:p.end,end:s.now()}));return f.codePointAt(0)!==94||!u.includes(f.slice(1))?i(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),r(h))}}function ON(e,r){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},e[e.length-1][1].start)},p={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},l=[e[i+1],e[i+2],["enter",s,r],e[i+3],e[i+4],["enter",c,r],["exit",c,r],["enter",u,r],["enter",p,r],["exit",p,r],["exit",u,r],e[e.length-2],e[e.length-1],["exit",s,r]];return e.splice(i,e.length-i+1,...l),e}function IN(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u=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(u>999||m===93&&!p||m===null||m===91||_t(m))return i(m);if(m===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return c.includes(Xn(s.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):i(m)}return _t(m)||(p=!0),u++,e.consume(m),m===92?g:f}function g(m){return m===91||m===92||m===93?(e.consume(m),u++,f):f(m)}}function BN(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,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||_t(E))return i(E);if(E===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=Xn(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return _t(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 v(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),c.includes(u)||c.push(u),st(e,S,"gfmFootnoteDefinitionWhitespace")):i(E)}function S(E){return r(E)}}function zN(e,r,i){return e.check(Za,r,e.attempt(LN,r,i))}function HN(e){e.exit("gfmFootnoteDefinition")}function PN(e,r,i){const s=this;return st(e,c,"gfmFootnoteDefinitionIndent",5);function c(u){const p=s.events[s.events.length-1];return p&&p[1].type==="gfmFootnoteDefinitionIndent"&&p[2].sliceSerialize(p[1],!0).length===4?r(u):i(u)}}function FN(e){let i=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,resolveAll:c};return i==null&&(i=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function c(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)},v=[["enter",g,l],["enter",p[f][1],l],["exit",p[f][1],l],["enter",m,l]],S=l.parser.constructs.insideSpan.null;S&&Ln(v,v.length,0,ql(S,p.slice(f+1,h),l)),Ln(v,v.length,0,[["exit",m,l],["enter",p[h][1],l],["exit",p[h][1],l],["exit",g,l]]),Ln(p,f-1,h-f+3,v),h=f+v.length-2;break}}for(h=-1;++h<p.length;)p[h][1].type==="strikethroughSequenceTemporary"&&(p[h][1].type="data");return p}function u(p,l,h){const f=this.previous,g=this.events;let m=0;return v;function v(E){return f===126&&g[g.length-1][1].type!=="characterEscape"?h(E):(p.enter("strikethroughSequenceTemporary"),S(E))}function S(E){const C=Ts(f);if(E===126)return m>1?h(E):(p.consume(E),m++,S);if(m<2&&!i)return h(E);const b=p.exit("strikethroughSequenceTemporary"),y=Ts(E);return b._open=!y||y===2&&!!C,b._close=!C||C===2&&!!y,l(E)}}}class UN{constructor(){this.map=[]}add(r,i,s){$N(this,r,i,s)}consume(r){if(this.map.sort(function(u,p){return u[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 u of c)r.push(u);c=s.pop()}this.map.length=0}}function $N(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 qN(e,r){let i=!1;const s=[];for(;r<e.length;){const c=e[r];if(i){if(c[0]==="enter")c[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=s.length-1;s[u]=s[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return s}function WN(){return{flow:{null:{name:"table",tokenize:GN,resolveAll:VN}}}}function GN(e,r,i){const s=this;let c=0,u=0,p;return l;function l(z){let V=s.events.length-1;for(;V>-1;){const F=s.events[V][1].type;if(F==="lineEnding"||F==="linePrefix")V--;else break}const Y=V>-1?s.events[V][1].type:null,$=Y==="tableHead"||Y==="tableRow"?N:h;return $===N&&s.parser.lazy[s.now().line]?i(z):$(z)}function h(z){return e.enter("tableHead"),e.enter("tableRow"),f(z)}function f(z){return z===124||(p=!0,u+=1),g(z)}function g(z){return z===null?i(z):Oe(z)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),S):i(z):Je(z)?st(e,g,"whitespace")(z):(u+=1,p&&(p=!1,c+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),p=!0,g):(e.enter("data"),m(z)))}function m(z){return z===null||z===124||_t(z)?(e.exit("data"),g(z)):(e.consume(z),z===92?v:m)}function v(z){return z===92||z===124?(e.consume(z),m):m(z)}function S(z){return s.interrupt=!1,s.parser.lazy[s.now().line]?i(z):(e.enter("tableDelimiterRow"),p=!1,Je(z)?st(e,E,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):E(z))}function E(z){return z===45||z===58?b(z):z===124?(p=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),C):A(z)}function C(z){return Je(z)?st(e,b,"whitespace")(z):b(z)}function b(z){return z===58?(u+=1,p=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),y):z===45?(u+=1,y(z)):z===null||Oe(z)?j(z):A(z)}function y(z){return z===45?(e.enter("tableDelimiterFiller"),x(z)):A(z)}function x(z){return z===45?(e.consume(z),x):z===58?(p=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(z))}function _(z){return Je(z)?st(e,j,"whitespace")(z):j(z)}function j(z){return z===124?E(z):z===null||Oe(z)?!p||c!==u?A(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(z)):A(z)}function A(z){return i(z)}function N(z){return e.enter("tableRow"),L(z)}function L(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),L):z===null||Oe(z)?(e.exit("tableRow"),r(z)):Je(z)?st(e,L,"whitespace")(z):(e.enter("data"),T(z))}function T(z){return z===null||z===124||_t(z)?(e.exit("data"),L(z)):(e.consume(z),z===92?I:T)}function I(z){return z===92||z===124?(e.consume(z),T):T(z)}}function VN(e,r){let i=-1,s=!0,c=0,u=[0,0,0,0],p=[0,0,0,0],l=!1,h=0,f,g,m;const v=new UN;for(;++i<e.length;){const S=e[i],E=S[1];S[0]==="enter"?E.type==="tableHead"?(l=!1,h!==0&&(kv(v,r,h,f,g),g=void 0,h=0),f={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(i,0,[["enter",f,r]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(s=!0,m=void 0,u=[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)},v.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&&(u[1]!==0&&(p[0]=p[1],m=bl(v,r,u,c,void 0,m),u=[0,0,0,0]),p[2]=i)):E.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(p[0]=p[1],m=bl(v,r,u,c,void 0,m)),u=p,p=[u[1],i,0,0])):E.type==="tableHead"?(l=!0,h=i):E.type==="tableRow"||E.type==="tableDelimiterRow"?(h=i,u[1]!==0?(p[0]=p[1],m=bl(v,r,u,c,i,m)):p[1]!==0&&(m=bl(v,r,p,c,i,m)),c=0):c&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(p[3]=i)}for(h!==0&&kv(v,r,h,f,g),v.consume(r.events),i=-1;++i<r.events.length;){const S=r.events[i];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=qN(r.events,i))}return e}function bl(e,r,i,s,c,u){const p=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",l="tableContent";i[0]!==0&&(u.end=Object.assign({},Cs(r.events,i[0])),e.add(i[0],0,[["exit",u,r]]));const h=Cs(r.events,i[1]);if(u={type:p,start:Object.assign({},h),end:Object.assign({},h)},e.add(i[1],0,[["enter",u,r]]),i[2]!==0){const f=Cs(r.events,i[2]),g=Cs(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 v=r.events[i[2]],S=r.events[i[3]];if(v[1].end=Object.assign({},S[1].end),v[1].type="chunkText",v[1].contentType="text",i[3]>i[2]+1){const E=i[2]+1,C=i[3]-i[2]-1;e.add(E,C,[])}}e.add(i[3]+1,0,[["exit",m,r]])}return c!==void 0&&(u.end=Object.assign({},Cs(r.events,c)),e.add(c,0,[["exit",u,r]]),u=void 0),u}function kv(e,r,i,s,c){const u=[],p=Cs(r.events,i);c&&(c.end=Object.assign({},p),u.push(["exit",c,r])),s.end=Object.assign({},p),u.push(["exit",s,r]),e.add(i+1,0,u)}function Cs(e,r){const i=e[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const YN={name:"tasklistCheck",tokenize:XN};function KN(){return{text:{91:YN}}}function XN(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"),u)}function u(h){return _t(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 Oe(h)?r(h):Je(h)?e.check({tokenize:ZN},r,i)(h):i(h)}}function ZN(e,r,i){return st(e,s,"whitespace");function s(c){return c===null?i(c):r(c)}}function QN(e){return Db([wN(),RN(),FN(e),WN(),KN()])}const JN={};function e5(e){const r=this,i=e||JN,s=r.data(),c=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),p=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);c.push(QN(i)),u.push(bN()),p.push(yN(i))}function t5(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 n5(e,r){if(e==null)return{};var i,s,c=t5(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(s=0;s<u.length;s++)i=u[s],r.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(c[i]=e[i])}return c}function oh(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 r5(e){if(Array.isArray(e))return oh(e)}function i5(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function s5(e,r){if(e){if(typeof e=="string")return oh(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)?oh(e,r):void 0}}function a5(){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 lh(e){return r5(e)||i5(e)||s5(e)||a5()}function Ga(e){"@babel/helpers - typeof";return Ga=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},Ga(e)}function o5(e,r){if(Ga(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var s=i.call(e,r);if(Ga(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function l5(e){var r=o5(e,"string");return Ga(r)=="symbol"?r:r+""}function _0(e,r,i){return(r=l5(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function ch(){return ch=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},ch.apply(null,arguments)}function Ev(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 ks(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Ev(Object(i),!0).forEach(function(s){_0(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Ev(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}function c5(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 $d={};function u5(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return $d[r]||($d[r]=c5(e)),$d[r]}function d5(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,s=e.filter(function(u){return u!=="token"}),c=u5(s);return c.reduce(function(u,p){return ks(ks({},u),i[p])},r)}function jv(e){return e.join(" ")}function h5(e,r){var i=0;return function(s){return i+=1,s.map(function(c,u){return S0({node:c,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(i,"-").concat(u)})})}}function S0(e){var r=e.node,i=e.stylesheet,s=e.style,c=s===void 0?{}:s,u=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=h5(i,u),v;if(!u)v=ks(ks({},l),{},{className:jv(l.className)});else{var S=Object.keys(i).reduce(function(y,x){return x.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(y){return!S.includes(y)}));v=ks(ks({},l),{},{className:jv(C)||void 0,style:d5(l.className,Object.assign({},l.style,c),i)})}var b=m(r.children);return cn.createElement(f,ch({key:p},v),b)}}const f5=(function(e,r){var i=e.listLanguages();return i.indexOf(r)!==-1});var p5=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function Nv(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 ri(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Nv(Object(i),!0).forEach(function(s){_0(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Nv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var m5=/\n/g;function g5(e){return e.match(m5)}function x5(e){var r=e.lines,i=e.startingLineNumber,s=e.style;return r.map(function(c,u){var p=u+i;return cn.createElement("span",{key:"line-".concat(u),className:"react-syntax-highlighter-line-number",style:typeof s=="function"?s(p):s},"".concat(p,`
|
|
120
|
-
`))})}function v5(e){var r=e.codeString,i=e.codeStyle,s=e.containerStyle,c=s===void 0?{float:"left",paddingRight:"10px"}:s,u=e.numberStyle,p=u===void 0?{}:u,l=e.startingLineNumber;return cn.createElement("code",{style:Object.assign({},i,c)},x5({lines:r.replace(/\n$/,"").split(`
|
|
121
|
-
`),style:p,startingLineNumber:l}))}function b5(e){return"".concat(e.toString().length,".25em")}function w0(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 C0(e,r,i){var s={display:"inline-block",minWidth:b5(i),paddingRight:"1em",textAlign:"right",userSelect:"none"},c=typeof e=="function"?e(r):e,u=ri(ri({},s),c);return u}function El(e){var r=e.children,i=e.lineNumber,s=e.lineNumberStyle,c=e.largestLineNumber,u=e.showInlineLineNumbers,p=e.lineProps,l=p===void 0?{}:p,h=e.className,f=h===void 0?[]:h,g=e.showLineNumbers,m=e.wrapLongLines,v=e.wrapLines,S=v===void 0?!1:v,E=S?ri({},typeof l=="function"?l(i):l):{};if(E.className=E.className?[].concat(lh(E.className.trim().split(/\s+/)),lh(f)):f,i&&u){var C=C0(s,i,c);r.unshift(w0(i,C))}return m&g&&(E.style=ri({display:"flex"},E.style)),{type:"element",tagName:"span",properties:E,children:r}}function k0(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(El({children:[c],className:lh(new Set(r))}));else if(c.children){var u,p=r.concat(((u=c.properties)===null||u===void 0?void 0:u.className)||[]);k0(c.children,p).forEach(function(l){return i.push(l)})}}return i}function y5(e,r,i,s,c,u,p,l,h){var f,g=k0(e.value),m=[],v=-1,S=0;function E(A,N){var L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return El({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=C0(l,N,p);A.unshift(w0(N,L))}return A}function b(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 y=function(){var N=g[S],L=N.children[0].value,T=g5(L);if(T){var I=L.split(`
|
|
122
|
-
`);I.forEach(function(z,V){var Y=s&&m.length+u,$={type:"text",value:"".concat(z,`
|
|
123
|
-
`)};if(V===0){var F=g.slice(v+1,S).concat(El({children:[$],className:N.properties.className})),B=b(F,Y);m.push(B)}else if(V===I.length-1){var q=g[S+1]&&g[S+1].children&&g[S+1].children[0],X={type:"text",value:"".concat(z)};if(q){var J=El({children:[X],className:N.properties.className});g.splice(S+1,0,J)}else{var R=[X],D=b(R,Y,N.properties.className);m.push(D)}}else{var O=[$],W=b(O,Y,N.properties.className);m.push(W)}}),v=S}S++};S<g.length;)y();if(v!==g.length-1){var x=g.slice(v+1,g.length);if(x&&x.length){var _=s&&m.length+u,j=b(x,_);m.push(j)}}return r?m:(f=[]).concat.apply(f,m)}function _5(e){var r=e.rows,i=e.stylesheet,s=e.useInlineStyles;return r.map(function(c,u){return S0({node:c,stylesheet:i,useInlineStyles:s,key:"code-segment-".concat(u)})})}function E0(e){return e&&typeof e.highlightAuto<"u"}function S5(e){var r=e.astGenerator,i=e.language,s=e.code,c=e.defaultCodeValue;if(E0(r)){var u=f5(r,i);return i==="text"?{value:c,language:"text"}:u?r.highlight(i,s):r.highlightAuto(s)}try{return i&&i!=="text"?{value:r.highlight(s,i)}:{value:c}}catch{return{value:c}}}function w5(e,r){return function(s){var c,u,p=s.language,l=s.children,h=s.style,f=h===void 0?r:h,g=s.customStyle,m=g===void 0?{}:g,v=s.codeTagProps,S=v===void 0?{className:p?"language-".concat(p):void 0,style:ri(ri({},f['code[class*="language-"]']),f['code[class*="language-'.concat(p,'"]')])}:v,E=s.useInlineStyles,C=E===void 0?!0:E,b=s.showLineNumbers,y=b===void 0?!1:b,x=s.showInlineLineNumbers,_=x===void 0?!0:x,j=s.startingLineNumber,A=j===void 0?1:j,N=s.lineNumberContainerStyle,L=s.lineNumberStyle,T=L===void 0?{}:L,I=s.wrapLines,z=s.wrapLongLines,V=z===void 0?!1:z,Y=s.lineProps,$=Y===void 0?{}:Y,F=s.renderer,B=s.PreTag,q=B===void 0?"pre":B,X=s.CodeTag,J=X===void 0?"code":X,R=s.code,D=R===void 0?(Array.isArray(l)?l[0]:l)||"":R,O=s.astGenerator,W=n5(s,p5);O=O||e;var U=y?cn.createElement(v5,{containerStyle:N,codeStyle:S.style||{},numberStyle:T,startingLineNumber:A,codeString:D}):null,K=f.hljs||f['pre[class*="language-"]']||{backgroundColor:"#fff"},te=E0(O)?"hljs":"prismjs",Q=C?Object.assign({},W,{style:Object.assign({},K,m)}):Object.assign({},W,{className:W.className?"".concat(te," ").concat(W.className):te,style:Object.assign({},m)});if(V?S.style=ri({whiteSpace:"pre-wrap"},S.style):S.style=ri({whiteSpace:"pre"},S.style),!O)return cn.createElement(q,Q,U,cn.createElement(J,S,D));(I===void 0&&F||V)&&(I=!0),F=F||_5;var Z=[{type:"text",value:D}],H=S5({astGenerator:O,language:p,code:D,defaultCodeValue:Z});H.language===null&&(H.value=Z);var se=(c=(u=D.match(/\n/g))===null||u===void 0?void 0:u.length)!==null&&c!==void 0?c:0,ie=A+se,ge=y5(H,I,$,y,_,A,ie,T,V);return cn.createElement(q,Q,cn.createElement(J,S,!_&&U,F({rows:ge,stylesheet:f,useInlineStyles:C})))}}const Tv=/[#.]/g;function C5(e,r){const i=e||"",s={};let c=0,u,p;for(;c<i.length;){Tv.lastIndex=c;const l=Tv.exec(i),h=i.slice(c,l?l.index:i.length);h&&(u?u==="#"?s.id=h:Array.isArray(s.className)?s.className.push(h):s.className=[h]:p=h,c+=h.length),l&&(u=l[0],c++)}return{type:"element",tagName:p||r||"div",properties:s,children:[]}}function j0(e,r,i){const s=i?N5(i):void 0;function c(u,p,...l){let h;if(u==null){h={type:"root",children:[]};const f=p;l.unshift(f)}else{h=C5(u,r);const f=h.tagName.toLowerCase(),g=s?s.get(f):void 0;if(h.tagName=g||f,k5(p))l.unshift(p);else for(const[m,v]of Object.entries(p))E5(e,h.properties,m,v)}for(const f of l)uh(h.children,f);return h.type==="element"&&h.tagName==="template"&&(h.content={type:"root",children:h.children},h.children=[]),h}return c}function k5(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const r=e,i=Object.keys(e);for(const s of i){const c=r[s];if(c&&typeof c=="object"){if(!Array.isArray(c))return!0;const u=c;for(const p of u)if(typeof p!="number"&&typeof p!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function E5(e,r,i,s){const c=Sb(e,i);let u;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;u=s}else typeof s=="boolean"?u=s:typeof s=="string"?c.spaceSeparated?u=Px(s):c.commaSeparated?u=Ox(s):c.commaOrSpaceSeparated?u=Px(Ox(s).join(" ")):u=Av(c,c.property,s):Array.isArray(s)?u=[...s]:u=c.property==="style"?j5(s):String(s);if(Array.isArray(u)){const p=[];for(const l of u)p.push(Av(c,c.property,l));u=p}c.property==="className"&&Array.isArray(r.className)&&(u=r.className.concat(u)),r[c.property]=u}}function uh(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)uh(e,i);else if(typeof r=="object"&&"type"in r)r.type==="root"?uh(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function Av(e,r,i){if(typeof i=="string"){if(e.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((e.boolean||e.overloadedBoolean)&&(i===""||Ua(i)===Ua(r)))return!0}return i}function j5(e){const r=[];for(const[i,s]of Object.entries(e))r.push([i,s].join(": "));return r.join("; ")}function N5(e){const r=new Map;for(const i of e)r.set(i.toLowerCase(),i);return r}const T5=["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"],A5=j0(wb,"div");j0(Ul,"g",T5);const D5=["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"],Dv={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function N0(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function L5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function R5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function Lv(e){return R5(e)||N0(e)}const M5=["","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 O5(e,r){const i={},s=typeof i.additional=="string"?i.additional.charCodeAt(0):i.additional,c=[];let u=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,v=E(),S;for(u--;++u<=e.length;)if(S===10&&(m=(f?f[p]:0)||1),S=e.charCodeAt(u),S===38){const y=e.charCodeAt(u+1);if(y===9||y===10||y===12||y===32||y===38||y===60||Number.isNaN(y)||s&&y===s){l+=String.fromCharCode(S),m++;continue}const x=u+1;let _=x,j=x,A;if(y===35){j=++_;const $=e.charCodeAt(j);$===88||$===120?(A="hexadecimal",j=++_):A="decimal"}else A="named";let N="",L="",T="";const I=A==="named"?Lv:A==="decimal"?N0:L5;for(j--;++j<=e.length;){const $=e.charCodeAt(j);if(!I($))break;T+=String.fromCharCode($),A==="named"&&D5.includes(T)&&(N=T,L=qa(T))}let z=e.charCodeAt(j)===59;if(z){j++;const $=A==="named"?qa(T):!1;$&&(N=T,L=$)}let V=1+j-x,Y="";if(!(!z&&i.nonTerminated===!1))if(!T)A!=="named"&&C(4,V);else if(A==="named"){if(z&&!L)C(5,1);else if(N!==T&&(j=_+N.length,V=1+j-_,z=!1),!z){const $=N?1:3;if(i.attribute){const F=e.charCodeAt(j);F===61?(C($,V),L=""):Lv(F)?L="":C($,V)}else C($,V)}Y=L}else{z||C(2,V);let $=Number.parseInt(T,A==="hexadecimal"?16:10);if(I5($))C(7,V),Y="�";else if($ in Dv)C(6,V),Y=Dv[$];else{let F="";B5($)&&C(6,V),$>65535&&($-=65536,F+=String.fromCharCode($>>>10|55296),$=56320|$&1023),Y=F+String.fromCharCode($)}}if(Y){b(),v=E(),u=j-1,m+=j-x+1,c.push(Y);const $=E();$.offset++,i.reference&&i.reference.call(i.referenceContext||void 0,Y,{start:v,end:$},e.slice(x-1,j)),v=$}else T=e.slice(x-1,j),l+=T,m+=T.length,u=j-1}else S===10&&(g++,p++,m=0),Number.isNaN(S)?b():(l+=String.fromCharCode(S),m++);return c.join("");function E(){return{line:g,column:m,offset:u+((h?h.offset:0)||0)}}function C(y,x){let _;i.warning&&(_=E(),_.column+=x,_.offset+=x,i.warning.call(i.warningContext||void 0,M5[y],_,y))}function b(){l&&(c.push(l),i.text&&i.text.call(i.textContext||void 0,l,{start:v,end:E()}),l="")}}function I5(e){return e>=55296&&e<=57343||e>1114111}function B5(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 z5=0,yl={},Vt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++z5}),e.__id},clone:function e(r,i){i=i||{};var s,c;switch(Vt.util.type(r)){case"Object":if(c=Vt.util.objId(r),i[c])return i[c];s={},i[c]=s;for(var u in r)r.hasOwnProperty(u)&&(s[u]=e(r[u],i));return s;case"Array":return c=Vt.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:yl,plaintext:yl,text:yl,txt:yl,extend:function(e,r){var i=Vt.util.clone(Vt.languages[e]);for(var s in r)i[s]=r[s];return i},insertBefore:function(e,r,i,s){s=s||Vt.languages;var c=s[e],u={};for(var p in c)if(c.hasOwnProperty(p)){if(p==r)for(var l in i)i.hasOwnProperty(l)&&(u[l]=i[l]);i.hasOwnProperty(p)||(u[p]=c[p])}var h=s[e];return s[e]=u,Vt.languages.DFS(Vt.languages,function(f,g){g===h&&f!=e&&(this[f]=u)}),u},DFS:function e(r,i,s,c){c=c||{};var u=Vt.util.objId;for(var p in r)if(r.hasOwnProperty(p)){i.call(r,p,r[p],s||p);var l=r[p],h=Vt.util.type(l);h==="Object"&&!c[u(l)]?(c[u(l)]=!0,e(l,i,null,c)):h==="Array"&&!c[u(l)]&&(c[u(l)]=!0,e(l,i,p,c))}}},plugins:{},highlight:function(e,r,i){var s={code:e,grammar:r,language:i};if(Vt.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=Vt.tokenize(s.code,s.grammar),Vt.hooks.run("after-tokenize",s),Fa.stringify(Vt.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 H5;return jl(c,c.head,e),T0(e,c,r,c.head,0),F5(c)},hooks:{all:{},add:function(e,r){var i=Vt.hooks.all;i[e]=i[e]||[],i[e].push(r)},run:function(e,r){var i=Vt.hooks.all[e];if(!(!i||!i.length))for(var s=0,c;c=i[s++];)c(r)}},Token:Fa};function Fa(e,r,i,s){this.type=e,this.content=r,this.alias=i,this.length=(s||"").length|0}function Rv(e,r,i,s){e.lastIndex=r;var c=e.exec(i);if(c&&s&&c[1]){var u=c[1].length;c.index+=u,c[0]=c[0].slice(u)}return c}function T0(e,r,i,s,c,u){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(u&&u.cause==p+","+h)return;var f=l[h],g=f.inside,m=!!f.lookbehind,v=!!f.greedy,S=f.alias;if(v&&!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,b=s.next,y=c;b!==r.tail&&!(u&&y>=u.reach);y+=b.value.length,b=b.next){var x=b.value;if(r.length>e.length)return;if(!(x instanceof Fa)){var _=1,j;if(v){if(j=Rv(C,y,e,m),!j||j.index>=e.length)break;var T=j.index,A=j.index+j[0].length,N=y;for(N+=b.value.length;T>=N;)b=b.next,N+=b.value.length;if(N-=b.value.length,y=N,b.value instanceof Fa)continue;for(var L=b;L!==r.tail&&(N<A||typeof L.value=="string");L=L.next)_++,N+=L.value.length;_--,x=e.slice(y,N),j.index-=y}else if(j=Rv(C,0,x,m),!j)continue;var T=j.index,I=j[0],z=x.slice(0,T),V=x.slice(T+I.length),Y=y+x.length;u&&Y>u.reach&&(u.reach=Y);var $=b.prev;z&&($=jl(r,$,z),y+=z.length),P5(r,$,_);var F=new Fa(p,g?Vt.tokenize(I,g):I,S,I);if(b=jl(r,$,F),V&&jl(r,b,V),_>1){var B={cause:p+","+h,reach:Y};T0(e,r,i,b.prev,y,B),u&&B.reach>u.reach&&(u.reach=B.reach)}}}}}}function H5(){var e={value:null,prev:null,next:null},r={value:null,prev:e,next:null};e.next=r,this.head=e,this.tail=r,this.length=0}function jl(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 P5(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 F5(e){for(var r=[],i=e.head.next;i!==e.tail;)r.push(i.value),i=i.next;return r}const A0=Vt;function D0(){}D0.prototype=A0;const $t=new D0;$t.highlight=U5;$t.register=$5;$t.alias=q5;$t.registered=W5;$t.listLanguages=G5;$t.util.encode=V5;$t.Token.stringify=dh;function U5(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:A0.highlight.call($t,e,i,s)}}function $5(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 q5(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 u=s[c],p=typeof u=="string"?[u]:u;let l=-1;for(;++l<p.length;)i[p[l]]=i[c]}}function W5(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn($t.languages,e)}function G5(){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 dh(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(dh(e[c],r));return s}const i={attributes:{},classes:["token",e.type],content:dh(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),A5(i.tag+"."+i.classes.join("."),Y5(i.attributes),i.content)}function V5(e){return e}function Y5(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=O5(e[r]));return e}var gt=w5($t,{});gt.registerLanguage=function(e,r){return $t.register(r)};gt.alias=function(e,r){return $t.alias(e,r)};Li.displayName="markup";Li.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function Li(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(i,s){var c={};c["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[s]},c.cdata=/^<!\[CDATA\[|\]\]>$/i;var u={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:c}};u["language-"+s]={pattern:/[\s\S]+/,inside:e.languages[s]};var p={};p[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:u},e.languages.insertBefore("markup","cdata",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}Yl.displayName="css";Yl.aliases=[];function Yl(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)}Ri.displayName="clike";Ri.aliases=[];function Ri(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:/[{}[\];(),.:]/}}Ja.displayName="javascript";Ja.aliases=["js"];function Ja(e){e.register(Ri),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}Rh.displayName="sql";Rh.aliases=[];function Rh(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:/[;[\]()`,.]/}}Kl.displayName="c";Kl.aliases=[];function Kl(e){e.register(Ri),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}Mh.displayName="cpp";Mh.aliases=[];function Mh(e){e.register(Kl),(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)}Oh.displayName="bash";Oh.aliases=["sh","shell"];function Oh(e){(function(r){var i="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},c={bash:s,environment:{pattern:RegExp("\\$"+i),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+i),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};r.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+i),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:c},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:c},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:c.entity}}],environment:{pattern:RegExp("\\$?"+i),alias:"constant"},variable:c.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},s.inside=r.languages.bash;for(var u=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],p=c.variable[1].inside,l=0;l<u.length;l++)p[u[l]]=r.languages.bash[u[l]];r.languages.sh=r.languages.bash,r.languages.shell=r.languages.bash})(e)}Ih.displayName="yaml";Ih.aliases=["yml"];function Ih(e){(function(r){var i=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,c="(?:"+s.source+"(?:[ ]+"+i.source+")?|"+i.source+"(?:[ ]+"+s.source+")?)",u=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),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"(?:"+u+"|"+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)}Bh.displayName="markdown";Bh.aliases=["md"];function Bh(e){e.register(Li),(function(r){var i=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(l){return l=l.replace(/<inner>/g,function(){return i}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+l+")")}var c=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,u=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return c}),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("^"+u+p+"(?:"+u+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+u+p+")(?:"+u+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(c),inside:r.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+u+")"+p+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+u+"$"),inside:{"table-header":{pattern:RegExp(c),alias:"important",inside:r.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(l){["url","bold","italic","strike","code-snippet"].forEach(function(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 v=f[g];if(v.type!=="code"){h(v.content);continue}var S=v.content[1],E=v.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 b="language-"+C;E.alias?typeof E.alias=="string"?E.alias=[E.alias,b]:E.alias.push(b):E.alias=[b]}}}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],v=/language-(.+)/.exec(m);if(v){h=v[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)}zh.displayName="ruby";zh.aliases=["rb"];function zh(e){e.register(Ri),(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)}Hh.displayName="diff";Hh.aliases=[];function Hh(e){(function(r){r.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var i={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(i).forEach(function(s){var c=i[s],u=[];/^\w+$/.test(s)||u.push(/\w+/.exec(s)[0]),s==="diff"&&u.push("bold"),r.languages.diff[s]={pattern:RegExp("^(?:["+c+`].*(?:\r
|
|
124
|
-
?|
|
|
125
|
-
|(?![\\s\\S])))+`,"m"),alias:u,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(s)[0]}}}}),Object.defineProperty(r.languages.diff,"PREFIXES",{value:i})})(e)}Ph.displayName="docker";Ph.aliases=["dockerfile"];function Ph(e){(function(r){var i=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,s=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return i}),c=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,u=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return c}),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 u}).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)}Fh.displayName="go";Fh.aliases=[];function Fh(e){e.register(Ri),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"]}Uh.displayName="graphql";Uh.aliases=[];function Uh(e){e.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:e.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},e.hooks.add("after-tokenize",function(i){if(i.language!=="graphql")return;var s=i.tokens.filter(function(b){return typeof b!="string"&&b.type!=="comment"&&b.type!=="scalar"}),c=0;function u(b){return s[c+b]}function p(b,y){y=y||0;for(var x=0;x<b.length;x++){var _=u(x+y);if(!_||_.type!==b[x])return!1}return!0}function l(b,y){for(var x=1,_=c;_<s.length;_++){var j=s[_],A=j.content;if(j.type==="punctuation"&&typeof A=="string"){if(b.test(A))x++;else if(y.test(A)&&(x--,x===0))return _}}return-1}function h(b,y){var x=b.alias;x?Array.isArray(x)||(b.alias=x=[x]):b.alias=x=[],x.push(y)}for(;c<s.length;){var f=s[c++];if(f.type==="keyword"&&f.content==="mutation"){var g=[];if(p(["definition-mutation","punctuation"])&&u(1).content==="("){c+=2;var m=l(/^\($/,/^\)$/);if(m===-1)continue;for(;c<m;c++){var v=u(0);v.type==="variable"&&(h(v,"variable-input"),g.push(v.content))}c=m+1}if(p(["punctuation","property-query"])&&u(0).content==="{"&&(c++,h(u(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")}}}}})}$h.displayName="scss";$h.aliases=[];function $h(e){e.register(Yl),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}qh.displayName="json";qh.aliases=["webmanifest"];function qh(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}Wh.displayName="java";Wh.aliases=[];function Wh(e){e.register(Ri),(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)}Xl.displayName="typescript";Xl.aliases=["ts"];function Xl(e){e.register(Ja),(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)}Gh.displayName="python";Gh.aliases=["py"];function Gh(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}Zl.displayName="jsx";Zl.aliases=[];function Zl(e){e.register(Ja),e.register(Li),(function(r){var i=r.util.clone(r.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,c=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,u=/(?:\{<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 u}),RegExp(f,g)}u=p(u).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 v=f[m],S=!1;if(typeof v!="string"&&(v.type==="tag"&&v.content[0]&&v.content[0].type==="tag"?v.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===l(v.content[0].content[1])&&g.pop():v.content[v.content.length-1].content==="/>"||g.push({tagName:l(v.content[0].content[1]),openedBraces:0}):g.length>0&&v.type==="punctuation"&&v.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&v.type==="punctuation"&&v.content==="}"?g[g.length-1].openedBraces--:S=!0),(S||typeof v=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var E=l(v);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)}v.content&&typeof v.content!="string"&&h(v.content)}};r.hooks.add("after-tokenize",function(f){f.language!=="jsx"&&f.language!=="tsx"||h(f.tokens)})})(e)}Vh.displayName="tsx";Vh.aliases=[];function Vh(e){e.register(Zl),e.register(Xl),(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)}Yh.displayName="rust";Yh.aliases=[];function Yh(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)}Kh.displayName="toml";Kh.aliases=[];function Kh(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 Nl={'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%)"}};gt.registerLanguage("typescript",Xl);gt.registerLanguage("javascript",Ja);gt.registerLanguage("tsx",Vh);gt.registerLanguage("jsx",Zl);gt.registerLanguage("python",Gh);gt.registerLanguage("bash",Oh);gt.registerLanguage("json",qh);gt.registerLanguage("css",Yl);gt.registerLanguage("html",Li);gt.registerLanguage("markup",Li);gt.registerLanguage("xml",Li);gt.registerLanguage("sql",Rh);gt.registerLanguage("yaml",Ih);gt.registerLanguage("markdown",Bh);gt.registerLanguage("diff",Hh);gt.registerLanguage("rust",Yh);gt.registerLanguage("go",Fh);gt.registerLanguage("java",Wh);gt.registerLanguage("c",Kl);gt.registerLanguage("cpp",Mh);gt.registerLanguage("ruby",zh);gt.registerLanguage("toml",Kh);gt.registerLanguage("scss",$h);gt.registerLanguage("graphql",Uh);gt.registerLanguage("docker",Ph);function L0(e=2e3){const[r,i]=P.useState(!1),s=P.useCallback(async c=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(c);else{const u=document.createElement("textarea");u.value=c,u.style.position="fixed",u.style.left="-9999px",document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u)}i(!0),setTimeout(()=>i(!1),e)}catch(u){console.error("Failed to copy:",u)}},[e]);return{copied:r,copy:s}}const K5={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 u=(s==null?void 0:s[1])||"text",p=String(r).replace(/\n$/,""),{copied:l,copy:h}=L0();return o.jsxs("div",{className:"relative group my-1.5 rounded overflow-hidden",children:[o.jsxs("div",{className:"absolute bottom-0 right-0 flex items-center gap-2 px-2 py-1 text-xs text-text-muted/70 bg-bg-tertiary/60 rounded-tl rounded-tr z-10",children:[o.jsx("span",{children:u}),o.jsx("button",{type:"button",onClick: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(gt,{style:Nl,language:u,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})}},Mi=P.memo(function({content:r,className:i=""}){const s=P.useMemo(()=>{let c=X5(r);return c=Z5(c),c},[r]);return o.jsx("div",{className:`markdown-content [&_li>p]:inline ${i}`,children:o.jsx(FE,{remarkPlugins:[e5],components:K5,children:s})})});function X5(e){let r=e.replace(/^(\s*)•\s/gm,"$1- ");return r=r.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),r}function Z5(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 Q5=P.memo(function({content:r,variant:i="default"}){return i==="labeled"?o.jsxs("div",{className:"text-text-muted text-sm italic feed-item",children:[o.jsx("span",{className:"text-purple-400",children:"thinking:"}),o.jsx("div",{className:"ml-1.5 mt-0.5",children:o.jsx(Mi,{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 R0({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 J5={...Nl,'pre[class*="language-"]':{...Nl['pre[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflowX:"hidden"},'code[class*="language-"]':{...Nl['code[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},e3={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 Ql(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?e3[s]??"text":"text"}const M0={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},t3={...M0,display:"inline"},n3={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},Va=P.memo(function({code:r,language:i,variant:s}){const c=s==="inline"?"span":s==="block-nowrap"?"div":"pre",u=s==="inline"?t3:s==="block-nowrap"?M0:n3;return o.jsx(gt,{style:J5,language:i,PreTag:c,customStyle:u,children:r})});function O0({src:e,alt:r,isOpen:i,onClose:s}){const c=P.useRef(null);P.useEffect(()=>{if(!i)return;const p=l=>{l.key==="Escape"&&s()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[i,s]);const u=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:u,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 r3=P.memo(function({oldString:r,newString:i,filePath:s}){const c=P.useMemo(()=>Ql(s),[s]),u=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:u.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(Va,{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(Va,{code:i,language:c,variant:"block-nowrap"})})]})]})}),i3=P.memo(function({content:r,filePath:i}){const s=P.useMemo(()=>Ql(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,u)=>o.jsx("div",{className:"leading-[1.5rem]",children:"+"},u))}),o.jsx("div",{className:"bg-green-950/30 pr-2 min-w-0 overflow-x-hidden",children:o.jsx(Va,{code:r,language:s,variant:"block"})})]})})}),s3=P.memo(function({regions:r,filePath:i}){const s=P.useMemo(()=>Ql(i),[i]);return r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):o.jsx("div",{className:"space-y-2",children:r.map((c,u)=>o.jsx(a3,{region:c,language:s},u))})}),a3=P.memo(function({region:r,language:i}){const s=o3(r),c=Math.max(...r.beforeContext.map(p=>p.lineNumber),...r.afterContext.map(p=>p.lineNumber),...r.edits.flatMap(p=>[p.startLine,p.endLine])),u=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(l3,{item:p,language:i,lineNumWidth:u},l))})});function o3(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 u=0;u<s.length;u++)r.push({type:"removed",lineNumber:i.startLine+u,content:s[u]});const c=i.newContent.split(`
|
|
132
|
-
`);for(let u=0;u<c.length;u++)r.push({type:"added",lineNumber:i.startLine+u,content:c[u]})}for(const i of e.afterContext)r.push({type:"context",lineNumber:i.lineNumber,content:i.content});return r}const l3=P.memo(function({item:r,language:i,lineNumWidth:s}){const c=String(r.lineNumber).padStart(s," "),u=r.type==="context"?"bg-bg-secondary":r.type==="removed"?"bg-red-950/30":"bg-green-950/30",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] ${u}`,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(Va,{code:r.content||" ",language:i,variant:"inline"})})]})}),c3=P.memo(function({result:r,metadata:i,filePath:s,heightExpanded:c=!1}){const[u,p]=P.useState(!1),l=P.useMemo(()=>Ql(s),[s]),h=i==null?void 0:i.mimeType,f=i==null?void 0:i.base64Data;if(h!=null&&h.startsWith("image/")&&f){const v=`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:v,alt:s,className:"max-w-full max-h-[45vh] object-contain"})}),o.jsx(O0,{src:v,alt:s,isOpen:u,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(v=>!v.startsWith(`
|
|
134
|
-
[`)&&!v.startsWith("[")).map(v=>v.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(v=>!v.startsWith(`
|
|
136
|
-
[`)&&!v.startsWith("[")).map((v,S)=>{const E=v.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(Va,{code:m,language:l,variant:"block"})})]})})}),u3={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"}},Mv=P.memo(function({diagnostics:r}){if(r.length===0)return null;const i=r.filter(u=>u.severity==="error"),s=r.filter(u=>u.severity==="warning"),c=r.filter(u=>u.severity==="info"||u.severity==="hint");return o.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[o.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[o.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),i.length>0&&o.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[i.length," error",i.length!==1?"s":""]}),s.length>0&&o.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[s.length," warning",s.length!==1?"s":""]}),c.length>0&&o.jsxs("span",{className:"text-xs text-text-muted",children:[c.length," info"]})]}),o.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.map((u,p)=>{const l=u3[u.severity];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${l.bg} border-b border-border last:border-b-0`,children:[o.jsx("span",{className:`${l.color} text-xs flex-shrink-0 w-4 text-center`,children:l.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",u.range.start.line+1,":",u.range.start.character+1]}),u.code&&o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",u.code,"]"]})]}),o.jsx("div",{className:"text-xs text-text-primary break-words",children:u.message})]})]},p)})})]})}),d3=P.memo(function({command:r,timeout:i,startedAt:s,streamingOutput:c,status:u,result:p,error:l,durationMs:h}){const f=P.useRef(null),[g,m]=P.useState(0);P.useEffect(()=>{f.current&&u==="pending"&&(f.current.scrollTop=f.current.scrollHeight)},[c,u]),P.useEffect(()=>{if(u!=="pending"||!s)return;const C=setInterval(()=>{m(Date.now()-s)},100);return()=>clearInterval(C)},[u,s]);const v=i/1e3,S=u==="pending"?g/1e3:(h??0)/1e3,E=u==="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:[u==="pending"&&o.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),u==="interrupted"&&o.jsx("span",{className:"text-red-400",children:"interrupted"}),o.jsxs("span",{className:u==="pending"?"text-text-secondary":"text-text-muted",children:[S.toFixed(1),"s / ",v,"s"]})]})]}),u==="pending"&&o.jsx("div",{className:"h-1 bg-bg-tertiary rounded overflow-hidden",children:o.jsx("div",{className:"h-full bg-accent-warning transition-all duration-100",style:{width:`${Math.min(100,g/i*100)}%`}})}),(E||u==="pending")&&o.jsx("pre",{ref:f,className:`text-xs bg-bg-primary p-2 rounded overflow-auto max-h-64 ${u==="pending"?"border border-accent-warning/30":""}`,children:u==="pending"&&c?c.map((C,b)=>o.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:Ns(C.content)},b)):Ns(E)}),u==="error"&&l&&o.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:l}),u!=="pending"&&h!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(h/1e3).toFixed(2),"s"]})]})});function h3(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 f3({confirmation:e}){const r=Ce(g=>g.confirmPath),i=Ce(g=>g.currentSession),s=Ce(g=>g.switchDangerLevel),{title:c,description:u}=h3(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:u})]})]}),o.jsxs("div",{className:"text-xs text-text-muted mb-2",children:[o.jsx("span",{className:"font-medium",children:e.tool})," ","wants to access:"]}),o.jsx("div",{className:"bg-bg-primary rounded p-2 mb-3 max-h-24 overflow-y-auto",children:o.jsx("ul",{className:"space-y-0.5",children:e.paths.map((g,m)=>o.jsx("li",{className:`text-xs font-mono ${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 p3(e,r){if(e==="read_file"){const s=String(r.path??""),c=r.offset,u=r.limit,p=[];return c!==void 0&&c!==1&&p.push(`offset=${c}`),u!==void 0&&p.push(`limit=${u}`),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 Ov(e,r,i){return p3(e,r)}function m3(e){return JSON.stringify(e,null,2)}const g3={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}},x3=P.memo(function({tool:r,args:i,status:s,variant:c="compact",result:u,error:p,durationMs:l,diagnostics:h,editContext:f,startedAt:g,streamingOutput:m,metadata:v,callId:S}){const E=r==="edit_file"||r==="write_file",C=r==="run_command"&&s==="pending",b=r==="read_file",y=r==="return_value",[x,_]=P.useState(E||C||y),j=g3[s],A=Ce(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(R0,{tool:r}),o.jsx("span",{className:"text-accent-primary font-medium",children:r}),o.jsx("span",{className:"text-text-muted truncate flex-1",children:Ov(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:()=>_(!x),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:Ov(r,i)}),o.jsx("span",{className:"text-text-muted text-xs",children:x?"▼":"▶"})]}),N&&o.jsx(f3,{confirmation:N}),(x||b)&&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(d3,{command:String(i.command??""),timeout:i.timeout??12e4,startedAt:g,streamingOutput:m,status:s,result:u,error:p,durationMs:l}),r==="edit_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[f&&f.regions.length>0?o.jsx(s3,{regions:f.regions,filePath:String(i.path??"")}):o.jsx(r3,{oldString:String(i.old_string??""),newString:String(i.new_string??""),filePath:String(i.path??"")}),h&&h.length>0&&o.jsx(Mv,{diagnostics:h})]}),r==="write_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(i3,{content:String(i.content??""),filePath:String(i.path??"")}),h&&h.length>0&&o.jsx(Mv,{diagnostics:h})]}),r==="read_file"&&s==="success"&&o.jsx(c3,{result:u,metadata:v,filePath:String(i.path??""),heightExpanded:x}),r==="return_value"&&(()=>{const L=(m==null?void 0:m.map(I=>I.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(Mi,{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:m3(i)})]}),s==="success"&&u!==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:u||"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})]})]})]})}),v3={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 b3(e){return v3[e]??`Preparing ${e}`}const y3=P.memo(function({name:r}){const i=b3(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(R0,{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,"..."]})]})})}),_3={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},S3=P.memo(function({todos:r}){return Array.isArray(r)?r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),o.jsx("div",{children:r.map((i,s)=>{const c=_3[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"})}),Iv={add:{icon:"○",color:"text-text-muted"},update:{icon:"○",color:"text-text-muted"},remove:{icon:"○",color:"text-text-muted"},complete:{icon:"◉",color:"text-purple-400"},pass:{icon:"✓",color:"text-accent-success"},fail:{icon:"✗",color:"text-accent-error"},get:{icon:"○",color:"text-text-muted"}},I0=P.memo(function({toolCalls:r,criteria:i}){if(r.length===0)return null;const s=new Map((i==null?void 0:i.map(u=>[u.id,u]))??[]),c=r.find(u=>{var p,l;return u.arguments.action==="get"&&((p=u.result)==null?void 0:p.success)&&((l=u.result)==null?void 0:l.output)});return o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Acceptance Criteria"})}),o.jsx("div",{children:c?(()=>{const u=c.result.output;if(u==="No criteria defined yet.")return o.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5",children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0 text-text-muted text-sm",children:"No criteria defined yet."})]});try{return JSON.parse(u).map((l,h)=>o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${h>0?"border-t border-border":""}`,children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx(Mi,{content:`[${l.id}] ${l.description}`})})]},l.id??h))}catch{return r.map((p,l)=>o.jsx(Bv,{tc:p,index:l,criteriaMap:s},p.id??l))}})():r.map((u,p)=>o.jsx(Bv,{tc:u,index:p,criteriaMap:s},u.id??p))})]})});function Bv({tc:e,index:r,criteriaMap:i}){const s=e.arguments.action,c=s&&Iv[s]?Iv[s]:{icon:"○",color:"text-text-muted"},u=e.arguments,p=s==="remove",l=u.id,h=u.description,f=l?i.get(l):void 0,g=h??(f==null?void 0:f.description)??(p&&l?`[${l}]`:"Criterion updated"),m=u.reason,v=s==="fail";return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${r>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${c.color} text-sm leading-tight flex-shrink-0`,children:c.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:p?"line-through text-text-muted":"",children:o.jsx(Mi,{content:g})}),m&&o.jsxs("div",{className:`mt-1 text-sm ${v?"text-accent-error":"text-text-muted"}`,children:[o.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function w3(e){return e==="criterion"}const C3="#6b7280";function Ol(e,r){var i;return((i=e.find(s=>s.id===r))==null?void 0:i.color)??C3}const sn=qn((e,r)=>({agents:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await ye("/api/agents/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchAgents:async()=>{e({loading:!0});try{const s=await(await ye("/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 ye(`/api/agents/${i}`);return s.ok?await s.json():null}catch{return null}},createAgent:async i=>{try{const s=await ye("/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 ye(`/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 ye(`/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 ye(`/api/agents/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchAgents(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await ye("/api/agents/restore-all-defaults",{method:"POST"})).ok?(await r().fetchAgents(),!0):!1}catch{return!1}}}));function k3(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"&&w3(c.toolCall.name)?i.push(c.toolCall):(s(),r.push(c));return s(),r}function E3(e,r){if(e.segments&&e.segments.length>0)return j3(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 j3(e,r,i,s,c){const u=[],p=new Map(r.map(l=>[l.id,l]));for(const l of e)switch(l.type){case"text":u.push({type:"text",content:l.content});break;case"thinking":l.content&&l.content.trim().length>0&&u.push({type:"thinking",content:l.content});break;case"tool_call":{const h=p.get(l.toolCallId);h&&u.push({type:"tool_call",toolCall:h});break}}for(const l of i)u.push({type:"preparing_tool_call",preparing:l});return c&&s&&u.push({type:"stats",stats:s}),u}const Xh=P.memo(function({message:r,showStats:i=!0}){const s=Ce(l=>{var h;return(h=l.currentSession)==null?void 0:h.criteria}),c=sn(l=>l.agents),u=E3(r,i),p=k3(u);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(Q5,{content:l.content},h);case"text":return o.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:o.jsx(Mi,{content:l.content})},h);case"preparing_tool_call":return o.jsx(y3,{name:l.preparing.name},`preparing-${l.preparing.index}`);case"tool_call":{const m=l.toolCall,v=m.result;if(m.name==="todo_write"){const C=m.arguments.todos,b=Array.isArray(C)?C:[];return o.jsx(S3,{todos:b},h)}const S=(f=v==null?void 0:v.output)==null?void 0:f.includes("[interrupted by user]"),E=v?S?"interrupted":v.success?"success":"error":"pending";return o.jsx(x3,{tool:m.name,args:m.arguments,status:E,variant:"expandable",result:v==null?void 0:v.output,error:v==null?void 0:v.error,durationMs:v==null?void 0:v.durationMs,diagnostics:v==null?void 0:v.diagnostics,editContext:v==null?void 0:v.editContext,startedAt:m.startedAt,streamingOutput:m.streamingOutput,metadata:v==null?void 0:v.metadata,callId:m.id},h)}case"criteria_group":return o.jsx(I0,{toolCalls:l.toolCalls,criteria:s},h);case"stats":{const m=l.stats,v=((g=m.model.split("/").pop())==null?void 0:g.split("-").slice(0,2).join("-"))??m.model,S=Ol(c,m.mode),E=b=>b>=1e3?`${(b/1e3).toFixed(1)}k`:b.toString(),C=b=>b>=1e3?`${(b/1e3).toFixed(1)}k`:b.toFixed(1);return o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:"text-text-secondary",children:v}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("span",{style:{color: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"})]})]})})}),Yt=qn((e,r)=>({workflows:[],defaultIds:[],modifiedIds:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await ye("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchDefaultIds:async()=>{try{const s=await(await ye("/api/workflows/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await ye("/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 ye(`/api/workflows/${i}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async i=>{try{const s=await ye("/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 ye(`/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 ye(`/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 ye(`/api/workflows/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchWorkflows(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await ye("/api/workflows/restore-all-defaults",{method:"POST"})).ok?(await r().fetchWorkflows(),!0):!1}catch{return!1}}}));function N3(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 T3(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function zv(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 A3=P.memo(function({data:r}){var c;const s=((c=Yt(u=>u.workflows).find(u=>u.id===r.workflowId))==null?void 0:c.color)??r.workflowColor??"#8b949e";return o.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:zv(s,.3),backgroundColor:zv(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(Ma,{label:"Iterations",value:String(r.iterations)}),o.jsx(Ma,{label:"Total time",value:N3(r.totalTimeSeconds)}),o.jsx(Ma,{label:"Tool calls",value:String(r.totalToolCalls)}),o.jsx(Ma,{label:"Tokens",value:T3(r.totalTokensGenerated)}),o.jsx(Ma,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function Ma({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 Hv(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 D3=P.memo(function({data:r}){var c;const s=((c=Yt(u=>u.workflows).find(u=>u.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:Hv(s,.3),backgroundColor:Hv(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 L3({attachments:e,messageId:r}){const[i,s]=P.useState(null),c=Ce(g=>g.visionFallbackByMessage),u=Ce(g=>g.messages),p=P.useMemo(()=>{const g=u.findIndex(m=>m.id===r);if(g===-1)return null;for(let m=g+1;m<u.length;m++){const v=u[m];if(v&&v.role==="assistant")return v.id}return null},[u,r]),l=g=>{s(g)},h=()=>{s(null)},f=g=>{const m=`${r}-${g}`;if(c[m])return c[m];if(p){const v=`${p}-${g}`;return c[v]}return null};return e.length===0?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(g=>{const m=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(O0,{src:i,alt:"Attached image",isOpen:!0,onClose:h})]})}function R3({isOpen:e,onClose:r,promptContext:i}){const[s,c]=P.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),u=p=>{c(l=>({...l,[p]:!l[p]}))};return o.jsx(dn,{isOpen:e,onClose:r,title:"Prompt Inspector",size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx(_s,{title:"User Message",expanded:s.userMessage??!0,onToggle:()=>u("userMessage"),children:o.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto",children:i.userMessage||"(empty)"})}),i.messages.length>0&&o.jsx(_s,{title:`Prompt Messages (${i.messages.length})`,expanded:s.messages??!0,onToggle:()=>u("messages"),children:o.jsx("div",{className:"space-y-2",children:i.messages.map((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(_s,{title:`Tools (${i.tools.length})`,expanded:s.tools??!0,onToggle:()=>u("tools"),children:o.jsxs("div",{className:"space-y-2",children:[i.tools.length===0&&o.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),i.tools.map((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(_s,{title:"Request Options",expanded:s.requestOptions??!0,onToggle:()=>u("requestOptions"),children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto font-mono lowercase",children:JSON.stringify(i.requestOptions,null,2)})}),i.injectedFiles.length>0&&o.jsx(_s,{title:`Injected Files (${i.injectedFiles.length})`,expanded:s.injectedFiles??!0,onToggle:()=>u("injectedFiles"),children:o.jsx("div",{className:"space-y-2",children:i.injectedFiles.map((p,l)=>o.jsx(M3,{file:p,expanded:s[`file-${l}`]??!1,onToggle:()=>u(`file-${l}`)},l))})}),o.jsx(_s,{title:"System Prompt",expanded:s.systemPrompt??!1,onToggle:()=>u("systemPrompt"),badge:`${Math.round(i.systemPrompt.length/1e3)}K chars`,children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-96 overflow-auto font-mono",children:i.systemPrompt})})]})})}function M3({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 _s({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 O3({content:e,promptContext:r,align:i="right"}){const[s,c]=P.useState(!1),[u,p]=P.useState(!1),[l,h]=P.useState(!1),f=P.useRef(null);P.useEffect(()=>{const v=S=>{f.current&&!f.current.contains(S.target)&&c(!1)};return s&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]);const g=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const v=document.createElement("textarea");v.value=e,v.style.position="fixed",v.style.left="-999999px",document.body.appendChild(v),v.select(),document.execCommand("copy"),document.body.removeChild(v)}h(!0),c(!1),window.setTimeout(()=>h(!1),1500)}catch(v){console.error("Failed to copy:",v)}},m=i==="right";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`flex items-start gap-1.5 ${m?"":"order-first"}`,children:[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(R3,{isOpen:u,onClose:()=>p(!1),promptContext:r})]})}function I3({message:e}){const[r,i]=P.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,c=(s==null?void 0:s.color)??"#6b7280",u=(s==null?void 0:s.name)??"Agent",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:u}),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(dn,{isOpen:r,onClose:()=>i(!1),title:`${u} Prompt`,size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:c}}),o.jsx("span",{className:"text-sm text-text-primary font-medium",children:u}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",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 B3({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(O3,{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(L3,{attachments:e.attachments,messageId:e.id})]})]})}const B0=P.memo(function({message:r,isLastAssistantMessage:i=!1,promptContext:s}){const c=r.role==="user",u=r.role==="assistant",p=r.role==="system",l=r.role==="tool";if(u)return o.jsx(Xh,{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(D3,{data:h})}catch{}if(r.messageKind==="task-completed")try{const h=JSON.parse(r.content);return o.jsx(A3,{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(I3,{message:r}):c?o.jsx(B3,{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(Mi,{content:r.content})})})}),z0=(e,r)=>{const i=P.useRef(!0),[s,c]=P.useState(!0),u=()=>{const p=e.current;p&&(p.scrollTop=p.scrollHeight)};return P.useEffect(()=>{const p=e.current;if(!p)return;const l=g=>{if(g.deltaY>0){requestAnimationFrame(()=>requestAnimationFrame(()=>{p.scrollHeight-p.scrollTop-p.offsetHeight<100&&(i.current=!0,c(!0))}));return}i.current=!1,c(!1)},h=new MutationObserver(()=>{i.current&&requestAnimationFrame(u)}),f=setInterval(()=>{i.current&&u()},1e3);return p.addEventListener("wheel",l,{passive:!0}),h.observe(p,{childList:!0,subtree:!0,characterData:!0}),()=>{p.removeEventListener("wheel",l),h.disconnect(),clearInterval(f)}},[r==null?void 0:r.id]),{force_scroll_to_bottom:()=>{i.current=!0,c(!0),u()},isAutoScrollActive:s,setAutoScroll:p=>{i.current=p,c(p),p&&u()}}},z3={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function H3(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function P3(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function F3(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function U3({contextState:e}){const{currentTokens:r,maxTokens:i,compactionCount:s,dangerZone:c}=e,u=Math.round(r/i*100);return o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[o.jsxs("span",{className:F3(u,c),children:[Tl(r),"/",Tl(i)]}),o.jsx("div",{className:"h-1 bg-bg-tertiary rounded-full overflow-hidden w-12",children:o.jsx("div",{className:`h-full transition-all duration-300 ${P3(u,c)}`,style:{width:`${Math.min(u,100)}%`}})}),c&&o.jsx("span",{className:"text-accent-error animate-pulse",children:"Low!"}),s>0&&o.jsxs("span",{className:"text-text-muted bg-bg-tertiary px-1 rounded",children:[s,"x"]})]})}const $3=P.memo(function({messages:r,subAgentType:i,subAgentId:s,isStreaming:c}){const u=P.useRef(null),p=P.useRef(null),[l,h]=P.useState(!1),f=sn(_=>_.agents),g=Ce(_=>_.subAgentContextStates[s]),{isAutoScrollActive:m,setAutoScroll:v}=z0(p,null);P.useEffect(()=>{c||v(!0)},[c]);const S=P.useCallback(()=>{const _=!l;h(_),_&&setTimeout(()=>{var j;(j=u.current)==null||j.scrollIntoView({block:"start",behavior:"smooth"})},220)},[l]),E=f.find(_=>_.id===i),C=(E==null?void 0:E.name)??z3[i]??i,b=Ol(f,i),y=H3(b),x=r.filter(_=>_.role!=="tool");return o.jsxs("div",{ref:u,className:"feed-item border border-border rounded overflow-hidden bg-bg-secondary",children:[o.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1 border-b",style:y,children:[o.jsx("span",{className:"text-xs font-medium",children:C}),o.jsxs("div",{className:"flex items-center gap-2",children:[g&&o.jsx(U3,{contextState:g}),o.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5",onClick:()=>v(!m),children:[o.jsx("span",{className:`w-1 h-1 rounded-full ${m?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsxs("button",{type:"button",className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary",onClick:S,children:[l?"▼":"▶"," Expand"]})]})]}),o.jsx("div",{ref:p,className:`${l?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:x.map(_=>_.role==="assistant"?o.jsx(Xh,{message:_,showStats:!0},_.id):o.jsx(B0,{message:_,isLastAssistantMessage:!1},_.id))})]})});function q3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function W3({isOpen:e,onClose:r,initialEditId:i}){const s=sn(pe=>pe.agents),c=sn(pe=>pe.modifiedIds),u=sn(pe=>pe.loading),p=sn(pe=>pe.fetchAgents),l=sn(pe=>pe.fetchAgent),h=sn(pe=>pe.createAgent),f=sn(pe=>pe.updateAgent),g=sn(pe=>pe.deleteAgent),m=sn(pe=>pe.restoreDefault),v=sn(pe=>pe.restoreAllDefaults),[S,E]=P.useState("list"),[C,b]=P.useState(null),[y,x]=P.useState(null),[_,j]=P.useState(""),[A,N]=P.useState(""),[L,T]=P.useState(""),[I,z]=P.useState(!0),[V,Y]=P.useState([]),[$,F]=P.useState("#6b7280"),[B,q]=P.useState(""),[X,J]=P.useState(""),[R,D]=P.useState(!1),[O,W]=P.useState(null),[U,K]=P.useState(!1),[te,Q]=P.useState([]);function Z(pe){const Me=new Map;for(const nt of pe){const Ke=nt.indexOf(":");if(Ke===-1)Me.set(nt,new Set);else{const Ye=nt.slice(0,Ke),de=nt.slice(Ke+1).split(",").filter(Boolean);Me.set(Ye,new Set(de))}}return Me}function H(pe){const Me=[];for(const[nt,Ke]of pe)Ke.size===0?Me.push(nt):Me.push(`${nt}:${[...Ke].join(",")}`);return Me}const se=Z(V),ie=(pe,Me)=>{const nt=new Map(se),Ke=nt.get(pe)||new Set,Ye=new Set(Ke);Ye.has(Me)?Ye.delete(Me):Ye.add(Me),Ye.size===0?nt.set(pe,new Set):nt.set(pe,Ye),Y(H(nt))};P.useEffect(()=>{e&&(p(),ye("/api/tools").then(pe=>pe.json()).then(pe=>Q(pe.tools||[])).catch(()=>Q([])),x(null),W(null),K(!1),i?(E("edit"),b(i),J(""),l(i).then(pe=>{pe&&(j(pe.metadata.name),N(pe.metadata.id),T(pe.metadata.description),z(pe.metadata.subagent),Y(pe.metadata.allowedTools),F(pe.metadata.color??"#6b7280"),q(pe.prompt))})):(E("list"),b(null)))},[e,p,l,i]);const ge=()=>{b(null),j(""),N(""),T(""),z(!0),Y(["read_file"]),F("#6b7280"),q(""),J(""),E("edit")},ve=async pe=>{const Me=await l(pe);Me&&(b(pe),j(Me.metadata.name),N(Me.metadata.id),T(Me.metadata.description),z(Me.metadata.subagent),Y(Me.metadata.allowedTools),F(Me.metadata.color??"#6b7280"),q(Me.prompt),J(""),E("edit"))},Ee=async pe=>{await g(pe),x(null)},De=async()=>{const pe=C??A;if(!pe||!_||!B){J("Name and prompt are required.");return}D(!0),J("");const Me={metadata:{id:pe,name:_,description:L,subagent:I,allowedTools:V,color:$},prompt:B},nt=C?await f(C,Me):await h(Me);if(D(!1),!nt.success){J(nt.error??"Failed to save agent.");return}i?r():E("list")},Re=()=>{i?r():E("list")},$e=pe=>{j(pe),C||N(q3(pe))},we=pe=>{const Me=new Map(se);Me.has(pe)?Me.delete(pe):Me.set(pe,new Set),Y(H(Me))};if(S==="edit")return o.jsx(dn,{isOpen:e,onClose:Re,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:[X&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:X}),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:_,onChange:pe=>$e(pe.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:pe=>!C&&N(pe.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:pe=>T(pe.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:()=>z(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${I?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"}`,children:"Sub-agent"}),o.jsx("button",{onClick:()=>z(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${I?"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:pe=>F(pe.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(pe=>{const Me=se.has(pe.name),nt=pe.actions.length>0,Ke=se.get(pe.name)||new Set,Ye=o.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Me?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"}`,children:[o.jsx("span",{children:pe.name}),nt&&o.jsx("span",{className:`text-[10px] ${Me&&Ke.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},pe.name);return nt?o.jsx(Ka,{trigger:Ye,minWidth:"160px",items:[...pe.actions.map(ct=>({label:o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${pe.name}-${ct}`,children:[o.jsx("input",{type:"checkbox",id:`${pe.name}-${ct}`,checked:Ke.has(ct),onChange:()=>ie(pe.name,ct),className:"w-3 h-3 rounded accent-accent-primary"}),o.jsx("span",{children:ct})]}),closeOnClick:!1})),{label:Me?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(Me)we(pe.name);else{const ct=new Map(se);ct.set(pe.name,new Set(pe.actions)),Y(H(ct))}}}]},pe.name):o.jsx("button",{onClick:()=>we(pe.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Me?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"}`,children:o.jsx("span",{children:pe.name})},pe.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:B,onChange:pe=>q(pe.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:Re,children:"Cancel"}),o.jsx(dt,{variant:"primary",onClick:De,disabled:R||!_||!B,children:R?"Saving...":"Save"})]})]})});const lt=s.filter(pe=>pe.subagent),ht=s.filter(pe=>!pe.subagent);return o.jsxs(dn,{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&&(U?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await v(),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"})]})]}),u&&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(pe=>o.jsx(Pv,{agent:pe,confirmDeleteId:y,isModified:c.includes(pe.id),confirmRestoreId:O,onRestore:async()=>{await m(pe.id),W(null)},onConfirmRestore:()=>W(pe.id),onCancelRestore:()=>W(null),onEdit:()=>ve(pe.id),onDelete:()=>Ee(pe.id),onConfirmDelete:()=>x(pe.id),onCancelDelete:()=>x(null)},pe.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(pe=>o.jsx(Pv,{agent:pe,confirmDeleteId:y,isModified:c.includes(pe.id),confirmRestoreId:O,onRestore:async()=>{await m(pe.id),W(null)},onConfirmRestore:()=>W(pe.id),onCancelRestore:()=>W(null),onEdit:()=>ve(pe.id),onDelete:()=>Ee(pe.id),onConfirmDelete:()=>x(pe.id),onCancelDelete:()=>x(null)},pe.id))})]})]})]})}function Pv({agent:e,confirmDeleteId:r,isModified:i,confirmRestoreId:s,onRestore:c,onConfirmRestore:u,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:u,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(ii,{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 G3(){const e=Ce(C=>{var b;return(b=C.currentSession)==null?void 0:b.mode}),r=Ce(C=>C.switchMode),i=sn(C=>C.agents),s=sn(C=>C.fetchAgents),[c,u]=P.useState(!1),[p,l]=P.useState(!1),[h,f]=P.useState(null),g=P.useRef(null);if(P.useEffect(()=>{s()},[s]),P.useEffect(()=>{function C(b){g.current&&!g.current.contains(b.target)&&u(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]),!e)return null;const m=i.filter(C=>!C.subagent),v=m.find(C=>C.id===e),S=(v==null?void 0:v.name)??e,E=Ol(i,e);return o.jsxs("div",{className:"relative",ref:g,children:[o.jsxs("button",{type:"button",onClick:()=>u(!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 b=C.id===e,y=Ol(i,C.id);return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${b?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[o.jsxs("button",{type:"button",onClick:()=>{b||r(C.id),u(!1)},className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"font-medium",style:{color:y},children:C.name}),b&&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(ii,{className:"opacity-0 group-hover:opacity-100",onClick:x=>{x.stopPropagation(),u(!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:()=>{u(!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(W3,{isOpen:p,onClose:()=>{l(!1),f(null)},initialEditId:h})]})}function V3(){const e=Ce(s=>s.currentSession),r=Ce(s=>s.switchDangerLevel);if(!e)return null;const i=e.dangerLevel??"normal";return o.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[o.jsx("button",{type:"button",onClick:()=>r("normal"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="normal"?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Normal mode - requires path confirmation",children:"Normal"}),o.jsx("button",{type:"button",onClick:()=>r("dangerous"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="dangerous"?"bg-red-500/20 text-red-400":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Dangerous mode - bypasses all confirmations",children:"Dangerous"})]})}function Y3({question:e}){const r=Ce(f=>f.answerQuestion),i=P.useRef(null),s=P.useRef(null),[c,u]=P.useState(""),p=P.useCallback(f=>{f.key},[]);P.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=""}},[]),P.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 Hl.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=>u(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 K3(){const e=Ce(s=>s.connectionStatus),r=Ce(s=>s.reconnect);if(e==="connected")return null;const i=e==="reconnecting";return o.jsxs("div",{className:`
|
|
138
|
-
flex items-center justify-between px-4 py-2
|
|
139
|
-
text-sm font-medium
|
|
140
|
-
${i?"bg-amber-500/15 border-b border-amber-500/30 text-amber-300":"bg-red-500/15 border-b border-red-500/30 text-red-300"}
|
|
141
|
-
`,children:[o.jsx("div",{className:"flex items-center gap-2",children:i?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"flex gap-1",children:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"150ms"}}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"300ms"}})]}),o.jsx("span",{children:"Reconnecting to server..."})]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),o.jsx("span",{children:"Connection lost"})]})}),o.jsx("button",{onClick:()=>r(),disabled:i,className:`
|
|
142
|
-
px-3 py-1 rounded text-xs font-medium
|
|
143
|
-
transition-colors
|
|
144
|
-
${i?"bg-amber-500/20 text-amber-400 cursor-not-allowed opacity-50":"bg-red-500/20 text-red-300 hover:bg-red-500/30 hover:text-red-200"}
|
|
145
|
-
`,children:i?"Reconnecting...":"Reconnect"})]})}function X3(){const e=fS(),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 Z3({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 Q3({history:e,selectedIndex:r,onSelect:i,onEscape:s,onNavigate:c}){const u=P.useRef(null),p=P.useRef(null);P.useEffect(()=>{p.current&&u.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:u,role:"list",className:"mb-2 p-2 bg-bg-secondary border border-border rounded-lg overflow-y-auto max-h-64",onKeyDown:l,children:e.map((f,g)=>o.jsxs("div",{ref:g===r?p:null,role:"listitem",onClick:()=>h(f.content),className:`
|
|
146
|
-
p-2 rounded cursor-pointer transition-colors
|
|
147
|
-
${g===r?"bg-accent-primary/20 border border-accent-primary":"hover:bg-bg-tertiary"}
|
|
148
|
-
`,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 J3={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function qd(e,r={}){const i={...J3,...r};if(!e.type.startsWith("image/"))throw new Error("File is not an image");if(!["image/png","image/jpeg","image/gif"].includes(e.type))throw new Error(`Unsupported image format: ${e.type}. Only PNG, JPG, and GIF are supported.`);if(e.size<=i.maxSizeBytes){const c=await e.arrayBuffer(),u=a4(c),p=`data:${e.type};base64,${u}`,l=await H0(p);return{dataUrl:p,mimeType:e.type,size:e.size,width:l.width,height:l.height}}return await e4(e,i)}async function e4(e,r){const i=await n4(e),s=await H0(i),{width:c,height:u}=t4(s.width,s.height,r.maxWidth,r.maxHeight),p=r4();p.width=c,p.height=u;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,u);let h=r.quality,f;do{if(f=p.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,h),Fv(f)<=r.maxSizeBytes||h<=.3)break;h-=.1}while(!0);const g=Fv(f);return{dataUrl:f,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:c,height:u}}function t4(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 n4(e){return new Promise((r,i)=>{const s=s4(),c=new s;c.onload=()=>r(c.result),c.onerror=()=>i(new Error("Failed to read file")),c.readAsDataURL(e)})}function H0(e){return new Promise((r,i)=>{const s=i4(),c=new s;c.onload=()=>r(c),c.onerror=()=>i(new Error("Failed to load image")),c.src=e})}function r4(){var r;const e=Zh();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function i4(){const e=Zh();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function s4(){const e=Zh();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function Zh(){return globalThis}function a4(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 Fv(e){const i=e.split(",")[1];return i?Math.round(i.length*3/4):0}function Wd(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function Gd(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${Uv(e.size)}). Maximum size is ${Uv(r)}.`}:{valid:!0}}function Uv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function o4(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 l4({isOpen:e,onClose:r,providerId:i,model:s}){const[c,u]=P.useState(s.contextWindow),[p,l]=P.useState(!1),h=jt(m=>m.updateModelContext);if(P.useEffect(()=>{u(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=()=>{u(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=>u(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 c4(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function u4(){var F;const[,e]=ar(),r=Ce(B=>B.currentSession),i=Ce(B=>B.setSessionProvider),[s,c]=P.useState(!1),[u,p]=P.useState([]),[l,h]=P.useState(null),f=P.useRef(null),[g,m]=P.useState(null),v=P.useRef(new Set),S=jt(B=>B.providers),E=jt(B=>B.activeProviderId),C=jt(B=>B.model);jt(B=>B.backend);const b=jt(B=>B.llmStatus),y=jt(B=>B.activating),x=jt(B=>B.activateProvider),_=jt(B=>B.refreshModel),j=jt(B=>B.refreshProviderModels);P.useEffect(()=>{function B(q){f.current&&!f.current.contains(q.target)&&(c(!1),p([]),v.current=new Set)}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]),P.useEffect(()=>{if(s){const B=S.map(q=>q.id);p(B),B.forEach(q=>{v.current.has(q)||(v.current.add(q),L(q))})}},[s,S]),S.find(B=>B.id===E);const A=b==="disconnected",N=C?((F=C.split("/").pop())==null?void 0:F.replace(/-/g," "))??C:"detecting...",L=async B=>{h(B);try{await j(B)}catch{}finally{h(null)}},T=async B=>{if(B.id===E){u.includes(B.id)?p(u.filter(q=>q!==B.id)):(p([...u,B.id]),L(B.id));return}r?(i(B.id,void 0),jt.getState().syncFromSession(B.id,""),c(!1),p([])):await x(B.id)&&(c(!1),p([]))},I=B=>{u.includes(B.id)?p(u.filter(q=>q!==B.id)):(p([...u,B.id]),L(B.id))},z=async(B,q)=>{B.stopPropagation(),v.current.delete(q),await j(q),await L(q)},V=(B,q)=>{m({providerId:B,model:q})},Y=()=>{m(null)},$=async(B,q)=>{if(console.log("[ProviderSelector.handleModelClick] providerId:",B,"model:",q),r){console.log("[ProviderSelector.handleModelClick] Calling setSessionProvider"),i(B,q),jt.getState().syncFromSession(B,q),p([]),c(!1);return}h("activating");try{(await ye(`/api/providers/${B}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:q})})).ok&&(await jt.getState().fetchConfig(),p([]),c(!1))}catch{}finally{h(null)}};return S.length===0?o.jsxs("button",{type:"button",onClick:()=>_(),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(B=>{var q;return o.jsxs("div",{children:[o.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${B.id===E?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${y?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[o.jsxs("div",{onClick:()=>!y&&T(B),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[o.jsx("span",{className:`text-sm font-medium truncate ${B.id===E?"text-accent-primary":"text-text-primary"}`,children:B.name}),o.jsx("span",{className:"text-xs text-text-muted truncate",children:B.backend!=="auto"&&Y1(B.backend)})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[B.id===E?o.jsx("span",{className:"text-accent-success",title:"Active",children:o.jsx("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:X=>{X.stopPropagation(),z(X,B.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===B.id?"animate-spin":""} ${B.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:X=>{X.stopPropagation(),I(B)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:o.jsx("svg",{className:`w-4 h-4 transition-transform ${u.includes(B.id)?"rotate-180":""} ${B.id===E?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),u.includes(B.id)&&o.jsx("div",{className:"bg-bg-primary border-t border-border",children:l===B.id?o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(q=B.models)!=null&&q.length?B.models.map(X=>{var J;return o.jsxs("button",{type:"button",onClick:()=>$(B.id,X.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===X.id?"text-accent-primary":"text-text-secondary"}`,children:[o.jsx("span",{className:"truncate flex-1",children:((J=X.id.split("/").pop())==null?void 0:J.replace(/-/g," "))??X.id}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-xs text-text-muted",children:c4(X.contextWindow)}),o.jsx("button",{type:"button",onClick:R=>{R.stopPropagation(),V(B.id,X)},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===X.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"})})})]},X.id)}):o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},B.id)})}),o.jsx("div",{className:"border-t border-border px-3 py-2",children:o.jsx("button",{onClick:()=>e("/onboarding"),className:"text-xs text-accent-primary hover:underline",children:"Manage providers"})})]}),g&&o.jsx(l4,{isOpen:!0,onClose:Y,providerId:g.providerId,model:g.model})]})}const An=qn((e,r)=>({commands:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await ye("/api/commands/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchCommands:async()=>{e({loading:!0});try{const s=await(await ye("/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 ye(`/api/commands/${i}`);return s.ok?await s.json():null}catch{return null}},createCommand:async i=>{try{const s=await ye("/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 ye(`/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 ye(`/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 ye(`/api/commands/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchCommands(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await ye("/api/commands/restore-all-defaults",{method:"POST"})).ok?(await r().fetchCommands(),!0):!1}catch{return!1}}}));function d4(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function P0({isOpen:e,onClose:r,initialEditId:i}){const s=An(H=>H.commands),c=An(H=>H.modifiedIds),u=An(H=>H.loading),p=An(H=>H.fetchCommands),l=An(H=>H.fetchCommand),h=An(H=>H.createCommand),f=An(H=>H.updateCommand),g=An(H=>H.deleteCommand),m=An(H=>H.restoreDefault),v=An(H=>H.restoreAllDefaults),[S,E]=P.useState("list"),[C,b]=P.useState(null),[y,x]=P.useState(null),_=sn(H=>H.agents),j=sn(H=>H.fetchAgents),A=_.filter(H=>!H.subagent),[N,L]=P.useState(""),[T,I]=P.useState(""),[z,V]=P.useState(""),[Y,$]=P.useState(""),[F,B]=P.useState(""),[q,X]=P.useState(!1),[J,R]=P.useState(null),[D,O]=P.useState(!1);P.useEffect(()=>{e&&(p(),j(),x(null),R(null),O(!1),i?(E("edit"),b(i),B(""),l(i).then(H=>{H&&(L(H.metadata.name),I(H.metadata.id),V(H.prompt),$(H.metadata.agentMode??""))})):(E("list"),b(null)))},[e,p,j,l,i]);const W=()=>{b(null),L(""),I(""),V(""),$(""),B(""),E("edit")},U=async H=>{const se=await l(H);se&&(b(H),L(se.metadata.name),I(se.metadata.id),V(se.prompt),$(se.metadata.agentMode??""),B(""),E("edit"))},K=async H=>{await g(H),x(null)},te=async()=>{const H=C??T;if(!H||!N||!z){B("Name and message are required.");return}X(!0),B("");const se={metadata:{id:H,name:N,...Y?{agentMode:Y}:{}},prompt:z},ie=C?await f(C,se):await h(se);if(X(!1),!ie.success){B(ie.error??"Failed to save command.");return}i?r():E("list")},Q=()=>{i?r():E("list")},Z=H=>{L(H),C||I(d4(H))};return S==="edit"?o.jsx(dn,{isOpen:e,onClose:Q,title:C?"Edit Command":"New Command",size:"xl",children:o.jsxs("div",{className:"space-y-3",children:[F&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:F}),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:H=>Z(H.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:H=>!C&&I(H.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:H=>$(H.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(H=>o.jsx("option",{value:H.id,children:H.name},H.id))]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),o.jsx("textarea",{value:z,onChange:H=>V(H.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:q||!N||!z,children:q?"Saving...":"Save"})]})]})}):o.jsxs(dn,{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 v(),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:W,children:"+ New"})]})]}),u&&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(H=>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:H.name}),c.includes(H.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(H.id)&&(J===H.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await m(H.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(H.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(ii,{onClick:()=>U(H.id)}),y===H.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:()=>K(H.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:()=>x(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:()=>x(H.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"})})})]})]},H.id))})]})}function h4({onSendCommand:e,onOpenManager:r,textareaContent:i,attachments:s}){const[c,u]=P.useState(!1),[p,l]=P.useState(""),[h,f]=P.useState(0),[g,m]=P.useState(null),v=P.useRef(null),S=P.useRef(null),E=An(j=>j.commands),C=An(j=>j.fetchCommands);P.useEffect(()=>{c&&(C(),l(""),f(0),requestAnimationFrame(()=>{var j;return(j=S.current)==null?void 0:j.focus()}))},[c,C]),P.useEffect(()=>{if(!c)return;const j=A=>{v.current&&!v.current.contains(A.target)&&u(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[c]);const b=E.filter(j=>{if(!p)return!0;const A=p.toLowerCase();return j.name.toLowerCase().includes(A)}),y=j=>{switch(j.key){case"ArrowDown":j.preventDefault(),f(A=>Math.min(A+1,b.length-1));break;case"ArrowUp":j.preventDefault(),f(A=>Math.max(A-1,0));break;case"Enter":j.preventDefault(),b[h]&&x(b[h].id);break;case"Escape":j.preventDefault(),u(!1);break}},x=async j=>{const A=await An.getState().fetchCommand(j);A&&e(A.prompt,A.metadata.agentMode,i,s),u(!1)},_=()=>{u(!1),r()};return o.jsxs("div",{ref:v,className:"relative",children:[o.jsxs("button",{type:"button",onClick:()=>u(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:y,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:b.length===0?o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:E.length===0?"No commands yet":"No matches"}):b.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:()=>x(j.id),className:"flex-1 text-left",children:o.jsx("div",{className:"text-sm text-text-primary font-medium",children:j.name})}),o.jsx(ii,{className:"opacity-0 group-hover:opacity-100",onClick:N=>{N.stopPropagation(),u(!1),m(j.id)}})]},j.id))}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:_,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(P0,{isOpen:!!g,onClose:()=>m(null),initialEditId:g})]})}function f4(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function p4(e){let r=1;for(;e.some(i=>i.id===`s${r}`);)r++;return`s${r}`}const m4=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],F0={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"},U0=[{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)"}],ki=150,jr=54,Ss=80,Nn=30,ws=70,$v=100,Ei=50,_l=50,qv=4;function Qh(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 g4(e,r,i,s){const c=_l+Ei+ki+$v+ki+Ei+_l,u=c/2,p=_l+Ei+ki/2,l=_l+Ei+ki+$v+ki/2,h=[],f=[],g=new Map,m=e.filter(F=>F.type==="agent"||F.type==="shell"),v=e.filter(F=>F.type==="sub_agent"),S=v.length>0,E=S?p:u,C=m.length>0?l:u,b=Ei+Nn/2;if(h.push({id:"$start",type:"terminal",label:"Start",cx:E,cy:b,w:Ss,h:Nn}),g.set("$start",{cx:E,cy:b,w:Ss,h:Nn}),e.length===0){const F=b+Nn/2+ws*2+Nn/2;return h.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:F,w:Ss,h:Nn}),g.set("$done",{cx:E,cy:F,w:Ss,h:Nn}),{nodes:h,edges:f,width:c,height:F+Nn/2+Ei,posMap:g}}const y=b+Nn/2+ws,x=(F,B)=>{F.forEach((q,X)=>{const J=y+X*(jr+ws)+jr/2,{name:R,color:D}=Qh(q,s);h.push({id:q.id,type:"step",label:R,color:D,cx:B,cy:J,w:ki,h:jr}),g.set(q.id,{cx:B,cy:J,w:ki,h:jr})})};x(m,E),x(v,C);const _=m.length>0?y+(m.length-1)*(jr+ws)+jr/2:b,j=S?y+(v.length-1)*(jr+ws)+jr/2:b,A=Math.max(_,j)+jr/2+ws+Nn/2;h.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:A,w:Ss,h:Nn}),g.set("$done",{cx:E,cy:A,w:Ss,h:Nn});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 F of e)F.transitions.forEach((B,q)=>{if(!B.goto||!g.has(B.goto))return;const X=g.get(F.id),J=g.get(B.goto),R=B.when.type==="step_result"?`${B.when.result}`:F0[B.when.type]??B.when.type,D=F.id===B.goto;let O;D?O="back":J.cy>X.cy+1?O="down":J.cy<X.cy-1?O="back":O="same",N.push({from:F.id,to:B.goto,label:R,edgeKey:`${F.id}:${q}`,direction:O,backEdgeIndex:O==="back"?L++:0})});const T=new Map,I=new Map,z=new Map,V=new Map;for(const F of N)F.direction==="down"&&(T.set(F.from,(T.get(F.from)??0)+1),I.set(F.to,(I.get(F.to)??0)+1));const Y=new Map,$=new Map;for(const F of N){if(F.direction!=="same")continue;const B=[F.from,F.to].sort().join("|");Y.set(B,(Y.get(B)??0)+1)}for(const F of N){if(F.direction==="back"||F.direction==="same"){let O=0;if(F.direction==="same"){const W=[F.from,F.to].sort().join("|");O=$.get(W)??0,$.set(W,O+1)}f.push({...F,fromPort:0,toPort:0,sameEdgeIndex:O});continue}const B=T.get(F.from)??1,q=I.get(F.to)??1,X=z.get(F.from)??0,J=V.get(F.to)??0;z.set(F.from,X+1),V.set(F.to,J+1);const R=B===1?0:-.6+1.2*X/(B-1),D=q===1?0:-.6+1.2*J/(q-1);f.push({...F,fromPort:R,toPort:D,sameEdgeIndex:0})}return{nodes:h,edges:f,width:c,height:A+Nn/2+Ei,posMap:g}}function x4({steps:e,entryStep:r,selectedNodeId:i,selectedEdgeKey:s,startConditionLabel:c,agentTypes:u,onSelectNode:p,onSelectEdge:l,onRemoveStep:h,onCreateTransition:f,onReconnectTo:g,onReconnectFrom:m,onDeleteTransition:v}){const S=P.useRef(null),E=P.useRef(!1),[C,b]=P.useState(null),[y,x]=P.useState(null),[_,j]=P.useState(null),{nodes:A,edges:N,width:L,height:T,posMap:I}=P.useMemo(()=>g4(e,r,c,u),[e,r,c,u]),z=P.useCallback(K=>{var se;const te=S.current;if(!te)return{x:0,y:0};const Q=te.createSVGPoint();Q.x=K.clientX,Q.y=K.clientY;const Z=(se=te.getScreenCTM())==null?void 0:se.inverse();if(!Z)return{x:0,y:0};const H=Q.matrixTransform(Z);return{x:H.x,y:H.y}},[]),V=P.useCallback(K=>!K||!y||K==="$start"?!1:y.type==="reconnect-from"?K!=="$done":!0,[y]),Y=P.useCallback((K,te)=>{K.stopPropagation(),K.preventDefault();const Q=z(K);x({type:"new",fromNodeId:te,mouseX:Q.x,mouseY:Q.y})},[z]),$=P.useCallback((K,te)=>{K.stopPropagation(),K.preventDefault();const Q=z(K);x({type:"reconnect-to",fromNodeId:te.from,edgeKey:te.edgeKey,mouseX:Q.x,mouseY:Q.y})},[z]),F=P.useCallback((K,te)=>{K.stopPropagation(),K.preventDefault();const Q=z(K);x({type:"reconnect-from",fromNodeId:te.from,fixedTargetId:te.to,edgeKey:te.edgeKey,mouseX:Q.x,mouseY:Q.y})},[z]),B=P.useCallback(K=>{if(!y)return;const te=z(K);x(Q=>Q?{...Q,mouseX:te.x,mouseY:te.y}:null)},[y,z]),q=P.useCallback(()=>{y&&(E.current=!0,_&&V(_)&&(y.type==="new"?f(y.fromNodeId,_):y.type==="reconnect-to"?g(y.edgeKey,_):y.type==="reconnect-from"&&m(y.edgeKey,_)),x(null),j(null))},[y,_,V,f,g,m]),X=P.useCallback(()=>{if(E.current){E.current=!1;return}p(null),l(null)},[p,l]);P.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(),v(s),l(null))};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[s,v,l]);const J=K=>{const te=I.get(K.from),Q=I.get(K.to);if(!te||!Q)return null;let Z,H,se,ie="middle",ge,ve;if(K.direction==="down"){const Ee=te.cx+K.fromPort*(te.w/2-10),De=te.cy+te.h/2,Re=Q.cx+K.toPort*(Q.w/2-10),$e=Q.cy-Q.h/2,we=$e-De,lt=Re-Ee;Z=`M ${Ee} ${De} C ${Ee} ${De+we*.4}, ${Re-lt*.2} ${$e-we*.1}, ${Re} ${$e}`,H=Ee+(Re-Ee)*.5,se=De+we*.6,ge={x:Ee,y:De},ve={x:Re,y:$e}}else if(K.direction==="back"){const Ee=K.from===K.to,De=te.cx>=L/2,Re=K.backEdgeIndex*16,$e=De?L-20-Re:20+Re;if(Ee){const we=te.cx>=L/2,lt=30+K.backEdgeIndex*14,ht=te.cy-te.h/2,pe=we?te.cx+te.w/2:te.cx-te.w/2,Me=we?pe+lt:pe-lt,nt=te.cx+(we?te.w/4:-te.w/4),Ke=ht-20-K.backEdgeIndex*10;Z=`M ${pe} ${te.cy} C ${Me} ${te.cy}, ${Me} ${Ke}, ${nt} ${ht}`,H=Me+10,se=Ke+4,ie="middle",ge={x:pe,y:te.cy},ve={x:nt,y:ht}}else{const we=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;Z=`M ${we} ${te.cy} L ${$e} ${te.cy} L ${$e} ${ht} L ${lt} ${ht} L ${lt} ${Q.cy-Q.h/2}`,H=$e,se=(te.cy+ht)/2,ie=De?"start":"end",ge={x:we,y:te.cy},ve={x:lt,y:Q.cy-Q.h/2}}}else{const Ee=Q.cx>te.cx,De=K.sameEdgeIndex===0?-12:12,Re=Ee?te.cx+te.w/2:te.cx-te.w/2,$e=Ee?Q.cx-Q.w/2:Q.cx+Q.w/2,we=te.cy+De,lt=Q.cy+De,ht=(Re+$e)/2;Z=`M ${Re} ${we} C ${ht} ${we}, ${ht} ${lt}, ${$e} ${lt}`,H=ht,se=(we+lt)/2-6,ge={x:Re,y:we},ve={x:$e,y:lt}}return{path:Z,labelX:H,labelY:se,labelAnchor:ie,fromPt:ge,toPt:ve}},R=(K,te)=>{const Q=J(K);if(!Q)return null;const{path:Z,labelX:H,labelY:se,labelAnchor:ie}=Q,ge=s===K.edgeKey,ve=K.label&&!(K.from==="$start"&&K.label==="Always");return o.jsxs("g",{children:[o.jsx("path",{d:Z,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Ee=>{Ee.stopPropagation(),l(ge?null:K.edgeKey)}}),o.jsx("path",{d:Z,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:H+(ie==="start"?5:ie==="end"?-5:0),y:se+3,textAnchor:ie,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||y)return null;const K=N.find(se=>se.edgeKey===s);if(!K)return null;const te=J(K);if(!te)return null;const{fromPt:Q,toPt:Z}=te,H=6;return o.jsxs(o.Fragment,{children:[K.edgeKey!=="start"&&o.jsx("circle",{cx:Q.x,cy:Q.y,r:H,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:se=>F(se,K)}),o.jsx("circle",{cx:Z.x,cy:Z.y,r:H,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:se=>$(se,K)})]})},O=()=>{if(!y)return null;let K,te,Q,Z;if(y.type==="reconnect-from"){const ie=I.get(y.fixedTargetId);if(!ie)return null;K=y.mouseX,te=y.mouseY,Q=ie.cx,Z=ie.cy-ie.h/2}else{const ie=I.get(y.fromNodeId);if(!ie)return null;K=ie.cx,te=ie.cy+ie.h/2,Q=y.mouseX,Z=y.mouseY}const H=Z-te,se=Math.abs(H)>10?`M ${K} ${te} C ${K} ${te+H*.4}, ${Q} ${Z-H*.4}, ${Q} ${Z}`:`M ${K} ${te} L ${Q} ${Z}`;return o.jsx("path",{d:se,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},W=K=>{const te=K.cy+K.h/2,Q=(y==null?void 0:y.fromNodeId)===K.id;return o.jsx("circle",{cx:K.cx,cy:te,r:qv,fill:Q?"#58a6ff":"#1c2128",stroke:Q?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:Q?1:.5,className:"cursor-crosshair",onMouseDown:Z=>Y(Z,K.id)})},U=K=>{const te=K.cy-K.h/2,Q=y&&_===K.id&&V(K.id);return o.jsx("circle",{cx:K.cx,cy:te,r:qv,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:B,onMouseUp:q,onClick:X,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,Z=K.cy-K.h/2,H=C===K.id,se=y&&_===K.id&&V(K.id);if(K.type==="terminal"){const ge=K.id==="$start",ve=ge?"#58a6ff":"#3fb950",Ee=ge,De=!ge;return o.jsxs("g",{onClick:Re=>{Re.stopPropagation(),ge&&l("start")},className:ge?"cursor-pointer":void 0,children:[se&&o.jsx("rect",{x:Q-3,y:Z-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:Z-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:Z,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}),Ee&&W(K),De&&U(K)]},K.id)}const ie=K.color??"#6b7280";return o.jsxs("g",{onClick:ge=>{ge.stopPropagation(),p(te?null:K.id)},onMouseEnter:()=>b(K.id),onMouseLeave:()=>b(null),className:"cursor-pointer",children:[se&&o.jsx("rect",{x:Q-3,y:Z-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:Z-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:Z,width:K.w,height:K.h,rx:10,fill:ie,fillOpacity:.08,stroke:ie,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}),W(K),U(K),H&&!y&&o.jsxs("g",{onClick:ge=>{ge.stopPropagation(),h(K.id)},className:"cursor-pointer",children:[o.jsx("circle",{cx:Q+K.w-2,cy:Z+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),o.jsx("line",{x1:Q+K.w-5,y1:Z-1,x2:Q+K.w+1,y2:Z+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),o.jsx("line",{x1:Q+K.w+1,y1:Z-1,x2:Q+K.w-5,y2:Z+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},K.id)}),y&&A.map(K=>V(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(),q()}},`drop-${K.id}`):null),O(),D()]})}const Kn="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",Ti="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",tn="block text-[11px] text-text-secondary mb-0.5";function v4({fromLabel:e,toLabel:r,condition:i,fromStep:s,agentTypes:c,onUpdateCondition:u,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:tn,children:"Condition"}),o.jsx("select",{value:i.type,onChange:f=>{u(f.target.value==="step_result"?{type:"step_result",result:"success"}:{type:f.target.value})},className:Ti,children:U0.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:tn,children:"Result"}),h?o.jsx("select",{value:i.result??l.results[0],onChange:f=>{u({type:"step_result",result:f.target.value})},className:Ti,children:l.results.map(f=>o.jsx("option",{value:f,children:f},f))}):o.jsx("input",{type:"text",value:i.result??"success",onChange:f=>u({type:"step_result",result:f.target.value}),placeholder:"e.g. success, passed, failed",className:Kn})]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function Vd({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 b4({step:e,isEntry:r,agentTypes:i,transitionCount:s,templateVariables:c,onUpdate:u,onRemove:p,onSetEntry:l}){const{color:h,name:f}=Qh(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:tn,children:"Type"}),o.jsx("select",{value:e.type,onChange:g=>{const m=g.target.value,v=m==="sub_agent"?"verification":"build";if(m==="agent"){const S=i.find(E=>!E.subagent);u({...e,type:m,phase:v,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);u({...e,type:m,phase:v,subAgentType:(S==null?void 0:S.id)??"",name:(S==null?void 0:S.name)??"Sub-Agent"})}else u({...e,type:m,phase:v,name:"Shell"})},className:Ti,children:m4.map(g=>o.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&o.jsxs("div",{children:[o.jsx("label",{className:tn,children:"Agent Type"}),o.jsx("select",{value:e.toolMode??"builder",onChange:g=>{const m=i.find(v=>v.id===g.target.value);u({...e,toolMode:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Ti,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:tn,children:"Sub-Agent Type"}),o.jsxs("select",{value:e.subAgentType??"",onChange:g=>{const m=i.find(v=>v.id===g.target.value);u({...e,subAgentType:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Ti,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:tn,children:"Prompt"}),o.jsx("textarea",{value:e.prompt??"",onChange:g=>u({...e,prompt:g.target.value||void 0}),rows:6,className:`${Kn} resize-y text-xs`,placeholder:"Injected on first entry..."}),o.jsx(Vd,{variables:c,onInsert:g=>u({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),o.jsxs("div",{children:[o.jsx("label",{className:tn,children:"Nudge Prompt"}),o.jsx("textarea",{value:e.nudgePrompt??"",onChange:g=>u({...e,nudgePrompt:g.target.value||void 0}),rows:6,className:`${Kn} resize-y text-xs`,placeholder:"Injected on re-entry..."}),o.jsx(Vd,{variables:c,onInsert:g=>u({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:tn,children:"Command"}),o.jsx("textarea",{value:e.command??"",onChange:g=>u({...e,command:g.target.value}),rows:3,className:`${Kn} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),o.jsx(Vd,{variables:c,onInsert:g=>u({...e,command:(e.command??"")+`{{${g}}}`})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx("label",{className:tn,children:"Timeout (ms)"}),o.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>u({...e,timeout:Number(g.target.value)}),className:`${Kn} font-mono text-xs`})]}),o.jsxs("div",{children:[o.jsx("label",{className:tn,children:"Success Codes"}),o.jsx("input",{value:(e.successExitCodes??[0]).join(", "),onChange:g=>u({...e,successExitCodes:g.target.value.split(",").map(m=>Number(m.trim())).filter(m=>!isNaN(m))}),className:`${Kn} 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 Wv=[];function $0({isOpen:e,onClose:r,initialEditId:i}){const s=Yt(he=>he.workflows),c=Yt(he=>he.modifiedIds),u=Yt(he=>he.loading),p=Yt(he=>he.templateVariables),l=Yt(he=>he.fetchWorkflows),h=Yt(he=>he.fetchWorkflow),f=Yt(he=>he.fetchTemplateVariables),g=Yt(he=>he.createWorkflow),m=Yt(he=>he.updateWorkflow),v=Yt(he=>he.deleteWorkflow),S=Yt(he=>he.restoreDefault),E=Yt(he=>he.restoreAllDefaults),[C,b]=P.useState("list"),[y,x]=P.useState(null),[_,j]=P.useState(null),[A,N]=P.useState(null),[L,T]=P.useState(null),[I,z]=P.useState(""),[V,Y]=P.useState(""),[$,F]=P.useState(""),[B,q]=P.useState("1.0.0"),[X,J]=P.useState("#3b82f6"),[R,D]=P.useState(""),[O,W]=P.useState(50),[U,K]=P.useState(Wv),[te,Q]=P.useState({type:"always"}),[Z,H]=P.useState(""),[se,ie]=P.useState(!1),[ge,ve]=P.useState([]),[Ee,De]=P.useState(null),[Re,$e]=P.useState(!1);P.useEffect(()=>{e&&(l(),f(),ye("/api/agents").then(he=>he.json()).then(he=>ve(he.agents??[])).catch(()=>{}),j(null),De(null),$e(!1),N(null),T(null),i?(b("edit"),x(i),H(""),h(i).then(he=>{he&&(z(he.metadata.name),Y(he.metadata.id),F(he.metadata.description),q(he.metadata.version),J(he.metadata.color??"#3b82f6"),D(he.entryStep),W(he.settings.maxIterations),K(he.steps),Q(he.startCondition??{type:"always"}))})):(b("list"),x(null)))},[e,l,h,f,i]);const we=()=>{x(null),z(""),Y(""),F(""),q("1.0.0"),J("#3b82f6"),D(""),W(50),K(structuredClone(Wv)),Q({type:"always"}),H(""),N(null),T(null),b("edit")},lt=async he=>{const Se=await h(he);Se&&(x(he),z(Se.metadata.name),Y(Se.metadata.id),F(Se.metadata.description),q(Se.metadata.version),J(Se.metadata.color??"#3b82f6"),D(Se.entryStep),W(Se.settings.maxIterations),K(Se.steps),Q(Se.startCondition??{type:"always"}),H(""),N(null),T(null),b("edit"))},ht=async()=>{var rt;const he=y??V;if(!he||!I)return H("Name is required."),!1;if(U.length===0)return H("Add at least one step."),!1;let Se=R;if(!Se||!U.some(Ie=>Ie.id===Se)){if(Se=((rt=U.find(Ie=>Ie.id))==null?void 0:rt.id)??"",!Se)return H("All steps need an ID."),!1;D(Se)}ie(!0),H("");const ze={metadata:{id:he,name:I,description:$,version:B||"1.0.0",color:X},entryStep:Se,settings:{maxIterations:O},steps:U,startCondition:te},Xe=y?await m(y,ze):await g(ze);return ie(!1),Xe.success?(y||x(he),!0):(H(Xe.error??"Failed to save."),!1)},pe=async()=>{await ht()},Me=async()=>{await ht()&&(i?r():b("list"))},nt=()=>{i?r():b("list")},Ke=he=>{z(he),y||Y(f4(he))},Ye=P.useCallback(he=>{N(he),T(null)},[]),ct=P.useCallback(he=>{T(he),N(null)},[]),de=A!==null?Number(A):-1,be=de>=0?U[de]??null:null,Te=P.useCallback(he=>{K(Se=>Se.map((ze,Xe)=>Xe===de?he:ze))},[de]),He=te.type==="step_result"?`${te.result}`:F0[te.type]??te.type,ae=()=>{const he=U.length,Se=p4(U),ze=ge.find(Xe=>!Xe.subagent);K([...U,{id:Se,name:(ze==null?void 0:ze.name)??"Agent",type:"agent",phase:"build",toolMode:(ze==null?void 0:ze.id)??"builder",transitions:[]}]),R||D(Se),Ye(String(he))},je=P.useCallback((he,Se)=>{he==="$start"?(D(Se),ct("start")):K(ze=>{const Xe=ze.find(Ie=>Ie.id===he),rt=Xe?Xe.transitions.length:0;return ct(`${he}:${rt}`),ze.map(Ie=>Ie.id===he?{...Ie,transitions:[...Ie.transitions,{when:{type:"always"},goto:Se}]}:Ie)})},[ct]),ke=P.useCallback((he,Se)=>{if(he==="start")D(Se);else{const ze=he.lastIndexOf(":"),Xe=he.slice(0,ze),rt=parseInt(he.slice(ze+1));K(Ie=>Ie.map(Rt=>Rt.id===Xe?{...Rt,transitions:Rt.transitions.map((Et,Kt)=>Kt===rt?{...Et,goto:Se}:Et)}:Rt))}},[]),Pe=P.useCallback((he,Se)=>{const ze=he.lastIndexOf(":"),Xe=he.slice(0,ze),rt=parseInt(he.slice(ze+1));K(Ie=>{const Rt=Ie.find(Kt=>Kt.id===Xe);if(!Rt)return Ie;const Et=Rt.transitions[rt];return Et?Ie.map(Kt=>Kt.id===Xe?{...Kt,transitions:Kt.transitions.filter((Jl,Rs)=>Rs!==rt)}:Kt.id===Se?{...Kt,transitions:[...Kt.transitions,Et]}:Kt):Ie}),T(null)},[]),Fe=P.useCallback(he=>{if(he==="start")D("");else{const Se=he.lastIndexOf(":"),ze=he.slice(0,Se),Xe=parseInt(he.slice(Se+1));K(rt=>rt.map(Ie=>Ie.id===ze?{...Ie,transitions:Ie.transitions.filter((Rt,Et)=>Et!==Xe)}:Ie))}T(null)},[]),ft=P.useCallback((he,Se)=>{if(he==="start")Q(Se);else{const ze=he.lastIndexOf(":"),Xe=he.slice(0,ze),rt=parseInt(he.slice(ze+1));K(Ie=>Ie.map(Rt=>Rt.id===Xe?{...Rt,transitions:Rt.transitions.map((Et,Kt)=>Kt===rt?{...Et,when:Se}:Et)}:Rt))}},[]),qe=he=>Qh(he,ge).name,qt=()=>{if(!L)return null;if(L==="start"){const Et=U.find(Kt=>Kt.id===R);return{type:"start",fromLabel:"Start",toLabel:Et?qe(Et):"(none)",condition:te}}const he=L.lastIndexOf(":"),Se=L.slice(0,he),ze=parseInt(L.slice(he+1)),Xe=U.find(Et=>Et.id===Se);if(!Xe)return null;const rt=Xe.transitions[ze];if(!rt)return null;const Ie=U.find(Et=>Et.id===rt.goto),Rt=rt.goto==="$done"?"Done":Ie?qe(Ie):rt.goto;return{type:"step",fromLabel:qe(Xe),toLabel:Rt,condition:rt.when}};if(C==="edit"){const he=qt();return o.jsxs(dn,{isOpen:e,onClose:nt,title:y?"Edit Workflow":"New Workflow",size:"full",children:[Z&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:Z}),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:tn,children:"Name"}),o.jsx("input",{value:I,onChange:Se=>Ke(Se.target.value),placeholder:"Workflow name",className:Kn})]}),o.jsxs("div",{className:"min-w-[100px]",children:[o.jsx("label",{className:tn,children:"ID"}),o.jsx("input",{value:V,onChange:Se=>!y&&Y(Se.target.value),readOnly:!!y,className:`${Kn} font-mono ${y?"opacity-50":""}`})]}),o.jsxs("div",{className:"flex-1 min-w-[140px]",children:[o.jsx("label",{className:tn,children:"Description"}),o.jsx("input",{value:$,onChange:Se=>F(Se.target.value),placeholder:"What does this workflow do?",className:Kn})]}),o.jsxs("div",{className:"w-20",children:[o.jsx("label",{className:tn,children:"Max Iter."}),o.jsx("input",{type:"number",value:O,onChange:Se=>W(Number(Se.target.value)),className:`${Kn} font-mono`})]}),o.jsxs("div",{children:[o.jsx("label",{className:tn,children:"Color"}),o.jsx("input",{type:"color",value:X,onChange:Se=>J(Se.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:ae,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(x4,{steps:U,entryStep:R,selectedNodeId:(be==null?void 0:be.id)??null,selectedEdgeKey:L,startConditionLabel:He,agentTypes:ge,onSelectNode:Se=>{if(Se===null){Ye(null);return}const ze=U.findIndex(Xe=>Xe.id===Se);Ye(ze>=0?String(ze):null)},onSelectEdge:ct,onRemoveStep:Se=>{var Xe;const ze=U.findIndex(rt=>rt.id===Se);if(K(rt=>rt.filter(Ie=>Ie.id!==Se)),de===ze&&Ye(null),R===Se){const rt=U.filter(Ie=>Ie.id!==Se);D(((Xe=rt[0])==null?void 0:Xe.id)??"")}},onCreateTransition:je,onReconnectTo:ke,onReconnectFrom:Pe,onDeleteTransition:Fe}),U.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:ae,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:he?he.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:he.toLabel})]}),o.jsxs("div",{children:[o.jsx("label",{className:tn,children:"Activation Condition"}),o.jsx("select",{value:te.type,onChange:Se=>Q(Se.target.value==="step_result"?{type:"step_result",result:"success"}:{type:Se.target.value}),className:Ti,children:U0.map(Se=>o.jsx("option",{value:Se.value,children:Se.label},Se.value))})]}),te.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:tn,children:"Result"}),R&&(()=>{const Se=U.find(Ie=>Ie.id===R),ze=Se&&(Se.type==="sub_agent"||Se.type==="agent")?ge.find(Ie=>Ie.id===(Se.type==="sub_agent"?Se.subAgentType:Se.toolMode)):void 0,Xe=(ze==null?void 0:ze.results)&&ze.results.length>0,rt=(ze==null?void 0:ze.results)??[];return Xe?o.jsx("select",{value:te.result??rt[0],onChange:Ie=>Q({type:"step_result",result:Ie.target.value}),className:Ti,children:rt.map(Ie=>o.jsx("option",{value:Ie,children:Ie},Ie))}):o.jsx("input",{type:"text",value:te.result??"success",onChange:Ie=>Q({type:"step_result",result:Ie.target.value}),placeholder:"e.g. success, passed, failed",className:Kn})})()]}),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(v4,{fromLabel:he.fromLabel,toLabel:he.toLabel,condition:he.condition,fromStep:he.type==="step"?U.find(Se=>Se.id===he.fromLabel):void 0,agentTypes:ge,onUpdateCondition:Se=>ft(L,Se),onDelete:()=>Fe(L)}):be?o.jsx(b4,{step:be,isEntry:be.id===R,agentTypes:ge,transitionCount:be.transitions.length,templateVariables:p,onUpdate:Te,onRemove:()=>{var Se;if(be&&(K(U.filter((ze,Xe)=>Xe!==de)),Ye(null),R===be.id)){const ze=U.filter((Xe,rt)=>rt!==de);D(((Se=ze[0])==null?void 0:Se.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:nt,children:"Cancel"}),o.jsx(dt,{variant:"secondary",onClick:pe,disabled:se||!I,children:se?"Saving...":"Save"}),o.jsx(dt,{variant:"primary",onClick:Me,disabled:se||!I,children:"Save & Close"})]})]})}return o.jsxs(dn,{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&&(Re?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await E(),$e(!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:()=>$e(!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:()=>$e(!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:we,children:"+ New"})]})]}),u&&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(he=>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:he.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",he.version]}),c.includes(he.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:he.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[c.includes(he.id)&&(Ee===he.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await S(he.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(he.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(ii,{onClick:()=>lt(he.id)}),he.id!=="default"&&(_===he.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:()=>{v(he.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(he.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"})})}))]})]},he.id))})]})}function y4(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 _4({onSelectWorkflow:e,onOpenManager:r,criteria:i}){const[s,c]=P.useState(!1),[u,p]=P.useState(""),[l,h]=P.useState(0),[f,g]=P.useState(null),m=P.useRef(null),v=P.useRef(null),S=Yt(_=>_.workflows),E=Yt(_=>_.fetchWorkflows);P.useEffect(()=>{s&&(E(),p(""),h(0),requestAnimationFrame(()=>{var _;return(_=v.current)==null?void 0:_.focus()}))},[s,E]),P.useEffect(()=>{if(!s)return;const _=j=>{m.current&&!m.current.contains(j.target)&&c(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[s]);const C=S.filter(_=>{if(!u)return!0;const j=u.toLowerCase();return _.name.toLowerCase().includes(j)}),b=_=>{switch(_.key){case"ArrowDown":_.preventDefault(),h(j=>Math.min(j+1,C.length-1));break;case"ArrowUp":_.preventDefault(),h(j=>Math.max(j-1,0));break;case"Enter":_.preventDefault(),C[l]&&y(C[l].id);break;case"Escape":_.preventDefault(),c(!1);break}},y=_=>{e(_),c(!1)},x=()=>{c(!1),r()};return o.jsxs("div",{ref:m,className:"relative",children:[o.jsxs("button",{type:"button",onClick:()=>c(_=>!_),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:b,children:[o.jsx("div",{className:"p-2 border-b border-border",children:o.jsx("input",{ref:v,value:u,onChange:_=>{p(_.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((_,j)=>{const A=y4(_,i),N=_.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:_.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(ii,{className:"opacity-0 group-hover:opacity-100",onClick:L=>{L.stopPropagation(),c(!1),g(_.id)}})]},_.id)})}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:x,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($0,{isOpen:!!f,onClose:()=>g(null),initialEditId:f})]})}function S4(e){return e==="criterion"}function w4(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=>S4(s.name))}function C4(e,r=[]){const i=[];let s=null,c=[],u,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,b)=>{var y;return C.id===((y=c[b])==null?void 0:y.id)})?i.push(S):i.push({type:"criteria-batch",toolCalls:[...c]}),g++,c=[]}},v=()=>{if(!s)return;const S=s,E=h.get(S.subAgentId);E&&E.type==="subagent"&&E.messages.length===S.messages.length&&E.messages.every((b,y)=>b===S.messages[y])?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&&u&&S.contextWindowId!==u&&(m(),v(),p++,i.push({type:"context-divider",windowSequence:p})),u=S.contextWindowId,w4(S)){v();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):(v(),s={subAgentId:S.subAgentId,subAgentType:S.subAgentType,messages:[S]});else{v();const E=l.get(S.id);E&&E.type==="message"&&E.message===S?i.push(E):i.push({type:"message",message:S})}}return m(),v(),i}function k4(e){const r=new Date(e),i=r.getFullYear(),s=String(r.getMonth()+1).padStart(2,"0"),c=String(r.getDate()).padStart(2,"0"),u=String(r.getHours()).padStart(2,"0"),p=String(r.getMinutes()).padStart(2,"0");return`${i}/${s}/${c} ${u}:${p}`}function E4(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const j4=10,N4=150;function T4(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 u=s.slice(0,j4);u.reverse();const p=[];for(const l of u)p.push({id:l.id,content:l.content,timestamp:l.timestamp,formattedTimestamp:k4(l.timestamp),trimmedContent:E4(l.content,N4),sessionId:l.sessionId||void 0,sessionName:l.sessionName});return p}function A4(e,r=[],i=null){const[s,c]=P.useState(0),[u,p]=P.useState(!1),l=P.useMemo(()=>T4(e,r,i),[e,r,i]),h=P.useCallback(()=>{l.length>0&&(c(l.length-1),p(!0))},[l.length]),f=P.useCallback(()=>{p(!1),c(0)},[]),g=P.useCallback(()=>{c(S=>l.length===0?S:S===0?l.length-1:S-1)},[l.length]),m=P.useCallback(()=>{c(S=>l.length===0?S:S===l.length-1?0:S+1)},[l.length]),v=P.useCallback(()=>{if(l.length===0||!u)return null;const S=l[s];return(S==null?void 0:S.content)??null},[l,s,u]);return{history:l,selectedIndex:s,showHistory:u,openHistory:h,closeHistory:f,navigateUp:g,navigateDown:m,selectCurrent:v}}function D4({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const i=e??!0,[s,c]=P.useState(""),[u,p]=P.useState([]),[l,h]=P.useState(!1),[f,g]=P.useState(null),[m,v]=P.useState(!1),[S,E]=P.useState(!1),C=P.useRef(null),b=P.useRef(null),y=P.useRef(null),x=Ce(ae=>ae.currentSession),_=Ce(ae=>ae.messages),j=Ce(ae=>ae.streamingMessage),A=Ce(ae=>ae.sessions),N=Ce(ae=>ae.error),L=Ce(ae=>ae.pendingQuestion),T=ob(),I=Ce(ae=>ae.sendMessage),z=Ce(ae=>ae.clearError),V=Ce(ae=>ae.acceptAndBuild),Y=Ce(ae=>ae.stopGeneration),$=Ce(ae=>ae.launchRunner),F=Ce(ae=>ae.cancelQueued),B=hS(),q=Yt(ae=>ae.workflows),X=Yt(ae=>ae.fetchWorkflows);P.useEffect(()=>{X()},[X]);const{history:J,selectedIndex:R,showHistory:D,openHistory:O,closeHistory:W,navigateUp:U,navigateDown:K,selectCurrent:te}=A4(_,A,x==null?void 0:x.id),Q=P.useMemo(()=>j?_.map(ae=>ae.id===j.id?j:ae):_,[_,j]),Z=P.useRef([]),H=P.useMemo(()=>{const ae=C4(Q,Z.current);return Z.current=ae,ae},[Q]),se=P.useMemo(()=>o4(_),[_]),{force_scroll_to_bottom:ie,isAutoScrollActive:ge,setAutoScroll:ve}=z0(C,x),Ee=P.useCallback(()=>{const ae=b.current;if(!ae)return;ae.style.height="auto";const je=Math.min(200,ae.scrollHeight);ae.style.height=`${je}px`},[]);P.useEffect(()=>{if(!(x!=null&&x.id))return;const ae=`openfox:draft:${x.id}`,je=localStorage.getItem(ae);je!==null&&c(je)},[x==null?void 0:x.id]),P.useEffect(()=>{var ae;(ae=b.current)==null||ae.focus(),Ee()},[x==null?void 0:x.id,Ee]),P.useEffect(()=>{if(!(x!=null&&x.id))return;const ae=`openfox:draft:${x.id}`,je=setTimeout(()=>{s?localStorage.setItem(ae,s):localStorage.removeItem(ae)},500);return()=>clearTimeout(je)},[x==null?void 0:x.id,s]),P.useEffect(()=>{Ee()},[s,Ee]),P.useEffect(()=>{const ae=je=>{je.key==="Escape"&&T&&Y(),je.key==="ScrollLock"&&ve(!ge)};return window.addEventListener("keydown",ae),()=>window.removeEventListener("keydown",ae)},[T,Y,ge]),P.useEffect(()=>{const ae=b.current;if(!ae)return;const je=ke=>{var Fe;if(document.activeElement!==ae)return;const Pe=(Fe=ke.clipboardData)==null?void 0:Fe.items;if(Pe){for(const ft of Array.from(Pe))if(ft.type.startsWith("image/")){ke.preventDefault();const qe=ft.getAsFile();if(!qe)continue;(async()=>{try{if(!Wd(qe)){g("Only PNG, JPG, and GIF images are supported.");return}const qt=Gd(qe,50*1024*1024);if(!qt.valid){g(qt.error??"Image file is too large");return}const he=await qd(qe,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),Se={id:Sl(),filename:"pasted-image",mimeType:he.mimeType,size:he.size,data:he.dataUrl};p(ze=>[...ze,Se])}catch(qt){const he=qt instanceof Error?qt.message??"Failed to process image":"Failed to process image";g(he)}})()}}};return ae.addEventListener("paste",je),()=>ae.removeEventListener("paste",je)},[]);const De=()=>{c(""),p([]),x!=null&&x.id&&localStorage.removeItem(`openfox:draft:${x.id}`)},Re=async ae=>{ae.preventDefault(),!(!s.trim()&&u.length===0)&&(ie(),I(s,u.length>0?u:void 0),De())},$e=ae=>{if(D)switch(ae.key){case"Enter":ae.preventDefault();const je=te();je&&(c(je),W());return;case"Escape":ae.preventDefault(),W(),T&&Y();return;case"ArrowUp":ae.preventDefault(),U();return;case"ArrowDown":ae.preventDefault(),K();return}if(ae.key==="ArrowUp"&&s.trim()===""&&!D){ae.preventDefault(),O();return}ae.key==="Enter"&&!ae.shiftKey&&(ae.preventDefault(),Re(ae))},we=P.useCallback(async ae=>{const je=ae.target.files;if(!(!je||je.length===0)){g(null);for(const ke of Array.from(je))try{if(!Wd(ke)){g(`Unsupported file type: ${ke.type}. Only PNG, JPG, and GIF are supported.`);continue}const Pe=Gd(ke,50*1024*1024);if(!Pe.valid){g(Pe.error??"Image file is too large");continue}const Fe=await qd(ke,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),ft={id:Sl(),filename:ke.name,mimeType:Fe.mimeType,size:Fe.size,data:Fe.dataUrl};p(qe=>[...qe,ft])}catch(Pe){const Fe=Pe instanceof Error?Pe.message??"Failed to process image":"Failed to process image";g(Fe)}y.current&&(y.current.value="")}},[]),lt=P.useCallback(ae=>{ae.preventDefault(),ae.stopPropagation(),h(!0)},[]),ht=P.useCallback(ae=>{ae.preventDefault(),ae.stopPropagation(),h(!1)},[]),pe=P.useCallback(async ae=>{ae.preventDefault(),ae.stopPropagation(),h(!1),g(null);const je=ae.dataTransfer.files;if(!(!je||je.length===0))for(const ke of Array.from(je))try{if(!Wd(ke)){g(`Unsupported file type: ${ke.type}. Only PNG, JPG, and GIF are supported.`);continue}const Pe=Gd(ke,50*1024*1024);if(!Pe.valid){g(Pe.error??"Image file is too large");continue}const Fe=await qd(ke,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),ft={id:Sl(),filename:ke.name,mimeType:Fe.mimeType,size:Fe.size,data:Fe.dataUrl};p(qe=>[...qe,ft])}catch(Pe){const Fe=Pe instanceof Error?Pe.message??"Failed to process image":"Failed to process image";g(Fe)}},[]),Me=P.useCallback(ae=>{p(je=>je.filter(ke=>ke.id!==ae))},[]),nt=P.useCallback(()=>{var ae;(ae=y.current)==null||ae.click()},[]),Ke=(x==null?void 0:x.mode)==="planner",Ye=(x==null?void 0:x.mode)==="builder",ct=((x==null?void 0:x.criteria.length)??0)>0,de=(x==null?void 0:x.phase)==="done",be=H.some(ae=>ae.type==="message"&&ae.message.role==="assistant"),Te=Ke&&ct&&!T&&be&&!de,He=ae=>{const je=s.trim()?s:void 0,ke=u.length>0?u:void 0;Ke?V(ae,je,ke):Ye&&$(je,ke,ae),De()};return o.jsxs(Aw,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:r,messages:Q,children:[L&&o.jsx(Y3,{question:L}),o.jsx(Lw,{}),o.jsx(K3,{}),o.jsxs("div",{ref:C,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto relative",children:[o.jsx("div",{className:"pt-4",children:H.map((ae,je)=>{if(ae.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"})]},je);if(ae.type==="subagent"){const Pe=ae.messages.some(Fe=>Fe.isStreaming);return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx($3,{messages:ae.messages,subAgentType:ae.subAgentType,subAgentId:ae.subAgentId,isStreaming:Pe})},je)}if(ae.type==="criteria-batch")return o.jsx("div",{className:"feed-item px-2 md:px-4",children:o.jsx(I0,{toolCalls:ae.toolCalls,criteria:x==null?void 0:x.criteria})},je);const ke=ae.message;return ke.role==="assistant"?o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(Xh,{message:ke,showStats:!0})},je):o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(B0,{message:ke,isLastAssistantMessage:!1,promptContext:ke.role==="user"?se[ke.id]:void 0})},je)})}),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:z,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"})})})]})}),Te&&o.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:q.map(ae=>{const je=ae.color??"#3b82f6",ke=parseInt(je.slice(1,3),16),Pe=parseInt(je.slice(3,5),16),Fe=parseInt(je.slice(5,7),16),ft=`rgba(${ke},${Pe},${Fe},0.12)`,qe=`rgba(${ke},${Pe},${Fe},0.22)`,qt=`rgba(${ke},${Pe},${Fe},0.25)`;return o.jsxs("button",{onClick:()=>V(ae.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:ft,color:je,border:`1px solid ${qt}`},onMouseEnter:he=>{he.currentTarget.style.backgroundColor=qe},onMouseLeave:he=>{he.currentTarget.style.backgroundColor=ft},children:["▶ ",ae.name]},ae.id)})}),T&&o.jsx(X3,{})]})]}),o.jsxs("form",{onSubmit:Re,className:"relative p-2 md:p-4 border-t border-border bg-gradient-to-t from-bg-secondary/50 to-transparent",children:[o.jsxs("button",{type:"button",className:"absolute -top-8 right-2 md:right-4 text-sm text-text-muted hover:text-text-primary z-10 flex items-center gap-1.5",onClick:()=>ve(!ge),children:[o.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${ge?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsx("input",{ref:y,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:we,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}),u.length>0&&o.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:u.map(ae=>o.jsx(Z3,{attachment:ae,onRemove:Me},ae.id))}),D&&o.jsx(Q3,{history:J,selectedIndex:R,onSelect:ae=>{c(ae),W()},onEscape:W,onNavigate:ae=>{ae==="up"?U():K()}}),B.length>0&&o.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:B.map(ae=>o.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${ae.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:[ae.mode==="asap"?"ASAP":"Queue",":"]}),o.jsx("span",{className:"truncate max-w-[200px]",children:ae.content}),o.jsx("button",{type:"button",onClick:()=>F(ae.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"})})})]},ae.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:lt,onDragLeave:ht,onDrop:pe,children:[o.jsx("button",{type:"button",onClick:nt,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:b,value:s,onChange:ae=>{c(ae.target.value),D&&W()},onKeyDown:$e,placeholder:Ke?"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(h4,{onSendCommand:(ae,je,ke,Pe)=>{var ft;je&&(x==null?void 0:x.mode)!==je&&Ce.getState().switchMode(je);const Fe=ke&&ke.trim()?`${ke.trim()}
|
|
149
|
-
|
|
150
|
-
${ae}`:ae;(ft=C.current)==null||ft.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),I(Fe,Pe!=null&&Pe.length?Pe:void 0,{messageKind:"command",isSystemGenerated:!0}),De()},onOpenManager:()=>v(!0),textareaContent:s,attachments:u.length>0?u:void 0}),o.jsx(_4,{onSelectWorkflow:He,onOpenManager:()=>E(!0),criteria:(x==null?void 0:x.criteria)??[]})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("button",{type:"button",onClick:()=>{var ae;!s.trim()&&u.length===0||((ae=C.current)==null||ae.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),I(s,u),De())},disabled:!s.trim()&&u.length===0,className:"px-4 py-1.5 rounded bg-accent-primary/20 text-sm text-accent-primary font-medium hover:bg-accent-primary/30 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"Send"})})]})]}),o.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(G3,{}),o.jsx(V3,{})]}),o.jsx(u4,{})]})]}),o.jsx(P0,{isOpen:m,onClose:()=>v(!1)}),o.jsx($0,{isOpen:S,onClose:()=>E(!1)})]})}P.memo(function({item:r}){const[i,s]=P.useState(!1);return r.type==="start"?o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-500/10 border border-amber-500/30 rounded text-amber-300 text-sm",children:[o.jsx("span",{className:"animate-pulse",children:"●"}),o.jsx("span",{children:"Delegating image to fallback vision model..."}),r.filename&&o.jsxs("span",{className:"text-amber-400/70",children:["(",r.filename,")"]})]}):o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[o.jsx("span",{className:"text-accent-success",children:"✓"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),o.jsx("button",{type:"button",onClick:()=>s(!i),className:"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:i?"Hide":"Show"})]}),i&&r.description&&o.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(Mi,{content:r.description})})]})]})});function Gv({isOpen:e,isRetry:r,onSubmit:i,onCancel:s}){const[c,u]=P.useState(""),p=P.useRef(null);P.useEffect(()=>{e&&(u(""),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(dn,{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(Pl,{ref:p,type:"password",value:c,onChange:h=>u(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 L4=[8e3,11434,8080],R4=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function Vv(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return"Unknown";default:return e}}function q0({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 M4(){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 O4(){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 I4({currentStep:e,totalSteps:r,labels:i,onStepClick:s}){return o.jsx("div",{className:"flex justify-center py-6",children:o.jsx("div",{className:"flex items-center",children:Array.from({length:r},(c,u)=>{const p=u+1,l=p<e,h=p===e;return o.jsxs("div",{className:"flex items-center",children:[o.jsx("button",{onClick:()=>s==null?void 0:s(p),className:`size-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors shrink-0 ${l?"bg-accent-primary text-white hover:opacity-80":h?"bg-accent-primary text-white":"bg-bg-tertiary text-text-muted"}`,children:l?"✓":p}),o.jsx("button",{onClick:()=>s==null?void 0:s(p),className:`ml-2 mr-4 text-sm whitespace-nowrap hidden sm:block ${h?"text-text-primary font-medium":"text-text-muted hover:text-text-secondary"}`,children:i[u]}),u<r-1&&o.jsx("div",{className:`w-12 sm:w-20 h-0.5 mr-4 ${l?"bg-accent-primary":"bg-border"}`})]},u)})})})}function B4({onNext:e}){const[r,i]=P.useState([]),[s,c]=P.useState([]),[u,p]=P.useState(!1),[l,h]=P.useState(""),[f,g]=P.useState(""),[m,v]=P.useState(""),[S,E]=P.useState("auto"),[C,b]=P.useState(!1),[y,x]=P.useState(null),[_,j]=P.useState(null),[A,N]=P.useState(null),[L,T]=P.useState("");P.useEffect(()=>{I()},[]);async function I(){try{const B=await ye("/api/providers");if(B.ok){const X=(await B.json()).providers.map(J=>({id:J.id,name:J.name,url:J.url,backend:J.backend,model:null,apiKey:J.apiKey}));i(X),c(X)}}catch{}}async function z(B){b(!0),x(null);const q=S!=="auto";try{const J=await(await ye("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:B,skipBackendDetection:q})})).json();J.success?(q||E(J.backend??"auto"),x({success:!0,model:J.model??void 0})):x({success:!1,error:J.error??"Connection failed"})}catch(X){x({success:!1,error:X instanceof Error?X.message:"Connection failed"})}b(!1)}function V(){if(!f)return;const B=l||`Provider ${s.length+1}`,q={id:`temp-${Date.now()}`,name:B,url:f,backend:y!=null&&y.success?S:"auto",model:y!=null&&y.success?y.model??null:null,apiKey:m||void 0};c([...s,q]),h(""),g(""),v(""),x(null)}function Y(B){j(B),r.some(X=>X.id===B)?ye(`/api/providers/${B}`,{method:"DELETE"}).then(()=>{c(s.filter(X=>X.id!==B)),i(r.filter(X=>X.id!==B)),j(null)}).catch(()=>{j(null)}):(c(s.filter(X=>X.id!==B)),j(null))}async function $(){for(const q of s)(q.id.startsWith("temp-")||!r.some(X=>X.id===q.id))&&((await ye("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:q.name,url:q.url,backend:q.backend,model:q.model,apiKey:q.apiKey})})).ok||console.error("Failed to add provider",q));const B=s.filter(q=>!q.id.startsWith("temp-"));e({providers:B})}const F=s.length>0;return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"LLM Providers"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Manage your LLM server connections"}),o.jsxs("div",{className:"space-y-4",children:[s.length>0?o.jsx("div",{className:"space-y-2",children:s.map(B=>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:Vv(B.backend)}),A===B.id?o.jsx("input",{type:"text",value:L,onChange:q=>T(q.target.value),onKeyDown:q=>{q.key==="Enter"&&(c(s.map(X=>X.id===B.id?{...X,name:L}:X)),N(null)),q.key==="Escape"&&N(null)},onBlur:()=>{c(s.map(q=>q.id===B.id?{...q,name:L}:q)),N(null)},className:"px-2 py-0.5 bg-bg-primary border border-accent-primary rounded text-text-primary text-sm focus:outline-none",autoFocus:!0}):o.jsx("span",{className:"text-text-primary font-medium cursor-pointer hover:text-accent-primary",onClick:()=>{N(B.id),T(B.name)},title:"Click to edit",children:B.name})]}),o.jsx("p",{className:"text-text-muted text-sm mt-1",children:B.url}),B.model&&o.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",B.model]})]}),o.jsx("button",{onClick:()=>Y(B.id),disabled:_===B.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:o.jsx(O4,{})})]},B.id))}):o.jsx("div",{className:"bg-bg-secondary rounded-lg p-8 text-center border border-border",children:o.jsx("p",{className:"text-text-muted",children:"No providers configured yet"})}),u?o.jsxs("form",{onSubmit:B=>{B.preventDefault(),f&&V()},className:"space-y-4 p-4 bg-bg-tertiary rounded-lg",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Service Presets"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:R4.map(B=>o.jsx("button",{type:"button",onClick:()=>{h(B.name),g(B.url),E(B.backend),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===B.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:B.name},B.name))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Local Presets"}),o.jsx("div",{className:"grid grid-cols-3 gap-2",children:L4.map(B=>o.jsxs("button",{type:"button",onClick:()=>{h(""),g(`http://localhost:${B}`),E("auto"),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===`http://localhost:${B}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",B]},B))})]}),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:B=>{g(B.target.value),x(null)},onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),z(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:B=>h(B.target.value),onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),V())},placeholder:"My LLM Server",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"API key (optional)"}),o.jsx("input",{type:"password",name:"apiKey",value:m,onChange:B=>v(B.target.value),placeholder:"sk-...",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),y&&o.jsx("div",{className:`p-3 rounded-lg ${y.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:y.success?o.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",Vv(S),y.model&&` (${y.model})`]}):o.jsx("p",{className:"text-red-500",children:y.error})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{type:"button",onClick:()=>z(f),disabled:!f||C,className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted disabled:opacity-50",children:C?o.jsx(q0,{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:y!=null&&y.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(M4,{}),"Add Provider"]}),o.jsx("button",{onClick:$,disabled:!F,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 z4({onNext:e}){const[r,i]=P.useState(""),[s,c]=P.useState(!1);return P.useEffect(()=>{ye("/api/config").then(u=>u.json()).then(u=>{u.workdir?i(u.workdir):fetch("/api/directories?path="+encodeURIComponent("/home")).then(p=>p.json()).then(p=>{p.current&&i(p.current)}).catch(()=>{})}).catch(()=>{fetch("/api/directories?path="+encodeURIComponent("/home")).then(u=>u.json()).then(u=>{u.current&&i(u.current)}).catch(()=>{})})},[]),o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Your Projects Folder"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Where should OpenFox create project folders?"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Workspace directory"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",value:r,onChange:u=>i(u.target.value),placeholder:"/home/user/projects",className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"}),o.jsx("button",{onClick:()=>c(!0),className:"px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted",children:"Browse"})]})]}),s&&o.jsx(fb,{initialPath:r||void 0,onSelect:u=>{i(u),c(!1)},onClose:()=>c(!1)}),o.jsx("button",{onClick:()=>e({workdir:r}),disabled:!r,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function H4({onNext:e}){const[r,i]=P.useState(!1),[s,c]=P.useState("http://localhost:11434"),[u,p]=P.useState("qwen3-vl:2b"),{copied:l,copy:h}=L0();P.useEffect(()=>{ye("/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:u,timeout:120}})}return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Vision (Optional)"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Configure a vision model for non-vision models"}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsx("p",{className:"text-text-secondary text-sm mb-2",children:"To enable vision support, you need an Ollama server with a vision model:"}),o.jsx("a",{href:"https://ollama.com/download",target:"_blank",rel:"noopener noreferrer",className:"text-accent-primary hover:underline text-sm",children:"Download Ollama"}),o.jsxs("div",{className:"mt-3 p-2 bg-bg-primary rounded border border-border flex items-center justify-between gap-2",children:[o.jsx("code",{className:"text-text-secondary text-xs",children:"ollama pull qwen3-vl:2b"}),o.jsx("button",{onClick:()=>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:u,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 P4({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 F4({onComplete:e}){const[r,i]=P.useState(1),[s,c]=P.useState(!1),[u,p]=P.useState({});async function l(m){p(v=>({...v,providers:m.providers})),i(2)}async function h(m){p(v=>({...v,...m})),i(3)}async function f(m){c(!0);try{if(!(await ye("/api/init/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:u.workdir,visionFallback:m.visionFallback})})).ok)throw new Error("Failed to save config");e()}catch(v){console.error("Failed to save onboarding data:",v),c(!1)}}const g=m=>{i(m)};return o.jsxs("div",{className:"w-full max-w-xl mx-auto px-6 py-16 relative",children:[o.jsx(P4,{onClick:e}),o.jsx(I4,{currentStep:r,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"],onStepClick:g}),o.jsx("div",{className:"max-w-xl mx-auto",children:s?o.jsxs("div",{className:"text-center",children:[o.jsx(q0,{size:"md"}),o.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):o.jsxs(o.Fragment,{children:[r===1&&o.jsx(B4,{onNext:l}),r===2&&o.jsx(z4,{onNext:h}),r===3&&o.jsx(H4,{onNext:f})]})})]})}function Jh(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function W0(){return o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Fl,{})})}function U4({sidebarOpen:e,onSidebarToggle:r}){const[,i]=mh("/p/:projectId"),s=i==null?void 0:i.projectId,c=Ce(m=>m.connectionStatus),u=Ce(m=>m.listSessions),p=Ce(m=>m.clearSession),l=Ut(m=>m.currentProject),h=Ut(m=>m.loadProject),f=Jh(),g=c==="connected"||f;return P.useEffect(()=>{g&&s&&((l==null?void 0:l.id)!==s&&h(s),u(s),p())},[g,s,l==null?void 0:l.id,h,u,p]),!l||l.id!==s?o.jsx(W0,{}):o.jsxs(o.Fragment,{children:[o.jsx(hb,{projectId:s,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(KS,{})})]})}function $4({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:i,onRightSidebarToggle:s}){const[,c]=mh("/p/:projectId/s/:sessionId"),u=c==null?void 0:c.projectId,p=c==null?void 0:c.sessionId,[,l]=ar(),h=Ce(_=>_.connectionStatus),f=Ce(_=>_.currentSession),g=Ce(_=>_.loadSession),m=Ce(_=>_.listSessions),v=Ce(_=>_.pendingSessionCreate),S=Ce(_=>_.error),E=Ce(_=>_.clearError),C=Ut(_=>_.currentProject),b=Ut(_=>_.loadProject),y=Jh(),x=h==="connected"||y;return P.useEffect(()=>{x&&u&&(C==null?void 0:C.id)!==u&&b(u)},[x,u,C==null?void 0:C.id,b]),P.useEffect(()=>{x&&p&&(f==null?void 0:f.id)!==p&&!v&&g(p),x&&u&&m(u)},[x,p,f==null?void 0:f.id,g,m,v,u]),P.useEffect(()=>{(S==null?void 0:S.code)==="NOT_FOUND"&&u&&(E(),l(`/p/${u}`))},[S,u,E,l]),!C||C.id!==u?o.jsx(W0,{}):o.jsxs(o.Fragment,{children:[o.jsx(hb,{projectId:u,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(D4,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:s})})]})}function q4(){const e=jt(i=>i.fetchConfig);function r(){e(),window.history.back()}return o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx(F4,{onComplete:r})})}function W4(){const{connectionStatus:e}=pS(),r=jt($=>$.fetchConfig),i=jt($=>$.refreshProviderModels),s=jt($=>$.providers),c=jt($=>$.activeProviderId),[,u]=ar(),p=Jh(),[l,h]=P.useState(!1);P.useEffect(()=>{(e==="connected"||p)&&r().then(()=>{h(!0)})},[e,p,r]),P.useEffect(()=>{l&&c&&i(c).then(()=>{r()})},[l,c,i,r]),P.useEffect(()=>{l&&s.length===0&&u("/onboarding")},[l,s.length]);const f=()=>{const $=localStorage.getItem("openfox:leftSidebar");return $!==null?$==="true":!1},g=()=>{const $=localStorage.getItem("openfox:rightSidebar");return $!==null?$==="true":!0},[m,v]=P.useState(f),[S,E]=P.useState(g),[C,b]=P.useState(!1),[y,x]=P.useState(!1),[_,j]=P.useState(!1);P.useEffect(()=>{const $=()=>{j(window.innerWidth<768)};return $(),window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)},[]);const A=_?C:m,N=_?y:S,L=()=>{_?b(!C):v(!m)},T=()=>{_?x(!y):E(!S)};P.useEffect(()=>{_||localStorage.setItem("openfox:leftSidebar",String(m))},[m,_]),P.useEffect(()=>{_||localStorage.setItem("openfox:rightSidebar",String(S))},[S,_]),P.useEffect(()=>{(e==="connected"||p)&&r()},[e,r,p]);const I=Ce($=>$.showPasswordModal),z=Ce($=>$.passwordModalRetry),V=Ce($=>$.submitPassword),Y=Ce($=>$.cancelPassword);return e!=="connected"&&!I&&!p?o.jsxs(o.Fragment,{children:[o.jsx(Gv,{isOpen:!0,isRetry:z,onSubmit:V,onCancel:Y}),o.jsx("div",{className:"h-screen flex items-center justify-center",children:o.jsx(WS,{text:"Connecting to server..."})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Gv,{isOpen:I,isRetry:z,onSubmit:V,onCancel:Y}),o.jsxs("div",{className:"h-screen flex flex-col",children:[o.jsx(PS,{}),o.jsx(IS,{onMenuClick:L,onCriteriaToggle:T}),o.jsx("div",{className:"flex-1 flex overflow-hidden",children:o.jsxs(H1,{children:[o.jsx(Ea,{path:"/onboarding",children:o.jsx(q4,{})}),o.jsx(Ea,{path:"/p/:projectId/s/:sessionId",children:o.jsx($4,{sidebarOpen:A,onSidebarToggle:L,rightSidebarOpen:N,onRightSidebarToggle:T})}),o.jsx(Ea,{path:"/p/:projectId/new",children:o.jsx(YS,{})}),o.jsx(Ea,{path:"/p/:projectId",children:o.jsx(U4,{sidebarOpen:A,onSidebarToggle:L})}),o.jsx(Ea,{path:"/",children:o.jsx(VS,{})})]})})]})]})}x1.createRoot(document.getElementById("root")).render(o.jsx(cn.StrictMode,{children:o.jsx(W4,{})}));
|