@qodalis/cli-server-plugin-admin 1.0.0-beta.5 → 1.0.0-beta.6

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.
@@ -1,199 +0,0 @@
1
- function _mergeNamespaces(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const o in n)if(o!=="default"&&!(o in t)){const u=Object.getOwnPropertyDescriptor(n,o);u&&Object.defineProperty(t,o,u.get?u:{enumerable:!0,get:()=>n[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&n(h)}).observe(document,{childList:!0,subtree:!0});function r(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function n(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();function getDefaultExportFromCjs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its 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 hasRequiredReact_production_min;function requireReact_production_min(){if(hasRequiredReact_production_min)return react_production_min;hasRequiredReact_production_min=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),h=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),d=Symbol.iterator;function P(Z){return Z===null||typeof Z!="object"?null:(Z=d&&Z[d]||Z["@@iterator"],typeof Z=="function"?Z:null)}var H={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},W=Object.assign,U={};function L(Z,ie,ge){this.props=Z,this.context=ie,this.refs=U,this.updater=ge||H}L.prototype.isReactComponent={},L.prototype.setState=function(Z,ie){if(typeof Z!="object"&&typeof Z!="function"&&Z!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,Z,ie,"setState")},L.prototype.forceUpdate=function(Z){this.updater.enqueueForceUpdate(this,Z,"forceUpdate")};function N(){}N.prototype=L.prototype;function x(Z,ie,ge){this.props=Z,this.context=ie,this.refs=U,this.updater=ge||H}var j=x.prototype=new N;j.constructor=x,W(j,L.prototype),j.isPureReactComponent=!0;var V=Array.isArray,Y=Object.prototype.hasOwnProperty,J={current:null},X={key:!0,ref:!0,__self:!0,__source:!0};function G(Z,ie,ge){var fe,xe={},ke=null,ue=null;if(ie!=null)for(fe in ie.ref!==void 0&&(ue=ie.ref),ie.key!==void 0&&(ke=""+ie.key),ie)Y.call(ie,fe)&&!X.hasOwnProperty(fe)&&(xe[fe]=ie[fe]);var se=arguments.length-2;if(se===1)xe.children=ge;else if(1<se){for(var Ee=Array(se),Se=0;Se<se;Se++)Ee[Se]=arguments[Se+2];xe.children=Ee}if(Z&&Z.defaultProps)for(fe in se=Z.defaultProps,se)xe[fe]===void 0&&(xe[fe]=se[fe]);return{$$typeof:t,type:Z,key:ke,ref:ue,props:xe,_owner:J.current}}function ee(Z,ie){return{$$typeof:t,type:Z.type,key:ie,ref:Z.ref,props:Z.props,_owner:Z._owner}}function ne(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===t}function ae(Z){var ie={"=":"=0",":":"=2"};return"$"+Z.replace(/[=:]/g,function(ge){return ie[ge]})}var ce=/\/+/g;function oe(Z,ie){return typeof Z=="object"&&Z!==null&&Z.key!=null?ae(""+Z.key):ie.toString(36)}function we(Z,ie,ge,fe,xe){var ke=typeof Z;(ke==="undefined"||ke==="boolean")&&(Z=null);var ue=!1;if(Z===null)ue=!0;else switch(ke){case"string":case"number":ue=!0;break;case"object":switch(Z.$$typeof){case t:case e:ue=!0}}if(ue)return ue=Z,xe=xe(ue),Z=fe===""?"."+oe(ue,0):fe,V(xe)?(ge="",Z!=null&&(ge=Z.replace(ce,"$&/")+"/"),we(xe,ie,ge,"",function(Se){return Se})):xe!=null&&(ne(xe)&&(xe=ee(xe,ge+(!xe.key||ue&&ue.key===xe.key?"":(""+xe.key).replace(ce,"$&/")+"/")+Z)),ie.push(xe)),1;if(ue=0,fe=fe===""?".":fe+":",V(Z))for(var se=0;se<Z.length;se++){ke=Z[se];var Ee=fe+oe(ke,se);ue+=we(ke,ie,ge,Ee,xe)}else if(Ee=P(Z),typeof Ee=="function")for(Z=Ee.call(Z),se=0;!(ke=Z.next()).done;)ke=ke.value,Ee=fe+oe(ke,se++),ue+=we(ke,ie,ge,Ee,xe);else if(ke==="object")throw ie=String(Z),Error("Objects are not valid as a React child (found: "+(ie==="[object Object]"?"object with keys {"+Object.keys(Z).join(", ")+"}":ie)+"). If you meant to render a collection of children, use an array instead.");return ue}function be(Z,ie,ge){if(Z==null)return Z;var fe=[],xe=0;return we(Z,fe,"","",function(ke){return ie.call(ge,ke,xe++)}),fe}function ve(Z){if(Z._status===-1){var ie=Z._result;ie=ie(),ie.then(function(ge){(Z._status===0||Z._status===-1)&&(Z._status=1,Z._result=ge)},function(ge){(Z._status===0||Z._status===-1)&&(Z._status=2,Z._result=ge)}),Z._status===-1&&(Z._status=0,Z._result=ie)}if(Z._status===1)return Z._result.default;throw Z._result}var me={current:null},de={transition:null},Q={ReactCurrentDispatcher:me,ReactCurrentBatchConfig:de,ReactCurrentOwner:J};function re(){throw Error("act(...) is not supported in production builds of React.")}return react_production_min.Children={map:be,forEach:function(Z,ie,ge){be(Z,function(){ie.apply(this,arguments)},ge)},count:function(Z){var ie=0;return be(Z,function(){ie++}),ie},toArray:function(Z){return be(Z,function(ie){return ie})||[]},only:function(Z){if(!ne(Z))throw Error("React.Children.only expected to receive a single React element child.");return Z}},react_production_min.Component=L,react_production_min.Fragment=r,react_production_min.Profiler=o,react_production_min.PureComponent=x,react_production_min.StrictMode=n,react_production_min.Suspense=l,react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q,react_production_min.act=re,react_production_min.cloneElement=function(Z,ie,ge){if(Z==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+Z+".");var fe=W({},Z.props),xe=Z.key,ke=Z.ref,ue=Z._owner;if(ie!=null){if(ie.ref!==void 0&&(ke=ie.ref,ue=J.current),ie.key!==void 0&&(xe=""+ie.key),Z.type&&Z.type.defaultProps)var se=Z.type.defaultProps;for(Ee in ie)Y.call(ie,Ee)&&!X.hasOwnProperty(Ee)&&(fe[Ee]=ie[Ee]===void 0&&se!==void 0?se[Ee]:ie[Ee])}var Ee=arguments.length-2;if(Ee===1)fe.children=ge;else if(1<Ee){se=Array(Ee);for(var Se=0;Se<Ee;Se++)se[Se]=arguments[Se+2];fe.children=se}return{$$typeof:t,type:Z.type,key:xe,ref:ke,props:fe,_owner:ue}},react_production_min.createContext=function(Z){return Z={$$typeof:h,_currentValue:Z,_currentValue2:Z,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},Z.Provider={$$typeof:u,_context:Z},Z.Consumer=Z},react_production_min.createElement=G,react_production_min.createFactory=function(Z){var ie=G.bind(null,Z);return ie.type=Z,ie},react_production_min.createRef=function(){return{current:null}},react_production_min.forwardRef=function(Z){return{$$typeof:a,render:Z}},react_production_min.isValidElement=ne,react_production_min.lazy=function(Z){return{$$typeof:C,_payload:{_status:-1,_result:Z},_init:ve}},react_production_min.memo=function(Z,ie){return{$$typeof:f,type:Z,compare:ie===void 0?null:ie}},react_production_min.startTransition=function(Z){var ie=de.transition;de.transition={};try{Z()}finally{de.transition=ie}},react_production_min.unstable_act=re,react_production_min.useCallback=function(Z,ie){return me.current.useCallback(Z,ie)},react_production_min.useContext=function(Z){return me.current.useContext(Z)},react_production_min.useDebugValue=function(){},react_production_min.useDeferredValue=function(Z){return me.current.useDeferredValue(Z)},react_production_min.useEffect=function(Z,ie){return me.current.useEffect(Z,ie)},react_production_min.useId=function(){return me.current.useId()},react_production_min.useImperativeHandle=function(Z,ie,ge){return me.current.useImperativeHandle(Z,ie,ge)},react_production_min.useInsertionEffect=function(Z,ie){return me.current.useInsertionEffect(Z,ie)},react_production_min.useLayoutEffect=function(Z,ie){return me.current.useLayoutEffect(Z,ie)},react_production_min.useMemo=function(Z,ie){return me.current.useMemo(Z,ie)},react_production_min.useReducer=function(Z,ie,ge){return me.current.useReducer(Z,ie,ge)},react_production_min.useRef=function(Z){return me.current.useRef(Z)},react_production_min.useState=function(Z){return me.current.useState(Z)},react_production_min.useSyncExternalStore=function(Z,ie,ge){return me.current.useSyncExternalStore(Z,ie,ge)},react_production_min.useTransition=function(){return me.current.useTransition()},react_production_min.version="18.3.1",react_production_min}var hasRequiredReact;function requireReact(){return hasRequiredReact||(hasRequiredReact=1,react.exports=requireReact_production_min()),react.exports}/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its 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 hasRequiredReactJsxRuntime_production_min;function requireReactJsxRuntime_production_min(){if(hasRequiredReactJsxRuntime_production_min)return reactJsxRuntime_production_min;hasRequiredReactJsxRuntime_production_min=1;var t=requireReact(),e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function h(a,l,f){var C,d={},P=null,H=null;f!==void 0&&(P=""+f),l.key!==void 0&&(P=""+l.key),l.ref!==void 0&&(H=l.ref);for(C in l)n.call(l,C)&&!u.hasOwnProperty(C)&&(d[C]=l[C]);if(a&&a.defaultProps)for(C in l=a.defaultProps,l)d[C]===void 0&&(d[C]=l[C]);return{$$typeof:e,type:a,key:P,ref:H,props:d,_owner:o.current}}return reactJsxRuntime_production_min.Fragment=r,reactJsxRuntime_production_min.jsx=h,reactJsxRuntime_production_min.jsxs=h,reactJsxRuntime_production_min}var hasRequiredJsxRuntime;function requireJsxRuntime(){return hasRequiredJsxRuntime||(hasRequiredJsxRuntime=1,jsxRuntime.exports=requireReactJsxRuntime_production_min()),jsxRuntime.exports}var jsxRuntimeExports=requireJsxRuntime(),reactExports=requireReact();const React3=getDefaultExportFromCjs(reactExports),React=_mergeNamespaces({__proto__:null,default:React3},[reactExports]);var client={},reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its 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 hasRequiredScheduler_production_min;function requireScheduler_production_min(){return hasRequiredScheduler_production_min||(hasRequiredScheduler_production_min=1,(function(t){function e(de,Q){var re=de.length;de.push(Q);e:for(;0<re;){var Z=re-1>>>1,ie=de[Z];if(0<o(ie,Q))de[Z]=Q,de[re]=ie,re=Z;else break e}}function r(de){return de.length===0?null:de[0]}function n(de){if(de.length===0)return null;var Q=de[0],re=de.pop();if(re!==Q){de[0]=re;e:for(var Z=0,ie=de.length,ge=ie>>>1;Z<ge;){var fe=2*(Z+1)-1,xe=de[fe],ke=fe+1,ue=de[ke];if(0>o(xe,re))ke<ie&&0>o(ue,xe)?(de[Z]=ue,de[ke]=re,Z=ke):(de[Z]=xe,de[fe]=re,Z=fe);else if(ke<ie&&0>o(ue,re))de[Z]=ue,de[ke]=re,Z=ke;else break e}}return Q}function o(de,Q){var re=de.sortIndex-Q.sortIndex;return re!==0?re:de.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var h=Date,a=h.now();t.unstable_now=function(){return h.now()-a}}var l=[],f=[],C=1,d=null,P=3,H=!1,W=!1,U=!1,L=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(de){for(var Q=r(f);Q!==null;){if(Q.callback===null)n(f);else if(Q.startTime<=de)n(f),Q.sortIndex=Q.expirationTime,e(l,Q);else break;Q=r(f)}}function V(de){if(U=!1,j(de),!W)if(r(l)!==null)W=!0,ve(Y);else{var Q=r(f);Q!==null&&me(V,Q.startTime-de)}}function Y(de,Q){W=!1,U&&(U=!1,N(G),G=-1),H=!0;var re=P;try{for(j(Q),d=r(l);d!==null&&(!(d.expirationTime>Q)||de&&!ae());){var Z=d.callback;if(typeof Z=="function"){d.callback=null,P=d.priorityLevel;var ie=Z(d.expirationTime<=Q);Q=t.unstable_now(),typeof ie=="function"?d.callback=ie:d===r(l)&&n(l),j(Q)}else n(l);d=r(l)}if(d!==null)var ge=!0;else{var fe=r(f);fe!==null&&me(V,fe.startTime-Q),ge=!1}return ge}finally{d=null,P=re,H=!1}}var J=!1,X=null,G=-1,ee=5,ne=-1;function ae(){return!(t.unstable_now()-ne<ee)}function ce(){if(X!==null){var de=t.unstable_now();ne=de;var Q=!0;try{Q=X(!0,de)}finally{Q?oe():(J=!1,X=null)}}else J=!1}var oe;if(typeof x=="function")oe=function(){x(ce)};else if(typeof MessageChannel<"u"){var we=new MessageChannel,be=we.port2;we.port1.onmessage=ce,oe=function(){be.postMessage(null)}}else oe=function(){L(ce,0)};function ve(de){X=de,J||(J=!0,oe())}function me(de,Q){G=L(function(){de(t.unstable_now())},Q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(de){de.callback=null},t.unstable_continueExecution=function(){W||H||(W=!0,ve(Y))},t.unstable_forceFrameRate=function(de){0>de||125<de?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ee=0<de?Math.floor(1e3/de):5},t.unstable_getCurrentPriorityLevel=function(){return P},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function(de){switch(P){case 1:case 2:case 3:var Q=3;break;default:Q=P}var re=P;P=Q;try{return de()}finally{P=re}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(de,Q){switch(de){case 1:case 2:case 3:case 4:case 5:break;default:de=3}var re=P;P=de;try{return Q()}finally{P=re}},t.unstable_scheduleCallback=function(de,Q,re){var Z=t.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?Z+re:Z):re=Z,de){case 1:var ie=-1;break;case 2:ie=250;break;case 5:ie=1073741823;break;case 4:ie=1e4;break;default:ie=5e3}return ie=re+ie,de={id:C++,callback:Q,priorityLevel:de,startTime:re,expirationTime:ie,sortIndex:-1},re>Z?(de.sortIndex=re,e(f,de),r(l)===null&&de===r(f)&&(U?(N(G),G=-1):U=!0,me(V,re-Z))):(de.sortIndex=ie,e(l,de),W||H||(W=!0,ve(Y))),de},t.unstable_shouldYield=ae,t.unstable_wrapCallback=function(de){var Q=P;return function(){var re=P;P=Q;try{return de.apply(this,arguments)}finally{P=re}}}})(scheduler_production_min)),scheduler_production_min}var hasRequiredScheduler;function requireScheduler(){return hasRequiredScheduler||(hasRequiredScheduler=1,scheduler.exports=requireScheduler_production_min()),scheduler.exports}/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its 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 hasRequiredReactDom_production_min;function requireReactDom_production_min(){if(hasRequiredReactDom_production_min)return reactDom_production_min;hasRequiredReactDom_production_min=1;var t=requireReact(),e=requireScheduler();function r(s){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+s,c=1;c<arguments.length;c++)i+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+s+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,o={};function u(s,i){h(s,i),h(s+"Capture",i)}function h(s,i){for(o[s]=i,s=0;s<i.length;s++)n.add(i[s])}var a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,f=/^[: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]*$/,C={},d={};function P(s){return l.call(d,s)?!0:l.call(C,s)?!1:f.test(s)?d[s]=!0:(C[s]=!0,!1)}function H(s,i,c,R){if(c!==null&&c.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return R?!1:c!==null?!c.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function W(s,i,c,R){if(i===null||typeof i>"u"||H(s,i,c,R))return!0;if(R)return!1;if(c!==null)switch(c.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function U(s,i,c,R,q,K,te){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=R,this.attributeNamespace=q,this.mustUseProperty=c,this.propertyName=s,this.type=i,this.sanitizeURL=K,this.removeEmptyString=te}var L={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){L[s]=new U(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var i=s[0];L[i]=new U(i,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){L[s]=new U(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){L[s]=new U(s,2,!1,s,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(s){L[s]=new U(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){L[s]=new U(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){L[s]=new U(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){L[s]=new U(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){L[s]=new U(s,5,!1,s.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function x(s){return s[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(s){var i=s.replace(N,x);L[i]=new U(i,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var i=s.replace(N,x);L[i]=new U(i,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var i=s.replace(N,x);L[i]=new U(i,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){L[s]=new U(s,1,!1,s.toLowerCase(),null,!1,!1)}),L.xlinkHref=new U("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){L[s]=new U(s,1,!1,s.toLowerCase(),null,!0,!0)});function j(s,i,c,R){var q=L.hasOwnProperty(i)?L[i]:null;(q!==null?q.type!==0:R||!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(W(i,c,q,R)&&(c=null),R||q===null?P(i)&&(c===null?s.removeAttribute(i):s.setAttribute(i,""+c)):q.mustUseProperty?s[q.propertyName]=c===null?q.type===3?!1:"":c:(i=q.attributeName,R=q.attributeNamespace,c===null?s.removeAttribute(i):(q=q.type,c=q===3||q===4&&c===!0?"":""+c,R?s.setAttributeNS(R,i,c):s.setAttribute(i,c))))}var V=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Y=Symbol.for("react.element"),J=Symbol.for("react.portal"),X=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),ee=Symbol.for("react.profiler"),ne=Symbol.for("react.provider"),ae=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),oe=Symbol.for("react.suspense"),we=Symbol.for("react.suspense_list"),be=Symbol.for("react.memo"),ve=Symbol.for("react.lazy"),me=Symbol.for("react.offscreen"),de=Symbol.iterator;function Q(s){return s===null||typeof s!="object"?null:(s=de&&s[de]||s["@@iterator"],typeof s=="function"?s:null)}var re=Object.assign,Z;function ie(s){if(Z===void 0)try{throw Error()}catch(c){var i=c.stack.trim().match(/\n( *(at )?)/);Z=i&&i[1]||""}return`
34
- `+Z+s}var ge=!1;function fe(s,i){if(!s||ge)return"";ge=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(i)if(i=function(){throw Error()},Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(ye){var R=ye}Reflect.construct(s,[],i)}else{try{i.call()}catch(ye){R=ye}s.call(i.prototype)}else{try{throw Error()}catch(ye){R=ye}s()}}catch(ye){if(ye&&R&&typeof ye.stack=="string"){for(var q=ye.stack.split(`
35
- `),K=R.stack.split(`
36
- `),te=q.length-1,le=K.length-1;1<=te&&0<=le&&q[te]!==K[le];)le--;for(;1<=te&&0<=le;te--,le--)if(q[te]!==K[le]){if(te!==1||le!==1)do if(te--,le--,0>le||q[te]!==K[le]){var he=`
37
- `+q[te].replace(" at new "," at ");return s.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",s.displayName)),he}while(1<=te&&0<=le);break}}}finally{ge=!1,Error.prepareStackTrace=c}return(s=s?s.displayName||s.name:"")?ie(s):""}function xe(s){switch(s.tag){case 5:return ie(s.type);case 16:return ie("Lazy");case 13:return ie("Suspense");case 19:return ie("SuspenseList");case 0:case 2:case 15:return s=fe(s.type,!1),s;case 11:return s=fe(s.type.render,!1),s;case 1:return s=fe(s.type,!0),s;default:return""}}function ke(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case X:return"Fragment";case J:return"Portal";case ee:return"Profiler";case G:return"StrictMode";case oe:return"Suspense";case we:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case ae:return(s.displayName||"Context")+".Consumer";case ne:return(s._context.displayName||"Context")+".Provider";case ce:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case be:return i=s.displayName||null,i!==null?i:ke(s.type)||"Memo";case ve:i=s._payload,s=s._init;try{return ke(s(i))}catch{}}return null}function ue(s){var i=s.type;switch(s.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=i.render,s=s.displayName||s.name||"",i.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ke(i);case 8:return i===G?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function se(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Ee(s){var i=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Se(s){var i=Ee(s)?"checked":"value",c=Object.getOwnPropertyDescriptor(s.constructor.prototype,i),R=""+s[i];if(!s.hasOwnProperty(i)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var q=c.get,K=c.set;return Object.defineProperty(s,i,{configurable:!0,get:function(){return q.call(this)},set:function(te){R=""+te,K.call(this,te)}}),Object.defineProperty(s,i,{enumerable:c.enumerable}),{getValue:function(){return R},setValue:function(te){R=""+te},stopTracking:function(){s._valueTracker=null,delete s[i]}}}}function $e(s){s._valueTracker||(s._valueTracker=Se(s))}function Te(s){if(!s)return!1;var i=s._valueTracker;if(!i)return!0;var c=i.getValue(),R="";return s&&(R=Ee(s)?s.checked?"true":"false":s.value),s=R,s!==c?(i.setValue(s),!0):!1}function Ue(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function Ve(s,i){var c=i.checked;return re({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??s._wrapperState.initialChecked})}function Ge(s,i){var c=i.defaultValue==null?"":i.defaultValue,R=i.checked!=null?i.checked:i.defaultChecked;c=se(i.value!=null?i.value:c),s._wrapperState={initialChecked:R,initialValue:c,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function ut(s,i){i=i.checked,i!=null&&j(s,"checked",i,!1)}function je(s,i){ut(s,i);var c=se(i.value),R=i.type;if(c!=null)R==="number"?(c===0&&s.value===""||s.value!=c)&&(s.value=""+c):s.value!==""+c&&(s.value=""+c);else if(R==="submit"||R==="reset"){s.removeAttribute("value");return}i.hasOwnProperty("value")?Tr(s,i.type,c):i.hasOwnProperty("defaultValue")&&Tr(s,i.type,se(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(s.defaultChecked=!!i.defaultChecked)}function cr(s,i,c){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var R=i.type;if(!(R!=="submit"&&R!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+s._wrapperState.initialValue,c||i===s.value||(s.value=i),s.defaultValue=i}c=s.name,c!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,c!==""&&(s.name=c)}function Tr(s,i,c){(i!=="number"||Ue(s.ownerDocument)!==s)&&(c==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+c&&(s.defaultValue=""+c))}var er=Array.isArray;function Kt(s,i,c,R){if(s=s.options,i){i={};for(var q=0;q<c.length;q++)i["$"+c[q]]=!0;for(c=0;c<s.length;c++)q=i.hasOwnProperty("$"+s[c].value),s[c].selected!==q&&(s[c].selected=q),q&&R&&(s[c].defaultSelected=!0)}else{for(c=""+se(c),i=null,q=0;q<s.length;q++){if(s[q].value===c){s[q].selected=!0,R&&(s[q].defaultSelected=!0);return}i!==null||s[q].disabled||(i=s[q])}i!==null&&(i.selected=!0)}}function ur(s,i){if(i.dangerouslySetInnerHTML!=null)throw Error(r(91));return re({},i,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function vt(s,i){var c=i.value;if(c==null){if(c=i.children,i=i.defaultValue,c!=null){if(i!=null)throw Error(r(92));if(er(c)){if(1<c.length)throw Error(r(93));c=c[0]}i=c}i==null&&(i=""),c=i}s._wrapperState={initialValue:se(c)}}function hr(s,i){var c=se(i.value),R=se(i.defaultValue);c!=null&&(c=""+c,c!==s.value&&(s.value=c),i.defaultValue==null&&s.defaultValue!==c&&(s.defaultValue=c)),R!=null&&(s.defaultValue=""+R)}function kt(s){var i=s.textContent;i===s._wrapperState.initialValue&&i!==""&&i!==null&&(s.value=i)}function dr(s){switch(s){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Dr(s,i){return s==null||s==="http://www.w3.org/1999/xhtml"?dr(i):s==="http://www.w3.org/2000/svg"&&i==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var Lt,Br=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(i,c,R,q){MSApp.execUnsafeLocalFunction(function(){return s(i,c,R,q)})}:s})(function(s,i){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=i;else{for(Lt=Lt||document.createElement("div"),Lt.innerHTML="<svg>"+i.valueOf().toString()+"</svg>",i=Lt.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;i.firstChild;)s.appendChild(i.firstChild)}});function yt(s,i){if(i){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=i;return}}s.textContent=i}var Nt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ye=["Webkit","ms","Moz","O"];Object.keys(Nt).forEach(function(s){Ye.forEach(function(i){i=i+s.charAt(0).toUpperCase()+s.substring(1),Nt[i]=Nt[s]})});function si(s,i,c){return i==null||typeof i=="boolean"||i===""?"":c||typeof i!="number"||i===0||Nt.hasOwnProperty(s)&&Nt[s]?(""+i).trim():i+"px"}function sa(s,i){s=s.style;for(var c in i)if(i.hasOwnProperty(c)){var R=c.indexOf("--")===0,q=si(c,i[c],R);c==="float"&&(c="cssFloat"),R?s.setProperty(c,q):s[c]=q}}var zc=re({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function fn(s,i){if(i){if(zc[s]&&(i.children!=null||i.dangerouslySetInnerHTML!=null))throw Error(r(137,s));if(i.dangerouslySetInnerHTML!=null){if(i.children!=null)throw Error(r(60));if(typeof i.dangerouslySetInnerHTML!="object"||!("__html"in i.dangerouslySetInnerHTML))throw Error(r(61))}if(i.style!=null&&typeof i.style!="object")throw Error(r(62))}}function pn(s,i){if(s.indexOf("-")===-1)return typeof i.is=="string";switch(s){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 mn=null;function gn(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var vn=null,Gr=null,Yr=null;function ia(s){if(s=Hs(s)){if(typeof vn!="function")throw Error(r(280));var i=s.stateNode;i&&(i=Ri(i),vn(s.stateNode,s.type,i))}}function na(s){Gr?Yr?Yr.push(s):Yr=[s]:Gr=s}function oa(){if(Gr){var s=Gr,i=Yr;if(Yr=Gr=null,ia(s),i)for(s=0;s<i.length;s++)ia(i[s])}}function aa(s,i){return s(i)}function la(){}var _n=!1;function ca(s,i,c){if(_n)return s(i,c);_n=!0;try{return aa(s,i,c)}finally{_n=!1,(Gr!==null||Yr!==null)&&(la(),oa())}}function Cs(s,i){var c=s.stateNode;if(c===null)return null;var R=Ri(c);if(R===null)return null;c=R[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(R=!R.disabled)||(s=s.type,R=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!R;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(r(231,i,typeof c));return c}var wn=!1;if(a)try{var ys={};Object.defineProperty(ys,"passive",{get:function(){wn=!0}}),window.addEventListener("test",ys,ys),window.removeEventListener("test",ys,ys)}catch{wn=!1}function qc(s,i,c,R,q,K,te,le,he){var ye=Array.prototype.slice.call(arguments,3);try{i.apply(c,ye)}catch(Le){this.onError(Le)}}var Ss=!1,ii=null,ni=!1,Cn=null,Vc={onError:function(s){Ss=!0,ii=s}};function Kc(s,i,c,R,q,K,te,le,he){Ss=!1,ii=null,qc.apply(Vc,arguments)}function Gc(s,i,c,R,q,K,te,le,he){if(Kc.apply(this,arguments),Ss){if(Ss){var ye=ii;Ss=!1,ii=null}else throw Error(r(198));ni||(ni=!0,Cn=ye)}}function Ar(s){var i=s,c=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,(i.flags&4098)!==0&&(c=i.return),s=i.return;while(s)}return i.tag===3?c:null}function ua(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function ha(s){if(Ar(s)!==s)throw Error(r(188))}function Yc(s){var i=s.alternate;if(!i){if(i=Ar(s),i===null)throw Error(r(188));return i!==s?null:s}for(var c=s,R=i;;){var q=c.return;if(q===null)break;var K=q.alternate;if(K===null){if(R=q.return,R!==null){c=R;continue}break}if(q.child===K.child){for(K=q.child;K;){if(K===c)return ha(q),s;if(K===R)return ha(q),i;K=K.sibling}throw Error(r(188))}if(c.return!==R.return)c=q,R=K;else{for(var te=!1,le=q.child;le;){if(le===c){te=!0,c=q,R=K;break}if(le===R){te=!0,R=q,c=K;break}le=le.sibling}if(!te){for(le=K.child;le;){if(le===c){te=!0,c=K,R=q;break}if(le===R){te=!0,R=K,c=q;break}le=le.sibling}if(!te)throw Error(r(189))}}if(c.alternate!==R)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?s:i}function da(s){return s=Yc(s),s!==null?fa(s):null}function fa(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var i=fa(s);if(i!==null)return i;s=s.sibling}return null}var pa=e.unstable_scheduleCallback,ma=e.unstable_cancelCallback,Jc=e.unstable_shouldYield,Xc=e.unstable_requestPaint,rt=e.unstable_now,Qc=e.unstable_getCurrentPriorityLevel,yn=e.unstable_ImmediatePriority,ga=e.unstable_UserBlockingPriority,oi=e.unstable_NormalPriority,Zc=e.unstable_LowPriority,va=e.unstable_IdlePriority,ai=null,Gt=null;function eu(s){if(Gt&&typeof Gt.onCommitFiberRoot=="function")try{Gt.onCommitFiberRoot(ai,s,void 0,(s.current.flags&128)===128)}catch{}}var jt=Math.clz32?Math.clz32:su,tu=Math.log,ru=Math.LN2;function su(s){return s>>>=0,s===0?32:31-(tu(s)/ru|0)|0}var li=64,ci=4194304;function xs(s){switch(s&-s){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: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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function ui(s,i){var c=s.pendingLanes;if(c===0)return 0;var R=0,q=s.suspendedLanes,K=s.pingedLanes,te=c&268435455;if(te!==0){var le=te&~q;le!==0?R=xs(le):(K&=te,K!==0&&(R=xs(K)))}else te=c&~q,te!==0?R=xs(te):K!==0&&(R=xs(K));if(R===0)return 0;if(i!==0&&i!==R&&(i&q)===0&&(q=R&-R,K=i&-i,q>=K||q===16&&(K&4194240)!==0))return i;if((R&4)!==0&&(R|=c&16),i=s.entangledLanes,i!==0)for(s=s.entanglements,i&=R;0<i;)c=31-jt(i),q=1<<c,R|=s[c],i&=~q;return R}function iu(s,i){switch(s){case 1:case 2:case 4:return i+250;case 8:case 16:case 32:case 64: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 i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function nu(s,i){for(var c=s.suspendedLanes,R=s.pingedLanes,q=s.expirationTimes,K=s.pendingLanes;0<K;){var te=31-jt(K),le=1<<te,he=q[te];he===-1?((le&c)===0||(le&R)!==0)&&(q[te]=iu(le,i)):he<=i&&(s.expiredLanes|=le),K&=~le}}function Sn(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function _a(){var s=li;return li<<=1,(li&4194240)===0&&(li=64),s}function xn(s){for(var i=[],c=0;31>c;c++)i.push(s);return i}function bs(s,i,c){s.pendingLanes|=i,i!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,i=31-jt(i),s[i]=c}function ou(s,i){var c=s.pendingLanes&~i;s.pendingLanes=i,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=i,s.mutableReadLanes&=i,s.entangledLanes&=i,i=s.entanglements;var R=s.eventTimes;for(s=s.expirationTimes;0<c;){var q=31-jt(c),K=1<<q;i[q]=0,R[q]=-1,s[q]=-1,c&=~K}}function bn(s,i){var c=s.entangledLanes|=i;for(s=s.entanglements;c;){var R=31-jt(c),q=1<<R;q&i|s[R]&i&&(s[R]|=i),c&=~q}}var qe=0;function wa(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Ca,En,ya,Sa,xa,Rn=!1,hi=[],fr=null,pr=null,mr=null,Es=new Map,Rs=new Map,gr=[],au="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 submit".split(" ");function ba(s,i){switch(s){case"focusin":case"focusout":fr=null;break;case"dragenter":case"dragleave":pr=null;break;case"mouseover":case"mouseout":mr=null;break;case"pointerover":case"pointerout":Es.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Rs.delete(i.pointerId)}}function ks(s,i,c,R,q,K){return s===null||s.nativeEvent!==K?(s={blockedOn:i,domEventName:c,eventSystemFlags:R,nativeEvent:K,targetContainers:[q]},i!==null&&(i=Hs(i),i!==null&&En(i)),s):(s.eventSystemFlags|=R,i=s.targetContainers,q!==null&&i.indexOf(q)===-1&&i.push(q),s)}function lu(s,i,c,R,q){switch(i){case"focusin":return fr=ks(fr,s,i,c,R,q),!0;case"dragenter":return pr=ks(pr,s,i,c,R,q),!0;case"mouseover":return mr=ks(mr,s,i,c,R,q),!0;case"pointerover":var K=q.pointerId;return Es.set(K,ks(Es.get(K)||null,s,i,c,R,q)),!0;case"gotpointercapture":return K=q.pointerId,Rs.set(K,ks(Rs.get(K)||null,s,i,c,R,q)),!0}return!1}function Ea(s){var i=Or(s.target);if(i!==null){var c=Ar(i);if(c!==null){if(i=c.tag,i===13){if(i=ua(c),i!==null){s.blockedOn=i,xa(s.priority,function(){ya(c)});return}}else if(i===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function di(s){if(s.blockedOn!==null)return!1;for(var i=s.targetContainers;0<i.length;){var c=Ln(s.domEventName,s.eventSystemFlags,i[0],s.nativeEvent);if(c===null){c=s.nativeEvent;var R=new c.constructor(c.type,c);mn=R,c.target.dispatchEvent(R),mn=null}else return i=Hs(c),i!==null&&En(i),s.blockedOn=c,!1;i.shift()}return!0}function Ra(s,i,c){di(s)&&c.delete(i)}function cu(){Rn=!1,fr!==null&&di(fr)&&(fr=null),pr!==null&&di(pr)&&(pr=null),mr!==null&&di(mr)&&(mr=null),Es.forEach(Ra),Rs.forEach(Ra)}function Ls(s,i){s.blockedOn===i&&(s.blockedOn=null,Rn||(Rn=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,cu)))}function Is(s){function i(q){return Ls(q,s)}if(0<hi.length){Ls(hi[0],s);for(var c=1;c<hi.length;c++){var R=hi[c];R.blockedOn===s&&(R.blockedOn=null)}}for(fr!==null&&Ls(fr,s),pr!==null&&Ls(pr,s),mr!==null&&Ls(mr,s),Es.forEach(i),Rs.forEach(i),c=0;c<gr.length;c++)R=gr[c],R.blockedOn===s&&(R.blockedOn=null);for(;0<gr.length&&(c=gr[0],c.blockedOn===null);)Ea(c),c.blockedOn===null&&gr.shift()}var Jr=V.ReactCurrentBatchConfig,fi=!0;function uu(s,i,c,R){var q=qe,K=Jr.transition;Jr.transition=null;try{qe=1,kn(s,i,c,R)}finally{qe=q,Jr.transition=K}}function hu(s,i,c,R){var q=qe,K=Jr.transition;Jr.transition=null;try{qe=4,kn(s,i,c,R)}finally{qe=q,Jr.transition=K}}function kn(s,i,c,R){if(fi){var q=Ln(s,i,c,R);if(q===null)qn(s,i,R,pi,c),ba(s,R);else if(lu(q,s,i,c,R))R.stopPropagation();else if(ba(s,R),i&4&&-1<au.indexOf(s)){for(;q!==null;){var K=Hs(q);if(K!==null&&Ca(K),K=Ln(s,i,c,R),K===null&&qn(s,i,R,pi,c),K===q)break;q=K}q!==null&&R.stopPropagation()}else qn(s,i,R,null,c)}}var pi=null;function Ln(s,i,c,R){if(pi=null,s=gn(R),s=Or(s),s!==null)if(i=Ar(s),i===null)s=null;else if(c=i.tag,c===13){if(s=ua(i),s!==null)return s;s=null}else if(c===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;s=null}else i!==s&&(s=null);return pi=s,null}function ka(s){switch(s){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Qc()){case yn:return 1;case ga:return 4;case oi:case Zc:return 16;case va:return 536870912;default:return 16}default:return 16}}var vr=null,In=null,mi=null;function La(){if(mi)return mi;var s,i=In,c=i.length,R,q="value"in vr?vr.value:vr.textContent,K=q.length;for(s=0;s<c&&i[s]===q[s];s++);var te=c-s;for(R=1;R<=te&&i[c-R]===q[K-R];R++);return mi=q.slice(s,1<R?1-R:void 0)}function gi(s){var i=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&i===13&&(s=13)):s=i,s===10&&(s=13),32<=s||s===13?s:0}function vi(){return!0}function Ia(){return!1}function It(s){function i(c,R,q,K,te){this._reactName=c,this._targetInst=q,this.type=R,this.nativeEvent=K,this.target=te,this.currentTarget=null;for(var le in s)s.hasOwnProperty(le)&&(c=s[le],this[le]=c?c(K):K[le]);return this.isDefaultPrevented=(K.defaultPrevented!=null?K.defaultPrevented:K.returnValue===!1)?vi:Ia,this.isPropagationStopped=Ia,this}return re(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=vi)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=vi)},persist:function(){},isPersistent:vi}),i}var Xr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Pn=It(Xr),Ps=re({},Xr,{view:0,detail:0}),du=It(Ps),$n,Tn,$s,_i=re({},Ps,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bn,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==$s&&($s&&s.type==="mousemove"?($n=s.screenX-$s.screenX,Tn=s.screenY-$s.screenY):Tn=$n=0,$s=s),$n)},movementY:function(s){return"movementY"in s?s.movementY:Tn}}),Pa=It(_i),fu=re({},_i,{dataTransfer:0}),pu=It(fu),mu=re({},Ps,{relatedTarget:0}),Dn=It(mu),gu=re({},Xr,{animationName:0,elapsedTime:0,pseudoElement:0}),vu=It(gu),_u=re({},Xr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),wu=It(_u),Cu=re({},Xr,{data:0}),$a=It(Cu),yu={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Su={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"},xu={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bu(s){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(s):(s=xu[s])?!!i[s]:!1}function Bn(){return bu}var Eu=re({},Ps,{key:function(s){if(s.key){var i=yu[s.key]||s.key;if(i!=="Unidentified")return i}return s.type==="keypress"?(s=gi(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Su[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bn,charCode:function(s){return s.type==="keypress"?gi(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?gi(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Ru=It(Eu),ku=re({},_i,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ta=It(ku),Lu=re({},Ps,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bn}),Iu=It(Lu),Pu=re({},Xr,{propertyName:0,elapsedTime:0,pseudoElement:0}),$u=It(Pu),Tu=re({},_i,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),Du=It(Tu),Bu=[9,13,27,32],An=a&&"CompositionEvent"in window,Ts=null;a&&"documentMode"in document&&(Ts=document.documentMode);var Au=a&&"TextEvent"in window&&!Ts,Da=a&&(!An||Ts&&8<Ts&&11>=Ts),Ba=" ",Aa=!1;function Oa(s,i){switch(s){case"keyup":return Bu.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fa(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Qr=!1;function Ou(s,i){switch(s){case"compositionend":return Fa(i);case"keypress":return i.which!==32?null:(Aa=!0,Ba);case"textInput":return s=i.data,s===Ba&&Aa?null:s;default:return null}}function Fu(s,i){if(Qr)return s==="compositionend"||!An&&Oa(s,i)?(s=La(),mi=In=vr=null,Qr=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Da&&i.locale!=="ko"?null:i.data;default:return null}}var Mu={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 Ma(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i==="input"?!!Mu[s.type]:i==="textarea"}function Na(s,i,c,R){na(R),i=xi(i,"onChange"),0<i.length&&(c=new Pn("onChange","change",null,c,R),s.push({event:c,listeners:i}))}var Ds=null,Bs=null;function Nu(s){sl(s,0)}function wi(s){var i=ss(s);if(Te(i))return s}function ju(s,i){if(s==="change")return i}var ja=!1;if(a){var On;if(a){var Fn="oninput"in document;if(!Fn){var Ha=document.createElement("div");Ha.setAttribute("oninput","return;"),Fn=typeof Ha.oninput=="function"}On=Fn}else On=!1;ja=On&&(!document.documentMode||9<document.documentMode)}function Ua(){Ds&&(Ds.detachEvent("onpropertychange",Wa),Bs=Ds=null)}function Wa(s){if(s.propertyName==="value"&&wi(Bs)){var i=[];Na(i,Bs,s,gn(s)),ca(Nu,i)}}function Hu(s,i,c){s==="focusin"?(Ua(),Ds=i,Bs=c,Ds.attachEvent("onpropertychange",Wa)):s==="focusout"&&Ua()}function Uu(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return wi(Bs)}function Wu(s,i){if(s==="click")return wi(i)}function zu(s,i){if(s==="input"||s==="change")return wi(i)}function qu(s,i){return s===i&&(s!==0||1/s===1/i)||s!==s&&i!==i}var Ht=typeof Object.is=="function"?Object.is:qu;function As(s,i){if(Ht(s,i))return!0;if(typeof s!="object"||s===null||typeof i!="object"||i===null)return!1;var c=Object.keys(s),R=Object.keys(i);if(c.length!==R.length)return!1;for(R=0;R<c.length;R++){var q=c[R];if(!l.call(i,q)||!Ht(s[q],i[q]))return!1}return!0}function za(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function qa(s,i){var c=za(s);s=0;for(var R;c;){if(c.nodeType===3){if(R=s+c.textContent.length,s<=i&&R>=i)return{node:c,offset:i-s};s=R}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=za(c)}}function Va(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?Va(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function Ka(){for(var s=window,i=Ue();i instanceof s.HTMLIFrameElement;){try{var c=typeof i.contentWindow.location.href=="string"}catch{c=!1}if(c)s=i.contentWindow;else break;i=Ue(s.document)}return i}function Mn(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}function Vu(s){var i=Ka(),c=s.focusedElem,R=s.selectionRange;if(i!==c&&c&&c.ownerDocument&&Va(c.ownerDocument.documentElement,c)){if(R!==null&&Mn(c)){if(i=R.start,s=R.end,s===void 0&&(s=i),"selectionStart"in c)c.selectionStart=i,c.selectionEnd=Math.min(s,c.value.length);else if(s=(i=c.ownerDocument||document)&&i.defaultView||window,s.getSelection){s=s.getSelection();var q=c.textContent.length,K=Math.min(R.start,q);R=R.end===void 0?K:Math.min(R.end,q),!s.extend&&K>R&&(q=R,R=K,K=q),q=qa(c,K);var te=qa(c,R);q&&te&&(s.rangeCount!==1||s.anchorNode!==q.node||s.anchorOffset!==q.offset||s.focusNode!==te.node||s.focusOffset!==te.offset)&&(i=i.createRange(),i.setStart(q.node,q.offset),s.removeAllRanges(),K>R?(s.addRange(i),s.extend(te.node,te.offset)):(i.setEnd(te.node,te.offset),s.addRange(i)))}}for(i=[],s=c;s=s.parentNode;)s.nodeType===1&&i.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c<i.length;c++)s=i[c],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var Ku=a&&"documentMode"in document&&11>=document.documentMode,Zr=null,Nn=null,Os=null,jn=!1;function Ga(s,i,c){var R=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;jn||Zr==null||Zr!==Ue(R)||(R=Zr,"selectionStart"in R&&Mn(R)?R={start:R.selectionStart,end:R.selectionEnd}:(R=(R.ownerDocument&&R.ownerDocument.defaultView||window).getSelection(),R={anchorNode:R.anchorNode,anchorOffset:R.anchorOffset,focusNode:R.focusNode,focusOffset:R.focusOffset}),Os&&As(Os,R)||(Os=R,R=xi(Nn,"onSelect"),0<R.length&&(i=new Pn("onSelect","select",null,i,c),s.push({event:i,listeners:R}),i.target=Zr)))}function Ci(s,i){var c={};return c[s.toLowerCase()]=i.toLowerCase(),c["Webkit"+s]="webkit"+i,c["Moz"+s]="moz"+i,c}var es={animationend:Ci("Animation","AnimationEnd"),animationiteration:Ci("Animation","AnimationIteration"),animationstart:Ci("Animation","AnimationStart"),transitionend:Ci("Transition","TransitionEnd")},Hn={},Ya={};a&&(Ya=document.createElement("div").style,"AnimationEvent"in window||(delete es.animationend.animation,delete es.animationiteration.animation,delete es.animationstart.animation),"TransitionEvent"in window||delete es.transitionend.transition);function yi(s){if(Hn[s])return Hn[s];if(!es[s])return s;var i=es[s],c;for(c in i)if(i.hasOwnProperty(c)&&c in Ya)return Hn[s]=i[c];return s}var Ja=yi("animationend"),Xa=yi("animationiteration"),Qa=yi("animationstart"),Za=yi("transitionend"),el=new Map,tl="abort auxClick 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(" ");function _r(s,i){el.set(s,i),u(i,[s])}for(var Un=0;Un<tl.length;Un++){var Wn=tl[Un],Gu=Wn.toLowerCase(),Yu=Wn[0].toUpperCase()+Wn.slice(1);_r(Gu,"on"+Yu)}_r(Ja,"onAnimationEnd"),_r(Xa,"onAnimationIteration"),_r(Qa,"onAnimationStart"),_r("dblclick","onDoubleClick"),_r("focusin","onFocus"),_r("focusout","onBlur"),_r(Za,"onTransitionEnd"),h("onMouseEnter",["mouseout","mouseover"]),h("onMouseLeave",["mouseout","mouseover"]),h("onPointerEnter",["pointerout","pointerover"]),h("onPointerLeave",["pointerout","pointerover"]),u("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),u("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),u("onBeforeInput",["compositionend","keypress","textInput","paste"]),u("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fs="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(" "),Ju=new Set("cancel close invalid load scroll toggle".split(" ").concat(Fs));function rl(s,i,c){var R=s.type||"unknown-event";s.currentTarget=c,Gc(R,i,void 0,s),s.currentTarget=null}function sl(s,i){i=(i&4)!==0;for(var c=0;c<s.length;c++){var R=s[c],q=R.event;R=R.listeners;e:{var K=void 0;if(i)for(var te=R.length-1;0<=te;te--){var le=R[te],he=le.instance,ye=le.currentTarget;if(le=le.listener,he!==K&&q.isPropagationStopped())break e;rl(q,le,ye),K=he}else for(te=0;te<R.length;te++){if(le=R[te],he=le.instance,ye=le.currentTarget,le=le.listener,he!==K&&q.isPropagationStopped())break e;rl(q,le,ye),K=he}}}if(ni)throw s=Cn,ni=!1,Cn=null,s}function Je(s,i){var c=i[Xn];c===void 0&&(c=i[Xn]=new Set);var R=s+"__bubble";c.has(R)||(il(i,s,2,!1),c.add(R))}function zn(s,i,c){var R=0;i&&(R|=4),il(c,s,R,i)}var Si="_reactListening"+Math.random().toString(36).slice(2);function Ms(s){if(!s[Si]){s[Si]=!0,n.forEach(function(c){c!=="selectionchange"&&(Ju.has(c)||zn(c,!1,s),zn(c,!0,s))});var i=s.nodeType===9?s:s.ownerDocument;i===null||i[Si]||(i[Si]=!0,zn("selectionchange",!1,i))}}function il(s,i,c,R){switch(ka(i)){case 1:var q=uu;break;case 4:q=hu;break;default:q=kn}c=q.bind(null,i,c,s),q=void 0,!wn||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(q=!0),R?q!==void 0?s.addEventListener(i,c,{capture:!0,passive:q}):s.addEventListener(i,c,!0):q!==void 0?s.addEventListener(i,c,{passive:q}):s.addEventListener(i,c,!1)}function qn(s,i,c,R,q){var K=R;if((i&1)===0&&(i&2)===0&&R!==null)e:for(;;){if(R===null)return;var te=R.tag;if(te===3||te===4){var le=R.stateNode.containerInfo;if(le===q||le.nodeType===8&&le.parentNode===q)break;if(te===4)for(te=R.return;te!==null;){var he=te.tag;if((he===3||he===4)&&(he=te.stateNode.containerInfo,he===q||he.nodeType===8&&he.parentNode===q))return;te=te.return}for(;le!==null;){if(te=Or(le),te===null)return;if(he=te.tag,he===5||he===6){R=K=te;continue e}le=le.parentNode}}R=R.return}ca(function(){var ye=K,Le=gn(c),Ie=[];e:{var Re=el.get(s);if(Re!==void 0){var De=Pn,Ae=s;switch(s){case"keypress":if(gi(c)===0)break e;case"keydown":case"keyup":De=Ru;break;case"focusin":Ae="focus",De=Dn;break;case"focusout":Ae="blur",De=Dn;break;case"beforeblur":case"afterblur":De=Dn;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":De=Pa;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":De=pu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":De=Iu;break;case Ja:case Xa:case Qa:De=vu;break;case Za:De=$u;break;case"scroll":De=du;break;case"wheel":De=Du;break;case"copy":case"cut":case"paste":De=wu;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":De=Ta}var Oe=(i&4)!==0,st=!Oe&&s==="scroll",_e=Oe?Re!==null?Re+"Capture":null:Re;Oe=[];for(var pe=ye,Ce;pe!==null;){Ce=pe;var Pe=Ce.stateNode;if(Ce.tag===5&&Pe!==null&&(Ce=Pe,_e!==null&&(Pe=Cs(pe,_e),Pe!=null&&Oe.push(Ns(pe,Pe,Ce)))),st)break;pe=pe.return}0<Oe.length&&(Re=new De(Re,Ae,null,c,Le),Ie.push({event:Re,listeners:Oe}))}}if((i&7)===0){e:{if(Re=s==="mouseover"||s==="pointerover",De=s==="mouseout"||s==="pointerout",Re&&c!==mn&&(Ae=c.relatedTarget||c.fromElement)&&(Or(Ae)||Ae[tr]))break e;if((De||Re)&&(Re=Le.window===Le?Le:(Re=Le.ownerDocument)?Re.defaultView||Re.parentWindow:window,De?(Ae=c.relatedTarget||c.toElement,De=ye,Ae=Ae?Or(Ae):null,Ae!==null&&(st=Ar(Ae),Ae!==st||Ae.tag!==5&&Ae.tag!==6)&&(Ae=null)):(De=null,Ae=ye),De!==Ae)){if(Oe=Pa,Pe="onMouseLeave",_e="onMouseEnter",pe="mouse",(s==="pointerout"||s==="pointerover")&&(Oe=Ta,Pe="onPointerLeave",_e="onPointerEnter",pe="pointer"),st=De==null?Re:ss(De),Ce=Ae==null?Re:ss(Ae),Re=new Oe(Pe,pe+"leave",De,c,Le),Re.target=st,Re.relatedTarget=Ce,Pe=null,Or(Le)===ye&&(Oe=new Oe(_e,pe+"enter",Ae,c,Le),Oe.target=Ce,Oe.relatedTarget=st,Pe=Oe),st=Pe,De&&Ae)t:{for(Oe=De,_e=Ae,pe=0,Ce=Oe;Ce;Ce=ts(Ce))pe++;for(Ce=0,Pe=_e;Pe;Pe=ts(Pe))Ce++;for(;0<pe-Ce;)Oe=ts(Oe),pe--;for(;0<Ce-pe;)_e=ts(_e),Ce--;for(;pe--;){if(Oe===_e||_e!==null&&Oe===_e.alternate)break t;Oe=ts(Oe),_e=ts(_e)}Oe=null}else Oe=null;De!==null&&nl(Ie,Re,De,Oe,!1),Ae!==null&&st!==null&&nl(Ie,st,Ae,Oe,!0)}}e:{if(Re=ye?ss(ye):window,De=Re.nodeName&&Re.nodeName.toLowerCase(),De==="select"||De==="input"&&Re.type==="file")var Fe=ju;else if(Ma(Re))if(ja)Fe=zu;else{Fe=Uu;var Me=Hu}else(De=Re.nodeName)&&De.toLowerCase()==="input"&&(Re.type==="checkbox"||Re.type==="radio")&&(Fe=Wu);if(Fe&&(Fe=Fe(s,ye))){Na(Ie,Fe,c,Le);break e}Me&&Me(s,Re,ye),s==="focusout"&&(Me=Re._wrapperState)&&Me.controlled&&Re.type==="number"&&Tr(Re,"number",Re.value)}switch(Me=ye?ss(ye):window,s){case"focusin":(Ma(Me)||Me.contentEditable==="true")&&(Zr=Me,Nn=ye,Os=null);break;case"focusout":Os=Nn=Zr=null;break;case"mousedown":jn=!0;break;case"contextmenu":case"mouseup":case"dragend":jn=!1,Ga(Ie,c,Le);break;case"selectionchange":if(Ku)break;case"keydown":case"keyup":Ga(Ie,c,Le)}var Ne;if(An)e:{switch(s){case"compositionstart":var He="onCompositionStart";break e;case"compositionend":He="onCompositionEnd";break e;case"compositionupdate":He="onCompositionUpdate";break e}He=void 0}else Qr?Oa(s,c)&&(He="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(He="onCompositionStart");He&&(Da&&c.locale!=="ko"&&(Qr||He!=="onCompositionStart"?He==="onCompositionEnd"&&Qr&&(Ne=La()):(vr=Le,In="value"in vr?vr.value:vr.textContent,Qr=!0)),Me=xi(ye,He),0<Me.length&&(He=new $a(He,s,null,c,Le),Ie.push({event:He,listeners:Me}),Ne?He.data=Ne:(Ne=Fa(c),Ne!==null&&(He.data=Ne)))),(Ne=Au?Ou(s,c):Fu(s,c))&&(ye=xi(ye,"onBeforeInput"),0<ye.length&&(Le=new $a("onBeforeInput","beforeinput",null,c,Le),Ie.push({event:Le,listeners:ye}),Le.data=Ne))}sl(Ie,i)})}function Ns(s,i,c){return{instance:s,listener:i,currentTarget:c}}function xi(s,i){for(var c=i+"Capture",R=[];s!==null;){var q=s,K=q.stateNode;q.tag===5&&K!==null&&(q=K,K=Cs(s,c),K!=null&&R.unshift(Ns(s,K,q)),K=Cs(s,i),K!=null&&R.push(Ns(s,K,q))),s=s.return}return R}function ts(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function nl(s,i,c,R,q){for(var K=i._reactName,te=[];c!==null&&c!==R;){var le=c,he=le.alternate,ye=le.stateNode;if(he!==null&&he===R)break;le.tag===5&&ye!==null&&(le=ye,q?(he=Cs(c,K),he!=null&&te.unshift(Ns(c,he,le))):q||(he=Cs(c,K),he!=null&&te.push(Ns(c,he,le)))),c=c.return}te.length!==0&&s.push({event:i,listeners:te})}var Xu=/\r\n?/g,Qu=/\u0000|\uFFFD/g;function ol(s){return(typeof s=="string"?s:""+s).replace(Xu,`
38
- `).replace(Qu,"")}function bi(s,i,c){if(i=ol(i),ol(s)!==i&&c)throw Error(r(425))}function Ei(){}var Vn=null,Kn=null;function Gn(s,i){return s==="textarea"||s==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Yn=typeof setTimeout=="function"?setTimeout:void 0,Zu=typeof clearTimeout=="function"?clearTimeout:void 0,al=typeof Promise=="function"?Promise:void 0,eh=typeof queueMicrotask=="function"?queueMicrotask:typeof al<"u"?function(s){return al.resolve(null).then(s).catch(th)}:Yn;function th(s){setTimeout(function(){throw s})}function Jn(s,i){var c=i,R=0;do{var q=c.nextSibling;if(s.removeChild(c),q&&q.nodeType===8)if(c=q.data,c==="/$"){if(R===0){s.removeChild(q),Is(i);return}R--}else c!=="$"&&c!=="$?"&&c!=="$!"||R++;c=q}while(c);Is(i)}function wr(s){for(;s!=null;s=s.nextSibling){var i=s.nodeType;if(i===1||i===3)break;if(i===8){if(i=s.data,i==="$"||i==="$!"||i==="$?")break;if(i==="/$")return null}}return s}function ll(s){s=s.previousSibling;for(var i=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"){if(i===0)return s;i--}else c==="/$"&&i++}s=s.previousSibling}return null}var rs=Math.random().toString(36).slice(2),Yt="__reactFiber$"+rs,js="__reactProps$"+rs,tr="__reactContainer$"+rs,Xn="__reactEvents$"+rs,rh="__reactListeners$"+rs,sh="__reactHandles$"+rs;function Or(s){var i=s[Yt];if(i)return i;for(var c=s.parentNode;c;){if(i=c[tr]||c[Yt]){if(c=i.alternate,i.child!==null||c!==null&&c.child!==null)for(s=ll(s);s!==null;){if(c=s[Yt])return c;s=ll(s)}return i}s=c,c=s.parentNode}return null}function Hs(s){return s=s[Yt]||s[tr],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function ss(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(r(33))}function Ri(s){return s[js]||null}var Qn=[],is=-1;function Cr(s){return{current:s}}function Xe(s){0>is||(s.current=Qn[is],Qn[is]=null,is--)}function Ke(s,i){is++,Qn[is]=s.current,s.current=i}var yr={},ft=Cr(yr),St=Cr(!1),Fr=yr;function ns(s,i){var c=s.type.contextTypes;if(!c)return yr;var R=s.stateNode;if(R&&R.__reactInternalMemoizedUnmaskedChildContext===i)return R.__reactInternalMemoizedMaskedChildContext;var q={},K;for(K in c)q[K]=i[K];return R&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=i,s.__reactInternalMemoizedMaskedChildContext=q),q}function xt(s){return s=s.childContextTypes,s!=null}function ki(){Xe(St),Xe(ft)}function cl(s,i,c){if(ft.current!==yr)throw Error(r(168));Ke(ft,i),Ke(St,c)}function ul(s,i,c){var R=s.stateNode;if(i=i.childContextTypes,typeof R.getChildContext!="function")return c;R=R.getChildContext();for(var q in R)if(!(q in i))throw Error(r(108,ue(s)||"Unknown",q));return re({},c,R)}function Li(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||yr,Fr=ft.current,Ke(ft,s),Ke(St,St.current),!0}function hl(s,i,c){var R=s.stateNode;if(!R)throw Error(r(169));c?(s=ul(s,i,Fr),R.__reactInternalMemoizedMergedChildContext=s,Xe(St),Xe(ft),Ke(ft,s)):Xe(St),Ke(St,c)}var rr=null,Ii=!1,Zn=!1;function dl(s){rr===null?rr=[s]:rr.push(s)}function ih(s){Ii=!0,dl(s)}function Sr(){if(!Zn&&rr!==null){Zn=!0;var s=0,i=qe;try{var c=rr;for(qe=1;s<c.length;s++){var R=c[s];do R=R(!0);while(R!==null)}rr=null,Ii=!1}catch(q){throw rr!==null&&(rr=rr.slice(s+1)),pa(yn,Sr),q}finally{qe=i,Zn=!1}}return null}var os=[],as=0,Pi=null,$i=0,Dt=[],Bt=0,Mr=null,sr=1,ir="";function Nr(s,i){os[as++]=$i,os[as++]=Pi,Pi=s,$i=i}function fl(s,i,c){Dt[Bt++]=sr,Dt[Bt++]=ir,Dt[Bt++]=Mr,Mr=s;var R=sr;s=ir;var q=32-jt(R)-1;R&=~(1<<q),c+=1;var K=32-jt(i)+q;if(30<K){var te=q-q%5;K=(R&(1<<te)-1).toString(32),R>>=te,q-=te,sr=1<<32-jt(i)+q|c<<q|R,ir=K+s}else sr=1<<K|c<<q|R,ir=s}function eo(s){s.return!==null&&(Nr(s,1),fl(s,1,0))}function to(s){for(;s===Pi;)Pi=os[--as],os[as]=null,$i=os[--as],os[as]=null;for(;s===Mr;)Mr=Dt[--Bt],Dt[Bt]=null,ir=Dt[--Bt],Dt[Bt]=null,sr=Dt[--Bt],Dt[Bt]=null}var Pt=null,$t=null,Qe=!1,Ut=null;function pl(s,i){var c=Mt(5,null,null,0);c.elementType="DELETED",c.stateNode=i,c.return=s,i=s.deletions,i===null?(s.deletions=[c],s.flags|=16):i.push(c)}function ml(s,i){switch(s.tag){case 5:var c=s.type;return i=i.nodeType!==1||c.toLowerCase()!==i.nodeName.toLowerCase()?null:i,i!==null?(s.stateNode=i,Pt=s,$t=wr(i.firstChild),!0):!1;case 6:return i=s.pendingProps===""||i.nodeType!==3?null:i,i!==null?(s.stateNode=i,Pt=s,$t=null,!0):!1;case 13:return i=i.nodeType!==8?null:i,i!==null?(c=Mr!==null?{id:sr,overflow:ir}:null,s.memoizedState={dehydrated:i,treeContext:c,retryLane:1073741824},c=Mt(18,null,null,0),c.stateNode=i,c.return=s,s.child=c,Pt=s,$t=null,!0):!1;default:return!1}}function ro(s){return(s.mode&1)!==0&&(s.flags&128)===0}function so(s){if(Qe){var i=$t;if(i){var c=i;if(!ml(s,i)){if(ro(s))throw Error(r(418));i=wr(c.nextSibling);var R=Pt;i&&ml(s,i)?pl(R,c):(s.flags=s.flags&-4097|2,Qe=!1,Pt=s)}}else{if(ro(s))throw Error(r(418));s.flags=s.flags&-4097|2,Qe=!1,Pt=s}}}function gl(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Pt=s}function Ti(s){if(s!==Pt)return!1;if(!Qe)return gl(s),Qe=!0,!1;var i;if((i=s.tag!==3)&&!(i=s.tag!==5)&&(i=s.type,i=i!=="head"&&i!=="body"&&!Gn(s.type,s.memoizedProps)),i&&(i=$t)){if(ro(s))throw vl(),Error(r(418));for(;i;)pl(s,i),i=wr(i.nextSibling)}if(gl(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));e:{for(s=s.nextSibling,i=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"){if(i===0){$t=wr(s.nextSibling);break e}i--}else c!=="$"&&c!=="$!"&&c!=="$?"||i++}s=s.nextSibling}$t=null}}else $t=Pt?wr(s.stateNode.nextSibling):null;return!0}function vl(){for(var s=$t;s;)s=wr(s.nextSibling)}function ls(){$t=Pt=null,Qe=!1}function io(s){Ut===null?Ut=[s]:Ut.push(s)}var nh=V.ReactCurrentBatchConfig;function Us(s,i,c){if(s=c.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(c._owner){if(c=c._owner,c){if(c.tag!==1)throw Error(r(309));var R=c.stateNode}if(!R)throw Error(r(147,s));var q=R,K=""+s;return i!==null&&i.ref!==null&&typeof i.ref=="function"&&i.ref._stringRef===K?i.ref:(i=function(te){var le=q.refs;te===null?delete le[K]:le[K]=te},i._stringRef=K,i)}if(typeof s!="string")throw Error(r(284));if(!c._owner)throw Error(r(290,s))}return s}function Di(s,i){throw s=Object.prototype.toString.call(i),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s))}function _l(s){var i=s._init;return i(s._payload)}function wl(s){function i(_e,pe){if(s){var Ce=_e.deletions;Ce===null?(_e.deletions=[pe],_e.flags|=16):Ce.push(pe)}}function c(_e,pe){if(!s)return null;for(;pe!==null;)i(_e,pe),pe=pe.sibling;return null}function R(_e,pe){for(_e=new Map;pe!==null;)pe.key!==null?_e.set(pe.key,pe):_e.set(pe.index,pe),pe=pe.sibling;return _e}function q(_e,pe){return _e=Pr(_e,pe),_e.index=0,_e.sibling=null,_e}function K(_e,pe,Ce){return _e.index=Ce,s?(Ce=_e.alternate,Ce!==null?(Ce=Ce.index,Ce<pe?(_e.flags|=2,pe):Ce):(_e.flags|=2,pe)):(_e.flags|=1048576,pe)}function te(_e){return s&&_e.alternate===null&&(_e.flags|=2),_e}function le(_e,pe,Ce,Pe){return pe===null||pe.tag!==6?(pe=Jo(Ce,_e.mode,Pe),pe.return=_e,pe):(pe=q(pe,Ce),pe.return=_e,pe)}function he(_e,pe,Ce,Pe){var Fe=Ce.type;return Fe===X?Le(_e,pe,Ce.props.children,Pe,Ce.key):pe!==null&&(pe.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===ve&&_l(Fe)===pe.type)?(Pe=q(pe,Ce.props),Pe.ref=Us(_e,pe,Ce),Pe.return=_e,Pe):(Pe=sn(Ce.type,Ce.key,Ce.props,null,_e.mode,Pe),Pe.ref=Us(_e,pe,Ce),Pe.return=_e,Pe)}function ye(_e,pe,Ce,Pe){return pe===null||pe.tag!==4||pe.stateNode.containerInfo!==Ce.containerInfo||pe.stateNode.implementation!==Ce.implementation?(pe=Xo(Ce,_e.mode,Pe),pe.return=_e,pe):(pe=q(pe,Ce.children||[]),pe.return=_e,pe)}function Le(_e,pe,Ce,Pe,Fe){return pe===null||pe.tag!==7?(pe=Kr(Ce,_e.mode,Pe,Fe),pe.return=_e,pe):(pe=q(pe,Ce),pe.return=_e,pe)}function Ie(_e,pe,Ce){if(typeof pe=="string"&&pe!==""||typeof pe=="number")return pe=Jo(""+pe,_e.mode,Ce),pe.return=_e,pe;if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case Y:return Ce=sn(pe.type,pe.key,pe.props,null,_e.mode,Ce),Ce.ref=Us(_e,null,pe),Ce.return=_e,Ce;case J:return pe=Xo(pe,_e.mode,Ce),pe.return=_e,pe;case ve:var Pe=pe._init;return Ie(_e,Pe(pe._payload),Ce)}if(er(pe)||Q(pe))return pe=Kr(pe,_e.mode,Ce,null),pe.return=_e,pe;Di(_e,pe)}return null}function Re(_e,pe,Ce,Pe){var Fe=pe!==null?pe.key:null;if(typeof Ce=="string"&&Ce!==""||typeof Ce=="number")return Fe!==null?null:le(_e,pe,""+Ce,Pe);if(typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case Y:return Ce.key===Fe?he(_e,pe,Ce,Pe):null;case J:return Ce.key===Fe?ye(_e,pe,Ce,Pe):null;case ve:return Fe=Ce._init,Re(_e,pe,Fe(Ce._payload),Pe)}if(er(Ce)||Q(Ce))return Fe!==null?null:Le(_e,pe,Ce,Pe,null);Di(_e,Ce)}return null}function De(_e,pe,Ce,Pe,Fe){if(typeof Pe=="string"&&Pe!==""||typeof Pe=="number")return _e=_e.get(Ce)||null,le(pe,_e,""+Pe,Fe);if(typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case Y:return _e=_e.get(Pe.key===null?Ce:Pe.key)||null,he(pe,_e,Pe,Fe);case J:return _e=_e.get(Pe.key===null?Ce:Pe.key)||null,ye(pe,_e,Pe,Fe);case ve:var Me=Pe._init;return De(_e,pe,Ce,Me(Pe._payload),Fe)}if(er(Pe)||Q(Pe))return _e=_e.get(Ce)||null,Le(pe,_e,Pe,Fe,null);Di(pe,Pe)}return null}function Ae(_e,pe,Ce,Pe){for(var Fe=null,Me=null,Ne=pe,He=pe=0,ct=null;Ne!==null&&He<Ce.length;He++){Ne.index>He?(ct=Ne,Ne=null):ct=Ne.sibling;var ze=Re(_e,Ne,Ce[He],Pe);if(ze===null){Ne===null&&(Ne=ct);break}s&&Ne&&ze.alternate===null&&i(_e,Ne),pe=K(ze,pe,He),Me===null?Fe=ze:Me.sibling=ze,Me=ze,Ne=ct}if(He===Ce.length)return c(_e,Ne),Qe&&Nr(_e,He),Fe;if(Ne===null){for(;He<Ce.length;He++)Ne=Ie(_e,Ce[He],Pe),Ne!==null&&(pe=K(Ne,pe,He),Me===null?Fe=Ne:Me.sibling=Ne,Me=Ne);return Qe&&Nr(_e,He),Fe}for(Ne=R(_e,Ne);He<Ce.length;He++)ct=De(Ne,_e,He,Ce[He],Pe),ct!==null&&(s&&ct.alternate!==null&&Ne.delete(ct.key===null?He:ct.key),pe=K(ct,pe,He),Me===null?Fe=ct:Me.sibling=ct,Me=ct);return s&&Ne.forEach(function($r){return i(_e,$r)}),Qe&&Nr(_e,He),Fe}function Oe(_e,pe,Ce,Pe){var Fe=Q(Ce);if(typeof Fe!="function")throw Error(r(150));if(Ce=Fe.call(Ce),Ce==null)throw Error(r(151));for(var Me=Fe=null,Ne=pe,He=pe=0,ct=null,ze=Ce.next();Ne!==null&&!ze.done;He++,ze=Ce.next()){Ne.index>He?(ct=Ne,Ne=null):ct=Ne.sibling;var $r=Re(_e,Ne,ze.value,Pe);if($r===null){Ne===null&&(Ne=ct);break}s&&Ne&&$r.alternate===null&&i(_e,Ne),pe=K($r,pe,He),Me===null?Fe=$r:Me.sibling=$r,Me=$r,Ne=ct}if(ze.done)return c(_e,Ne),Qe&&Nr(_e,He),Fe;if(Ne===null){for(;!ze.done;He++,ze=Ce.next())ze=Ie(_e,ze.value,Pe),ze!==null&&(pe=K(ze,pe,He),Me===null?Fe=ze:Me.sibling=ze,Me=ze);return Qe&&Nr(_e,He),Fe}for(Ne=R(_e,Ne);!ze.done;He++,ze=Ce.next())ze=De(Ne,_e,He,ze.value,Pe),ze!==null&&(s&&ze.alternate!==null&&Ne.delete(ze.key===null?He:ze.key),pe=K(ze,pe,He),Me===null?Fe=ze:Me.sibling=ze,Me=ze);return s&&Ne.forEach(function(Mh){return i(_e,Mh)}),Qe&&Nr(_e,He),Fe}function st(_e,pe,Ce,Pe){if(typeof Ce=="object"&&Ce!==null&&Ce.type===X&&Ce.key===null&&(Ce=Ce.props.children),typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case Y:e:{for(var Fe=Ce.key,Me=pe;Me!==null;){if(Me.key===Fe){if(Fe=Ce.type,Fe===X){if(Me.tag===7){c(_e,Me.sibling),pe=q(Me,Ce.props.children),pe.return=_e,_e=pe;break e}}else if(Me.elementType===Fe||typeof Fe=="object"&&Fe!==null&&Fe.$$typeof===ve&&_l(Fe)===Me.type){c(_e,Me.sibling),pe=q(Me,Ce.props),pe.ref=Us(_e,Me,Ce),pe.return=_e,_e=pe;break e}c(_e,Me);break}else i(_e,Me);Me=Me.sibling}Ce.type===X?(pe=Kr(Ce.props.children,_e.mode,Pe,Ce.key),pe.return=_e,_e=pe):(Pe=sn(Ce.type,Ce.key,Ce.props,null,_e.mode,Pe),Pe.ref=Us(_e,pe,Ce),Pe.return=_e,_e=Pe)}return te(_e);case J:e:{for(Me=Ce.key;pe!==null;){if(pe.key===Me)if(pe.tag===4&&pe.stateNode.containerInfo===Ce.containerInfo&&pe.stateNode.implementation===Ce.implementation){c(_e,pe.sibling),pe=q(pe,Ce.children||[]),pe.return=_e,_e=pe;break e}else{c(_e,pe);break}else i(_e,pe);pe=pe.sibling}pe=Xo(Ce,_e.mode,Pe),pe.return=_e,_e=pe}return te(_e);case ve:return Me=Ce._init,st(_e,pe,Me(Ce._payload),Pe)}if(er(Ce))return Ae(_e,pe,Ce,Pe);if(Q(Ce))return Oe(_e,pe,Ce,Pe);Di(_e,Ce)}return typeof Ce=="string"&&Ce!==""||typeof Ce=="number"?(Ce=""+Ce,pe!==null&&pe.tag===6?(c(_e,pe.sibling),pe=q(pe,Ce),pe.return=_e,_e=pe):(c(_e,pe),pe=Jo(Ce,_e.mode,Pe),pe.return=_e,_e=pe),te(_e)):c(_e,pe)}return st}var cs=wl(!0),Cl=wl(!1),Bi=Cr(null),Ai=null,us=null,no=null;function oo(){no=us=Ai=null}function ao(s){var i=Bi.current;Xe(Bi),s._currentValue=i}function lo(s,i,c){for(;s!==null;){var R=s.alternate;if((s.childLanes&i)!==i?(s.childLanes|=i,R!==null&&(R.childLanes|=i)):R!==null&&(R.childLanes&i)!==i&&(R.childLanes|=i),s===c)break;s=s.return}}function hs(s,i){Ai=s,no=us=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&i)!==0&&(bt=!0),s.firstContext=null)}function At(s){var i=s._currentValue;if(no!==s)if(s={context:s,memoizedValue:i,next:null},us===null){if(Ai===null)throw Error(r(308));us=s,Ai.dependencies={lanes:0,firstContext:s}}else us=us.next=s;return i}var jr=null;function co(s){jr===null?jr=[s]:jr.push(s)}function yl(s,i,c,R){var q=i.interleaved;return q===null?(c.next=c,co(i)):(c.next=q.next,q.next=c),i.interleaved=c,nr(s,R)}function nr(s,i){s.lanes|=i;var c=s.alternate;for(c!==null&&(c.lanes|=i),c=s,s=s.return;s!==null;)s.childLanes|=i,c=s.alternate,c!==null&&(c.childLanes|=i),c=s,s=s.return;return c.tag===3?c.stateNode:null}var xr=!1;function uo(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Sl(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function or(s,i){return{eventTime:s,lane:i,tag:0,payload:null,callback:null,next:null}}function br(s,i,c){var R=s.updateQueue;if(R===null)return null;if(R=R.shared,(We&2)!==0){var q=R.pending;return q===null?i.next=i:(i.next=q.next,q.next=i),R.pending=i,nr(s,c)}return q=R.interleaved,q===null?(i.next=i,co(R)):(i.next=q.next,q.next=i),R.interleaved=i,nr(s,c)}function Oi(s,i,c){if(i=i.updateQueue,i!==null&&(i=i.shared,(c&4194240)!==0)){var R=i.lanes;R&=s.pendingLanes,c|=R,i.lanes=c,bn(s,c)}}function xl(s,i){var c=s.updateQueue,R=s.alternate;if(R!==null&&(R=R.updateQueue,c===R)){var q=null,K=null;if(c=c.firstBaseUpdate,c!==null){do{var te={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};K===null?q=K=te:K=K.next=te,c=c.next}while(c!==null);K===null?q=K=i:K=K.next=i}else q=K=i;c={baseState:R.baseState,firstBaseUpdate:q,lastBaseUpdate:K,shared:R.shared,effects:R.effects},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=i:s.next=i,c.lastBaseUpdate=i}function Fi(s,i,c,R){var q=s.updateQueue;xr=!1;var K=q.firstBaseUpdate,te=q.lastBaseUpdate,le=q.shared.pending;if(le!==null){q.shared.pending=null;var he=le,ye=he.next;he.next=null,te===null?K=ye:te.next=ye,te=he;var Le=s.alternate;Le!==null&&(Le=Le.updateQueue,le=Le.lastBaseUpdate,le!==te&&(le===null?Le.firstBaseUpdate=ye:le.next=ye,Le.lastBaseUpdate=he))}if(K!==null){var Ie=q.baseState;te=0,Le=ye=he=null,le=K;do{var Re=le.lane,De=le.eventTime;if((R&Re)===Re){Le!==null&&(Le=Le.next={eventTime:De,lane:0,tag:le.tag,payload:le.payload,callback:le.callback,next:null});e:{var Ae=s,Oe=le;switch(Re=i,De=c,Oe.tag){case 1:if(Ae=Oe.payload,typeof Ae=="function"){Ie=Ae.call(De,Ie,Re);break e}Ie=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Oe.payload,Re=typeof Ae=="function"?Ae.call(De,Ie,Re):Ae,Re==null)break e;Ie=re({},Ie,Re);break e;case 2:xr=!0}}le.callback!==null&&le.lane!==0&&(s.flags|=64,Re=q.effects,Re===null?q.effects=[le]:Re.push(le))}else De={eventTime:De,lane:Re,tag:le.tag,payload:le.payload,callback:le.callback,next:null},Le===null?(ye=Le=De,he=Ie):Le=Le.next=De,te|=Re;if(le=le.next,le===null){if(le=q.shared.pending,le===null)break;Re=le,le=Re.next,Re.next=null,q.lastBaseUpdate=Re,q.shared.pending=null}}while(!0);if(Le===null&&(he=Ie),q.baseState=he,q.firstBaseUpdate=ye,q.lastBaseUpdate=Le,i=q.shared.interleaved,i!==null){q=i;do te|=q.lane,q=q.next;while(q!==i)}else K===null&&(q.shared.lanes=0);Wr|=te,s.lanes=te,s.memoizedState=Ie}}function bl(s,i,c){if(s=i.effects,i.effects=null,s!==null)for(i=0;i<s.length;i++){var R=s[i],q=R.callback;if(q!==null){if(R.callback=null,R=c,typeof q!="function")throw Error(r(191,q));q.call(R)}}}var Ws={},Jt=Cr(Ws),zs=Cr(Ws),qs=Cr(Ws);function Hr(s){if(s===Ws)throw Error(r(174));return s}function ho(s,i){switch(Ke(qs,i),Ke(zs,s),Ke(Jt,Ws),s=i.nodeType,s){case 9:case 11:i=(i=i.documentElement)?i.namespaceURI:Dr(null,"");break;default:s=s===8?i.parentNode:i,i=s.namespaceURI||null,s=s.tagName,i=Dr(i,s)}Xe(Jt),Ke(Jt,i)}function ds(){Xe(Jt),Xe(zs),Xe(qs)}function El(s){Hr(qs.current);var i=Hr(Jt.current),c=Dr(i,s.type);i!==c&&(Ke(zs,s),Ke(Jt,c))}function fo(s){zs.current===s&&(Xe(Jt),Xe(zs))}var Ze=Cr(0);function Mi(s){for(var i=s;i!==null;){if(i.tag===13){var c=i.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||c.data==="$!"))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!==void 0){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var po=[];function mo(){for(var s=0;s<po.length;s++)po[s]._workInProgressVersionPrimary=null;po.length=0}var Ni=V.ReactCurrentDispatcher,go=V.ReactCurrentBatchConfig,Ur=0,et=null,nt=null,at=null,ji=!1,Vs=!1,Ks=0,oh=0;function pt(){throw Error(r(321))}function vo(s,i){if(i===null)return!1;for(var c=0;c<i.length&&c<s.length;c++)if(!Ht(s[c],i[c]))return!1;return!0}function _o(s,i,c,R,q,K){if(Ur=K,et=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,Ni.current=s===null||s.memoizedState===null?uh:hh,s=c(R,q),Vs){K=0;do{if(Vs=!1,Ks=0,25<=K)throw Error(r(301));K+=1,at=nt=null,i.updateQueue=null,Ni.current=dh,s=c(R,q)}while(Vs)}if(Ni.current=Wi,i=nt!==null&&nt.next!==null,Ur=0,at=nt=et=null,ji=!1,i)throw Error(r(300));return s}function wo(){var s=Ks!==0;return Ks=0,s}function Xt(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return at===null?et.memoizedState=at=s:at=at.next=s,at}function Ot(){if(nt===null){var s=et.alternate;s=s!==null?s.memoizedState:null}else s=nt.next;var i=at===null?et.memoizedState:at.next;if(i!==null)at=i,nt=s;else{if(s===null)throw Error(r(310));nt=s,s={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},at===null?et.memoizedState=at=s:at=at.next=s}return at}function Gs(s,i){return typeof i=="function"?i(s):i}function Co(s){var i=Ot(),c=i.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=s;var R=nt,q=R.baseQueue,K=c.pending;if(K!==null){if(q!==null){var te=q.next;q.next=K.next,K.next=te}R.baseQueue=q=K,c.pending=null}if(q!==null){K=q.next,R=R.baseState;var le=te=null,he=null,ye=K;do{var Le=ye.lane;if((Ur&Le)===Le)he!==null&&(he=he.next={lane:0,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null}),R=ye.hasEagerState?ye.eagerState:s(R,ye.action);else{var Ie={lane:Le,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null};he===null?(le=he=Ie,te=R):he=he.next=Ie,et.lanes|=Le,Wr|=Le}ye=ye.next}while(ye!==null&&ye!==K);he===null?te=R:he.next=le,Ht(R,i.memoizedState)||(bt=!0),i.memoizedState=R,i.baseState=te,i.baseQueue=he,c.lastRenderedState=R}if(s=c.interleaved,s!==null){q=s;do K=q.lane,et.lanes|=K,Wr|=K,q=q.next;while(q!==s)}else q===null&&(c.lanes=0);return[i.memoizedState,c.dispatch]}function yo(s){var i=Ot(),c=i.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=s;var R=c.dispatch,q=c.pending,K=i.memoizedState;if(q!==null){c.pending=null;var te=q=q.next;do K=s(K,te.action),te=te.next;while(te!==q);Ht(K,i.memoizedState)||(bt=!0),i.memoizedState=K,i.baseQueue===null&&(i.baseState=K),c.lastRenderedState=K}return[K,R]}function Rl(){}function kl(s,i){var c=et,R=Ot(),q=i(),K=!Ht(R.memoizedState,q);if(K&&(R.memoizedState=q,bt=!0),R=R.queue,So(Pl.bind(null,c,R,s),[s]),R.getSnapshot!==i||K||at!==null&&at.memoizedState.tag&1){if(c.flags|=2048,Ys(9,Il.bind(null,c,R,q,i),void 0,null),lt===null)throw Error(r(349));(Ur&30)!==0||Ll(c,i,q)}return q}function Ll(s,i,c){s.flags|=16384,s={getSnapshot:i,value:c},i=et.updateQueue,i===null?(i={lastEffect:null,stores:null},et.updateQueue=i,i.stores=[s]):(c=i.stores,c===null?i.stores=[s]:c.push(s))}function Il(s,i,c,R){i.value=c,i.getSnapshot=R,$l(i)&&Tl(s)}function Pl(s,i,c){return c(function(){$l(i)&&Tl(s)})}function $l(s){var i=s.getSnapshot;s=s.value;try{var c=i();return!Ht(s,c)}catch{return!0}}function Tl(s){var i=nr(s,1);i!==null&&Vt(i,s,1,-1)}function Dl(s){var i=Xt();return typeof s=="function"&&(s=s()),i.memoizedState=i.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Gs,lastRenderedState:s},i.queue=s,s=s.dispatch=ch.bind(null,et,s),[i.memoizedState,s]}function Ys(s,i,c,R){return s={tag:s,create:i,destroy:c,deps:R,next:null},i=et.updateQueue,i===null?(i={lastEffect:null,stores:null},et.updateQueue=i,i.lastEffect=s.next=s):(c=i.lastEffect,c===null?i.lastEffect=s.next=s:(R=c.next,c.next=s,s.next=R,i.lastEffect=s)),s}function Bl(){return Ot().memoizedState}function Hi(s,i,c,R){var q=Xt();et.flags|=s,q.memoizedState=Ys(1|i,c,void 0,R===void 0?null:R)}function Ui(s,i,c,R){var q=Ot();R=R===void 0?null:R;var K=void 0;if(nt!==null){var te=nt.memoizedState;if(K=te.destroy,R!==null&&vo(R,te.deps)){q.memoizedState=Ys(i,c,K,R);return}}et.flags|=s,q.memoizedState=Ys(1|i,c,K,R)}function Al(s,i){return Hi(8390656,8,s,i)}function So(s,i){return Ui(2048,8,s,i)}function Ol(s,i){return Ui(4,2,s,i)}function Fl(s,i){return Ui(4,4,s,i)}function Ml(s,i){if(typeof i=="function")return s=s(),i(s),function(){i(null)};if(i!=null)return s=s(),i.current=s,function(){i.current=null}}function Nl(s,i,c){return c=c!=null?c.concat([s]):null,Ui(4,4,Ml.bind(null,i,s),c)}function xo(){}function jl(s,i){var c=Ot();i=i===void 0?null:i;var R=c.memoizedState;return R!==null&&i!==null&&vo(i,R[1])?R[0]:(c.memoizedState=[s,i],s)}function Hl(s,i){var c=Ot();i=i===void 0?null:i;var R=c.memoizedState;return R!==null&&i!==null&&vo(i,R[1])?R[0]:(s=s(),c.memoizedState=[s,i],s)}function Ul(s,i,c){return(Ur&21)===0?(s.baseState&&(s.baseState=!1,bt=!0),s.memoizedState=c):(Ht(c,i)||(c=_a(),et.lanes|=c,Wr|=c,s.baseState=!0),i)}function ah(s,i){var c=qe;qe=c!==0&&4>c?c:4,s(!0);var R=go.transition;go.transition={};try{s(!1),i()}finally{qe=c,go.transition=R}}function Wl(){return Ot().memoizedState}function lh(s,i,c){var R=Lr(s);if(c={lane:R,action:c,hasEagerState:!1,eagerState:null,next:null},zl(s))ql(i,c);else if(c=yl(s,i,c,R),c!==null){var q=wt();Vt(c,s,R,q),Vl(c,i,R)}}function ch(s,i,c){var R=Lr(s),q={lane:R,action:c,hasEagerState:!1,eagerState:null,next:null};if(zl(s))ql(i,q);else{var K=s.alternate;if(s.lanes===0&&(K===null||K.lanes===0)&&(K=i.lastRenderedReducer,K!==null))try{var te=i.lastRenderedState,le=K(te,c);if(q.hasEagerState=!0,q.eagerState=le,Ht(le,te)){var he=i.interleaved;he===null?(q.next=q,co(i)):(q.next=he.next,he.next=q),i.interleaved=q;return}}catch{}finally{}c=yl(s,i,q,R),c!==null&&(q=wt(),Vt(c,s,R,q),Vl(c,i,R))}}function zl(s){var i=s.alternate;return s===et||i!==null&&i===et}function ql(s,i){Vs=ji=!0;var c=s.pending;c===null?i.next=i:(i.next=c.next,c.next=i),s.pending=i}function Vl(s,i,c){if((c&4194240)!==0){var R=i.lanes;R&=s.pendingLanes,c|=R,i.lanes=c,bn(s,c)}}var Wi={readContext:At,useCallback:pt,useContext:pt,useEffect:pt,useImperativeHandle:pt,useInsertionEffect:pt,useLayoutEffect:pt,useMemo:pt,useReducer:pt,useRef:pt,useState:pt,useDebugValue:pt,useDeferredValue:pt,useTransition:pt,useMutableSource:pt,useSyncExternalStore:pt,useId:pt,unstable_isNewReconciler:!1},uh={readContext:At,useCallback:function(s,i){return Xt().memoizedState=[s,i===void 0?null:i],s},useContext:At,useEffect:Al,useImperativeHandle:function(s,i,c){return c=c!=null?c.concat([s]):null,Hi(4194308,4,Ml.bind(null,i,s),c)},useLayoutEffect:function(s,i){return Hi(4194308,4,s,i)},useInsertionEffect:function(s,i){return Hi(4,2,s,i)},useMemo:function(s,i){var c=Xt();return i=i===void 0?null:i,s=s(),c.memoizedState=[s,i],s},useReducer:function(s,i,c){var R=Xt();return i=c!==void 0?c(i):i,R.memoizedState=R.baseState=i,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:i},R.queue=s,s=s.dispatch=lh.bind(null,et,s),[R.memoizedState,s]},useRef:function(s){var i=Xt();return s={current:s},i.memoizedState=s},useState:Dl,useDebugValue:xo,useDeferredValue:function(s){return Xt().memoizedState=s},useTransition:function(){var s=Dl(!1),i=s[0];return s=ah.bind(null,s[1]),Xt().memoizedState=s,[i,s]},useMutableSource:function(){},useSyncExternalStore:function(s,i,c){var R=et,q=Xt();if(Qe){if(c===void 0)throw Error(r(407));c=c()}else{if(c=i(),lt===null)throw Error(r(349));(Ur&30)!==0||Ll(R,i,c)}q.memoizedState=c;var K={value:c,getSnapshot:i};return q.queue=K,Al(Pl.bind(null,R,K,s),[s]),R.flags|=2048,Ys(9,Il.bind(null,R,K,c,i),void 0,null),c},useId:function(){var s=Xt(),i=lt.identifierPrefix;if(Qe){var c=ir,R=sr;c=(R&~(1<<32-jt(R)-1)).toString(32)+c,i=":"+i+"R"+c,c=Ks++,0<c&&(i+="H"+c.toString(32)),i+=":"}else c=oh++,i=":"+i+"r"+c.toString(32)+":";return s.memoizedState=i},unstable_isNewReconciler:!1},hh={readContext:At,useCallback:jl,useContext:At,useEffect:So,useImperativeHandle:Nl,useInsertionEffect:Ol,useLayoutEffect:Fl,useMemo:Hl,useReducer:Co,useRef:Bl,useState:function(){return Co(Gs)},useDebugValue:xo,useDeferredValue:function(s){var i=Ot();return Ul(i,nt.memoizedState,s)},useTransition:function(){var s=Co(Gs)[0],i=Ot().memoizedState;return[s,i]},useMutableSource:Rl,useSyncExternalStore:kl,useId:Wl,unstable_isNewReconciler:!1},dh={readContext:At,useCallback:jl,useContext:At,useEffect:So,useImperativeHandle:Nl,useInsertionEffect:Ol,useLayoutEffect:Fl,useMemo:Hl,useReducer:yo,useRef:Bl,useState:function(){return yo(Gs)},useDebugValue:xo,useDeferredValue:function(s){var i=Ot();return nt===null?i.memoizedState=s:Ul(i,nt.memoizedState,s)},useTransition:function(){var s=yo(Gs)[0],i=Ot().memoizedState;return[s,i]},useMutableSource:Rl,useSyncExternalStore:kl,useId:Wl,unstable_isNewReconciler:!1};function Wt(s,i){if(s&&s.defaultProps){i=re({},i),s=s.defaultProps;for(var c in s)i[c]===void 0&&(i[c]=s[c]);return i}return i}function bo(s,i,c,R){i=s.memoizedState,c=c(R,i),c=c==null?i:re({},i,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var zi={isMounted:function(s){return(s=s._reactInternals)?Ar(s)===s:!1},enqueueSetState:function(s,i,c){s=s._reactInternals;var R=wt(),q=Lr(s),K=or(R,q);K.payload=i,c!=null&&(K.callback=c),i=br(s,K,q),i!==null&&(Vt(i,s,q,R),Oi(i,s,q))},enqueueReplaceState:function(s,i,c){s=s._reactInternals;var R=wt(),q=Lr(s),K=or(R,q);K.tag=1,K.payload=i,c!=null&&(K.callback=c),i=br(s,K,q),i!==null&&(Vt(i,s,q,R),Oi(i,s,q))},enqueueForceUpdate:function(s,i){s=s._reactInternals;var c=wt(),R=Lr(s),q=or(c,R);q.tag=2,i!=null&&(q.callback=i),i=br(s,q,R),i!==null&&(Vt(i,s,R,c),Oi(i,s,R))}};function Kl(s,i,c,R,q,K,te){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(R,K,te):i.prototype&&i.prototype.isPureReactComponent?!As(c,R)||!As(q,K):!0}function Gl(s,i,c){var R=!1,q=yr,K=i.contextType;return typeof K=="object"&&K!==null?K=At(K):(q=xt(i)?Fr:ft.current,R=i.contextTypes,K=(R=R!=null)?ns(s,q):yr),i=new i(c,K),s.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=zi,s.stateNode=i,i._reactInternals=s,R&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=q,s.__reactInternalMemoizedMaskedChildContext=K),i}function Yl(s,i,c,R){s=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(c,R),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(c,R),i.state!==s&&zi.enqueueReplaceState(i,i.state,null)}function Eo(s,i,c,R){var q=s.stateNode;q.props=c,q.state=s.memoizedState,q.refs={},uo(s);var K=i.contextType;typeof K=="object"&&K!==null?q.context=At(K):(K=xt(i)?Fr:ft.current,q.context=ns(s,K)),q.state=s.memoizedState,K=i.getDerivedStateFromProps,typeof K=="function"&&(bo(s,i,K,c),q.state=s.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof q.getSnapshotBeforeUpdate=="function"||typeof q.UNSAFE_componentWillMount!="function"&&typeof q.componentWillMount!="function"||(i=q.state,typeof q.componentWillMount=="function"&&q.componentWillMount(),typeof q.UNSAFE_componentWillMount=="function"&&q.UNSAFE_componentWillMount(),i!==q.state&&zi.enqueueReplaceState(q,q.state,null),Fi(s,c,q,R),q.state=s.memoizedState),typeof q.componentDidMount=="function"&&(s.flags|=4194308)}function fs(s,i){try{var c="",R=i;do c+=xe(R),R=R.return;while(R);var q=c}catch(K){q=`
39
- Error generating stack: `+K.message+`
40
- `+K.stack}return{value:s,source:i,stack:q,digest:null}}function Ro(s,i,c){return{value:s,source:null,stack:c??null,digest:i??null}}function ko(s,i){try{console.error(i.value)}catch(c){setTimeout(function(){throw c})}}var fh=typeof WeakMap=="function"?WeakMap:Map;function Jl(s,i,c){c=or(-1,c),c.tag=3,c.payload={element:null};var R=i.value;return c.callback=function(){Xi||(Xi=!0,Uo=R),ko(s,i)},c}function Xl(s,i,c){c=or(-1,c),c.tag=3;var R=s.type.getDerivedStateFromError;if(typeof R=="function"){var q=i.value;c.payload=function(){return R(q)},c.callback=function(){ko(s,i)}}var K=s.stateNode;return K!==null&&typeof K.componentDidCatch=="function"&&(c.callback=function(){ko(s,i),typeof R!="function"&&(Rr===null?Rr=new Set([this]):Rr.add(this));var te=i.stack;this.componentDidCatch(i.value,{componentStack:te!==null?te:""})}),c}function Ql(s,i,c){var R=s.pingCache;if(R===null){R=s.pingCache=new fh;var q=new Set;R.set(i,q)}else q=R.get(i),q===void 0&&(q=new Set,R.set(i,q));q.has(c)||(q.add(c),s=kh.bind(null,s,i,c),i.then(s,s))}function Zl(s){do{var i;if((i=s.tag===13)&&(i=s.memoizedState,i=i!==null?i.dehydrated!==null:!0),i)return s;s=s.return}while(s!==null);return null}function ec(s,i,c,R,q){return(s.mode&1)===0?(s===i?s.flags|=65536:(s.flags|=128,c.flags|=131072,c.flags&=-52805,c.tag===1&&(c.alternate===null?c.tag=17:(i=or(-1,1),i.tag=2,br(c,i,1))),c.lanes|=1),s):(s.flags|=65536,s.lanes=q,s)}var ph=V.ReactCurrentOwner,bt=!1;function _t(s,i,c,R){i.child=s===null?Cl(i,null,c,R):cs(i,s.child,c,R)}function tc(s,i,c,R,q){c=c.render;var K=i.ref;return hs(i,q),R=_o(s,i,c,R,K,q),c=wo(),s!==null&&!bt?(i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~q,ar(s,i,q)):(Qe&&c&&eo(i),i.flags|=1,_t(s,i,R,q),i.child)}function rc(s,i,c,R,q){if(s===null){var K=c.type;return typeof K=="function"&&!Yo(K)&&K.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(i.tag=15,i.type=K,sc(s,i,K,R,q)):(s=sn(c.type,null,R,i,i.mode,q),s.ref=i.ref,s.return=i,i.child=s)}if(K=s.child,(s.lanes&q)===0){var te=K.memoizedProps;if(c=c.compare,c=c!==null?c:As,c(te,R)&&s.ref===i.ref)return ar(s,i,q)}return i.flags|=1,s=Pr(K,R),s.ref=i.ref,s.return=i,i.child=s}function sc(s,i,c,R,q){if(s!==null){var K=s.memoizedProps;if(As(K,R)&&s.ref===i.ref)if(bt=!1,i.pendingProps=R=K,(s.lanes&q)!==0)(s.flags&131072)!==0&&(bt=!0);else return i.lanes=s.lanes,ar(s,i,q)}return Lo(s,i,c,R,q)}function ic(s,i,c){var R=i.pendingProps,q=R.children,K=s!==null?s.memoizedState:null;if(R.mode==="hidden")if((i.mode&1)===0)i.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ke(ms,Tt),Tt|=c;else{if((c&1073741824)===0)return s=K!==null?K.baseLanes|c:c,i.lanes=i.childLanes=1073741824,i.memoizedState={baseLanes:s,cachePool:null,transitions:null},i.updateQueue=null,Ke(ms,Tt),Tt|=s,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},R=K!==null?K.baseLanes:c,Ke(ms,Tt),Tt|=R}else K!==null?(R=K.baseLanes|c,i.memoizedState=null):R=c,Ke(ms,Tt),Tt|=R;return _t(s,i,q,c),i.child}function nc(s,i){var c=i.ref;(s===null&&c!==null||s!==null&&s.ref!==c)&&(i.flags|=512,i.flags|=2097152)}function Lo(s,i,c,R,q){var K=xt(c)?Fr:ft.current;return K=ns(i,K),hs(i,q),c=_o(s,i,c,R,K,q),R=wo(),s!==null&&!bt?(i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~q,ar(s,i,q)):(Qe&&R&&eo(i),i.flags|=1,_t(s,i,c,q),i.child)}function oc(s,i,c,R,q){if(xt(c)){var K=!0;Li(i)}else K=!1;if(hs(i,q),i.stateNode===null)Vi(s,i),Gl(i,c,R),Eo(i,c,R,q),R=!0;else if(s===null){var te=i.stateNode,le=i.memoizedProps;te.props=le;var he=te.context,ye=c.contextType;typeof ye=="object"&&ye!==null?ye=At(ye):(ye=xt(c)?Fr:ft.current,ye=ns(i,ye));var Le=c.getDerivedStateFromProps,Ie=typeof Le=="function"||typeof te.getSnapshotBeforeUpdate=="function";Ie||typeof te.UNSAFE_componentWillReceiveProps!="function"&&typeof te.componentWillReceiveProps!="function"||(le!==R||he!==ye)&&Yl(i,te,R,ye),xr=!1;var Re=i.memoizedState;te.state=Re,Fi(i,R,te,q),he=i.memoizedState,le!==R||Re!==he||St.current||xr?(typeof Le=="function"&&(bo(i,c,Le,R),he=i.memoizedState),(le=xr||Kl(i,c,le,R,Re,he,ye))?(Ie||typeof te.UNSAFE_componentWillMount!="function"&&typeof te.componentWillMount!="function"||(typeof te.componentWillMount=="function"&&te.componentWillMount(),typeof te.UNSAFE_componentWillMount=="function"&&te.UNSAFE_componentWillMount()),typeof te.componentDidMount=="function"&&(i.flags|=4194308)):(typeof te.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=R,i.memoizedState=he),te.props=R,te.state=he,te.context=ye,R=le):(typeof te.componentDidMount=="function"&&(i.flags|=4194308),R=!1)}else{te=i.stateNode,Sl(s,i),le=i.memoizedProps,ye=i.type===i.elementType?le:Wt(i.type,le),te.props=ye,Ie=i.pendingProps,Re=te.context,he=c.contextType,typeof he=="object"&&he!==null?he=At(he):(he=xt(c)?Fr:ft.current,he=ns(i,he));var De=c.getDerivedStateFromProps;(Le=typeof De=="function"||typeof te.getSnapshotBeforeUpdate=="function")||typeof te.UNSAFE_componentWillReceiveProps!="function"&&typeof te.componentWillReceiveProps!="function"||(le!==Ie||Re!==he)&&Yl(i,te,R,he),xr=!1,Re=i.memoizedState,te.state=Re,Fi(i,R,te,q);var Ae=i.memoizedState;le!==Ie||Re!==Ae||St.current||xr?(typeof De=="function"&&(bo(i,c,De,R),Ae=i.memoizedState),(ye=xr||Kl(i,c,ye,R,Re,Ae,he)||!1)?(Le||typeof te.UNSAFE_componentWillUpdate!="function"&&typeof te.componentWillUpdate!="function"||(typeof te.componentWillUpdate=="function"&&te.componentWillUpdate(R,Ae,he),typeof te.UNSAFE_componentWillUpdate=="function"&&te.UNSAFE_componentWillUpdate(R,Ae,he)),typeof te.componentDidUpdate=="function"&&(i.flags|=4),typeof te.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof te.componentDidUpdate!="function"||le===s.memoizedProps&&Re===s.memoizedState||(i.flags|=4),typeof te.getSnapshotBeforeUpdate!="function"||le===s.memoizedProps&&Re===s.memoizedState||(i.flags|=1024),i.memoizedProps=R,i.memoizedState=Ae),te.props=R,te.state=Ae,te.context=he,R=ye):(typeof te.componentDidUpdate!="function"||le===s.memoizedProps&&Re===s.memoizedState||(i.flags|=4),typeof te.getSnapshotBeforeUpdate!="function"||le===s.memoizedProps&&Re===s.memoizedState||(i.flags|=1024),R=!1)}return Io(s,i,c,R,K,q)}function Io(s,i,c,R,q,K){nc(s,i);var te=(i.flags&128)!==0;if(!R&&!te)return q&&hl(i,c,!1),ar(s,i,K);R=i.stateNode,ph.current=i;var le=te&&typeof c.getDerivedStateFromError!="function"?null:R.render();return i.flags|=1,s!==null&&te?(i.child=cs(i,s.child,null,K),i.child=cs(i,null,le,K)):_t(s,i,le,K),i.memoizedState=R.state,q&&hl(i,c,!0),i.child}function ac(s){var i=s.stateNode;i.pendingContext?cl(s,i.pendingContext,i.pendingContext!==i.context):i.context&&cl(s,i.context,!1),ho(s,i.containerInfo)}function lc(s,i,c,R,q){return ls(),io(q),i.flags|=256,_t(s,i,c,R),i.child}var Po={dehydrated:null,treeContext:null,retryLane:0};function $o(s){return{baseLanes:s,cachePool:null,transitions:null}}function cc(s,i,c){var R=i.pendingProps,q=Ze.current,K=!1,te=(i.flags&128)!==0,le;if((le=te)||(le=s!==null&&s.memoizedState===null?!1:(q&2)!==0),le?(K=!0,i.flags&=-129):(s===null||s.memoizedState!==null)&&(q|=1),Ke(Ze,q&1),s===null)return so(i),s=i.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((i.mode&1)===0?i.lanes=1:s.data==="$!"?i.lanes=8:i.lanes=1073741824,null):(te=R.children,s=R.fallback,K?(R=i.mode,K=i.child,te={mode:"hidden",children:te},(R&1)===0&&K!==null?(K.childLanes=0,K.pendingProps=te):K=nn(te,R,0,null),s=Kr(s,R,c,null),K.return=i,s.return=i,K.sibling=s,i.child=K,i.child.memoizedState=$o(c),i.memoizedState=Po,s):To(i,te));if(q=s.memoizedState,q!==null&&(le=q.dehydrated,le!==null))return mh(s,i,te,R,le,q,c);if(K){K=R.fallback,te=i.mode,q=s.child,le=q.sibling;var he={mode:"hidden",children:R.children};return(te&1)===0&&i.child!==q?(R=i.child,R.childLanes=0,R.pendingProps=he,i.deletions=null):(R=Pr(q,he),R.subtreeFlags=q.subtreeFlags&14680064),le!==null?K=Pr(le,K):(K=Kr(K,te,c,null),K.flags|=2),K.return=i,R.return=i,R.sibling=K,i.child=R,R=K,K=i.child,te=s.child.memoizedState,te=te===null?$o(c):{baseLanes:te.baseLanes|c,cachePool:null,transitions:te.transitions},K.memoizedState=te,K.childLanes=s.childLanes&~c,i.memoizedState=Po,R}return K=s.child,s=K.sibling,R=Pr(K,{mode:"visible",children:R.children}),(i.mode&1)===0&&(R.lanes=c),R.return=i,R.sibling=null,s!==null&&(c=i.deletions,c===null?(i.deletions=[s],i.flags|=16):c.push(s)),i.child=R,i.memoizedState=null,R}function To(s,i){return i=nn({mode:"visible",children:i},s.mode,0,null),i.return=s,s.child=i}function qi(s,i,c,R){return R!==null&&io(R),cs(i,s.child,null,c),s=To(i,i.pendingProps.children),s.flags|=2,i.memoizedState=null,s}function mh(s,i,c,R,q,K,te){if(c)return i.flags&256?(i.flags&=-257,R=Ro(Error(r(422))),qi(s,i,te,R)):i.memoizedState!==null?(i.child=s.child,i.flags|=128,null):(K=R.fallback,q=i.mode,R=nn({mode:"visible",children:R.children},q,0,null),K=Kr(K,q,te,null),K.flags|=2,R.return=i,K.return=i,R.sibling=K,i.child=R,(i.mode&1)!==0&&cs(i,s.child,null,te),i.child.memoizedState=$o(te),i.memoizedState=Po,K);if((i.mode&1)===0)return qi(s,i,te,null);if(q.data==="$!"){if(R=q.nextSibling&&q.nextSibling.dataset,R)var le=R.dgst;return R=le,K=Error(r(419)),R=Ro(K,R,void 0),qi(s,i,te,R)}if(le=(te&s.childLanes)!==0,bt||le){if(R=lt,R!==null){switch(te&-te){case 4:q=2;break;case 16:q=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:q=32;break;case 536870912:q=268435456;break;default:q=0}q=(q&(R.suspendedLanes|te))!==0?0:q,q!==0&&q!==K.retryLane&&(K.retryLane=q,nr(s,q),Vt(R,s,q,-1))}return Go(),R=Ro(Error(r(421))),qi(s,i,te,R)}return q.data==="$?"?(i.flags|=128,i.child=s.child,i=Lh.bind(null,s),q._reactRetry=i,null):(s=K.treeContext,$t=wr(q.nextSibling),Pt=i,Qe=!0,Ut=null,s!==null&&(Dt[Bt++]=sr,Dt[Bt++]=ir,Dt[Bt++]=Mr,sr=s.id,ir=s.overflow,Mr=i),i=To(i,R.children),i.flags|=4096,i)}function uc(s,i,c){s.lanes|=i;var R=s.alternate;R!==null&&(R.lanes|=i),lo(s.return,i,c)}function Do(s,i,c,R,q){var K=s.memoizedState;K===null?s.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:R,tail:c,tailMode:q}:(K.isBackwards=i,K.rendering=null,K.renderingStartTime=0,K.last=R,K.tail=c,K.tailMode=q)}function hc(s,i,c){var R=i.pendingProps,q=R.revealOrder,K=R.tail;if(_t(s,i,R.children,c),R=Ze.current,(R&2)!==0)R=R&1|2,i.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=i.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&uc(s,c,i);else if(s.tag===19)uc(s,c,i);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}R&=1}if(Ke(Ze,R),(i.mode&1)===0)i.memoizedState=null;else switch(q){case"forwards":for(c=i.child,q=null;c!==null;)s=c.alternate,s!==null&&Mi(s)===null&&(q=c),c=c.sibling;c=q,c===null?(q=i.child,i.child=null):(q=c.sibling,c.sibling=null),Do(i,!1,q,c,K);break;case"backwards":for(c=null,q=i.child,i.child=null;q!==null;){if(s=q.alternate,s!==null&&Mi(s)===null){i.child=q;break}s=q.sibling,q.sibling=c,c=q,q=s}Do(i,!0,c,null,K);break;case"together":Do(i,!1,null,null,void 0);break;default:i.memoizedState=null}return i.child}function Vi(s,i){(i.mode&1)===0&&s!==null&&(s.alternate=null,i.alternate=null,i.flags|=2)}function ar(s,i,c){if(s!==null&&(i.dependencies=s.dependencies),Wr|=i.lanes,(c&i.childLanes)===0)return null;if(s!==null&&i.child!==s.child)throw Error(r(153));if(i.child!==null){for(s=i.child,c=Pr(s,s.pendingProps),i.child=c,c.return=i;s.sibling!==null;)s=s.sibling,c=c.sibling=Pr(s,s.pendingProps),c.return=i;c.sibling=null}return i.child}function gh(s,i,c){switch(i.tag){case 3:ac(i),ls();break;case 5:El(i);break;case 1:xt(i.type)&&Li(i);break;case 4:ho(i,i.stateNode.containerInfo);break;case 10:var R=i.type._context,q=i.memoizedProps.value;Ke(Bi,R._currentValue),R._currentValue=q;break;case 13:if(R=i.memoizedState,R!==null)return R.dehydrated!==null?(Ke(Ze,Ze.current&1),i.flags|=128,null):(c&i.child.childLanes)!==0?cc(s,i,c):(Ke(Ze,Ze.current&1),s=ar(s,i,c),s!==null?s.sibling:null);Ke(Ze,Ze.current&1);break;case 19:if(R=(c&i.childLanes)!==0,(s.flags&128)!==0){if(R)return hc(s,i,c);i.flags|=128}if(q=i.memoizedState,q!==null&&(q.rendering=null,q.tail=null,q.lastEffect=null),Ke(Ze,Ze.current),R)break;return null;case 22:case 23:return i.lanes=0,ic(s,i,c)}return ar(s,i,c)}var dc,Bo,fc,pc;dc=function(s,i){for(var c=i.child;c!==null;){if(c.tag===5||c.tag===6)s.appendChild(c.stateNode);else if(c.tag!==4&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===i)break;for(;c.sibling===null;){if(c.return===null||c.return===i)return;c=c.return}c.sibling.return=c.return,c=c.sibling}},Bo=function(){},fc=function(s,i,c,R){var q=s.memoizedProps;if(q!==R){s=i.stateNode,Hr(Jt.current);var K=null;switch(c){case"input":q=Ve(s,q),R=Ve(s,R),K=[];break;case"select":q=re({},q,{value:void 0}),R=re({},R,{value:void 0}),K=[];break;case"textarea":q=ur(s,q),R=ur(s,R),K=[];break;default:typeof q.onClick!="function"&&typeof R.onClick=="function"&&(s.onclick=Ei)}fn(c,R);var te;c=null;for(ye in q)if(!R.hasOwnProperty(ye)&&q.hasOwnProperty(ye)&&q[ye]!=null)if(ye==="style"){var le=q[ye];for(te in le)le.hasOwnProperty(te)&&(c||(c={}),c[te]="")}else ye!=="dangerouslySetInnerHTML"&&ye!=="children"&&ye!=="suppressContentEditableWarning"&&ye!=="suppressHydrationWarning"&&ye!=="autoFocus"&&(o.hasOwnProperty(ye)?K||(K=[]):(K=K||[]).push(ye,null));for(ye in R){var he=R[ye];if(le=q!=null?q[ye]:void 0,R.hasOwnProperty(ye)&&he!==le&&(he!=null||le!=null))if(ye==="style")if(le){for(te in le)!le.hasOwnProperty(te)||he&&he.hasOwnProperty(te)||(c||(c={}),c[te]="");for(te in he)he.hasOwnProperty(te)&&le[te]!==he[te]&&(c||(c={}),c[te]=he[te])}else c||(K||(K=[]),K.push(ye,c)),c=he;else ye==="dangerouslySetInnerHTML"?(he=he?he.__html:void 0,le=le?le.__html:void 0,he!=null&&le!==he&&(K=K||[]).push(ye,he)):ye==="children"?typeof he!="string"&&typeof he!="number"||(K=K||[]).push(ye,""+he):ye!=="suppressContentEditableWarning"&&ye!=="suppressHydrationWarning"&&(o.hasOwnProperty(ye)?(he!=null&&ye==="onScroll"&&Je("scroll",s),K||le===he||(K=[])):(K=K||[]).push(ye,he))}c&&(K=K||[]).push("style",c);var ye=K;(i.updateQueue=ye)&&(i.flags|=4)}},pc=function(s,i,c,R){c!==R&&(i.flags|=4)};function Js(s,i){if(!Qe)switch(s.tailMode){case"hidden":i=s.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var R=null;c!==null;)c.alternate!==null&&(R=c),c=c.sibling;R===null?i||s.tail===null?s.tail=null:s.tail.sibling=null:R.sibling=null}}function mt(s){var i=s.alternate!==null&&s.alternate.child===s.child,c=0,R=0;if(i)for(var q=s.child;q!==null;)c|=q.lanes|q.childLanes,R|=q.subtreeFlags&14680064,R|=q.flags&14680064,q.return=s,q=q.sibling;else for(q=s.child;q!==null;)c|=q.lanes|q.childLanes,R|=q.subtreeFlags,R|=q.flags,q.return=s,q=q.sibling;return s.subtreeFlags|=R,s.childLanes=c,i}function vh(s,i,c){var R=i.pendingProps;switch(to(i),i.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(i),null;case 1:return xt(i.type)&&ki(),mt(i),null;case 3:return R=i.stateNode,ds(),Xe(St),Xe(ft),mo(),R.pendingContext&&(R.context=R.pendingContext,R.pendingContext=null),(s===null||s.child===null)&&(Ti(i)?i.flags|=4:s===null||s.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Ut!==null&&(qo(Ut),Ut=null))),Bo(s,i),mt(i),null;case 5:fo(i);var q=Hr(qs.current);if(c=i.type,s!==null&&i.stateNode!=null)fc(s,i,c,R,q),s.ref!==i.ref&&(i.flags|=512,i.flags|=2097152);else{if(!R){if(i.stateNode===null)throw Error(r(166));return mt(i),null}if(s=Hr(Jt.current),Ti(i)){R=i.stateNode,c=i.type;var K=i.memoizedProps;switch(R[Yt]=i,R[js]=K,s=(i.mode&1)!==0,c){case"dialog":Je("cancel",R),Je("close",R);break;case"iframe":case"object":case"embed":Je("load",R);break;case"video":case"audio":for(q=0;q<Fs.length;q++)Je(Fs[q],R);break;case"source":Je("error",R);break;case"img":case"image":case"link":Je("error",R),Je("load",R);break;case"details":Je("toggle",R);break;case"input":Ge(R,K),Je("invalid",R);break;case"select":R._wrapperState={wasMultiple:!!K.multiple},Je("invalid",R);break;case"textarea":vt(R,K),Je("invalid",R)}fn(c,K),q=null;for(var te in K)if(K.hasOwnProperty(te)){var le=K[te];te==="children"?typeof le=="string"?R.textContent!==le&&(K.suppressHydrationWarning!==!0&&bi(R.textContent,le,s),q=["children",le]):typeof le=="number"&&R.textContent!==""+le&&(K.suppressHydrationWarning!==!0&&bi(R.textContent,le,s),q=["children",""+le]):o.hasOwnProperty(te)&&le!=null&&te==="onScroll"&&Je("scroll",R)}switch(c){case"input":$e(R),cr(R,K,!0);break;case"textarea":$e(R),kt(R);break;case"select":case"option":break;default:typeof K.onClick=="function"&&(R.onclick=Ei)}R=q,i.updateQueue=R,R!==null&&(i.flags|=4)}else{te=q.nodeType===9?q:q.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=dr(c)),s==="http://www.w3.org/1999/xhtml"?c==="script"?(s=te.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof R.is=="string"?s=te.createElement(c,{is:R.is}):(s=te.createElement(c),c==="select"&&(te=s,R.multiple?te.multiple=!0:R.size&&(te.size=R.size))):s=te.createElementNS(s,c),s[Yt]=i,s[js]=R,dc(s,i,!1,!1),i.stateNode=s;e:{switch(te=pn(c,R),c){case"dialog":Je("cancel",s),Je("close",s),q=R;break;case"iframe":case"object":case"embed":Je("load",s),q=R;break;case"video":case"audio":for(q=0;q<Fs.length;q++)Je(Fs[q],s);q=R;break;case"source":Je("error",s),q=R;break;case"img":case"image":case"link":Je("error",s),Je("load",s),q=R;break;case"details":Je("toggle",s),q=R;break;case"input":Ge(s,R),q=Ve(s,R),Je("invalid",s);break;case"option":q=R;break;case"select":s._wrapperState={wasMultiple:!!R.multiple},q=re({},R,{value:void 0}),Je("invalid",s);break;case"textarea":vt(s,R),q=ur(s,R),Je("invalid",s);break;default:q=R}fn(c,q),le=q;for(K in le)if(le.hasOwnProperty(K)){var he=le[K];K==="style"?sa(s,he):K==="dangerouslySetInnerHTML"?(he=he?he.__html:void 0,he!=null&&Br(s,he)):K==="children"?typeof he=="string"?(c!=="textarea"||he!=="")&&yt(s,he):typeof he=="number"&&yt(s,""+he):K!=="suppressContentEditableWarning"&&K!=="suppressHydrationWarning"&&K!=="autoFocus"&&(o.hasOwnProperty(K)?he!=null&&K==="onScroll"&&Je("scroll",s):he!=null&&j(s,K,he,te))}switch(c){case"input":$e(s),cr(s,R,!1);break;case"textarea":$e(s),kt(s);break;case"option":R.value!=null&&s.setAttribute("value",""+se(R.value));break;case"select":s.multiple=!!R.multiple,K=R.value,K!=null?Kt(s,!!R.multiple,K,!1):R.defaultValue!=null&&Kt(s,!!R.multiple,R.defaultValue,!0);break;default:typeof q.onClick=="function"&&(s.onclick=Ei)}switch(c){case"button":case"input":case"select":case"textarea":R=!!R.autoFocus;break e;case"img":R=!0;break e;default:R=!1}}R&&(i.flags|=4)}i.ref!==null&&(i.flags|=512,i.flags|=2097152)}return mt(i),null;case 6:if(s&&i.stateNode!=null)pc(s,i,s.memoizedProps,R);else{if(typeof R!="string"&&i.stateNode===null)throw Error(r(166));if(c=Hr(qs.current),Hr(Jt.current),Ti(i)){if(R=i.stateNode,c=i.memoizedProps,R[Yt]=i,(K=R.nodeValue!==c)&&(s=Pt,s!==null))switch(s.tag){case 3:bi(R.nodeValue,c,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&bi(R.nodeValue,c,(s.mode&1)!==0)}K&&(i.flags|=4)}else R=(c.nodeType===9?c:c.ownerDocument).createTextNode(R),R[Yt]=i,i.stateNode=R}return mt(i),null;case 13:if(Xe(Ze),R=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(Qe&&$t!==null&&(i.mode&1)!==0&&(i.flags&128)===0)vl(),ls(),i.flags|=98560,K=!1;else if(K=Ti(i),R!==null&&R.dehydrated!==null){if(s===null){if(!K)throw Error(r(318));if(K=i.memoizedState,K=K!==null?K.dehydrated:null,!K)throw Error(r(317));K[Yt]=i}else ls(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;mt(i),K=!1}else Ut!==null&&(qo(Ut),Ut=null),K=!0;if(!K)return i.flags&65536?i:null}return(i.flags&128)!==0?(i.lanes=c,i):(R=R!==null,R!==(s!==null&&s.memoizedState!==null)&&R&&(i.child.flags|=8192,(i.mode&1)!==0&&(s===null||(Ze.current&1)!==0?ot===0&&(ot=3):Go())),i.updateQueue!==null&&(i.flags|=4),mt(i),null);case 4:return ds(),Bo(s,i),s===null&&Ms(i.stateNode.containerInfo),mt(i),null;case 10:return ao(i.type._context),mt(i),null;case 17:return xt(i.type)&&ki(),mt(i),null;case 19:if(Xe(Ze),K=i.memoizedState,K===null)return mt(i),null;if(R=(i.flags&128)!==0,te=K.rendering,te===null)if(R)Js(K,!1);else{if(ot!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(te=Mi(s),te!==null){for(i.flags|=128,Js(K,!1),R=te.updateQueue,R!==null&&(i.updateQueue=R,i.flags|=4),i.subtreeFlags=0,R=c,c=i.child;c!==null;)K=c,s=R,K.flags&=14680066,te=K.alternate,te===null?(K.childLanes=0,K.lanes=s,K.child=null,K.subtreeFlags=0,K.memoizedProps=null,K.memoizedState=null,K.updateQueue=null,K.dependencies=null,K.stateNode=null):(K.childLanes=te.childLanes,K.lanes=te.lanes,K.child=te.child,K.subtreeFlags=0,K.deletions=null,K.memoizedProps=te.memoizedProps,K.memoizedState=te.memoizedState,K.updateQueue=te.updateQueue,K.type=te.type,s=te.dependencies,K.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),c=c.sibling;return Ke(Ze,Ze.current&1|2),i.child}s=s.sibling}K.tail!==null&&rt()>gs&&(i.flags|=128,R=!0,Js(K,!1),i.lanes=4194304)}else{if(!R)if(s=Mi(te),s!==null){if(i.flags|=128,R=!0,c=s.updateQueue,c!==null&&(i.updateQueue=c,i.flags|=4),Js(K,!0),K.tail===null&&K.tailMode==="hidden"&&!te.alternate&&!Qe)return mt(i),null}else 2*rt()-K.renderingStartTime>gs&&c!==1073741824&&(i.flags|=128,R=!0,Js(K,!1),i.lanes=4194304);K.isBackwards?(te.sibling=i.child,i.child=te):(c=K.last,c!==null?c.sibling=te:i.child=te,K.last=te)}return K.tail!==null?(i=K.tail,K.rendering=i,K.tail=i.sibling,K.renderingStartTime=rt(),i.sibling=null,c=Ze.current,Ke(Ze,R?c&1|2:c&1),i):(mt(i),null);case 22:case 23:return Ko(),R=i.memoizedState!==null,s!==null&&s.memoizedState!==null!==R&&(i.flags|=8192),R&&(i.mode&1)!==0?(Tt&1073741824)!==0&&(mt(i),i.subtreeFlags&6&&(i.flags|=8192)):mt(i),null;case 24:return null;case 25:return null}throw Error(r(156,i.tag))}function _h(s,i){switch(to(i),i.tag){case 1:return xt(i.type)&&ki(),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return ds(),Xe(St),Xe(ft),mo(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 5:return fo(i),null;case 13:if(Xe(Ze),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(r(340));ls()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return Xe(Ze),null;case 4:return ds(),null;case 10:return ao(i.type._context),null;case 22:case 23:return Ko(),null;case 24:return null;default:return null}}var Ki=!1,gt=!1,wh=typeof WeakSet=="function"?WeakSet:Set,Be=null;function ps(s,i){var c=s.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(R){tt(s,i,R)}else c.current=null}function Ao(s,i,c){try{c()}catch(R){tt(s,i,R)}}var mc=!1;function Ch(s,i){if(Vn=fi,s=Ka(),Mn(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var R=c.getSelection&&c.getSelection();if(R&&R.rangeCount!==0){c=R.anchorNode;var q=R.anchorOffset,K=R.focusNode;R=R.focusOffset;try{c.nodeType,K.nodeType}catch{c=null;break e}var te=0,le=-1,he=-1,ye=0,Le=0,Ie=s,Re=null;t:for(;;){for(var De;Ie!==c||q!==0&&Ie.nodeType!==3||(le=te+q),Ie!==K||R!==0&&Ie.nodeType!==3||(he=te+R),Ie.nodeType===3&&(te+=Ie.nodeValue.length),(De=Ie.firstChild)!==null;)Re=Ie,Ie=De;for(;;){if(Ie===s)break t;if(Re===c&&++ye===q&&(le=te),Re===K&&++Le===R&&(he=te),(De=Ie.nextSibling)!==null)break;Ie=Re,Re=Ie.parentNode}Ie=De}c=le===-1||he===-1?null:{start:le,end:he}}else c=null}c=c||{start:0,end:0}}else c=null;for(Kn={focusedElem:s,selectionRange:c},fi=!1,Be=i;Be!==null;)if(i=Be,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,Be=s;else for(;Be!==null;){i=Be;try{var Ae=i.alternate;if((i.flags&1024)!==0)switch(i.tag){case 0:case 11:case 15:break;case 1:if(Ae!==null){var Oe=Ae.memoizedProps,st=Ae.memoizedState,_e=i.stateNode,pe=_e.getSnapshotBeforeUpdate(i.elementType===i.type?Oe:Wt(i.type,Oe),st);_e.__reactInternalSnapshotBeforeUpdate=pe}break;case 3:var Ce=i.stateNode.containerInfo;Ce.nodeType===1?Ce.textContent="":Ce.nodeType===9&&Ce.documentElement&&Ce.removeChild(Ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Pe){tt(i,i.return,Pe)}if(s=i.sibling,s!==null){s.return=i.return,Be=s;break}Be=i.return}return Ae=mc,mc=!1,Ae}function Xs(s,i,c){var R=i.updateQueue;if(R=R!==null?R.lastEffect:null,R!==null){var q=R=R.next;do{if((q.tag&s)===s){var K=q.destroy;q.destroy=void 0,K!==void 0&&Ao(i,c,K)}q=q.next}while(q!==R)}}function Gi(s,i){if(i=i.updateQueue,i=i!==null?i.lastEffect:null,i!==null){var c=i=i.next;do{if((c.tag&s)===s){var R=c.create;c.destroy=R()}c=c.next}while(c!==i)}}function Oo(s){var i=s.ref;if(i!==null){var c=s.stateNode;switch(s.tag){case 5:s=c;break;default:s=c}typeof i=="function"?i(s):i.current=s}}function gc(s){var i=s.alternate;i!==null&&(s.alternate=null,gc(i)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(i=s.stateNode,i!==null&&(delete i[Yt],delete i[js],delete i[Xn],delete i[rh],delete i[sh])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function vc(s){return s.tag===5||s.tag===3||s.tag===4}function _c(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||vc(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Fo(s,i,c){var R=s.tag;if(R===5||R===6)s=s.stateNode,i?c.nodeType===8?c.parentNode.insertBefore(s,i):c.insertBefore(s,i):(c.nodeType===8?(i=c.parentNode,i.insertBefore(s,c)):(i=c,i.appendChild(s)),c=c._reactRootContainer,c!=null||i.onclick!==null||(i.onclick=Ei));else if(R!==4&&(s=s.child,s!==null))for(Fo(s,i,c),s=s.sibling;s!==null;)Fo(s,i,c),s=s.sibling}function Mo(s,i,c){var R=s.tag;if(R===5||R===6)s=s.stateNode,i?c.insertBefore(s,i):c.appendChild(s);else if(R!==4&&(s=s.child,s!==null))for(Mo(s,i,c),s=s.sibling;s!==null;)Mo(s,i,c),s=s.sibling}var ht=null,zt=!1;function Er(s,i,c){for(c=c.child;c!==null;)wc(s,i,c),c=c.sibling}function wc(s,i,c){if(Gt&&typeof Gt.onCommitFiberUnmount=="function")try{Gt.onCommitFiberUnmount(ai,c)}catch{}switch(c.tag){case 5:gt||ps(c,i);case 6:var R=ht,q=zt;ht=null,Er(s,i,c),ht=R,zt=q,ht!==null&&(zt?(s=ht,c=c.stateNode,s.nodeType===8?s.parentNode.removeChild(c):s.removeChild(c)):ht.removeChild(c.stateNode));break;case 18:ht!==null&&(zt?(s=ht,c=c.stateNode,s.nodeType===8?Jn(s.parentNode,c):s.nodeType===1&&Jn(s,c),Is(s)):Jn(ht,c.stateNode));break;case 4:R=ht,q=zt,ht=c.stateNode.containerInfo,zt=!0,Er(s,i,c),ht=R,zt=q;break;case 0:case 11:case 14:case 15:if(!gt&&(R=c.updateQueue,R!==null&&(R=R.lastEffect,R!==null))){q=R=R.next;do{var K=q,te=K.destroy;K=K.tag,te!==void 0&&((K&2)!==0||(K&4)!==0)&&Ao(c,i,te),q=q.next}while(q!==R)}Er(s,i,c);break;case 1:if(!gt&&(ps(c,i),R=c.stateNode,typeof R.componentWillUnmount=="function"))try{R.props=c.memoizedProps,R.state=c.memoizedState,R.componentWillUnmount()}catch(le){tt(c,i,le)}Er(s,i,c);break;case 21:Er(s,i,c);break;case 22:c.mode&1?(gt=(R=gt)||c.memoizedState!==null,Er(s,i,c),gt=R):Er(s,i,c);break;default:Er(s,i,c)}}function Cc(s){var i=s.updateQueue;if(i!==null){s.updateQueue=null;var c=s.stateNode;c===null&&(c=s.stateNode=new wh),i.forEach(function(R){var q=Ih.bind(null,s,R);c.has(R)||(c.add(R),R.then(q,q))})}}function qt(s,i){var c=i.deletions;if(c!==null)for(var R=0;R<c.length;R++){var q=c[R];try{var K=s,te=i,le=te;e:for(;le!==null;){switch(le.tag){case 5:ht=le.stateNode,zt=!1;break e;case 3:ht=le.stateNode.containerInfo,zt=!0;break e;case 4:ht=le.stateNode.containerInfo,zt=!0;break e}le=le.return}if(ht===null)throw Error(r(160));wc(K,te,q),ht=null,zt=!1;var he=q.alternate;he!==null&&(he.return=null),q.return=null}catch(ye){tt(q,i,ye)}}if(i.subtreeFlags&12854)for(i=i.child;i!==null;)yc(i,s),i=i.sibling}function yc(s,i){var c=s.alternate,R=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(qt(i,s),Qt(s),R&4){try{Xs(3,s,s.return),Gi(3,s)}catch(Oe){tt(s,s.return,Oe)}try{Xs(5,s,s.return)}catch(Oe){tt(s,s.return,Oe)}}break;case 1:qt(i,s),Qt(s),R&512&&c!==null&&ps(c,c.return);break;case 5:if(qt(i,s),Qt(s),R&512&&c!==null&&ps(c,c.return),s.flags&32){var q=s.stateNode;try{yt(q,"")}catch(Oe){tt(s,s.return,Oe)}}if(R&4&&(q=s.stateNode,q!=null)){var K=s.memoizedProps,te=c!==null?c.memoizedProps:K,le=s.type,he=s.updateQueue;if(s.updateQueue=null,he!==null)try{le==="input"&&K.type==="radio"&&K.name!=null&&ut(q,K),pn(le,te);var ye=pn(le,K);for(te=0;te<he.length;te+=2){var Le=he[te],Ie=he[te+1];Le==="style"?sa(q,Ie):Le==="dangerouslySetInnerHTML"?Br(q,Ie):Le==="children"?yt(q,Ie):j(q,Le,Ie,ye)}switch(le){case"input":je(q,K);break;case"textarea":hr(q,K);break;case"select":var Re=q._wrapperState.wasMultiple;q._wrapperState.wasMultiple=!!K.multiple;var De=K.value;De!=null?Kt(q,!!K.multiple,De,!1):Re!==!!K.multiple&&(K.defaultValue!=null?Kt(q,!!K.multiple,K.defaultValue,!0):Kt(q,!!K.multiple,K.multiple?[]:"",!1))}q[js]=K}catch(Oe){tt(s,s.return,Oe)}}break;case 6:if(qt(i,s),Qt(s),R&4){if(s.stateNode===null)throw Error(r(162));q=s.stateNode,K=s.memoizedProps;try{q.nodeValue=K}catch(Oe){tt(s,s.return,Oe)}}break;case 3:if(qt(i,s),Qt(s),R&4&&c!==null&&c.memoizedState.isDehydrated)try{Is(i.containerInfo)}catch(Oe){tt(s,s.return,Oe)}break;case 4:qt(i,s),Qt(s);break;case 13:qt(i,s),Qt(s),q=s.child,q.flags&8192&&(K=q.memoizedState!==null,q.stateNode.isHidden=K,!K||q.alternate!==null&&q.alternate.memoizedState!==null||(Ho=rt())),R&4&&Cc(s);break;case 22:if(Le=c!==null&&c.memoizedState!==null,s.mode&1?(gt=(ye=gt)||Le,qt(i,s),gt=ye):qt(i,s),Qt(s),R&8192){if(ye=s.memoizedState!==null,(s.stateNode.isHidden=ye)&&!Le&&(s.mode&1)!==0)for(Be=s,Le=s.child;Le!==null;){for(Ie=Be=Le;Be!==null;){switch(Re=Be,De=Re.child,Re.tag){case 0:case 11:case 14:case 15:Xs(4,Re,Re.return);break;case 1:ps(Re,Re.return);var Ae=Re.stateNode;if(typeof Ae.componentWillUnmount=="function"){R=Re,c=Re.return;try{i=R,Ae.props=i.memoizedProps,Ae.state=i.memoizedState,Ae.componentWillUnmount()}catch(Oe){tt(R,c,Oe)}}break;case 5:ps(Re,Re.return);break;case 22:if(Re.memoizedState!==null){bc(Ie);continue}}De!==null?(De.return=Re,Be=De):bc(Ie)}Le=Le.sibling}e:for(Le=null,Ie=s;;){if(Ie.tag===5){if(Le===null){Le=Ie;try{q=Ie.stateNode,ye?(K=q.style,typeof K.setProperty=="function"?K.setProperty("display","none","important"):K.display="none"):(le=Ie.stateNode,he=Ie.memoizedProps.style,te=he!=null&&he.hasOwnProperty("display")?he.display:null,le.style.display=si("display",te))}catch(Oe){tt(s,s.return,Oe)}}}else if(Ie.tag===6){if(Le===null)try{Ie.stateNode.nodeValue=ye?"":Ie.memoizedProps}catch(Oe){tt(s,s.return,Oe)}}else if((Ie.tag!==22&&Ie.tag!==23||Ie.memoizedState===null||Ie===s)&&Ie.child!==null){Ie.child.return=Ie,Ie=Ie.child;continue}if(Ie===s)break e;for(;Ie.sibling===null;){if(Ie.return===null||Ie.return===s)break e;Le===Ie&&(Le=null),Ie=Ie.return}Le===Ie&&(Le=null),Ie.sibling.return=Ie.return,Ie=Ie.sibling}}break;case 19:qt(i,s),Qt(s),R&4&&Cc(s);break;case 21:break;default:qt(i,s),Qt(s)}}function Qt(s){var i=s.flags;if(i&2){try{e:{for(var c=s.return;c!==null;){if(vc(c)){var R=c;break e}c=c.return}throw Error(r(160))}switch(R.tag){case 5:var q=R.stateNode;R.flags&32&&(yt(q,""),R.flags&=-33);var K=_c(s);Mo(s,K,q);break;case 3:case 4:var te=R.stateNode.containerInfo,le=_c(s);Fo(s,le,te);break;default:throw Error(r(161))}}catch(he){tt(s,s.return,he)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function yh(s,i,c){Be=s,Sc(s)}function Sc(s,i,c){for(var R=(s.mode&1)!==0;Be!==null;){var q=Be,K=q.child;if(q.tag===22&&R){var te=q.memoizedState!==null||Ki;if(!te){var le=q.alternate,he=le!==null&&le.memoizedState!==null||gt;le=Ki;var ye=gt;if(Ki=te,(gt=he)&&!ye)for(Be=q;Be!==null;)te=Be,he=te.child,te.tag===22&&te.memoizedState!==null?Ec(q):he!==null?(he.return=te,Be=he):Ec(q);for(;K!==null;)Be=K,Sc(K),K=K.sibling;Be=q,Ki=le,gt=ye}xc(s)}else(q.subtreeFlags&8772)!==0&&K!==null?(K.return=q,Be=K):xc(s)}}function xc(s){for(;Be!==null;){var i=Be;if((i.flags&8772)!==0){var c=i.alternate;try{if((i.flags&8772)!==0)switch(i.tag){case 0:case 11:case 15:gt||Gi(5,i);break;case 1:var R=i.stateNode;if(i.flags&4&&!gt)if(c===null)R.componentDidMount();else{var q=i.elementType===i.type?c.memoizedProps:Wt(i.type,c.memoizedProps);R.componentDidUpdate(q,c.memoizedState,R.__reactInternalSnapshotBeforeUpdate)}var K=i.updateQueue;K!==null&&bl(i,K,R);break;case 3:var te=i.updateQueue;if(te!==null){if(c=null,i.child!==null)switch(i.child.tag){case 5:c=i.child.stateNode;break;case 1:c=i.child.stateNode}bl(i,te,c)}break;case 5:var le=i.stateNode;if(c===null&&i.flags&4){c=le;var he=i.memoizedProps;switch(i.type){case"button":case"input":case"select":case"textarea":he.autoFocus&&c.focus();break;case"img":he.src&&(c.src=he.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(i.memoizedState===null){var ye=i.alternate;if(ye!==null){var Le=ye.memoizedState;if(Le!==null){var Ie=Le.dehydrated;Ie!==null&&Is(Ie)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}gt||i.flags&512&&Oo(i)}catch(Re){tt(i,i.return,Re)}}if(i===s){Be=null;break}if(c=i.sibling,c!==null){c.return=i.return,Be=c;break}Be=i.return}}function bc(s){for(;Be!==null;){var i=Be;if(i===s){Be=null;break}var c=i.sibling;if(c!==null){c.return=i.return,Be=c;break}Be=i.return}}function Ec(s){for(;Be!==null;){var i=Be;try{switch(i.tag){case 0:case 11:case 15:var c=i.return;try{Gi(4,i)}catch(he){tt(i,c,he)}break;case 1:var R=i.stateNode;if(typeof R.componentDidMount=="function"){var q=i.return;try{R.componentDidMount()}catch(he){tt(i,q,he)}}var K=i.return;try{Oo(i)}catch(he){tt(i,K,he)}break;case 5:var te=i.return;try{Oo(i)}catch(he){tt(i,te,he)}}}catch(he){tt(i,i.return,he)}if(i===s){Be=null;break}var le=i.sibling;if(le!==null){le.return=i.return,Be=le;break}Be=i.return}}var Sh=Math.ceil,Yi=V.ReactCurrentDispatcher,No=V.ReactCurrentOwner,Ft=V.ReactCurrentBatchConfig,We=0,lt=null,it=null,dt=0,Tt=0,ms=Cr(0),ot=0,Qs=null,Wr=0,Ji=0,jo=0,Zs=null,Et=null,Ho=0,gs=1/0,lr=null,Xi=!1,Uo=null,Rr=null,Qi=!1,kr=null,Zi=0,ei=0,Wo=null,en=-1,tn=0;function wt(){return(We&6)!==0?rt():en!==-1?en:en=rt()}function Lr(s){return(s.mode&1)===0?1:(We&2)!==0&&dt!==0?dt&-dt:nh.transition!==null?(tn===0&&(tn=_a()),tn):(s=qe,s!==0||(s=window.event,s=s===void 0?16:ka(s.type)),s)}function Vt(s,i,c,R){if(50<ei)throw ei=0,Wo=null,Error(r(185));bs(s,c,R),((We&2)===0||s!==lt)&&(s===lt&&((We&2)===0&&(Ji|=c),ot===4&&Ir(s,dt)),Rt(s,R),c===1&&We===0&&(i.mode&1)===0&&(gs=rt()+500,Ii&&Sr()))}function Rt(s,i){var c=s.callbackNode;nu(s,i);var R=ui(s,s===lt?dt:0);if(R===0)c!==null&&ma(c),s.callbackNode=null,s.callbackPriority=0;else if(i=R&-R,s.callbackPriority!==i){if(c!=null&&ma(c),i===1)s.tag===0?ih(kc.bind(null,s)):dl(kc.bind(null,s)),eh(function(){(We&6)===0&&Sr()}),c=null;else{switch(wa(R)){case 1:c=yn;break;case 4:c=ga;break;case 16:c=oi;break;case 536870912:c=va;break;default:c=oi}c=Ac(c,Rc.bind(null,s))}s.callbackPriority=i,s.callbackNode=c}}function Rc(s,i){if(en=-1,tn=0,(We&6)!==0)throw Error(r(327));var c=s.callbackNode;if(vs()&&s.callbackNode!==c)return null;var R=ui(s,s===lt?dt:0);if(R===0)return null;if((R&30)!==0||(R&s.expiredLanes)!==0||i)i=rn(s,R);else{i=R;var q=We;We|=2;var K=Ic();(lt!==s||dt!==i)&&(lr=null,gs=rt()+500,qr(s,i));do try{Eh();break}catch(le){Lc(s,le)}while(!0);oo(),Yi.current=K,We=q,it!==null?i=0:(lt=null,dt=0,i=ot)}if(i!==0){if(i===2&&(q=Sn(s),q!==0&&(R=q,i=zo(s,q))),i===1)throw c=Qs,qr(s,0),Ir(s,R),Rt(s,rt()),c;if(i===6)Ir(s,R);else{if(q=s.current.alternate,(R&30)===0&&!xh(q)&&(i=rn(s,R),i===2&&(K=Sn(s),K!==0&&(R=K,i=zo(s,K))),i===1))throw c=Qs,qr(s,0),Ir(s,R),Rt(s,rt()),c;switch(s.finishedWork=q,s.finishedLanes=R,i){case 0:case 1:throw Error(r(345));case 2:Vr(s,Et,lr);break;case 3:if(Ir(s,R),(R&130023424)===R&&(i=Ho+500-rt(),10<i)){if(ui(s,0)!==0)break;if(q=s.suspendedLanes,(q&R)!==R){wt(),s.pingedLanes|=s.suspendedLanes&q;break}s.timeoutHandle=Yn(Vr.bind(null,s,Et,lr),i);break}Vr(s,Et,lr);break;case 4:if(Ir(s,R),(R&4194240)===R)break;for(i=s.eventTimes,q=-1;0<R;){var te=31-jt(R);K=1<<te,te=i[te],te>q&&(q=te),R&=~K}if(R=q,R=rt()-R,R=(120>R?120:480>R?480:1080>R?1080:1920>R?1920:3e3>R?3e3:4320>R?4320:1960*Sh(R/1960))-R,10<R){s.timeoutHandle=Yn(Vr.bind(null,s,Et,lr),R);break}Vr(s,Et,lr);break;case 5:Vr(s,Et,lr);break;default:throw Error(r(329))}}}return Rt(s,rt()),s.callbackNode===c?Rc.bind(null,s):null}function zo(s,i){var c=Zs;return s.current.memoizedState.isDehydrated&&(qr(s,i).flags|=256),s=rn(s,i),s!==2&&(i=Et,Et=c,i!==null&&qo(i)),s}function qo(s){Et===null?Et=s:Et.push.apply(Et,s)}function xh(s){for(var i=s;;){if(i.flags&16384){var c=i.updateQueue;if(c!==null&&(c=c.stores,c!==null))for(var R=0;R<c.length;R++){var q=c[R],K=q.getSnapshot;q=q.value;try{if(!Ht(K(),q))return!1}catch{return!1}}}if(c=i.child,i.subtreeFlags&16384&&c!==null)c.return=i,i=c;else{if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ir(s,i){for(i&=~jo,i&=~Ji,s.suspendedLanes|=i,s.pingedLanes&=~i,s=s.expirationTimes;0<i;){var c=31-jt(i),R=1<<c;s[c]=-1,i&=~R}}function kc(s){if((We&6)!==0)throw Error(r(327));vs();var i=ui(s,0);if((i&1)===0)return Rt(s,rt()),null;var c=rn(s,i);if(s.tag!==0&&c===2){var R=Sn(s);R!==0&&(i=R,c=zo(s,R))}if(c===1)throw c=Qs,qr(s,0),Ir(s,i),Rt(s,rt()),c;if(c===6)throw Error(r(345));return s.finishedWork=s.current.alternate,s.finishedLanes=i,Vr(s,Et,lr),Rt(s,rt()),null}function Vo(s,i){var c=We;We|=1;try{return s(i)}finally{We=c,We===0&&(gs=rt()+500,Ii&&Sr())}}function zr(s){kr!==null&&kr.tag===0&&(We&6)===0&&vs();var i=We;We|=1;var c=Ft.transition,R=qe;try{if(Ft.transition=null,qe=1,s)return s()}finally{qe=R,Ft.transition=c,We=i,(We&6)===0&&Sr()}}function Ko(){Tt=ms.current,Xe(ms)}function qr(s,i){s.finishedWork=null,s.finishedLanes=0;var c=s.timeoutHandle;if(c!==-1&&(s.timeoutHandle=-1,Zu(c)),it!==null)for(c=it.return;c!==null;){var R=c;switch(to(R),R.tag){case 1:R=R.type.childContextTypes,R!=null&&ki();break;case 3:ds(),Xe(St),Xe(ft),mo();break;case 5:fo(R);break;case 4:ds();break;case 13:Xe(Ze);break;case 19:Xe(Ze);break;case 10:ao(R.type._context);break;case 22:case 23:Ko()}c=c.return}if(lt=s,it=s=Pr(s.current,null),dt=Tt=i,ot=0,Qs=null,jo=Ji=Wr=0,Et=Zs=null,jr!==null){for(i=0;i<jr.length;i++)if(c=jr[i],R=c.interleaved,R!==null){c.interleaved=null;var q=R.next,K=c.pending;if(K!==null){var te=K.next;K.next=q,R.next=te}c.pending=R}jr=null}return s}function Lc(s,i){do{var c=it;try{if(oo(),Ni.current=Wi,ji){for(var R=et.memoizedState;R!==null;){var q=R.queue;q!==null&&(q.pending=null),R=R.next}ji=!1}if(Ur=0,at=nt=et=null,Vs=!1,Ks=0,No.current=null,c===null||c.return===null){ot=1,Qs=i,it=null;break}e:{var K=s,te=c.return,le=c,he=i;if(i=dt,le.flags|=32768,he!==null&&typeof he=="object"&&typeof he.then=="function"){var ye=he,Le=le,Ie=Le.tag;if((Le.mode&1)===0&&(Ie===0||Ie===11||Ie===15)){var Re=Le.alternate;Re?(Le.updateQueue=Re.updateQueue,Le.memoizedState=Re.memoizedState,Le.lanes=Re.lanes):(Le.updateQueue=null,Le.memoizedState=null)}var De=Zl(te);if(De!==null){De.flags&=-257,ec(De,te,le,K,i),De.mode&1&&Ql(K,ye,i),i=De,he=ye;var Ae=i.updateQueue;if(Ae===null){var Oe=new Set;Oe.add(he),i.updateQueue=Oe}else Ae.add(he);break e}else{if((i&1)===0){Ql(K,ye,i),Go();break e}he=Error(r(426))}}else if(Qe&&le.mode&1){var st=Zl(te);if(st!==null){(st.flags&65536)===0&&(st.flags|=256),ec(st,te,le,K,i),io(fs(he,le));break e}}K=he=fs(he,le),ot!==4&&(ot=2),Zs===null?Zs=[K]:Zs.push(K),K=te;do{switch(K.tag){case 3:K.flags|=65536,i&=-i,K.lanes|=i;var _e=Jl(K,he,i);xl(K,_e);break e;case 1:le=he;var pe=K.type,Ce=K.stateNode;if((K.flags&128)===0&&(typeof pe.getDerivedStateFromError=="function"||Ce!==null&&typeof Ce.componentDidCatch=="function"&&(Rr===null||!Rr.has(Ce)))){K.flags|=65536,i&=-i,K.lanes|=i;var Pe=Xl(K,le,i);xl(K,Pe);break e}}K=K.return}while(K!==null)}$c(c)}catch(Fe){i=Fe,it===c&&c!==null&&(it=c=c.return);continue}break}while(!0)}function Ic(){var s=Yi.current;return Yi.current=Wi,s===null?Wi:s}function Go(){(ot===0||ot===3||ot===2)&&(ot=4),lt===null||(Wr&268435455)===0&&(Ji&268435455)===0||Ir(lt,dt)}function rn(s,i){var c=We;We|=2;var R=Ic();(lt!==s||dt!==i)&&(lr=null,qr(s,i));do try{bh();break}catch(q){Lc(s,q)}while(!0);if(oo(),We=c,Yi.current=R,it!==null)throw Error(r(261));return lt=null,dt=0,ot}function bh(){for(;it!==null;)Pc(it)}function Eh(){for(;it!==null&&!Jc();)Pc(it)}function Pc(s){var i=Bc(s.alternate,s,Tt);s.memoizedProps=s.pendingProps,i===null?$c(s):it=i,No.current=null}function $c(s){var i=s;do{var c=i.alternate;if(s=i.return,(i.flags&32768)===0){if(c=vh(c,i,Tt),c!==null){it=c;return}}else{if(c=_h(c,i),c!==null){c.flags&=32767,it=c;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{ot=6,it=null;return}}if(i=i.sibling,i!==null){it=i;return}it=i=s}while(i!==null);ot===0&&(ot=5)}function Vr(s,i,c){var R=qe,q=Ft.transition;try{Ft.transition=null,qe=1,Rh(s,i,c,R)}finally{Ft.transition=q,qe=R}return null}function Rh(s,i,c,R){do vs();while(kr!==null);if((We&6)!==0)throw Error(r(327));c=s.finishedWork;var q=s.finishedLanes;if(c===null)return null;if(s.finishedWork=null,s.finishedLanes=0,c===s.current)throw Error(r(177));s.callbackNode=null,s.callbackPriority=0;var K=c.lanes|c.childLanes;if(ou(s,K),s===lt&&(it=lt=null,dt=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||Qi||(Qi=!0,Ac(oi,function(){return vs(),null})),K=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||K){K=Ft.transition,Ft.transition=null;var te=qe;qe=1;var le=We;We|=4,No.current=null,Ch(s,c),yc(c,s),Vu(Kn),fi=!!Vn,Kn=Vn=null,s.current=c,yh(c),Xc(),We=le,qe=te,Ft.transition=K}else s.current=c;if(Qi&&(Qi=!1,kr=s,Zi=q),K=s.pendingLanes,K===0&&(Rr=null),eu(c.stateNode),Rt(s,rt()),i!==null)for(R=s.onRecoverableError,c=0;c<i.length;c++)q=i[c],R(q.value,{componentStack:q.stack,digest:q.digest});if(Xi)throw Xi=!1,s=Uo,Uo=null,s;return(Zi&1)!==0&&s.tag!==0&&vs(),K=s.pendingLanes,(K&1)!==0?s===Wo?ei++:(ei=0,Wo=s):ei=0,Sr(),null}function vs(){if(kr!==null){var s=wa(Zi),i=Ft.transition,c=qe;try{if(Ft.transition=null,qe=16>s?16:s,kr===null)var R=!1;else{if(s=kr,kr=null,Zi=0,(We&6)!==0)throw Error(r(331));var q=We;for(We|=4,Be=s.current;Be!==null;){var K=Be,te=K.child;if((Be.flags&16)!==0){var le=K.deletions;if(le!==null){for(var he=0;he<le.length;he++){var ye=le[he];for(Be=ye;Be!==null;){var Le=Be;switch(Le.tag){case 0:case 11:case 15:Xs(8,Le,K)}var Ie=Le.child;if(Ie!==null)Ie.return=Le,Be=Ie;else for(;Be!==null;){Le=Be;var Re=Le.sibling,De=Le.return;if(gc(Le),Le===ye){Be=null;break}if(Re!==null){Re.return=De,Be=Re;break}Be=De}}}var Ae=K.alternate;if(Ae!==null){var Oe=Ae.child;if(Oe!==null){Ae.child=null;do{var st=Oe.sibling;Oe.sibling=null,Oe=st}while(Oe!==null)}}Be=K}}if((K.subtreeFlags&2064)!==0&&te!==null)te.return=K,Be=te;else e:for(;Be!==null;){if(K=Be,(K.flags&2048)!==0)switch(K.tag){case 0:case 11:case 15:Xs(9,K,K.return)}var _e=K.sibling;if(_e!==null){_e.return=K.return,Be=_e;break e}Be=K.return}}var pe=s.current;for(Be=pe;Be!==null;){te=Be;var Ce=te.child;if((te.subtreeFlags&2064)!==0&&Ce!==null)Ce.return=te,Be=Ce;else e:for(te=pe;Be!==null;){if(le=Be,(le.flags&2048)!==0)try{switch(le.tag){case 0:case 11:case 15:Gi(9,le)}}catch(Fe){tt(le,le.return,Fe)}if(le===te){Be=null;break e}var Pe=le.sibling;if(Pe!==null){Pe.return=le.return,Be=Pe;break e}Be=le.return}}if(We=q,Sr(),Gt&&typeof Gt.onPostCommitFiberRoot=="function")try{Gt.onPostCommitFiberRoot(ai,s)}catch{}R=!0}return R}finally{qe=c,Ft.transition=i}}return!1}function Tc(s,i,c){i=fs(c,i),i=Jl(s,i,1),s=br(s,i,1),i=wt(),s!==null&&(bs(s,1,i),Rt(s,i))}function tt(s,i,c){if(s.tag===3)Tc(s,s,c);else for(;i!==null;){if(i.tag===3){Tc(i,s,c);break}else if(i.tag===1){var R=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof R.componentDidCatch=="function"&&(Rr===null||!Rr.has(R))){s=fs(c,s),s=Xl(i,s,1),i=br(i,s,1),s=wt(),i!==null&&(bs(i,1,s),Rt(i,s));break}}i=i.return}}function kh(s,i,c){var R=s.pingCache;R!==null&&R.delete(i),i=wt(),s.pingedLanes|=s.suspendedLanes&c,lt===s&&(dt&c)===c&&(ot===4||ot===3&&(dt&130023424)===dt&&500>rt()-Ho?qr(s,0):jo|=c),Rt(s,i)}function Dc(s,i){i===0&&((s.mode&1)===0?i=1:(i=ci,ci<<=1,(ci&130023424)===0&&(ci=4194304)));var c=wt();s=nr(s,i),s!==null&&(bs(s,i,c),Rt(s,c))}function Lh(s){var i=s.memoizedState,c=0;i!==null&&(c=i.retryLane),Dc(s,c)}function Ih(s,i){var c=0;switch(s.tag){case 13:var R=s.stateNode,q=s.memoizedState;q!==null&&(c=q.retryLane);break;case 19:R=s.stateNode;break;default:throw Error(r(314))}R!==null&&R.delete(i),Dc(s,c)}var Bc;Bc=function(s,i,c){if(s!==null)if(s.memoizedProps!==i.pendingProps||St.current)bt=!0;else{if((s.lanes&c)===0&&(i.flags&128)===0)return bt=!1,gh(s,i,c);bt=(s.flags&131072)!==0}else bt=!1,Qe&&(i.flags&1048576)!==0&&fl(i,$i,i.index);switch(i.lanes=0,i.tag){case 2:var R=i.type;Vi(s,i),s=i.pendingProps;var q=ns(i,ft.current);hs(i,c),q=_o(null,i,R,s,q,c);var K=wo();return i.flags|=1,typeof q=="object"&&q!==null&&typeof q.render=="function"&&q.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,xt(R)?(K=!0,Li(i)):K=!1,i.memoizedState=q.state!==null&&q.state!==void 0?q.state:null,uo(i),q.updater=zi,i.stateNode=q,q._reactInternals=i,Eo(i,R,s,c),i=Io(null,i,R,!0,K,c)):(i.tag=0,Qe&&K&&eo(i),_t(null,i,q,c),i=i.child),i;case 16:R=i.elementType;e:{switch(Vi(s,i),s=i.pendingProps,q=R._init,R=q(R._payload),i.type=R,q=i.tag=$h(R),s=Wt(R,s),q){case 0:i=Lo(null,i,R,s,c);break e;case 1:i=oc(null,i,R,s,c);break e;case 11:i=tc(null,i,R,s,c);break e;case 14:i=rc(null,i,R,Wt(R.type,s),c);break e}throw Error(r(306,R,""))}return i;case 0:return R=i.type,q=i.pendingProps,q=i.elementType===R?q:Wt(R,q),Lo(s,i,R,q,c);case 1:return R=i.type,q=i.pendingProps,q=i.elementType===R?q:Wt(R,q),oc(s,i,R,q,c);case 3:e:{if(ac(i),s===null)throw Error(r(387));R=i.pendingProps,K=i.memoizedState,q=K.element,Sl(s,i),Fi(i,R,null,c);var te=i.memoizedState;if(R=te.element,K.isDehydrated)if(K={element:R,isDehydrated:!1,cache:te.cache,pendingSuspenseBoundaries:te.pendingSuspenseBoundaries,transitions:te.transitions},i.updateQueue.baseState=K,i.memoizedState=K,i.flags&256){q=fs(Error(r(423)),i),i=lc(s,i,R,c,q);break e}else if(R!==q){q=fs(Error(r(424)),i),i=lc(s,i,R,c,q);break e}else for($t=wr(i.stateNode.containerInfo.firstChild),Pt=i,Qe=!0,Ut=null,c=Cl(i,null,R,c),i.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(ls(),R===q){i=ar(s,i,c);break e}_t(s,i,R,c)}i=i.child}return i;case 5:return El(i),s===null&&so(i),R=i.type,q=i.pendingProps,K=s!==null?s.memoizedProps:null,te=q.children,Gn(R,q)?te=null:K!==null&&Gn(R,K)&&(i.flags|=32),nc(s,i),_t(s,i,te,c),i.child;case 6:return s===null&&so(i),null;case 13:return cc(s,i,c);case 4:return ho(i,i.stateNode.containerInfo),R=i.pendingProps,s===null?i.child=cs(i,null,R,c):_t(s,i,R,c),i.child;case 11:return R=i.type,q=i.pendingProps,q=i.elementType===R?q:Wt(R,q),tc(s,i,R,q,c);case 7:return _t(s,i,i.pendingProps,c),i.child;case 8:return _t(s,i,i.pendingProps.children,c),i.child;case 12:return _t(s,i,i.pendingProps.children,c),i.child;case 10:e:{if(R=i.type._context,q=i.pendingProps,K=i.memoizedProps,te=q.value,Ke(Bi,R._currentValue),R._currentValue=te,K!==null)if(Ht(K.value,te)){if(K.children===q.children&&!St.current){i=ar(s,i,c);break e}}else for(K=i.child,K!==null&&(K.return=i);K!==null;){var le=K.dependencies;if(le!==null){te=K.child;for(var he=le.firstContext;he!==null;){if(he.context===R){if(K.tag===1){he=or(-1,c&-c),he.tag=2;var ye=K.updateQueue;if(ye!==null){ye=ye.shared;var Le=ye.pending;Le===null?he.next=he:(he.next=Le.next,Le.next=he),ye.pending=he}}K.lanes|=c,he=K.alternate,he!==null&&(he.lanes|=c),lo(K.return,c,i),le.lanes|=c;break}he=he.next}}else if(K.tag===10)te=K.type===i.type?null:K.child;else if(K.tag===18){if(te=K.return,te===null)throw Error(r(341));te.lanes|=c,le=te.alternate,le!==null&&(le.lanes|=c),lo(te,c,i),te=K.sibling}else te=K.child;if(te!==null)te.return=K;else for(te=K;te!==null;){if(te===i){te=null;break}if(K=te.sibling,K!==null){K.return=te.return,te=K;break}te=te.return}K=te}_t(s,i,q.children,c),i=i.child}return i;case 9:return q=i.type,R=i.pendingProps.children,hs(i,c),q=At(q),R=R(q),i.flags|=1,_t(s,i,R,c),i.child;case 14:return R=i.type,q=Wt(R,i.pendingProps),q=Wt(R.type,q),rc(s,i,R,q,c);case 15:return sc(s,i,i.type,i.pendingProps,c);case 17:return R=i.type,q=i.pendingProps,q=i.elementType===R?q:Wt(R,q),Vi(s,i),i.tag=1,xt(R)?(s=!0,Li(i)):s=!1,hs(i,c),Gl(i,R,q),Eo(i,R,q,c),Io(null,i,R,!0,s,c);case 19:return hc(s,i,c);case 22:return ic(s,i,c)}throw Error(r(156,i.tag))};function Ac(s,i){return pa(s,i)}function Ph(s,i,c,R){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=R,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mt(s,i,c,R){return new Ph(s,i,c,R)}function Yo(s){return s=s.prototype,!(!s||!s.isReactComponent)}function $h(s){if(typeof s=="function")return Yo(s)?1:0;if(s!=null){if(s=s.$$typeof,s===ce)return 11;if(s===be)return 14}return 2}function Pr(s,i){var c=s.alternate;return c===null?(c=Mt(s.tag,i,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=i,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&14680064,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,i=s.dependencies,c.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c}function sn(s,i,c,R,q,K){var te=2;if(R=s,typeof s=="function")Yo(s)&&(te=1);else if(typeof s=="string")te=5;else e:switch(s){case X:return Kr(c.children,q,K,i);case G:te=8,q|=8;break;case ee:return s=Mt(12,c,i,q|2),s.elementType=ee,s.lanes=K,s;case oe:return s=Mt(13,c,i,q),s.elementType=oe,s.lanes=K,s;case we:return s=Mt(19,c,i,q),s.elementType=we,s.lanes=K,s;case me:return nn(c,q,K,i);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case ne:te=10;break e;case ae:te=9;break e;case ce:te=11;break e;case be:te=14;break e;case ve:te=16,R=null;break e}throw Error(r(130,s==null?s:typeof s,""))}return i=Mt(te,c,i,q),i.elementType=s,i.type=R,i.lanes=K,i}function Kr(s,i,c,R){return s=Mt(7,s,R,i),s.lanes=c,s}function nn(s,i,c,R){return s=Mt(22,s,R,i),s.elementType=me,s.lanes=c,s.stateNode={isHidden:!1},s}function Jo(s,i,c){return s=Mt(6,s,null,i),s.lanes=c,s}function Xo(s,i,c){return i=Mt(4,s.children!==null?s.children:[],s.key,i),i.lanes=c,i.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},i}function Th(s,i,c,R,q){this.tag=i,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=xn(0),this.expirationTimes=xn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xn(0),this.identifierPrefix=R,this.onRecoverableError=q,this.mutableSourceEagerHydrationData=null}function Qo(s,i,c,R,q,K,te,le,he){return s=new Th(s,i,c,le,he),i===1?(i=1,K===!0&&(i|=8)):i=0,K=Mt(3,null,null,i),s.current=K,K.stateNode=s,K.memoizedState={element:R,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},uo(K),s}function Dh(s,i,c){var R=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:J,key:R==null?null:""+R,children:s,containerInfo:i,implementation:c}}function Oc(s){if(!s)return yr;s=s._reactInternals;e:{if(Ar(s)!==s||s.tag!==1)throw Error(r(170));var i=s;do{switch(i.tag){case 3:i=i.stateNode.context;break e;case 1:if(xt(i.type)){i=i.stateNode.__reactInternalMemoizedMergedChildContext;break e}}i=i.return}while(i!==null);throw Error(r(171))}if(s.tag===1){var c=s.type;if(xt(c))return ul(s,c,i)}return i}function Fc(s,i,c,R,q,K,te,le,he){return s=Qo(c,R,!0,s,q,K,te,le,he),s.context=Oc(null),c=s.current,R=wt(),q=Lr(c),K=or(R,q),K.callback=i??null,br(c,K,q),s.current.lanes=q,bs(s,q,R),Rt(s,R),s}function on(s,i,c,R){var q=i.current,K=wt(),te=Lr(q);return c=Oc(c),i.context===null?i.context=c:i.pendingContext=c,i=or(K,te),i.payload={element:s},R=R===void 0?null:R,R!==null&&(i.callback=R),s=br(q,i,te),s!==null&&(Vt(s,q,te,K),Oi(s,q,te)),te}function an(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function Mc(s,i){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<i?c:i}}function Zo(s,i){Mc(s,i),(s=s.alternate)&&Mc(s,i)}function Bh(){return null}var Nc=typeof reportError=="function"?reportError:function(s){console.error(s)};function ea(s){this._internalRoot=s}ln.prototype.render=ea.prototype.render=function(s){var i=this._internalRoot;if(i===null)throw Error(r(409));on(s,i,null,null)},ln.prototype.unmount=ea.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var i=s.containerInfo;zr(function(){on(null,s,null,null)}),i[tr]=null}};function ln(s){this._internalRoot=s}ln.prototype.unstable_scheduleHydration=function(s){if(s){var i=Sa();s={blockedOn:null,target:s,priority:i};for(var c=0;c<gr.length&&i!==0&&i<gr[c].priority;c++);gr.splice(c,0,s),c===0&&Ea(s)}};function ta(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function cn(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function jc(){}function Ah(s,i,c,R,q){if(q){if(typeof R=="function"){var K=R;R=function(){var ye=an(te);K.call(ye)}}var te=Fc(i,R,s,0,null,!1,!1,"",jc);return s._reactRootContainer=te,s[tr]=te.current,Ms(s.nodeType===8?s.parentNode:s),zr(),te}for(;q=s.lastChild;)s.removeChild(q);if(typeof R=="function"){var le=R;R=function(){var ye=an(he);le.call(ye)}}var he=Qo(s,0,!1,null,null,!1,!1,"",jc);return s._reactRootContainer=he,s[tr]=he.current,Ms(s.nodeType===8?s.parentNode:s),zr(function(){on(i,he,c,R)}),he}function un(s,i,c,R,q){var K=c._reactRootContainer;if(K){var te=K;if(typeof q=="function"){var le=q;q=function(){var he=an(te);le.call(he)}}on(i,te,s,q)}else te=Ah(c,i,s,q,R);return an(te)}Ca=function(s){switch(s.tag){case 3:var i=s.stateNode;if(i.current.memoizedState.isDehydrated){var c=xs(i.pendingLanes);c!==0&&(bn(i,c|1),Rt(i,rt()),(We&6)===0&&(gs=rt()+500,Sr()))}break;case 13:zr(function(){var R=nr(s,1);if(R!==null){var q=wt();Vt(R,s,1,q)}}),Zo(s,1)}},En=function(s){if(s.tag===13){var i=nr(s,134217728);if(i!==null){var c=wt();Vt(i,s,134217728,c)}Zo(s,134217728)}},ya=function(s){if(s.tag===13){var i=Lr(s),c=nr(s,i);if(c!==null){var R=wt();Vt(c,s,i,R)}Zo(s,i)}},Sa=function(){return qe},xa=function(s,i){var c=qe;try{return qe=s,i()}finally{qe=c}},vn=function(s,i,c){switch(i){case"input":if(je(s,c),i=c.name,c.type==="radio"&&i!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll("input[name="+JSON.stringify(""+i)+'][type="radio"]'),i=0;i<c.length;i++){var R=c[i];if(R!==s&&R.form===s.form){var q=Ri(R);if(!q)throw Error(r(90));Te(R),je(R,q)}}}break;case"textarea":hr(s,c);break;case"select":i=c.value,i!=null&&Kt(s,!!c.multiple,i,!1)}},aa=Vo,la=zr;var Oh={usingClientEntryPoint:!1,Events:[Hs,ss,Ri,na,oa,Vo]},ti={findFiberByHostInstance:Or,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Fh={bundleType:ti.bundleType,version:ti.version,rendererPackageName:ti.rendererPackageName,rendererConfig:ti.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:V.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=da(s),s===null?null:s.stateNode},findFiberByHostInstance:ti.findFiberByHostInstance||Bh,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var hn=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!hn.isDisabled&&hn.supportsFiber)try{ai=hn.inject(Fh),Gt=hn}catch{}}return reactDom_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Oh,reactDom_production_min.createPortal=function(s,i){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ta(i))throw Error(r(200));return Dh(s,i,null,c)},reactDom_production_min.createRoot=function(s,i){if(!ta(s))throw Error(r(299));var c=!1,R="",q=Nc;return i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(R=i.identifierPrefix),i.onRecoverableError!==void 0&&(q=i.onRecoverableError)),i=Qo(s,1,!1,null,null,c,!1,R,q),s[tr]=i.current,Ms(s.nodeType===8?s.parentNode:s),new ea(i)},reactDom_production_min.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var i=s._reactInternals;if(i===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=da(i),s=s===null?null:s.stateNode,s},reactDom_production_min.flushSync=function(s){return zr(s)},reactDom_production_min.hydrate=function(s,i,c){if(!cn(i))throw Error(r(200));return un(null,s,i,!0,c)},reactDom_production_min.hydrateRoot=function(s,i,c){if(!ta(s))throw Error(r(405));var R=c!=null&&c.hydratedSources||null,q=!1,K="",te=Nc;if(c!=null&&(c.unstable_strictMode===!0&&(q=!0),c.identifierPrefix!==void 0&&(K=c.identifierPrefix),c.onRecoverableError!==void 0&&(te=c.onRecoverableError)),i=Fc(i,null,s,1,c??null,q,!1,K,te),s[tr]=i.current,Ms(s),R)for(s=0;s<R.length;s++)c=R[s],q=c._getVersion,q=q(c._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[c,q]:i.mutableSourceEagerHydrationData.push(c,q);return new ln(i)},reactDom_production_min.render=function(s,i,c){if(!cn(i))throw Error(r(200));return un(null,s,i,!1,c)},reactDom_production_min.unmountComponentAtNode=function(s){if(!cn(s))throw Error(r(40));return s._reactRootContainer?(zr(function(){un(null,null,s,!1,function(){s._reactRootContainer=null,s[tr]=null})}),!0):!1},reactDom_production_min.unstable_batchedUpdates=Vo,reactDom_production_min.unstable_renderSubtreeIntoContainer=function(s,i,c,R){if(!cn(c))throw Error(r(200));if(s==null||s._reactInternals===void 0)throw Error(r(38));return un(s,i,c,!1,R)},reactDom_production_min.version="18.3.1-next-f1338f8080-20240426",reactDom_production_min}var hasRequiredReactDom;function requireReactDom(){if(hasRequiredReactDom)return reactDom.exports;hasRequiredReactDom=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),reactDom.exports=requireReactDom_production_min(),reactDom.exports}var hasRequiredClient;function requireClient(){if(hasRequiredClient)return client;hasRequiredClient=1;var t=requireReactDom();return client.createRoot=t.createRoot,client.hydrateRoot=t.hydrateRoot,client}var clientExports=requireClient();requireReactDom();/**
41
- * @remix-run/router v1.23.2
42
- *
43
- * Copyright (c) Remix Software Inc.
44
- *
45
- * This source code is licensed under the MIT license found in the
46
- * LICENSE.md file in the root directory of this source tree.
47
- *
48
- * @license MIT
49
- */function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_extends$2.apply(this,arguments)}var Action;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Action||(Action={}));const PopStateEventType="popstate";function createBrowserHistory(t){t===void 0&&(t={});function e(n,o){let{pathname:u,search:h,hash:a}=n.location;return createLocation("",{pathname:u,search:h,hash:a},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function r(n,o){return typeof o=="string"?o:createPath(o)}return getUrlBasedHistory(e,r,null,t)}function invariant(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function warning(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function createKey(){return Math.random().toString(36).substr(2,8)}function getHistoryState(t,e){return{usr:t.state,key:t.key,idx:e}}function createLocation(t,e,r,n){return r===void 0&&(r=null),_extends$2({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?parsePath(e):e,{state:r,key:e&&e.key||n||createKey()})}function createPath(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function parsePath(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function getUrlBasedHistory(t,e,r,n){n===void 0&&(n={});let{window:o=document.defaultView,v5Compat:u=!1}=n,h=o.history,a=Action.Pop,l=null,f=C();f==null&&(f=0,h.replaceState(_extends$2({},h.state,{idx:f}),""));function C(){return(h.state||{idx:null}).idx}function d(){a=Action.Pop;let L=C(),N=L==null?null:L-f;f=L,l&&l({action:a,location:U.location,delta:N})}function P(L,N){a=Action.Push;let x=createLocation(U.location,L,N);f=C()+1;let j=getHistoryState(x,f),V=U.createHref(x);try{h.pushState(j,"",V)}catch(Y){if(Y instanceof DOMException&&Y.name==="DataCloneError")throw Y;o.location.assign(V)}u&&l&&l({action:a,location:U.location,delta:1})}function H(L,N){a=Action.Replace;let x=createLocation(U.location,L,N);f=C();let j=getHistoryState(x,f),V=U.createHref(x);h.replaceState(j,"",V),u&&l&&l({action:a,location:U.location,delta:0})}function W(L){let N=o.location.origin!=="null"?o.location.origin:o.location.href,x=typeof L=="string"?L:createPath(L);return x=x.replace(/ $/,"%20"),invariant(N,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,N)}let U={get action(){return a},get location(){return t(o,h)},listen(L){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(PopStateEventType,d),l=L,()=>{o.removeEventListener(PopStateEventType,d),l=null}},createHref(L){return e(o,L)},createURL:W,encodeLocation(L){let N=W(L);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:P,replace:H,go(L){return h.go(L)}};return U}var ResultType;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(ResultType||(ResultType={}));function matchRoutes(t,e,r){return r===void 0&&(r="/"),matchRoutesImpl(t,e,r)}function matchRoutesImpl(t,e,r,n){let o=typeof e=="string"?parsePath(e):e,u=stripBasename(o.pathname||"/",r);if(u==null)return null;let h=flattenRoutes(t);rankRouteBranches(h);let a=null;for(let l=0;a==null&&l<h.length;++l){let f=decodePath(u);a=matchRouteBranch(h[l],f)}return a}function flattenRoutes(t,e,r,n){e===void 0&&(e=[]),r===void 0&&(r=[]),n===void 0&&(n="");let o=(u,h,a)=>{let l={relativePath:a===void 0?u.path||"":a,caseSensitive:u.caseSensitive===!0,childrenIndex:h,route:u};l.relativePath.startsWith("/")&&(invariant(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let f=joinPaths([n,l.relativePath]),C=r.concat(l);u.children&&u.children.length>0&&(invariant(u.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+f+'".')),flattenRoutes(u.children,e,C,f)),!(u.path==null&&!u.index)&&e.push({path:f,score:computeScore(f,u.index),routesMeta:C})};return t.forEach((u,h)=>{var a;if(u.path===""||!((a=u.path)!=null&&a.includes("?")))o(u,h);else for(let l of explodeOptionalSegments(u.path))o(u,h,l)}),e}function explodeOptionalSegments(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,o=r.endsWith("?"),u=r.replace(/\?$/,"");if(n.length===0)return o?[u,""]:[u];let h=explodeOptionalSegments(n.join("/")),a=[];return a.push(...h.map(l=>l===""?u:[u,l].join("/"))),o&&a.push(...h),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function rankRouteBranches(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:compareIndexes(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const paramRe=/^:[\w-]+$/,dynamicSegmentValue=3,indexRouteValue=2,emptySegmentValue=1,staticSegmentValue=10,splatPenalty=-2,isSplat=t=>t==="*";function computeScore(t,e){let r=t.split("/"),n=r.length;return r.some(isSplat)&&(n+=splatPenalty),e&&(n+=indexRouteValue),r.filter(o=>!isSplat(o)).reduce((o,u)=>o+(paramRe.test(u)?dynamicSegmentValue:u===""?emptySegmentValue:staticSegmentValue),n)}function compareIndexes(t,e){return t.length===e.length&&t.slice(0,-1).every((n,o)=>n===e[o])?t[t.length-1]-e[e.length-1]:0}function matchRouteBranch(t,e,r){let{routesMeta:n}=t,o={},u="/",h=[];for(let a=0;a<n.length;++a){let l=n[a],f=a===n.length-1,C=u==="/"?e:e.slice(u.length)||"/",d=matchPath({path:l.relativePath,caseSensitive:l.caseSensitive,end:f},C),P=l.route;if(!d)return null;Object.assign(o,d.params),h.push({params:o,pathname:joinPaths([u,d.pathname]),pathnameBase:normalizePathname(joinPaths([u,d.pathnameBase])),route:P}),d.pathnameBase!=="/"&&(u=joinPaths([u,d.pathnameBase]))}return h}function matchPath(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=compilePath(t.path,t.caseSensitive,t.end),o=e.match(r);if(!o)return null;let u=o[0],h=u.replace(/(.)\/+$/,"$1"),a=o.slice(1);return{params:n.reduce((f,C,d)=>{let{paramName:P,isOptional:H}=C;if(P==="*"){let U=a[d]||"";h=u.slice(0,u.length-U.length).replace(/(.)\/+$/,"$1")}const W=a[d];return H&&!W?f[P]=void 0:f[P]=(W||"").replace(/%2F/g,"/"),f},{}),pathname:u,pathnameBase:h,pattern:t}}function compilePath(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),warning(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],o="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,a,l)=>(n.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),o+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":t!==""&&t!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,e?void 0:"i"),n]}function decodePath(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return warning(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function stripBasename(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}const ABSOLUTE_URL_REGEX$1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,isAbsoluteUrl=t=>ABSOLUTE_URL_REGEX$1.test(t);function resolvePath(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:o=""}=typeof t=="string"?parsePath(t):t,u;if(r)if(isAbsoluteUrl(r))u=r;else{if(r.includes("//")){let h=r;r=r.replace(/\/\/+/g,"/"),warning(!1,"Pathnames cannot have embedded double slashes - normalizing "+(h+" -> "+r))}r.startsWith("/")?u=resolvePathname(r.substring(1),"/"):u=resolvePathname(r,e)}else u=e;return{pathname:u,search:normalizeSearch(n),hash:normalizeHash(o)}}function resolvePathname(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function getInvalidPathError(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function getPathContributingMatches(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function getResolveToMatches(t,e){let r=getPathContributingMatches(t);return e?r.map((n,o)=>o===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function resolveTo(t,e,r,n){n===void 0&&(n=!1);let o;typeof t=="string"?o=parsePath(t):(o=_extends$2({},t),invariant(!o.pathname||!o.pathname.includes("?"),getInvalidPathError("?","pathname","search",o)),invariant(!o.pathname||!o.pathname.includes("#"),getInvalidPathError("#","pathname","hash",o)),invariant(!o.search||!o.search.includes("#"),getInvalidPathError("#","search","hash",o)));let u=t===""||o.pathname==="",h=u?"/":o.pathname,a;if(h==null)a=r;else{let d=e.length-1;if(!n&&h.startsWith("..")){let P=h.split("/");for(;P[0]==="..";)P.shift(),d-=1;o.pathname=P.join("/")}a=d>=0?e[d]:"/"}let l=resolvePath(o,a),f=h&&h!=="/"&&h.endsWith("/"),C=(u||h===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(f||C)&&(l.pathname+="/"),l}const joinPaths=t=>t.join("/").replace(/\/\/+/g,"/"),normalizePathname=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),normalizeSearch=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,normalizeHash=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function isRouteErrorResponse(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const validMutationMethodsArr=["post","put","patch","delete"];new Set(validMutationMethodsArr);const validRequestMethodsArr=["get",...validMutationMethodsArr];new Set(validRequestMethodsArr);/**
50
- * React Router v6.30.3
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */function _extends$1(){return _extends$1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_extends$1.apply(this,arguments)}const DataRouterContext=reactExports.createContext(null),DataRouterStateContext=reactExports.createContext(null),NavigationContext=reactExports.createContext(null),LocationContext=reactExports.createContext(null),RouteContext=reactExports.createContext({outlet:null,matches:[],isDataRoute:!1}),RouteErrorContext=reactExports.createContext(null);function useHref(t,e){let{relative:r}=e===void 0?{}:e;useInRouterContext()||invariant(!1);let{basename:n,navigator:o}=reactExports.useContext(NavigationContext),{hash:u,pathname:h,search:a}=useResolvedPath(t,{relative:r}),l=h;return n!=="/"&&(l=h==="/"?n:joinPaths([n,h])),o.createHref({pathname:l,search:a,hash:u})}function useInRouterContext(){return reactExports.useContext(LocationContext)!=null}function useLocation(){return useInRouterContext()||invariant(!1),reactExports.useContext(LocationContext).location}function useIsomorphicLayoutEffect(t){reactExports.useContext(NavigationContext).static||reactExports.useLayoutEffect(t)}function useNavigate(){let{isDataRoute:t}=reactExports.useContext(RouteContext);return t?useNavigateStable():useNavigateUnstable()}function useNavigateUnstable(){useInRouterContext()||invariant(!1);let t=reactExports.useContext(DataRouterContext),{basename:e,future:r,navigator:n}=reactExports.useContext(NavigationContext),{matches:o}=reactExports.useContext(RouteContext),{pathname:u}=useLocation(),h=JSON.stringify(getResolveToMatches(o,r.v7_relativeSplatPath)),a=reactExports.useRef(!1);return useIsomorphicLayoutEffect(()=>{a.current=!0}),reactExports.useCallback(function(f,C){if(C===void 0&&(C={}),!a.current)return;if(typeof f=="number"){n.go(f);return}let d=resolveTo(f,JSON.parse(h),u,C.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:joinPaths([e,d.pathname])),(C.replace?n.replace:n.push)(d,C.state,C)},[e,n,h,u,t])}const OutletContext=reactExports.createContext(null);function useOutlet(t){let e=reactExports.useContext(RouteContext).outlet;return e&&reactExports.createElement(OutletContext.Provider,{value:t},e)}function useParams(){let{matches:t}=reactExports.useContext(RouteContext),e=t[t.length-1];return e?e.params:{}}function useResolvedPath(t,e){let{relative:r}=e===void 0?{}:e,{future:n}=reactExports.useContext(NavigationContext),{matches:o}=reactExports.useContext(RouteContext),{pathname:u}=useLocation(),h=JSON.stringify(getResolveToMatches(o,n.v7_relativeSplatPath));return reactExports.useMemo(()=>resolveTo(t,JSON.parse(h),u,r==="path"),[t,h,u,r])}function useRoutes(t,e){return useRoutesImpl(t,e)}function useRoutesImpl(t,e,r,n){useInRouterContext()||invariant(!1);let{navigator:o}=reactExports.useContext(NavigationContext),{matches:u}=reactExports.useContext(RouteContext),h=u[u.length-1],a=h?h.params:{};h&&h.pathname;let l=h?h.pathnameBase:"/";h&&h.route;let f=useLocation(),C;if(e){var d;let L=typeof e=="string"?parsePath(e):e;l==="/"||(d=L.pathname)!=null&&d.startsWith(l)||invariant(!1),C=L}else C=f;let P=C.pathname||"/",H=P;if(l!=="/"){let L=l.replace(/^\//,"").split("/");H="/"+P.replace(/^\//,"").split("/").slice(L.length).join("/")}let W=matchRoutes(t,{pathname:H}),U=_renderMatches(W&&W.map(L=>Object.assign({},L,{params:Object.assign({},a,L.params),pathname:joinPaths([l,o.encodeLocation?o.encodeLocation(L.pathname).pathname:L.pathname]),pathnameBase:L.pathnameBase==="/"?l:joinPaths([l,o.encodeLocation?o.encodeLocation(L.pathnameBase).pathname:L.pathnameBase])})),u,r,n);return e&&U?reactExports.createElement(LocationContext.Provider,{value:{location:_extends$1({pathname:"/",search:"",hash:"",state:null,key:"default"},C),navigationType:Action.Pop}},U):U}function DefaultErrorComponent(){let t=useRouteError(),e=isRouteErrorResponse(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement("h2",null,"Unexpected Application Error!"),reactExports.createElement("h3",{style:{fontStyle:"italic"}},e),r?reactExports.createElement("pre",{style:o},r):null,null)}const defaultErrorElement=reactExports.createElement(DefaultErrorComponent,null);class RenderErrorBoundary extends reactExports.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?reactExports.createElement(RouteContext.Provider,{value:this.props.routeContext},reactExports.createElement(RouteErrorContext.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function RenderedRoute(t){let{routeContext:e,match:r,children:n}=t,o=reactExports.useContext(DataRouterContext);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),reactExports.createElement(RouteContext.Provider,{value:e},n)}function _renderMatches(t,e,r,n){var o;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var u;if(!r)return null;if(r.errors)t=r.matches;else if((u=n)!=null&&u.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let h=t,a=(o=r)==null?void 0:o.errors;if(a!=null){let C=h.findIndex(d=>d.route.id&&(a==null?void 0:a[d.route.id])!==void 0);C>=0||invariant(!1),h=h.slice(0,Math.min(h.length,C+1))}let l=!1,f=-1;if(r&&n&&n.v7_partialHydration)for(let C=0;C<h.length;C++){let d=h[C];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(f=C),d.route.id){let{loaderData:P,errors:H}=r,W=d.route.loader&&P[d.route.id]===void 0&&(!H||H[d.route.id]===void 0);if(d.route.lazy||W){l=!0,f>=0?h=h.slice(0,f+1):h=[h[0]];break}}}return h.reduceRight((C,d,P)=>{let H,W=!1,U=null,L=null;r&&(H=a&&d.route.id?a[d.route.id]:void 0,U=d.route.errorElement||defaultErrorElement,l&&(f<0&&P===0?(warningOnce("route-fallback"),W=!0,L=null):f===P&&(W=!0,L=d.route.hydrateFallbackElement||null)));let N=e.concat(h.slice(0,P+1)),x=()=>{let j;return H?j=U:W?j=L:d.route.Component?j=reactExports.createElement(d.route.Component,null):d.route.element?j=d.route.element:j=C,reactExports.createElement(RenderedRoute,{match:d,routeContext:{outlet:C,matches:N,isDataRoute:r!=null},children:j})};return r&&(d.route.ErrorBoundary||d.route.errorElement||P===0)?reactExports.createElement(RenderErrorBoundary,{location:r.location,revalidation:r.revalidation,component:U,error:H,children:x(),routeContext:{outlet:null,matches:N,isDataRoute:!0}}):x()},null)}var DataRouterHook$1=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(DataRouterHook$1||{}),DataRouterStateHook$1=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(DataRouterStateHook$1||{});function useDataRouterContext$1(t){let e=reactExports.useContext(DataRouterContext);return e||invariant(!1),e}function useDataRouterState(t){let e=reactExports.useContext(DataRouterStateContext);return e||invariant(!1),e}function useRouteContext(t){let e=reactExports.useContext(RouteContext);return e||invariant(!1),e}function useCurrentRouteId(t){let e=useRouteContext(),r=e.matches[e.matches.length-1];return r.route.id||invariant(!1),r.route.id}function useRouteError(){var t;let e=reactExports.useContext(RouteErrorContext),r=useDataRouterState(),n=useCurrentRouteId();return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function useNavigateStable(){let{router:t}=useDataRouterContext$1(DataRouterHook$1.UseNavigateStable),e=useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable),r=reactExports.useRef(!1);return useIsomorphicLayoutEffect(()=>{r.current=!0}),reactExports.useCallback(function(o,u){u===void 0&&(u={}),r.current&&(typeof o=="number"?t.navigate(o):t.navigate(o,_extends$1({fromRouteId:e},u)))},[t,e])}const alreadyWarned$1={};function warningOnce(t,e,r){alreadyWarned$1[t]||(alreadyWarned$1[t]=!0)}function logV6DeprecationWarnings(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Navigate(t){let{to:e,replace:r,state:n,relative:o}=t;useInRouterContext()||invariant(!1);let{future:u,static:h}=reactExports.useContext(NavigationContext),{matches:a}=reactExports.useContext(RouteContext),{pathname:l}=useLocation(),f=useNavigate(),C=resolveTo(e,getResolveToMatches(a,u.v7_relativeSplatPath),l,o==="path"),d=JSON.stringify(C);return reactExports.useEffect(()=>f(JSON.parse(d),{replace:r,state:n,relative:o}),[f,d,o,r,n]),null}function Outlet(t){return useOutlet(t.context)}function Route(t){invariant(!1)}function Router(t){let{basename:e="/",children:r=null,location:n,navigationType:o=Action.Pop,navigator:u,static:h=!1,future:a}=t;useInRouterContext()&&invariant(!1);let l=e.replace(/^\/*/,"/"),f=reactExports.useMemo(()=>({basename:l,navigator:u,static:h,future:_extends$1({v7_relativeSplatPath:!1},a)}),[l,a,u,h]);typeof n=="string"&&(n=parsePath(n));let{pathname:C="/",search:d="",hash:P="",state:H=null,key:W="default"}=n,U=reactExports.useMemo(()=>{let L=stripBasename(C,l);return L==null?null:{location:{pathname:L,search:d,hash:P,state:H,key:W},navigationType:o}},[l,C,d,P,H,W,o]);return U==null?null:reactExports.createElement(NavigationContext.Provider,{value:f},reactExports.createElement(LocationContext.Provider,{children:r,value:U}))}function Routes(t){let{children:e,location:r}=t;return useRoutes(createRoutesFromChildren(e),r)}new Promise(()=>{});function createRoutesFromChildren(t,e){e===void 0&&(e=[]);let r=[];return reactExports.Children.forEach(t,(n,o)=>{if(!reactExports.isValidElement(n))return;let u=[...e,o];if(n.type===reactExports.Fragment){r.push.apply(r,createRoutesFromChildren(n.props.children,u));return}n.type!==Route&&invariant(!1),!n.props.index||!n.props.children||invariant(!1);let h={id:n.props.id||u.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(h.children=createRoutesFromChildren(n.props.children,u)),r.push(h)}),r}/**
59
- * React Router DOM v6.30.3
60
- *
61
- * Copyright (c) Remix Software Inc.
62
- *
63
- * This source code is licensed under the MIT license found in the
64
- * LICENSE.md file in the root directory of this source tree.
65
- *
66
- * @license MIT
67
- */function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_extends.apply(this,arguments)}function _objectWithoutPropertiesLoose(t,e){if(t==null)return{};var r={},n=Object.keys(t),o,u;for(u=0;u<n.length;u++)o=n[u],!(e.indexOf(o)>=0)&&(r[o]=t[o]);return r}function isModifiedEvent(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function shouldProcessLinkClick(t,e){return t.button===0&&(!e||e==="_self")&&!isModifiedEvent(t)}const _excluded=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],_excluded2=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],REACT_ROUTER_VERSION="6";try{window.__reactRouterVersion=REACT_ROUTER_VERSION}catch{}const ViewTransitionContext=reactExports.createContext({isTransitioning:!1}),START_TRANSITION="startTransition",startTransitionImpl=React[START_TRANSITION];function BrowserRouter(t){let{basename:e,children:r,future:n,window:o}=t,u=reactExports.useRef();u.current==null&&(u.current=createBrowserHistory({window:o,v5Compat:!0}));let h=u.current,[a,l]=reactExports.useState({action:h.action,location:h.location}),{v7_startTransition:f}=n||{},C=reactExports.useCallback(d=>{f&&startTransitionImpl?startTransitionImpl(()=>l(d)):l(d)},[l,f]);return reactExports.useLayoutEffect(()=>h.listen(C),[h,C]),reactExports.useEffect(()=>logV6DeprecationWarnings(n),[n]),reactExports.createElement(Router,{basename:e,children:r,location:a.location,navigationType:a.action,navigator:h,future:n})}const isBrowser=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ABSOLUTE_URL_REGEX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Link=reactExports.forwardRef(function(e,r){let{onClick:n,relative:o,reloadDocument:u,replace:h,state:a,target:l,to:f,preventScrollReset:C,viewTransition:d}=e,P=_objectWithoutPropertiesLoose(e,_excluded),{basename:H}=reactExports.useContext(NavigationContext),W,U=!1;if(typeof f=="string"&&ABSOLUTE_URL_REGEX.test(f)&&(W=f,isBrowser))try{let j=new URL(window.location.href),V=f.startsWith("//")?new URL(j.protocol+f):new URL(f),Y=stripBasename(V.pathname,H);V.origin===j.origin&&Y!=null?f=Y+V.search+V.hash:U=!0}catch{}let L=useHref(f,{relative:o}),N=useLinkClickHandler(f,{replace:h,state:a,target:l,preventScrollReset:C,relative:o,viewTransition:d});function x(j){n&&n(j),j.defaultPrevented||N(j)}return reactExports.createElement("a",_extends({},P,{href:W||L,onClick:U||u?n:x,ref:r,target:l}))}),NavLink=reactExports.forwardRef(function(e,r){let{"aria-current":n="page",caseSensitive:o=!1,className:u="",end:h=!1,style:a,to:l,viewTransition:f,children:C}=e,d=_objectWithoutPropertiesLoose(e,_excluded2),P=useResolvedPath(l,{relative:d.relative}),H=useLocation(),W=reactExports.useContext(DataRouterStateContext),{navigator:U,basename:L}=reactExports.useContext(NavigationContext),N=W!=null&&useViewTransitionState(P)&&f===!0,x=U.encodeLocation?U.encodeLocation(P).pathname:P.pathname,j=H.pathname,V=W&&W.navigation&&W.navigation.location?W.navigation.location.pathname:null;o||(j=j.toLowerCase(),V=V?V.toLowerCase():null,x=x.toLowerCase()),V&&L&&(V=stripBasename(V,L)||V);const Y=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let J=j===x||!h&&j.startsWith(x)&&j.charAt(Y)==="/",X=V!=null&&(V===x||!h&&V.startsWith(x)&&V.charAt(x.length)==="/"),G={isActive:J,isPending:X,isTransitioning:N},ee=J?n:void 0,ne;typeof u=="function"?ne=u(G):ne=[u,J?"active":null,X?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let ae=typeof a=="function"?a(G):a;return reactExports.createElement(Link,_extends({},d,{"aria-current":ee,className:ne,ref:r,style:ae,to:l,viewTransition:f}),typeof C=="function"?C(G):C)});var DataRouterHook;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useDataRouterContext(t){let e=reactExports.useContext(DataRouterContext);return e||invariant(!1),e}function useLinkClickHandler(t,e){let{target:r,replace:n,state:o,preventScrollReset:u,relative:h,viewTransition:a}=e===void 0?{}:e,l=useNavigate(),f=useLocation(),C=useResolvedPath(t,{relative:h});return reactExports.useCallback(d=>{if(shouldProcessLinkClick(d,r)){d.preventDefault();let P=n!==void 0?n:createPath(f)===createPath(C);l(t,{replace:P,state:o,preventScrollReset:u,relative:h,viewTransition:a})}},[f,l,C,n,o,r,t,u,h,a])}function useViewTransitionState(t,e){e===void 0&&(e={});let r=reactExports.useContext(ViewTransitionContext);r==null&&invariant(!1);let{basename:n}=useDataRouterContext(DataRouterHook.useViewTransitionState),o=useResolvedPath(t,{relative:e.relative});if(!r.isTransitioning)return!1;let u=stripBasename(r.currentLocation.pathname,n)||r.currentLocation.pathname,h=stripBasename(r.nextLocation.pathname,n)||r.nextLocation.pathname;return matchPath(o.pathname,h)!=null||matchPath(o.pathname,u)!=null}const TOKEN_KEY="qcli_admin_token";function getToken(){return localStorage.getItem(TOKEN_KEY)}function setToken(t){localStorage.setItem(TOKEN_KEY,t)}function clearToken(){localStorage.removeItem(TOKEN_KEY)}async function apiFetch(t,e={}){const r=getToken(),n={"Content-Type":"application/json",...e.headers??{}};r&&(n.Authorization=`Bearer ${r}`),e.body instanceof FormData&&delete n["Content-Type"];const o=await fetch(t,{...e,headers:n});if(o.status===401)throw clearToken(),window.location.href="/qcli/admin/login",new Error("Unauthorized");if(!o.ok){const u=await o.text();throw new Error(u||o.statusText)}return o.json()}async function login(t,e){const r=await apiFetch("/api/v1/qcli/auth/login",{method:"POST",body:JSON.stringify({username:t,password:e})});return setToken(r.token),r}async function getMe(){return apiFetch("/api/v1/qcli/auth/me")}function logout(){clearToken(),window.location.href="/qcli/admin/login"}const AuthContext=reactExports.createContext(null);function AuthProvider({children:t}){const[e,r]=reactExports.useState(null),[n,o]=reactExports.useState(!0),[u,h]=reactExports.useState(null);reactExports.useEffect(()=>{if(!getToken()){o(!1);return}getMe().then(r).catch(()=>r(null)).finally(()=>o(!1))},[]);const a=reactExports.useCallback(async(f,C)=>{h(null);try{const d=await login(f,C);r({username:d.username,authenticatedAt:new Date().toISOString()})}catch(d){throw h(d instanceof Error?d.message:"Login failed"),d}},[]),l=reactExports.useCallback(()=>{r(null),logout()},[]);return jsxRuntimeExports.jsx(AuthContext.Provider,{value:{user:e,loading:n,error:u,login:a,logout:l},children:t})}function useAuth(){const t=reactExports.useContext(AuthContext);if(!t)throw new Error("useAuth must be used within AuthProvider");return t}function getStatus(){return apiFetch("/api/v1/qcli/status")}function getCapabilities(){return apiFetch("/api/v1/qcli/capabilities")}const FeaturesContext=reactExports.createContext(null);function FeaturesProvider({children:t}){const[e,r]=reactExports.useState([]),[n,o]=reactExports.useState(!0);reactExports.useEffect(()=>{getStatus().then(h=>r(h.enabledFeatures??[])).catch(()=>r([])).finally(()=>o(!1))},[]);const u=h=>e.includes(h);return jsxRuntimeExports.jsx(FeaturesContext.Provider,{value:{features:e,loading:n,hasFeature:u},children:t})}function useFeatures(){const t=reactExports.useContext(FeaturesContext);if(!t)throw new Error("useFeatures must be used within FeaturesProvider");return t}const WsContext=reactExports.createContext(null);function WebSocketProvider({children:t}){const[e,r]=reactExports.useState("disconnected"),n=reactExports.useRef(null),o=reactExports.useRef(new Map),u=reactExports.useRef(0),h=reactExports.useRef(),a=reactExports.useCallback(()=>{const f=getToken();if(!f)return;const C=window.location.protocol==="https:"?"wss:":"ws:",d=new WebSocket(`${C}//${window.location.host}/ws/v1/qcli/events?token=${f}`);n.current=d,d.onopen=()=>{r("connected"),u.current=0},d.onmessage=P=>{var H,W;try{const U=JSON.parse(P.data),L=U.type;(H=o.current.get(L))==null||H.forEach(N=>N(U)),o.current.forEach((N,x)=>{x.endsWith("*")&&L.startsWith(x.slice(0,-1))&&N.forEach(j=>j(U))}),(W=o.current.get("*"))==null||W.forEach(N=>N(U))}catch{}},d.onclose=()=>{r("reconnecting");const P=Math.min(1e3*2**u.current,3e4);u.current++,h.current=setTimeout(a,P)},d.onerror=()=>d.close()},[]);reactExports.useEffect(()=>(a(),()=>{var f;clearTimeout(h.current),(f=n.current)==null||f.close()}),[a]);const l=reactExports.useCallback((f,C)=>(o.current.has(f)||o.current.set(f,new Set),o.current.get(f).add(C),()=>{var d;(d=o.current.get(f))==null||d.delete(C)}),[]);return jsxRuntimeExports.jsx(WsContext.Provider,{value:{status:e,subscribe:l},children:t})}function useWebSocket(){const t=reactExports.useContext(WsContext);if(!t)throw new Error("useWebSocket must be used within WebSocketProvider");return t}function LoginPage(){const[t,e]=reactExports.useState(""),[r,n]=reactExports.useState(""),[o,u]=reactExports.useState(!1),[h,a]=reactExports.useState(""),{login:l}=useAuth(),f=useNavigate(),C=async d=>{d.preventDefault(),u(!0),a("");try{await l(t,r),f("/")}catch{a("Invalid credentials")}finally{u(!1)}};return jsxRuntimeExports.jsx("div",{className:"min-h-screen flex items-center justify-center",children:jsxRuntimeExports.jsxs("form",{onSubmit:C,className:"w-full max-w-sm bg-white/[0.04] border border-white/[0.08] rounded-xl p-8 backdrop-blur-sm",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[jsxRuntimeExports.jsx("div",{className:"w-10 h-10 rounded-lg bg-gradient-to-br from-primary-light to-primary flex items-center justify-center text-white font-bold text-lg",children:"Q"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h1",{className:"text-xl font-bold text-white",children:"Qodalis Cli Admin"}),jsxRuntimeExports.jsx("p",{className:"text-xs text-slate-400",children:"Server Administration"})]})]}),h&&jsxRuntimeExports.jsx("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm",children:h}),jsxRuntimeExports.jsx("label",{className:"block text-sm text-slate-400 mb-1",children:"Username"}),jsxRuntimeExports.jsx("input",{type:"text",value:t,onChange:d=>e(d.target.value),className:"w-full mb-4 px-3 py-2 rounded-lg bg-white/[0.06] border border-white/[0.1] text-white placeholder-slate-500 focus:outline-none focus:border-primary-light",placeholder:"admin",autoFocus:!0}),jsxRuntimeExports.jsx("label",{className:"block text-sm text-slate-400 mb-1",children:"Password"}),jsxRuntimeExports.jsx("input",{type:"password",value:r,onChange:d=>n(d.target.value),className:"w-full mb-6 px-3 py-2 rounded-lg bg-white/[0.06] border border-white/[0.1] text-white placeholder-slate-500 focus:outline-none focus:border-primary-light",placeholder:"••••••••"}),jsxRuntimeExports.jsx("button",{type:"submit",disabled:o||!t||!r,className:"w-full py-2.5 rounded-lg bg-primary hover:bg-primary-dark text-white font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:o?"Signing in...":"Sign In"})]})})}function ConnectionStatus(){const{status:t}=useWebSocket(),e={connected:"bg-status-success",disconnected:"bg-status-error",reconnecting:"bg-status-warning"};return jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1.5 mt-2 pl-9",children:[jsxRuntimeExports.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${e[t]}`}),jsxRuntimeExports.jsx("span",{className:"text-[11px] text-slate-500 capitalize",children:t})]})}const navItems=[{path:"/",label:"Overview",icon:"▣"},{path:"/commands",label:"Commands",icon:"⌘"},{path:"/jobs",label:"Jobs",icon:"⏱",feature:"jobs"},{path:"/plugins",label:"Plugins",icon:"⚙"},{path:"/filesystem",label:"Filesystem",icon:"📁",feature:"filesystem"},{path:"/events",label:"Events",icon:"⚡"},{path:"/config",label:"Config",icon:"⚙"},{path:"/logs",label:"Logs",icon:"📜"},{path:"/terminal",label:"Terminal",icon:">"}];function Sidebar(){var u,h;const{user:t,logout:e}=useAuth(),{hasFeature:r,loading:n}=useFeatures(),o=n?navItems.filter(a=>!a.feature):navItems.filter(a=>!a.feature||r(a.feature));return jsxRuntimeExports.jsxs("aside",{className:"w-[220px] flex-shrink-0 bg-black/30 border-r border-white/[0.06] flex flex-col h-screen sticky top-0",children:[jsxRuntimeExports.jsxs("div",{className:"px-4 py-5 border-b border-white/[0.06]",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("div",{className:"w-7 h-7 rounded-lg bg-gradient-to-br from-primary-light to-primary flex items-center justify-center text-white font-bold text-sm",children:"Q"}),jsxRuntimeExports.jsx("span",{className:"font-bold text-white",children:"Qodalis Cli Admin"})]}),jsxRuntimeExports.jsx(ConnectionStatus,{})]}),jsxRuntimeExports.jsx("nav",{className:"flex-1 px-2 py-3 overflow-y-auto",children:o.map(a=>jsxRuntimeExports.jsxs(NavLink,{to:a.path,end:a.path==="/",className:({isActive:l})=>`flex items-center gap-2.5 px-3 py-2 rounded-lg text-sm mb-0.5 transition-colors ${l?"bg-primary/15 text-primary-light":"text-slate-400 hover:text-slate-200 hover:bg-white/[0.04]"}`,children:[jsxRuntimeExports.jsx("span",{className:"w-5 text-center",children:a.icon}),a.label]},a.path))}),jsxRuntimeExports.jsxs("div",{className:"px-4 py-3 border-t border-white/[0.06] flex items-center gap-2",children:[jsxRuntimeExports.jsx("div",{className:"w-7 h-7 rounded-full bg-gradient-to-br from-primary to-purple-500 flex items-center justify-center text-xs text-white font-medium",children:((h=(u=t==null?void 0:t.username)==null?void 0:u[0])==null?void 0:h.toUpperCase())??"A"}),jsxRuntimeExports.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntimeExports.jsx("div",{className:"text-xs text-slate-200 truncate",children:t==null?void 0:t.username}),jsxRuntimeExports.jsx("button",{onClick:e,className:"text-[10px] text-slate-500 hover:text-slate-300",children:"Sign out"})]})]})]})}function DashboardLayout(){return jsxRuntimeExports.jsxs("div",{className:"flex min-h-screen",children:[jsxRuntimeExports.jsx(Sidebar,{}),jsxRuntimeExports.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:jsxRuntimeExports.jsx(Outlet,{})})]})}function StatCard({label:t,value:e,sub:r,subColor:n="text-slate-500"}){return jsxRuntimeExports.jsxs("div",{className:"flex-1 bg-white/[0.04] border border-white/[0.08] rounded-xl p-4",children:[jsxRuntimeExports.jsx("div",{className:"text-[11px] text-slate-500 uppercase tracking-wide",children:t}),jsxRuntimeExports.jsx("div",{className:"text-2xl font-semibold text-white mt-1",children:e}),r&&jsxRuntimeExports.jsx("div",{className:`text-[11px] mt-0.5 ${n}`,children:r})]})}function PageHeader({title:t,subtitle:e,actions:r}){return jsxRuntimeExports.jsxs("div",{className:"px-6 py-4 border-b border-white/[0.06] flex items-center justify-between",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h2",{className:"text-lg font-semibold text-white",children:t}),e&&jsxRuntimeExports.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:e})]}),r&&jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:r})]})}function MonoPanel({lines:t,maxLines:e=500,title:r,className:n=""}){const o=reactExports.useRef(null),[u,h]=reactExports.useState(!0);reactExports.useEffect(()=>{u&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[t,u]);const a=()=>{if(!o.current)return;const{scrollTop:f,scrollHeight:C,clientHeight:d}=o.current;h(C-f-d<40)},l=t.slice(-e);return jsxRuntimeExports.jsxs("div",{className:`bg-white/[0.04] border border-white/[0.08] rounded-xl overflow-hidden ${n}`,children:[r&&jsxRuntimeExports.jsxs("div",{className:"px-4 py-3 border-b border-white/[0.06] flex items-center justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-sm font-medium text-white",children:r}),jsxRuntimeExports.jsx("button",{onClick:()=>h(!u),className:`text-[10px] px-2 py-0.5 rounded ${u?"bg-primary/20 text-primary-light":"bg-white/[0.06] text-slate-400"}`,children:u?"Auto-scroll ON":"Auto-scroll OFF"})]}),jsxRuntimeExports.jsx("div",{ref:o,onScroll:a,className:"overflow-y-auto max-h-80 p-3 font-mono text-xs leading-5 text-slate-300",children:l.map((f,C)=>jsxRuntimeExports.jsx("div",{className:"whitespace-pre-wrap break-all",children:f},C))})]})}function useApi(t,e=[]){const[r,n]=reactExports.useState(null),[o,u]=reactExports.useState(!0),[h,a]=reactExports.useState(null),l=reactExports.useCallback(async()=>{u(!0),a(null);try{const f=await t();n(f)}catch(f){a(f instanceof Error?f.message:"Failed to fetch")}finally{u(!1)}},e);return reactExports.useEffect(()=>{l()},[l]),{data:r,loading:o,error:h,refetch:l}}function getJobs(){return apiFetch("/api/v1/qcli/jobs")}function getJob(t){return apiFetch(`/api/v1/qcli/jobs/${t}`)}function triggerJob(t){return apiFetch(`/api/v1/qcli/jobs/${t}/trigger`,{method:"POST"})}function pauseJob(t){return apiFetch(`/api/v1/qcli/jobs/${t}/pause`,{method:"POST"})}function resumeJob(t){return apiFetch(`/api/v1/qcli/jobs/${t}/resume`,{method:"POST"})}function stopJob(t){return apiFetch(`/api/v1/qcli/jobs/${t}/stop`,{method:"POST"})}function getJobHistory(t,e={}){const r=new URLSearchParams;e.limit!==void 0&&r.set("limit",String(e.limit)),e.offset!==void 0&&r.set("offset",String(e.offset));const n=r.toString();return apiFetch(`/api/v1/qcli/jobs/${t}/history${n?`?${n}`:""}`)}function getJobExecution(t,e){return apiFetch(`/api/v1/qcli/jobs/${t}/history/${e}`)}function formatUptime$1(t){const e=Math.floor(t/86400),r=Math.floor(t%86400/3600),n=Math.floor(t%3600/60);return e>0?`${e}d ${r}h`:r>0?`${r}h ${n}m`:`${n}m`}function formatTimestamp(){return new Date().toISOString().replace("T"," ").slice(0,19)}function OverviewPage(){const{data:t,loading:e}=useApi(getStatus,[]),{data:r,loading:n}=useApi(getCapabilities,[]),{hasFeature:o}=useFeatures(),{data:u}=useApi(o("jobs")?getJobs:()=>Promise.resolve([]),[o("jobs")]),[h,a]=reactExports.useState([]),{subscribe:l}=useWebSocket();reactExports.useEffect(()=>l("*",U=>{const L=U.type??"unknown",N=JSON.stringify(U);a(x=>[...x.slice(-99),`[${formatTimestamp()}] ${L} ${N}`])}),[l]);const f=t?formatUptime$1(t.uptimeSeconds):"—",C=t?String(t.registeredCommands):"—",d=t?String(t.registeredJobs):"—",P=t?String(t.activeWsConnections):"—",H=u?u.slice(0,5):null;return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PageHeader,{title:"Overview",subtitle:"Server health and activity at a glance"}),jsxRuntimeExports.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntimeExports.jsxs("div",{className:"flex gap-4",children:[jsxRuntimeExports.jsx(StatCard,{label:"Uptime",value:f,sub:e?"Loading...":t?`Since ${new Date(t.startedAt).toLocaleString()}`:void 0}),jsxRuntimeExports.jsx(StatCard,{label:"Commands",value:C,sub:"Registered processors"}),o("jobs")&&jsxRuntimeExports.jsx(StatCard,{label:"Active Jobs",value:d,sub:"Registered jobs"}),jsxRuntimeExports.jsx(StatCard,{label:"WS Clients",value:P,sub:"Active connections"})]}),jsxRuntimeExports.jsxs("div",{className:"bg-white/[0.04] border border-white/[0.08] rounded-xl p-5",children:[jsxRuntimeExports.jsx("h3",{className:"text-sm font-semibold text-white mb-3",children:"Server Information"}),n?jsxRuntimeExports.jsx("p",{className:"text-slate-400 text-sm",children:"Loading..."}):r?jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-2 text-sm",children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"OS"}),jsxRuntimeExports.jsx("span",{className:"text-slate-200 font-mono text-xs",children:r.os??(t==null?void 0:t.os)??"—"})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Platform"}),jsxRuntimeExports.jsx("span",{className:"text-slate-200 font-mono text-xs",children:r.platform??(t==null?void 0:t.platform)??"—"})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Shell"}),jsxRuntimeExports.jsx("span",{className:"text-slate-200 font-mono text-xs",children:r.shell??"—"})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Version"}),jsxRuntimeExports.jsx("span",{className:"text-slate-200 font-mono text-xs",children:r.version??(t==null?void 0:t.platformVersion)??"—"})]}),t&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Memory"}),jsxRuntimeExports.jsxs("span",{className:"text-slate-200 font-mono text-xs",children:[t.memoryUsageMb.toFixed(1)," MB"]})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Shell Sessions"}),jsxRuntimeExports.jsx("span",{className:"text-slate-200 font-mono text-xs",children:t.activeShellSessions})]})]})]}):jsxRuntimeExports.jsx("p",{className:"text-slate-400 text-sm",children:"Unable to load server info."})]}),o("jobs")&&jsxRuntimeExports.jsxs("div",{className:"bg-white/[0.04] border border-white/[0.08] rounded-xl overflow-hidden",children:[jsxRuntimeExports.jsxs("div",{className:"px-4 py-3 border-b border-white/[0.06] flex items-center justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-sm font-medium text-white",children:"Recent Jobs"}),jsxRuntimeExports.jsx("a",{href:"jobs",className:"text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:"View all"})]}),H===null?jsxRuntimeExports.jsx("div",{className:"px-4 py-4 text-sm text-slate-400",children:"No job data available."}):H.length===0?jsxRuntimeExports.jsx("div",{className:"px-4 py-4 text-sm text-slate-400",children:"No jobs registered."}):jsxRuntimeExports.jsxs("table",{className:"w-full text-sm",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{className:"text-[11px] text-slate-500 uppercase tracking-wide border-b border-white/[0.04]",children:[jsxRuntimeExports.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Name"}),jsxRuntimeExports.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Group"}),jsxRuntimeExports.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Status"}),jsxRuntimeExports.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Last Run"}),jsxRuntimeExports.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Next Run"})]})}),jsxRuntimeExports.jsx("tbody",{children:H.map(W=>jsxRuntimeExports.jsxs("tr",{className:"border-b border-white/[0.03] hover:bg-white/[0.02] transition-colors",children:[jsxRuntimeExports.jsx("td",{className:"px-4 py-2 text-slate-200",children:W.name}),jsxRuntimeExports.jsx("td",{className:"px-4 py-2 text-slate-400",children:W.group}),jsxRuntimeExports.jsx("td",{className:"px-4 py-2",children:jsxRuntimeExports.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium ${W.status==="active"||W.status==="running"?"bg-green-500/20 text-green-400":W.status==="paused"?"bg-amber-500/20 text-amber-400":W.status==="stopped"||W.status==="failed"?"bg-red-500/20 text-red-400":"bg-slate-500/20 text-slate-400"}`,children:W.status})}),jsxRuntimeExports.jsx("td",{className:"px-4 py-2 text-slate-400 text-xs font-mono",children:W.lastRun?new Date(W.lastRun).toLocaleString():"—"}),jsxRuntimeExports.jsx("td",{className:"px-4 py-2 text-slate-400 text-xs font-mono",children:W.nextRun?new Date(W.nextRun).toLocaleString():"—"})]},W.id))})]})]}),jsxRuntimeExports.jsx(MonoPanel,{title:"Live Events",lines:h.length>0?h:["Waiting for events..."],maxLines:100})]})]})}function getCommands(){return apiFetch("/api/v1/qcli/commands")}function ParamRow({param:t}){return jsxRuntimeExports.jsxs("tr",{className:"border-b border-white/[0.03] last:border-0",children:[jsxRuntimeExports.jsx("td",{className:"px-3 py-1.5 font-mono text-xs text-indigo-300",children:t.name}),jsxRuntimeExports.jsx("td",{className:"px-3 py-1.5 text-xs text-slate-400",children:t.type}),jsxRuntimeExports.jsx("td",{className:"px-3 py-1.5 text-xs text-slate-400",children:t.description}),jsxRuntimeExports.jsx("td",{className:"px-3 py-1.5 text-xs",children:t.required?jsxRuntimeExports.jsx("span",{className:"text-red-400 font-medium",children:"Yes"}):jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"No"})})]})}function CommandRow({cmd:t,depth:e=0}){var h,a;const[r,n]=reactExports.useState(!1),o=t.parameters&&t.parameters.length>0||t.processors&&t.processors.length>0,u=e*16;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("tr",{className:`border-b border-white/[0.04] last:border-0 ${o?"cursor-pointer hover:bg-white/[0.04]":""}`,onClick:()=>o&&n(!r),children:[jsxRuntimeExports.jsx("td",{className:"px-4 py-3",children:jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:`${u}px`},children:[o&&jsxRuntimeExports.jsx("span",{className:`text-slate-500 transition-transform text-xs ${r?"rotate-90":""}`,children:"▶"}),jsxRuntimeExports.jsx("span",{className:"font-mono text-sm text-indigo-300",children:t.command})]})}),jsxRuntimeExports.jsx("td",{className:"px-4 py-3 text-sm text-slate-400",children:t.description||"—"}),jsxRuntimeExports.jsx("td",{className:"px-4 py-3 text-xs text-slate-500 font-mono",children:((h=t.metadata)==null?void 0:h.module)??"—"}),jsxRuntimeExports.jsx("td",{className:"px-4 py-3 text-xs text-slate-500 text-center",children:((a=t.parameters)==null?void 0:a.length)??0})]}),r&&o&&jsxRuntimeExports.jsx("tr",{className:"border-b border-white/[0.04]",children:jsxRuntimeExports.jsxs("td",{colSpan:4,className:"px-4 py-3 bg-white/[0.02]",children:[t.parameters&&t.parameters.length>0&&jsxRuntimeExports.jsxs("div",{className:"mb-3",children:[jsxRuntimeExports.jsx("div",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-medium mb-1.5",children:"Parameters"}),jsxRuntimeExports.jsx("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-lg overflow-hidden",children:jsxRuntimeExports.jsxs("table",{className:"w-full",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{className:"border-b border-white/[0.06]",children:[jsxRuntimeExports.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-slate-500 uppercase tracking-wide font-medium",children:"Name"}),jsxRuntimeExports.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-slate-500 uppercase tracking-wide font-medium",children:"Type"}),jsxRuntimeExports.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-slate-500 uppercase tracking-wide font-medium",children:"Description"}),jsxRuntimeExports.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-slate-500 uppercase tracking-wide font-medium",children:"Required"})]})}),jsxRuntimeExports.jsx("tbody",{children:t.parameters.map(l=>jsxRuntimeExports.jsx(ParamRow,{param:l},l.name))})]})})]}),t.processors&&t.processors.length>0&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-medium mb-1.5",children:"Sub-commands"}),jsxRuntimeExports.jsx("div",{className:"bg-white/[0.03] border border-white/[0.06] rounded-lg overflow-hidden",children:jsxRuntimeExports.jsxs("table",{className:"w-full",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{className:"border-b border-white/[0.06]",children:[jsxRuntimeExports.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-slate-500 uppercase tracking-wide font-medium",children:"Command"}),jsxRuntimeExports.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-slate-500 uppercase tracking-wide font-medium",children:"Description"}),jsxRuntimeExports.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-slate-500 uppercase tracking-wide font-medium",children:"Module"}),jsxRuntimeExports.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-slate-500 uppercase tracking-wide font-medium text-center",children:"Params"})]})}),jsxRuntimeExports.jsx("tbody",{children:t.processors.map(l=>jsxRuntimeExports.jsx(CommandRow,{cmd:l,depth:1},l.command))})]})})]})]})})]})}function CommandsPage(){const{data:t,loading:e,error:r,refetch:n}=useApi(getCommands,[]),[o,u]=reactExports.useState(""),h=t?t.filter(a=>a.command.toLowerCase().includes(o.toLowerCase())||(a.description??"").toLowerCase().includes(o.toLowerCase())):[];return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PageHeader,{title:"Commands",subtitle:t?`${t.length} registered processors`:"Loading...",actions:jsxRuntimeExports.jsx("button",{onClick:n,className:"px-3 py-1.5 text-xs bg-white/[0.06] hover:bg-white/[0.1] text-slate-300 rounded-lg transition-colors",children:"Refresh"})}),jsxRuntimeExports.jsxs("div",{className:"p-6 space-y-4",children:[jsxRuntimeExports.jsx("input",{type:"text",placeholder:"Search commands...",value:o,onChange:a=>u(a.target.value),className:"w-full max-w-sm px-3 py-2 text-sm bg-white/[0.06] border border-white/[0.1] rounded-lg text-slate-200 placeholder-slate-500 focus:outline-none focus:border-indigo-500/50"}),e&&jsxRuntimeExports.jsx("div",{className:"text-slate-400 text-sm",children:"Loading commands..."}),r&&jsxRuntimeExports.jsxs("div",{className:"text-red-400 text-sm",children:["Error: ",r]}),!e&&!r&&jsxRuntimeExports.jsxs("div",{className:"bg-white/[0.04] border border-white/[0.08] rounded-xl overflow-hidden",children:[jsxRuntimeExports.jsxs("table",{className:"w-full text-sm",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{className:"border-b border-white/[0.06]",children:[jsxRuntimeExports.jsx("th",{className:"px-4 py-3 text-left text-xs text-slate-500 font-medium uppercase tracking-wide",children:"Command"}),jsxRuntimeExports.jsx("th",{className:"px-4 py-3 text-left text-xs text-slate-500 font-medium uppercase tracking-wide",children:"Description"}),jsxRuntimeExports.jsx("th",{className:"px-4 py-3 text-left text-xs text-slate-500 font-medium uppercase tracking-wide",children:"Module"}),jsxRuntimeExports.jsx("th",{className:"px-4 py-3 text-center text-xs text-slate-500 font-medium uppercase tracking-wide",children:"Params"})]})}),jsxRuntimeExports.jsx("tbody",{children:h.map(a=>jsxRuntimeExports.jsx(CommandRow,{cmd:a},a.command))})]}),h.length===0&&jsxRuntimeExports.jsx("div",{className:"px-4 py-8 text-center text-slate-500 text-sm",children:o?"No commands match your search.":"No commands registered."})]})]})]})}const variants={success:"bg-status-success/15 text-status-success border-status-success/30",warning:"bg-status-warning/15 text-status-warning border-status-warning/30",error:"bg-status-error/15 text-status-error border-status-error/30",info:"bg-status-info/15 text-status-info border-status-info/30",neutral:"bg-slate-500/15 text-slate-400 border-slate-500/30"};function Badge({variant:t,children:e,dot:r}){return jsxRuntimeExports.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[11px] font-medium border ${variants[t]}`,children:[r&&jsxRuntimeExports.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current"}),e]})}function DataTable({columns:t,data:e,onRowClick:r,keyExtractor:n}){return jsxRuntimeExports.jsxs("div",{className:"bg-white/[0.04] border border-white/[0.08] rounded-xl overflow-hidden",children:[jsxRuntimeExports.jsxs("table",{className:"w-full text-sm",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsx("tr",{className:"border-b border-white/[0.06]",children:t.map(o=>jsxRuntimeExports.jsx("th",{className:`px-4 py-3 text-left text-xs text-slate-500 font-medium uppercase tracking-wide ${o.className??""}`,children:o.header},o.key))})}),jsxRuntimeExports.jsx("tbody",{children:e.map(o=>jsxRuntimeExports.jsx("tr",{onClick:()=>r==null?void 0:r(o),className:`border-b border-white/[0.04] last:border-0 ${r?"cursor-pointer hover:bg-white/[0.04]":""}`,children:t.map(u=>jsxRuntimeExports.jsx("td",{className:`px-4 py-3 text-slate-300 ${u.className??""}`,children:u.render?u.render(o):String(o[u.key]??"")},u.key))},n(o)))})]}),e.length===0&&jsxRuntimeExports.jsx("div",{className:"px-4 py-8 text-center text-slate-500 text-sm",children:"No data"})]})}function jobStatusVariant$1(t){switch(t){case"active":case"running":return"success";case"paused":return"warning";case"stopped":case"failed":return"error";case"scheduled":return"info";default:return"neutral"}}function formatDate$1(t){return t?new Date(t).toLocaleString():"—"}function JobsPage(){const t=useNavigate(),{data:e,loading:r,error:n,refetch:o}=useApi(getJobs,[]),[u,h]=reactExports.useState([]),[a,l]=reactExports.useState(null),{subscribe:f}=useWebSocket();reactExports.useEffect(()=>{e&&h(e)},[e]),reactExports.useEffect(()=>f("job:*",H=>{const W=H.jobId,U=H.status;W&&U&&h(L=>L.map(N=>N.id===W?{...N,status:U}:N))}),[f]);async function C(P,H,W){P.stopPropagation(),l(null);try{W==="trigger"?await triggerJob(H):W==="pause"?await pauseJob(H):W==="resume"?await resumeJob(H):W==="stop"&&await stopJob(H),o()}catch(U){l(U instanceof Error?U.message:"Action failed")}}const d=[{key:"name",header:"Name",render:P=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{className:"text-slate-200 font-medium",children:P.name}),P.description&&jsxRuntimeExports.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:P.description})]})},{key:"group",header:"Group",render:P=>jsxRuntimeExports.jsx("span",{className:"text-slate-400 text-xs",children:P.group||"—"})},{key:"status",header:"Status",render:P=>jsxRuntimeExports.jsx(Badge,{variant:jobStatusVariant$1(P.status),dot:!0,children:P.status})},{key:"schedule",header:"Schedule",render:P=>jsxRuntimeExports.jsx("span",{className:"text-xs font-mono text-slate-400",children:P.schedule??P.interval??"—"})},{key:"lastRun",header:"Last Run",render:P=>jsxRuntimeExports.jsx("span",{className:"text-xs text-slate-400",children:formatDate$1(P.lastRun)})},{key:"nextRun",header:"Next Run",render:P=>jsxRuntimeExports.jsx("span",{className:"text-xs text-slate-400",children:formatDate$1(P.nextRun)})},{key:"actions",header:"",render:P=>jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",onClick:H=>H.stopPropagation(),children:[jsxRuntimeExports.jsx("button",{onClick:H=>C(H,P.id,"trigger"),className:"px-2 py-1 text-[11px] bg-indigo-500/20 hover:bg-indigo-500/30 text-indigo-300 rounded transition-colors",children:"Trigger"}),P.status==="active"||P.status==="running"||P.status==="scheduled"?jsxRuntimeExports.jsx("button",{onClick:H=>C(H,P.id,"pause"),className:"px-2 py-1 text-[11px] bg-amber-500/20 hover:bg-amber-500/30 text-amber-300 rounded transition-colors",children:"Pause"}):P.status==="paused"?jsxRuntimeExports.jsx("button",{onClick:H=>C(H,P.id,"resume"),className:"px-2 py-1 text-[11px] bg-green-500/20 hover:bg-green-500/30 text-green-300 rounded transition-colors",children:"Resume"}):null,jsxRuntimeExports.jsx("button",{onClick:H=>C(H,P.id,"stop"),className:"px-2 py-1 text-[11px] bg-red-500/20 hover:bg-red-500/30 text-red-300 rounded transition-colors",children:"Stop"})]})}];return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PageHeader,{title:"Jobs",subtitle:u.length?`${u.length} registered jobs`:"Job scheduler",actions:jsxRuntimeExports.jsx("button",{onClick:o,className:"px-3 py-1.5 text-xs bg-white/[0.06] hover:bg-white/[0.1] text-slate-300 rounded-lg transition-colors",children:"Refresh"})}),jsxRuntimeExports.jsxs("div",{className:"p-6",children:[r&&jsxRuntimeExports.jsx("div",{className:"text-slate-400 text-sm",children:"Loading jobs..."}),n&&jsxRuntimeExports.jsxs("div",{className:"text-red-400 text-sm mb-4",children:["Error: ",n]}),a&&jsxRuntimeExports.jsx("div",{className:"text-red-400 text-sm mb-4 p-3 bg-red-500/10 border border-red-500/20 rounded-lg",children:a}),!r&&jsxRuntimeExports.jsx(DataTable,{columns:d,data:u,keyExtractor:P=>P.id,onRowClick:P=>t(`/jobs/${P.id}`)})]})]})}function jobStatusVariant(t){switch(t){case"active":case"running":case"completed":case"succeeded":return"success";case"paused":return"warning";case"stopped":case"failed":case"error":return"error";case"scheduled":return"info";default:return"neutral"}}function formatDate(t){return t?new Date(t).toLocaleString():"—"}function formatDuration(t){return t===null?"—":t<1e3?`${t}ms`:`${(t/1e3).toFixed(2)}s`}function JobDetail(){const{id:t}=useParams(),e=useNavigate(),[r,n]=reactExports.useState(0),o=20,[u,h]=reactExports.useState([]),[a,l]=reactExports.useState(!1),[f,C]=reactExports.useState(null),{data:d,loading:P,refetch:H}=useApi(()=>getJob(t),[t]),{data:W,loading:U,refetch:L}=useApi(()=>getJobHistory(t,{limit:o,offset:r*o}),[t,r]);async function N(V){if(t){C(null);try{V==="trigger"?await triggerJob(t):V==="pause"?await pauseJob(t):V==="resume"?await resumeJob(t):V==="stop"&&await stopJob(t),H(),L()}catch(Y){C(Y instanceof Error?Y.message:"Action failed")}}}async function x(V){if(t){l(!0),h([`Loading logs for execution ${V.id}...`]);try{const Y=await getJobExecution(t,V.id);Y.logs&&Y.logs.length>0?h(Y.logs.map(J=>`[${J.timestamp}] [${J.level}] ${J.message}`)):h(["No logs available for this execution."])}catch(Y){h([`Error loading logs: ${Y instanceof Error?Y.message:"Unknown error"}`])}finally{l(!1)}}}const j=[{key:"id",header:"ID",render:V=>jsxRuntimeExports.jsxs("span",{className:"font-mono text-xs text-slate-400",children:[V.id.slice(0,8),"..."]})},{key:"status",header:"Status",render:V=>jsxRuntimeExports.jsx(Badge,{variant:jobStatusVariant(V.status),dot:!0,children:V.status})},{key:"startedAt",header:"Started",render:V=>jsxRuntimeExports.jsx("span",{className:"text-xs text-slate-400",children:formatDate(V.startedAt)})},{key:"duration",header:"Duration",render:V=>jsxRuntimeExports.jsx("span",{className:"text-xs font-mono text-slate-400",children:formatDuration(V.duration)})},{key:"triggerType",header:"Trigger",render:V=>jsxRuntimeExports.jsx("span",{className:"text-xs text-slate-500",children:V.triggerType||"—"})},{key:"error",header:"Error",render:V=>V.error?jsxRuntimeExports.jsx("span",{className:"text-xs text-red-400 truncate max-w-[200px] block",title:V.error,children:V.error}):jsxRuntimeExports.jsx("span",{className:"text-slate-600",children:"—"})},{key:"logs",header:"",render:V=>jsxRuntimeExports.jsx("button",{onClick:Y=>{Y.stopPropagation(),x(V)},className:"px-2 py-1 text-[11px] bg-indigo-500/20 hover:bg-indigo-500/30 text-indigo-300 rounded transition-colors",children:"Logs"})}];return P?jsxRuntimeExports.jsx("div",{className:"p-6 text-slate-400",children:"Loading job details..."}):jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PageHeader,{title:(d==null?void 0:d.name)??"Job Detail",subtitle:(d==null?void 0:d.description)??`Job ${t}`,actions:jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("button",{onClick:()=>e("/jobs"),className:"px-3 py-1.5 text-xs bg-white/[0.06] hover:bg-white/[0.1] text-slate-300 rounded-lg transition-colors",children:"← Back"}),jsxRuntimeExports.jsx("button",{onClick:()=>N("trigger"),className:"px-3 py-1.5 text-xs bg-indigo-500/20 hover:bg-indigo-500/30 text-indigo-300 rounded-lg transition-colors",children:"Trigger"}),d&&(d.status==="active"||d.status==="running"||d.status==="scheduled")&&jsxRuntimeExports.jsx("button",{onClick:()=>N("pause"),className:"px-3 py-1.5 text-xs bg-amber-500/20 hover:bg-amber-500/30 text-amber-300 rounded-lg transition-colors",children:"Pause"}),d&&d.status==="paused"&&jsxRuntimeExports.jsx("button",{onClick:()=>N("resume"),className:"px-3 py-1.5 text-xs bg-green-500/20 hover:bg-green-500/30 text-green-300 rounded-lg transition-colors",children:"Resume"}),jsxRuntimeExports.jsx("button",{onClick:()=>N("stop"),className:"px-3 py-1.5 text-xs bg-red-500/20 hover:bg-red-500/30 text-red-300 rounded-lg transition-colors",children:"Stop"})]})}),jsxRuntimeExports.jsxs("div",{className:"p-6 space-y-6",children:[f&&jsxRuntimeExports.jsx("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 border border-red-500/20 rounded-lg",children:f}),d&&jsxRuntimeExports.jsxs("div",{className:"bg-white/[0.04] border border-white/[0.08] rounded-xl p-5",children:[jsxRuntimeExports.jsx("h3",{className:"text-sm font-semibold text-white mb-3",children:"Job Information"}),jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-2 text-sm",children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Status"}),jsxRuntimeExports.jsx(Badge,{variant:jobStatusVariant(d.status),dot:!0,children:d.status})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Group"}),jsxRuntimeExports.jsx("span",{className:"text-slate-300 text-xs font-mono",children:d.group||"—"})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Schedule"}),jsxRuntimeExports.jsx("span",{className:"text-slate-300 text-xs font-mono",children:d.schedule??"—"})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Interval"}),jsxRuntimeExports.jsx("span",{className:"text-slate-300 text-xs font-mono",children:d.interval??"—"})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Last Run"}),jsxRuntimeExports.jsx("span",{className:"text-slate-300 text-xs",children:formatDate(d.lastRun)})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Next Run"}),jsxRuntimeExports.jsx("span",{className:"text-slate-300 text-xs",children:formatDate(d.nextRun)})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Last Duration"}),jsxRuntimeExports.jsx("span",{className:"text-slate-300 text-xs font-mono",children:formatDuration(d.lastDuration)})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Max Retries"}),jsxRuntimeExports.jsx("span",{className:"text-slate-300 text-xs font-mono",children:d.maxRetries})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Overlap Policy"}),jsxRuntimeExports.jsx("span",{className:"text-slate-300 text-xs font-mono",children:d.overlapPolicy||"—"})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:"Timeout"}),jsxRuntimeExports.jsx("span",{className:"text-slate-300 text-xs font-mono",children:d.timeout??"—"})]})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntimeExports.jsx("h3",{className:"text-sm font-semibold text-white",children:"Execution History"}),W&&jsxRuntimeExports.jsxs("span",{className:"text-xs text-slate-500",children:[W.total," total executions"]})]}),U&&jsxRuntimeExports.jsx("div",{className:"text-slate-400 text-sm",children:"Loading history..."}),!U&&W&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(DataTable,{columns:j,data:W.items,keyExtractor:V=>V.id,onRowClick:x}),W.total>o&&jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between mt-3",children:[jsxRuntimeExports.jsx("button",{onClick:()=>n(V=>Math.max(0,V-1)),disabled:r===0,className:"px-3 py-1.5 text-xs bg-white/[0.06] hover:bg-white/[0.1] text-slate-300 rounded-lg transition-colors disabled:opacity-40",children:"Previous"}),jsxRuntimeExports.jsxs("span",{className:"text-xs text-slate-500",children:["Page ",r+1," of ",Math.ceil(W.total/o)]}),jsxRuntimeExports.jsx("button",{onClick:()=>n(V=>V+1),disabled:(r+1)*o>=W.total,className:"px-3 py-1.5 text-xs bg-white/[0.06] hover:bg-white/[0.1] text-slate-300 rounded-lg transition-colors disabled:opacity-40",children:"Next"})]})]})]}),jsxRuntimeExports.jsx(MonoPanel,{title:"Execution Logs",lines:a?["Loading..."]:u.length>0?u:["Click an execution row or its Logs button to view logs."],maxLines:500})]})]})}function getPlugins(){return apiFetch("/api/v1/qcli/plugins")}function togglePlugin(t){return apiFetch(`/api/v1/qcli/plugins/${encodeURIComponent(t)}/toggle`,{method:"POST"})}function PluginCard({plugin:t,onToggle:e}){const[r,n]=reactExports.useState(!1),[o,u]=reactExports.useState(!1);async function h(a){a.stopPropagation(),u(!0);try{await e(t.id)}finally{u(!1)}}return jsxRuntimeExports.jsxs("div",{className:`bg-white/[0.04] border rounded-xl overflow-hidden transition-colors cursor-pointer ${t.enabled?"border-white/[0.08] hover:border-white/[0.14]":"border-white/[0.04] opacity-60 hover:opacity-80"}`,onClick:()=>n(!r),children:[jsxRuntimeExports.jsxs("div",{className:"p-4",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-start justify-between gap-3",children:[jsxRuntimeExports.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[jsxRuntimeExports.jsx("span",{className:"font-semibold text-white text-sm truncate",children:t.name||t.id}),jsxRuntimeExports.jsxs("span",{className:"text-[10px] text-slate-500 font-mono bg-white/[0.06] px-1.5 py-0.5 rounded",children:["v",t.version]})]}),jsxRuntimeExports.jsx("p",{className:"text-xs text-slate-400 mt-1 line-clamp-2",children:t.description||"No description"})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[jsxRuntimeExports.jsx(Badge,{variant:t.enabled?"success":"neutral",dot:!0,children:t.enabled?"Enabled":"Disabled"}),jsxRuntimeExports.jsx("button",{onClick:h,disabled:o,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none disabled:opacity-50 ${t.enabled?"bg-indigo-500":"bg-slate-600"}`,title:t.enabled?"Disable plugin":"Enable plugin",children:jsxRuntimeExports.jsx("span",{className:`inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${t.enabled?"translate-x-4":"translate-x-0.5"}`})})]})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4 mt-3",children:[jsxRuntimeExports.jsxs("div",{className:"text-[11px] text-slate-500",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-300 font-medium",children:t.processorCount})," ","processor",t.processorCount!==1?"s":""]}),t.processors.length>0&&jsxRuntimeExports.jsx("button",{onClick:a=>{a.stopPropagation(),n(!r)},className:"text-[11px] text-indigo-400 hover:text-indigo-300 transition-colors",children:r?"Hide commands ▲":"Show commands ▼"})]})]}),r&&t.processors.length>0&&jsxRuntimeExports.jsxs("div",{className:"border-t border-white/[0.06] px-4 py-3 bg-white/[0.02]",children:[jsxRuntimeExports.jsx("div",{className:"text-[10px] text-slate-500 uppercase tracking-wider font-medium mb-2",children:"Registered Commands"}),jsxRuntimeExports.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.processors.map(a=>jsxRuntimeExports.jsx("span",{className:"font-mono text-[11px] text-indigo-300 bg-indigo-500/10 border border-indigo-500/20 px-2 py-0.5 rounded",children:a},a))})]})]})}function PluginsPage(){const{data:t,loading:e,error:r,refetch:n}=useApi(getPlugins,[]);async function o(u){await togglePlugin(u),n()}return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PageHeader,{title:"Plugins",subtitle:t?`${t.length} installed plugins`:"Plugin manager",actions:jsxRuntimeExports.jsx("button",{onClick:n,className:"px-3 py-1.5 text-xs bg-white/[0.06] hover:bg-white/[0.1] text-slate-300 rounded-lg transition-colors",children:"Refresh"})}),jsxRuntimeExports.jsxs("div",{className:"p-6",children:[e&&jsxRuntimeExports.jsx("div",{className:"text-slate-400 text-sm",children:"Loading plugins..."}),r&&jsxRuntimeExports.jsxs("div",{className:"text-red-400 text-sm",children:["Error: ",r]}),!e&&!r&&t&&jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:[t.map(u=>jsxRuntimeExports.jsx(PluginCard,{plugin:u,onToggle:o},u.id)),t.length===0&&jsxRuntimeExports.jsx("div",{className:"col-span-full text-slate-500 text-sm",children:"No plugins installed."})]})]})]})}function Breadcrumb({path:t,onNavigate:e}){const r=t==="/"?[]:t.split("/").filter(Boolean);function n(o){return o===-1?"/":"/"+r.slice(0,o+1).join("/")}return jsxRuntimeExports.jsxs("nav",{className:"flex items-center gap-1 text-sm text-slate-400 flex-wrap",children:[jsxRuntimeExports.jsx("button",{onClick:()=>e("/"),className:"hover:text-white transition-colors font-mono px-1.5 py-0.5 rounded hover:bg-white/[0.06]",children:"/"}),r.map((o,u)=>jsxRuntimeExports.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-600",children:"/"}),jsxRuntimeExports.jsx("button",{onClick:()=>e(n(u)),className:`hover:text-white transition-colors font-mono px-1.5 py-0.5 rounded hover:bg-white/[0.06] ${u===r.length-1?"text-white":""}`,children:o})]},u))]})}function Modal({open:t,onClose:e,title:r,children:n,actions:o}){return reactExports.useEffect(()=>{if(!t)return;const u=h=>{h.key==="Escape"&&e()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[t,e]),t?jsxRuntimeExports.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:e,children:jsxRuntimeExports.jsxs("div",{className:"bg-[#1e1b4b] border border-white/[0.1] rounded-xl w-full max-w-md mx-4 shadow-2xl",onClick:u=>u.stopPropagation(),children:[jsxRuntimeExports.jsx("div",{className:"px-5 py-4 border-b border-white/[0.06]",children:jsxRuntimeExports.jsx("h3",{className:"text-base font-semibold text-white",children:r})}),jsxRuntimeExports.jsx("div",{className:"px-5 py-4 text-sm text-slate-300",children:n}),o&&jsxRuntimeExports.jsx("div",{className:"px-5 py-3 border-t border-white/[0.06] flex justify-end gap-2",children:o})]})}):null}function listDir(t){return apiFetch(`/api/qcli/fs/ls?path=${encodeURIComponent(t)}`)}function readFile(t){return apiFetch(`/api/qcli/fs/cat?path=${encodeURIComponent(t)}`)}function uploadFile(t,e){const r=new FormData;return r.append("file",e),r.append("path",t),apiFetch("/api/qcli/fs/upload",{method:"POST",body:r})}function createDir(t){return apiFetch("/api/qcli/fs/mkdir",{method:"POST",body:JSON.stringify({path:t})})}function deleteEntry(t){return apiFetch(`/api/qcli/fs/rm?path=${encodeURIComponent(t)}`,{method:"DELETE"})}function formatSize(t){return t===0?"—":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function relativeTime(t){const e=Date.now()-new Date(t).getTime(),r=Math.floor(e/1e3);if(r<60)return`${r}s ago`;const n=Math.floor(r/60);if(n<60)return`${n}m ago`;const o=Math.floor(n/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function FilesystemPage(){const[t,e]=reactExports.useState("/"),[r,n]=reactExports.useState([]),[o,u]=reactExports.useState(!1),[h,a]=reactExports.useState(null),[l,f]=reactExports.useState(null),[C,d]=reactExports.useState(""),[P,H]=reactExports.useState(!1),[W,U]=reactExports.useState(!1),[L,N]=reactExports.useState(""),[x,j]=reactExports.useState(null),[V,Y]=reactExports.useState(!1),[J,X]=reactExports.useState(null),[G,ee]=reactExports.useState(!1),[ne,ae]=reactExports.useState(null),ce=reactExports.useRef(null),[oe,we]=reactExports.useState(!1),[be,ve]=reactExports.useState(null);reactExports.useEffect(()=>{u(!0),a(null),f(null),listDir(t).then(fe=>n(fe)).catch(fe=>a(fe instanceof Error?fe.message:"Failed to list directory")).finally(()=>u(!1))},[t]);function me(fe){e(fe)}async function de(fe){if(fe.type==="directory")me(fe.path);else{H(!0),f(null),d(fe.name);try{const xe=await readFile(fe.path);f(typeof xe=="string"?xe.split(`
68
- `):[JSON.stringify(xe)])}catch(xe){f([`Error reading file: ${xe instanceof Error?xe.message:"Unknown error"}`])}finally{H(!1)}}}async function Q(fe){var ke;const xe=(ke=fe.target.files)==null?void 0:ke[0];if(xe){we(!0),ve(null);try{await uploadFile(t,xe);const ue=await listDir(t);n(ue)}catch(ue){ve(ue instanceof Error?ue.message:"Upload failed")}finally{we(!1),ce.current&&(ce.current.value="")}}}async function re(){if(L.trim()){Y(!0),j(null);try{const fe=t==="/"?`/${L}`:`${t}/${L}`;await createDir(fe);const xe=await listDir(t);n(xe),U(!1),N("")}catch(fe){j(fe instanceof Error?fe.message:"Failed to create directory")}finally{Y(!1)}}}async function Z(){if(J){ee(!0),ae(null);try{await deleteEntry(J.path);const fe=await listDir(t);n(fe),X(null),C===J.name&&f(null)}catch(fe){ae(fe instanceof Error?fe.message:"Delete failed")}finally{ee(!1)}}}async function ie(fe,xe){try{const ke=localStorage.getItem("qcli_admin_token"),ue={};ke&&(ue.Authorization=`Bearer ${ke}`);const se=await fetch(`/api/qcli/fs/download?path=${encodeURIComponent(fe)}`,{headers:ue});if(!se.ok)return;const Ee=await se.blob(),Se=URL.createObjectURL(Ee),$e=document.createElement("a");$e.href=Se,$e.download=xe,$e.click(),URL.revokeObjectURL(Se)}catch{}}const ge=[{key:"name",header:"Name",render:fe=>jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("span",{className:"text-base",children:fe.type==="directory"?"📁":"📄"}),jsxRuntimeExports.jsx("span",{className:`text-sm ${fe.type==="directory"?"text-indigo-300 font-medium":"text-slate-300"}`,children:fe.name})]})},{key:"size",header:"Size",render:fe=>jsxRuntimeExports.jsx("span",{className:"text-xs text-slate-400 font-mono",children:fe.type==="directory"?"—":formatSize(fe.size)})},{key:"modified",header:"Modified",render:fe=>jsxRuntimeExports.jsx("span",{className:"text-xs text-slate-400",children:relativeTime(fe.modified)})},{key:"actions",header:"",render:fe=>jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",onClick:xe=>xe.stopPropagation(),children:[fe.type==="file"&&jsxRuntimeExports.jsx("button",{onClick:()=>ie(fe.path,fe.name),className:"px-2 py-1 text-[11px] bg-indigo-500/20 hover:bg-indigo-500/30 text-indigo-300 rounded transition-colors",children:"Download"}),jsxRuntimeExports.jsx("button",{onClick:()=>X(fe),className:"px-2 py-1 text-[11px] bg-red-500/20 hover:bg-red-500/30 text-red-300 rounded transition-colors",children:"Delete"})]})}];return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PageHeader,{title:"Filesystem",subtitle:"Browse and manage server files",actions:jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("input",{ref:ce,type:"file",className:"hidden",onChange:Q}),jsxRuntimeExports.jsx("button",{onClick:()=>{var fe;return(fe=ce.current)==null?void 0:fe.click()},disabled:oe,className:"px-3 py-1.5 text-xs bg-indigo-500/20 hover:bg-indigo-500/30 text-indigo-300 rounded-lg transition-colors disabled:opacity-50",children:oe?"Uploading...":"Upload"}),jsxRuntimeExports.jsx("button",{onClick:()=>{U(!0),N(""),j(null)},className:"px-3 py-1.5 text-xs bg-white/[0.06] hover:bg-white/[0.1] text-slate-300 rounded-lg transition-colors",children:"New Folder"})]})}),jsxRuntimeExports.jsxs("div",{className:"p-6 space-y-4",children:[jsxRuntimeExports.jsx("div",{className:"bg-white/[0.04] border border-white/[0.08] rounded-xl px-4 py-3",children:jsxRuntimeExports.jsx(Breadcrumb,{path:t,onNavigate:me})}),be&&jsxRuntimeExports.jsxs("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 border border-red-500/20 rounded-lg",children:["Upload error: ",be]}),o&&jsxRuntimeExports.jsx("div",{className:"text-slate-400 text-sm",children:"Loading..."}),h&&jsxRuntimeExports.jsx("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 border border-red-500/20 rounded-lg",children:h}),!o&&!h&&jsxRuntimeExports.jsx(DataTable,{columns:ge,data:r,keyExtractor:fe=>fe.path,onRowClick:de}),(l!==null||P)&&jsxRuntimeExports.jsx(MonoPanel,{title:P?"Loading...":C,lines:P?["Loading file content..."]:l??[],maxLines:1e3})]}),jsxRuntimeExports.jsxs(Modal,{open:W,onClose:()=>U(!1),title:"New Folder",actions:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("button",{onClick:()=>U(!1),className:"px-4 py-2 text-sm bg-white/[0.06] hover:bg-white/[0.1] text-slate-300 rounded-lg transition-colors",children:"Cancel"}),jsxRuntimeExports.jsx("button",{onClick:re,disabled:V||!L.trim(),className:"px-4 py-2 text-sm bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg transition-colors disabled:opacity-50",children:V?"Creating...":"Create"})]}),children:[jsxRuntimeExports.jsx("input",{type:"text",placeholder:"Folder name",value:L,onChange:fe=>N(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"&&re()},autoFocus:!0,className:"w-full px-3 py-2 text-sm bg-white/[0.06] border border-white/[0.1] rounded-lg text-slate-200 placeholder-slate-500 focus:outline-none focus:border-indigo-500/50"}),x&&jsxRuntimeExports.jsx("p",{className:"text-red-400 text-xs mt-2",children:x})]}),jsxRuntimeExports.jsxs(Modal,{open:!!J,onClose:()=>{X(null),ae(null)},title:"Confirm Delete",actions:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("button",{onClick:()=>{X(null),ae(null)},className:"px-4 py-2 text-sm bg-white/[0.06] hover:bg-white/[0.1] text-slate-300 rounded-lg transition-colors",children:"Cancel"}),jsxRuntimeExports.jsx("button",{onClick:Z,disabled:G,className:"px-4 py-2 text-sm bg-red-600 hover:bg-red-500 text-white rounded-lg transition-colors disabled:opacity-50",children:G?"Deleting...":"Delete"})]}),children:[jsxRuntimeExports.jsxs("p",{children:["Are you sure you want to delete"," ",jsxRuntimeExports.jsx("span",{className:"font-mono text-white",children:J==null?void 0:J.name}),"?",(J==null?void 0:J.type)==="directory"&&" This will remove the directory and all its contents."]}),ne&&jsxRuntimeExports.jsx("p",{className:"text-red-400 text-xs mt-2",children:ne})]})]})}function getWsClients(){return apiFetch("/api/v1/qcli/ws/clients")}let eventCounter=0;function formatTime(t){return t.toTimeString().slice(0,8)}function eventTypeBadgeVariant(t){return t.startsWith("job:")?"info":t.startsWith("log:")?"neutral":t.startsWith("error:")||t.includes("error")?"error":t.startsWith("warn:")||t.includes("warn")?"warning":t.startsWith("connect")||t.startsWith("session")?"success":"neutral"}function clientTypeBadgeVariant(t){return t==="events"?"info":t==="shell"?"success":"neutral"}const MAX_EVENTS=200;function EventsPage(){const{subscribe:t}=useWebSocket(),[e,r]=reactExports.useState([]),[n,o]=reactExports.useState("all"),u=reactExports.useRef(null),[h,a]=reactExports.useState(!0),{data:l,loading:f,refetch:C}=useApi(getWsClients,[]);reactExports.useEffect(()=>{const W=setInterval(C,1e4);return()=>clearInterval(W)},[C]),reactExports.useEffect(()=>t("*",U=>{const L=U.type??"unknown",N={id:++eventCounter,time:formatTime(new Date),type:L,payload:JSON.stringify(U)};r(x=>{const j=[...x,N];return j.length>MAX_EVENTS?j.slice(j.length-MAX_EVENTS):j})}),[t]),reactExports.useEffect(()=>{h&&u.current&&(u.current.scrollTop=u.current.scrollHeight)},[e,h]);const d=Array.from(new Set(e.map(W=>{const U=W.type.split(":");return U[0]+(U.length>1?":*":"")}))),P=e.filter(W=>{if(n==="all")return!0;const U=n.replace(":*","");return W.type.startsWith(U)}),H=[{key:"id",header:"ID",render:W=>jsxRuntimeExports.jsxs("span",{className:"font-mono text-xs text-slate-400",children:[W.id.slice(0,12),"..."]})},{key:"type",header:"Type",render:W=>jsxRuntimeExports.jsx(Badge,{variant:clientTypeBadgeVariant(W.type),children:W.type})},{key:"connectedAt",header:"Connected",render:W=>jsxRuntimeExports.jsx("span",{className:"text-xs text-slate-400",children:new Date(W.connectedAt).toLocaleTimeString()})},{key:"remoteAddress",header:"Remote",render:W=>jsxRuntimeExports.jsx("span",{className:"font-mono text-xs text-slate-400",children:W.remoteAddress})}];return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PageHeader,{title:"Events",subtitle:"Live event stream and connected clients"}),jsxRuntimeExports.jsx("div",{className:"p-6",children:jsxRuntimeExports.jsxs("div",{className:"flex gap-4 h-[calc(100vh-12rem)]",children:[jsxRuntimeExports.jsxs("div",{className:"flex-[2] flex flex-col bg-white/[0.04] border border-white/[0.08] rounded-xl overflow-hidden",children:[jsxRuntimeExports.jsxs("div",{className:"px-4 py-3 border-b border-white/[0.06] flex items-center gap-3 flex-wrap",children:[jsxRuntimeExports.jsx("span",{className:"text-sm font-medium text-white",children:"Live Events"}),jsxRuntimeExports.jsxs("span",{className:"text-xs text-slate-500",children:[e.length," / ",MAX_EVENTS]}),jsxRuntimeExports.jsxs("select",{value:n,onChange:W=>o(W.target.value),className:"ml-auto text-xs bg-white/[0.06] border border-white/[0.1] text-slate-300 rounded px-2 py-1 focus:outline-none",children:[jsxRuntimeExports.jsx("option",{value:"all",children:"All types"}),d.map(W=>jsxRuntimeExports.jsx("option",{value:W,children:W},W))]}),jsxRuntimeExports.jsx("button",{onClick:()=>a(!h),className:`text-[10px] px-2 py-0.5 rounded ${h?"bg-indigo-500/20 text-indigo-300":"bg-white/[0.06] text-slate-400"}`,children:h?"Auto-scroll ON":"Auto-scroll OFF"}),jsxRuntimeExports.jsx("button",{onClick:()=>r([]),className:"text-[10px] px-2 py-0.5 rounded bg-red-500/20 text-red-400 hover:bg-red-500/30 transition-colors",children:"Clear"})]}),jsxRuntimeExports.jsx("div",{ref:u,onScroll:()=>{if(!u.current)return;const{scrollTop:W,scrollHeight:U,clientHeight:L}=u.current;a(U-W-L<60)},className:"flex-1 overflow-y-auto p-3 font-mono text-xs space-y-0.5",children:P.length===0?jsxRuntimeExports.jsx("div",{className:"text-slate-500 py-4 text-center",children:"Waiting for events..."}):P.map(W=>jsxRuntimeExports.jsxs("div",{className:"flex items-start gap-2 py-0.5 hover:bg-white/[0.03] rounded px-1",children:[jsxRuntimeExports.jsxs("span",{className:"text-slate-600 shrink-0",children:["[",W.time,"]"]}),jsxRuntimeExports.jsx(Badge,{variant:eventTypeBadgeVariant(W.type),children:W.type}),jsxRuntimeExports.jsx("span",{className:"text-slate-400 truncate flex-1 text-[10px]",children:W.payload})]},W.id))})]}),jsxRuntimeExports.jsx("div",{className:"flex-1 flex flex-col",children:jsxRuntimeExports.jsxs("div",{className:"bg-white/[0.04] border border-white/[0.08] rounded-xl overflow-hidden flex flex-col h-full",children:[jsxRuntimeExports.jsxs("div",{className:"px-4 py-3 border-b border-white/[0.06] flex items-center justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-sm font-medium text-white",children:"Connected Clients"}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[l&&jsxRuntimeExports.jsxs("span",{className:"text-xs text-slate-500",children:[l.length," connected"]}),jsxRuntimeExports.jsx("button",{onClick:C,className:"text-[10px] px-2 py-0.5 rounded bg-white/[0.06] text-slate-400 hover:bg-white/[0.1] transition-colors",children:"Refresh"})]})]}),jsxRuntimeExports.jsx("div",{className:"flex-1 overflow-auto",children:f?jsxRuntimeExports.jsx("div",{className:"p-4 text-slate-400 text-sm",children:"Loading..."}):l&&l.length>0?jsxRuntimeExports.jsx(DataTable,{columns:H,data:l,keyExtractor:W=>W.id}):jsxRuntimeExports.jsx("div",{className:"p-4 text-slate-500 text-sm",children:"No clients connected."})})]})})]})})]})}function getConfig(){return apiFetch("/api/v1/qcli/config")}function updateConfig(t,e){return apiFetch("/api/v1/qcli/config",{method:"PUT",body:JSON.stringify({section:t,settings:e})})}function TagInput({value:t,onChange:e,disabled:r}){const[n,o]=reactExports.useState("");function u(){const a=n.trim();a&&!t.includes(a)&&e([...t,a]),o("")}function h(a){e(t.filter(l=>l!==a))}return jsxRuntimeExports.jsxs("div",{className:`flex flex-wrap gap-1.5 p-2 bg-white/[0.06] border border-white/[0.1] rounded-lg min-h-[38px] ${r?"opacity-50":""}`,children:[t.map(a=>jsxRuntimeExports.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-indigo-500/20 text-indigo-300 rounded text-xs font-mono",children:[a,!r&&jsxRuntimeExports.jsx("button",{onClick:()=>h(a),className:"text-indigo-400 hover:text-white ml-0.5",children:"×"})]},a)),!r&&jsxRuntimeExports.jsx("input",{type:"text",value:n,onChange:a=>o(a.target.value),onKeyDown:a=>{(a.key==="Enter"||a.key===",")&&(a.preventDefault(),u())},placeholder:"Add value...",className:"bg-transparent text-xs text-slate-300 placeholder-slate-600 focus:outline-none min-w-[80px]"})]})}function SettingField({entry:t,value:e,onChange:r}){const n=!t.mutable;if(t.type==="boolean"){const o=e;return jsxRuntimeExports.jsx("button",{onClick:()=>!n&&r(!o),disabled:n,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed ${o?"bg-indigo-500":"bg-slate-600"}`,children:jsxRuntimeExports.jsx("span",{className:`inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${o?"translate-x-4":"translate-x-0.5"}`})})}return t.type==="string[]"?jsxRuntimeExports.jsx(TagInput,{value:e,onChange:r,disabled:n}):t.type==="number"?jsxRuntimeExports.jsx("input",{type:"number",value:e,disabled:n,onChange:o=>r(Number(o.target.value)),className:"w-full max-w-xs px-3 py-1.5 text-sm bg-white/[0.06] border border-white/[0.1] rounded-lg text-slate-200 focus:outline-none focus:border-indigo-500/50 disabled:opacity-50 disabled:cursor-not-allowed"}):jsxRuntimeExports.jsx("input",{type:"text",value:e,disabled:n,onChange:o=>r(o.target.value),className:"w-full max-w-sm px-3 py-1.5 text-sm bg-white/[0.06] border border-white/[0.1] rounded-lg text-slate-200 focus:outline-none focus:border-indigo-500/50 disabled:opacity-50 disabled:cursor-not-allowed"})}function ConfigPage(){const{data:t,loading:e,error:r,refetch:n}=useApi(getConfig,[]),[o,u]=reactExports.useState({}),[h,a]=reactExports.useState(!1),[l,f]=reactExports.useState(!1),[C,d]=reactExports.useState(null),[P,H]=reactExports.useState(!1),[W,U]=reactExports.useState(null);reactExports.useEffect(()=>{u({})},[t]);function L(V,Y){var J;return((J=o[V.name])==null?void 0:J[Y.key])??Y.value}function N(V,Y,J){u(X=>({...X,[V]:{...X[V],[Y]:J}}))}const x=Object.keys(o).some(V=>Object.keys(o[V]??{}).length>0);async function j(){f(!0),d(null);let V=!1;try{for(const[Y,J]of Object.entries(o)){if(Object.keys(J).length===0)continue;(await updateConfig(Y,J)).restartRequired&&(V=!0),U(Y)}H(V),u({}),n()}catch(Y){d(Y instanceof Error?Y.message:"Save failed")}finally{f(!1),a(!1)}}return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PageHeader,{title:"Configuration",subtitle:"Server settings and runtime configuration",actions:jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("button",{onClick:n,className:"px-3 py-1.5 text-xs bg-white/[0.06] hover:bg-white/[0.1] text-slate-300 rounded-lg transition-colors",children:"Refresh"}),jsxRuntimeExports.jsx("button",{onClick:()=>{a(!0),d(null)},disabled:!x||l,className:"px-3 py-1.5 text-xs bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:"Save Changes"})]})}),jsxRuntimeExports.jsxs("div",{className:"p-6 space-y-6",children:[e&&jsxRuntimeExports.jsx("div",{className:"text-slate-400 text-sm",children:"Loading configuration..."}),r&&jsxRuntimeExports.jsxs("div",{className:"text-red-400 text-sm",children:["Error: ",r]}),P&&jsxRuntimeExports.jsxs("div",{className:"p-3 bg-amber-500/10 border border-amber-500/30 rounded-lg text-amber-300 text-sm flex items-center gap-2",children:[jsxRuntimeExports.jsx("span",{children:"⚠"}),jsxRuntimeExports.jsx("span",{children:"Some settings require a server restart to take effect."})]}),C&&jsxRuntimeExports.jsx("div",{className:"p-3 bg-red-500/10 border border-red-500/20 rounded-lg text-red-400 text-sm",children:C}),!e&&t&&t.sections.map(V=>jsxRuntimeExports.jsxs("div",{className:"bg-white/[0.04] border border-white/[0.08] rounded-xl overflow-hidden",children:[jsxRuntimeExports.jsxs("div",{className:"px-5 py-3 border-b border-white/[0.06] flex items-center gap-3",children:[jsxRuntimeExports.jsx("h3",{className:"text-sm font-semibold text-white capitalize",children:V.name}),jsxRuntimeExports.jsx(Badge,{variant:V.mutable?"success":"neutral",children:V.mutable?"Mutable":"Read-only"}),W===V.name&&jsxRuntimeExports.jsx("span",{className:"text-xs text-green-400 ml-auto",children:"Saved"})]}),jsxRuntimeExports.jsx("div",{className:"divide-y divide-white/[0.04]",children:V.settings.map(Y=>jsxRuntimeExports.jsxs("div",{className:`px-5 py-3 flex items-start gap-6 ${Y.mutable?"":"opacity-60"}`,children:[jsxRuntimeExports.jsxs("div",{className:"w-48 shrink-0",children:[jsxRuntimeExports.jsx("div",{className:"text-sm text-slate-300 font-mono",children:Y.key}),Y.description&&jsxRuntimeExports.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5",children:Y.description}),!Y.mutable&&jsxRuntimeExports.jsx("span",{className:"text-[10px] text-slate-600",children:"read-only"})]}),jsxRuntimeExports.jsx("div",{className:"flex-1",children:jsxRuntimeExports.jsx(SettingField,{entry:Y,value:L(V,Y),onChange:J=>N(V.name,Y.key,J)})})]},Y.key))})]},V.name))]}),jsxRuntimeExports.jsxs(Modal,{open:h,onClose:()=>a(!1),title:"Save Configuration",actions:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("button",{onClick:()=>a(!1),className:"px-4 py-2 text-sm bg-white/[0.06] hover:bg-white/[0.1] text-slate-300 rounded-lg transition-colors",children:"Cancel"}),jsxRuntimeExports.jsx("button",{onClick:j,disabled:l,className:"px-4 py-2 text-sm bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg transition-colors disabled:opacity-50",children:l?"Saving...":"Confirm Save"})]}),children:[jsxRuntimeExports.jsx("p",{children:"Are you sure you want to save the configuration changes? Some settings may require a server restart."}),C&&jsxRuntimeExports.jsx("p",{className:"text-red-400 text-xs mt-2",children:C})]})]})}function getLogs(t={}){const e=new URLSearchParams;t.level&&e.set("level",t.level),t.search&&e.set("search",t.search),t.limit!==void 0&&e.set("limit",String(t.limit)),t.offset!==void 0&&e.set("offset",String(t.offset));const r=e.toString();return apiFetch(`/api/v1/qcli/logs${r?`?${r}`:""}`)}const LEVEL_COLORS={DEBUG:"text-slate-400",INFO:"text-blue-400",WARN:"text-amber-400",ERROR:"text-red-400"},LEVEL_BG={DEBUG:"bg-slate-500/20",INFO:"bg-blue-500/20",WARN:"bg-amber-500/20",ERROR:"bg-red-500/20"},ALL_LEVELS=["DEBUG","INFO","WARN","ERROR"];function highlight(t,e){if(!e)return t;const r=t.toLowerCase().indexOf(e.toLowerCase());return r===-1?t:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[t.slice(0,r),jsxRuntimeExports.jsx("span",{className:"bg-yellow-400/30 text-yellow-200",children:t.slice(r,r+e.length)}),t.slice(r+e.length)]})}function LogsPage(){const{subscribe:t}=useWebSocket(),[e,r]=reactExports.useState([]),[n,o]=reactExports.useState(0),[u,h]=reactExports.useState(0),[a,l]=reactExports.useState(!1),[f,C]=reactExports.useState(!0),[d,P]=reactExports.useState(null),[H,W]=reactExports.useState(new Set(ALL_LEVELS)),[U,L]=reactExports.useState(""),N=reactExports.useRef(null),[x,j]=reactExports.useState(!0),V=100;reactExports.useEffect(()=>{C(!0),getLogs({limit:V,offset:0}).then(ne=>{r(ne.entries),o(ne.total),h(ne.entries.length)}).catch(ne=>P(ne instanceof Error?ne.message:"Failed to load logs")).finally(()=>C(!1))},[]);async function Y(){l(!0);try{const ne=await getLogs({limit:V,offset:u});r(ae=>[...ne.entries,...ae]),h(ae=>ae+ne.entries.length)}catch(ne){P(ne instanceof Error?ne.message:"Failed to load more logs")}finally{l(!1)}}reactExports.useEffect(()=>t("log:entry",ae=>{const ce=ae;ce.timestamp&&ce.level&&ce.message&&(r(oe=>[...oe,ce]),o(oe=>oe+1))}),[t]),reactExports.useEffect(()=>{x&&N.current&&(N.current.scrollTop=N.current.scrollHeight)},[e,x]);function J(ne){W(ae=>{const ce=new Set(ae);return ce.has(ne)?ce.size>1&&ce.delete(ne):ce.add(ne),ce})}const X=e.filter(ne=>!(!H.has(ne.level)||U&&!ne.message.toLowerCase().includes(U.toLowerCase())&&!ne.source.toLowerCase().includes(U.toLowerCase())));function G(){const ne=X.map(we=>`[${we.timestamp}] [${we.level}] [${we.source}] ${we.message}`).join(`
69
- `),ae=new Blob([ne],{type:"text/plain"}),ce=URL.createObjectURL(ae),oe=document.createElement("a");oe.href=ce,oe.download=`server-logs-${new Date().toISOString().slice(0,19).replace(/[:.]/g,"-")}.txt`,oe.click(),URL.revokeObjectURL(ce)}const ee=u<n;return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PageHeader,{title:"Logs",subtitle:`${X.length} entries shown`,actions:jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:jsxRuntimeExports.jsx("button",{onClick:G,disabled:X.length===0,className:"px-3 py-1.5 text-xs bg-white/[0.06] hover:bg-white/[0.1] text-slate-300 rounded-lg transition-colors disabled:opacity-40",children:"Export"})})}),jsxRuntimeExports.jsxs("div",{className:"p-6 space-y-4",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:ALL_LEVELS.map(ne=>jsxRuntimeExports.jsx("button",{onClick:()=>J(ne),className:`px-2.5 py-1 text-xs font-medium rounded-lg border transition-colors ${H.has(ne)?`${LEVEL_BG[ne]} ${LEVEL_COLORS[ne]} border-current/30`:"bg-white/[0.03] text-slate-600 border-white/[0.06]"}`,children:ne},ne))}),jsxRuntimeExports.jsx("input",{type:"text",placeholder:"Search logs...",value:U,onChange:ne=>L(ne.target.value),className:"flex-1 max-w-sm px-3 py-1.5 text-sm bg-white/[0.06] border border-white/[0.1] rounded-lg text-slate-200 placeholder-slate-500 focus:outline-none focus:border-indigo-500/50"})]}),ee&&!f&&jsxRuntimeExports.jsx("button",{onClick:Y,disabled:a,className:"text-xs text-indigo-400 hover:text-indigo-300 transition-colors disabled:opacity-50",children:a?"Loading...":`Load older logs (${n-u} remaining)`}),f&&jsxRuntimeExports.jsx("div",{className:"text-slate-400 text-sm",children:"Loading logs..."}),d&&jsxRuntimeExports.jsxs("div",{className:"text-red-400 text-sm",children:["Error: ",d]}),!f&&jsxRuntimeExports.jsxs("div",{className:"bg-white/[0.04] border border-white/[0.08] rounded-xl overflow-hidden",children:[jsxRuntimeExports.jsxs("div",{className:"px-4 py-3 border-b border-white/[0.06] flex items-center justify-between",children:[jsxRuntimeExports.jsx("span",{className:"text-sm font-medium text-white",children:"Log Output"}),jsxRuntimeExports.jsx("button",{onClick:()=>j(!x),className:`text-[10px] px-2 py-0.5 rounded ${x?"bg-indigo-500/20 text-indigo-300":"bg-white/[0.06] text-slate-400"}`,children:x?"Auto-scroll ON":"Auto-scroll OFF"})]}),jsxRuntimeExports.jsx("div",{ref:N,onScroll:()=>{if(!N.current)return;const{scrollTop:ne,scrollHeight:ae,clientHeight:ce}=N.current;j(ae-ne-ce<60)},className:"overflow-y-auto max-h-[60vh] p-3 font-mono text-xs leading-5",children:X.length===0?jsxRuntimeExports.jsx("div",{className:"text-slate-500 py-4 text-center",children:"No log entries match the current filters."}):X.map((ne,ae)=>jsxRuntimeExports.jsxs("div",{className:"flex items-start gap-2 py-0.5 hover:bg-white/[0.03] rounded px-1",children:[jsxRuntimeExports.jsx("span",{className:"text-slate-600 shrink-0 text-[10px]",children:ne.timestamp.replace("T"," ").slice(0,19)}),jsxRuntimeExports.jsx("span",{className:`shrink-0 font-bold w-12 text-[10px] ${LEVEL_COLORS[ne.level]??"text-slate-400"}`,children:ne.level}),ne.source&&jsxRuntimeExports.jsxs("span",{className:"text-slate-600 shrink-0 text-[10px] max-w-[120px] truncate",title:ne.source,children:["[",ne.source,"]"]}),jsxRuntimeExports.jsx("span",{className:`flex-1 whitespace-pre-wrap break-all ${LEVEL_COLORS[ne.level]??"text-slate-300"}`,children:highlight(ne.message,U)})]},ae))})]})]})]})}var define_process_env_default={},__create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJS=(t,e)=>function(){return e||(0,t[__getOwnPropNames(t)[0]])((e={exports:{}}).exports,e),e.exports},__copyProps=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of __getOwnPropNames(e))!__hasOwnProp.call(t,o)&&o!==r&&__defProp(t,o,{get:()=>e[o],enumerable:!(n=__getOwnPropDesc(e,o))||n.enumerable});return t},__toESM=(t,e,r)=>(r=t!=null?__create(__getProtoOf(t)):{},__copyProps(!t||!t.__esModule?__defProp(r,"default",{value:t,enumerable:!0}):r,t)),require_constants=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js"(t,e){var r="2.0.0",n=256,o=Number.MAX_SAFE_INTEGER||9007199254740991,u=16,h=n-6,a=["major","premajor","minor","preminor","patch","prepatch","prerelease"];e.exports={MAX_LENGTH:n,MAX_SAFE_COMPONENT_LENGTH:u,MAX_SAFE_BUILD_LENGTH:h,MAX_SAFE_INTEGER:o,RELEASE_TYPES:a,SEMVER_SPEC_VERSION:r,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}}),require_debug=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js"(t,e){var r=typeof process=="object"&&define_process_env_default&&define_process_env_default.NODE_DEBUG&&/\bsemver\b/i.test(define_process_env_default.NODE_DEBUG)?(...n)=>console.error("SEMVER",...n):()=>{};e.exports=r}}),require_re=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js"(t,e){var{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:o}=require_constants(),u=require_debug();t=e.exports={};var h=t.re=[],a=t.safeRe=[],l=t.src=[],f=t.safeSrc=[],C=t.t={},d=0,P="[a-zA-Z0-9-]",H=[["\\s",1],["\\d",o],[P,n]],W=L=>{for(const[N,x]of H)L=L.split(`${N}*`).join(`${N}{0,${x}}`).split(`${N}+`).join(`${N}{1,${x}}`);return L},U=(L,N,x)=>{const j=W(N),V=d++;u(L,V,N),C[L]=V,l[V]=N,f[V]=j,h[V]=new RegExp(N,x?"g":void 0),a[V]=new RegExp(j,x?"g":void 0)};U("NUMERICIDENTIFIER","0|[1-9]\\d*"),U("NUMERICIDENTIFIERLOOSE","\\d+"),U("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${P}*`),U("MAINVERSION",`(${l[C.NUMERICIDENTIFIER]})\\.(${l[C.NUMERICIDENTIFIER]})\\.(${l[C.NUMERICIDENTIFIER]})`),U("MAINVERSIONLOOSE",`(${l[C.NUMERICIDENTIFIERLOOSE]})\\.(${l[C.NUMERICIDENTIFIERLOOSE]})\\.(${l[C.NUMERICIDENTIFIERLOOSE]})`),U("PRERELEASEIDENTIFIER",`(?:${l[C.NONNUMERICIDENTIFIER]}|${l[C.NUMERICIDENTIFIER]})`),U("PRERELEASEIDENTIFIERLOOSE",`(?:${l[C.NONNUMERICIDENTIFIER]}|${l[C.NUMERICIDENTIFIERLOOSE]})`),U("PRERELEASE",`(?:-(${l[C.PRERELEASEIDENTIFIER]}(?:\\.${l[C.PRERELEASEIDENTIFIER]})*))`),U("PRERELEASELOOSE",`(?:-?(${l[C.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[C.PRERELEASEIDENTIFIERLOOSE]})*))`),U("BUILDIDENTIFIER",`${P}+`),U("BUILD",`(?:\\+(${l[C.BUILDIDENTIFIER]}(?:\\.${l[C.BUILDIDENTIFIER]})*))`),U("FULLPLAIN",`v?${l[C.MAINVERSION]}${l[C.PRERELEASE]}?${l[C.BUILD]}?`),U("FULL",`^${l[C.FULLPLAIN]}$`),U("LOOSEPLAIN",`[v=\\s]*${l[C.MAINVERSIONLOOSE]}${l[C.PRERELEASELOOSE]}?${l[C.BUILD]}?`),U("LOOSE",`^${l[C.LOOSEPLAIN]}$`),U("GTLT","((?:<|>)?=?)"),U("XRANGEIDENTIFIERLOOSE",`${l[C.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),U("XRANGEIDENTIFIER",`${l[C.NUMERICIDENTIFIER]}|x|X|\\*`),U("XRANGEPLAIN",`[v=\\s]*(${l[C.XRANGEIDENTIFIER]})(?:\\.(${l[C.XRANGEIDENTIFIER]})(?:\\.(${l[C.XRANGEIDENTIFIER]})(?:${l[C.PRERELEASE]})?${l[C.BUILD]}?)?)?`),U("XRANGEPLAINLOOSE",`[v=\\s]*(${l[C.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[C.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[C.XRANGEIDENTIFIERLOOSE]})(?:${l[C.PRERELEASELOOSE]})?${l[C.BUILD]}?)?)?`),U("XRANGE",`^${l[C.GTLT]}\\s*${l[C.XRANGEPLAIN]}$`),U("XRANGELOOSE",`^${l[C.GTLT]}\\s*${l[C.XRANGEPLAINLOOSE]}$`),U("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),U("COERCE",`${l[C.COERCEPLAIN]}(?:$|[^\\d])`),U("COERCEFULL",l[C.COERCEPLAIN]+`(?:${l[C.PRERELEASE]})?(?:${l[C.BUILD]})?(?:$|[^\\d])`),U("COERCERTL",l[C.COERCE],!0),U("COERCERTLFULL",l[C.COERCEFULL],!0),U("LONETILDE","(?:~>?)"),U("TILDETRIM",`(\\s*)${l[C.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",U("TILDE",`^${l[C.LONETILDE]}${l[C.XRANGEPLAIN]}$`),U("TILDELOOSE",`^${l[C.LONETILDE]}${l[C.XRANGEPLAINLOOSE]}$`),U("LONECARET","(?:\\^)"),U("CARETTRIM",`(\\s*)${l[C.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",U("CARET",`^${l[C.LONECARET]}${l[C.XRANGEPLAIN]}$`),U("CARETLOOSE",`^${l[C.LONECARET]}${l[C.XRANGEPLAINLOOSE]}$`),U("COMPARATORLOOSE",`^${l[C.GTLT]}\\s*(${l[C.LOOSEPLAIN]})$|^$`),U("COMPARATOR",`^${l[C.GTLT]}\\s*(${l[C.FULLPLAIN]})$|^$`),U("COMPARATORTRIM",`(\\s*)${l[C.GTLT]}\\s*(${l[C.LOOSEPLAIN]}|${l[C.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",U("HYPHENRANGE",`^\\s*(${l[C.XRANGEPLAIN]})\\s+-\\s+(${l[C.XRANGEPLAIN]})\\s*$`),U("HYPHENRANGELOOSE",`^\\s*(${l[C.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[C.XRANGEPLAINLOOSE]})\\s*$`),U("STAR","(<|>)?=?\\s*\\*"),U("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),U("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}}),require_parse_options=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js"(t,e){var r=Object.freeze({loose:!0}),n=Object.freeze({}),o=u=>u?typeof u!="object"?r:u:n;e.exports=o}}),require_identifiers=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js"(t,e){var r=/^[0-9]+$/,n=(u,h)=>{if(typeof u=="number"&&typeof h=="number")return u===h?0:u<h?-1:1;const a=r.test(u),l=r.test(h);return a&&l&&(u=+u,h=+h),u===h?0:a&&!l?-1:l&&!a?1:u<h?-1:1},o=(u,h)=>n(h,u);e.exports={compareIdentifiers:n,rcompareIdentifiers:o}}}),require_semver=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js"(t,e){var r=require_debug(),{MAX_LENGTH:n,MAX_SAFE_INTEGER:o}=require_constants(),{safeRe:u,t:h}=require_re(),a=require_parse_options(),{compareIdentifiers:l}=require_identifiers(),f=class Zt{constructor(d,P){if(P=a(P),d instanceof Zt){if(d.loose===!!P.loose&&d.includePrerelease===!!P.includePrerelease)return d;d=d.version}else if(typeof d!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof d}".`);if(d.length>n)throw new TypeError(`version is longer than ${n} characters`);r("SemVer",d,P),this.options=P,this.loose=!!P.loose,this.includePrerelease=!!P.includePrerelease;const H=d.trim().match(P.loose?u[h.LOOSE]:u[h.FULL]);if(!H)throw new TypeError(`Invalid Version: ${d}`);if(this.raw=d,this.major=+H[1],this.minor=+H[2],this.patch=+H[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");H[4]?this.prerelease=H[4].split(".").map(W=>{if(/^[0-9]+$/.test(W)){const U=+W;if(U>=0&&U<o)return U}return W}):this.prerelease=[],this.build=H[5]?H[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(d){if(r("SemVer.compare",this.version,this.options,d),!(d instanceof Zt)){if(typeof d=="string"&&d===this.version)return 0;d=new Zt(d,this.options)}return d.version===this.version?0:this.compareMain(d)||this.comparePre(d)}compareMain(d){return d instanceof Zt||(d=new Zt(d,this.options)),this.major<d.major?-1:this.major>d.major?1:this.minor<d.minor?-1:this.minor>d.minor?1:this.patch<d.patch?-1:this.patch>d.patch?1:0}comparePre(d){if(d instanceof Zt||(d=new Zt(d,this.options)),this.prerelease.length&&!d.prerelease.length)return-1;if(!this.prerelease.length&&d.prerelease.length)return 1;if(!this.prerelease.length&&!d.prerelease.length)return 0;let P=0;do{const H=this.prerelease[P],W=d.prerelease[P];if(r("prerelease compare",P,H,W),H===void 0&&W===void 0)return 0;if(W===void 0)return 1;if(H===void 0)return-1;if(H===W)continue;return l(H,W)}while(++P)}compareBuild(d){d instanceof Zt||(d=new Zt(d,this.options));let P=0;do{const H=this.build[P],W=d.build[P];if(r("build compare",P,H,W),H===void 0&&W===void 0)return 0;if(W===void 0)return 1;if(H===void 0)return-1;if(H===W)continue;return l(H,W)}while(++P)}inc(d,P,H){if(d.startsWith("pre")){if(!P&&H===!1)throw new Error("invalid increment argument: identifier is empty");if(P){const W=`-${P}`.match(this.options.loose?u[h.PRERELEASELOOSE]:u[h.PRERELEASE]);if(!W||W[1]!==P)throw new Error(`invalid identifier: ${P}`)}}switch(d){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",P,H);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",P,H);break;case"prepatch":this.prerelease.length=0,this.inc("patch",P,H),this.inc("pre",P,H);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",P,H),this.inc("pre",P,H);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const W=Number(H)?1:0;if(this.prerelease.length===0)this.prerelease=[W];else{let U=this.prerelease.length;for(;--U>=0;)typeof this.prerelease[U]=="number"&&(this.prerelease[U]++,U=-2);if(U===-1){if(P===this.prerelease.join(".")&&H===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(W)}}if(P){let U=[P,W];H===!1&&(U=[P]),l(this.prerelease[0],P)===0?isNaN(this.prerelease[1])&&(this.prerelease=U):this.prerelease=U}break}default:throw new Error(`invalid increment argument: ${d}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};e.exports=f}}),require_parse=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js"(t,e){var r=require_semver(),n=(o,u,h=!1)=>{if(o instanceof r)return o;try{return new r(o,u)}catch(a){if(!h)return null;throw a}};e.exports=n}}),require_valid=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js"(t,e){var r=require_parse(),n=(o,u)=>{const h=r(o,u);return h?h.version:null};e.exports=n}}),require_clean=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js"(t,e){var r=require_parse(),n=(o,u)=>{const h=r(o.trim().replace(/^[=v]+/,""),u);return h?h.version:null};e.exports=n}}),require_inc=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js"(t,e){var r=require_semver(),n=(o,u,h,a,l)=>{typeof h=="string"&&(l=a,a=h,h=void 0);try{return new r(o instanceof r?o.version:o,h).inc(u,a,l).version}catch{return null}};e.exports=n}}),require_diff=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js"(t,e){var r=require_parse(),n=(o,u)=>{const h=r(o,null,!0),a=r(u,null,!0),l=h.compare(a);if(l===0)return null;const f=l>0,C=f?h:a,d=f?a:h,P=!!C.prerelease.length;if(!!d.prerelease.length&&!P){if(!d.patch&&!d.minor)return"major";if(d.compareMain(C)===0)return d.minor&&!d.patch?"minor":"patch"}const W=P?"pre":"";return h.major!==a.major?W+"major":h.minor!==a.minor?W+"minor":h.patch!==a.patch?W+"patch":"prerelease"};e.exports=n}}),require_major=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js"(t,e){var r=require_semver(),n=(o,u)=>new r(o,u).major;e.exports=n}}),require_minor=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js"(t,e){var r=require_semver(),n=(o,u)=>new r(o,u).minor;e.exports=n}}),require_patch=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js"(t,e){var r=require_semver(),n=(o,u)=>new r(o,u).patch;e.exports=n}}),require_prerelease=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js"(t,e){var r=require_parse(),n=(o,u)=>{const h=r(o,u);return h&&h.prerelease.length?h.prerelease:null};e.exports=n}}),require_compare=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js"(t,e){var r=require_semver(),n=(o,u,h)=>new r(o,h).compare(new r(u,h));e.exports=n}}),require_rcompare=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js"(t,e){var r=require_compare(),n=(o,u,h)=>r(u,o,h);e.exports=n}}),require_compare_loose=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js"(t,e){var r=require_compare(),n=(o,u)=>r(o,u,!0);e.exports=n}}),require_compare_build=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js"(t,e){var r=require_semver(),n=(o,u,h)=>{const a=new r(o,h),l=new r(u,h);return a.compare(l)||a.compareBuild(l)};e.exports=n}}),require_sort=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js"(t,e){var r=require_compare_build(),n=(o,u)=>o.sort((h,a)=>r(h,a,u));e.exports=n}}),require_rsort=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js"(t,e){var r=require_compare_build(),n=(o,u)=>o.sort((h,a)=>r(a,h,u));e.exports=n}}),require_gt=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js"(t,e){var r=require_compare(),n=(o,u,h)=>r(o,u,h)>0;e.exports=n}}),require_lt=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js"(t,e){var r=require_compare(),n=(o,u,h)=>r(o,u,h)<0;e.exports=n}}),require_eq=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js"(t,e){var r=require_compare(),n=(o,u,h)=>r(o,u,h)===0;e.exports=n}}),require_neq=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js"(t,e){var r=require_compare(),n=(o,u,h)=>r(o,u,h)!==0;e.exports=n}}),require_gte=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js"(t,e){var r=require_compare(),n=(o,u,h)=>r(o,u,h)>=0;e.exports=n}}),require_lte=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js"(t,e){var r=require_compare(),n=(o,u,h)=>r(o,u,h)<=0;e.exports=n}}),require_cmp=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js"(t,e){var r=require_eq(),n=require_neq(),o=require_gt(),u=require_gte(),h=require_lt(),a=require_lte(),l=(f,C,d,P)=>{switch(C){case"===":return typeof f=="object"&&(f=f.version),typeof d=="object"&&(d=d.version),f===d;case"!==":return typeof f=="object"&&(f=f.version),typeof d=="object"&&(d=d.version),f!==d;case"":case"=":case"==":return r(f,d,P);case"!=":return n(f,d,P);case">":return o(f,d,P);case">=":return u(f,d,P);case"<":return h(f,d,P);case"<=":return a(f,d,P);default:throw new TypeError(`Invalid operator: ${C}`)}};e.exports=l}}),require_coerce=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js"(t,e){var r=require_semver(),n=require_parse(),{safeRe:o,t:u}=require_re(),h=(a,l)=>{if(a instanceof r)return a;if(typeof a=="number"&&(a=String(a)),typeof a!="string")return null;l=l||{};let f=null;if(!l.rtl)f=a.match(l.includePrerelease?o[u.COERCEFULL]:o[u.COERCE]);else{const U=l.includePrerelease?o[u.COERCERTLFULL]:o[u.COERCERTL];let L;for(;(L=U.exec(a))&&(!f||f.index+f[0].length!==a.length);)(!f||L.index+L[0].length!==f.index+f[0].length)&&(f=L),U.lastIndex=L.index+L[1].length+L[2].length;U.lastIndex=-1}if(f===null)return null;const C=f[2],d=f[3]||"0",P=f[4]||"0",H=l.includePrerelease&&f[5]?`-${f[5]}`:"",W=l.includePrerelease&&f[6]?`+${f[6]}`:"";return n(`${C}.${d}.${P}${H}${W}`,l)};e.exports=h}}),require_lrucache=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js"(t,e){var r=class{constructor(){this.max=1e3,this.map=new Map}get(n){const o=this.map.get(n);if(o!==void 0)return this.map.delete(n),this.map.set(n,o),o}delete(n){return this.map.delete(n)}set(n,o){if(!this.delete(n)&&o!==void 0){if(this.map.size>=this.max){const h=this.map.keys().next().value;this.delete(h)}this.map.set(n,o)}return this}};e.exports=r}}),require_range=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js"(t,e){var r=/\s+/g,n=class dn{constructor(me,de){if(de=h(de),me instanceof dn)return me.loose===!!de.loose&&me.includePrerelease===!!de.includePrerelease?me:new dn(me.raw,de);if(me instanceof a)return this.raw=me.value,this.set=[[me]],this.formatted=void 0,this;if(this.options=de,this.loose=!!de.loose,this.includePrerelease=!!de.includePrerelease,this.raw=me.trim().replace(r," "),this.set=this.raw.split("||").map(Q=>this.parseRange(Q.trim())).filter(Q=>Q.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const Q=this.set[0];if(this.set=this.set.filter(re=>!N(re[0])),this.set.length===0)this.set=[Q];else if(this.set.length>1){for(const re of this.set)if(re.length===1&&x(re[0])){this.set=[re];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let me=0;me<this.set.length;me++){me>0&&(this.formatted+="||");const de=this.set[me];for(let Q=0;Q<de.length;Q++)Q>0&&(this.formatted+=" "),this.formatted+=de[Q].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(me){const Q=((this.options.includePrerelease&&U)|(this.options.loose&&L))+":"+me,re=u.get(Q);if(re)return re;const Z=this.options.loose,ie=Z?C[d.HYPHENRANGELOOSE]:C[d.HYPHENRANGE];me=me.replace(ie,we(this.options.includePrerelease)),l("hyphen replace",me),me=me.replace(C[d.COMPARATORTRIM],P),l("comparator trim",me),me=me.replace(C[d.TILDETRIM],H),l("tilde trim",me),me=me.replace(C[d.CARETTRIM],W),l("caret trim",me);let ge=me.split(" ").map(ue=>V(ue,this.options)).join(" ").split(/\s+/).map(ue=>oe(ue,this.options));Z&&(ge=ge.filter(ue=>(l("loose invalid filter",ue,this.options),!!ue.match(C[d.COMPARATORLOOSE])))),l("range list",ge);const fe=new Map,xe=ge.map(ue=>new a(ue,this.options));for(const ue of xe){if(N(ue))return[ue];fe.set(ue.value,ue)}fe.size>1&&fe.has("")&&fe.delete("");const ke=[...fe.values()];return u.set(Q,ke),ke}intersects(me,de){if(!(me instanceof dn))throw new TypeError("a Range is required");return this.set.some(Q=>j(Q,de)&&me.set.some(re=>j(re,de)&&Q.every(Z=>re.every(ie=>Z.intersects(ie,de)))))}test(me){if(!me)return!1;if(typeof me=="string")try{me=new f(me,this.options)}catch{return!1}for(let de=0;de<this.set.length;de++)if(be(this.set[de],me,this.options))return!0;return!1}};e.exports=n;var o=require_lrucache(),u=new o,h=require_parse_options(),a=require_comparator(),l=require_debug(),f=require_semver(),{safeRe:C,t:d,comparatorTrimReplace:P,tildeTrimReplace:H,caretTrimReplace:W}=require_re(),{FLAG_INCLUDE_PRERELEASE:U,FLAG_LOOSE:L}=require_constants(),N=ve=>ve.value==="<0.0.0-0",x=ve=>ve.value==="",j=(ve,me)=>{let de=!0;const Q=ve.slice();let re=Q.pop();for(;de&&Q.length;)de=Q.every(Z=>re.intersects(Z,me)),re=Q.pop();return de},V=(ve,me)=>(ve=ve.replace(C[d.BUILD],""),l("comp",ve,me),ve=G(ve,me),l("caret",ve),ve=J(ve,me),l("tildes",ve),ve=ne(ve,me),l("xrange",ve),ve=ce(ve,me),l("stars",ve),ve),Y=ve=>!ve||ve.toLowerCase()==="x"||ve==="*",J=(ve,me)=>ve.trim().split(/\s+/).map(de=>X(de,me)).join(" "),X=(ve,me)=>{const de=me.loose?C[d.TILDELOOSE]:C[d.TILDE];return ve.replace(de,(Q,re,Z,ie,ge)=>{l("tilde",ve,Q,re,Z,ie,ge);let fe;return Y(re)?fe="":Y(Z)?fe=`>=${re}.0.0 <${+re+1}.0.0-0`:Y(ie)?fe=`>=${re}.${Z}.0 <${re}.${+Z+1}.0-0`:ge?(l("replaceTilde pr",ge),fe=`>=${re}.${Z}.${ie}-${ge} <${re}.${+Z+1}.0-0`):fe=`>=${re}.${Z}.${ie} <${re}.${+Z+1}.0-0`,l("tilde return",fe),fe})},G=(ve,me)=>ve.trim().split(/\s+/).map(de=>ee(de,me)).join(" "),ee=(ve,me)=>{l("caret",ve,me);const de=me.loose?C[d.CARETLOOSE]:C[d.CARET],Q=me.includePrerelease?"-0":"";return ve.replace(de,(re,Z,ie,ge,fe)=>{l("caret",ve,re,Z,ie,ge,fe);let xe;return Y(Z)?xe="":Y(ie)?xe=`>=${Z}.0.0${Q} <${+Z+1}.0.0-0`:Y(ge)?Z==="0"?xe=`>=${Z}.${ie}.0${Q} <${Z}.${+ie+1}.0-0`:xe=`>=${Z}.${ie}.0${Q} <${+Z+1}.0.0-0`:fe?(l("replaceCaret pr",fe),Z==="0"?ie==="0"?xe=`>=${Z}.${ie}.${ge}-${fe} <${Z}.${ie}.${+ge+1}-0`:xe=`>=${Z}.${ie}.${ge}-${fe} <${Z}.${+ie+1}.0-0`:xe=`>=${Z}.${ie}.${ge}-${fe} <${+Z+1}.0.0-0`):(l("no pr"),Z==="0"?ie==="0"?xe=`>=${Z}.${ie}.${ge}${Q} <${Z}.${ie}.${+ge+1}-0`:xe=`>=${Z}.${ie}.${ge}${Q} <${Z}.${+ie+1}.0-0`:xe=`>=${Z}.${ie}.${ge} <${+Z+1}.0.0-0`),l("caret return",xe),xe})},ne=(ve,me)=>(l("replaceXRanges",ve,me),ve.split(/\s+/).map(de=>ae(de,me)).join(" ")),ae=(ve,me)=>{ve=ve.trim();const de=me.loose?C[d.XRANGELOOSE]:C[d.XRANGE];return ve.replace(de,(Q,re,Z,ie,ge,fe)=>{l("xRange",ve,Q,re,Z,ie,ge,fe);const xe=Y(Z),ke=xe||Y(ie),ue=ke||Y(ge),se=ue;return re==="="&&se&&(re=""),fe=me.includePrerelease?"-0":"",xe?re===">"||re==="<"?Q="<0.0.0-0":Q="*":re&&se?(ke&&(ie=0),ge=0,re===">"?(re=">=",ke?(Z=+Z+1,ie=0,ge=0):(ie=+ie+1,ge=0)):re==="<="&&(re="<",ke?Z=+Z+1:ie=+ie+1),re==="<"&&(fe="-0"),Q=`${re+Z}.${ie}.${ge}${fe}`):ke?Q=`>=${Z}.0.0${fe} <${+Z+1}.0.0-0`:ue&&(Q=`>=${Z}.${ie}.0${fe} <${Z}.${+ie+1}.0-0`),l("xRange return",Q),Q})},ce=(ve,me)=>(l("replaceStars",ve,me),ve.trim().replace(C[d.STAR],"")),oe=(ve,me)=>(l("replaceGTE0",ve,me),ve.trim().replace(C[me.includePrerelease?d.GTE0PRE:d.GTE0],"")),we=ve=>(me,de,Q,re,Z,ie,ge,fe,xe,ke,ue,se)=>(Y(Q)?de="":Y(re)?de=`>=${Q}.0.0${ve?"-0":""}`:Y(Z)?de=`>=${Q}.${re}.0${ve?"-0":""}`:ie?de=`>=${de}`:de=`>=${de}${ve?"-0":""}`,Y(xe)?fe="":Y(ke)?fe=`<${+xe+1}.0.0-0`:Y(ue)?fe=`<${xe}.${+ke+1}.0-0`:se?fe=`<=${xe}.${ke}.${ue}-${se}`:ve?fe=`<${xe}.${ke}.${+ue+1}-0`:fe=`<=${fe}`,`${de} ${fe}`.trim()),be=(ve,me,de)=>{for(let Q=0;Q<ve.length;Q++)if(!ve[Q].test(me))return!1;if(me.prerelease.length&&!de.includePrerelease){for(let Q=0;Q<ve.length;Q++)if(l(ve[Q].semver),ve[Q].semver!==a.ANY&&ve[Q].semver.prerelease.length>0){const re=ve[Q].semver;if(re.major===me.major&&re.minor===me.minor&&re.patch===me.patch)return!0}return!1}return!0}}}),require_comparator=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js"(t,e){var r=Symbol("SemVer ANY"),n=class ra{static get ANY(){return r}constructor(P,H){if(H=o(H),P instanceof ra){if(P.loose===!!H.loose)return P;P=P.value}P=P.trim().split(/\s+/).join(" "),l("comparator",P,H),this.options=H,this.loose=!!H.loose,this.parse(P),this.semver===r?this.value="":this.value=this.operator+this.semver.version,l("comp",this)}parse(P){const H=this.options.loose?u[h.COMPARATORLOOSE]:u[h.COMPARATOR],W=P.match(H);if(!W)throw new TypeError(`Invalid comparator: ${P}`);this.operator=W[1]!==void 0?W[1]:"",this.operator==="="&&(this.operator=""),W[2]?this.semver=new f(W[2],this.options.loose):this.semver=r}toString(){return this.value}test(P){if(l("Comparator.test",P,this.options.loose),this.semver===r||P===r)return!0;if(typeof P=="string")try{P=new f(P,this.options)}catch{return!1}return a(P,this.operator,this.semver,this.options)}intersects(P,H){if(!(P instanceof ra))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new C(P.value,H).test(this.value):P.operator===""?P.value===""?!0:new C(this.value,H).test(P.semver):(H=o(H),H.includePrerelease&&(this.value==="<0.0.0-0"||P.value==="<0.0.0-0")||!H.includePrerelease&&(this.value.startsWith("<0.0.0")||P.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&P.operator.startsWith(">")||this.operator.startsWith("<")&&P.operator.startsWith("<")||this.semver.version===P.semver.version&&this.operator.includes("=")&&P.operator.includes("=")||a(this.semver,"<",P.semver,H)&&this.operator.startsWith(">")&&P.operator.startsWith("<")||a(this.semver,">",P.semver,H)&&this.operator.startsWith("<")&&P.operator.startsWith(">")))}};e.exports=n;var o=require_parse_options(),{safeRe:u,t:h}=require_re(),a=require_cmp(),l=require_debug(),f=require_semver(),C=require_range()}}),require_satisfies=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js"(t,e){var r=require_range(),n=(o,u,h)=>{try{u=new r(u,h)}catch{return!1}return u.test(o)};e.exports=n}}),require_to_comparators=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js"(t,e){var r=require_range(),n=(o,u)=>new r(o,u).set.map(h=>h.map(a=>a.value).join(" ").trim().split(" "));e.exports=n}}),require_max_satisfying=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js"(t,e){var r=require_semver(),n=require_range(),o=(u,h,a)=>{let l=null,f=null,C=null;try{C=new n(h,a)}catch{return null}return u.forEach(d=>{C.test(d)&&(!l||f.compare(d)===-1)&&(l=d,f=new r(l,a))}),l};e.exports=o}}),require_min_satisfying=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js"(t,e){var r=require_semver(),n=require_range(),o=(u,h,a)=>{let l=null,f=null,C=null;try{C=new n(h,a)}catch{return null}return u.forEach(d=>{C.test(d)&&(!l||f.compare(d)===1)&&(l=d,f=new r(l,a))}),l};e.exports=o}}),require_min_version=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js"(t,e){var r=require_semver(),n=require_range(),o=require_gt(),u=(h,a)=>{h=new n(h,a);let l=new r("0.0.0");if(h.test(l)||(l=new r("0.0.0-0"),h.test(l)))return l;l=null;for(let f=0;f<h.set.length;++f){const C=h.set[f];let d=null;C.forEach(P=>{const H=new r(P.semver.version);switch(P.operator){case">":H.prerelease.length===0?H.patch++:H.prerelease.push(0),H.raw=H.format();case"":case">=":(!d||o(H,d))&&(d=H);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${P.operator}`)}}),d&&(!l||o(l,d))&&(l=d)}return l&&h.test(l)?l:null};e.exports=u}}),require_valid2=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js"(t,e){var r=require_range(),n=(o,u)=>{try{return new r(o,u).range||"*"}catch{return null}};e.exports=n}}),require_outside=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js"(t,e){var r=require_semver(),n=require_comparator(),{ANY:o}=n,u=require_range(),h=require_satisfies(),a=require_gt(),l=require_lt(),f=require_lte(),C=require_gte(),d=(P,H,W,U)=>{P=new r(P,U),H=new u(H,U);let L,N,x,j,V;switch(W){case">":L=a,N=f,x=l,j=">",V=">=";break;case"<":L=l,N=C,x=a,j="<",V="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(h(P,H,U))return!1;for(let Y=0;Y<H.set.length;++Y){const J=H.set[Y];let X=null,G=null;if(J.forEach(ee=>{ee.semver===o&&(ee=new n(">=0.0.0")),X=X||ee,G=G||ee,L(ee.semver,X.semver,U)?X=ee:x(ee.semver,G.semver,U)&&(G=ee)}),X.operator===j||X.operator===V||(!G.operator||G.operator===j)&&N(P,G.semver))return!1;if(G.operator===V&&x(P,G.semver))return!1}return!0};e.exports=d}}),require_gtr=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js"(t,e){var r=require_outside(),n=(o,u,h)=>r(o,u,">",h);e.exports=n}}),require_ltr=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js"(t,e){var r=require_outside(),n=(o,u,h)=>r(o,u,"<",h);e.exports=n}}),require_intersects=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js"(t,e){var r=require_range(),n=(o,u,h)=>(o=new r(o,h),u=new r(u,h),o.intersects(u,h));e.exports=n}}),require_simplify=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js"(t,e){var r=require_satisfies(),n=require_compare();e.exports=(o,u,h)=>{const a=[];let l=null,f=null;const C=o.sort((W,U)=>n(W,U,h));for(const W of C)r(W,u,h)?(f=W,l||(l=W)):(f&&a.push([l,f]),f=null,l=null);l&&a.push([l,null]);const d=[];for(const[W,U]of a)W===U?d.push(W):!U&&W===C[0]?d.push("*"):U?W===C[0]?d.push(`<=${U}`):d.push(`${W} - ${U}`):d.push(`>=${W}`);const P=d.join(" || "),H=typeof u.raw=="string"?u.raw:String(u);return P.length<H.length?P:u}}}),require_subset=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js"(t,e){var r=require_range(),n=require_comparator(),{ANY:o}=n,u=require_satisfies(),h=require_compare(),a=(H,W,U={})=>{if(H===W)return!0;H=new r(H,U),W=new r(W,U);let L=!1;e:for(const N of H.set){for(const x of W.set){const j=C(N,x,U);if(L=L||j!==null,j)continue e}if(L)return!1}return!0},l=[new n(">=0.0.0-0")],f=[new n(">=0.0.0")],C=(H,W,U)=>{if(H===W)return!0;if(H.length===1&&H[0].semver===o){if(W.length===1&&W[0].semver===o)return!0;U.includePrerelease?H=l:H=f}if(W.length===1&&W[0].semver===o){if(U.includePrerelease)return!0;W=f}const L=new Set;let N,x;for(const ne of H)ne.operator===">"||ne.operator===">="?N=d(N,ne,U):ne.operator==="<"||ne.operator==="<="?x=P(x,ne,U):L.add(ne.semver);if(L.size>1)return null;let j;if(N&&x){if(j=h(N.semver,x.semver,U),j>0)return null;if(j===0&&(N.operator!==">="||x.operator!=="<="))return null}for(const ne of L){if(N&&!u(ne,String(N),U)||x&&!u(ne,String(x),U))return null;for(const ae of W)if(!u(ne,String(ae),U))return!1;return!0}let V,Y,J,X,G=x&&!U.includePrerelease&&x.semver.prerelease.length?x.semver:!1,ee=N&&!U.includePrerelease&&N.semver.prerelease.length?N.semver:!1;G&&G.prerelease.length===1&&x.operator==="<"&&G.prerelease[0]===0&&(G=!1);for(const ne of W){if(X=X||ne.operator===">"||ne.operator===">=",J=J||ne.operator==="<"||ne.operator==="<=",N){if(ee&&ne.semver.prerelease&&ne.semver.prerelease.length&&ne.semver.major===ee.major&&ne.semver.minor===ee.minor&&ne.semver.patch===ee.patch&&(ee=!1),ne.operator===">"||ne.operator===">="){if(V=d(N,ne,U),V===ne&&V!==N)return!1}else if(N.operator===">="&&!u(N.semver,String(ne),U))return!1}if(x){if(G&&ne.semver.prerelease&&ne.semver.prerelease.length&&ne.semver.major===G.major&&ne.semver.minor===G.minor&&ne.semver.patch===G.patch&&(G=!1),ne.operator==="<"||ne.operator==="<="){if(Y=P(x,ne,U),Y===ne&&Y!==x)return!1}else if(x.operator==="<="&&!u(x.semver,String(ne),U))return!1}if(!ne.operator&&(x||N)&&j!==0)return!1}return!(N&&J&&!x&&j!==0||x&&X&&!N&&j!==0||ee||G)},d=(H,W,U)=>{if(!H)return W;const L=h(H.semver,W.semver,U);return L>0?H:L<0||W.operator===">"&&H.operator===">="?W:H},P=(H,W,U)=>{if(!H)return W;const L=h(H.semver,W.semver,U);return L<0?H:L>0||W.operator==="<"&&H.operator==="<="?W:H};e.exports=a}}),require_semver2=__commonJS({"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js"(t,e){var r=require_re(),n=require_constants(),o=require_semver(),u=require_identifiers(),h=require_parse(),a=require_valid(),l=require_clean(),f=require_inc(),C=require_diff(),d=require_major(),P=require_minor(),H=require_patch(),W=require_prerelease(),U=require_compare(),L=require_rcompare(),N=require_compare_loose(),x=require_compare_build(),j=require_sort(),V=require_rsort(),Y=require_gt(),J=require_lt(),X=require_eq(),G=require_neq(),ee=require_gte(),ne=require_lte(),ae=require_cmp(),ce=require_coerce(),oe=require_comparator(),we=require_range(),be=require_satisfies(),ve=require_to_comparators(),me=require_max_satisfying(),de=require_min_satisfying(),Q=require_min_version(),re=require_valid2(),Z=require_outside(),ie=require_gtr(),ge=require_ltr(),fe=require_intersects(),xe=require_simplify(),ke=require_subset();e.exports={parse:h,valid:a,clean:l,inc:f,diff:C,major:d,minor:P,patch:H,prerelease:W,compare:U,rcompare:L,compareLoose:N,compareBuild:x,sort:j,rsort:V,gt:Y,lt:J,eq:X,neq:G,gte:ee,lte:ne,cmp:ae,coerce:ce,Comparator:oe,Range:we,satisfies:be,toComparators:ve,maxSatisfying:me,minSatisfying:de,minVersion:Q,validRange:re,outside:Z,gtr:ie,ltr:ge,intersects:fe,simplifyRange:xe,subset:ke,SemVer:o,re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:n.SEMVER_SPEC_VERSION,RELEASE_TYPES:n.RELEASE_TYPES,compareIdentifiers:u.compareIdentifiers,rcompareIdentifiers:u.rcompareIdentifiers}}}),CliForegroundColor=(t=>(t.Black="\x1B[30m",t.Red="\x1B[31m",t.Green="\x1B[32m",t.Yellow="\x1B[33m",t.Blue="\x1B[34m",t.Magenta="\x1B[35m",t.Cyan="\x1B[36m",t.White="\x1B[37m",t.Reset="\x1B[0m",t))(CliForegroundColor||{}),CliBackgroundColor=(t=>(t.Black="\x1B[40m",t.Red="\x1B[41m",t.Green="\x1B[42m",t.Yellow="\x1B[43m",t.Blue="\x1B[44m",t.Magenta="\x1B[45m",t.Cyan="\x1B[46m",t.White="\x1B[47m",t))(CliBackgroundColor||{}),CliIcon=(t=>(t.CheckIcon="✔",t.CrossIcon="✘",t.InfoIcon="ℹ",t.WarningIcon="⚠",t.QuestionMark="?",t.Exclamation="❗",t.Ellipsis="…",t.Dot="•",t.Bullet="‣",t.ArrowRight="→",t.ArrowLeft="←",t.ArrowUp="↑",t.ArrowDown="↓",t.ArrowRightFilled="▶",t.ArrowLeftFilled="◀",t.ArrowUpFilled="▲",t.ArrowDownFilled="▼",t.DoubleArrowRight="»",t.DoubleArrowLeft="«",t.Star="★",t.StarEmpty="☆",t.Plus="+",t.Minus="-",t.Progress="⏳",t.Success="✅",t.Failure="❌",t.Clock="⏰",t.Timer="⏱",t.Alarm="🔔",t.Calendar="📅",t.Folder="📁",t.FolderOpen="📂",t.File="📄",t.Archive="🗃",t.Link="🔗",t.Chain="⛓",t.Bookmark="🔖",t.Edit="✏",t.Trash="🗑",t.Add="➕",t.Remove="➖",t.Reload="🔄",t.Save="💾",t.Undo="↩",t.Redo="↪",t.Play="▶",t.Pause="⏸",t.Stop="⏹",t.Cancel="❎",t.User="👤",t.Group="👥",t.Lock="🔒",t.Unlock="🔓",t.Help="❓",t.Key="🔑",t.Shield="🛡",t.Gear="⚙",t.Settings="⚙️",t.Theme="🎨",t.Light="💡",t.Bug="🐞",t.Wrench="🔧",t.Hammer="🔨",t.Terminal="💻",t.Database="🗄",t.Server="🖥",t.Cloud="☁",t.Network="🌐",t.Monitor="📺",t.Printer="🖨",t.USB="🔌",t.Speaker="🔊",t.Microphone="🎙",t.Camera="📷",t.Video="🎥",t.Music="🎵",t.Phone="📞",t.Package="📦",t.Plugin="🧩",t.Extension="🔌",t.Module="🧱",t.Evaluate="🔍",t.Variable="𝑥",t.Script="📜",t.Code="📝",t.Logs="📋",t.Power="⏻",t.Heart="❤",t.Flame="🔥",t.Growth="📈",t.Decline="📉",t.WarningFilled="⚠️",t.Sun="☀",t.Moon="🌙",t.Rain="🌧",t.Snow="❄",t.Lightning="⚡",t.Tree="🌲",t.Smile="😊",t.Sad="😢",t.Angry="😡",t.Clap="👏",t.ThumbsUp="👍",t.ThumbsDown="👎",t.Rocket="🚀",t.Globe="🌍",t.Medal="🏅",t.Trophy="🏆",t.Flag="🚩",t.StarFilled="⭐",t.StarOutline="✩",t.Fireworks="🎆",t.Balloon="🎈",t.Gift="🎁",t))(CliIcon||{}),CliLogLevel=(t=>(t[t.None=0]="None",t[t.DEBUG=1]="DEBUG",t[t.LOG=2]="LOG",t[t.INFO=3]="INFO",t[t.WARN=4]="WARN",t[t.ERROR=5]="ERROR",t))(CliLogLevel||{}),enums={CliForegroundColor,CliBackgroundColor,CliIcon,CliLogLevel},ICliCompletionProvider_TOKEN="cli-completion-provider",ICliDragDropService_TOKEN="cli-drag-drop-service",ICliTranslationService_TOKEN="cli-translation-service",DefaultLibraryAuthor={name:"Nicolae Lupei",email:"nicolae.lupei@qodalis.com"},constants={DefaultLibraryAuthor},delay=t=>new Promise(e=>setTimeout(e,t)),ObjectDescriber=class{static describe(t,e){var h,a;const{filter:r}=e||{},n=[],u=Object.keys(t).filter(l=>typeof t[l]=="function");for(const l of u){const f=t[l],C=this.getFunctionArguments(f);if(r&&!r({funcName:l,func:f,args:C}))continue;const d=C.length>1,P=this.supportsDynamicArgs(f);if(C.length===0&&!P||C.length>0&&C.some(W=>W==="function"||W==="func"))continue;const H={command:l,description:`A command that executes the function ${l} with the provided arguments`,acceptsRawInput:!0,valueRequired:!0,parameters:[{name:"debug",description:"Debug",type:"boolean",required:!1}],processCommand:async(W,U)=>{const L=W.args.debug;L&&(U.writer.writeln("Executing command: "+l),U.writer.writeln("Arguments: "+JSON.stringify(W.args)),U.writer.writeln("Function: "+f.toString()));const N=[];if(d)for(const j of C.slice(1))N.push(W.args[j]);if(P&&W.value){const j=W.args.delimiter||",";N.push(...W.value.split(j))}L&&U.writer.writeln("Arguments after processing: "+JSON.stringify(N));const x=P&&C.length===0?f(...N):f(W.value,...N);U.writer.write(U.writer.wrapInColor("Result: ","\x1B[33m")),x===null?U.writer.writeln("null"):x===void 0?U.writer.writeln("undefined"):typeof x=="boolean"||typeof x=="number"?U.writer.writeln(x.toString()):Array.isArray(x)?U.writer.writeJson(x):typeof x=="string"?U.writer.writeln(x):typeof x=="object"?U.writer.writeJson(x):U.writer.writeln(x==null?void 0:x.toString()),U.process.output(x==null?void 0:x.toString())},writeDescription:W=>{W.writer.writeln(l)}};P&&((h=H.parameters)==null||h.push({name:"delimiter",description:"Delimiter",type:"string",required:!1})),d&&((a=H.parameters)==null||a.push(...C.slice(1).map(W=>({name:W,description:W,type:"string",required:!1})))),n.push(H)}return n}static supportsDynamicArgs(t){return t.toString().includes("arguments")}static getFunctionArguments(t){const r=t.toString().match(/\(([^)]*)\)/);return r?r[1].split(",").map(n=>n.trim()).filter(n=>n!==""):[]}},CLI_CONFIGURE_STORE_NAME="configure";function getConfigValue(t,e,r,n){var o;try{const u=t.getState(),h=e==="system"?u==null?void 0:u.system:(o=u==null?void 0:u.plugins)==null?void 0:o[e];if(h&&r in h)return h[r]}catch{}return n}function getPluginConfigValue(t,e,r,n){try{const o=t.services.get("cli-state-store-manager");if(!o)return n;const u=o.getStateStore(CLI_CONFIGURE_STORE_NAME);return u?getConfigValue(u,e,r,n):n}catch{return n}}function resolveConfigurationCategories(t){const e=new Map;for(const r of t.processors)if(r.configurationOptions&&r.configurationOptions.length>0)for(const n of r.configurationOptions){const o=n.category||r.command;e.has(o)||e.set(o,{processorCommand:r.command,options:[]}),e.get(o).options.push(n)}return e}var clearTerminalLine=(t,e)=>{if(e<=0)return;const r=Math.ceil(e/t.cols);for(let n=0;n<r;n++)t.write("\x1B[2K"),n<r-1&&t.write("\x1B[A");t.write("\r")},semver=__toESM(require_semver2());function satisfiesVersionRange(t,e){if(!e)return!0;const r=semver.coerce(t);return r?semver.valid(e)?semver.gte(r,semver.coerce(e)):semver.satisfies(r,e):!1}var LIBRARY_VERSION$1="2.0.0-beta.10",API_VERSION$1=2,VERSIONS_ENDPOINT="/api/qcli/versions",_s,ServerVersionNegotiator=(_s=class{static negotiate(e){const r=this.CLIENT_SUPPORTED_VERSIONS.filter(n=>e.supportedVersions.includes(n));return r.length>0?Math.max(...r):null}static async discover(e){try{const r=await fetch(`${e}${VERSIONS_ENDPOINT}`);if(!r.ok)return null;const n=await r.json(),o=this.negotiate(n);return o===null?null:{apiVersion:o,basePath:`${e}/api/v${o}/qcli`}}catch{return null}}},_s.CLIENT_SUPPORTED_VERSIONS=[API_VERSION$1],_s),ANSI_RE=/\x1b\[[0-9;]*m/g;function stripAnsi(t){return t.replace(ANSI_RE,"")}function visibleLength(t){return stripAnsi(t).length}var getParameterValue=(t,e)=>{var n;if(e[t.name]!==void 0)return e[t.name];const r=(n=t.aliases)==null?void 0:n.find(o=>e[o]!==void 0);return r?e[r]:void 0},formatJson=t=>{const e=JSON.stringify(t,null,2);return colorizeJson(e.split(`
70
- `).join(`\r
71
- `))},colorizeJson=t=>{const e="\x1B[0m",r="\x1B[36m",n="\x1B[32m",o="\x1B[33m",u="\x1B[90m",h=/("(?:[^"\\]|\\.)*"?)(\s*:)?|(\btrue\b|\bfalse\b|\bnull\b)|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|([{}[\],])/g;let a="",l=0,f;for(;(f=h.exec(t))!==null;)f.index>l&&(a+=t.slice(l,f.index)),f[1]!==void 0?f[2]!==void 0?a+=r+f[1]+e+f[2]:a+=n+f[1]+e:f[3]!==void 0?a+=o+f[3]+e:f[4]!==void 0?a+=o+f[4]+e:f[5]!==void 0&&(a+=u+f[5]+e),l=f.index+f[0].length;return l<t.length&&(a+=t.slice(l)),a},toQueryString=t=>{const e=new URLSearchParams;for(const[r,n]of Object.entries(t))Array.isArray(n)?n.forEach(o=>e.append(r,o.toString())):n!=null&&e.append(r,n.toString());return e.toString()},highlightTextWithBg=(t,e,r="\x1B[43m")=>t.replace(e,n=>`${r}${n}\x1B[0m`),getRightOfWord=(t,e)=>{const r=t.indexOf(e);if(r!==-1)return t.slice(r+e.length).trim()},colorFirstWord=(t,e)=>{if(!t)return t;const r=t.match(/^(\s*)(\S+)(.*)$/);if(!r)return t;const[,n,o,u]=r,h=e(o);return`${n}${h}${u}`},utils={getParameterValue,formatJson,colorizeJson,toQueryString,highlightTextWithBg,getRightOfWord,colorFirstWord,ObjectDescriber,delay,getConfigValue,getPluginConfigValue,resolveConfigurationCategories,CLI_CONFIGURE_STORE_NAME},CliModuleRegistry=class{constructor(){this.modules=new Map,this.bootHandlers=[]}onModuleBoot(t){this.bootHandlers.push(t)}async register(t){const e=t.apiVersion;if(typeof e!="number"||e<API_VERSION$1){const r=`[CLI] Plugin "${t.name}" targets API version ${e??"unknown"}, but this runtime requires API version ${API_VERSION$1}. Skipping.`;this.onWarn?this.onWarn(r):console.warn(r);return}this.modules.set(t.name,t);for(const r of this.bootHandlers)try{await r(t)}catch(n){const o=`[CLI] Boot handler failed for module "${t.name}": ${n instanceof Error?n.message:n}`;this.onWarn?this.onWarn(o):console.warn(o)}}getModule(t){return this.modules.get(t)}getAll(){return Array.from(this.modules.values())}track(t){this.modules.set(t.name,t)}has(t){return this.modules.has(t)}},initializeBrowserEnvironment=({context:t,registry:e})=>{window.__cliModuleRegistry=e,window.cliCore={...constants,...utils,...enums,bootCliModule,bootUmdModule},Object.defineProperty(window,"ngCore",{configurable:!0,get(){return console.warn("CLI: Angular decorators are not supported in UMD modules. Use plain classes instead."),{Injectable:()=>()=>{}}}})},bootCliModule=async t=>{typeof window<"u"&&window.__cliModuleRegistry&&await window.__cliModuleRegistry.register(t)},bootUmdModule=async t=>{await bootCliModule(t)},CANCELLATION_ERROR_MESSAGE="Promise cancelled",CancellablePromise=class{constructor(t){this.executor=t,this.hasCancelled=!1,this.abortController=new AbortController}execute(){return new Promise((t,e)=>{this.abortController.signal.onabort=()=>{e(new Error(CANCELLATION_ERROR_MESSAGE))},this.executor(r=>{this.hasCancelled||t(r)},r=>{this.hasCancelled||e(r)})})}cancel(){this.hasCancelled=!0,this.abortController.abort()}},DefaultThemes={default:{background:"#070b14",foreground:"#dee2ea",cursor:"#818cf8",selectionBackground:"#334155",selectionForeground:"#ffffff",black:"#0d1117",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#818cf8",magenta:"#c084fc",cyan:"#67e8f9",white:"#dee2ea",brightBlack:"#475569",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde68a",brightBlue:"#a5b4fc",brightMagenta:"#d8b4fe",brightCyan:"#a5f3fc",brightWhite:"#f1f5f9"},classic:{background:"#0c0c0c",foreground:"#cccccc",cursor:"#cccccc",selectionBackground:"#264f78",selectionForeground:"#ffffff",black:"#0c0c0c",red:"#c50f1f",green:"#13a10e",yellow:"#c19c00",blue:"#0037da",magenta:"#881798",cyan:"#3a96dd",white:"#cccccc",brightBlack:"#767676",brightRed:"#e74856",brightGreen:"#16c60c",brightYellow:"#f9f1a5",brightBlue:"#3b78ff",brightMagenta:"#b4009e",brightCyan:"#61d6d6",brightWhite:"#f2f2f2"},dracula:{background:"#282A36",foreground:"#F8F8F2",cursor:"#50FA7B",black:"#21222C",red:"#FF5555",green:"#50FA7B",yellow:"#F1FA8C",blue:"#BD93F9",magenta:"#FF79C6",cyan:"#8BE9FD",white:"#F8F8F2",brightBlack:"#6272A4",brightRed:"#FF6E6E",brightGreen:"#69FF94",brightYellow:"#FFFFA5",brightBlue:"#D6ACFF",brightMagenta:"#FF92D0",brightCyan:"#A4FFFF",brightWhite:"#FFFFFF"},monokai:{background:"#272822",foreground:"#F8F8F2",cursor:"#F8F8F0",black:"#272822",red:"#F92672",green:"#A6E22E",yellow:"#F4BF75",blue:"#66D9EF",magenta:"#AE81FF",cyan:"#A1EFE4",white:"#F8F8F2",brightBlack:"#75715E",brightRed:"#F92672",brightGreen:"#A6E22E",brightYellow:"#F4BF75",brightBlue:"#66D9EF",brightMagenta:"#AE81FF",brightCyan:"#A1EFE4",brightWhite:"#F9F8F5"},solarizedDark:{background:"#002B36",foreground:"#839496",cursor:"#93A1A1",black:"#073642",red:"#DC322F",green:"#859900",yellow:"#B58900",blue:"#268BD2",magenta:"#D33682",cyan:"#2AA198",white:"#EEE8D5",brightBlack:"#002B36",brightRed:"#CB4B16",brightGreen:"#586E75",brightYellow:"#657B83",brightBlue:"#839496",brightMagenta:"#6C71C4",brightCyan:"#93A1A1",brightWhite:"#FDF6E3"},solarizedLight:{background:"#FDF6E3",foreground:"#657B83",cursor:"#586E75",black:"#073642",red:"#DC322F",green:"#859900",yellow:"#B58900",blue:"#268BD2",magenta:"#D33682",cyan:"#2AA198",white:"#EEE8D5",brightBlack:"#002B36",brightRed:"#CB4B16",brightGreen:"#586E75",brightYellow:"#657B83",brightBlue:"#839496",brightMagenta:"#6C71C4",brightCyan:"#93A1A1",brightWhite:"#FDF6E3"},gruvboxDark:{background:"#282828",foreground:"#EBDBB2",cursor:"#EBDBB2",black:"#282828",red:"#CC241D",green:"#98971A",yellow:"#D79921",blue:"#458588",magenta:"#B16286",cyan:"#689D6A",white:"#A89984",brightBlack:"#928374",brightRed:"#FB4934",brightGreen:"#B8BB26",brightYellow:"#FABD2F",brightBlue:"#83A598",brightMagenta:"#D3869B",brightCyan:"#8EC07C",brightWhite:"#EBDBB2"},gruvboxLight:{background:"#FBF1C7",foreground:"#3C3836",cursor:"#3C3836",black:"#FBF1C7",red:"#9D0006",green:"#79740E",yellow:"#B57614",blue:"#076678",magenta:"#8F3F71",cyan:"#427B58",white:"#3C3836",brightBlack:"#D5C4A1",brightRed:"#AF3A03",brightGreen:"#B8BB26",brightYellow:"#FABD2F",brightBlue:"#83A598",brightMagenta:"#D3869B",brightCyan:"#8EC07C",brightWhite:"#EBDBB2"},nord:{background:"#2E3440",foreground:"#D8DEE9",cursor:"#88C0D0",black:"#3B4252",red:"#BF616A",green:"#A3BE8C",yellow:"#EBCB8B",blue:"#81A1C1",magenta:"#B48EAD",cyan:"#88C0D0",white:"#E5E9F0",brightBlack:"#4C566A",brightRed:"#BF616A",brightGreen:"#A3BE8C",brightYellow:"#EBCB8B",brightBlue:"#81A1C1",brightMagenta:"#B48EAD",brightCyan:"#8FBCBB",brightWhite:"#ECEFF4"},oneDark:{background:"#282C34",foreground:"#ABB2BF",cursor:"#528BFF",black:"#282C34",red:"#E06C75",green:"#98C379",yellow:"#E5C07B",blue:"#61AFEF",magenta:"#C678DD",cyan:"#56B6C2",white:"#ABB2BF",brightBlack:"#5C6370",brightRed:"#E06C75",brightGreen:"#98C379",brightYellow:"#E5C07B",brightBlue:"#61AFEF",brightMagenta:"#C678DD",brightCyan:"#56B6C2",brightWhite:"#FFFFFF"},material:{background:"#263238",foreground:"#ECEFF1",cursor:"#FFCC00",black:"#263238",red:"#F07178",green:"#C3E88D",yellow:"#FFCB6B",blue:"#82AAFF",magenta:"#C792EA",cyan:"#89DDFF",white:"#EEFFFF",brightBlack:"#546E7A",brightRed:"#F07178",brightGreen:"#C3E88D",brightYellow:"#FFCB6B",brightBlue:"#82AAFF",brightMagenta:"#C792EA",brightCyan:"#89DDFF",brightWhite:"#FFFFFF"},highContrastLight:{background:"#FFFACD",foreground:"#000000",cursor:"#FFA500",selectionBackground:"#FFD700",black:"#3B3A32",red:"#D32F2F",green:"#388E3C",yellow:"#FBC02D",blue:"#1976D2",magenta:"#8E24AA",cyan:"#0097A7",white:"#FFFFFF",brightBlack:"#616161",brightRed:"#FF5252",brightGreen:"#69F0AE",brightYellow:"#FFEB3B",brightBlue:"#64B5F6",brightMagenta:"#BA68C8",brightCyan:"#4DD0E1",brightWhite:"#FAFAFA"},tokyoNight:{background:"#1a1b26",foreground:"#c0caf5",cursor:"#c0caf5",selectionBackground:"#33467c",black:"#15161e",red:"#f7768e",green:"#9ece6a",yellow:"#e0af68",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#a9b1d6",brightBlack:"#414868",brightRed:"#f7768e",brightGreen:"#9ece6a",brightYellow:"#e0af68",brightBlue:"#7aa2f7",brightMagenta:"#bb9af7",brightCyan:"#7dcfff",brightWhite:"#c0caf5"},catppuccinMocha:{background:"#1e1e2e",foreground:"#cdd6f4",cursor:"#f5e0dc",selectionBackground:"#45475a",black:"#45475a",red:"#f38ba8",green:"#a6e3a1",yellow:"#f9e2af",blue:"#89b4fa",magenta:"#f5c2e7",cyan:"#94e2d5",white:"#bac2de",brightBlack:"#585b70",brightRed:"#f38ba8",brightGreen:"#a6e3a1",brightYellow:"#f9e2af",brightBlue:"#89b4fa",brightMagenta:"#f5c2e7",brightCyan:"#94e2d5",brightWhite:"#a6adc8"},catppuccinFrappe:{background:"#303446",foreground:"#c6d0f5",cursor:"#f2d5cf",selectionBackground:"#51576d",black:"#51576d",red:"#e78284",green:"#a6d189",yellow:"#e5c890",blue:"#8caaee",magenta:"#f4b8e4",cyan:"#81c8be",white:"#b5bfe2",brightBlack:"#626880",brightRed:"#e78284",brightGreen:"#a6d189",brightYellow:"#e5c890",brightBlue:"#8caaee",brightMagenta:"#f4b8e4",brightCyan:"#81c8be",brightWhite:"#a5adce"},rosePine:{background:"#191724",foreground:"#e0def4",cursor:"#524f67",selectionBackground:"#2a283e",black:"#26233a",red:"#eb6f92",green:"#31748f",yellow:"#f6c177",blue:"#9ccfd8",magenta:"#c4a7e7",cyan:"#ebbcba",white:"#e0def4",brightBlack:"#6e6a86",brightRed:"#eb6f92",brightGreen:"#31748f",brightYellow:"#f6c177",brightBlue:"#9ccfd8",brightMagenta:"#c4a7e7",brightCyan:"#ebbcba",brightWhite:"#e0def4"},kanagawa:{background:"#1f1f28",foreground:"#dcd7ba",cursor:"#c8c093",selectionBackground:"#2d4f67",black:"#16161d",red:"#c34043",green:"#76946a",yellow:"#c0a36e",blue:"#7e9cd8",magenta:"#957fb8",cyan:"#6a9589",white:"#c8c093",brightBlack:"#727169",brightRed:"#e82424",brightGreen:"#98bb6c",brightYellow:"#e6c384",brightBlue:"#7fb4ca",brightMagenta:"#938aa9",brightCyan:"#7aa89f",brightWhite:"#dcd7ba"},everforestDark:{background:"#2d353b",foreground:"#d3c6aa",cursor:"#d3c6aa",selectionBackground:"#543a48",black:"#475258",red:"#e67e80",green:"#a7c080",yellow:"#dbbc7f",blue:"#7fbbb3",magenta:"#d699b6",cyan:"#83c092",white:"#d3c6aa",brightBlack:"#475258",brightRed:"#e67e80",brightGreen:"#a7c080",brightYellow:"#dbbc7f",brightBlue:"#7fbbb3",brightMagenta:"#d699b6",brightCyan:"#83c092",brightWhite:"#d3c6aa"},ayuDark:{background:"#0b0e14",foreground:"#bfbdb6",cursor:"#e6b450",selectionBackground:"#1b3a4b",black:"#01060e",red:"#ea6c73",green:"#91b362",yellow:"#f9af4f",blue:"#53bdfa",magenta:"#fae994",cyan:"#90e1c6",white:"#c7c7c7",brightBlack:"#686868",brightRed:"#f07178",brightGreen:"#c2d94c",brightYellow:"#ffb454",brightBlue:"#59c2ff",brightMagenta:"#ffee99",brightCyan:"#95e6cb",brightWhite:"#ffffff"},catppuccinLatte:{background:"#eff1f5",foreground:"#4c4f69",cursor:"#dc8a78",selectionBackground:"#acb0be",black:"#5c5f77",red:"#d20f39",green:"#40a02b",yellow:"#df8e1d",blue:"#1e66f5",magenta:"#ea76cb",cyan:"#179299",white:"#acb0be",brightBlack:"#6c6f85",brightRed:"#d20f39",brightGreen:"#40a02b",brightYellow:"#df8e1d",brightBlue:"#1e66f5",brightMagenta:"#ea76cb",brightCyan:"#179299",brightWhite:"#bcc0cc"},rosePineDawn:{background:"#faf4ed",foreground:"#575279",cursor:"#9893a5",selectionBackground:"#dfdad9",black:"#f2e9e1",red:"#b4637a",green:"#286983",yellow:"#ea9d34",blue:"#56949f",magenta:"#907aa9",cyan:"#d7827e",white:"#575279",brightBlack:"#9893a5",brightRed:"#b4637a",brightGreen:"#286983",brightYellow:"#ea9d34",brightBlue:"#56949f",brightMagenta:"#907aa9",brightCyan:"#d7827e",brightWhite:"#575279"},everforestLight:{background:"#fdf6e3",foreground:"#5c6a72",cursor:"#5c6a72",selectionBackground:"#e6e2cc",black:"#5c6a72",red:"#f85552",green:"#8da101",yellow:"#dfa000",blue:"#3a94c5",magenta:"#df69ba",cyan:"#35a77c",white:"#dfddc8",brightBlack:"#708089",brightRed:"#f85552",brightGreen:"#8da101",brightYellow:"#dfa000",brightBlue:"#3a94c5",brightMagenta:"#df69ba",brightCyan:"#35a77c",brightWhite:"#e8e5d0"},githubLight:{background:"#ffffff",foreground:"#24292f",cursor:"#044289",selectionBackground:"#0969da33",black:"#24292f",red:"#cf222e",green:"#116329",yellow:"#4d2d00",blue:"#0969da",magenta:"#8250df",cyan:"#1b7c83",white:"#6e7781",brightBlack:"#57606a",brightRed:"#a40e26",brightGreen:"#1a7f37",brightYellow:"#633c01",brightBlue:"#218bff",brightMagenta:"#a475f9",brightCyan:"#3192aa",brightWhite:"#8c959f"},cyberpunk:{background:"#0a0a1a",foreground:"#0abdc6",cursor:"#ff2079",selectionBackground:"#1a1a3a",black:"#000000",red:"#ff2079",green:"#00ff9c",yellow:"#fed230",blue:"#0abdc6",magenta:"#ea00d9",cyan:"#0abdc6",white:"#c7c7c7",brightBlack:"#686868",brightRed:"#ff4a9e",brightGreen:"#3df5b6",brightYellow:"#fef465",brightBlue:"#3ff1de",brightMagenta:"#ff79f0",brightCyan:"#3ff1de",brightWhite:"#ffffff"},retroGreen:{background:"#0a0a0a",foreground:"#33ff00",cursor:"#33ff00",selectionBackground:"#1a3a1a",black:"#0a0a0a",red:"#ff0000",green:"#33ff00",yellow:"#ffff00",blue:"#0066ff",magenta:"#cc00ff",cyan:"#00ffff",white:"#33ff00",brightBlack:"#1a5c1a",brightRed:"#ff3333",brightGreen:"#66ff33",brightYellow:"#ffff66",brightBlue:"#3399ff",brightMagenta:"#e550ff",brightCyan:"#66ffff",brightWhite:"#66ff33"},retroAmber:{background:"#0a0a00",foreground:"#ffb000",cursor:"#ffb000",selectionBackground:"#3a2a00",black:"#0a0a00",red:"#ff0000",green:"#ffb000",yellow:"#ffcc00",blue:"#cc8800",magenta:"#ff8800",cyan:"#ffcc66",white:"#ffb000",brightBlack:"#665500",brightRed:"#ff3333",brightGreen:"#ffc033",brightYellow:"#ffdd33",brightBlue:"#ddaa33",brightMagenta:"#ffaa33",brightCyan:"#ffdd99",brightWhite:"#ffc033"},matrix:{background:"#000000",foreground:"#00ff41",cursor:"#00ff41",selectionBackground:"#003300",black:"#000000",red:"#00ff41",green:"#00ff41",yellow:"#00ff41",blue:"#00cc33",magenta:"#009926",cyan:"#00ff41",white:"#00ff41",brightBlack:"#005500",brightRed:"#33ff66",brightGreen:"#33ff66",brightYellow:"#33ff66",brightBlue:"#00ff41",brightMagenta:"#00cc33",brightCyan:"#33ff66",brightWhite:"#66ff88"},synthwave:{background:"#2b213a",foreground:"#f0e4fc",cursor:"#72f1b8",selectionBackground:"#463465",black:"#2b213a",red:"#fe4450",green:"#72f1b8",yellow:"#fede5d",blue:"#2ee2fa",magenta:"#ff7edb",cyan:"#03edf9",white:"#f0e4fc",brightBlack:"#614d85",brightRed:"#fe4450",brightGreen:"#72f1b8",brightYellow:"#fede5d",brightBlue:"#2ee2fa",brightMagenta:"#ff7edb",brightCyan:"#03edf9",brightWhite:"#ffffff"},highContrastDark:{background:"#000000",foreground:"#ffffff",cursor:"#ffffff",selectionBackground:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#ff0000",green:"#00ff00",yellow:"#ffff00",blue:"#3b78ff",magenta:"#ff00ff",cyan:"#00ffff",white:"#ffffff",brightBlack:"#808080",brightRed:"#ff3333",brightGreen:"#33ff33",brightYellow:"#ffff33",brightBlue:"#6699ff",brightMagenta:"#ff33ff",brightCyan:"#33ffff",brightWhite:"#ffffff"}};DefaultThemes.yellow=DefaultThemes.highContrastLight;var DefaultThemeInfos={default:{theme:DefaultThemes.default,category:"dark",tags:["built-in"],description:"Dark indigo theme with soft pastels"},classic:{theme:DefaultThemes.classic,category:"dark",tags:["built-in"],description:"Classic Windows terminal palette"},dracula:{theme:DefaultThemes.dracula,category:"dark",tags:["popular"],description:"Popular dark theme with vibrant colors"},monokai:{theme:DefaultThemes.monokai,category:"dark",tags:["popular"],description:"Classic code editor dark theme"},solarizedDark:{theme:DefaultThemes.solarizedDark,category:"dark",tags:["popular"],description:"Ethan Schoonover's precision dark palette"},solarizedLight:{theme:DefaultThemes.solarizedLight,category:"light",tags:["popular"],description:"Ethan Schoonover's precision light palette"},gruvboxDark:{theme:DefaultThemes.gruvboxDark,category:"dark",tags:["popular"],description:"Retro groove dark color scheme"},gruvboxLight:{theme:DefaultThemes.gruvboxLight,category:"light",tags:["popular"],description:"Retro groove light color scheme"},nord:{theme:DefaultThemes.nord,category:"dark",tags:["popular"],description:"Arctic, north-bluish clean palette"},oneDark:{theme:DefaultThemes.oneDark,category:"dark",tags:["popular"],description:"Atom's iconic dark theme"},material:{theme:DefaultThemes.material,category:"dark",tags:["popular"],description:"Material Design inspired dark theme"},highContrastLight:{theme:DefaultThemes.highContrastLight,category:"light",tags:["accessibility"],description:"High contrast light theme for accessibility"},tokyoNight:{theme:DefaultThemes.tokyoNight,category:"dark",tags:["popular"],description:"Cool blue-purple dark theme"},catppuccinMocha:{theme:DefaultThemes.catppuccinMocha,category:"dark",tags:["popular","pastel"],description:"Soothing pastel dark theme (warmest)"},catppuccinFrappe:{theme:DefaultThemes.catppuccinFrappe,category:"dark",tags:["popular","pastel"],description:"Soothing pastel mid-dark theme"},catppuccinLatte:{theme:DefaultThemes.catppuccinLatte,category:"light",tags:["popular","pastel"],description:"Soothing pastel light theme"},rosePine:{theme:DefaultThemes.rosePine,category:"dark",tags:["popular"],description:"All natural pine, faux fur, and a bit of soho vibes"},rosePineDawn:{theme:DefaultThemes.rosePineDawn,category:"light",tags:["popular"],description:"Rose Pine light variant"},kanagawa:{theme:DefaultThemes.kanagawa,category:"dark",tags:["popular"],description:"Dark theme inspired by Katsushika Hokusai"},everforestDark:{theme:DefaultThemes.everforestDark,category:"dark",tags:["popular"],description:"Comfortable green-tinted dark theme"},everforestLight:{theme:DefaultThemes.everforestLight,category:"light",tags:["popular"],description:"Comfortable green-tinted light theme"},ayuDark:{theme:DefaultThemes.ayuDark,category:"dark",tags:["popular"],description:"Simple, bright and elegant dark theme"},githubLight:{theme:DefaultThemes.githubLight,category:"light",tags:["popular"],description:"GitHub's clean light interface theme"},cyberpunk:{theme:DefaultThemes.cyberpunk,category:"dark",tags:["retro","fun"],description:"Neon-lit cyberpunk aesthetic"},retroGreen:{theme:DefaultThemes.retroGreen,category:"dark",tags:["retro","fun"],description:"Classic green phosphor CRT monitor"},retroAmber:{theme:DefaultThemes.retroAmber,category:"dark",tags:["retro","fun"],description:"Warm amber CRT monitor"},matrix:{theme:DefaultThemes.matrix,category:"dark",tags:["retro","fun"],description:"Enter the Matrix - green on black"},synthwave:{theme:DefaultThemes.synthwave,category:"dark",tags:["retro","fun"],description:"80s synthwave purple/pink aesthetic"},highContrastDark:{theme:DefaultThemes.highContrastDark,category:"dark",tags:["accessibility"],description:"Maximum contrast dark theme"}},extendStatics=function(t,e){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},extendStatics(t,e)};function __extends(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");extendStatics(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function __values(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,u=[],h;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)u.push(o.value)}catch(a){h={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(h)throw h.error}}return u}function __spreadArray(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,u;n<o;n++)(u||!(n in e))&&(u||(u=Array.prototype.slice.call(e,0,n)),u[n]=e[n]);return t.concat(u||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;function isFunction(t){return typeof t=="function"}function createErrorClass(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var UnsubscriptionError=createErrorClass(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
72
- `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
73
- `):"",this.name="UnsubscriptionError",this.errors=r}});function arrRemove(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Subscription=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,o,u;if(!this.closed){this.closed=!0;var h=this._parentage;if(h)if(this._parentage=null,Array.isArray(h))try{for(var a=__values(h),l=a.next();!l.done;l=a.next()){var f=l.value;f.remove(this)}}catch(U){e={error:U}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else h.remove(this);var C=this.initialTeardown;if(isFunction(C))try{C()}catch(U){u=U instanceof UnsubscriptionError?U.errors:[U]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var P=__values(d),H=P.next();!H.done;H=P.next()){var W=H.value;try{execFinalizer(W)}catch(U){u=u??[],U instanceof UnsubscriptionError?u=__spreadArray(__spreadArray([],__read(u)),__read(U.errors)):u.push(U)}}}catch(U){n={error:U}}finally{try{H&&!H.done&&(o=P.return)&&o.call(P)}finally{if(n)throw n.error}}}if(u)throw new UnsubscriptionError(u)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)execFinalizer(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&arrRemove(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&arrRemove(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})(),EMPTY_SUBSCRIPTION=Subscription.EMPTY;function isSubscription(t){return t instanceof Subscription||t&&"closed"in t&&isFunction(t.remove)&&isFunction(t.add)&&isFunction(t.unsubscribe)}function execFinalizer(t){isFunction(t)?t():t.unsubscribe()}var config={Promise:void 0},timeoutProvider={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,__spreadArray([t,e],__read(r)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function reportUnhandledError(t){timeoutProvider.setTimeout(function(){throw t})}function noop(){}function errorContext(t){t()}var Subscriber=(function(t){__extends(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,isSubscription(r)&&r.add(n)):n.destination=EMPTY_OBSERVER,n}return e.create=function(r,n,o){return new SafeSubscriber(r,n,o)},e.prototype.next=function(r){this.isStopped||this._next(r)},e.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Subscription),ConsumerObserver=(function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){handleUnhandledError(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){handleUnhandledError(n)}else handleUnhandledError(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){handleUnhandledError(r)}},t})(),SafeSubscriber=(function(t){__extends(e,t);function e(r,n,o){var u=t.call(this)||this,h;return isFunction(r)||!r?h={next:r??void 0,error:n??void 0,complete:o??void 0}:h=r,u.destination=new ConsumerObserver(h),u}return e})(Subscriber);function handleUnhandledError(t){reportUnhandledError(t)}function defaultErrorHandler(t){throw t}var EMPTY_OBSERVER={closed:!0,next:noop,error:defaultErrorHandler,complete:noop},observable=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function identity(t){return t}function pipeFromArray(t){return t.length===0?identity:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var Observable=(function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var o=this,u=isSubscriber(e)?e:new SafeSubscriber(e,r,n);return errorContext(function(){var h=o,a=h.operator,l=h.source;u.add(a?a.call(u,l):l?o._subscribe(u):o._trySubscribe(u))}),u},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=getPromiseCtor(r),new r(function(o,u){var h=new SafeSubscriber({next:function(a){try{e(a)}catch(l){u(l),h.unsubscribe()}},error:u,complete:o});n.subscribe(h)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[observable]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return pipeFromArray(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=getPromiseCtor(e),new e(function(n,o){var u;r.subscribe(function(h){return u=h},function(h){return o(h)},function(){return n(u)})})},t.create=function(e){return new t(e)},t})();function getPromiseCtor(t){var e;return(e=t??config.Promise)!==null&&e!==void 0?e:Promise}function isObserver(t){return t&&isFunction(t.next)&&isFunction(t.error)&&isFunction(t.complete)}function isSubscriber(t){return t&&t instanceof Subscriber||isObserver(t)&&isSubscription(t)}function hasLift(t){return isFunction(t==null?void 0:t.lift)}function operate(t){return function(e){if(hasLift(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function createOperatorSubscriber(t,e,r,n,o){return new OperatorSubscriber(t,e,r,n,o)}var OperatorSubscriber=(function(t){__extends(e,t);function e(r,n,o,u,h,a){var l=t.call(this,r)||this;return l.onFinalize=h,l.shouldUnsubscribe=a,l._next=n?function(f){try{n(f)}catch(C){r.error(C)}}:t.prototype._next,l._error=u?function(f){try{u(f)}catch(C){r.error(C)}finally{this.unsubscribe()}}:t.prototype._error,l._complete=o?function(){try{o()}catch(f){r.error(f)}finally{this.unsubscribe()}}:t.prototype._complete,l}return e.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},e})(Subscriber),ObjectUnsubscribedError=createErrorClass(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Subject=(function(t){__extends(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new AnonymousSubject(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new ObjectUnsubscribedError},e.prototype.next=function(r){var n=this;errorContext(function(){var o,u;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var h=__values(n.currentObservers),a=h.next();!a.done;a=h.next()){var l=a.value;l.next(r)}}catch(f){o={error:f}}finally{try{a&&!a.done&&(u=h.return)&&u.call(h)}finally{if(o)throw o.error}}}})},e.prototype.error=function(r){var n=this;errorContext(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},e.prototype.complete=function(){var r=this;errorContext(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,o=this,u=o.hasError,h=o.isStopped,a=o.observers;return u||h?EMPTY_SUBSCRIPTION:(this.currentObservers=null,a.push(r),new Subscription(function(){n.currentObservers=null,arrRemove(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,u=n.thrownError,h=n.isStopped;o?r.error(u):h&&r.complete()},e.prototype.asObservable=function(){var r=new Observable;return r.source=this,r},e.create=function(r,n){return new AnonymousSubject(r,n)},e})(Observable),AnonymousSubject=(function(t){__extends(e,t);function e(r,n){var o=t.call(this)||this;return o.destination=r,o.source=n,o}return e.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},e.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:EMPTY_SUBSCRIPTION},e})(Subject),BehaviorSubject=(function(t){__extends(e,t);function e(r){var n=t.call(this)||this;return n._value=r,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},e.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,u=r._value;if(n)throw o;return this._throwIfClosed(),u},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e})(Subject);function map(t,e){return operate(function(r,n){var o=0;r.subscribe(createOperatorSubscriber(n,function(u){n.next(t.call(e,u,o++))}))})}function distinctUntilChanged(t,e){return e===void 0&&(e=identity),t=t??defaultCompare,operate(function(r,n){var o,u=!0;r.subscribe(createOperatorSubscriber(n,function(h){var a=e(h);(u||!t(o,a))&&(u=!1,o=a,n.next(h))}))})}function defaultCompare(t,e){return t===e}var xterm={exports:{}},hasRequiredXterm;function requireXterm(){return hasRequiredXterm||(hasRequiredXterm=1,(function(t,e){(function(r,n){t.exports=n()})(globalThis,(()=>(()=>{var r={4567:function(h,a,l){var f=this&&this.__decorate||function(x,j,V,Y){var J,X=arguments.length,G=X<3?j:Y===null?Y=Object.getOwnPropertyDescriptor(j,V):Y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(x,j,V,Y);else for(var ee=x.length-1;ee>=0;ee--)(J=x[ee])&&(G=(X<3?J(G):X>3?J(j,V,G):J(j,V))||G);return X>3&&G&&Object.defineProperty(j,V,G),G},C=this&&this.__param||function(x,j){return function(V,Y){j(V,Y,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;const d=l(9042),P=l(9924),H=l(844),W=l(4725),U=l(2585),L=l(3656);let N=a.AccessibilityManager=class extends H.Disposable{constructor(x,j,V,Y){super(),this._terminal=x,this._coreBrowserService=V,this._renderService=Y,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 J=0;J<this._terminal.rows;J++)this._rowElements[J]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[J]);if(this._topBoundaryFocusListener=J=>this._handleBoundaryFocus(J,0),this._bottomBoundaryFocusListener=J=>this._handleBoundaryFocus(J,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 P.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((J=>this._handleResize(J.rows)))),this.register(this._terminal.onRender((J=>this._refreshRows(J.start,J.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((J=>this._handleChar(J)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
74
- `)))),this.register(this._terminal.onA11yTab((J=>this._handleTab(J)))),this.register(this._terminal.onKey((J=>this._handleKey(J.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,L.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,H.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let j=0;j<x;j++)this._handleChar(" ")}_handleChar(x){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===`
75
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.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,j){this._liveRegionDebouncer.refresh(x,j,this._terminal.rows)}_renderRows(x,j){const V=this._terminal.buffer,Y=V.lines.length.toString();for(let J=x;J<=j;J++){const X=V.lines.get(V.ydisp+J),G=[],ee=(X==null?void 0:X.translateToString(!0,void 0,void 0,G))||"",ne=(V.ydisp+J+1).toString(),ae=this._rowElements[J];ae&&(ee.length===0?(ae.innerText=" ",this._rowColumns.set(ae,[0,1])):(ae.textContent=ee,this._rowColumns.set(ae,G)),ae.setAttribute("aria-posinset",ne),ae.setAttribute("aria-setsize",Y))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,j){const V=x.target,Y=this._rowElements[j===0?1:this._rowElements.length-2];if(V.getAttribute("aria-posinset")===(j===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==Y)return;let J,X;if(j===0?(J=V,X=this._rowElements.pop(),this._rowContainer.removeChild(X)):(J=this._rowElements.shift(),X=V,this._rowContainer.removeChild(J)),J.removeEventListener("focus",this._topBoundaryFocusListener),X.removeEventListener("focus",this._bottomBoundaryFocusListener),j===0){const G=this._createAccessibilityTreeNode();this._rowElements.unshift(G),this._rowContainer.insertAdjacentElement("afterbegin",G)}else{const G=this._createAccessibilityTreeNode();this._rowElements.push(G),this._rowContainer.appendChild(G)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(j===0?-1:1),this._rowElements[j===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var ee;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 j={node:x.anchorNode,offset:x.anchorOffset},V={node:x.focusNode,offset:x.focusOffset};if((j.node.compareDocumentPosition(V.node)&Node.DOCUMENT_POSITION_PRECEDING||j.node===V.node&&j.offset>V.offset)&&([j,V]=[V,j]),j.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(j={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(j.node))return;const Y=this._rowElements.slice(-1)[0];if(V.node.compareDocumentPosition(Y)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(V={node:Y,offset:((ee=Y.textContent)==null?void 0:ee.length)??0}),!this._rowContainer.contains(V.node))return;const J=({node:ne,offset:ae})=>{const ce=ne instanceof Text?ne.parentNode:ne;let oe=parseInt(ce==null?void 0:ce.getAttribute("aria-posinset"),10)-1;if(isNaN(oe))return console.warn("row is invalid. Race condition?"),null;const we=this._rowColumns.get(ce);if(!we)return console.warn("columns is null. Race condition?"),null;let be=ae<we.length?we[ae]:we.slice(-1)[0]+1;return be>=this._terminal.cols&&(++oe,be=0),{row:oe,column:be}},X=J(j),G=J(V);if(X&&G){if(X.row>G.row||X.row===G.row&&X.column>=G.column)throw new Error("invalid range");this._terminal.select(X.column,X.row,(G.row-X.row)*this._terminal.cols-X.column+G.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let j=this._rowContainer.children.length;j<this._terminal.rows;j++)this._rowElements[j]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[j]);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`}};a.AccessibilityManager=N=f([C(1,U.IInstantiationService),C(2,W.ICoreBrowserService),C(3,W.IRenderService)],N)},3614:(h,a)=>{function l(P){return P.replace(/\r?\n/g,"\r")}function f(P,H){return H?"\x1B[200~"+P+"\x1B[201~":P}function C(P,H,W,U){P=f(P=l(P),W.decPrivateModes.bracketedPasteMode&&U.rawOptions.ignoreBracketedPasteMode!==!0),W.triggerDataEvent(P,!0),H.value=""}function d(P,H,W){const U=W.getBoundingClientRect(),L=P.clientX-U.left-10,N=P.clientY-U.top-10;H.style.width="20px",H.style.height="20px",H.style.left=`${L}px`,H.style.top=`${N}px`,H.style.zIndex="1000",H.focus()}Object.defineProperty(a,"__esModule",{value:!0}),a.rightClickHandler=a.moveTextAreaUnderMouseCursor=a.paste=a.handlePasteEvent=a.copyHandler=a.bracketTextForPaste=a.prepareTextForTerminal=void 0,a.prepareTextForTerminal=l,a.bracketTextForPaste=f,a.copyHandler=function(P,H){P.clipboardData&&P.clipboardData.setData("text/plain",H.selectionText),P.preventDefault()},a.handlePasteEvent=function(P,H,W,U){P.stopPropagation(),P.clipboardData&&C(P.clipboardData.getData("text/plain"),H,W,U)},a.paste=C,a.moveTextAreaUnderMouseCursor=d,a.rightClickHandler=function(P,H,W,U,L){d(P,H,W),L&&U.rightClickSelect(P),H.value=U.selectionText,H.select()}},7239:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorContrastCache=void 0;const f=l(1505);a.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(C,d,P){this._css.set(C,d,P)}getCss(C,d){return this._css.get(C,d)}setColor(C,d,P){this._color.set(C,d,P)}getColor(C,d){return this._color.get(C,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.addDisposableDomListener=void 0,a.addDisposableDomListener=function(l,f,C,d){l.addEventListener(f,C,d);let P=!1;return{dispose:()=>{P||(P=!0,l.removeEventListener(f,C,d))}}}},3551:function(h,a,l){var f=this&&this.__decorate||function(N,x,j,V){var Y,J=arguments.length,X=J<3?x:V===null?V=Object.getOwnPropertyDescriptor(x,j):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")X=Reflect.decorate(N,x,j,V);else for(var G=N.length-1;G>=0;G--)(Y=N[G])&&(X=(J<3?Y(X):J>3?Y(x,j,X):Y(x,j))||X);return J>3&&X&&Object.defineProperty(x,j,X),X},C=this&&this.__param||function(N,x){return function(j,V){x(j,V,N)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Linkifier=void 0;const d=l(3656),P=l(8460),H=l(844),W=l(2585),U=l(4725);let L=a.Linkifier=class extends H.Disposable{get currentLink(){return this._currentLink}constructor(N,x,j,V,Y){super(),this._element=N,this._mouseService=x,this._renderService=j,this._bufferService=V,this._linkProviderService=Y,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new P.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new P.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,H.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,H.toDisposable)((()=>{var J;this._lastMouseEvent=void 0,(J=this._activeProviderReplies)==null||J.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(N){this._lastMouseEvent=N;const x=this._positionFromMouseEvent(N,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const j=N.composedPath();for(let V=0;V<j.length;V++){const Y=j[V];if(Y.classList.contains("xterm"))break;if(Y.classList.contains("xterm-hover"))return}this._lastBufferCell&&x.x===this._lastBufferCell.x&&x.y===this._lastBufferCell.y||(this._handleHover(x),this._lastBufferCell=x)}_handleHover(N){if(this._activeLine!==N.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(N,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,N)||(this._clearCurrentLink(),this._askForLink(N,!0))}_askForLink(N,x){var V,Y;this._activeProviderReplies&&x||((V=this._activeProviderReplies)==null||V.forEach((J=>{J==null||J.forEach((X=>{X.link.dispose&&X.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=N.y);let j=!1;for(const[J,X]of this._linkProviderService.linkProviders.entries())x?(Y=this._activeProviderReplies)!=null&&Y.get(J)&&(j=this._checkLinkProviderResult(J,N,j)):X.provideLinks(N.y,(G=>{var ne,ae;if(this._isMouseOut)return;const ee=G==null?void 0:G.map((ce=>({link:ce})));(ne=this._activeProviderReplies)==null||ne.set(J,ee),j=this._checkLinkProviderResult(J,N,j),((ae=this._activeProviderReplies)==null?void 0:ae.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(N.y,this._activeProviderReplies)}))}_removeIntersectingLinks(N,x){const j=new Set;for(let V=0;V<x.size;V++){const Y=x.get(V);if(Y)for(let J=0;J<Y.length;J++){const X=Y[J],G=X.link.range.start.y<N?0:X.link.range.start.x,ee=X.link.range.end.y>N?this._bufferService.cols:X.link.range.end.x;for(let ne=G;ne<=ee;ne++){if(j.has(ne)){Y.splice(J--,1);break}j.add(ne)}}}}_checkLinkProviderResult(N,x,j){var J;if(!this._activeProviderReplies)return j;const V=this._activeProviderReplies.get(N);let Y=!1;for(let X=0;X<N;X++)this._activeProviderReplies.has(X)&&!this._activeProviderReplies.get(X)||(Y=!0);if(!Y&&V){const X=V.find((G=>this._linkAtPosition(G.link,x)));X&&(j=!0,this._handleNewLink(X))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!j)for(let X=0;X<this._activeProviderReplies.size;X++){const G=(J=this._activeProviderReplies.get(X))==null?void 0:J.find((ee=>this._linkAtPosition(ee.link,x)));if(G){j=!0,this._handleNewLink(G);break}}return j}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(N){if(!this._currentLink)return;const x=this._positionFromMouseEvent(N,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(N,this._currentLink.link.text)}_clearCurrentLink(N,x){this._currentLink&&this._lastMouseEvent&&(!N||!x||this._currentLink.link.range.start.y>=N&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,H.disposeArray)(this._linkCacheDisposables))}_handleNewLink(N){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(N.link,x)&&(this._currentLink=N,this._currentLink.state={decorations:{underline:N.link.decorations===void 0||N.link.decorations.underline,pointerCursor:N.link.decorations===void 0||N.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,N.link,this._lastMouseEvent),N.link.decorations={},Object.defineProperties(N.link.decorations,{pointerCursor:{get:()=>{var j,V;return(V=(j=this._currentLink)==null?void 0:j.state)==null?void 0:V.decorations.pointerCursor},set:j=>{var V;(V=this._currentLink)!=null&&V.state&&this._currentLink.state.decorations.pointerCursor!==j&&(this._currentLink.state.decorations.pointerCursor=j,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",j))}},underline:{get:()=>{var j,V;return(V=(j=this._currentLink)==null?void 0:j.state)==null?void 0:V.decorations.underline},set:j=>{var V,Y,J;(V=this._currentLink)!=null&&V.state&&((J=(Y=this._currentLink)==null?void 0:Y.state)==null?void 0:J.decorations.underline)!==j&&(this._currentLink.state.decorations.underline=j,this._currentLink.state.isHovered&&this._fireUnderlineEvent(N.link,j))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((j=>{if(!this._currentLink)return;const V=j.start===0?0:j.start+1+this._bufferService.buffer.ydisp,Y=this._bufferService.buffer.ydisp+1+j.end;if(this._currentLink.link.range.start.y>=V&&this._currentLink.link.range.end.y<=Y&&(this._clearCurrentLink(V,Y),this._lastMouseEvent)){const J=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);J&&this._askForLink(J,!1)}}))))}_linkHover(N,x,j){var V;(V=this._currentLink)!=null&&V.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&N.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(j,x.text)}_fireUnderlineEvent(N,x){const j=N.range,V=this._bufferService.buffer.ydisp,Y=this._createLinkUnderlineEvent(j.start.x-1,j.start.y-V-1,j.end.x,j.end.y-V-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(Y)}_linkLeave(N,x,j){var V;(V=this._currentLink)!=null&&V.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&N.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(j,x.text)}_linkAtPosition(N,x){const j=N.range.start.y*this._bufferService.cols+N.range.start.x,V=N.range.end.y*this._bufferService.cols+N.range.end.x,Y=x.y*this._bufferService.cols+x.x;return j<=Y&&Y<=V}_positionFromMouseEvent(N,x,j){const V=j.getCoords(N,x,this._bufferService.cols,this._bufferService.rows);if(V)return{x:V[0],y:V[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(N,x,j,V,Y){return{x1:N,y1:x,x2:j,y2:V,cols:this._bufferService.cols,fg:Y}}};a.Linkifier=L=f([C(1,U.IMouseService),C(2,U.IRenderService),C(3,W.IBufferService),C(4,U.ILinkProviderService)],L)},9042:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.tooMuchOutput=a.promptLabel=void 0,a.promptLabel="Terminal input",a.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(h,a,l){var f=this&&this.__decorate||function(U,L,N,x){var j,V=arguments.length,Y=V<3?L:x===null?x=Object.getOwnPropertyDescriptor(L,N):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(U,L,N,x);else for(var J=U.length-1;J>=0;J--)(j=U[J])&&(Y=(V<3?j(Y):V>3?j(L,N,Y):j(L,N))||Y);return V>3&&Y&&Object.defineProperty(L,N,Y),Y},C=this&&this.__param||function(U,L){return function(N,x){L(N,x,U)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkProvider=void 0;const d=l(511),P=l(2585);let H=a.OscLinkProvider=class{constructor(U,L,N){this._bufferService=U,this._optionsService=L,this._oscLinkService=N}provideLinks(U,L){var ee;const N=this._bufferService.buffer.lines.get(U-1);if(!N)return void L(void 0);const x=[],j=this._optionsService.rawOptions.linkHandler,V=new d.CellData,Y=N.getTrimmedLength();let J=-1,X=-1,G=!1;for(let ne=0;ne<Y;ne++)if(X!==-1||N.hasContent(ne)){if(N.loadCell(ne,V),V.hasExtendedAttrs()&&V.extended.urlId){if(X===-1){X=ne,J=V.extended.urlId;continue}G=V.extended.urlId!==J}else X!==-1&&(G=!0);if(G||X!==-1&&ne===Y-1){const ae=(ee=this._oscLinkService.getLinkData(J))==null?void 0:ee.uri;if(ae){const ce={start:{x:X+1,y:U},end:{x:ne+(G||ne!==Y-1?0:1),y:U}};let oe=!1;if(!(j!=null&&j.allowNonHttpProtocols))try{const we=new URL(ae);["http:","https:"].includes(we.protocol)||(oe=!0)}catch{oe=!0}oe||x.push({text:ae,range:ce,activate:(we,be)=>j?j.activate(we,be,ce):W(0,be),hover:(we,be)=>{var ve;return(ve=j==null?void 0:j.hover)==null?void 0:ve.call(j,we,be,ce)},leave:(we,be)=>{var ve;return(ve=j==null?void 0:j.leave)==null?void 0:ve.call(j,we,be,ce)}})}G=!1,V.hasExtendedAttrs()&&V.extended.urlId?(X=ne,J=V.extended.urlId):(X=-1,J=-1)}}L(x)}};function W(U,L){if(confirm(`Do you want to navigate to ${L}?
76
-
77
- WARNING: This link could potentially be dangerous`)){const N=window.open();if(N){try{N.opener=null}catch{}N.location.href=L}else console.warn("Opening link blocked as opener could not be cleared")}}a.OscLinkProvider=H=f([C(0,P.IBufferService),C(1,P.IOptionsService),C(2,P.IOscLinkService)],H)},6193:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.RenderDebouncer=void 0,a.RenderDebouncer=class{constructor(l,f){this._renderCallback=l,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(l){return this._refreshCallbacks.push(l),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(l,f,C){this._rowCount=C,l=l!==void 0?l:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,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 l=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const l of this._refreshCallbacks)l(0);this._refreshCallbacks=[]}}},3236:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;const f=l(3614),C=l(3656),d=l(3551),P=l(9042),H=l(3730),W=l(1680),U=l(3107),L=l(5744),N=l(2950),x=l(1296),j=l(428),V=l(4269),Y=l(5114),J=l(8934),X=l(3230),G=l(9312),ee=l(4725),ne=l(6731),ae=l(8055),ce=l(8969),oe=l(8460),we=l(844),be=l(6114),ve=l(8437),me=l(2584),de=l(7399),Q=l(5941),re=l(9074),Z=l(2585),ie=l(5435),ge=l(4567),fe=l(779);class xe extends ce.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(ue={}){super(ue),this.browser=be,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new we.MutableDisposable),this._onCursorMove=this.register(new oe.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new oe.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new oe.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new oe.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new oe.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new oe.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new oe.EventEmitter),this._onBlur=this.register(new oe.EventEmitter),this._onA11yCharEmitter=this.register(new oe.EventEmitter),this._onA11yTabEmitter=this.register(new oe.EventEmitter),this._onWillOpen=this.register(new oe.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(re.DecorationService),this._instantiationService.setService(Z.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(fe.LinkProviderService),this._instantiationService.setService(ee.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(H.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((se,Ee)=>this.refresh(se,Ee)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((se=>this._reportWindowsOptions(se)))),this.register(this._inputHandler.onColor((se=>this._handleColorEvent(se)))),this.register((0,oe.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,oe.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,oe.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,oe.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((se=>this._afterResize(se.cols,se.rows)))),this.register((0,we.toDisposable)((()=>{var se,Ee;this._customKeyEventHandler=void 0,(Ee=(se=this.element)==null?void 0:se.parentNode)==null||Ee.removeChild(this.element)})))}_handleColorEvent(ue){if(this._themeService)for(const se of ue){let Ee,Se="";switch(se.index){case 256:Ee="foreground",Se="10";break;case 257:Ee="background",Se="11";break;case 258:Ee="cursor",Se="12";break;default:Ee="ansi",Se="4;"+se.index}switch(se.type){case 0:const $e=ae.color.toColorRGB(Ee==="ansi"?this._themeService.colors.ansi[se.index]:this._themeService.colors[Ee]);this.coreService.triggerDataEvent(`${me.C0.ESC}]${Se};${(0,Q.toRgbString)($e)}${me.C1_ESCAPED.ST}`);break;case 1:if(Ee==="ansi")this._themeService.modifyColors((Te=>Te.ansi[se.index]=ae.channels.toColor(...se.color)));else{const Te=Ee;this._themeService.modifyColors((Ue=>Ue[Te]=ae.channels.toColor(...se.color)))}break;case 2:this._themeService.restoreColor(se.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(ue){ue?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(ge.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(ue){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(me.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var ue;return(ue=this.textarea)==null?void 0:ue.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(me.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 ue=this.buffer.ybase+this.buffer.y,se=this.buffer.lines.get(ue);if(!se)return;const Ee=Math.min(this.buffer.x,this.cols-1),Se=this._renderService.dimensions.css.cell.height,$e=se.getWidth(Ee),Te=this._renderService.dimensions.css.cell.width*$e,Ue=this.buffer.y*this._renderService.dimensions.css.cell.height,Ve=Ee*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Ve+"px",this.textarea.style.top=Ue+"px",this.textarea.style.width=Te+"px",this.textarea.style.height=Se+"px",this.textarea.style.lineHeight=Se+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,C.addDisposableDomListener)(this.element,"copy",(se=>{this.hasSelection()&&(0,f.copyHandler)(se,this._selectionService)})));const ue=se=>(0,f.handlePasteEvent)(se,this.textarea,this.coreService,this.optionsService);this.register((0,C.addDisposableDomListener)(this.textarea,"paste",ue)),this.register((0,C.addDisposableDomListener)(this.element,"paste",ue)),be.isFirefox?this.register((0,C.addDisposableDomListener)(this.element,"mousedown",(se=>{se.button===2&&(0,f.rightClickHandler)(se,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,C.addDisposableDomListener)(this.element,"contextmenu",(se=>{(0,f.rightClickHandler)(se,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),be.isLinux&&this.register((0,C.addDisposableDomListener)(this.element,"auxclick",(se=>{se.button===1&&(0,f.moveTextAreaUnderMouseCursor)(se,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,C.addDisposableDomListener)(this.textarea,"keyup",(ue=>this._keyUp(ue)),!0)),this.register((0,C.addDisposableDomListener)(this.textarea,"keydown",(ue=>this._keyDown(ue)),!0)),this.register((0,C.addDisposableDomListener)(this.textarea,"keypress",(ue=>this._keyPress(ue)),!0)),this.register((0,C.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,C.addDisposableDomListener)(this.textarea,"compositionupdate",(ue=>this._compositionHelper.compositionupdate(ue)))),this.register((0,C.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,C.addDisposableDomListener)(this.textarea,"input",(ue=>this._inputEvent(ue)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(ue){var Ee;if(!ue)throw new Error("Terminal requires a parent element.");if(ue.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((Ee=this.element)==null?void 0:Ee.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=ue.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"),ue.appendChild(this.element);const se=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),se.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,C.addDisposableDomListener)(this.screenElement,"mousemove",(Se=>this.updateCursorStyle(Se)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),se.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",P.promptLabel),be.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(Y.CoreBrowserService,this.textarea,ue.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ee.ICoreBrowserService,this._coreBrowserService),this.register((0,C.addDisposableDomListener)(this.textarea,"focus",(Se=>this._handleTextAreaFocus(Se)))),this.register((0,C.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(j.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(ee.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(ne.ThemeService),this._instantiationService.setService(ee.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(V.CharacterJoinerService),this._instantiationService.setService(ee.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(X.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(ee.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((Se=>this._onRender.fire(Se)))),this.onResize((Se=>this._renderService.resize(Se.cols,Se.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(N.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(J.MouseService),this._instantiationService.setService(ee.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(se);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(W.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((Se=>this.scrollLines(Se.amount,Se.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(G.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(ee.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((Se=>this.scrollLines(Se.amount,Se.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((Se=>this._renderService.handleSelectionChanged(Se.start,Se.end,Se.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((Se=>{this.textarea.value=Se,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((Se=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,C.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(U.BufferDecorationRenderer,this.screenElement)),this.register((0,C.addDisposableDomListener)(this.element,"mousedown",(Se=>this._selectionService.handleMouseDown(Se)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(ge.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(Se=>this._handleScreenReaderModeOptionChange(Se)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(L.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(Se=>{!this._overviewRulerRenderer&&Se&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(L.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 ue=this,se=this.element;function Ee(Te){const Ue=ue._mouseService.getMouseReportCoords(Te,ue.screenElement);if(!Ue)return!1;let Ve,Ge;switch(Te.overrideType||Te.type){case"mousemove":Ge=32,Te.buttons===void 0?(Ve=3,Te.button!==void 0&&(Ve=Te.button<3?Te.button:3)):Ve=1&Te.buttons?0:4&Te.buttons?1:2&Te.buttons?2:3;break;case"mouseup":Ge=0,Ve=Te.button<3?Te.button:3;break;case"mousedown":Ge=1,Ve=Te.button<3?Te.button:3;break;case"wheel":if(ue._customWheelEventHandler&&ue._customWheelEventHandler(Te)===!1||ue.viewport.getLinesScrolled(Te)===0)return!1;Ge=Te.deltaY<0?0:1,Ve=4;break;default:return!1}return!(Ge===void 0||Ve===void 0||Ve>4)&&ue.coreMouseService.triggerMouseEvent({col:Ue.col,row:Ue.row,x:Ue.x,y:Ue.y,button:Ve,action:Ge,ctrl:Te.ctrlKey,alt:Te.altKey,shift:Te.shiftKey})}const Se={mouseup:null,wheel:null,mousedrag:null,mousemove:null},$e={mouseup:Te=>(Ee(Te),Te.buttons||(this._document.removeEventListener("mouseup",Se.mouseup),Se.mousedrag&&this._document.removeEventListener("mousemove",Se.mousedrag)),this.cancel(Te)),wheel:Te=>(Ee(Te),this.cancel(Te,!0)),mousedrag:Te=>{Te.buttons&&Ee(Te)},mousemove:Te=>{Te.buttons||Ee(Te)}};this.register(this.coreMouseService.onProtocolChange((Te=>{Te?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Te)),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&Te?Se.mousemove||(se.addEventListener("mousemove",$e.mousemove),Se.mousemove=$e.mousemove):(se.removeEventListener("mousemove",Se.mousemove),Se.mousemove=null),16&Te?Se.wheel||(se.addEventListener("wheel",$e.wheel,{passive:!1}),Se.wheel=$e.wheel):(se.removeEventListener("wheel",Se.wheel),Se.wheel=null),2&Te?Se.mouseup||(Se.mouseup=$e.mouseup):(this._document.removeEventListener("mouseup",Se.mouseup),Se.mouseup=null),4&Te?Se.mousedrag||(Se.mousedrag=$e.mousedrag):(this._document.removeEventListener("mousemove",Se.mousedrag),Se.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,C.addDisposableDomListener)(se,"mousedown",(Te=>{if(Te.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Te))return Ee(Te),Se.mouseup&&this._document.addEventListener("mouseup",Se.mouseup),Se.mousedrag&&this._document.addEventListener("mousemove",Se.mousedrag),this.cancel(Te)}))),this.register((0,C.addDisposableDomListener)(se,"wheel",(Te=>{if(!Se.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(Te)===!1)return!1;if(!this.buffer.hasScrollback){const Ue=this.viewport.getLinesScrolled(Te);if(Ue===0)return;const Ve=me.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Te.deltaY<0?"A":"B");let Ge="";for(let ut=0;ut<Math.abs(Ue);ut++)Ge+=Ve;return this.coreService.triggerDataEvent(Ge,!0),this.cancel(Te,!0)}return this.viewport.handleWheel(Te)?this.cancel(Te):void 0}}),{passive:!1})),this.register((0,C.addDisposableDomListener)(se,"touchstart",(Te=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Te),this.cancel(Te)}),{passive:!0})),this.register((0,C.addDisposableDomListener)(se,"touchmove",(Te=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Te)?void 0:this.cancel(Te)}),{passive:!1}))}refresh(ue,se){var Ee;(Ee=this._renderService)==null||Ee.refreshRows(ue,se)}updateCursorStyle(ue){var se;(se=this._selectionService)!=null&&se.shouldColumnSelect(ue)?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(ue,se,Ee=0){var Se;Ee===1?(super.scrollLines(ue,se,Ee),this.refresh(0,this.rows-1)):(Se=this.viewport)==null||Se.scrollLines(ue)}paste(ue){(0,f.paste)(ue,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(ue){this._customKeyEventHandler=ue}attachCustomWheelEventHandler(ue){this._customWheelEventHandler=ue}registerLinkProvider(ue){return this._linkProviderService.registerLinkProvider(ue)}registerCharacterJoiner(ue){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const se=this._characterJoinerService.register(ue);return this.refresh(0,this.rows-1),se}deregisterCharacterJoiner(ue){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(ue)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(ue){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+ue)}registerDecoration(ue){return this._decorationService.registerDecoration(ue)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(ue,se,Ee){this._selectionService.setSelection(ue,se,Ee)}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 ue;(ue=this._selectionService)==null||ue.clearSelection()}selectAll(){var ue;(ue=this._selectionService)==null||ue.selectAll()}selectLines(ue,se){var Ee;(Ee=this._selectionService)==null||Ee.selectLines(ue,se)}_keyDown(ue){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(ue)===!1)return!1;const se=this.browser.isMac&&this.options.macOptionIsMeta&&ue.altKey;if(!se&&!this._compositionHelper.keydown(ue))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;se||ue.key!=="Dead"&&ue.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const Ee=(0,de.evaluateKeyboardEvent)(ue,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(ue),Ee.type===3||Ee.type===2){const Se=this.rows-1;return this.scrollLines(Ee.type===2?-Se:Se),this.cancel(ue,!0)}return Ee.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,ue)||(Ee.cancel&&this.cancel(ue,!0),!Ee.key||!!(ue.key&&!ue.ctrlKey&&!ue.altKey&&!ue.metaKey&&ue.key.length===1&&ue.key.charCodeAt(0)>=65&&ue.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(Ee.key!==me.C0.ETX&&Ee.key!==me.C0.CR||(this.textarea.value=""),this._onKey.fire({key:Ee.key,domEvent:ue}),this._showCursor(),this.coreService.triggerDataEvent(Ee.key,!0),!this.optionsService.rawOptions.screenReaderMode||ue.altKey||ue.ctrlKey?this.cancel(ue,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(ue,se){const Ee=ue.isMac&&!this.options.macOptionIsMeta&&se.altKey&&!se.ctrlKey&&!se.metaKey||ue.isWindows&&se.altKey&&se.ctrlKey&&!se.metaKey||ue.isWindows&&se.getModifierState("AltGraph");return se.type==="keypress"?Ee:Ee&&(!se.keyCode||se.keyCode>47)}_keyUp(ue){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(ue)===!1||((function(se){return se.keyCode===16||se.keyCode===17||se.keyCode===18})(ue)||this.focus(),this.updateCursorStyle(ue),this._keyPressHandled=!1)}_keyPress(ue){let se;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(ue)===!1)return!1;if(this.cancel(ue),ue.charCode)se=ue.charCode;else if(ue.which===null||ue.which===void 0)se=ue.keyCode;else{if(ue.which===0||ue.charCode===0)return!1;se=ue.which}return!(!se||(ue.altKey||ue.ctrlKey||ue.metaKey)&&!this._isThirdLevelShift(this.browser,ue)||(se=String.fromCharCode(se),this._onKey.fire({key:se,domEvent:ue}),this._showCursor(),this.coreService.triggerDataEvent(se,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(ue){if(ue.data&&ue.inputType==="insertText"&&(!ue.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const se=ue.data;return this.coreService.triggerDataEvent(se,!0),this.cancel(ue),!0}return!1}resize(ue,se){ue!==this.cols||se!==this.rows?super.resize(ue,se):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(ue,se){var Ee,Se;(Ee=this._charSizeService)==null||Ee.measure(),(Se=this.viewport)==null||Se.syncScrollArea(!0)}clear(){var ue;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 se=1;se<this.rows;se++)this.buffer.lines.push(this.buffer.getBlankLine(ve.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(ue=this.viewport)==null||ue.reset(),this.refresh(0,this.rows-1)}}reset(){var se,Ee;this.options.rows=this.rows,this.options.cols=this.cols;const ue=this._customKeyEventHandler;this._setup(),super.reset(),(se=this._selectionService)==null||se.reset(),this._decorationService.reset(),(Ee=this.viewport)==null||Ee.reset(),this._customKeyEventHandler=ue,this.refresh(0,this.rows-1)}clearTextureAtlas(){var ue;(ue=this._renderService)==null||ue.clearTextureAtlas()}_reportFocus(){var ue;(ue=this.element)!=null&&ue.classList.contains("focus")?this.coreService.triggerDataEvent(me.C0.ESC+"[I"):this.coreService.triggerDataEvent(me.C0.ESC+"[O")}_reportWindowsOptions(ue){if(this._renderService)switch(ue){case ie.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const se=this._renderService.dimensions.css.canvas.width.toFixed(0),Ee=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${me.C0.ESC}[4;${Ee};${se}t`);break;case ie.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Se=this._renderService.dimensions.css.cell.width.toFixed(0),$e=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${me.C0.ESC}[6;${$e};${Se}t`)}}cancel(ue,se){if(this.options.cancelEvents||se)return ue.preventDefault(),ue.stopPropagation(),!1}}a.Terminal=xe},9924:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TimeBasedDebouncer=void 0,a.TimeBasedDebouncer=class{constructor(l,f=1e3){this._renderCallback=l,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(l,f,C){this._rowCount=C,l=l!==void 0?l:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const P=d-this._lastRefreshMs,H=this._debounceThresholdMS-P;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),H)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const l=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,f)}}},1680:function(h,a,l){var f=this&&this.__decorate||function(N,x,j,V){var Y,J=arguments.length,X=J<3?x:V===null?V=Object.getOwnPropertyDescriptor(x,j):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")X=Reflect.decorate(N,x,j,V);else for(var G=N.length-1;G>=0;G--)(Y=N[G])&&(X=(J<3?Y(X):J>3?Y(x,j,X):Y(x,j))||X);return J>3&&X&&Object.defineProperty(x,j,X),X},C=this&&this.__param||function(N,x){return function(j,V){x(j,V,N)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Viewport=void 0;const d=l(3656),P=l(4725),H=l(8460),W=l(844),U=l(2585);let L=a.Viewport=class extends W.Disposable{constructor(N,x,j,V,Y,J,X,G){super(),this._viewportElement=N,this._scrollArea=x,this._bufferService=j,this._optionsService=V,this._charSizeService=Y,this._renderService=J,this._coreBrowserService=X,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 H.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((ee=>this._activeBuffer=ee.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((ee=>this._renderDimensions=ee))),this._handleThemeChange(G.colors),this.register(G.onChangeColors((ee=>this._handleThemeChange(ee)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(N){this._viewportElement.style.backgroundColor=N.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(N){if(N)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 N=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==N&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=N),this._refreshAnimationFrame=null}syncScrollArea(N=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(N);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(N)}_handleScroll(N){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 N=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(N*(this._smoothScrollState.target-this._smoothScrollState.origin)),N<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(N,x){const j=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&j<this._lastRecordedBufferHeight)||(N.cancelable&&N.preventDefault(),!1)}handleWheel(N){const x=this._getPixelsScrolled(N);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(N,x))}scrollLines(N){if(N!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const x=N*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:N,suppressScrollEvent:!1})}_getPixelsScrolled(N){if(N.deltaY===0||N.shiftKey)return 0;let x=this._applyScrollModifier(N.deltaY,N);return N.deltaMode===WheelEvent.DOM_DELTA_LINE?x*=this._currentRowHeight:N.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._currentRowHeight*this._bufferService.rows),x}getBufferElements(N,x){var G;let j,V="";const Y=[],J=x??this._bufferService.buffer.lines.length,X=this._bufferService.buffer.lines;for(let ee=N;ee<J;ee++){const ne=X.get(ee);if(!ne)continue;const ae=(G=X.get(ee+1))==null?void 0:G.isWrapped;if(V+=ne.translateToString(!ae),!ae||ee===X.length-1){const ce=document.createElement("div");ce.textContent=V,Y.push(ce),V.length>0&&(j=ce),V=""}}return{bufferElements:Y,cursorElement:j}}getLinesScrolled(N){if(N.deltaY===0||N.shiftKey)return 0;let x=this._applyScrollModifier(N.deltaY,N);return N.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):N.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(N,x){const j=this._optionsService.rawOptions.fastScrollModifier;return j==="alt"&&x.altKey||j==="ctrl"&&x.ctrlKey||j==="shift"&&x.shiftKey?N*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:N*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(N){this._lastTouchY=N.touches[0].pageY}handleTouchMove(N){const x=this._lastTouchY-N.touches[0].pageY;return this._lastTouchY=N.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(N,x))}};a.Viewport=L=f([C(2,U.IBufferService),C(3,U.IOptionsService),C(4,P.ICharSizeService),C(5,P.IRenderService),C(6,P.ICoreBrowserService),C(7,P.IThemeService)],L)},3107:function(h,a,l){var f=this&&this.__decorate||function(U,L,N,x){var j,V=arguments.length,Y=V<3?L:x===null?x=Object.getOwnPropertyDescriptor(L,N):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(U,L,N,x);else for(var J=U.length-1;J>=0;J--)(j=U[J])&&(Y=(V<3?j(Y):V>3?j(L,N,Y):j(L,N))||Y);return V>3&&Y&&Object.defineProperty(L,N,Y),Y},C=this&&this.__param||function(U,L){return function(N,x){L(N,x,U)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferDecorationRenderer=void 0;const d=l(4725),P=l(844),H=l(2585);let W=a.BufferDecorationRenderer=class extends P.Disposable{constructor(U,L,N,x,j){super(),this._screenElement=U,this._bufferService=L,this._coreBrowserService=N,this._decorationService=x,this._renderService=j,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((V=>this._removeDecoration(V)))),this.register((0,P.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 U of this._decorationService.decorations)this._renderDecoration(U);this._dimensionsChanged=!1}_renderDecoration(U){this._refreshStyle(U),this._dimensionsChanged&&this._refreshXPosition(U)}_createElement(U){var x;const L=this._coreBrowserService.mainDocument.createElement("div");L.classList.add("xterm-decoration"),L.classList.toggle("xterm-decoration-top-layer",((x=U==null?void 0:U.options)==null?void 0:x.layer)==="top"),L.style.width=`${Math.round((U.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,L.style.height=(U.options.height||1)*this._renderService.dimensions.css.cell.height+"px",L.style.top=(U.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",L.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const N=U.options.x??0;return N&&N>this._bufferService.cols&&(L.style.display="none"),this._refreshXPosition(U,L),L}_refreshStyle(U){const L=U.marker.line-this._bufferService.buffers.active.ydisp;if(L<0||L>=this._bufferService.rows)U.element&&(U.element.style.display="none",U.onRenderEmitter.fire(U.element));else{let N=this._decorationElements.get(U);N||(N=this._createElement(U),U.element=N,this._decorationElements.set(U,N),this._container.appendChild(N),U.onDispose((()=>{this._decorationElements.delete(U),N.remove()}))),N.style.top=L*this._renderService.dimensions.css.cell.height+"px",N.style.display=this._altBufferIsActive?"none":"block",U.onRenderEmitter.fire(N)}}_refreshXPosition(U,L=U.element){if(!L)return;const N=U.options.x??0;(U.options.anchor||"left")==="right"?L.style.right=N?N*this._renderService.dimensions.css.cell.width+"px":"":L.style.left=N?N*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(U){var L;(L=this._decorationElements.get(U))==null||L.remove(),this._decorationElements.delete(U),U.dispose()}};a.BufferDecorationRenderer=W=f([C(1,H.IBufferService),C(2,d.ICoreBrowserService),C(3,H.IDecorationService),C(4,d.IRenderService)],W)},5871:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorZoneStore=void 0,a.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(l){if(l.options.overviewRulerOptions){for(const f of this._zones)if(f.color===l.options.overviewRulerOptions.color&&f.position===l.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,l.marker.line))return;if(this._lineAdjacentToZone(f,l.marker.line,l.options.overviewRulerOptions.position))return void this._addLineToZone(f,l.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=l.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=l.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=l.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=l.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:l.options.overviewRulerOptions.color,position:l.options.overviewRulerOptions.position,startBufferLine:l.marker.line,endBufferLine:l.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(l){this._linePadding=l}_lineIntersectsZone(l,f){return f>=l.startBufferLine&&f<=l.endBufferLine}_lineAdjacentToZone(l,f,C){return f>=l.startBufferLine-this._linePadding[C||"full"]&&f<=l.endBufferLine+this._linePadding[C||"full"]}_addLineToZone(l,f){l.startBufferLine=Math.min(l.startBufferLine,f),l.endBufferLine=Math.max(l.endBufferLine,f)}}},5744:function(h,a,l){var f=this&&this.__decorate||function(j,V,Y,J){var X,G=arguments.length,ee=G<3?V:J===null?J=Object.getOwnPropertyDescriptor(V,Y):J;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ee=Reflect.decorate(j,V,Y,J);else for(var ne=j.length-1;ne>=0;ne--)(X=j[ne])&&(ee=(G<3?X(ee):G>3?X(V,Y,ee):X(V,Y))||ee);return G>3&&ee&&Object.defineProperty(V,Y,ee),ee},C=this&&this.__param||function(j,V){return function(Y,J){V(Y,J,j)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OverviewRulerRenderer=void 0;const d=l(5871),P=l(4725),H=l(844),W=l(2585),U={full:0,left:0,center:0,right:0},L={full:0,left:0,center:0,right:0},N={full:0,left:0,center:0,right:0};let x=a.OverviewRulerRenderer=class extends H.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(j,V,Y,J,X,G,ee){var ae;super(),this._viewportElement=j,this._screenElement=V,this._bufferService=Y,this._decorationService=J,this._renderService=X,this._optionsService=G,this._coreBrowserService=ee,this._colorZoneStore=new d.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(),(ae=this._viewportElement.parentElement)==null||ae.insertBefore(this._canvas,this._viewportElement);const ne=this._canvas.getContext("2d");if(!ne)throw new Error("Ctx cannot be null");this._ctx=ne,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,H.toDisposable)((()=>{var ce;(ce=this._canvas)==null||ce.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 j=Math.floor(this._canvas.width/3),V=Math.ceil(this._canvas.width/3);L.full=this._canvas.width,L.left=j,L.center=V,L.right=j,this._refreshDrawHeightConstants(),N.full=0,N.left=0,N.center=L.left,N.right=L.left+L.center}_refreshDrawHeightConstants(){U.full=Math.round(2*this._coreBrowserService.dpr);const j=this._canvas.height/this._bufferService.buffer.lines.length,V=Math.round(Math.max(Math.min(j,12),6)*this._coreBrowserService.dpr);U.left=V,U.center=V,U.right=V}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*U.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*U.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*U.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*U.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 V of this._decorationService.decorations)this._colorZoneStore.addDecoration(V);this._ctx.lineWidth=1;const j=this._colorZoneStore.zones;for(const V of j)V.position!=="full"&&this._renderColorZone(V);for(const V of j)V.position==="full"&&this._renderColorZone(V);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(j){this._ctx.fillStyle=j.color,this._ctx.fillRect(N[j.position||"full"],Math.round((this._canvas.height-1)*(j.startBufferLine/this._bufferService.buffers.active.lines.length)-U[j.position||"full"]/2),L[j.position||"full"],Math.round((this._canvas.height-1)*((j.endBufferLine-j.startBufferLine)/this._bufferService.buffers.active.lines.length)+U[j.position||"full"]))}_queueRefresh(j,V){this._shouldUpdateDimensions=j||this._shouldUpdateDimensions,this._shouldUpdateAnchor=V||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};a.OverviewRulerRenderer=x=f([C(2,W.IBufferService),C(3,W.IDecorationService),C(4,P.IRenderService),C(5,W.IOptionsService),C(6,P.ICoreBrowserService)],x)},2950:function(h,a,l){var f=this&&this.__decorate||function(U,L,N,x){var j,V=arguments.length,Y=V<3?L:x===null?x=Object.getOwnPropertyDescriptor(L,N):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(U,L,N,x);else for(var J=U.length-1;J>=0;J--)(j=U[J])&&(Y=(V<3?j(Y):V>3?j(L,N,Y):j(L,N))||Y);return V>3&&Y&&Object.defineProperty(L,N,Y),Y},C=this&&this.__param||function(U,L){return function(N,x){L(N,x,U)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CompositionHelper=void 0;const d=l(4725),P=l(2585),H=l(2584);let W=a.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(U,L,N,x,j,V){this._textarea=U,this._compositionView=L,this._bufferService=N,this._optionsService=x,this._coreService=j,this._renderService=V,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(U){this._compositionView.textContent=U.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(U){if(this._isComposing||this._isSendingComposition){if(U.keyCode===229||U.keyCode===16||U.keyCode===17||U.keyCode===18)return!1;this._finalizeComposition(!1)}return U.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(U){if(this._compositionView.classList.remove("active"),this._isComposing=!1,U){const L={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let N;this._isSendingComposition=!1,L.start+=this._dataAlreadySent.length,N=this._isComposing?this._textarea.value.substring(L.start,L.end):this._textarea.value.substring(L.start),N.length>0&&this._coreService.triggerDataEvent(N,!0)}}),0)}else{this._isSendingComposition=!1;const L=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(L,!0)}}_handleAnyTextareaChanges(){const U=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const L=this._textarea.value,N=L.replace(U,"");this._dataAlreadySent=N,L.length>U.length?this._coreService.triggerDataEvent(N,!0):L.length<U.length?this._coreService.triggerDataEvent(`${H.C0.DEL}`,!0):L.length===U.length&&L!==U&&this._coreService.triggerDataEvent(L,!0)}}),0)}updateCompositionElements(U){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const L=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),N=this._renderService.dimensions.css.cell.height,x=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,j=L*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=j+"px",this._compositionView.style.top=x+"px",this._compositionView.style.height=N+"px",this._compositionView.style.lineHeight=N+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const V=this._compositionView.getBoundingClientRect();this._textarea.style.left=j+"px",this._textarea.style.top=x+"px",this._textarea.style.width=Math.max(V.width,1)+"px",this._textarea.style.height=Math.max(V.height,1)+"px",this._textarea.style.lineHeight=V.height+"px"}U||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};a.CompositionHelper=W=f([C(2,P.IBufferService),C(3,P.IOptionsService),C(4,P.ICoreService),C(5,d.IRenderService)],W)},9806:(h,a)=>{function l(f,C,d){const P=d.getBoundingClientRect(),H=f.getComputedStyle(d),W=parseInt(H.getPropertyValue("padding-left")),U=parseInt(H.getPropertyValue("padding-top"));return[C.clientX-P.left-W,C.clientY-P.top-U]}Object.defineProperty(a,"__esModule",{value:!0}),a.getCoords=a.getCoordsRelativeToElement=void 0,a.getCoordsRelativeToElement=l,a.getCoords=function(f,C,d,P,H,W,U,L,N){if(!W)return;const x=l(f,C,d);return x?(x[0]=Math.ceil((x[0]+(N?U/2:0))/U),x[1]=Math.ceil(x[1]/L),x[0]=Math.min(Math.max(x[0],1),P+(N?1:0)),x[1]=Math.min(Math.max(x[1],1),H),x):void 0}},9504:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.moveToCellSequence=void 0;const f=l(2584);function C(L,N,x,j){const V=L-d(L,x),Y=N-d(N,x),J=Math.abs(V-Y)-(function(X,G,ee){let ne=0;const ae=X-d(X,ee),ce=G-d(G,ee);for(let oe=0;oe<Math.abs(ae-ce);oe++){const we=P(X,G)==="A"?-1:1,be=ee.buffer.lines.get(ae+we*oe);be!=null&&be.isWrapped&&ne++}return ne})(L,N,x);return U(J,W(P(L,N),j))}function d(L,N){let x=0,j=N.buffer.lines.get(L),V=j==null?void 0:j.isWrapped;for(;V&&L>=0&&L<N.rows;)x++,j=N.buffer.lines.get(--L),V=j==null?void 0:j.isWrapped;return x}function P(L,N){return L>N?"A":"B"}function H(L,N,x,j,V,Y){let J=L,X=N,G="";for(;J!==x||X!==j;)J+=V?1:-1,V&&J>Y.cols-1?(G+=Y.buffer.translateBufferLineToString(X,!1,L,J),J=0,L=0,X++):!V&&J<0&&(G+=Y.buffer.translateBufferLineToString(X,!1,0,L+1),J=Y.cols-1,L=J,X--);return G+Y.buffer.translateBufferLineToString(X,!1,L,J)}function W(L,N){const x=N?"O":"[";return f.C0.ESC+x+L}function U(L,N){L=Math.floor(L);let x="";for(let j=0;j<L;j++)x+=N;return x}a.moveToCellSequence=function(L,N,x,j){const V=x.buffer.x,Y=x.buffer.y;if(!x.buffer.hasScrollback)return(function(G,ee,ne,ae,ce,oe){return C(ee,ae,ce,oe).length===0?"":U(H(G,ee,G,ee-d(ee,ce),!1,ce).length,W("D",oe))})(V,Y,0,N,x,j)+C(Y,N,x,j)+(function(G,ee,ne,ae,ce,oe){let we;we=C(ee,ae,ce,oe).length>0?ae-d(ae,ce):ee;const be=ae,ve=(function(me,de,Q,re,Z,ie){let ge;return ge=C(Q,re,Z,ie).length>0?re-d(re,Z):de,me<Q&&ge<=re||me>=Q&&ge<re?"C":"D"})(G,ee,ne,ae,ce,oe);return U(H(G,we,ne,be,ve==="C",ce).length,W(ve,oe))})(V,Y,L,N,x,j);let J;if(Y===N)return J=V>L?"D":"C",U(Math.abs(V-L),W(J,j));J=Y>N?"D":"C";const X=Math.abs(Y-N);return U((function(G,ee){return ee.cols-G})(Y>N?L:V,x)+(X-1)*x.cols+1+((Y>N?V:L)-1),W(J,j))}},1296:function(h,a,l){var f=this&&this.__decorate||function(oe,we,be,ve){var me,de=arguments.length,Q=de<3?we:ve===null?ve=Object.getOwnPropertyDescriptor(we,be):ve;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Q=Reflect.decorate(oe,we,be,ve);else for(var re=oe.length-1;re>=0;re--)(me=oe[re])&&(Q=(de<3?me(Q):de>3?me(we,be,Q):me(we,be))||Q);return de>3&&Q&&Object.defineProperty(we,be,Q),Q},C=this&&this.__param||function(oe,we){return function(be,ve){we(be,ve,oe)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRenderer=void 0;const d=l(3787),P=l(2550),H=l(2223),W=l(6171),U=l(6052),L=l(4725),N=l(8055),x=l(8460),j=l(844),V=l(2585),Y="xterm-dom-renderer-owner-",J="xterm-rows",X="xterm-fg-",G="xterm-bg-",ee="xterm-focus",ne="xterm-selection";let ae=1,ce=a.DomRenderer=class extends j.Disposable{constructor(oe,we,be,ve,me,de,Q,re,Z,ie,ge,fe,xe){super(),this._terminal=oe,this._document=we,this._element=be,this._screenElement=ve,this._viewportElement=me,this._helperContainer=de,this._linkifier2=Q,this._charSizeService=Z,this._optionsService=ie,this._bufferService=ge,this._coreBrowserService=fe,this._themeService=xe,this._terminalClass=ae++,this._rowElements=[],this._selectionRenderModel=(0,U.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(J),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(ne),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,W.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ke=>this._injectCss(ke)))),this._injectCss(this._themeService.colors),this._rowFactory=re.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(Y+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ke=>this._handleLinkHover(ke)))),this.register(this._linkifier2.onHideLinkUnderline((ke=>this._handleLinkLeave(ke)))),this.register((0,j.toDisposable)((()=>{this._element.classList.remove(Y+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new P.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 oe=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*oe,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*oe),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/oe),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/oe),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 be of this._rowElements)be.style.width=`${this.dimensions.css.canvas.width}px`,be.style.height=`${this.dimensions.css.cell.height}px`,be.style.lineHeight=`${this.dimensions.css.cell.height}px`,be.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const we=`${this._terminalSelector} .${J} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=we,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(oe){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let we=`${this._terminalSelector} .${J} { color: ${oe.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;we+=`${this._terminalSelector} .${J} .xterm-dim { color: ${N.color.multiplyOpacity(oe.foreground,.5).css};}`,we+=`${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 be=`blink_underline_${this._terminalClass}`,ve=`blink_bar_${this._terminalClass}`,me=`blink_block_${this._terminalClass}`;we+=`@keyframes ${be} { 50% { border-bottom-style: hidden; }}`,we+=`@keyframes ${ve} { 50% { box-shadow: none; }}`,we+=`@keyframes ${me} { 0% { background-color: ${oe.cursor.css}; color: ${oe.cursorAccent.css}; } 50% { background-color: inherit; color: ${oe.cursor.css}; }}`,we+=`${this._terminalSelector} .${J}.${ee} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${be} 1s step-end infinite;}${this._terminalSelector} .${J}.${ee} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${ve} 1s step-end infinite;}${this._terminalSelector} .${J}.${ee} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${me} 1s step-end infinite;}${this._terminalSelector} .${J} .xterm-cursor.xterm-cursor-block { background-color: ${oe.cursor.css}; color: ${oe.cursorAccent.css};}${this._terminalSelector} .${J} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${oe.cursor.css} !important; color: ${oe.cursorAccent.css} !important;}${this._terminalSelector} .${J} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${oe.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${J} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${oe.cursor.css} inset;}${this._terminalSelector} .${J} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${oe.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,we+=`${this._terminalSelector} .${ne} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ne} div { position: absolute; background-color: ${oe.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ne} div { position: absolute; background-color: ${oe.selectionInactiveBackgroundOpaque.css};}`;for(const[de,Q]of oe.ansi.entries())we+=`${this._terminalSelector} .${X}${de} { color: ${Q.css}; }${this._terminalSelector} .${X}${de}.xterm-dim { color: ${N.color.multiplyOpacity(Q,.5).css}; }${this._terminalSelector} .${G}${de} { background-color: ${Q.css}; }`;we+=`${this._terminalSelector} .${X}${H.INVERTED_DEFAULT_COLOR} { color: ${N.color.opaque(oe.background).css}; }${this._terminalSelector} .${X}${H.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${N.color.multiplyOpacity(N.color.opaque(oe.background),.5).css}; }${this._terminalSelector} .${G}${H.INVERTED_DEFAULT_COLOR} { background-color: ${oe.foreground.css}; }`,this._themeStyleElement.textContent=we}_setDefaultSpacing(){const oe=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${oe}px`,this._rowFactory.defaultSpacing=oe}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(oe,we){for(let be=this._rowElements.length;be<=we;be++){const ve=this._document.createElement("div");this._rowContainer.appendChild(ve),this._rowElements.push(ve)}for(;this._rowElements.length>we;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(oe,we){this._refreshRowElements(oe,we),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(ee),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ee),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(oe,we,be){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(oe,we,be),this.renderRows(0,this._bufferService.rows-1),!oe||!we)return;this._selectionRenderModel.update(this._terminal,oe,we,be);const ve=this._selectionRenderModel.viewportStartRow,me=this._selectionRenderModel.viewportEndRow,de=this._selectionRenderModel.viewportCappedStartRow,Q=this._selectionRenderModel.viewportCappedEndRow;if(de>=this._bufferService.rows||Q<0)return;const re=this._document.createDocumentFragment();if(be){const Z=oe[0]>we[0];re.appendChild(this._createSelectionElement(de,Z?we[0]:oe[0],Z?oe[0]:we[0],Q-de+1))}else{const Z=ve===de?oe[0]:0,ie=de===me?we[0]:this._bufferService.cols;re.appendChild(this._createSelectionElement(de,Z,ie));const ge=Q-de-1;if(re.appendChild(this._createSelectionElement(de+1,0,this._bufferService.cols,ge)),de!==Q){const fe=me===Q?we[0]:this._bufferService.cols;re.appendChild(this._createSelectionElement(Q,0,fe))}}this._selectionContainer.appendChild(re)}_createSelectionElement(oe,we,be,ve=1){const me=this._document.createElement("div"),de=we*this.dimensions.css.cell.width;let Q=this.dimensions.css.cell.width*(be-we);return de+Q>this.dimensions.css.canvas.width&&(Q=this.dimensions.css.canvas.width-de),me.style.height=ve*this.dimensions.css.cell.height+"px",me.style.top=oe*this.dimensions.css.cell.height+"px",me.style.left=`${de}px`,me.style.width=`${Q}px`,me}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 oe of this._rowElements)oe.replaceChildren()}renderRows(oe,we){const be=this._bufferService.buffer,ve=be.ybase+be.y,me=Math.min(be.x,this._bufferService.cols-1),de=this._optionsService.rawOptions.cursorBlink,Q=this._optionsService.rawOptions.cursorStyle,re=this._optionsService.rawOptions.cursorInactiveStyle;for(let Z=oe;Z<=we;Z++){const ie=Z+be.ydisp,ge=this._rowElements[Z],fe=be.lines.get(ie);if(!ge||!fe)break;ge.replaceChildren(...this._rowFactory.createRow(fe,ie,ie===ve,Q,re,me,de,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Y}${this._terminalClass}`}_handleLinkHover(oe){this._setCellUnderline(oe.x1,oe.x2,oe.y1,oe.y2,oe.cols,!0)}_handleLinkLeave(oe){this._setCellUnderline(oe.x1,oe.x2,oe.y1,oe.y2,oe.cols,!1)}_setCellUnderline(oe,we,be,ve,me,de){be<0&&(oe=0),ve<0&&(we=0);const Q=this._bufferService.rows-1;be=Math.max(Math.min(be,Q),0),ve=Math.max(Math.min(ve,Q),0),me=Math.min(me,this._bufferService.cols);const re=this._bufferService.buffer,Z=re.ybase+re.y,ie=Math.min(re.x,me-1),ge=this._optionsService.rawOptions.cursorBlink,fe=this._optionsService.rawOptions.cursorStyle,xe=this._optionsService.rawOptions.cursorInactiveStyle;for(let ke=be;ke<=ve;++ke){const ue=ke+re.ydisp,se=this._rowElements[ke],Ee=re.lines.get(ue);if(!se||!Ee)break;se.replaceChildren(...this._rowFactory.createRow(Ee,ue,ue===Z,fe,xe,ie,ge,this.dimensions.css.cell.width,this._widthCache,de?ke===be?oe:0:-1,de?(ke===ve?we:me)-1:-1))}}};a.DomRenderer=ce=f([C(7,V.IInstantiationService),C(8,L.ICharSizeService),C(9,V.IOptionsService),C(10,V.IBufferService),C(11,L.ICoreBrowserService),C(12,L.IThemeService)],ce)},3787:function(h,a,l){var f=this&&this.__decorate||function(J,X,G,ee){var ne,ae=arguments.length,ce=ae<3?X:ee===null?ee=Object.getOwnPropertyDescriptor(X,G):ee;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ce=Reflect.decorate(J,X,G,ee);else for(var oe=J.length-1;oe>=0;oe--)(ne=J[oe])&&(ce=(ae<3?ne(ce):ae>3?ne(X,G,ce):ne(X,G))||ce);return ae>3&&ce&&Object.defineProperty(X,G,ce),ce},C=this&&this.__param||function(J,X){return function(G,ee){X(G,ee,J)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRendererRowFactory=void 0;const d=l(2223),P=l(643),H=l(511),W=l(2585),U=l(8055),L=l(4725),N=l(4269),x=l(6171),j=l(3734);let V=a.DomRendererRowFactory=class{constructor(J,X,G,ee,ne,ae,ce){this._document=J,this._characterJoinerService=X,this._optionsService=G,this._coreBrowserService=ee,this._coreService=ne,this._decorationService=ae,this._themeService=ce,this._workCell=new H.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(J,X,G){this._selectionStart=J,this._selectionEnd=X,this._columnSelectMode=G}createRow(J,X,G,ee,ne,ae,ce,oe,we,be,ve){const me=[],de=this._characterJoinerService.getJoinedCharacters(X),Q=this._themeService.colors;let re,Z=J.getNoBgTrimmedLength();G&&Z<ae+1&&(Z=ae+1);let ie=0,ge="",fe=0,xe=0,ke=0,ue=!1,se=0,Ee=!1,Se=0;const $e=[],Te=be!==-1&&ve!==-1;for(let Ue=0;Ue<Z;Ue++){J.loadCell(Ue,this._workCell);let Ve=this._workCell.getWidth();if(Ve===0)continue;let Ge=!1,ut=Ue,je=this._workCell;if(de.length>0&&Ue===de[0][0]){Ge=!0;const Ye=de.shift();je=new N.JoinedCellData(this._workCell,J.translateToString(!0,Ye[0],Ye[1]),Ye[1]-Ye[0]),ut=Ye[1]-1,Ve=je.getWidth()}const cr=this._isCellInSelection(Ue,X),Tr=G&&Ue===ae,er=Te&&Ue>=be&&Ue<=ve;let Kt=!1;this._decorationService.forEachDecorationAtCell(Ue,X,void 0,(Ye=>{Kt=!0}));let ur=je.getChars()||P.WHITESPACE_CELL_CHAR;if(ur===" "&&(je.isUnderline()||je.isOverline())&&(ur=" "),Se=Ve*oe-we.get(ur,je.isBold(),je.isItalic()),re){if(ie&&(cr&&Ee||!cr&&!Ee&&je.bg===fe)&&(cr&&Ee&&Q.selectionForeground||je.fg===xe)&&je.extended.ext===ke&&er===ue&&Se===se&&!Tr&&!Ge&&!Kt){je.isInvisible()?ge+=P.WHITESPACE_CELL_CHAR:ge+=ur,ie++;continue}ie&&(re.textContent=ge),re=this._document.createElement("span"),ie=0,ge=""}else re=this._document.createElement("span");if(fe=je.bg,xe=je.fg,ke=je.extended.ext,ue=er,se=Se,Ee=cr,Ge&&ae>=Ue&&ae<=ut&&(ae=Ue),!this._coreService.isCursorHidden&&Tr&&this._coreService.isCursorInitialized){if($e.push("xterm-cursor"),this._coreBrowserService.isFocused)ce&&$e.push("xterm-cursor-blink"),$e.push(ee==="bar"?"xterm-cursor-bar":ee==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(ne)switch(ne){case"outline":$e.push("xterm-cursor-outline");break;case"block":$e.push("xterm-cursor-block");break;case"bar":$e.push("xterm-cursor-bar");break;case"underline":$e.push("xterm-cursor-underline")}}if(je.isBold()&&$e.push("xterm-bold"),je.isItalic()&&$e.push("xterm-italic"),je.isDim()&&$e.push("xterm-dim"),ge=je.isInvisible()?P.WHITESPACE_CELL_CHAR:je.getChars()||P.WHITESPACE_CELL_CHAR,je.isUnderline()&&($e.push(`xterm-underline-${je.extended.underlineStyle}`),ge===" "&&(ge=" "),!je.isUnderlineColorDefault()))if(je.isUnderlineColorRGB())re.style.textDecorationColor=`rgb(${j.AttributeData.toColorRGB(je.getUnderlineColor()).join(",")})`;else{let Ye=je.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&je.isBold()&&Ye<8&&(Ye+=8),re.style.textDecorationColor=Q.ansi[Ye].css}je.isOverline()&&($e.push("xterm-overline"),ge===" "&&(ge=" ")),je.isStrikethrough()&&$e.push("xterm-strikethrough"),er&&(re.style.textDecoration="underline");let vt=je.getFgColor(),hr=je.getFgColorMode(),kt=je.getBgColor(),dr=je.getBgColorMode();const Dr=!!je.isInverse();if(Dr){const Ye=vt;vt=kt,kt=Ye;const si=hr;hr=dr,dr=si}let Lt,Br,yt,Nt=!1;switch(this._decorationService.forEachDecorationAtCell(Ue,X,void 0,(Ye=>{Ye.options.layer!=="top"&&Nt||(Ye.backgroundColorRGB&&(dr=50331648,kt=Ye.backgroundColorRGB.rgba>>8&16777215,Lt=Ye.backgroundColorRGB),Ye.foregroundColorRGB&&(hr=50331648,vt=Ye.foregroundColorRGB.rgba>>8&16777215,Br=Ye.foregroundColorRGB),Nt=Ye.options.layer==="top")})),!Nt&&cr&&(Lt=this._coreBrowserService.isFocused?Q.selectionBackgroundOpaque:Q.selectionInactiveBackgroundOpaque,kt=Lt.rgba>>8&16777215,dr=50331648,Nt=!0,Q.selectionForeground&&(hr=50331648,vt=Q.selectionForeground.rgba>>8&16777215,Br=Q.selectionForeground)),Nt&&$e.push("xterm-decoration-top"),dr){case 16777216:case 33554432:yt=Q.ansi[kt],$e.push(`xterm-bg-${kt}`);break;case 50331648:yt=U.channels.toColor(kt>>16,kt>>8&255,255&kt),this._addStyle(re,`background-color:#${Y((kt>>>0).toString(16),"0",6)}`);break;default:Dr?(yt=Q.foreground,$e.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):yt=Q.background}switch(Lt||je.isDim()&&(Lt=U.color.multiplyOpacity(yt,.5)),hr){case 16777216:case 33554432:je.isBold()&&vt<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(vt+=8),this._applyMinimumContrast(re,yt,Q.ansi[vt],je,Lt,void 0)||$e.push(`xterm-fg-${vt}`);break;case 50331648:const Ye=U.channels.toColor(vt>>16&255,vt>>8&255,255&vt);this._applyMinimumContrast(re,yt,Ye,je,Lt,Br)||this._addStyle(re,`color:#${Y(vt.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(re,yt,Q.foreground,je,Lt,Br)||Dr&&$e.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}$e.length&&(re.className=$e.join(" "),$e.length=0),Tr||Ge||Kt?re.textContent=ge:ie++,Se!==this.defaultSpacing&&(re.style.letterSpacing=`${Se}px`),me.push(re),Ue=ut}return re&&ie&&(re.textContent=ge),me}_applyMinimumContrast(J,X,G,ee,ne,ae){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(ee.getCode()))return!1;const ce=this._getContrastCache(ee);let oe;if(ne||ae||(oe=ce.getColor(X.rgba,G.rgba)),oe===void 0){const we=this._optionsService.rawOptions.minimumContrastRatio/(ee.isDim()?2:1);oe=U.color.ensureContrastRatio(ne||X,ae||G,we),ce.setColor((ne||X).rgba,(ae||G).rgba,oe??null)}return!!oe&&(this._addStyle(J,`color:${oe.css}`),!0)}_getContrastCache(J){return J.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(J,X){J.setAttribute("style",`${J.getAttribute("style")||""}${X};`)}_isCellInSelection(J,X){const G=this._selectionStart,ee=this._selectionEnd;return!(!G||!ee)&&(this._columnSelectMode?G[0]<=ee[0]?J>=G[0]&&X>=G[1]&&J<ee[0]&&X<=ee[1]:J<G[0]&&X>=G[1]&&J>=ee[0]&&X<=ee[1]:X>G[1]&&X<ee[1]||G[1]===ee[1]&&X===G[1]&&J>=G[0]&&J<ee[0]||G[1]<ee[1]&&X===ee[1]&&J<ee[0]||G[1]<ee[1]&&X===G[1]&&J>=G[0])}};function Y(J,X,G){for(;J.length<G;)J=X+J;return J}a.DomRendererRowFactory=V=f([C(1,L.ICharacterJoinerService),C(2,W.IOptionsService),C(3,L.ICoreBrowserService),C(4,W.ICoreService),C(5,W.IDecorationService),C(6,L.IThemeService)],V)},2550:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WidthCache=void 0,a.WidthCache=class{constructor(l,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=l.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 C=l.createElement("span");C.classList.add("xterm-char-measure-element");const d=l.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const P=l.createElement("span");P.classList.add("xterm-char-measure-element"),P.style.fontStyle="italic";const H=l.createElement("span");H.classList.add("xterm-char-measure-element"),H.style.fontWeight="bold",H.style.fontStyle="italic",this._measureElements=[C,d,P,H],this._container.appendChild(C),this._container.appendChild(d),this._container.appendChild(P),this._container.appendChild(H),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(l,f,C,d){l===this._font&&f===this._fontSize&&C===this._weight&&d===this._weightBold||(this._font=l,this._fontSize=f,this._weight=C,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${C}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${C}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(l,f,C){let d=0;if(!f&&!C&&l.length===1&&(d=l.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const W=this._measure(l,0);return W>0&&(this._flat[d]=W),W}let P=l;f&&(P+="B"),C&&(P+="I");let H=this._holey.get(P);if(H===void 0){let W=0;f&&(W|=1),C&&(W|=2),H=this._measure(l,W),H>0&&this._holey.set(P,H)}return H}_measure(l,f){const C=this._measureElements[f];return C.textContent=l.repeat(32),C.offsetWidth/32}}},2223:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TEXT_BASELINE=a.DIM_OPACITY=a.INVERTED_DEFAULT_COLOR=void 0;const f=l(6114);a.INVERTED_DEFAULT_COLOR=257,a.DIM_OPACITY=.5,a.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(h,a)=>{function l(C){return 57508<=C&&C<=57558}function f(C){return C>=128512&&C<=128591||C>=127744&&C<=128511||C>=128640&&C<=128767||C>=9728&&C<=9983||C>=9984&&C<=10175||C>=65024&&C<=65039||C>=129280&&C<=129535||C>=127462&&C<=127487}Object.defineProperty(a,"__esModule",{value:!0}),a.computeNextVariantOffset=a.createRenderDimensions=a.treatGlyphAsBackgroundColor=a.allowRescaling=a.isEmoji=a.isRestrictedPowerlineGlyph=a.isPowerlineGlyph=a.throwIfFalsy=void 0,a.throwIfFalsy=function(C){if(!C)throw new Error("value must not be falsy");return C},a.isPowerlineGlyph=l,a.isRestrictedPowerlineGlyph=function(C){return 57520<=C&&C<=57527},a.isEmoji=f,a.allowRescaling=function(C,d,P,H){return d===1&&P>Math.ceil(1.5*H)&&C!==void 0&&C>255&&!f(C)&&!l(C)&&!(function(W){return 57344<=W&&W<=63743})(C)},a.treatGlyphAsBackgroundColor=function(C){return l(C)||(function(d){return 9472<=d&&d<=9631})(C)},a.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}}}},a.computeNextVariantOffset=function(C,d,P=0){return(C-(2*Math.round(d)-P))%(2*Math.round(d))}},6052:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createSelectionRenderModel=void 0;class l{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(C,d,P,H=!1){if(this.selectionStart=d,this.selectionEnd=P,!d||!P||d[0]===P[0]&&d[1]===P[1])return void this.clear();const W=C.buffers.active.ydisp,U=d[1]-W,L=P[1]-W,N=Math.max(U,0),x=Math.min(L,C.rows-1);N>=C.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=H,this.viewportStartRow=U,this.viewportEndRow=L,this.viewportCappedStartRow=N,this.viewportCappedEndRow=x,this.startCol=d[0],this.endCol=P[0])}isCellSelected(C,d,P){return!!this.hasSelection&&(P-=C.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&P>=this.viewportCappedStartRow&&d<this.endCol&&P<=this.viewportCappedEndRow:d<this.startCol&&P>=this.viewportCappedStartRow&&d>=this.endCol&&P<=this.viewportCappedEndRow:P>this.viewportStartRow&&P<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&P===this.viewportStartRow&&d>=this.startCol&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&P===this.viewportEndRow&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&P===this.viewportStartRow&&d>=this.startCol)}}a.createSelectionRenderModel=function(){return new l}},456:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionModel=void 0,a.SelectionModel=class{constructor(l){this._bufferService=l,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 l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?l%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)-1]:[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[l,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[Math.max(l,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const l=this.selectionStart,f=this.selectionEnd;return!(!l||!f)&&(l[1]>f[1]||l[1]===f[1]&&l[0]>f[0])}handleTrim(l){return this.selectionStart&&(this.selectionStart[1]-=l),this.selectionEnd&&(this.selectionEnd[1]-=l),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(h,a,l){var f=this&&this.__decorate||function(x,j,V,Y){var J,X=arguments.length,G=X<3?j:Y===null?Y=Object.getOwnPropertyDescriptor(j,V):Y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(x,j,V,Y);else for(var ee=x.length-1;ee>=0;ee--)(J=x[ee])&&(G=(X<3?J(G):X>3?J(j,V,G):J(j,V))||G);return X>3&&G&&Object.defineProperty(j,V,G),G},C=this&&this.__param||function(x,j){return function(V,Y){j(V,Y,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharSizeService=void 0;const d=l(2585),P=l(8460),H=l(844);let W=a.CharSizeService=class extends H.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,j,V){super(),this._optionsService=V,this.width=0,this.height=0,this._onCharSizeChange=this.register(new P.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new N(this._optionsService))}catch{this._measureStrategy=this.register(new L(x,j,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())}};a.CharSizeService=W=f([C(2,d.IOptionsService)],W);class U extends H.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(j,V){j!==void 0&&j>0&&V!==void 0&&V>0&&(this._result.width=j,this._result.height=V)}}class L extends U{constructor(j,V,Y){super(),this._document=j,this._parentElement=V,this._optionsService=Y,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 N extends U{constructor(j){super(),this._optionsService=j,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const V=this._ctx.measureText("W");if(!("width"in V&&"fontBoundingBoxAscent"in V&&"fontBoundingBoxDescent"in V))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const j=this._ctx.measureText("W");return this._validateAndSet(j.width,j.fontBoundingBoxAscent+j.fontBoundingBoxDescent),this._result}}},4269:function(h,a,l){var f=this&&this.__decorate||function(N,x,j,V){var Y,J=arguments.length,X=J<3?x:V===null?V=Object.getOwnPropertyDescriptor(x,j):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")X=Reflect.decorate(N,x,j,V);else for(var G=N.length-1;G>=0;G--)(Y=N[G])&&(X=(J<3?Y(X):J>3?Y(x,j,X):Y(x,j))||X);return J>3&&X&&Object.defineProperty(x,j,X),X},C=this&&this.__param||function(N,x){return function(j,V){x(j,V,N)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharacterJoinerService=a.JoinedCellData=void 0;const d=l(3734),P=l(643),H=l(511),W=l(2585);class U extends d.AttributeData{constructor(x,j,V){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=j,this._width=V}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()]}}a.JoinedCellData=U;let L=a.CharacterJoinerService=class Hc{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new H.CellData}register(x){const j={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(j),j.id}deregister(x){for(let j=0;j<this._characterJoiners.length;j++)if(this._characterJoiners[j].id===x)return this._characterJoiners.splice(j,1),!0;return!1}getJoinedCharacters(x){if(this._characterJoiners.length===0)return[];const j=this._bufferService.buffer.lines.get(x);if(!j||j.length===0)return[];const V=[],Y=j.translateToString(!0);let J=0,X=0,G=0,ee=j.getFg(0),ne=j.getBg(0);for(let ae=0;ae<j.getTrimmedLength();ae++)if(j.loadCell(ae,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==ee||this._workCell.bg!==ne){if(ae-J>1){const ce=this._getJoinedRanges(Y,G,X,j,J);for(let oe=0;oe<ce.length;oe++)V.push(ce[oe])}J=ae,G=X,ee=this._workCell.fg,ne=this._workCell.bg}X+=this._workCell.getChars().length||P.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-J>1){const ae=this._getJoinedRanges(Y,G,X,j,J);for(let ce=0;ce<ae.length;ce++)V.push(ae[ce])}return V}_getJoinedRanges(x,j,V,Y,J){const X=x.substring(j,V);let G=[];try{G=this._characterJoiners[0].handler(X)}catch(ee){console.error(ee)}for(let ee=1;ee<this._characterJoiners.length;ee++)try{const ne=this._characterJoiners[ee].handler(X);for(let ae=0;ae<ne.length;ae++)Hc._mergeRanges(G,ne[ae])}catch(ne){console.error(ne)}return this._stringRangesToCellRanges(G,Y,J),G}_stringRangesToCellRanges(x,j,V){let Y=0,J=!1,X=0,G=x[Y];if(G){for(let ee=V;ee<this._bufferService.cols;ee++){const ne=j.getWidth(ee),ae=j.getString(ee).length||P.WHITESPACE_CELL_CHAR.length;if(ne!==0){if(!J&&G[0]<=X&&(G[0]=ee,J=!0),G[1]<=X){if(G[1]=ee,G=x[++Y],!G)break;G[0]<=X?(G[0]=ee,J=!0):J=!1}X+=ae}}G&&(G[1]=this._bufferService.cols)}}static _mergeRanges(x,j){let V=!1;for(let Y=0;Y<x.length;Y++){const J=x[Y];if(V){if(j[1]<=J[0])return x[Y-1][1]=j[1],x;if(j[1]<=J[1])return x[Y-1][1]=Math.max(j[1],J[1]),x.splice(Y,1),x;x.splice(Y,1),Y--}else{if(j[1]<=J[0])return x.splice(Y,0,j),x;if(j[1]<=J[1])return J[0]=Math.min(j[0],J[0]),x;j[0]<J[1]&&(J[0]=Math.min(j[0],J[0]),V=!0)}}return V?x[x.length-1][1]=j[1]:x.push(j),x}};a.CharacterJoinerService=L=f([C(0,W.IBufferService)],L)},5114:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreBrowserService=void 0;const f=l(844),C=l(8460),d=l(3656);class P extends f.Disposable{constructor(U,L,N){super(),this._textarea=U,this._window=L,this.mainDocument=N,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new H(this._window),this._onDprChange=this.register(new C.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new C.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,C.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(U){this._window!==U&&(this._window=U,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}}a.CoreBrowserService=P;class H extends f.Disposable{constructor(U){super(),this._parentWindow=U,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new C.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(U){this._parentWindow=U,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,d.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var U;this._outerListener&&((U=this._resolutionMediaMatchList)==null||U.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:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.LinkProviderService=void 0;const f=l(844);class C extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(P){return this.linkProviders.push(P),{dispose:()=>{const H=this.linkProviders.indexOf(P);H!==-1&&this.linkProviders.splice(H,1)}}}}a.LinkProviderService=C},8934:function(h,a,l){var f=this&&this.__decorate||function(W,U,L,N){var x,j=arguments.length,V=j<3?U:N===null?N=Object.getOwnPropertyDescriptor(U,L):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(W,U,L,N);else for(var Y=W.length-1;Y>=0;Y--)(x=W[Y])&&(V=(j<3?x(V):j>3?x(U,L,V):x(U,L))||V);return j>3&&V&&Object.defineProperty(U,L,V),V},C=this&&this.__param||function(W,U){return function(L,N){U(L,N,W)}};Object.defineProperty(a,"__esModule",{value:!0}),a.MouseService=void 0;const d=l(4725),P=l(9806);let H=a.MouseService=class{constructor(W,U){this._renderService=W,this._charSizeService=U}getCoords(W,U,L,N,x){return(0,P.getCoords)(window,W,U,L,N,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(W,U){const L=(0,P.getCoordsRelativeToElement)(window,W,U);if(this._charSizeService.hasValidSize)return L[0]=Math.min(Math.max(L[0],0),this._renderService.dimensions.css.canvas.width-1),L[1]=Math.min(Math.max(L[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(L[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(L[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(L[0]),y:Math.floor(L[1])}}};a.MouseService=H=f([C(0,d.IRenderService),C(1,d.ICharSizeService)],H)},3230:function(h,a,l){var f=this&&this.__decorate||function(x,j,V,Y){var J,X=arguments.length,G=X<3?j:Y===null?Y=Object.getOwnPropertyDescriptor(j,V):Y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(x,j,V,Y);else for(var ee=x.length-1;ee>=0;ee--)(J=x[ee])&&(G=(X<3?J(G):X>3?J(j,V,G):J(j,V))||G);return X>3&&G&&Object.defineProperty(j,V,G),G},C=this&&this.__param||function(x,j){return function(V,Y){j(V,Y,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.RenderService=void 0;const d=l(6193),P=l(4725),H=l(8460),W=l(844),U=l(7226),L=l(2585);let N=a.RenderService=class extends W.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,j,V,Y,J,X,G,ee){super(),this._rowCount=x,this._charSizeService=Y,this._renderer=this.register(new W.MutableDisposable),this._pausedResizeTask=new U.DebouncedIdleTask,this._observerDisposable=this.register(new W.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 H.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new H.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new H.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new H.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((ne,ae)=>this._renderRows(ne,ae)),G),this.register(this._renderDebouncer),this.register(G.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(X.onResize((()=>this._fullRefresh()))),this.register(X.buffers.onBufferActivate((()=>{var ne;return(ne=this._renderer.value)==null?void 0:ne.clear()}))),this.register(V.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(J.onDecorationRegistered((()=>this._fullRefresh()))),this.register(J.onDecorationRemoved((()=>this._fullRefresh()))),this.register(V.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(X.cols,X.rows),this._fullRefresh()}))),this.register(V.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(X.buffer.y,X.buffer.y,!0)))),this.register(ee.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(G.window,j),this.register(G.onWindowChange((ne=>this._registerIntersectionObserver(ne,j))))}_registerIntersectionObserver(x,j){if("IntersectionObserver"in x){const V=new x.IntersectionObserver((Y=>this._handleIntersectionChange(Y[Y.length-1])),{threshold:0});V.observe(j),this._observerDisposable.value=(0,W.toDisposable)((()=>V.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,V=!1){this._isPaused?this._needsFullRefresh=!0:(V||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,j,this._rowCount))}_renderRows(x,j){this._renderer.value&&(x=Math.min(x,this._rowCount-1),j=Math.min(j,this._rowCount-1),this._renderer.value.renderRows(x,j),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:j}),this._onRender.fire({start:x,end:j}),this._isNextRenderRedrawOnly=!0)}resize(x,j){this._rowCount=j,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((j=>this.refreshRows(j.start,j.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,j;this._renderer.value&&((j=(x=this._renderer.value).clearTextureAtlas)==null||j.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,j){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var V;return(V=this._renderer.value)==null?void 0:V.handleResize(x,j)})):this._renderer.value.handleResize(x,j),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,V){var Y;this._selectionState.start=x,this._selectionState.end=j,this._selectionState.columnSelectMode=V,(Y=this._renderer.value)==null||Y.handleSelectionChanged(x,j,V)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};a.RenderService=N=f([C(2,L.IOptionsService),C(3,P.ICharSizeService),C(4,L.IDecorationService),C(5,L.IBufferService),C(6,P.ICoreBrowserService),C(7,P.IThemeService)],N)},9312:function(h,a,l){var f=this&&this.__decorate||function(G,ee,ne,ae){var ce,oe=arguments.length,we=oe<3?ee:ae===null?ae=Object.getOwnPropertyDescriptor(ee,ne):ae;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")we=Reflect.decorate(G,ee,ne,ae);else for(var be=G.length-1;be>=0;be--)(ce=G[be])&&(we=(oe<3?ce(we):oe>3?ce(ee,ne,we):ce(ee,ne))||we);return oe>3&&we&&Object.defineProperty(ee,ne,we),we},C=this&&this.__param||function(G,ee){return function(ne,ae){ee(ne,ae,G)}};Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionService=void 0;const d=l(9806),P=l(9504),H=l(456),W=l(4725),U=l(8460),L=l(844),N=l(6114),x=l(4841),j=l(511),V=l(2585),Y=" ",J=new RegExp(Y,"g");let X=a.SelectionService=class extends L.Disposable{constructor(G,ee,ne,ae,ce,oe,we,be,ve){super(),this._element=G,this._screenElement=ee,this._linkifier=ne,this._bufferService=ae,this._coreService=ce,this._mouseService=oe,this._optionsService=we,this._renderService=be,this._coreBrowserService=ve,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new j.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new U.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new U.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new U.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new U.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=me=>this._handleMouseMove(me),this._mouseUpListener=me=>this._handleMouseUp(me),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((me=>this._handleTrim(me))),this.register(this._bufferService.buffers.onBufferActivate((me=>this._handleBufferActivate(me)))),this.enable(),this._model=new H.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,L.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 G=this._model.finalSelectionStart,ee=this._model.finalSelectionEnd;return!(!G||!ee||G[0]===ee[0]&&G[1]===ee[1])}get selectionText(){const G=this._model.finalSelectionStart,ee=this._model.finalSelectionEnd;if(!G||!ee)return"";const ne=this._bufferService.buffer,ae=[];if(this._activeSelectionMode===3){if(G[0]===ee[0])return"";const ce=G[0]<ee[0]?G[0]:ee[0],oe=G[0]<ee[0]?ee[0]:G[0];for(let we=G[1];we<=ee[1];we++){const be=ne.translateBufferLineToString(we,!0,ce,oe);ae.push(be)}}else{const ce=G[1]===ee[1]?ee[0]:void 0;ae.push(ne.translateBufferLineToString(G[1],!0,G[0],ce));for(let oe=G[1]+1;oe<=ee[1]-1;oe++){const we=ne.lines.get(oe),be=ne.translateBufferLineToString(oe,!0);we!=null&&we.isWrapped?ae[ae.length-1]+=be:ae.push(be)}if(G[1]!==ee[1]){const oe=ne.lines.get(ee[1]),we=ne.translateBufferLineToString(ee[1],!0,0,ee[0]);oe&&oe.isWrapped?ae[ae.length-1]+=we:ae.push(we)}}return ae.map((ce=>ce.replace(J," "))).join(N.isWindows?`\r
78
- `:`
79
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(G){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),N.isLinux&&G&&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(G){const ee=this._getMouseBufferCoords(G),ne=this._model.finalSelectionStart,ae=this._model.finalSelectionEnd;return!!(ne&&ae&&ee)&&this._areCoordsInSelection(ee,ne,ae)}isCellInSelection(G,ee){const ne=this._model.finalSelectionStart,ae=this._model.finalSelectionEnd;return!(!ne||!ae)&&this._areCoordsInSelection([G,ee],ne,ae)}_areCoordsInSelection(G,ee,ne){return G[1]>ee[1]&&G[1]<ne[1]||ee[1]===ne[1]&&G[1]===ee[1]&&G[0]>=ee[0]&&G[0]<ne[0]||ee[1]<ne[1]&&G[1]===ne[1]&&G[0]<ne[0]||ee[1]<ne[1]&&G[1]===ee[1]&&G[0]>=ee[0]}_selectWordAtCursor(G,ee){var ce,oe;const ne=(oe=(ce=this._linkifier.currentLink)==null?void 0:ce.link)==null?void 0:oe.range;if(ne)return this._model.selectionStart=[ne.start.x-1,ne.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(ne,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const ae=this._getMouseBufferCoords(G);return!!ae&&(this._selectWordAt(ae,ee),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(G,ee){this._model.clearSelection(),G=Math.max(G,0),ee=Math.min(ee,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,G],this._model.selectionEnd=[this._bufferService.cols,ee],this.refresh(),this._onSelectionChange.fire()}_handleTrim(G){this._model.handleTrim(G)&&this.refresh()}_getMouseBufferCoords(G){const ee=this._mouseService.getCoords(G,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(ee)return ee[0]--,ee[1]--,ee[1]+=this._bufferService.buffer.ydisp,ee}_getMouseEventScrollAmount(G){let ee=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,G,this._screenElement)[1];const ne=this._renderService.dimensions.css.canvas.height;return ee>=0&&ee<=ne?0:(ee>ne&&(ee-=ne),ee=Math.min(Math.max(ee,-50),50),ee/=50,ee/Math.abs(ee)+Math.round(14*ee))}shouldForceSelection(G){return N.isMac?G.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:G.shiftKey}handleMouseDown(G){if(this._mouseDownTimeStamp=G.timeStamp,(G.button!==2||!this.hasSelection)&&G.button===0){if(!this._enabled){if(!this.shouldForceSelection(G))return;G.stopPropagation()}G.preventDefault(),this._dragScrollAmount=0,this._enabled&&G.shiftKey?this._handleIncrementalClick(G):G.detail===1?this._handleSingleClick(G):G.detail===2?this._handleDoubleClick(G):G.detail===3&&this._handleTripleClick(G),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(G){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(G))}_handleSingleClick(G){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(G)?3:0,this._model.selectionStart=this._getMouseBufferCoords(G),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const ee=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);ee&&ee.length!==this._model.selectionStart[0]&&ee.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(G){this._selectWordAtCursor(G,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(G){const ee=this._getMouseBufferCoords(G);ee&&(this._activeSelectionMode=2,this._selectLineAt(ee[1]))}shouldColumnSelect(G){return G.altKey&&!(N.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(G){if(G.stopImmediatePropagation(),!this._model.selectionStart)return;const ee=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(G),!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(G),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const ne=this._bufferService.buffer;if(this._model.selectionEnd[1]<ne.lines.length){const ae=ne.lines.get(this._model.selectionEnd[1]);ae&&ae.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}ee&&ee[0]===this._model.selectionEnd[0]&&ee[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 G=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(G.ydisp+this._bufferService.rows,G.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=G.ydisp),this.refresh()}}_handleMouseUp(G){const ee=G.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&ee<500&&G.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const ne=this._mouseService.getCoords(G,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(ne&&ne[0]!==void 0&&ne[1]!==void 0){const ae=(0,P.moveToCellSequence)(ne[0]-1,ne[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(ae,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const G=this._model.finalSelectionStart,ee=this._model.finalSelectionEnd,ne=!(!G||!ee||G[0]===ee[0]&&G[1]===ee[1]);ne?G&&ee&&(this._oldSelectionStart&&this._oldSelectionEnd&&G[0]===this._oldSelectionStart[0]&&G[1]===this._oldSelectionStart[1]&&ee[0]===this._oldSelectionEnd[0]&&ee[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(G,ee,ne)):this._oldHasSelection&&this._fireOnSelectionChange(G,ee,ne)}_fireOnSelectionChange(G,ee,ne){this._oldSelectionStart=G,this._oldSelectionEnd=ee,this._oldHasSelection=ne,this._onSelectionChange.fire()}_handleBufferActivate(G){this.clearSelection(),this._trimListener.dispose(),this._trimListener=G.activeBuffer.lines.onTrim((ee=>this._handleTrim(ee)))}_convertViewportColToCharacterIndex(G,ee){let ne=ee;for(let ae=0;ee>=ae;ae++){const ce=G.loadCell(ae,this._workCell).getChars().length;this._workCell.getWidth()===0?ne--:ce>1&&ee!==ae&&(ne+=ce-1)}return ne}setSelection(G,ee,ne){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[G,ee],this._model.selectionStartLength=ne,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(G){this._isClickInSelection(G)||(this._selectWordAtCursor(G,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(G,ee,ne=!0,ae=!0){if(G[0]>=this._bufferService.cols)return;const ce=this._bufferService.buffer,oe=ce.lines.get(G[1]);if(!oe)return;const we=ce.translateBufferLineToString(G[1],!1);let be=this._convertViewportColToCharacterIndex(oe,G[0]),ve=be;const me=G[0]-be;let de=0,Q=0,re=0,Z=0;if(we.charAt(be)===" "){for(;be>0&&we.charAt(be-1)===" ";)be--;for(;ve<we.length&&we.charAt(ve+1)===" ";)ve++}else{let fe=G[0],xe=G[0];oe.getWidth(fe)===0&&(de++,fe--),oe.getWidth(xe)===2&&(Q++,xe++);const ke=oe.getString(xe).length;for(ke>1&&(Z+=ke-1,ve+=ke-1);fe>0&&be>0&&!this._isCharWordSeparator(oe.loadCell(fe-1,this._workCell));){oe.loadCell(fe-1,this._workCell);const ue=this._workCell.getChars().length;this._workCell.getWidth()===0?(de++,fe--):ue>1&&(re+=ue-1,be-=ue-1),be--,fe--}for(;xe<oe.length&&ve+1<we.length&&!this._isCharWordSeparator(oe.loadCell(xe+1,this._workCell));){oe.loadCell(xe+1,this._workCell);const ue=this._workCell.getChars().length;this._workCell.getWidth()===2?(Q++,xe++):ue>1&&(Z+=ue-1,ve+=ue-1),ve++,xe++}}ve++;let ie=be+me-de+re,ge=Math.min(this._bufferService.cols,ve-be+de+Q-re-Z);if(ee||we.slice(be,ve).trim()!==""){if(ne&&ie===0&&oe.getCodePoint(0)!==32){const fe=ce.lines.get(G[1]-1);if(fe&&oe.isWrapped&&fe.getCodePoint(this._bufferService.cols-1)!==32){const xe=this._getWordAt([this._bufferService.cols-1,G[1]-1],!1,!0,!1);if(xe){const ke=this._bufferService.cols-xe.start;ie-=ke,ge+=ke}}}if(ae&&ie+ge===this._bufferService.cols&&oe.getCodePoint(this._bufferService.cols-1)!==32){const fe=ce.lines.get(G[1]+1);if(fe!=null&&fe.isWrapped&&fe.getCodePoint(0)!==32){const xe=this._getWordAt([0,G[1]+1],!1,!1,!0);xe&&(ge+=xe.length)}}return{start:ie,length:ge}}}_selectWordAt(G,ee){const ne=this._getWordAt(G,ee);if(ne){for(;ne.start<0;)ne.start+=this._bufferService.cols,G[1]--;this._model.selectionStart=[ne.start,G[1]],this._model.selectionStartLength=ne.length}}_selectToWordAt(G){const ee=this._getWordAt(G,!0);if(ee){let ne=G[1];for(;ee.start<0;)ee.start+=this._bufferService.cols,ne--;if(!this._model.areSelectionValuesReversed())for(;ee.start+ee.length>this._bufferService.cols;)ee.length-=this._bufferService.cols,ne++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?ee.start:ee.start+ee.length,ne]}}_isCharWordSeparator(G){return G.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(G.getChars())>=0}_selectLineAt(G){const ee=this._bufferService.buffer.getWrappedRangeForLine(G),ne={start:{x:0,y:ee.first},end:{x:this._bufferService.cols-1,y:ee.last}};this._model.selectionStart=[0,ee.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(ne,this._bufferService.cols)}};a.SelectionService=X=f([C(3,V.IBufferService),C(4,V.ICoreService),C(5,W.IMouseService),C(6,V.IOptionsService),C(7,W.IRenderService),C(8,W.ICoreBrowserService)],X)},4725:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ILinkProviderService=a.IThemeService=a.ICharacterJoinerService=a.ISelectionService=a.IRenderService=a.IMouseService=a.ICoreBrowserService=a.ICharSizeService=void 0;const f=l(8343);a.ICharSizeService=(0,f.createDecorator)("CharSizeService"),a.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),a.IMouseService=(0,f.createDecorator)("MouseService"),a.IRenderService=(0,f.createDecorator)("RenderService"),a.ISelectionService=(0,f.createDecorator)("SelectionService"),a.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),a.IThemeService=(0,f.createDecorator)("ThemeService"),a.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(h,a,l){var f=this&&this.__decorate||function(X,G,ee,ne){var ae,ce=arguments.length,oe=ce<3?G:ne===null?ne=Object.getOwnPropertyDescriptor(G,ee):ne;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")oe=Reflect.decorate(X,G,ee,ne);else for(var we=X.length-1;we>=0;we--)(ae=X[we])&&(oe=(ce<3?ae(oe):ce>3?ae(G,ee,oe):ae(G,ee))||oe);return ce>3&&oe&&Object.defineProperty(G,ee,oe),oe},C=this&&this.__param||function(X,G){return function(ee,ne){G(ee,ne,X)}};Object.defineProperty(a,"__esModule",{value:!0}),a.ThemeService=a.DEFAULT_ANSI_COLORS=void 0;const d=l(7239),P=l(8055),H=l(8460),W=l(844),U=l(2585),L=P.css.toColor("#ffffff"),N=P.css.toColor("#000000"),x=P.css.toColor("#ffffff"),j=P.css.toColor("#000000"),V={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};a.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const X=[P.css.toColor("#2e3436"),P.css.toColor("#cc0000"),P.css.toColor("#4e9a06"),P.css.toColor("#c4a000"),P.css.toColor("#3465a4"),P.css.toColor("#75507b"),P.css.toColor("#06989a"),P.css.toColor("#d3d7cf"),P.css.toColor("#555753"),P.css.toColor("#ef2929"),P.css.toColor("#8ae234"),P.css.toColor("#fce94f"),P.css.toColor("#729fcf"),P.css.toColor("#ad7fa8"),P.css.toColor("#34e2e2"),P.css.toColor("#eeeeec")],G=[0,95,135,175,215,255];for(let ee=0;ee<216;ee++){const ne=G[ee/36%6|0],ae=G[ee/6%6|0],ce=G[ee%6];X.push({css:P.channels.toCss(ne,ae,ce),rgba:P.channels.toRgba(ne,ae,ce)})}for(let ee=0;ee<24;ee++){const ne=8+10*ee;X.push({css:P.channels.toCss(ne,ne,ne),rgba:P.channels.toRgba(ne,ne,ne)})}return X})());let Y=a.ThemeService=class extends W.Disposable{get colors(){return this._colors}constructor(X){super(),this._optionsService=X,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new H.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:L,background:N,cursor:x,cursorAccent:j,selectionForeground:void 0,selectionBackgroundTransparent:V,selectionBackgroundOpaque:P.color.blend(N,V),selectionInactiveBackgroundTransparent:V,selectionInactiveBackgroundOpaque:P.color.blend(N,V),ansi:a.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(X={}){const G=this._colors;if(G.foreground=J(X.foreground,L),G.background=J(X.background,N),G.cursor=J(X.cursor,x),G.cursorAccent=J(X.cursorAccent,j),G.selectionBackgroundTransparent=J(X.selectionBackground,V),G.selectionBackgroundOpaque=P.color.blend(G.background,G.selectionBackgroundTransparent),G.selectionInactiveBackgroundTransparent=J(X.selectionInactiveBackground,G.selectionBackgroundTransparent),G.selectionInactiveBackgroundOpaque=P.color.blend(G.background,G.selectionInactiveBackgroundTransparent),G.selectionForeground=X.selectionForeground?J(X.selectionForeground,P.NULL_COLOR):void 0,G.selectionForeground===P.NULL_COLOR&&(G.selectionForeground=void 0),P.color.isOpaque(G.selectionBackgroundTransparent)&&(G.selectionBackgroundTransparent=P.color.opacity(G.selectionBackgroundTransparent,.3)),P.color.isOpaque(G.selectionInactiveBackgroundTransparent)&&(G.selectionInactiveBackgroundTransparent=P.color.opacity(G.selectionInactiveBackgroundTransparent,.3)),G.ansi=a.DEFAULT_ANSI_COLORS.slice(),G.ansi[0]=J(X.black,a.DEFAULT_ANSI_COLORS[0]),G.ansi[1]=J(X.red,a.DEFAULT_ANSI_COLORS[1]),G.ansi[2]=J(X.green,a.DEFAULT_ANSI_COLORS[2]),G.ansi[3]=J(X.yellow,a.DEFAULT_ANSI_COLORS[3]),G.ansi[4]=J(X.blue,a.DEFAULT_ANSI_COLORS[4]),G.ansi[5]=J(X.magenta,a.DEFAULT_ANSI_COLORS[5]),G.ansi[6]=J(X.cyan,a.DEFAULT_ANSI_COLORS[6]),G.ansi[7]=J(X.white,a.DEFAULT_ANSI_COLORS[7]),G.ansi[8]=J(X.brightBlack,a.DEFAULT_ANSI_COLORS[8]),G.ansi[9]=J(X.brightRed,a.DEFAULT_ANSI_COLORS[9]),G.ansi[10]=J(X.brightGreen,a.DEFAULT_ANSI_COLORS[10]),G.ansi[11]=J(X.brightYellow,a.DEFAULT_ANSI_COLORS[11]),G.ansi[12]=J(X.brightBlue,a.DEFAULT_ANSI_COLORS[12]),G.ansi[13]=J(X.brightMagenta,a.DEFAULT_ANSI_COLORS[13]),G.ansi[14]=J(X.brightCyan,a.DEFAULT_ANSI_COLORS[14]),G.ansi[15]=J(X.brightWhite,a.DEFAULT_ANSI_COLORS[15]),X.extendedAnsi){const ee=Math.min(G.ansi.length-16,X.extendedAnsi.length);for(let ne=0;ne<ee;ne++)G.ansi[ne+16]=J(X.extendedAnsi[ne],a.DEFAULT_ANSI_COLORS[ne+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(X){this._restoreColor(X),this._onChangeColors.fire(this.colors)}_restoreColor(X){if(X!==void 0)switch(X){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[X]=this._restoreColors.ansi[X]}else for(let G=0;G<this._restoreColors.ansi.length;++G)this._colors.ansi[G]=this._restoreColors.ansi[G]}modifyColors(X){X(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 J(X,G){if(X!==void 0)try{return P.css.toColor(X)}catch{}return G}a.ThemeService=Y=f([C(0,U.IOptionsService)],Y)},6349:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CircularList=void 0;const f=l(8460),C=l(844);class d extends C.Disposable{constructor(H){super(),this._maxLength=H,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(H){if(this._maxLength===H)return;const W=new Array(H);for(let U=0;U<Math.min(H,this.length);U++)W[U]=this._array[this._getCyclicIndex(U)];this._array=W,this._maxLength=H,this._startIndex=0}get length(){return this._length}set length(H){if(H>this._length)for(let W=this._length;W<H;W++)this._array[W]=void 0;this._length=H}get(H){return this._array[this._getCyclicIndex(H)]}set(H,W){this._array[this._getCyclicIndex(H)]=W}push(H){this._array[this._getCyclicIndex(this._length)]=H,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(H,W,...U){if(W){for(let L=H;L<this._length-W;L++)this._array[this._getCyclicIndex(L)]=this._array[this._getCyclicIndex(L+W)];this._length-=W,this.onDeleteEmitter.fire({index:H,amount:W})}for(let L=this._length-1;L>=H;L--)this._array[this._getCyclicIndex(L+U.length)]=this._array[this._getCyclicIndex(L)];for(let L=0;L<U.length;L++)this._array[this._getCyclicIndex(H+L)]=U[L];if(U.length&&this.onInsertEmitter.fire({index:H,amount:U.length}),this._length+U.length>this._maxLength){const L=this._length+U.length-this._maxLength;this._startIndex+=L,this._length=this._maxLength,this.onTrimEmitter.fire(L)}else this._length+=U.length}trimStart(H){H>this._length&&(H=this._length),this._startIndex+=H,this._length-=H,this.onTrimEmitter.fire(H)}shiftElements(H,W,U){if(!(W<=0)){if(H<0||H>=this._length)throw new Error("start argument out of range");if(H+U<0)throw new Error("Cannot shift elements in list beyond index 0");if(U>0){for(let N=W-1;N>=0;N--)this.set(H+N+U,this.get(H+N));const L=H+W+U-this._length;if(L>0)for(this._length+=L;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let L=0;L<W;L++)this.set(H+L+U,this.get(H+L))}}_getCyclicIndex(H){return(this._startIndex+H)%this._maxLength}}a.CircularList=d},1439:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.clone=void 0,a.clone=function l(f,C=5){if(typeof f!="object")return f;const d=Array.isArray(f)?[]:{};for(const P in f)d[P]=C<=1?f[P]:f[P]&&l(f[P],C-1);return d}},8055:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.contrastRatio=a.toPaddedHex=a.rgba=a.rgb=a.css=a.color=a.channels=a.NULL_COLOR=void 0;let l=0,f=0,C=0,d=0;var P,H,W,U,L;function N(j){const V=j.toString(16);return V.length<2?"0"+V:V}function x(j,V){return j<V?(V+.05)/(j+.05):(j+.05)/(V+.05)}a.NULL_COLOR={css:"#00000000",rgba:0},(function(j){j.toCss=function(V,Y,J,X){return X!==void 0?`#${N(V)}${N(Y)}${N(J)}${N(X)}`:`#${N(V)}${N(Y)}${N(J)}`},j.toRgba=function(V,Y,J,X=255){return(V<<24|Y<<16|J<<8|X)>>>0},j.toColor=function(V,Y,J,X){return{css:j.toCss(V,Y,J,X),rgba:j.toRgba(V,Y,J,X)}}})(P||(a.channels=P={})),(function(j){function V(Y,J){return d=Math.round(255*J),[l,f,C]=L.toChannels(Y.rgba),{css:P.toCss(l,f,C,d),rgba:P.toRgba(l,f,C,d)}}j.blend=function(Y,J){if(d=(255&J.rgba)/255,d===1)return{css:J.css,rgba:J.rgba};const X=J.rgba>>24&255,G=J.rgba>>16&255,ee=J.rgba>>8&255,ne=Y.rgba>>24&255,ae=Y.rgba>>16&255,ce=Y.rgba>>8&255;return l=ne+Math.round((X-ne)*d),f=ae+Math.round((G-ae)*d),C=ce+Math.round((ee-ce)*d),{css:P.toCss(l,f,C),rgba:P.toRgba(l,f,C)}},j.isOpaque=function(Y){return(255&Y.rgba)==255},j.ensureContrastRatio=function(Y,J,X){const G=L.ensureContrastRatio(Y.rgba,J.rgba,X);if(G)return P.toColor(G>>24&255,G>>16&255,G>>8&255)},j.opaque=function(Y){const J=(255|Y.rgba)>>>0;return[l,f,C]=L.toChannels(J),{css:P.toCss(l,f,C),rgba:J}},j.opacity=V,j.multiplyOpacity=function(Y,J){return d=255&Y.rgba,V(Y,d*J/255)},j.toColorRGB=function(Y){return[Y.rgba>>24&255,Y.rgba>>16&255,Y.rgba>>8&255]}})(H||(a.color=H={})),(function(j){let V,Y;try{const J=document.createElement("canvas");J.width=1,J.height=1;const X=J.getContext("2d",{willReadFrequently:!0});X&&(V=X,V.globalCompositeOperation="copy",Y=V.createLinearGradient(0,0,1,1))}catch{}j.toColor=function(J){if(J.match(/#[\da-f]{3,8}/i))switch(J.length){case 4:return l=parseInt(J.slice(1,2).repeat(2),16),f=parseInt(J.slice(2,3).repeat(2),16),C=parseInt(J.slice(3,4).repeat(2),16),P.toColor(l,f,C);case 5:return l=parseInt(J.slice(1,2).repeat(2),16),f=parseInt(J.slice(2,3).repeat(2),16),C=parseInt(J.slice(3,4).repeat(2),16),d=parseInt(J.slice(4,5).repeat(2),16),P.toColor(l,f,C,d);case 7:return{css:J,rgba:(parseInt(J.slice(1),16)<<8|255)>>>0};case 9:return{css:J,rgba:parseInt(J.slice(1),16)>>>0}}const X=J.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(X)return l=parseInt(X[1]),f=parseInt(X[2]),C=parseInt(X[3]),d=Math.round(255*(X[5]===void 0?1:parseFloat(X[5]))),P.toColor(l,f,C,d);if(!V||!Y)throw new Error("css.toColor: Unsupported css format");if(V.fillStyle=Y,V.fillStyle=J,typeof V.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(V.fillRect(0,0,1,1),[l,f,C,d]=V.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:P.toRgba(l,f,C,d),css:J}}})(W||(a.css=W={})),(function(j){function V(Y,J,X){const G=Y/255,ee=J/255,ne=X/255;return .2126*(G<=.03928?G/12.92:Math.pow((G+.055)/1.055,2.4))+.7152*(ee<=.03928?ee/12.92:Math.pow((ee+.055)/1.055,2.4))+.0722*(ne<=.03928?ne/12.92:Math.pow((ne+.055)/1.055,2.4))}j.relativeLuminance=function(Y){return V(Y>>16&255,Y>>8&255,255&Y)},j.relativeLuminance2=V})(U||(a.rgb=U={})),(function(j){function V(J,X,G){const ee=J>>24&255,ne=J>>16&255,ae=J>>8&255;let ce=X>>24&255,oe=X>>16&255,we=X>>8&255,be=x(U.relativeLuminance2(ce,oe,we),U.relativeLuminance2(ee,ne,ae));for(;be<G&&(ce>0||oe>0||we>0);)ce-=Math.max(0,Math.ceil(.1*ce)),oe-=Math.max(0,Math.ceil(.1*oe)),we-=Math.max(0,Math.ceil(.1*we)),be=x(U.relativeLuminance2(ce,oe,we),U.relativeLuminance2(ee,ne,ae));return(ce<<24|oe<<16|we<<8|255)>>>0}function Y(J,X,G){const ee=J>>24&255,ne=J>>16&255,ae=J>>8&255;let ce=X>>24&255,oe=X>>16&255,we=X>>8&255,be=x(U.relativeLuminance2(ce,oe,we),U.relativeLuminance2(ee,ne,ae));for(;be<G&&(ce<255||oe<255||we<255);)ce=Math.min(255,ce+Math.ceil(.1*(255-ce))),oe=Math.min(255,oe+Math.ceil(.1*(255-oe))),we=Math.min(255,we+Math.ceil(.1*(255-we))),be=x(U.relativeLuminance2(ce,oe,we),U.relativeLuminance2(ee,ne,ae));return(ce<<24|oe<<16|we<<8|255)>>>0}j.blend=function(J,X){if(d=(255&X)/255,d===1)return X;const G=X>>24&255,ee=X>>16&255,ne=X>>8&255,ae=J>>24&255,ce=J>>16&255,oe=J>>8&255;return l=ae+Math.round((G-ae)*d),f=ce+Math.round((ee-ce)*d),C=oe+Math.round((ne-oe)*d),P.toRgba(l,f,C)},j.ensureContrastRatio=function(J,X,G){const ee=U.relativeLuminance(J>>8),ne=U.relativeLuminance(X>>8);if(x(ee,ne)<G){if(ne<ee){const oe=V(J,X,G),we=x(ee,U.relativeLuminance(oe>>8));if(we<G){const be=Y(J,X,G);return we>x(ee,U.relativeLuminance(be>>8))?oe:be}return oe}const ae=Y(J,X,G),ce=x(ee,U.relativeLuminance(ae>>8));if(ce<G){const oe=V(J,X,G);return ce>x(ee,U.relativeLuminance(oe>>8))?ae:oe}return ae}},j.reduceLuminance=V,j.increaseLuminance=Y,j.toChannels=function(J){return[J>>24&255,J>>16&255,J>>8&255,255&J]}})(L||(a.rgba=L={})),a.toPaddedHex=N,a.contrastRatio=x},8969:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreTerminal=void 0;const f=l(844),C=l(2585),d=l(4348),P=l(7866),H=l(744),W=l(7302),U=l(6975),L=l(8460),N=l(1753),x=l(1480),j=l(7994),V=l(9282),Y=l(5435),J=l(5981),X=l(2660);let G=!1;class ee extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new L.EventEmitter),this._onScroll.event((ae=>{var ce;(ce=this._onScrollApi)==null||ce.fire(ae.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(ae){for(const ce in ae)this.optionsService.options[ce]=ae[ce]}constructor(ae){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new L.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new L.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new L.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new L.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new L.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new L.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new W.OptionsService(ae)),this._instantiationService.setService(C.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(H.BufferService)),this._instantiationService.setService(C.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(P.LogService)),this._instantiationService.setService(C.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(U.CoreService)),this._instantiationService.setService(C.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(N.CoreMouseService)),this._instantiationService.setService(C.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(C.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(j.CharsetService),this._instantiationService.setService(C.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(X.OscLinkService),this._instantiationService.setService(C.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new Y.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,L.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,L.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,L.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,L.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((ce=>{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((ce=>{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 J.WriteBuffer(((ce,oe)=>this._inputHandler.parse(ce,oe)))),this.register((0,L.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(ae,ce){this._writeBuffer.write(ae,ce)}writeSync(ae,ce){this._logService.logLevel<=C.LogLevelEnum.WARN&&!G&&(this._logService.warn("writeSync is unreliable and will be removed soon."),G=!0),this._writeBuffer.writeSync(ae,ce)}input(ae,ce=!0){this.coreService.triggerDataEvent(ae,ce)}resize(ae,ce){isNaN(ae)||isNaN(ce)||(ae=Math.max(ae,H.MINIMUM_COLS),ce=Math.max(ce,H.MINIMUM_ROWS),this._bufferService.resize(ae,ce))}scroll(ae,ce=!1){this._bufferService.scroll(ae,ce)}scrollLines(ae,ce,oe){this._bufferService.scrollLines(ae,ce,oe)}scrollPages(ae){this.scrollLines(ae*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(ae){const ce=ae-this._bufferService.buffer.ydisp;ce!==0&&this.scrollLines(ce)}registerEscHandler(ae,ce){return this._inputHandler.registerEscHandler(ae,ce)}registerDcsHandler(ae,ce){return this._inputHandler.registerDcsHandler(ae,ce)}registerCsiHandler(ae,ce){return this._inputHandler.registerCsiHandler(ae,ce)}registerOscHandler(ae,ce){return this._inputHandler.registerOscHandler(ae,ce)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let ae=!1;const ce=this.optionsService.rawOptions.windowsPty;ce&&ce.buildNumber!==void 0&&ce.buildNumber!==void 0?ae=ce.backend==="conpty"&&ce.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(ae=!0),ae?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const ae=[];ae.push(this.onLineFeed(V.updateWindowsModeWrappedState.bind(null,this._bufferService))),ae.push(this.registerCsiHandler({final:"H"},(()=>((0,V.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const ce of ae)ce.dispose()}))}}}a.CoreTerminal=ee},8460:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.runAndSubscribe=a.forwardEvent=a.EventEmitter=void 0,a.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===l)return void this._listeners.splice(f,1)}}})),this._event}fire(l,f){const C=[];for(let d=0;d<this._listeners.length;d++)C.push(this._listeners[d]);for(let d=0;d<C.length;d++)C[d].call(void 0,l,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},a.forwardEvent=function(l,f){return l((C=>f.fire(C)))},a.runAndSubscribe=function(l,f){return f(void 0),l((C=>f(C)))}},5435:function(h,a,l){var f=this&&this.__decorate||function(de,Q,re,Z){var ie,ge=arguments.length,fe=ge<3?Q:Z===null?Z=Object.getOwnPropertyDescriptor(Q,re):Z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")fe=Reflect.decorate(de,Q,re,Z);else for(var xe=de.length-1;xe>=0;xe--)(ie=de[xe])&&(fe=(ge<3?ie(fe):ge>3?ie(Q,re,fe):ie(Q,re))||fe);return ge>3&&fe&&Object.defineProperty(Q,re,fe),fe},C=this&&this.__param||function(de,Q){return function(re,Z){Q(re,Z,de)}};Object.defineProperty(a,"__esModule",{value:!0}),a.InputHandler=a.WindowsOptionsReportType=void 0;const d=l(2584),P=l(7116),H=l(2015),W=l(844),U=l(482),L=l(8437),N=l(8460),x=l(643),j=l(511),V=l(3734),Y=l(2585),J=l(1480),X=l(6242),G=l(6351),ee=l(5941),ne={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ae=131072;function ce(de,Q){if(de>24)return Q.setWinLines||!1;switch(de){case 1:return!!Q.restoreWin;case 2:return!!Q.minimizeWin;case 3:return!!Q.setWinPosition;case 4:return!!Q.setWinSizePixels;case 5:return!!Q.raiseWin;case 6:return!!Q.lowerWin;case 7:return!!Q.refreshWin;case 8:return!!Q.setWinSizeChars;case 9:return!!Q.maximizeWin;case 10:return!!Q.fullscreenWin;case 11:return!!Q.getWinState;case 13:return!!Q.getWinPosition;case 14:return!!Q.getWinSizePixels;case 15:return!!Q.getScreenSizePixels;case 16:return!!Q.getCellSizePixels;case 18:return!!Q.getWinSizeChars;case 19:return!!Q.getScreenSizeChars;case 20:return!!Q.getIconTitle;case 21:return!!Q.getWinTitle;case 22:return!!Q.pushTitle;case 23:return!!Q.popTitle;case 24:return!!Q.setWinLines}return!1}var oe;(function(de){de[de.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",de[de.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(oe||(a.WindowsOptionsReportType=oe={}));let we=0;class be extends W.Disposable{getAttrData(){return this._curAttrData}constructor(Q,re,Z,ie,ge,fe,xe,ke,ue=new H.EscapeSequenceParser){super(),this._bufferService=Q,this._charsetService=re,this._coreService=Z,this._logService=ie,this._optionsService=ge,this._oscLinkService=fe,this._coreMouseService=xe,this._unicodeService=ke,this._parser=ue,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new U.StringToUtf32,this._utf8Decoder=new U.Utf8ToUtf32,this._workCell=new j.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=L.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=L.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new N.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new N.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new N.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new N.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new N.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new N.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new N.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new N.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new N.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new N.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new N.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new N.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new N.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 ve(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((se=>this._activeBuffer=se.activeBuffer))),this._parser.setCsiHandlerFallback(((se,Ee)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(se),params:Ee.toArray()})})),this._parser.setEscHandlerFallback((se=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(se)})})),this._parser.setExecuteHandlerFallback((se=>{this._logService.debug("Unknown EXECUTE code: ",{code:se})})),this._parser.setOscHandlerFallback(((se,Ee,Se)=>{this._logService.debug("Unknown OSC code: ",{identifier:se,action:Ee,data:Se})})),this._parser.setDcsHandlerFallback(((se,Ee,Se)=>{Ee==="HOOK"&&(Se=Se.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(se),action:Ee,payload:Se})})),this._parser.setPrintHandler(((se,Ee,Se)=>this.print(se,Ee,Se))),this._parser.registerCsiHandler({final:"@"},(se=>this.insertChars(se))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(se=>this.scrollLeft(se))),this._parser.registerCsiHandler({final:"A"},(se=>this.cursorUp(se))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(se=>this.scrollRight(se))),this._parser.registerCsiHandler({final:"B"},(se=>this.cursorDown(se))),this._parser.registerCsiHandler({final:"C"},(se=>this.cursorForward(se))),this._parser.registerCsiHandler({final:"D"},(se=>this.cursorBackward(se))),this._parser.registerCsiHandler({final:"E"},(se=>this.cursorNextLine(se))),this._parser.registerCsiHandler({final:"F"},(se=>this.cursorPrecedingLine(se))),this._parser.registerCsiHandler({final:"G"},(se=>this.cursorCharAbsolute(se))),this._parser.registerCsiHandler({final:"H"},(se=>this.cursorPosition(se))),this._parser.registerCsiHandler({final:"I"},(se=>this.cursorForwardTab(se))),this._parser.registerCsiHandler({final:"J"},(se=>this.eraseInDisplay(se,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(se=>this.eraseInDisplay(se,!0))),this._parser.registerCsiHandler({final:"K"},(se=>this.eraseInLine(se,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(se=>this.eraseInLine(se,!0))),this._parser.registerCsiHandler({final:"L"},(se=>this.insertLines(se))),this._parser.registerCsiHandler({final:"M"},(se=>this.deleteLines(se))),this._parser.registerCsiHandler({final:"P"},(se=>this.deleteChars(se))),this._parser.registerCsiHandler({final:"S"},(se=>this.scrollUp(se))),this._parser.registerCsiHandler({final:"T"},(se=>this.scrollDown(se))),this._parser.registerCsiHandler({final:"X"},(se=>this.eraseChars(se))),this._parser.registerCsiHandler({final:"Z"},(se=>this.cursorBackwardTab(se))),this._parser.registerCsiHandler({final:"`"},(se=>this.charPosAbsolute(se))),this._parser.registerCsiHandler({final:"a"},(se=>this.hPositionRelative(se))),this._parser.registerCsiHandler({final:"b"},(se=>this.repeatPrecedingCharacter(se))),this._parser.registerCsiHandler({final:"c"},(se=>this.sendDeviceAttributesPrimary(se))),this._parser.registerCsiHandler({prefix:">",final:"c"},(se=>this.sendDeviceAttributesSecondary(se))),this._parser.registerCsiHandler({final:"d"},(se=>this.linePosAbsolute(se))),this._parser.registerCsiHandler({final:"e"},(se=>this.vPositionRelative(se))),this._parser.registerCsiHandler({final:"f"},(se=>this.hVPosition(se))),this._parser.registerCsiHandler({final:"g"},(se=>this.tabClear(se))),this._parser.registerCsiHandler({final:"h"},(se=>this.setMode(se))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(se=>this.setModePrivate(se))),this._parser.registerCsiHandler({final:"l"},(se=>this.resetMode(se))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(se=>this.resetModePrivate(se))),this._parser.registerCsiHandler({final:"m"},(se=>this.charAttributes(se))),this._parser.registerCsiHandler({final:"n"},(se=>this.deviceStatus(se))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(se=>this.deviceStatusPrivate(se))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(se=>this.softReset(se))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(se=>this.setCursorStyle(se))),this._parser.registerCsiHandler({final:"r"},(se=>this.setScrollRegion(se))),this._parser.registerCsiHandler({final:"s"},(se=>this.saveCursor(se))),this._parser.registerCsiHandler({final:"t"},(se=>this.windowOptions(se))),this._parser.registerCsiHandler({final:"u"},(se=>this.restoreCursor(se))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(se=>this.insertColumns(se))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(se=>this.deleteColumns(se))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(se=>this.selectProtected(se))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(se=>this.requestMode(se,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(se=>this.requestMode(se,!1))),this._parser.setExecuteHandler(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new X.OscHandler((se=>(this.setTitle(se),this.setIconName(se),!0)))),this._parser.registerOscHandler(1,new X.OscHandler((se=>this.setIconName(se)))),this._parser.registerOscHandler(2,new X.OscHandler((se=>this.setTitle(se)))),this._parser.registerOscHandler(4,new X.OscHandler((se=>this.setOrReportIndexedColor(se)))),this._parser.registerOscHandler(8,new X.OscHandler((se=>this.setHyperlink(se)))),this._parser.registerOscHandler(10,new X.OscHandler((se=>this.setOrReportFgColor(se)))),this._parser.registerOscHandler(11,new X.OscHandler((se=>this.setOrReportBgColor(se)))),this._parser.registerOscHandler(12,new X.OscHandler((se=>this.setOrReportCursorColor(se)))),this._parser.registerOscHandler(104,new X.OscHandler((se=>this.restoreIndexedColor(se)))),this._parser.registerOscHandler(110,new X.OscHandler((se=>this.restoreFgColor(se)))),this._parser.registerOscHandler(111,new X.OscHandler((se=>this.restoreBgColor(se)))),this._parser.registerOscHandler(112,new X.OscHandler((se=>this.restoreCursorColor(se)))),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 se in P.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:se},(()=>this.selectCharset("("+se))),this._parser.registerEscHandler({intermediates:")",final:se},(()=>this.selectCharset(")"+se))),this._parser.registerEscHandler({intermediates:"*",final:se},(()=>this.selectCharset("*"+se))),this._parser.registerEscHandler({intermediates:"+",final:se},(()=>this.selectCharset("+"+se))),this._parser.registerEscHandler({intermediates:"-",final:se},(()=>this.selectCharset("-"+se))),this._parser.registerEscHandler({intermediates:".",final:se},(()=>this.selectCharset("."+se))),this._parser.registerEscHandler({intermediates:"/",final:se},(()=>this.selectCharset("/"+se)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((se=>(this._logService.error("Parsing error: ",se),se))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new G.DcsHandler(((se,Ee)=>this.requestStatusString(se,Ee))))}_preserveStack(Q,re,Z,ie){this._parseStack.paused=!0,this._parseStack.cursorStartX=Q,this._parseStack.cursorStartY=re,this._parseStack.decodedLength=Z,this._parseStack.position=ie}_logSlowResolvingAsync(Q){this._logService.logLevel<=Y.LogLevelEnum.WARN&&Promise.race([Q,new Promise(((re,Z)=>setTimeout((()=>Z("#SLOW_TIMEOUT")),5e3)))]).catch((re=>{if(re!=="#SLOW_TIMEOUT")throw re;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(Q,re){let Z,ie=this._activeBuffer.x,ge=this._activeBuffer.y,fe=0;const xe=this._parseStack.paused;if(xe){if(Z=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,re))return this._logSlowResolvingAsync(Z),Z;ie=this._parseStack.cursorStartX,ge=this._parseStack.cursorStartY,this._parseStack.paused=!1,Q.length>ae&&(fe=this._parseStack.position+ae)}if(this._logService.logLevel<=Y.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof Q=="string"?` "${Q}"`:` "${Array.prototype.map.call(Q,(se=>String.fromCharCode(se))).join("")}"`),typeof Q=="string"?Q.split("").map((se=>se.charCodeAt(0))):Q),this._parseBuffer.length<Q.length&&this._parseBuffer.length<ae&&(this._parseBuffer=new Uint32Array(Math.min(Q.length,ae))),xe||this._dirtyRowTracker.clearRange(),Q.length>ae)for(let se=fe;se<Q.length;se+=ae){const Ee=se+ae<Q.length?se+ae:Q.length,Se=typeof Q=="string"?this._stringDecoder.decode(Q.substring(se,Ee),this._parseBuffer):this._utf8Decoder.decode(Q.subarray(se,Ee),this._parseBuffer);if(Z=this._parser.parse(this._parseBuffer,Se))return this._preserveStack(ie,ge,Se,se),this._logSlowResolvingAsync(Z),Z}else if(!xe){const se=typeof Q=="string"?this._stringDecoder.decode(Q,this._parseBuffer):this._utf8Decoder.decode(Q,this._parseBuffer);if(Z=this._parser.parse(this._parseBuffer,se))return this._preserveStack(ie,ge,se,0),this._logSlowResolvingAsync(Z),Z}this._activeBuffer.x===ie&&this._activeBuffer.y===ge||this._onCursorMove.fire();const ke=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),ue=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);ue<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(ue,this._bufferService.rows-1),Math.min(ke,this._bufferService.rows-1))}print(Q,re,Z){let ie,ge;const fe=this._charsetService.charset,xe=this._optionsService.rawOptions.screenReaderMode,ke=this._bufferService.cols,ue=this._coreService.decPrivateModes.wraparound,se=this._coreService.modes.insertMode,Ee=this._curAttrData;let Se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&Z-re>0&&Se.getWidth(this._activeBuffer.x-1)===2&&Se.setCellFromCodepoint(this._activeBuffer.x-1,0,1,Ee);let $e=this._parser.precedingJoinState;for(let Te=re;Te<Z;++Te){if(ie=Q[Te],ie<127&&fe){const ut=fe[String.fromCharCode(ie)];ut&&(ie=ut.charCodeAt(0))}const Ue=this._unicodeService.charProperties(ie,$e);ge=J.UnicodeService.extractWidth(Ue);const Ve=J.UnicodeService.extractShouldJoin(Ue),Ge=Ve?J.UnicodeService.extractWidth($e):0;if($e=Ue,xe&&this._onA11yChar.fire((0,U.stringFromCodePoint)(ie)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+ge-Ge>ke){if(ue){const ut=Se;let je=this._activeBuffer.x-Ge;for(this._activeBuffer.x=Ge,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),Se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Ge>0&&Se instanceof L.BufferLine&&Se.copyCellsFrom(ut,je,0,Ge,!1);je<ke;)ut.setCellFromCodepoint(je++,0,1,Ee)}else if(this._activeBuffer.x=ke-1,ge===2)continue}if(Ve&&this._activeBuffer.x){const ut=Se.getWidth(this._activeBuffer.x-1)?1:2;Se.addCodepointToCell(this._activeBuffer.x-ut,ie,ge);for(let je=ge-Ge;--je>=0;)Se.setCellFromCodepoint(this._activeBuffer.x++,0,0,Ee)}else if(se&&(Se.insertCells(this._activeBuffer.x,ge-Ge,this._activeBuffer.getNullCell(Ee)),Se.getWidth(ke-1)===2&&Se.setCellFromCodepoint(ke-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,Ee)),Se.setCellFromCodepoint(this._activeBuffer.x++,ie,ge,Ee),ge>0)for(;--ge;)Se.setCellFromCodepoint(this._activeBuffer.x++,0,0,Ee)}this._parser.precedingJoinState=$e,this._activeBuffer.x<ke&&Z-re>0&&Se.getWidth(this._activeBuffer.x)===0&&!Se.hasContent(this._activeBuffer.x)&&Se.setCellFromCodepoint(this._activeBuffer.x,0,1,Ee),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(Q,re){return Q.final!=="t"||Q.prefix||Q.intermediates?this._parser.registerCsiHandler(Q,re):this._parser.registerCsiHandler(Q,(Z=>!ce(Z.params[0],this._optionsService.rawOptions.windowOptions)||re(Z)))}registerDcsHandler(Q,re){return this._parser.registerDcsHandler(Q,new G.DcsHandler(re))}registerEscHandler(Q,re){return this._parser.registerEscHandler(Q,re)}registerOscHandler(Q,re){return this._parser.registerOscHandler(Q,new X.OscHandler(re))}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 Q;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&&((Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&Q.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);re.hasWidth(this._activeBuffer.x)&&!re.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const Q=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-Q),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(Q=this._bufferService.cols-1){this._activeBuffer.x=Math.min(Q,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(Q,re){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=Q,this._activeBuffer.y=this._activeBuffer.scrollTop+re):(this._activeBuffer.x=Q,this._activeBuffer.y=re),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(Q,re){this._restrictCursor(),this._setCursor(this._activeBuffer.x+Q,this._activeBuffer.y+re)}cursorUp(Q){const re=this._activeBuffer.y-this._activeBuffer.scrollTop;return re>=0?this._moveCursor(0,-Math.min(re,Q.params[0]||1)):this._moveCursor(0,-(Q.params[0]||1)),!0}cursorDown(Q){const re=this._activeBuffer.scrollBottom-this._activeBuffer.y;return re>=0?this._moveCursor(0,Math.min(re,Q.params[0]||1)):this._moveCursor(0,Q.params[0]||1),!0}cursorForward(Q){return this._moveCursor(Q.params[0]||1,0),!0}cursorBackward(Q){return this._moveCursor(-(Q.params[0]||1),0),!0}cursorNextLine(Q){return this.cursorDown(Q),this._activeBuffer.x=0,!0}cursorPrecedingLine(Q){return this.cursorUp(Q),this._activeBuffer.x=0,!0}cursorCharAbsolute(Q){return this._setCursor((Q.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(Q){return this._setCursor(Q.length>=2?(Q.params[1]||1)-1:0,(Q.params[0]||1)-1),!0}charPosAbsolute(Q){return this._setCursor((Q.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(Q){return this._moveCursor(Q.params[0]||1,0),!0}linePosAbsolute(Q){return this._setCursor(this._activeBuffer.x,(Q.params[0]||1)-1),!0}vPositionRelative(Q){return this._moveCursor(0,Q.params[0]||1),!0}hVPosition(Q){return this.cursorPosition(Q),!0}tabClear(Q){const re=Q.params[0];return re===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:re===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(Q){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let re=Q.params[0]||1;for(;re--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(Q){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let re=Q.params[0]||1;for(;re--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(Q){const re=Q.params[0];return re===1&&(this._curAttrData.bg|=536870912),re!==2&&re!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(Q,re,Z,ie=!1,ge=!1){const fe=this._activeBuffer.lines.get(this._activeBuffer.ybase+Q);fe.replaceCells(re,Z,this._activeBuffer.getNullCell(this._eraseAttrData()),ge),ie&&(fe.isWrapped=!1)}_resetBufferLine(Q,re=!1){const Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+Q);Z&&(Z.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),re),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+Q),Z.isWrapped=!1)}eraseInDisplay(Q,re=!1){let Z;switch(this._restrictCursor(this._bufferService.cols),Q.params[0]){case 0:for(Z=this._activeBuffer.y,this._dirtyRowTracker.markDirty(Z),this._eraseInBufferLine(Z++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,re);Z<this._bufferService.rows;Z++)this._resetBufferLine(Z,re);this._dirtyRowTracker.markDirty(Z);break;case 1:for(Z=this._activeBuffer.y,this._dirtyRowTracker.markDirty(Z),this._eraseInBufferLine(Z,0,this._activeBuffer.x+1,!0,re),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(Z+1).isWrapped=!1);Z--;)this._resetBufferLine(Z,re);this._dirtyRowTracker.markDirty(0);break;case 2:for(Z=this._bufferService.rows,this._dirtyRowTracker.markDirty(Z-1);Z--;)this._resetBufferLine(Z,re);this._dirtyRowTracker.markDirty(0);break;case 3:const ie=this._activeBuffer.lines.length-this._bufferService.rows;ie>0&&(this._activeBuffer.lines.trimStart(ie),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-ie,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-ie,0),this._onScroll.fire(0))}return!0}eraseInLine(Q,re=!1){switch(this._restrictCursor(this._bufferService.cols),Q.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,re);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,re);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,re)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(Q){this._restrictCursor();let re=Q.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const Z=this._activeBuffer.ybase+this._activeBuffer.y,ie=this._bufferService.rows-1-this._activeBuffer.scrollBottom,ge=this._bufferService.rows-1+this._activeBuffer.ybase-ie+1;for(;re--;)this._activeBuffer.lines.splice(ge-1,1),this._activeBuffer.lines.splice(Z,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(Q){this._restrictCursor();let re=Q.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const Z=this._activeBuffer.ybase+this._activeBuffer.y;let ie;for(ie=this._bufferService.rows-1-this._activeBuffer.scrollBottom,ie=this._bufferService.rows-1+this._activeBuffer.ybase-ie;re--;)this._activeBuffer.lines.splice(Z,1),this._activeBuffer.lines.splice(ie,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(Q){this._restrictCursor();const re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return re&&(re.insertCells(this._activeBuffer.x,Q.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(Q){this._restrictCursor();const re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return re&&(re.deleteCells(this._activeBuffer.x,Q.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(Q){let re=Q.params[0]||1;for(;re--;)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(Q){let re=Q.params[0]||1;for(;re--;)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(L.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(Q){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const re=Q.params[0]||1;for(let Z=this._activeBuffer.scrollTop;Z<=this._activeBuffer.scrollBottom;++Z){const ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+Z);ie.deleteCells(0,re,this._activeBuffer.getNullCell(this._eraseAttrData())),ie.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(Q){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const re=Q.params[0]||1;for(let Z=this._activeBuffer.scrollTop;Z<=this._activeBuffer.scrollBottom;++Z){const ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+Z);ie.insertCells(0,re,this._activeBuffer.getNullCell(this._eraseAttrData())),ie.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(Q){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const re=Q.params[0]||1;for(let Z=this._activeBuffer.scrollTop;Z<=this._activeBuffer.scrollBottom;++Z){const ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+Z);ie.insertCells(this._activeBuffer.x,re,this._activeBuffer.getNullCell(this._eraseAttrData())),ie.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(Q){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const re=Q.params[0]||1;for(let Z=this._activeBuffer.scrollTop;Z<=this._activeBuffer.scrollBottom;++Z){const ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+Z);ie.deleteCells(this._activeBuffer.x,re,this._activeBuffer.getNullCell(this._eraseAttrData())),ie.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(Q){this._restrictCursor();const re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return re&&(re.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(Q.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(Q){const re=this._parser.precedingJoinState;if(!re)return!0;const Z=Q.params[0]||1,ie=J.UnicodeService.extractWidth(re),ge=this._activeBuffer.x-ie,fe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(ge),xe=new Uint32Array(fe.length*Z);let ke=0;for(let se=0;se<fe.length;){const Ee=fe.codePointAt(se)||0;xe[ke++]=Ee,se+=Ee>65535?2:1}let ue=ke;for(let se=1;se<Z;++se)xe.copyWithin(ue,0,ke),ue+=ke;return this.print(xe,0,ue),!0}sendDeviceAttributesPrimary(Q){return Q.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(Q){return Q.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(Q.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(Q){return(this._optionsService.rawOptions.termName+"").indexOf(Q)===0}setMode(Q){for(let re=0;re<Q.length;re++)switch(Q.params[re]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(Q){for(let re=0;re<Q.length;re++)switch(Q.params[re]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,P.DEFAULT_CHARSET),this._charsetService.setgCharset(1,P.DEFAULT_CHARSET),this._charsetService.setgCharset(2,P.DEFAULT_CHARSET),this._charsetService.setgCharset(3,P.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(Q){for(let re=0;re<Q.length;re++)switch(Q.params[re]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(Q){for(let re=0;re<Q.length;re++)switch(Q.params[re]){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(),Q.params[re]===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(Q,re){const Z=this._coreService.decPrivateModes,{activeProtocol:ie,activeEncoding:ge}=this._coreMouseService,fe=this._coreService,{buffers:xe,cols:ke}=this._bufferService,{active:ue,alt:se}=xe,Ee=this._optionsService.rawOptions,Se=Ve=>Ve?1:2,$e=Q.params[0];return Te=$e,Ue=re?$e===2?4:$e===4?Se(fe.modes.insertMode):$e===12?3:$e===20?Se(Ee.convertEol):0:$e===1?Se(Z.applicationCursorKeys):$e===3?Ee.windowOptions.setWinLines?ke===80?2:ke===132?1:0:0:$e===6?Se(Z.origin):$e===7?Se(Z.wraparound):$e===8?3:$e===9?Se(ie==="X10"):$e===12?Se(Ee.cursorBlink):$e===25?Se(!fe.isCursorHidden):$e===45?Se(Z.reverseWraparound):$e===66?Se(Z.applicationKeypad):$e===67?4:$e===1e3?Se(ie==="VT200"):$e===1002?Se(ie==="DRAG"):$e===1003?Se(ie==="ANY"):$e===1004?Se(Z.sendFocus):$e===1005?4:$e===1006?Se(ge==="SGR"):$e===1015?4:$e===1016?Se(ge==="SGR_PIXELS"):$e===1048?1:$e===47||$e===1047||$e===1049?Se(ue===se):$e===2004?Se(Z.bracketedPasteMode):0,fe.triggerDataEvent(`${d.C0.ESC}[${re?"":"?"}${Te};${Ue}$y`),!0;var Te,Ue}_updateAttrColor(Q,re,Z,ie,ge){return re===2?(Q|=50331648,Q&=-16777216,Q|=V.AttributeData.fromColorRGB([Z,ie,ge])):re===5&&(Q&=-50331904,Q|=33554432|255&Z),Q}_extractColor(Q,re,Z){const ie=[0,0,-1,0,0,0];let ge=0,fe=0;do{if(ie[fe+ge]=Q.params[re+fe],Q.hasSubParams(re+fe)){const xe=Q.getSubParams(re+fe);let ke=0;do ie[1]===5&&(ge=1),ie[fe+ke+1+ge]=xe[ke];while(++ke<xe.length&&ke+fe+1+ge<ie.length);break}if(ie[1]===5&&fe+ge>=2||ie[1]===2&&fe+ge>=5)break;ie[1]&&(ge=1)}while(++fe+re<Q.length&&fe+ge<ie.length);for(let xe=2;xe<ie.length;++xe)ie[xe]===-1&&(ie[xe]=0);switch(ie[0]){case 38:Z.fg=this._updateAttrColor(Z.fg,ie[1],ie[3],ie[4],ie[5]);break;case 48:Z.bg=this._updateAttrColor(Z.bg,ie[1],ie[3],ie[4],ie[5]);break;case 58:Z.extended=Z.extended.clone(),Z.extended.underlineColor=this._updateAttrColor(Z.extended.underlineColor,ie[1],ie[3],ie[4],ie[5])}return fe}_processUnderline(Q,re){re.extended=re.extended.clone(),(!~Q||Q>5)&&(Q=1),re.extended.underlineStyle=Q,re.fg|=268435456,Q===0&&(re.fg&=-268435457),re.updateExtended()}_processSGR0(Q){Q.fg=L.DEFAULT_ATTR_DATA.fg,Q.bg=L.DEFAULT_ATTR_DATA.bg,Q.extended=Q.extended.clone(),Q.extended.underlineStyle=0,Q.extended.underlineColor&=-67108864,Q.updateExtended()}charAttributes(Q){if(Q.length===1&&Q.params[0]===0)return this._processSGR0(this._curAttrData),!0;const re=Q.length;let Z;const ie=this._curAttrData;for(let ge=0;ge<re;ge++)Z=Q.params[ge],Z>=30&&Z<=37?(ie.fg&=-50331904,ie.fg|=16777216|Z-30):Z>=40&&Z<=47?(ie.bg&=-50331904,ie.bg|=16777216|Z-40):Z>=90&&Z<=97?(ie.fg&=-50331904,ie.fg|=16777224|Z-90):Z>=100&&Z<=107?(ie.bg&=-50331904,ie.bg|=16777224|Z-100):Z===0?this._processSGR0(ie):Z===1?ie.fg|=134217728:Z===3?ie.bg|=67108864:Z===4?(ie.fg|=268435456,this._processUnderline(Q.hasSubParams(ge)?Q.getSubParams(ge)[0]:1,ie)):Z===5?ie.fg|=536870912:Z===7?ie.fg|=67108864:Z===8?ie.fg|=1073741824:Z===9?ie.fg|=2147483648:Z===2?ie.bg|=134217728:Z===21?this._processUnderline(2,ie):Z===22?(ie.fg&=-134217729,ie.bg&=-134217729):Z===23?ie.bg&=-67108865:Z===24?(ie.fg&=-268435457,this._processUnderline(0,ie)):Z===25?ie.fg&=-536870913:Z===27?ie.fg&=-67108865:Z===28?ie.fg&=-1073741825:Z===29?ie.fg&=2147483647:Z===39?(ie.fg&=-67108864,ie.fg|=16777215&L.DEFAULT_ATTR_DATA.fg):Z===49?(ie.bg&=-67108864,ie.bg|=16777215&L.DEFAULT_ATTR_DATA.bg):Z===38||Z===48||Z===58?ge+=this._extractColor(Q,ge,ie):Z===53?ie.bg|=1073741824:Z===55?ie.bg&=-1073741825:Z===59?(ie.extended=ie.extended.clone(),ie.extended.underlineColor=-1,ie.updateExtended()):Z===100?(ie.fg&=-67108864,ie.fg|=16777215&L.DEFAULT_ATTR_DATA.fg,ie.bg&=-67108864,ie.bg|=16777215&L.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",Z);return!0}deviceStatus(Q){switch(Q.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const re=this._activeBuffer.y+1,Z=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${re};${Z}R`)}return!0}deviceStatusPrivate(Q){if(Q.params[0]===6){const re=this._activeBuffer.y+1,Z=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${re};${Z}R`)}return!0}softReset(Q){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=L.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(Q){const re=Q.params[0]||1;switch(re){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 Z=re%2==1;return this._optionsService.options.cursorBlink=Z,!0}setScrollRegion(Q){const re=Q.params[0]||1;let Z;return(Q.length<2||(Z=Q.params[1])>this._bufferService.rows||Z===0)&&(Z=this._bufferService.rows),Z>re&&(this._activeBuffer.scrollTop=re-1,this._activeBuffer.scrollBottom=Z-1,this._setCursor(0,0)),!0}windowOptions(Q){if(!ce(Q.params[0],this._optionsService.rawOptions.windowOptions))return!0;const re=Q.length>1?Q.params[1]:0;switch(Q.params[0]){case 14:re!==2&&this._onRequestWindowsOptionsReport.fire(oe.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(oe.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:re!==0&&re!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),re!==0&&re!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:re!==0&&re!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),re!==0&&re!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(Q){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(Q){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(Q){return this._windowTitle=Q,this._onTitleChange.fire(Q),!0}setIconName(Q){return this._iconName=Q,!0}setOrReportIndexedColor(Q){const re=[],Z=Q.split(";");for(;Z.length>1;){const ie=Z.shift(),ge=Z.shift();if(/^\d+$/.exec(ie)){const fe=parseInt(ie);if(me(fe))if(ge==="?")re.push({type:0,index:fe});else{const xe=(0,ee.parseColor)(ge);xe&&re.push({type:1,index:fe,color:xe})}}}return re.length&&this._onColor.fire(re),!0}setHyperlink(Q){const re=Q.split(";");return!(re.length<2)&&(re[1]?this._createHyperlink(re[0],re[1]):!re[0]&&this._finishHyperlink())}_createHyperlink(Q,re){this._getCurrentLinkId()&&this._finishHyperlink();const Z=Q.split(":");let ie;const ge=Z.findIndex((fe=>fe.startsWith("id=")));return ge!==-1&&(ie=Z[ge].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:ie,uri:re}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(Q,re){const Z=Q.split(";");for(let ie=0;ie<Z.length&&!(re>=this._specialColors.length);++ie,++re)if(Z[ie]==="?")this._onColor.fire([{type:0,index:this._specialColors[re]}]);else{const ge=(0,ee.parseColor)(Z[ie]);ge&&this._onColor.fire([{type:1,index:this._specialColors[re],color:ge}])}return!0}setOrReportFgColor(Q){return this._setOrReportSpecialColor(Q,0)}setOrReportBgColor(Q){return this._setOrReportSpecialColor(Q,1)}setOrReportCursorColor(Q){return this._setOrReportSpecialColor(Q,2)}restoreIndexedColor(Q){if(!Q)return this._onColor.fire([{type:2}]),!0;const re=[],Z=Q.split(";");for(let ie=0;ie<Z.length;++ie)if(/^\d+$/.exec(Z[ie])){const ge=parseInt(Z[ie]);me(ge)&&re.push({type:2,index:ge})}return re.length&&this._onColor.fire(re),!0}restoreFgColor(Q){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(Q){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(Q){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,P.DEFAULT_CHARSET),!0}selectCharset(Q){return Q.length!==2?(this.selectDefaultCharset(),!0):(Q[0]==="/"||this._charsetService.setgCharset(ne[Q[0]],P.CHARSETS[Q[1]]||P.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 Q=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,Q,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=L.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=L.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(Q){return this._charsetService.setgLevel(Q),!0}screenAlignmentPattern(){const Q=new j.CellData;Q.content=4194373,Q.fg=this._curAttrData.fg,Q.bg=this._curAttrData.bg,this._setCursor(0,0);for(let re=0;re<this._bufferService.rows;++re){const Z=this._activeBuffer.ybase+this._activeBuffer.y+re,ie=this._activeBuffer.lines.get(Z);ie&&(ie.fill(Q),ie.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(Q,re){const Z=this._bufferService.buffer,ie=this._optionsService.rawOptions;return(ge=>(this._coreService.triggerDataEvent(`${d.C0.ESC}${ge}${d.C0.ESC}\\`),!0))(Q==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:Q==='"p'?'P1$r61;1"p':Q==="r"?`P1$r${Z.scrollTop+1};${Z.scrollBottom+1}r`:Q==="m"?"P1$r0m":Q===" q"?`P1$r${{block:2,underline:4,bar:6}[ie.cursorStyle]-(ie.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(Q,re){this._dirtyRowTracker.markRangeDirty(Q,re)}}a.InputHandler=be;let ve=class{constructor(de){this._bufferService=de,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(de){de<this.start?this.start=de:de>this.end&&(this.end=de)}markRangeDirty(de,Q){de>Q&&(we=de,de=Q,Q=we),de<this.start&&(this.start=de),Q>this.end&&(this.end=Q)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function me(de){return 0<=de&&de<256}ve=f([C(0,Y.IBufferService)],ve)},844:(h,a)=>{function l(f){for(const C of f)C.dispose();f.length=0}Object.defineProperty(a,"__esModule",{value:!0}),a.getDisposeArrayDisposable=a.disposeArray=a.toDisposable=a.MutableDisposable=a.Disposable=void 0,a.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 C=this._disposables.indexOf(f);C!==-1&&this._disposables.splice(C,1)}},a.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var C;this._isDisposed||f===this._value||((C=this._value)==null||C.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}},a.toDisposable=function(f){return{dispose:f}},a.disposeArray=l,a.getDisposeArrayDisposable=function(f){return{dispose:()=>l(f)}}},1505:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.FourKeyMap=a.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(C,d,P){this._data[C]||(this._data[C]={}),this._data[C][d]=P}get(C,d){return this._data[C]?this._data[C][d]:void 0}clear(){this._data={}}}a.TwoKeyMap=l,a.FourKeyMap=class{constructor(){this._data=new l}set(f,C,d,P,H){this._data.get(f,C)||this._data.set(f,C,new l),this._data.get(f,C).set(d,P,H)}get(f,C,d,P){var H;return(H=this._data.get(f,C))==null?void 0:H.get(d,P)}clear(){this._data.clear()}}},6114:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.isChromeOS=a.isLinux=a.isWindows=a.isIphone=a.isIpad=a.isMac=a.getSafariVersion=a.isSafari=a.isLegacyEdge=a.isFirefox=a.isNode=void 0,a.isNode=typeof process<"u"&&"title"in process;const l=a.isNode?"node":navigator.userAgent,f=a.isNode?"node":navigator.platform;a.isFirefox=l.includes("Firefox"),a.isLegacyEdge=l.includes("Edge"),a.isSafari=/^((?!chrome|android).)*safari/i.test(l),a.getSafariVersion=function(){if(!a.isSafari)return 0;const C=l.match(/Version\/(\d+)/);return C===null||C.length<2?0:parseInt(C[1])},a.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),a.isIpad=f==="iPad",a.isIphone=f==="iPhone",a.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),a.isLinux=f.indexOf("Linux")>=0,a.isChromeOS=/\bCrOS\b/.test(l)},6106:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SortedList=void 0;let l=0;a.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(l=this._search(this._getKey(f)),this._array.splice(l,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const C=this._getKey(f);if(C===void 0||(l=this._search(C),l===-1)||this._getKey(this._array[l])!==C)return!1;do if(this._array[l]===f)return this._array.splice(l,1),!0;while(++l<this._array.length&&this._getKey(this._array[l])===C);return!1}*getKeyIterator(f){if(this._array.length!==0&&(l=this._search(f),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===f))do yield this._array[l];while(++l<this._array.length&&this._getKey(this._array[l])===f)}forEachByKey(f,C){if(this._array.length!==0&&(l=this._search(f),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===f))do C(this._array[l]);while(++l<this._array.length&&this._getKey(this._array[l])===f)}values(){return[...this._array].values()}_search(f){let C=0,d=this._array.length-1;for(;d>=C;){let P=C+d>>1;const H=this._getKey(this._array[P]);if(H>f)d=P-1;else{if(!(H<f)){for(;P>0&&this._getKey(this._array[P-1])===f;)P--;return P}C=P+1}}return C}}},7226:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DebouncedIdleTask=a.IdleTaskQueue=a.PriorityTaskQueue=void 0;const f=l(6114);class C{constructor(){this._tasks=[],this._i=0}enqueue(H){this._tasks.push(H),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(H){this._idleCallback=void 0;let W=0,U=0,L=H.timeRemaining(),N=0;for(;this._i<this._tasks.length;){if(W=Date.now(),this._tasks[this._i]()||this._i++,W=Math.max(1,Date.now()-W),U=Math.max(W,U),N=H.timeRemaining(),1.5*U>N)return L-W<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(L-W))}ms`),void this._start();L=N}this.clear()}}class d extends C{_requestCallback(H){return setTimeout((()=>H(this._createDeadline(16))))}_cancelCallback(H){clearTimeout(H)}_createDeadline(H){const W=Date.now()+H;return{timeRemaining:()=>Math.max(0,W-Date.now())}}}a.PriorityTaskQueue=d,a.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends C{_requestCallback(P){return requestIdleCallback(P)}_cancelCallback(P){cancelIdleCallback(P)}}:d,a.DebouncedIdleTask=class{constructor(){this._queue=new a.IdleTaskQueue}set(P){this._queue.clear(),this._queue.enqueue(P)}flush(){this._queue.flush()}}},9282:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.updateWindowsModeWrappedState=void 0;const f=l(643);a.updateWindowsModeWrappedState=function(C){const d=C.buffer.lines.get(C.buffer.ybase+C.buffer.y-1),P=d==null?void 0:d.get(C.cols-1),H=C.buffer.lines.get(C.buffer.ybase+C.buffer.y);H&&P&&(H.isWrapped=P[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&P[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ExtendedAttrs=a.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new l;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}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}}a.AttributeData=l;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,P=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=P}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}a.ExtendedAttrs=f},9092:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Buffer=a.MAX_BUFFER_SIZE=void 0;const f=l(6349),C=l(7226),d=l(3734),P=l(8437),H=l(4634),W=l(511),U=l(643),L=l(4863),N=l(7116);a.MAX_BUFFER_SIZE=4294967295,a.Buffer=class{constructor(x,j,V){this._hasScrollback=x,this._optionsService=j,this._bufferService=V,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=P.DEFAULT_ATTR_DATA.clone(),this.savedCharset=N.DEFAULT_CHARSET,this.markers=[],this._nullCell=W.CellData.fromCharData([0,U.NULL_CELL_CHAR,U.NULL_CELL_WIDTH,U.NULL_CELL_CODE]),this._whitespaceCell=W.CellData.fromCharData([0,U.WHITESPACE_CELL_CHAR,U.WHITESPACE_CELL_WIDTH,U.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new C.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 d.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 d.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,j){return new P.BufferLine(this._bufferService.cols,this.getNullCell(x),j)}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 j=x+this._optionsService.rawOptions.scrollback;return j>a.MAX_BUFFER_SIZE?a.MAX_BUFFER_SIZE:j}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=P.DEFAULT_ATTR_DATA);let j=this._rows;for(;j--;)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,j){const V=this.getNullCell(P.DEFAULT_ATTR_DATA);let Y=0;const J=this._getCorrectBufferLength(j);if(J>this.lines.maxLength&&(this.lines.maxLength=J),this.lines.length>0){if(this._cols<x)for(let G=0;G<this.lines.length;G++)Y+=+this.lines.get(G).resize(x,V);let X=0;if(this._rows<j)for(let G=this._rows;G<j;G++)this.lines.length<j+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new P.BufferLine(x,V)):this.ybase>0&&this.lines.length<=this.ybase+this.y+X+1?(this.ybase--,X++,this.ydisp>0&&this.ydisp--):this.lines.push(new P.BufferLine(x,V)));else for(let G=this._rows;G>j;G--)this.lines.length>j+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(J<this.lines.maxLength){const G=this.lines.length-J;G>0&&(this.lines.trimStart(G),this.ybase=Math.max(this.ybase-G,0),this.ydisp=Math.max(this.ydisp-G,0),this.savedY=Math.max(this.savedY-G,0)),this.lines.maxLength=J}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,j-1),X&&(this.y+=X),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=j-1,this._isReflowEnabled&&(this._reflow(x,j),this._cols>x))for(let X=0;X<this.lines.length;X++)Y+=+this.lines.get(X).resize(x,V);this._cols=x,this._rows=j,this._memoryCleanupQueue.clear(),Y>.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 j=0;for(;this._memoryCleanupPosition<this.lines.length;)if(j+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),j>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,j){this._cols!==x&&(x>this._cols?this._reflowLarger(x,j):this._reflowSmaller(x,j))}_reflowLarger(x,j){const V=(0,H.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(P.DEFAULT_ATTR_DATA));if(V.length>0){const Y=(0,H.reflowLargerCreateNewLayout)(this.lines,V);(0,H.reflowLargerApplyNewLayout)(this.lines,Y.layout),this._reflowLargerAdjustViewport(x,j,Y.countRemoved)}}_reflowLargerAdjustViewport(x,j,V){const Y=this.getNullCell(P.DEFAULT_ATTR_DATA);let J=V;for(;J-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<j&&this.lines.push(new P.BufferLine(x,Y))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-V,0)}_reflowSmaller(x,j){const V=this.getNullCell(P.DEFAULT_ATTR_DATA),Y=[];let J=0;for(let X=this.lines.length-1;X>=0;X--){let G=this.lines.get(X);if(!G||!G.isWrapped&&G.getTrimmedLength()<=x)continue;const ee=[G];for(;G.isWrapped&&X>0;)G=this.lines.get(--X),ee.unshift(G);const ne=this.ybase+this.y;if(ne>=X&&ne<X+ee.length)continue;const ae=ee[ee.length-1].getTrimmedLength(),ce=(0,H.reflowSmallerGetNewLineLengths)(ee,this._cols,x),oe=ce.length-ee.length;let we;we=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+oe):Math.max(0,this.lines.length-this.lines.maxLength+oe);const be=[];for(let Z=0;Z<oe;Z++){const ie=this.getBlankLine(P.DEFAULT_ATTR_DATA,!0);be.push(ie)}be.length>0&&(Y.push({start:X+ee.length+J,newLines:be}),J+=be.length),ee.push(...be);let ve=ce.length-1,me=ce[ve];me===0&&(ve--,me=ce[ve]);let de=ee.length-oe-1,Q=ae;for(;de>=0;){const Z=Math.min(Q,me);if(ee[ve]===void 0)break;if(ee[ve].copyCellsFrom(ee[de],Q-Z,me-Z,Z,!0),me-=Z,me===0&&(ve--,me=ce[ve]),Q-=Z,Q===0){de--;const ie=Math.max(de,0);Q=(0,H.getWrappedLineTrimmedLength)(ee,ie,this._cols)}}for(let Z=0;Z<ee.length;Z++)ce[Z]<x&&ee[Z].setCell(ce[Z],V);let re=oe-we;for(;re-- >0;)this.ybase===0?this.y<j-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+J)-j&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+oe,this.ybase+j-1)}if(Y.length>0){const X=[],G=[];for(let ve=0;ve<this.lines.length;ve++)G.push(this.lines.get(ve));const ee=this.lines.length;let ne=ee-1,ae=0,ce=Y[ae];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+J);let oe=0;for(let ve=Math.min(this.lines.maxLength-1,ee+J-1);ve>=0;ve--)if(ce&&ce.start>ne+oe){for(let me=ce.newLines.length-1;me>=0;me--)this.lines.set(ve--,ce.newLines[me]);ve++,X.push({index:ne+1,amount:ce.newLines.length}),oe+=ce.newLines.length,ce=Y[++ae]}else this.lines.set(ve,G[ne--]);let we=0;for(let ve=X.length-1;ve>=0;ve--)X[ve].index+=we,this.lines.onInsertEmitter.fire(X[ve]),we+=X[ve].amount;const be=Math.max(0,ee+J-this.lines.maxLength);be>0&&this.lines.onTrimEmitter.fire(be)}}translateBufferLineToString(x,j,V=0,Y){const J=this.lines.get(x);return J?J.translateToString(j,V,Y):""}getWrappedRangeForLine(x){let j=x,V=x;for(;j>0&&this.lines.get(j).isWrapped;)j--;for(;V+1<this.lines.length&&this.lines.get(V+1).isWrapped;)V++;return{first:j,last:V}}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 j=0;j<this.markers.length;j++)this.markers[j].line===x&&(this.markers[j].dispose(),this.markers.splice(j--,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 j=new L.Marker(x);return this.markers.push(j),j.register(this.lines.onTrim((V=>{j.line-=V,j.line<0&&j.dispose()}))),j.register(this.lines.onInsert((V=>{j.line>=V.index&&(j.line+=V.amount)}))),j.register(this.lines.onDelete((V=>{j.line>=V.index&&j.line<V.index+V.amount&&j.dispose(),j.line>V.index&&(j.line-=V.amount)}))),j.register(j.onDispose((()=>this._removeMarker(j)))),j}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLine=a.DEFAULT_ATTR_DATA=void 0;const f=l(3734),C=l(511),d=l(643),P=l(482);a.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let H=0;class W{constructor(L,N,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*L);const j=N||C.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let V=0;V<L;++V)this.setCell(V,j);this.length=L}get(L){const N=this._data[3*L+0],x=2097151&N;return[this._data[3*L+1],2097152&N?this._combined[L]:x?(0,P.stringFromCodePoint)(x):"",N>>22,2097152&N?this._combined[L].charCodeAt(this._combined[L].length-1):x]}set(L,N){this._data[3*L+1]=N[d.CHAR_DATA_ATTR_INDEX],N[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[L]=N[1],this._data[3*L+0]=2097152|L|N[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*L+0]=N[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|N[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(L){return this._data[3*L+0]>>22}hasWidth(L){return 12582912&this._data[3*L+0]}getFg(L){return this._data[3*L+1]}getBg(L){return this._data[3*L+2]}hasContent(L){return 4194303&this._data[3*L+0]}getCodePoint(L){const N=this._data[3*L+0];return 2097152&N?this._combined[L].charCodeAt(this._combined[L].length-1):2097151&N}isCombined(L){return 2097152&this._data[3*L+0]}getString(L){const N=this._data[3*L+0];return 2097152&N?this._combined[L]:2097151&N?(0,P.stringFromCodePoint)(2097151&N):""}isProtected(L){return 536870912&this._data[3*L+2]}loadCell(L,N){return H=3*L,N.content=this._data[H+0],N.fg=this._data[H+1],N.bg=this._data[H+2],2097152&N.content&&(N.combinedData=this._combined[L]),268435456&N.bg&&(N.extended=this._extendedAttrs[L]),N}setCell(L,N){2097152&N.content&&(this._combined[L]=N.combinedData),268435456&N.bg&&(this._extendedAttrs[L]=N.extended),this._data[3*L+0]=N.content,this._data[3*L+1]=N.fg,this._data[3*L+2]=N.bg}setCellFromCodepoint(L,N,x,j){268435456&j.bg&&(this._extendedAttrs[L]=j.extended),this._data[3*L+0]=N|x<<22,this._data[3*L+1]=j.fg,this._data[3*L+2]=j.bg}addCodepointToCell(L,N,x){let j=this._data[3*L+0];2097152&j?this._combined[L]+=(0,P.stringFromCodePoint)(N):2097151&j?(this._combined[L]=(0,P.stringFromCodePoint)(2097151&j)+(0,P.stringFromCodePoint)(N),j&=-2097152,j|=2097152):j=N|4194304,x&&(j&=-12582913,j|=x<<22),this._data[3*L+0]=j}insertCells(L,N,x){if((L%=this.length)&&this.getWidth(L-1)===2&&this.setCellFromCodepoint(L-1,0,1,x),N<this.length-L){const j=new C.CellData;for(let V=this.length-L-N-1;V>=0;--V)this.setCell(L+N+V,this.loadCell(L+V,j));for(let V=0;V<N;++V)this.setCell(L+V,x)}else for(let j=L;j<this.length;++j)this.setCell(j,x);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,x)}deleteCells(L,N,x){if(L%=this.length,N<this.length-L){const j=new C.CellData;for(let V=0;V<this.length-L-N;++V)this.setCell(L+V,this.loadCell(L+N+V,j));for(let V=this.length-N;V<this.length;++V)this.setCell(V,x)}else for(let j=L;j<this.length;++j)this.setCell(j,x);L&&this.getWidth(L-1)===2&&this.setCellFromCodepoint(L-1,0,1,x),this.getWidth(L)!==0||this.hasContent(L)||this.setCellFromCodepoint(L,0,1,x)}replaceCells(L,N,x,j=!1){if(j)for(L&&this.getWidth(L-1)===2&&!this.isProtected(L-1)&&this.setCellFromCodepoint(L-1,0,1,x),N<this.length&&this.getWidth(N-1)===2&&!this.isProtected(N)&&this.setCellFromCodepoint(N,0,1,x);L<N&&L<this.length;)this.isProtected(L)||this.setCell(L,x),L++;else for(L&&this.getWidth(L-1)===2&&this.setCellFromCodepoint(L-1,0,1,x),N<this.length&&this.getWidth(N-1)===2&&this.setCellFromCodepoint(N,0,1,x);L<N&&L<this.length;)this.setCell(L++,x)}resize(L,N){if(L===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const x=3*L;if(L>this.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const j=new Uint32Array(x);j.set(this._data),this._data=j}for(let j=this.length;j<L;++j)this.setCell(j,N)}else{this._data=this._data.subarray(0,x);const j=Object.keys(this._combined);for(let Y=0;Y<j.length;Y++){const J=parseInt(j[Y],10);J>=L&&delete this._combined[J]}const V=Object.keys(this._extendedAttrs);for(let Y=0;Y<V.length;Y++){const J=parseInt(V[Y],10);J>=L&&delete this._extendedAttrs[J]}}return this.length=L,4*x*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const L=new Uint32Array(this._data.length);return L.set(this._data),this._data=L,1}return 0}fill(L,N=!1){if(N)for(let x=0;x<this.length;++x)this.isProtected(x)||this.setCell(x,L);else{this._combined={},this._extendedAttrs={};for(let x=0;x<this.length;++x)this.setCell(x,L)}}copyFrom(L){this.length!==L.length?this._data=new Uint32Array(L._data):this._data.set(L._data),this.length=L.length,this._combined={};for(const N in L._combined)this._combined[N]=L._combined[N];this._extendedAttrs={};for(const N in L._extendedAttrs)this._extendedAttrs[N]=L._extendedAttrs[N];this.isWrapped=L.isWrapped}clone(){const L=new W(0);L._data=new Uint32Array(this._data),L.length=this.length;for(const N in this._combined)L._combined[N]=this._combined[N];for(const N in this._extendedAttrs)L._extendedAttrs[N]=this._extendedAttrs[N];return L.isWrapped=this.isWrapped,L}getTrimmedLength(){for(let L=this.length-1;L>=0;--L)if(4194303&this._data[3*L+0])return L+(this._data[3*L+0]>>22);return 0}getNoBgTrimmedLength(){for(let L=this.length-1;L>=0;--L)if(4194303&this._data[3*L+0]||50331648&this._data[3*L+2])return L+(this._data[3*L+0]>>22);return 0}copyCellsFrom(L,N,x,j,V){const Y=L._data;if(V)for(let X=j-1;X>=0;X--){for(let G=0;G<3;G++)this._data[3*(x+X)+G]=Y[3*(N+X)+G];268435456&Y[3*(N+X)+2]&&(this._extendedAttrs[x+X]=L._extendedAttrs[N+X])}else for(let X=0;X<j;X++){for(let G=0;G<3;G++)this._data[3*(x+X)+G]=Y[3*(N+X)+G];268435456&Y[3*(N+X)+2]&&(this._extendedAttrs[x+X]=L._extendedAttrs[N+X])}const J=Object.keys(L._combined);for(let X=0;X<J.length;X++){const G=parseInt(J[X],10);G>=N&&(this._combined[G-N+x]=L._combined[G])}}translateToString(L,N,x,j){N=N??0,x=x??this.length,L&&(x=Math.min(x,this.getTrimmedLength())),j&&(j.length=0);let V="";for(;N<x;){const Y=this._data[3*N+0],J=2097151&Y,X=2097152&Y?this._combined[N]:J?(0,P.stringFromCodePoint)(J):d.WHITESPACE_CELL_CHAR;if(V+=X,j)for(let G=0;G<X.length;++G)j.push(N);N+=Y>>22||1}return j&&j.push(N),V}}a.BufferLine=W},4841:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.getRangeLength=void 0,a.getRangeLength=function(l,f){if(l.start.y>l.end.y)throw new Error(`Buffer range end (${l.end.x}, ${l.end.y}) cannot be before start (${l.start.x}, ${l.start.y})`);return f*(l.end.y-l.start.y)+(l.end.x-l.start.x+1)}},4634:(h,a)=>{function l(f,C,d){if(C===f.length-1)return f[C].getTrimmedLength();const P=!f[C].hasContent(d-1)&&f[C].getWidth(d-1)===1,H=f[C+1].getWidth(0)===2;return P&&H?d-1:d}Object.defineProperty(a,"__esModule",{value:!0}),a.getWrappedLineTrimmedLength=a.reflowSmallerGetNewLineLengths=a.reflowLargerApplyNewLayout=a.reflowLargerCreateNewLayout=a.reflowLargerGetLinesToRemove=void 0,a.reflowLargerGetLinesToRemove=function(f,C,d,P,H){const W=[];for(let U=0;U<f.length-1;U++){let L=U,N=f.get(++L);if(!N.isWrapped)continue;const x=[f.get(U)];for(;L<f.length&&N.isWrapped;)x.push(N),N=f.get(++L);if(P>=U&&P<L){U+=x.length-1;continue}let j=0,V=l(x,j,C),Y=1,J=0;for(;Y<x.length;){const G=l(x,Y,C),ee=G-J,ne=d-V,ae=Math.min(ee,ne);x[j].copyCellsFrom(x[Y],J,V,ae,!1),V+=ae,V===d&&(j++,V=0),J+=ae,J===G&&(Y++,J=0),V===0&&j!==0&&x[j-1].getWidth(d-1)===2&&(x[j].copyCellsFrom(x[j-1],d-1,V++,1,!1),x[j-1].setCell(d-1,H))}x[j].replaceCells(V,d,H);let X=0;for(let G=x.length-1;G>0&&(G>j||x[G].getTrimmedLength()===0);G--)X++;X>0&&(W.push(U+x.length-X),W.push(X)),U+=x.length-1}return W},a.reflowLargerCreateNewLayout=function(f,C){const d=[];let P=0,H=C[P],W=0;for(let U=0;U<f.length;U++)if(H===U){const L=C[++P];f.onDeleteEmitter.fire({index:U-W,amount:L}),U+=L-1,W+=L,H=C[++P]}else d.push(U);return{layout:d,countRemoved:W}},a.reflowLargerApplyNewLayout=function(f,C){const d=[];for(let P=0;P<C.length;P++)d.push(f.get(C[P]));for(let P=0;P<d.length;P++)f.set(P,d[P]);f.length=C.length},a.reflowSmallerGetNewLineLengths=function(f,C,d){const P=[],H=f.map(((N,x)=>l(f,x,C))).reduce(((N,x)=>N+x));let W=0,U=0,L=0;for(;L<H;){if(H-L<d){P.push(H-L);break}W+=d;const N=l(f,U,C);W>N&&(W-=N,U++);const x=f[U].getWidth(W-1)===2;x&&W--;const j=x?d-1:d;P.push(j),L+=j}return P},a.getWrappedLineTrimmedLength=l},5295:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferSet=void 0;const f=l(8460),C=l(844),d=l(9092);class P extends C.Disposable{constructor(W,U){super(),this._optionsService=W,this._bufferService=U,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 d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.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(W){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(W),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(W,U){this._normal.resize(W,U),this._alt.resize(W,U),this.setupTabStops(W)}setupTabStops(W){this._normal.setupTabStops(W),this._alt.setupTabStops(W)}}a.BufferSet=P},511:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CellData=void 0;const f=l(482),C=l(643),d=l(3734);class P extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(W){const U=new P;return U.setFromCharData(W),U}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(W){this.fg=W[C.CHAR_DATA_ATTR_INDEX],this.bg=0;let U=!1;if(W[C.CHAR_DATA_CHAR_INDEX].length>2)U=!0;else if(W[C.CHAR_DATA_CHAR_INDEX].length===2){const L=W[C.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=L&&L<=56319){const N=W[C.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=N&&N<=57343?this.content=1024*(L-55296)+N-56320+65536|W[C.CHAR_DATA_WIDTH_INDEX]<<22:U=!0}else U=!0}else this.content=W[C.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|W[C.CHAR_DATA_WIDTH_INDEX]<<22;U&&(this.combinedData=W[C.CHAR_DATA_CHAR_INDEX],this.content=2097152|W[C.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.CellData=P},643:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WHITESPACE_CELL_CODE=a.WHITESPACE_CELL_WIDTH=a.WHITESPACE_CELL_CHAR=a.NULL_CELL_CODE=a.NULL_CELL_WIDTH=a.NULL_CELL_CHAR=a.CHAR_DATA_CODE_INDEX=a.CHAR_DATA_WIDTH_INDEX=a.CHAR_DATA_CHAR_INDEX=a.CHAR_DATA_ATTR_INDEX=a.DEFAULT_EXT=a.DEFAULT_ATTR=a.DEFAULT_COLOR=void 0,a.DEFAULT_COLOR=0,a.DEFAULT_ATTR=256|a.DEFAULT_COLOR<<9,a.DEFAULT_EXT=0,a.CHAR_DATA_ATTR_INDEX=0,a.CHAR_DATA_CHAR_INDEX=1,a.CHAR_DATA_WIDTH_INDEX=2,a.CHAR_DATA_CODE_INDEX=3,a.NULL_CELL_CHAR="",a.NULL_CELL_WIDTH=1,a.NULL_CELL_CODE=0,a.WHITESPACE_CELL_CHAR=" ",a.WHITESPACE_CELL_WIDTH=1,a.WHITESPACE_CELL_CODE=32},4863:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Marker=void 0;const f=l(8460),C=l(844);class d{get id(){return this._id}constructor(H){this.line=H,this.isDisposed=!1,this._disposables=[],this._id=d._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,C.disposeArray)(this._disposables),this._disposables.length=0)}register(H){return this._disposables.push(H),H}}a.Marker=d,d._nextId=1},7116:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DEFAULT_CHARSET=a.CHARSETS=void 0,a.CHARSETS={},a.DEFAULT_CHARSET=a.CHARSETS.B,a.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:"≥","{":"π","|":"≠","}":"£","~":"·"},a.CHARSETS.A={"#":"£"},a.CHARSETS.B=void 0,a.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},a.CHARSETS.C=a.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},a.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},a.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},a.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},a.CHARSETS.E=a.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},a.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},a.CHARSETS.H=a.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(h,a)=>{var l,f,C;Object.defineProperty(a,"__esModule",{value:!0}),a.C1_ESCAPED=a.C1=a.C0=void 0,(function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
80
- `,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(l||(a.C0=l={})),(function(d){d.PAD="€",d.HOP="",d.BPH="‚",d.NBH="ƒ",d.IND="„",d.NEL="…",d.SSA="†",d.ESA="‡",d.HTS="ˆ",d.HTJ="‰",d.VTS="Š",d.PLD="‹",d.PLU="Œ",d.RI="",d.SS2="Ž",d.SS3="",d.DCS="",d.PU1="‘",d.PU2="’",d.STS="“",d.CCH="”",d.MW="•",d.SPA="–",d.EPA="—",d.SOS="˜",d.SGCI="™",d.SCI="š",d.CSI="›",d.ST="œ",d.OSC="",d.PM="ž",d.APC="Ÿ"})(f||(a.C1=f={})),(function(d){d.ST=`${l.ESC}\\`})(C||(a.C1_ESCAPED=C={}))},7399:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.evaluateKeyboardEvent=void 0;const f=l(2584),C={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:["'",'"']};a.evaluateKeyboardEvent=function(d,P,H,W){const U={type:0,cancel:!1,key:void 0},L=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?U.key=P?f.C0.ESC+"OA":f.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?U.key=P?f.C0.ESC+"OD":f.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?U.key=P?f.C0.ESC+"OC":f.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(U.key=P?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:U.key=d.ctrlKey?"\b":f.C0.DEL,d.altKey&&(U.key=f.C0.ESC+U.key);break;case 9:if(d.shiftKey){U.key=f.C0.ESC+"[Z";break}U.key=f.C0.HT,U.cancel=!0;break;case 13:U.key=d.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,U.cancel=!0;break;case 27:U.key=f.C0.ESC,d.altKey&&(U.key=f.C0.ESC+f.C0.ESC),U.cancel=!0;break;case 37:if(d.metaKey)break;L?(U.key=f.C0.ESC+"[1;"+(L+1)+"D",U.key===f.C0.ESC+"[1;3D"&&(U.key=f.C0.ESC+(H?"b":"[1;5D"))):U.key=P?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(d.metaKey)break;L?(U.key=f.C0.ESC+"[1;"+(L+1)+"C",U.key===f.C0.ESC+"[1;3C"&&(U.key=f.C0.ESC+(H?"f":"[1;5C"))):U.key=P?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(d.metaKey)break;L?(U.key=f.C0.ESC+"[1;"+(L+1)+"A",H||U.key!==f.C0.ESC+"[1;3A"||(U.key=f.C0.ESC+"[1;5A")):U.key=P?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(d.metaKey)break;L?(U.key=f.C0.ESC+"[1;"+(L+1)+"B",H||U.key!==f.C0.ESC+"[1;3B"||(U.key=f.C0.ESC+"[1;5B")):U.key=P?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(U.key=f.C0.ESC+"[2~");break;case 46:U.key=L?f.C0.ESC+"[3;"+(L+1)+"~":f.C0.ESC+"[3~";break;case 36:U.key=L?f.C0.ESC+"[1;"+(L+1)+"H":P?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:U.key=L?f.C0.ESC+"[1;"+(L+1)+"F":P?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:d.shiftKey?U.type=2:d.ctrlKey?U.key=f.C0.ESC+"[5;"+(L+1)+"~":U.key=f.C0.ESC+"[5~";break;case 34:d.shiftKey?U.type=3:d.ctrlKey?U.key=f.C0.ESC+"[6;"+(L+1)+"~":U.key=f.C0.ESC+"[6~";break;case 112:U.key=L?f.C0.ESC+"[1;"+(L+1)+"P":f.C0.ESC+"OP";break;case 113:U.key=L?f.C0.ESC+"[1;"+(L+1)+"Q":f.C0.ESC+"OQ";break;case 114:U.key=L?f.C0.ESC+"[1;"+(L+1)+"R":f.C0.ESC+"OR";break;case 115:U.key=L?f.C0.ESC+"[1;"+(L+1)+"S":f.C0.ESC+"OS";break;case 116:U.key=L?f.C0.ESC+"[15;"+(L+1)+"~":f.C0.ESC+"[15~";break;case 117:U.key=L?f.C0.ESC+"[17;"+(L+1)+"~":f.C0.ESC+"[17~";break;case 118:U.key=L?f.C0.ESC+"[18;"+(L+1)+"~":f.C0.ESC+"[18~";break;case 119:U.key=L?f.C0.ESC+"[19;"+(L+1)+"~":f.C0.ESC+"[19~";break;case 120:U.key=L?f.C0.ESC+"[20;"+(L+1)+"~":f.C0.ESC+"[20~";break;case 121:U.key=L?f.C0.ESC+"[21;"+(L+1)+"~":f.C0.ESC+"[21~";break;case 122:U.key=L?f.C0.ESC+"[23;"+(L+1)+"~":f.C0.ESC+"[23~";break;case 123:U.key=L?f.C0.ESC+"[24;"+(L+1)+"~":f.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(H&&!W||!d.altKey||d.metaKey)!H||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?U.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(U.key=f.C0.US),d.key==="@"&&(U.key=f.C0.NUL)):d.keyCode===65&&(U.type=1);else{const N=C[d.keyCode],x=N==null?void 0:N[d.shiftKey?1:0];if(x)U.key=f.C0.ESC+x;else if(d.keyCode>=65&&d.keyCode<=90){const j=d.ctrlKey?d.keyCode-64:d.keyCode+32;let V=String.fromCharCode(j);d.shiftKey&&(V=V.toUpperCase()),U.key=f.C0.ESC+V}else if(d.keyCode===32)U.key=f.C0.ESC+(d.ctrlKey?f.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let j=d.code.slice(3,4);d.shiftKey||(j=j.toLowerCase()),U.key=f.C0.ESC+j,U.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?U.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?U.key=f.C0.NUL:d.keyCode>=51&&d.keyCode<=55?U.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?U.key=f.C0.DEL:d.keyCode===219?U.key=f.C0.ESC:d.keyCode===220?U.key=f.C0.FS:d.keyCode===221&&(U.key=f.C0.GS)}return U}},482:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Utf8ToUtf32=a.StringToUtf32=a.utf32ToString=a.stringFromCodePoint=void 0,a.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},a.utf32ToString=function(l,f=0,C=l.length){let d="";for(let P=f;P<C;++P){let H=l[P];H>65535?(H-=65536,d+=String.fromCharCode(55296+(H>>10))+String.fromCharCode(H%1024+56320)):d+=String.fromCharCode(H)}return d},a.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,f){const C=l.length;if(!C)return 0;let d=0,P=0;if(this._interim){const H=l.charCodeAt(P++);56320<=H&&H<=57343?f[d++]=1024*(this._interim-55296)+H-56320+65536:(f[d++]=this._interim,f[d++]=H),this._interim=0}for(let H=P;H<C;++H){const W=l.charCodeAt(H);if(55296<=W&&W<=56319){if(++H>=C)return this._interim=W,d;const U=l.charCodeAt(H);56320<=U&&U<=57343?f[d++]=1024*(W-55296)+U-56320+65536:(f[d++]=W,f[d++]=U)}else W!==65279&&(f[d++]=W)}return d}},a.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,f){const C=l.length;if(!C)return 0;let d,P,H,W,U=0,L=0,N=0;if(this.interim[0]){let V=!1,Y=this.interim[0];Y&=(224&Y)==192?31:(240&Y)==224?15:7;let J,X=0;for(;(J=63&this.interim[++X])&&X<4;)Y<<=6,Y|=J;const G=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,ee=G-X;for(;N<ee;){if(N>=C)return 0;if(J=l[N++],(192&J)!=128){N--,V=!0;break}this.interim[X++]=J,Y<<=6,Y|=63&J}V||(G===2?Y<128?N--:f[U++]=Y:G===3?Y<2048||Y>=55296&&Y<=57343||Y===65279||(f[U++]=Y):Y<65536||Y>1114111||(f[U++]=Y)),this.interim.fill(0)}const x=C-4;let j=N;for(;j<C;){for(;!(!(j<x)||128&(d=l[j])||128&(P=l[j+1])||128&(H=l[j+2])||128&(W=l[j+3]));)f[U++]=d,f[U++]=P,f[U++]=H,f[U++]=W,j+=4;if(d=l[j++],d<128)f[U++]=d;else if((224&d)==192){if(j>=C)return this.interim[0]=d,U;if(P=l[j++],(192&P)!=128){j--;continue}if(L=(31&d)<<6|63&P,L<128){j--;continue}f[U++]=L}else if((240&d)==224){if(j>=C)return this.interim[0]=d,U;if(P=l[j++],(192&P)!=128){j--;continue}if(j>=C)return this.interim[0]=d,this.interim[1]=P,U;if(H=l[j++],(192&H)!=128){j--;continue}if(L=(15&d)<<12|(63&P)<<6|63&H,L<2048||L>=55296&&L<=57343||L===65279)continue;f[U++]=L}else if((248&d)==240){if(j>=C)return this.interim[0]=d,U;if(P=l[j++],(192&P)!=128){j--;continue}if(j>=C)return this.interim[0]=d,this.interim[1]=P,U;if(H=l[j++],(192&H)!=128){j--;continue}if(j>=C)return this.interim[0]=d,this.interim[1]=P,this.interim[2]=H,U;if(W=l[j++],(192&W)!=128){j--;continue}if(L=(7&d)<<18|(63&P)<<12|(63&H)<<6|63&W,L<65536||L>1114111)continue;f[U++]=L}}return U}}},225:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeV6=void 0;const f=l(1480),C=[[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]],d=[[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 P;a.UnicodeV6=class{constructor(){if(this.version="6",!P){P=new Uint8Array(65536),P.fill(1),P[0]=0,P.fill(0,1,32),P.fill(0,127,160),P.fill(2,4352,4448),P[9001]=2,P[9002]=2,P.fill(2,11904,42192),P[12351]=1,P.fill(2,44032,55204),P.fill(2,63744,64256),P.fill(2,65040,65050),P.fill(2,65072,65136),P.fill(2,65280,65377),P.fill(2,65504,65511);for(let H=0;H<C.length;++H)P.fill(0,C[H][0],C[H][1]+1)}}wcwidth(H){return H<32?0:H<127?1:H<65536?P[H]:(function(W,U){let L,N=0,x=U.length-1;if(W<U[0][0]||W>U[x][1])return!1;for(;x>=N;)if(L=N+x>>1,W>U[L][1])N=L+1;else{if(!(W<U[L][0]))return!0;x=L-1}return!1})(H,d)?0:H>=131072&&H<=196605||H>=196608&&H<=262141?2:1}charProperties(H,W){let U=this.wcwidth(H),L=U===0&&W!==0;if(L){const N=f.UnicodeService.extractWidth(W);N===0?L=!1:N>U&&(U=N)}return f.UnicodeService.createPropertyValue(0,U,L)}}},5981:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WriteBuffer=void 0;const f=l(8460),C=l(844);class d extends C.Disposable{constructor(H){super(),this._action=H,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(H,W){if(W!==void 0&&this._syncCalls>W)return void(this._syncCalls=0);if(this._pendingData+=H.length,this._writeBuffer.push(H),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let U;for(this._isSyncWriting=!0;U=this._writeBuffer.shift();){this._action(U);const L=this._callbacks.shift();L&&L()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(H,W){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+=H.length,this._writeBuffer.push(H),this._callbacks.push(W),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=H.length,this._writeBuffer.push(H),this._callbacks.push(W)}_innerWrite(H=0,W=!0){const U=H||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const L=this._writeBuffer[this._bufferOffset],N=this._action(L,W);if(N){const j=V=>Date.now()-U>=12?setTimeout((()=>this._innerWrite(0,V))):this._innerWrite(U,V);return void N.catch((V=>(queueMicrotask((()=>{throw V})),Promise.resolve(!1)))).then(j)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=L.length,Date.now()-U>=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()}}a.WriteBuffer=d},5941:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.toRgbString=a.parseColor=void 0;const l=/^([\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 C(d,P){const H=d.toString(16),W=H.length<2?"0"+H:H;switch(P){case 4:return H[0];case 8:return W;case 12:return(W+W).slice(0,3);default:return W+W}}a.parseColor=function(d){if(!d)return;let P=d.toLowerCase();if(P.indexOf("rgb:")===0){P=P.slice(4);const H=l.exec(P);if(H){const W=H[1]?15:H[4]?255:H[7]?4095:65535;return[Math.round(parseInt(H[1]||H[4]||H[7]||H[10],16)/W*255),Math.round(parseInt(H[2]||H[5]||H[8]||H[11],16)/W*255),Math.round(parseInt(H[3]||H[6]||H[9]||H[12],16)/W*255)]}}else if(P.indexOf("#")===0&&(P=P.slice(1),f.exec(P)&&[3,6,9,12].includes(P.length))){const H=P.length/3,W=[0,0,0];for(let U=0;U<3;++U){const L=parseInt(P.slice(H*U,H*U+H),16);W[U]=H===1?L<<4:H===2?L:H===3?L>>4:L>>8}return W}},a.toRgbString=function(d,P=16){const[H,W,U]=d;return`rgb:${C(H,P)}/${C(W,P)}/${C(U,P)}`}},5770:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PAYLOAD_LIMIT=void 0,a.PAYLOAD_LIMIT=1e7},6351:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DcsHandler=a.DcsParser=void 0;const f=l(482),C=l(8742),d=l(5770),P=[];a.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=P,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=P}registerHandler(W,U){this._handlers[W]===void 0&&(this._handlers[W]=[]);const L=this._handlers[W];return L.push(U),{dispose:()=>{const N=L.indexOf(U);N!==-1&&L.splice(N,1)}}}clearHandler(W){this._handlers[W]&&delete this._handlers[W]}setHandlerFallback(W){this._handlerFb=W}reset(){if(this._active.length)for(let W=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;W>=0;--W)this._active[W].unhook(!1);this._stack.paused=!1,this._active=P,this._ident=0}hook(W,U){if(this.reset(),this._ident=W,this._active=this._handlers[W]||P,this._active.length)for(let L=this._active.length-1;L>=0;L--)this._active[L].hook(U);else this._handlerFb(this._ident,"HOOK",U)}put(W,U,L){if(this._active.length)for(let N=this._active.length-1;N>=0;N--)this._active[N].put(W,U,L);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(W,U,L))}unhook(W,U=!0){if(this._active.length){let L=!1,N=this._active.length-1,x=!1;if(this._stack.paused&&(N=this._stack.loopPosition-1,L=U,x=this._stack.fallThrough,this._stack.paused=!1),!x&&L===!1){for(;N>=0&&(L=this._active[N].unhook(W),L!==!0);N--)if(L instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=N,this._stack.fallThrough=!1,L;N--}for(;N>=0;N--)if(L=this._active[N].unhook(!1),L instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=N,this._stack.fallThrough=!0,L}else this._handlerFb(this._ident,"UNHOOK",W);this._active=P,this._ident=0}};const H=new C.Params;H.addParam(0),a.DcsHandler=class{constructor(W){this._handler=W,this._data="",this._params=H,this._hitLimit=!1}hook(W){this._params=W.length>1||W.params[0]?W.clone():H,this._data="",this._hitLimit=!1}put(W,U,L){this._hitLimit||(this._data+=(0,f.utf32ToString)(W,U,L),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(W){let U=!1;if(this._hitLimit)U=!1;else if(W&&(U=this._handler(this._data,this._params),U instanceof Promise))return U.then((L=>(this._params=H,this._data="",this._hitLimit=!1,L)));return this._params=H,this._data="",this._hitLimit=!1,U}}},2015:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.EscapeSequenceParser=a.VT500_TRANSITION_TABLE=a.TransitionTable=void 0;const f=l(844),C=l(8742),d=l(6242),P=l(6351);class H{constructor(N){this.table=new Uint8Array(N)}setDefault(N,x){this.table.fill(N<<4|x)}add(N,x,j,V){this.table[x<<8|N]=j<<4|V}addMany(N,x,j,V){for(let Y=0;Y<N.length;Y++)this.table[x<<8|N[Y]]=j<<4|V}}a.TransitionTable=H;const W=160;a.VT500_TRANSITION_TABLE=(function(){const L=new H(4095),N=Array.apply(null,Array(256)).map(((X,G)=>G)),x=(X,G)=>N.slice(X,G),j=x(32,127),V=x(0,24);V.push(25),V.push.apply(V,x(28,32));const Y=x(0,14);let J;for(J in L.setDefault(1,0),L.addMany(j,0,2,0),Y)L.addMany([24,26,153,154],J,3,0),L.addMany(x(128,144),J,3,0),L.addMany(x(144,152),J,3,0),L.add(156,J,0,0),L.add(27,J,11,1),L.add(157,J,4,8),L.addMany([152,158,159],J,0,7),L.add(155,J,11,3),L.add(144,J,11,9);return L.addMany(V,0,3,0),L.addMany(V,1,3,1),L.add(127,1,0,1),L.addMany(V,8,0,8),L.addMany(V,3,3,3),L.add(127,3,0,3),L.addMany(V,4,3,4),L.add(127,4,0,4),L.addMany(V,6,3,6),L.addMany(V,5,3,5),L.add(127,5,0,5),L.addMany(V,2,3,2),L.add(127,2,0,2),L.add(93,1,4,8),L.addMany(j,8,5,8),L.add(127,8,5,8),L.addMany([156,27,24,26,7],8,6,0),L.addMany(x(28,32),8,0,8),L.addMany([88,94,95],1,0,7),L.addMany(j,7,0,7),L.addMany(V,7,0,7),L.add(156,7,0,0),L.add(127,7,0,7),L.add(91,1,11,3),L.addMany(x(64,127),3,7,0),L.addMany(x(48,60),3,8,4),L.addMany([60,61,62,63],3,9,4),L.addMany(x(48,60),4,8,4),L.addMany(x(64,127),4,7,0),L.addMany([60,61,62,63],4,0,6),L.addMany(x(32,64),6,0,6),L.add(127,6,0,6),L.addMany(x(64,127),6,0,0),L.addMany(x(32,48),3,9,5),L.addMany(x(32,48),5,9,5),L.addMany(x(48,64),5,0,6),L.addMany(x(64,127),5,7,0),L.addMany(x(32,48),4,9,5),L.addMany(x(32,48),1,9,2),L.addMany(x(32,48),2,9,2),L.addMany(x(48,127),2,10,0),L.addMany(x(48,80),1,10,0),L.addMany(x(81,88),1,10,0),L.addMany([89,90,92],1,10,0),L.addMany(x(96,127),1,10,0),L.add(80,1,11,9),L.addMany(V,9,0,9),L.add(127,9,0,9),L.addMany(x(28,32),9,0,9),L.addMany(x(32,48),9,9,12),L.addMany(x(48,60),9,8,10),L.addMany([60,61,62,63],9,9,10),L.addMany(V,11,0,11),L.addMany(x(32,128),11,0,11),L.addMany(x(28,32),11,0,11),L.addMany(V,10,0,10),L.add(127,10,0,10),L.addMany(x(28,32),10,0,10),L.addMany(x(48,60),10,8,10),L.addMany([60,61,62,63],10,0,11),L.addMany(x(32,48),10,9,12),L.addMany(V,12,0,12),L.add(127,12,0,12),L.addMany(x(28,32),12,0,12),L.addMany(x(32,48),12,9,12),L.addMany(x(48,64),12,0,11),L.addMany(x(64,127),12,12,13),L.addMany(x(64,127),10,12,13),L.addMany(x(64,127),9,12,13),L.addMany(V,13,13,13),L.addMany(j,13,13,13),L.add(127,13,0,13),L.addMany([27,156,24,26],13,14,0),L.add(W,0,2,0),L.add(W,8,5,8),L.add(W,6,0,6),L.add(W,11,0,11),L.add(W,13,13,13),L})();class U extends f.Disposable{constructor(N=a.VT500_TRANSITION_TABLE){super(),this._transitions=N,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new C.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,j,V)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,j)=>{},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 d.OscParser),this._dcsParser=this.register(new P.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(N,x=[64,126]){let j=0;if(N.prefix){if(N.prefix.length>1)throw new Error("only one byte as prefix supported");if(j=N.prefix.charCodeAt(0),j&&60>j||j>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(N.intermediates){if(N.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let Y=0;Y<N.intermediates.length;++Y){const J=N.intermediates.charCodeAt(Y);if(32>J||J>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");j<<=8,j|=J}}if(N.final.length!==1)throw new Error("final must be a single byte");const V=N.final.charCodeAt(0);if(x[0]>V||V>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return j<<=8,j|=V,j}identToString(N){const x=[];for(;N;)x.push(String.fromCharCode(255&N)),N>>=8;return x.reverse().join("")}setPrintHandler(N){this._printHandler=N}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(N,x){const j=this._identifier(N,[48,126]);this._escHandlers[j]===void 0&&(this._escHandlers[j]=[]);const V=this._escHandlers[j];return V.push(x),{dispose:()=>{const Y=V.indexOf(x);Y!==-1&&V.splice(Y,1)}}}clearEscHandler(N){this._escHandlers[this._identifier(N,[48,126])]&&delete this._escHandlers[this._identifier(N,[48,126])]}setEscHandlerFallback(N){this._escHandlerFb=N}setExecuteHandler(N,x){this._executeHandlers[N.charCodeAt(0)]=x}clearExecuteHandler(N){this._executeHandlers[N.charCodeAt(0)]&&delete this._executeHandlers[N.charCodeAt(0)]}setExecuteHandlerFallback(N){this._executeHandlerFb=N}registerCsiHandler(N,x){const j=this._identifier(N);this._csiHandlers[j]===void 0&&(this._csiHandlers[j]=[]);const V=this._csiHandlers[j];return V.push(x),{dispose:()=>{const Y=V.indexOf(x);Y!==-1&&V.splice(Y,1)}}}clearCsiHandler(N){this._csiHandlers[this._identifier(N)]&&delete this._csiHandlers[this._identifier(N)]}setCsiHandlerFallback(N){this._csiHandlerFb=N}registerDcsHandler(N,x){return this._dcsParser.registerHandler(this._identifier(N),x)}clearDcsHandler(N){this._dcsParser.clearHandler(this._identifier(N))}setDcsHandlerFallback(N){this._dcsParser.setHandlerFallback(N)}registerOscHandler(N,x){return this._oscParser.registerHandler(N,x)}clearOscHandler(N){this._oscParser.clearHandler(N)}setOscHandlerFallback(N){this._oscParser.setHandlerFallback(N)}setErrorHandler(N){this._errorHandler=N}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(N,x,j,V,Y){this._parseStack.state=N,this._parseStack.handlers=x,this._parseStack.handlerPos=j,this._parseStack.transition=V,this._parseStack.chunkPos=Y}parse(N,x,j){let V,Y=0,J=0,X=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,X=this._parseStack.chunkPos+1;else{if(j===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const G=this._parseStack.handlers;let ee=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(j===!1&&ee>-1){for(;ee>=0&&(V=G[ee](this._params),V!==!0);ee--)if(V instanceof Promise)return this._parseStack.handlerPos=ee,V}this._parseStack.handlers=[];break;case 4:if(j===!1&&ee>-1){for(;ee>=0&&(V=G[ee](),V!==!0);ee--)if(V instanceof Promise)return this._parseStack.handlerPos=ee,V}this._parseStack.handlers=[];break;case 6:if(Y=N[this._parseStack.chunkPos],V=this._dcsParser.unhook(Y!==24&&Y!==26,j),V)return V;Y===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(Y=N[this._parseStack.chunkPos],V=this._oscParser.end(Y!==24&&Y!==26,j),V)return V;Y===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,X=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let G=X;G<x;++G){switch(Y=N[G],J=this._transitions.table[this.currentState<<8|(Y<160?Y:W)],J>>4){case 2:for(let oe=G+1;;++oe){if(oe>=x||(Y=N[oe])<32||Y>126&&Y<W){this._printHandler(N,G,oe),G=oe-1;break}if(++oe>=x||(Y=N[oe])<32||Y>126&&Y<W){this._printHandler(N,G,oe),G=oe-1;break}if(++oe>=x||(Y=N[oe])<32||Y>126&&Y<W){this._printHandler(N,G,oe),G=oe-1;break}if(++oe>=x||(Y=N[oe])<32||Y>126&&Y<W){this._printHandler(N,G,oe),G=oe-1;break}}break;case 3:this._executeHandlers[Y]?this._executeHandlers[Y]():this._executeHandlerFb(Y),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:G,code:Y,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const ee=this._csiHandlers[this._collect<<8|Y];let ne=ee?ee.length-1:-1;for(;ne>=0&&(V=ee[ne](this._params),V!==!0);ne--)if(V instanceof Promise)return this._preserveStack(3,ee,ne,J,G),V;ne<0&&this._csiHandlerFb(this._collect<<8|Y,this._params),this.precedingJoinState=0;break;case 8:do switch(Y){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(Y-48)}while(++G<x&&(Y=N[G])>47&&Y<60);G--;break;case 9:this._collect<<=8,this._collect|=Y;break;case 10:const ae=this._escHandlers[this._collect<<8|Y];let ce=ae?ae.length-1:-1;for(;ce>=0&&(V=ae[ce](),V!==!0);ce--)if(V instanceof Promise)return this._preserveStack(4,ae,ce,J,G),V;ce<0&&this._escHandlerFb(this._collect<<8|Y),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|Y,this._params);break;case 13:for(let oe=G+1;;++oe)if(oe>=x||(Y=N[oe])===24||Y===26||Y===27||Y>127&&Y<W){this._dcsParser.put(N,G,oe),G=oe-1;break}break;case 14:if(V=this._dcsParser.unhook(Y!==24&&Y!==26),V)return this._preserveStack(6,[],0,J,G),V;Y===27&&(J|=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 oe=G+1;;oe++)if(oe>=x||(Y=N[oe])<32||Y>127&&Y<W){this._oscParser.put(N,G,oe),G=oe-1;break}break;case 6:if(V=this._oscParser.end(Y!==24&&Y!==26),V)return this._preserveStack(5,[],0,J,G),V;Y===27&&(J|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&J}}}a.EscapeSequenceParser=U},6242:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OscHandler=a.OscParser=void 0;const f=l(5770),C=l(482),d=[];a.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(P,H){this._handlers[P]===void 0&&(this._handlers[P]=[]);const W=this._handlers[P];return W.push(H),{dispose:()=>{const U=W.indexOf(H);U!==-1&&W.splice(U,1)}}}clearHandler(P){this._handlers[P]&&delete this._handlers[P]}setHandlerFallback(P){this._handlerFb=P}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let P=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;P>=0;--P)this._active[P].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let P=this._active.length-1;P>=0;P--)this._active[P].start();else this._handlerFb(this._id,"START")}_put(P,H,W){if(this._active.length)for(let U=this._active.length-1;U>=0;U--)this._active[U].put(P,H,W);else this._handlerFb(this._id,"PUT",(0,C.utf32ToString)(P,H,W))}start(){this.reset(),this._state=1}put(P,H,W){if(this._state!==3){if(this._state===1)for(;H<W;){const U=P[H++];if(U===59){this._state=2,this._start();break}if(U<48||57<U)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+U-48}this._state===2&&W-H>0&&this._put(P,H,W)}}end(P,H=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let W=!1,U=this._active.length-1,L=!1;if(this._stack.paused&&(U=this._stack.loopPosition-1,W=H,L=this._stack.fallThrough,this._stack.paused=!1),!L&&W===!1){for(;U>=0&&(W=this._active[U].end(P),W!==!0);U--)if(W instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=U,this._stack.fallThrough=!1,W;U--}for(;U>=0;U--)if(W=this._active[U].end(!1),W instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=U,this._stack.fallThrough=!0,W}else this._handlerFb(this._id,"END",P);this._active=d,this._id=-1,this._state=0}}},a.OscHandler=class{constructor(P){this._handler=P,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(P,H,W){this._hitLimit||(this._data+=(0,C.utf32ToString)(P,H,W),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(P){let H=!1;if(this._hitLimit)H=!1;else if(P&&(H=this._handler(this._data),H instanceof Promise))return H.then((W=>(this._data="",this._hitLimit=!1,W)));return this._data="",this._hitLimit=!1,H}}},8742:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Params=void 0;const l=2147483647;class f{static fromArray(d){const P=new f;if(!d.length)return P;for(let H=Array.isArray(d[0])?1:0;H<d.length;++H){const W=d[H];if(Array.isArray(W))for(let U=0;U<W.length;++U)P.addSubParam(W[U]);else P.addParam(W)}return P}constructor(d=32,P=32){if(this.maxLength=d,this.maxSubParamsLength=P,P>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(P),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new f(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let P=0;P<this.length;++P){d.push(this.params[P]);const H=this._subParamsIdx[P]>>8,W=255&this._subParamsIdx[P];W-H>0&&d.push(Array.prototype.slice.call(this._subParams,H,W))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>l?l:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>l?l:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const P=this._subParamsIdx[d]>>8,H=255&this._subParamsIdx[d];return H-P>0?this._subParams.subarray(P,H):null}getSubParamsAll(){const d={};for(let P=0;P<this.length;++P){const H=this._subParamsIdx[P]>>8,W=255&this._subParamsIdx[P];W-H>0&&(d[P]=this._subParams.slice(H,W))}return d}addDigit(d){let P;if(this._rejectDigits||!(P=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const H=this._digitIsSub?this._subParams:this.params,W=H[P-1];H[P-1]=~W?Math.min(10*W+d,l):d}}a.Params=f},5741:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.AddonManager=void 0,a.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,f){const C={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(C),f.dispose=()=>this._wrappedAddonDispose(C),f.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let f=-1;for(let C=0;C<this._addons.length;C++)if(this._addons[C]===l){f=C;break}if(f===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(f,1)}}},8771:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferApiView=void 0;const f=l(3785),C=l(511);a.BufferApiView=class{constructor(d,P){this._buffer=d,this.type=P}init(d){return this._buffer=d,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(d){const P=this._buffer.lines.get(d);if(P)return new f.BufferLineApiView(P)}getNullCell(){return new C.CellData}}},3785:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLineApiView=void 0;const f=l(511);a.BufferLineApiView=class{constructor(C){this._line=C}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(C,d){if(!(C<0||C>=this._line.length))return d?(this._line.loadCell(C,d),d):this._line.loadCell(C,new f.CellData)}translateToString(C,d,P){return this._line.translateToString(C,d,P)}}},8285:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferNamespaceApi=void 0;const f=l(8771),C=l(8460),d=l(844);class P extends d.Disposable{constructor(W){super(),this._core=W,this._onBufferChange=this.register(new C.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)}}a.BufferNamespaceApi=P},7975:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ParserApi=void 0,a.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,f){return this._core.registerCsiHandler(l,(C=>f(C.toArray())))}addCsiHandler(l,f){return this.registerCsiHandler(l,f)}registerDcsHandler(l,f){return this._core.registerDcsHandler(l,((C,d)=>f(C,d.toArray())))}addDcsHandler(l,f){return this.registerDcsHandler(l,f)}registerEscHandler(l,f){return this._core.registerEscHandler(l,f)}addEscHandler(l,f){return this.registerEscHandler(l,f)}registerOscHandler(l,f){return this._core.registerOscHandler(l,f)}addOscHandler(l,f){return this.registerOscHandler(l,f)}}},7090:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeApi=void 0,a.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(h,a,l){var f=this&&this.__decorate||function(L,N,x,j){var V,Y=arguments.length,J=Y<3?N:j===null?j=Object.getOwnPropertyDescriptor(N,x):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")J=Reflect.decorate(L,N,x,j);else for(var X=L.length-1;X>=0;X--)(V=L[X])&&(J=(Y<3?V(J):Y>3?V(N,x,J):V(N,x))||J);return Y>3&&J&&Object.defineProperty(N,x,J),J},C=this&&this.__param||function(L,N){return function(x,j){N(x,j,L)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferService=a.MINIMUM_ROWS=a.MINIMUM_COLS=void 0;const d=l(8460),P=l(844),H=l(5295),W=l(2585);a.MINIMUM_COLS=2,a.MINIMUM_ROWS=1;let U=a.BufferService=class extends P.Disposable{get buffer(){return this.buffers.active}constructor(L){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(L.rawOptions.cols||0,a.MINIMUM_COLS),this.rows=Math.max(L.rawOptions.rows||0,a.MINIMUM_ROWS),this.buffers=this.register(new H.BufferSet(L,this))}resize(L,N){this.cols=L,this.rows=N,this.buffers.resize(L,N),this._onResize.fire({cols:L,rows:N})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(L,N=!1){const x=this.buffer;let j;j=this._cachedBlankLine,j&&j.length===this.cols&&j.getFg(0)===L.fg&&j.getBg(0)===L.bg||(j=x.getBlankLine(L,N),this._cachedBlankLine=j),j.isWrapped=N;const V=x.ybase+x.scrollTop,Y=x.ybase+x.scrollBottom;if(x.scrollTop===0){const J=x.lines.isFull;Y===x.lines.length-1?J?x.lines.recycle().copyFrom(j):x.lines.push(j.clone()):x.lines.splice(Y+1,0,j.clone()),J?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const J=Y-V+1;x.lines.shiftElements(V+1,J-1,-1),x.lines.set(Y,j.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(L,N,x){const j=this.buffer;if(L<0){if(j.ydisp===0)return;this.isUserScrolling=!0}else L+j.ydisp>=j.ybase&&(this.isUserScrolling=!1);const V=j.ydisp;j.ydisp=Math.max(Math.min(j.ydisp+L,j.ybase),0),V!==j.ydisp&&(N||this._onScroll.fire(j.ydisp))}};a.BufferService=U=f([C(0,W.IOptionsService)],U)},7994:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CharsetService=void 0,a.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,f){this._charsets[l]=f,this.glevel===l&&(this.charset=f)}}},1753:function(h,a,l){var f=this&&this.__decorate||function(j,V,Y,J){var X,G=arguments.length,ee=G<3?V:J===null?J=Object.getOwnPropertyDescriptor(V,Y):J;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ee=Reflect.decorate(j,V,Y,J);else for(var ne=j.length-1;ne>=0;ne--)(X=j[ne])&&(ee=(G<3?X(ee):G>3?X(V,Y,ee):X(V,Y))||ee);return G>3&&ee&&Object.defineProperty(V,Y,ee),ee},C=this&&this.__param||function(j,V){return function(Y,J){V(Y,J,j)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreMouseService=void 0;const d=l(2585),P=l(8460),H=l(844),W={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:j=>j.button!==4&&j.action===1&&(j.ctrl=!1,j.alt=!1,j.shift=!1,!0)},VT200:{events:19,restrict:j=>j.action!==32},DRAG:{events:23,restrict:j=>j.action!==32||j.button!==3},ANY:{events:31,restrict:j=>!0}};function U(j,V){let Y=(j.ctrl?16:0)|(j.shift?4:0)|(j.alt?8:0);return j.button===4?(Y|=64,Y|=j.action):(Y|=3&j.button,4&j.button&&(Y|=64),8&j.button&&(Y|=128),j.action===32?Y|=32:j.action!==0||V||(Y|=3)),Y}const L=String.fromCharCode,N={DEFAULT:j=>{const V=[U(j,!1)+32,j.col+32,j.row+32];return V[0]>255||V[1]>255||V[2]>255?"":`\x1B[M${L(V[0])}${L(V[1])}${L(V[2])}`},SGR:j=>{const V=j.action===0&&j.button!==4?"m":"M";return`\x1B[<${U(j,!0)};${j.col};${j.row}${V}`},SGR_PIXELS:j=>{const V=j.action===0&&j.button!==4?"m":"M";return`\x1B[<${U(j,!0)};${j.x};${j.y}${V}`}};let x=a.CoreMouseService=class extends H.Disposable{constructor(j,V){super(),this._bufferService=j,this._coreService=V,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new P.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const Y of Object.keys(W))this.addProtocol(Y,W[Y]);for(const Y of Object.keys(N))this.addEncoding(Y,N[Y]);this.reset()}addProtocol(j,V){this._protocols[j]=V}addEncoding(j,V){this._encodings[j]=V}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(j){if(!this._protocols[j])throw new Error(`unknown protocol "${j}"`);this._activeProtocol=j,this._onProtocolChange.fire(this._protocols[j].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(j){if(!this._encodings[j])throw new Error(`unknown encoding "${j}"`);this._activeEncoding=j}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(j){if(j.col<0||j.col>=this._bufferService.cols||j.row<0||j.row>=this._bufferService.rows||j.button===4&&j.action===32||j.button===3&&j.action!==32||j.button!==4&&(j.action===2||j.action===3)||(j.col++,j.row++,j.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,j,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(j))return!1;const V=this._encodings[this._activeEncoding](j);return V&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(V):this._coreService.triggerDataEvent(V,!0)),this._lastEvent=j,!0}explainEvents(j){return{down:!!(1&j),up:!!(2&j),drag:!!(4&j),move:!!(8&j),wheel:!!(16&j)}}_equalEvents(j,V,Y){if(Y){if(j.x!==V.x||j.y!==V.y)return!1}else if(j.col!==V.col||j.row!==V.row)return!1;return j.button===V.button&&j.action===V.action&&j.ctrl===V.ctrl&&j.alt===V.alt&&j.shift===V.shift}};a.CoreMouseService=x=f([C(0,d.IBufferService),C(1,d.ICoreService)],x)},6975:function(h,a,l){var f=this&&this.__decorate||function(x,j,V,Y){var J,X=arguments.length,G=X<3?j:Y===null?Y=Object.getOwnPropertyDescriptor(j,V):Y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(x,j,V,Y);else for(var ee=x.length-1;ee>=0;ee--)(J=x[ee])&&(G=(X<3?J(G):X>3?J(j,V,G):J(j,V))||G);return X>3&&G&&Object.defineProperty(j,V,G),G},C=this&&this.__param||function(x,j){return function(V,Y){j(V,Y,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreService=void 0;const d=l(1439),P=l(8460),H=l(844),W=l(2585),U=Object.freeze({insertMode:!1}),L=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let N=a.CoreService=class extends H.Disposable{constructor(x,j,V){super(),this._bufferService=x,this._logService=j,this._optionsService=V,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new P.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new P.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new P.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new P.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(U),this.decPrivateModes=(0,d.clone)(L)}reset(){this.modes=(0,d.clone)(U),this.decPrivateModes=(0,d.clone)(L)}triggerDataEvent(x,j=!1){if(this._optionsService.rawOptions.disableStdin)return;const V=this._bufferService.buffer;j&&this._optionsService.rawOptions.scrollOnUserInput&&V.ybase!==V.ydisp&&this._onRequestScrollToBottom.fire(),j&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((Y=>Y.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((j=>j.charCodeAt(0))))),this._onBinary.fire(x))}};a.CoreService=N=f([C(0,W.IBufferService),C(1,W.ILogService),C(2,W.IOptionsService)],N)},9074:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DecorationService=void 0;const f=l(8055),C=l(8460),d=l(844),P=l(6106);let H=0,W=0;class U extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new P.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new C.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new C.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const j=new L(x);if(j){const V=j.marker.onDispose((()=>j.dispose()));j.onDispose((()=>{j&&(this._decorations.delete(j)&&this._onDecorationRemoved.fire(j),V.dispose())})),this._decorations.insert(j),this._onDecorationRegistered.fire(j)}return j}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,j,V){let Y=0,J=0;for(const X of this._decorations.getKeyIterator(j))Y=X.options.x??0,J=Y+(X.options.width??1),x>=Y&&x<J&&(!V||(X.options.layer??"bottom")===V)&&(yield X)}forEachDecorationAtCell(x,j,V,Y){this._decorations.forEachByKey(j,(J=>{H=J.options.x??0,W=H+(J.options.width??1),x>=H&&x<W&&(!V||(J.options.layer??"bottom")===V)&&Y(J)}))}}a.DecorationService=U;class L extends d.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 C.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new C.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:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.InstantiationService=a.ServiceCollection=void 0;const f=l(2585),C=l(8343);class d{constructor(...H){this._entries=new Map;for(const[W,U]of H)this.set(W,U)}set(H,W){const U=this._entries.get(H);return this._entries.set(H,W),U}forEach(H){for(const[W,U]of this._entries.entries())H(W,U)}has(H){return this._entries.has(H)}get(H){return this._entries.get(H)}}a.ServiceCollection=d,a.InstantiationService=class{constructor(){this._services=new d,this._services.set(f.IInstantiationService,this)}setService(P,H){this._services.set(P,H)}getService(P){return this._services.get(P)}createInstance(P,...H){const W=(0,C.getServiceDependencies)(P).sort(((N,x)=>N.index-x.index)),U=[];for(const N of W){const x=this._services.get(N.id);if(!x)throw new Error(`[createInstance] ${P.name} depends on UNKNOWN service ${N.id}.`);U.push(x)}const L=W.length>0?W[0].index:H.length;if(H.length!==L)throw new Error(`[createInstance] First service dependency of ${P.name} at position ${L+1} conflicts with ${H.length} static arguments`);return new P(...H,...U)}}},7866:function(h,a,l){var f=this&&this.__decorate||function(L,N,x,j){var V,Y=arguments.length,J=Y<3?N:j===null?j=Object.getOwnPropertyDescriptor(N,x):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")J=Reflect.decorate(L,N,x,j);else for(var X=L.length-1;X>=0;X--)(V=L[X])&&(J=(Y<3?V(J):Y>3?V(N,x,J):V(N,x))||J);return Y>3&&J&&Object.defineProperty(N,x,J),J},C=this&&this.__param||function(L,N){return function(x,j){N(x,j,L)}};Object.defineProperty(a,"__esModule",{value:!0}),a.traceCall=a.setTraceLogger=a.LogService=void 0;const d=l(844),P=l(2585),H={trace:P.LogLevelEnum.TRACE,debug:P.LogLevelEnum.DEBUG,info:P.LogLevelEnum.INFO,warn:P.LogLevelEnum.WARN,error:P.LogLevelEnum.ERROR,off:P.LogLevelEnum.OFF};let W,U=a.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(L){super(),this._optionsService=L,this._logLevel=P.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),W=this}_updateLogLevel(){this._logLevel=H[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(L){for(let N=0;N<L.length;N++)typeof L[N]=="function"&&(L[N]=L[N]())}_log(L,N,x){this._evalLazyOptionalParams(x),L.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+N,...x)}trace(L,...N){var x;this._logLevel<=P.LogLevelEnum.TRACE&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.trace.bind(this._optionsService.options.logger))??console.log,L,N)}debug(L,...N){var x;this._logLevel<=P.LogLevelEnum.DEBUG&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.debug.bind(this._optionsService.options.logger))??console.log,L,N)}info(L,...N){var x;this._logLevel<=P.LogLevelEnum.INFO&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.info.bind(this._optionsService.options.logger))??console.info,L,N)}warn(L,...N){var x;this._logLevel<=P.LogLevelEnum.WARN&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.warn.bind(this._optionsService.options.logger))??console.warn,L,N)}error(L,...N){var x;this._logLevel<=P.LogLevelEnum.ERROR&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.error.bind(this._optionsService.options.logger))??console.error,L,N)}};a.LogService=U=f([C(0,P.IOptionsService)],U),a.setTraceLogger=function(L){W=L},a.traceCall=function(L,N,x){if(typeof x.value!="function")throw new Error("not supported");const j=x.value;x.value=function(...V){if(W.logLevel!==P.LogLevelEnum.TRACE)return j.apply(this,V);W.trace(`GlyphRenderer#${j.name}(${V.map((J=>JSON.stringify(J))).join(", ")})`);const Y=j.apply(this,V);return W.trace(`GlyphRenderer#${j.name} return`,Y),Y}}},7302:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OptionsService=a.DEFAULT_OPTIONS=void 0;const f=l(8460),C=l(844),d=l(6114);a.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:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const P=["normal","bold","100","200","300","400","500","600","700","800","900"];class H extends C.Disposable{constructor(U){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const L={...a.DEFAULT_OPTIONS};for(const N in U)if(N in L)try{const x=U[N];L[N]=this._sanitizeAndValidateOption(N,x)}catch(x){console.error(x)}this.rawOptions=L,this.options={...L},this._setupOptions(),this.register((0,C.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(U,L){return this.onOptionChange((N=>{N===U&&L(this.rawOptions[U])}))}onMultipleOptionChange(U,L){return this.onOptionChange((N=>{U.indexOf(N)!==-1&&L()}))}_setupOptions(){const U=N=>{if(!(N in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${N}"`);return this.rawOptions[N]},L=(N,x)=>{if(!(N in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${N}"`);x=this._sanitizeAndValidateOption(N,x),this.rawOptions[N]!==x&&(this.rawOptions[N]=x,this._onOptionChange.fire(N))};for(const N in this.rawOptions){const x={get:U.bind(this,N),set:L.bind(this,N)};Object.defineProperty(this.options,N,x)}}_sanitizeAndValidateOption(U,L){switch(U){case"cursorStyle":if(L||(L=a.DEFAULT_OPTIONS[U]),!(function(N){return N==="block"||N==="underline"||N==="bar"})(L))throw new Error(`"${L}" is not a valid value for ${U}`);break;case"wordSeparator":L||(L=a.DEFAULT_OPTIONS[U]);break;case"fontWeight":case"fontWeightBold":if(typeof L=="number"&&1<=L&&L<=1e3)break;L=P.includes(L)?L:a.DEFAULT_OPTIONS[U];break;case"cursorWidth":L=Math.floor(L);case"lineHeight":case"tabStopWidth":if(L<1)throw new Error(`${U} cannot be less than 1, value: ${L}`);break;case"minimumContrastRatio":L=Math.max(1,Math.min(21,Math.round(10*L)/10));break;case"scrollback":if((L=Math.min(L,4294967295))<0)throw new Error(`${U} cannot be less than 0, value: ${L}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(L<=0)throw new Error(`${U} cannot be less than or equal to 0, value: ${L}`);break;case"rows":case"cols":if(!L&&L!==0)throw new Error(`${U} must be numeric, value: ${L}`);break;case"windowsPty":L=L??{}}return L}}a.OptionsService=H},2660:function(h,a,l){var f=this&&this.__decorate||function(H,W,U,L){var N,x=arguments.length,j=x<3?W:L===null?L=Object.getOwnPropertyDescriptor(W,U):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(H,W,U,L);else for(var V=H.length-1;V>=0;V--)(N=H[V])&&(j=(x<3?N(j):x>3?N(W,U,j):N(W,U))||j);return x>3&&j&&Object.defineProperty(W,U,j),j},C=this&&this.__param||function(H,W){return function(U,L){W(U,L,H)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkService=void 0;const d=l(2585);let P=a.OscLinkService=class{constructor(H){this._bufferService=H,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(H){const W=this._bufferService.buffer;if(H.id===void 0){const V=W.addMarker(W.ybase+W.y),Y={data:H,id:this._nextId++,lines:[V]};return V.onDispose((()=>this._removeMarkerFromLink(Y,V))),this._dataByLinkId.set(Y.id,Y),Y.id}const U=H,L=this._getEntryIdKey(U),N=this._entriesWithId.get(L);if(N)return this.addLineToLink(N.id,W.ybase+W.y),N.id;const x=W.addMarker(W.ybase+W.y),j={id:this._nextId++,key:this._getEntryIdKey(U),data:U,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(j,x))),this._entriesWithId.set(j.key,j),this._dataByLinkId.set(j.id,j),j.id}addLineToLink(H,W){const U=this._dataByLinkId.get(H);if(U&&U.lines.every((L=>L.line!==W))){const L=this._bufferService.buffer.addMarker(W);U.lines.push(L),L.onDispose((()=>this._removeMarkerFromLink(U,L)))}}getLinkData(H){var W;return(W=this._dataByLinkId.get(H))==null?void 0:W.data}_getEntryIdKey(H){return`${H.id};;${H.uri}`}_removeMarkerFromLink(H,W){const U=H.lines.indexOf(W);U!==-1&&(H.lines.splice(U,1),H.lines.length===0&&(H.data.id!==void 0&&this._entriesWithId.delete(H.key),this._dataByLinkId.delete(H.id)))}};a.OscLinkService=P=f([C(0,d.IBufferService)],P)},8343:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createDecorator=a.getServiceDependencies=a.serviceRegistry=void 0;const l="di$target",f="di$dependencies";a.serviceRegistry=new Map,a.getServiceDependencies=function(C){return C[f]||[]},a.createDecorator=function(C){if(a.serviceRegistry.has(C))return a.serviceRegistry.get(C);const d=function(P,H,W){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(U,L,N){L[l]===L?L[f].push({id:U,index:N}):(L[f]=[{id:U,index:N}],L[l]=L)})(d,P,W)};return d.toString=()=>C,a.serviceRegistry.set(C,d),d}},2585:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.IDecorationService=a.IUnicodeService=a.IOscLinkService=a.IOptionsService=a.ILogService=a.LogLevelEnum=a.IInstantiationService=a.ICharsetService=a.ICoreService=a.ICoreMouseService=a.IBufferService=void 0;const f=l(8343);var C;a.IBufferService=(0,f.createDecorator)("BufferService"),a.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),a.ICoreService=(0,f.createDecorator)("CoreService"),a.ICharsetService=(0,f.createDecorator)("CharsetService"),a.IInstantiationService=(0,f.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(C||(a.LogLevelEnum=C={})),a.ILogService=(0,f.createDecorator)("LogService"),a.IOptionsService=(0,f.createDecorator)("OptionsService"),a.IOscLinkService=(0,f.createDecorator)("OscLinkService"),a.IUnicodeService=(0,f.createDecorator)("UnicodeService"),a.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeService=void 0;const f=l(8460),C=l(225);class d{static extractShouldJoin(H){return(1&H)!=0}static extractWidth(H){return H>>1&3}static extractCharKind(H){return H>>3}static createPropertyValue(H,W,U=!1){return(16777215&H)<<3|(3&W)<<1|(U?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const H=new C.UnicodeV6;this.register(H),this._active=H.version,this._activeProvider=H}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(H){if(!this._providers[H])throw new Error(`unknown Unicode version "${H}"`);this._active=H,this._activeProvider=this._providers[H],this._onChange.fire(H)}register(H){this._providers[H.version]=H}wcwidth(H){return this._activeProvider.wcwidth(H)}getStringCellWidth(H){let W=0,U=0;const L=H.length;for(let N=0;N<L;++N){let x=H.charCodeAt(N);if(55296<=x&&x<=56319){if(++N>=L)return W+this.wcwidth(x);const Y=H.charCodeAt(N);56320<=Y&&Y<=57343?x=1024*(x-55296)+Y-56320+65536:W+=this.wcwidth(Y)}const j=this.charProperties(x,U);let V=d.extractWidth(j);d.extractShouldJoin(j)&&(V-=d.extractWidth(U)),W+=V,U=j}return W}charProperties(H,W){return this._activeProvider.charProperties(H,W)}}a.UnicodeService=d}},n={};function o(h){var a=n[h];if(a!==void 0)return a.exports;var l=n[h]={exports:{}};return r[h].call(l.exports,l,l.exports,o),l.exports}var u={};return(()=>{var h=u;Object.defineProperty(h,"__esModule",{value:!0}),h.Terminal=void 0;const a=o(9042),l=o(3236),f=o(844),C=o(5741),d=o(8285),P=o(7975),H=o(7090),W=["cols","rows"];class U extends f.Disposable{constructor(N){super(),this._core=this.register(new l.Terminal(N)),this._addonManager=this.register(new C.AddonManager),this._publicOptions={...this._core.options};const x=V=>this._core.options[V],j=(V,Y)=>{this._checkReadonlyOptions(V),this._core.options[V]=Y};for(const V in this._core.options){const Y={get:x.bind(this,V),set:j.bind(this,V)};Object.defineProperty(this._publicOptions,V,Y)}}_checkReadonlyOptions(N){if(W.includes(N))throw new Error(`Option "${N}" 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 P.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new H.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 d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const N=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:N.applicationCursorKeys,applicationKeypadMode:N.applicationKeypad,bracketedPasteMode:N.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:N.origin,reverseWraparoundMode:N.reverseWraparound,sendFocusMode:N.sendFocus,wraparoundMode:N.wraparound}}get options(){return this._publicOptions}set options(N){for(const x in N)this._publicOptions[x]=N[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(N,x=!0){this._core.input(N,x)}resize(N,x){this._verifyIntegers(N,x),this._core.resize(N,x)}open(N){this._core.open(N)}attachCustomKeyEventHandler(N){this._core.attachCustomKeyEventHandler(N)}attachCustomWheelEventHandler(N){this._core.attachCustomWheelEventHandler(N)}registerLinkProvider(N){return this._core.registerLinkProvider(N)}registerCharacterJoiner(N){return this._checkProposedApi(),this._core.registerCharacterJoiner(N)}deregisterCharacterJoiner(N){this._checkProposedApi(),this._core.deregisterCharacterJoiner(N)}registerMarker(N=0){return this._verifyIntegers(N),this._core.registerMarker(N)}registerDecoration(N){return this._checkProposedApi(),this._verifyPositiveIntegers(N.x??0,N.width??0,N.height??0),this._core.registerDecoration(N)}hasSelection(){return this._core.hasSelection()}select(N,x,j){this._verifyIntegers(N,x,j),this._core.select(N,x,j)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(N,x){this._verifyIntegers(N,x),this._core.selectLines(N,x)}dispose(){super.dispose()}scrollLines(N){this._verifyIntegers(N),this._core.scrollLines(N)}scrollPages(N){this._verifyIntegers(N),this._core.scrollPages(N)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(N){this._verifyIntegers(N),this._core.scrollToLine(N)}clear(){this._core.clear()}write(N,x){this._core.write(N,x)}writeln(N,x){this._core.write(N),this._core.write(`\r
81
- `,x)}paste(N){this._core.paste(N)}refresh(N,x){this._verifyIntegers(N,x),this._core.refresh(N,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(N){this._addonManager.loadAddon(this,N)}static get strings(){return a}_verifyIntegers(...N){for(const x of N)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...N){for(const x of N)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}h.Terminal=U})(),u})()))})(xterm)),xterm.exports}var xtermExports=requireXterm(),addonFit={exports:{}},hasRequiredAddonFit;function requireAddonFit(){return hasRequiredAddonFit||(hasRequiredAddonFit=1,(function(t,e){(function(r,n){t.exports=n()})(self,(()=>(()=>{var r={};return(()=>{var n=r;Object.defineProperty(n,"__esModule",{value:!0}),n.FitAddon=void 0,n.FitAddon=class{activate(o){this._terminal=o}dispose(){}fit(){const o=this.proposeDimensions();if(!o||!this._terminal||isNaN(o.cols)||isNaN(o.rows))return;const u=this._terminal._core;this._terminal.rows===o.rows&&this._terminal.cols===o.cols||(u._renderService.clear(),this._terminal.resize(o.cols,o.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const o=this._terminal._core,u=o._renderService.dimensions;if(u.css.cell.width===0||u.css.cell.height===0)return;const h=this._terminal.options.scrollback===0?0:o.viewport.scrollBarWidth,a=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(a.getPropertyValue("height")),f=Math.max(0,parseInt(a.getPropertyValue("width"))),C=window.getComputedStyle(this._terminal.element),d=l-(parseInt(C.getPropertyValue("padding-top"))+parseInt(C.getPropertyValue("padding-bottom"))),P=f-(parseInt(C.getPropertyValue("padding-right"))+parseInt(C.getPropertyValue("padding-left")))-h;return{cols:Math.max(2,Math.floor(P/u.css.cell.width)),rows:Math.max(1,Math.floor(d/u.css.cell.height))}}}})(),r})()))})(addonFit)),addonFit.exports}var addonFitExports=requireAddonFit(),addonWebLinks={exports:{}},hasRequiredAddonWebLinks;function requireAddonWebLinks(){return hasRequiredAddonWebLinks||(hasRequiredAddonWebLinks=1,(function(t,e){(function(r,n){t.exports=n()})(self,(()=>(()=>{var r={6:(h,a)=>{function l(C){try{const d=new URL(C),P=d.password&&d.username?`${d.protocol}//${d.username}:${d.password}@${d.host}`:d.username?`${d.protocol}//${d.username}@${d.host}`:`${d.protocol}//${d.host}`;return C.toLocaleLowerCase().startsWith(P.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(a,"__esModule",{value:!0}),a.LinkComputer=a.WebLinkProvider=void 0,a.WebLinkProvider=class{constructor(C,d,P,H={}){this._terminal=C,this._regex=d,this._handler=P,this._options=H}provideLinks(C,d){const P=f.computeLink(C,this._regex,this._terminal,this._handler);d(this._addCallbacks(P))}_addCallbacks(C){return C.map((d=>(d.leave=this._options.leave,d.hover=(P,H)=>{if(this._options.hover){const{range:W}=d;this._options.hover(P,H,W)}},d)))}};class f{static computeLink(d,P,H,W){const U=new RegExp(P.source,(P.flags||"")+"g"),[L,N]=f._getWindowedLineStrings(d-1,H),x=L.join("");let j;const V=[];for(;j=U.exec(x);){const Y=j[0];if(!l(Y))continue;const[J,X]=f._mapStrIdx(H,N,0,j.index),[G,ee]=f._mapStrIdx(H,J,X,Y.length);if(J===-1||X===-1||G===-1||ee===-1)continue;const ne={start:{x:X+1,y:J+1},end:{x:ee,y:G+1}};V.push({range:ne,text:Y,activate:W})}return V}static _getWindowedLineStrings(d,P){let H,W=d,U=d,L=0,N="";const x=[];if(H=P.buffer.active.getLine(d)){const j=H.translateToString(!0);if(H.isWrapped&&j[0]!==" "){for(L=0;(H=P.buffer.active.getLine(--W))&&L<2048&&(N=H.translateToString(!0),L+=N.length,x.push(N),H.isWrapped&&N.indexOf(" ")===-1););x.reverse()}for(x.push(j),L=0;(H=P.buffer.active.getLine(++U))&&H.isWrapped&&L<2048&&(N=H.translateToString(!0),L+=N.length,x.push(N),N.indexOf(" ")===-1););}return[x,W]}static _mapStrIdx(d,P,H,W){const U=d.buffer.active,L=U.getNullCell();let N=H;for(;W;){const x=U.getLine(P);if(!x)return[-1,-1];for(let j=N;j<x.length;++j){x.getCell(j,L);const V=L.getChars();if(L.getWidth()&&(W-=V.length||1,j===x.length-1&&V==="")){const Y=U.getLine(P+1);Y&&Y.isWrapped&&(Y.getCell(0,L),L.getWidth()===2&&(W+=1))}if(W<0)return[P,j]}P++,N=0}return[P,N]}}a.LinkComputer=f}},n={};function o(h){var a=n[h];if(a!==void 0)return a.exports;var l=n[h]={exports:{}};return r[h](l,l.exports,o),l.exports}var u={};return(()=>{var h=u;Object.defineProperty(h,"__esModule",{value:!0}),h.WebLinksAddon=void 0;const a=o(6),l=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(C,d){const P=window.open();if(P){try{P.opener=null}catch{}P.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}h.WebLinksAddon=class{constructor(C=f,d={}){this._handler=C,this._options=d}activate(C){this._terminal=C;const d=this._options,P=d.urlRegex||l;this._linkProvider=this._terminal.registerLinkProvider(new a.WebLinkProvider(this._terminal,P,this._handler,d))}dispose(){var C;(C=this._linkProvider)==null||C.dispose()}}})(),u})()))})(addonWebLinks)),addonWebLinks.exports}var addonWebLinksExports=requireAddonWebLinks(),addonUnicode11$1={exports:{}},addonUnicode11=addonUnicode11$1.exports,hasRequiredAddonUnicode11;function requireAddonUnicode11(){return hasRequiredAddonUnicode11||(hasRequiredAddonUnicode11=1,(function(t,e){(function(r,n){t.exports=n()})(addonUnicode11,(()=>(()=>{var r={433:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeV11=void 0;const f=l(938),C=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],d=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],P=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],H=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]];let W;function U(L,N){let x,j=0,V=N.length-1;if(L<N[0][0]||L>N[V][1])return!1;for(;V>=j;)if(x=j+V>>1,L>N[x][1])j=x+1;else{if(!(L<N[x][0]))return!0;V=x-1}return!1}a.UnicodeV11=class{constructor(){if(this.version="11",!W){W=new Uint8Array(65536),W.fill(1),W[0]=0,W.fill(0,1,32),W.fill(0,127,160);for(let L=0;L<C.length;++L)W.fill(0,C[L][0],C[L][1]+1);for(let L=0;L<P.length;++L)W.fill(2,P[L][0],P[L][1]+1)}}wcwidth(L){return L<32?0:L<127?1:L<65536?W[L]:U(L,d)?0:U(L,H)?2:1}charProperties(L,N){let x=this.wcwidth(L),j=x===0&&N!==0;if(j){const V=f.UnicodeService.extractWidth(N);V===0?j=!1:V>x&&(x=V)}return f.UnicodeService.createPropertyValue(0,x,j)}}},345:(h,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.runAndSubscribe=a.forwardEvent=a.EventEmitter=void 0,a.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===l)return void this._listeners.splice(f,1)}}})),this._event}fire(l,f){const C=[];for(let d=0;d<this._listeners.length;d++)C.push(this._listeners[d]);for(let d=0;d<C.length;d++)C[d].call(void 0,l,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},a.forwardEvent=function(l,f){return l((C=>f.fire(C)))},a.runAndSubscribe=function(l,f){return f(void 0),l((C=>f(C)))}},490:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeV6=void 0;const f=l(938),C=[[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]],d=[[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 P;a.UnicodeV6=class{constructor(){if(this.version="6",!P){P=new Uint8Array(65536),P.fill(1),P[0]=0,P.fill(0,1,32),P.fill(0,127,160),P.fill(2,4352,4448),P[9001]=2,P[9002]=2,P.fill(2,11904,42192),P[12351]=1,P.fill(2,44032,55204),P.fill(2,63744,64256),P.fill(2,65040,65050),P.fill(2,65072,65136),P.fill(2,65280,65377),P.fill(2,65504,65511);for(let H=0;H<C.length;++H)P.fill(0,C[H][0],C[H][1]+1)}}wcwidth(H){return H<32?0:H<127?1:H<65536?P[H]:(function(W,U){let L,N=0,x=U.length-1;if(W<U[0][0]||W>U[x][1])return!1;for(;x>=N;)if(L=N+x>>1,W>U[L][1])N=L+1;else{if(!(W<U[L][0]))return!0;x=L-1}return!1})(H,d)?0:H>=131072&&H<=196605||H>=196608&&H<=262141?2:1}charProperties(H,W){let U=this.wcwidth(H),L=U===0&&W!==0;if(L){const N=f.UnicodeService.extractWidth(W);N===0?L=!1:N>U&&(U=N)}return f.UnicodeService.createPropertyValue(0,U,L)}}},938:(h,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeService=void 0;const f=l(345),C=l(490);class d{static extractShouldJoin(H){return(1&H)!=0}static extractWidth(H){return H>>1&3}static extractCharKind(H){return H>>3}static createPropertyValue(H,W,U=!1){return(16777215&H)<<3|(3&W)<<1|(U?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const H=new C.UnicodeV6;this.register(H),this._active=H.version,this._activeProvider=H}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(H){if(!this._providers[H])throw new Error(`unknown Unicode version "${H}"`);this._active=H,this._activeProvider=this._providers[H],this._onChange.fire(H)}register(H){this._providers[H.version]=H}wcwidth(H){return this._activeProvider.wcwidth(H)}getStringCellWidth(H){let W=0,U=0;const L=H.length;for(let N=0;N<L;++N){let x=H.charCodeAt(N);if(55296<=x&&x<=56319){if(++N>=L)return W+this.wcwidth(x);const Y=H.charCodeAt(N);56320<=Y&&Y<=57343?x=1024*(x-55296)+Y-56320+65536:W+=this.wcwidth(Y)}const j=this.charProperties(x,U);let V=d.extractWidth(j);d.extractShouldJoin(j)&&(V-=d.extractWidth(U)),W+=V,U=j}return W}charProperties(H,W){return this._activeProvider.charProperties(H,W)}}a.UnicodeService=d}},n={};function o(h){var a=n[h];if(a!==void 0)return a.exports;var l=n[h]={exports:{}};return r[h](l,l.exports,o),l.exports}var u={};return(()=>{var h=u;Object.defineProperty(h,"__esModule",{value:!0}),h.Unicode11Addon=void 0;const a=o(433);h.Unicode11Addon=class{activate(l){l.unicode.register(new a.UnicodeV11)}dispose(){}}})(),u})()))})(addonUnicode11$1)),addonUnicode11$1.exports}var addonUnicode11Exports=requireAddonUnicode11();/**
82
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
83
- * @license MIT
84
- *
85
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
86
- * @license MIT
87
- *
88
- * Originally forked from (with the author's permission):
89
- * Fabrice Bellard's javascript vt100 for jslinux:
90
- * http://bellard.org/jslinux/
91
- * Copyright (c) 2011 Fabrice Bellard
92
- */var m=0,p=0,g=0,b=0,I;(t=>{function e(o,u,h,a){return a!==void 0?`#${B(o)}${B(u)}${B(h)}${B(a)}`:`#${B(o)}${B(u)}${B(h)}`}t.toCss=e;function r(o,u,h,a=255){return(o<<24|u<<16|h<<8|a)>>>0}t.toRgba=r;function n(o,u,h,a){return{css:t.toCss(o,u,h,a),rgba:t.toRgba(o,u,h,a)}}t.toColor=n})(I||(I={}));var $;(t=>{function e(l,f){if(b=(f.rgba&255)/255,b===1)return{css:f.css,rgba:f.rgba};let C=f.rgba>>24&255,d=f.rgba>>16&255,P=f.rgba>>8&255,H=l.rgba>>24&255,W=l.rgba>>16&255,U=l.rgba>>8&255;m=H+Math.round((C-H)*b),p=W+Math.round((d-W)*b),g=U+Math.round((P-U)*b);let L=I.toCss(m,p,g),N=I.toRgba(m,p,g);return{css:L,rgba:N}}t.blend=e;function r(l){return(l.rgba&255)===255}t.isOpaque=r;function n(l,f,C){let d=y.ensureContrastRatio(l.rgba,f.rgba,C);if(d)return I.toColor(d>>24&255,d>>16&255,d>>8&255)}t.ensureContrastRatio=n;function o(l){let f=(l.rgba|255)>>>0;return[m,p,g]=y.toChannels(f),{css:I.toCss(m,p,g),rgba:f}}t.opaque=o;function u(l,f){return b=Math.round(f*255),[m,p,g]=y.toChannels(l.rgba),{css:I.toCss(m,p,g,b),rgba:I.toRgba(m,p,g,b)}}t.opacity=u;function h(l,f){return b=l.rgba&255,u(l,b*f/255)}t.multiplyOpacity=h;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}t.toColorRGB=a})($||($={}));var _;(t=>{let e,r;try{let o=document.createElement("canvas");o.width=1,o.height=1;let u=o.getContext("2d",{willReadFrequently:!0});u&&(e=u,e.globalCompositeOperation="copy",r=e.createLinearGradient(0,0,1,1))}catch{}function n(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return m=parseInt(o.slice(1,2).repeat(2),16),p=parseInt(o.slice(2,3).repeat(2),16),g=parseInt(o.slice(3,4).repeat(2),16),I.toColor(m,p,g);case 5:return m=parseInt(o.slice(1,2).repeat(2),16),p=parseInt(o.slice(2,3).repeat(2),16),g=parseInt(o.slice(3,4).repeat(2),16),b=parseInt(o.slice(4,5).repeat(2),16),I.toColor(m,p,g,b);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let u=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(u)return m=parseInt(u[1]),p=parseInt(u[2]),g=parseInt(u[3]),b=Math.round((u[5]===void 0?1:parseFloat(u[5]))*255),I.toColor(m,p,g,b);if(!e||!r)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=r,e.fillStyle=o,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[m,p,g,b]=e.getImageData(0,0,1,1).data,b!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:I.toRgba(m,p,g,b),css:o}}t.toColor=n})(_||(_={}));var v;(t=>{function e(n){return r(n>>16&255,n>>8&255,n&255)}t.relativeLuminance=e;function r(n,o,u){let h=n/255,a=o/255,l=u/255,f=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),C=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return f*.2126+C*.7152+d*.0722}t.relativeLuminance2=r})(v||(v={}));var y;(t=>{function e(h,a){if(b=(a&255)/255,b===1)return a;let l=a>>24&255,f=a>>16&255,C=a>>8&255,d=h>>24&255,P=h>>16&255,H=h>>8&255;return m=d+Math.round((l-d)*b),p=P+Math.round((f-P)*b),g=H+Math.round((C-H)*b),I.toRgba(m,p,g)}t.blend=e;function r(h,a,l){let f=v.relativeLuminance(h>>8),C=v.relativeLuminance(a>>8);if(F(f,C)<l){if(C<f){let H=n(h,a,l),W=F(f,v.relativeLuminance(H>>8));if(W<l){let U=o(h,a,l),L=F(f,v.relativeLuminance(U>>8));return W>L?H:U}return H}let d=o(h,a,l),P=F(f,v.relativeLuminance(d>>8));if(P<l){let H=n(h,a,l),W=F(f,v.relativeLuminance(H>>8));return P>W?d:H}return d}}t.ensureContrastRatio=r;function n(h,a,l){let f=h>>24&255,C=h>>16&255,d=h>>8&255,P=a>>24&255,H=a>>16&255,W=a>>8&255,U=F(v.relativeLuminance2(P,H,W),v.relativeLuminance2(f,C,d));for(;U<l&&(P>0||H>0||W>0);)P-=Math.max(0,Math.ceil(P*.1)),H-=Math.max(0,Math.ceil(H*.1)),W-=Math.max(0,Math.ceil(W*.1)),U=F(v.relativeLuminance2(P,H,W),v.relativeLuminance2(f,C,d));return(P<<24|H<<16|W<<8|255)>>>0}t.reduceLuminance=n;function o(h,a,l){let f=h>>24&255,C=h>>16&255,d=h>>8&255,P=a>>24&255,H=a>>16&255,W=a>>8&255,U=F(v.relativeLuminance2(P,H,W),v.relativeLuminance2(f,C,d));for(;U<l&&(P<255||H<255||W<255);)P=Math.min(255,P+Math.ceil((255-P)*.1)),H=Math.min(255,H+Math.ceil((255-H)*.1)),W=Math.min(255,W+Math.ceil((255-W)*.1)),U=F(v.relativeLuminance2(P,H,W),v.relativeLuminance2(f,C,d));return(P<<24|H<<16|W<<8|255)>>>0}t.increaseLuminance=o;function u(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}t.toChannels=u})(y||(y={}));function B(t){let e=t.toString(16);return e.length<2?"0"+e:e}function F(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}var E=Object.freeze((()=>{let t=[_.toColor("#2e3436"),_.toColor("#cc0000"),_.toColor("#4e9a06"),_.toColor("#c4a000"),_.toColor("#3465a4"),_.toColor("#75507b"),_.toColor("#06989a"),_.toColor("#d3d7cf"),_.toColor("#555753"),_.toColor("#ef2929"),_.toColor("#8ae234"),_.toColor("#fce94f"),_.toColor("#729fcf"),_.toColor("#ad7fa8"),_.toColor("#34e2e2"),_.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=e[r/36%6|0],o=e[r/6%6|0],u=e[r%6];t.push({css:I.toCss(n,o,u),rgba:I.toRgba(n,o,u)})}for(let r=0;r<24;r++){let n=8+r*10;t.push({css:I.toCss(n,n,n),rgba:I.toRgba(n,n,n)})}return t})());function A(t,e,r){return Math.max(e,Math.min(t,r))}function O(t){switch(t){case"&":return"&amp;";case"<":return"&lt;"}return t}var S=class{constructor(t){this._buffer=t}serialize(t,e){let r=this._buffer.getNullCell(),n=this._buffer.getNullCell(),o=r,u=t.start.y,h=t.end.y,a=t.start.x,l=t.end.x;this._beforeSerialize(h-u,u,h);for(let f=u;f<=h;f++){let C=this._buffer.getLine(f);if(C){let d=f===t.start.y?a:0,P=f===t.end.y?l:C.length;for(let H=d;H<P;H++){let W=C.getCell(H,o===r?n:r);if(!W){console.warn(`Can't get cell at row=${f}, col=${H}`);continue}this._nextCell(W,o,f,H),o=W}}this._rowEnd(f,f===h)}return this._afterSerialize(),this._serializeString(e)}_nextCell(t,e,r,n){}_rowEnd(t,e){}_beforeSerialize(t,e,r){}_afterSerialize(){}_serializeString(t){return""}};function T(t,e){return t.getFgColorMode()===e.getFgColorMode()&&t.getFgColor()===e.getFgColor()}function w(t,e){return t.getBgColorMode()===e.getBgColorMode()&&t.getBgColor()===e.getBgColor()}function z(t,e){return t.isInverse()===e.isInverse()&&t.isBold()===e.isBold()&&t.isUnderline()===e.isUnderline()&&t.isOverline()===e.isOverline()&&t.isBlink()===e.isBlink()&&t.isInvisible()===e.isInvisible()&&t.isItalic()===e.isItalic()&&t.isDim()===e.isDim()&&t.isStrikethrough()===e.isStrikethrough()}var k=class extends S{constructor(t,e){super(t),this._terminal=e,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(t,e,r){this._allRows=new Array(t),this._lastContentCursorRow=e,this._lastCursorRow=e,this._firstRow=e}_rowEnd(t,e){var n;this._nullCellCount>0&&!w(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let r="";if(!e){t-this._firstRow>=this._terminal.rows&&((n=this._buffer.getLine(this._cursorStyleRow))==null||n.getCell(this._cursorStyleCol,this._backgroundCell));let o=this._buffer.getLine(t),u=this._buffer.getLine(t+1);if(!u.isWrapped)r=`\r
93
- `,this._lastCursorRow=t+1,this._lastCursorCol=0;else{r="";let h=o.getCell(o.length-1,this._thisRowLastChar),a=o.getCell(o.length-2,this._thisRowLastSecondChar),l=u.getCell(0,this._nextRowFirstChar),f=l.getWidth()>1,C=!1;(l.getChars()&&f?this._nullCellCount<=1:this._nullCellCount<=0)&&((h.getChars()||h.getWidth()===0)&&w(h,l)&&(C=!0),f&&(a.getChars()||a.getWidth()===0)&&w(h,l)&&w(a,l)&&(C=!0)),C||(r="-".repeat(this._nullCellCount+1),r+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(r+="\x1B[A",r+=`\x1B[${o.length-this._nullCellCount}C`,r+=`\x1B[${this._nullCellCount}X`,r+=`\x1B[${o.length-this._nullCellCount}D`,r+="\x1B[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=r,this._currentRow="",this._nullCellCount=0}_diffStyle(t,e){let r=[],n=!T(t,e),o=!w(t,e),u=!z(t,e);if(n||o||u)if(t.isAttributeDefault())e.isAttributeDefault()||r.push(0);else{if(n){let h=t.getFgColor();t.isFgRGB()?r.push(38,2,h>>>16&255,h>>>8&255,h&255):t.isFgPalette()?h>=16?r.push(38,5,h):r.push(h&8?90+(h&7):30+(h&7)):r.push(39)}if(o){let h=t.getBgColor();t.isBgRGB()?r.push(48,2,h>>>16&255,h>>>8&255,h&255):t.isBgPalette()?h>=16?r.push(48,5,h):r.push(h&8?100+(h&7):40+(h&7)):r.push(49)}u&&(t.isInverse()!==e.isInverse()&&r.push(t.isInverse()?7:27),t.isBold()!==e.isBold()&&r.push(t.isBold()?1:22),t.isUnderline()!==e.isUnderline()&&r.push(t.isUnderline()?4:24),t.isOverline()!==e.isOverline()&&r.push(t.isOverline()?53:55),t.isBlink()!==e.isBlink()&&r.push(t.isBlink()?5:25),t.isInvisible()!==e.isInvisible()&&r.push(t.isInvisible()?8:28),t.isItalic()!==e.isItalic()&&r.push(t.isItalic()?3:23),t.isDim()!==e.isDim()&&r.push(t.isDim()?2:22),t.isStrikethrough()!==e.isStrikethrough()&&r.push(t.isStrikethrough()?9:29))}return r}_nextCell(t,e,r,n){if(t.getWidth()===0)return;let o=t.getChars()==="",u=this._diffStyle(t,this._cursorStyle);if(o?!w(this._cursorStyle,t):u.length>0){this._nullCellCount>0&&(w(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=n,this._currentRow+=`\x1B[${u.join(";")}m`;let h=this._buffer.getLine(r);h!==void 0&&(h.getCell(n,this._cursorStyle),this._cursorStyleRow=r,this._cursorStyleCol=n)}o?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(w(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=n+t.getWidth())}_serializeString(t){let e=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(e=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let r="";for(let u=0;u<e;u++)r+=this._allRows[u],u+1<e&&(r+=this._allRowSeparators[u]);if(!t){let u=this._buffer.baseY+this._buffer.cursorY,h=this._buffer.cursorX,a=u!==this._lastCursorRow||h!==this._lastCursorCol,l=f=>{f>0?r+=`\x1B[${f}C`:f<0&&(r+=`\x1B[${-f}D`)};a&&((f=>{f>0?r+=`\x1B[${f}B`:f<0&&(r+=`\x1B[${-f}A`)})(u-this._lastCursorRow),l(h-this._lastCursorCol))}let n=this._terminal._core._inputHandler._curAttrData,o=this._diffStyle(n,this._cursorStyle);return o.length>0&&(r+=`\x1B[${o.join(";")}m`),r}},D=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,e,r){let n=e.length,o=r===void 0?n:A(r+t.rows,0,n);return this._serializeBufferByRange(t,e,{start:n-o,end:n-1},!1)}_serializeBufferByRange(t,e,r,n){return new k(e,t).serialize({start:{x:0,y:typeof r.start=="number"?r.start:r.start.line},end:{x:t.cols,y:typeof r.end=="number"?r.end:r.end.line}},n)}_serializeBufferAsHTML(t,e){var a;let r=t.buffer.active,n=new M(r,t,e),o=e.onlySelection??!1,u=e.range;if(u)return n.serialize({start:{x:u.startCol,y:(u.startLine,u.startLine)},end:{x:t.cols,y:(u.endLine,u.endLine)}});if(!o){let l=r.length,f=e.scrollback,C=f===void 0?l:A(f+t.rows,0,l);return n.serialize({start:{x:0,y:l-C},end:{x:t.cols,y:l-1}})}let h=(a=this._terminal)==null?void 0:a.getSelectionPosition();return h!==void 0?n.serialize({start:{x:h.start.x,y:h.start.y},end:{x:h.end.x,y:h.end.y}}):""}_serializeModes(t){let e="",r=t.modes;if(r.applicationCursorKeysMode&&(e+="\x1B[?1h"),r.applicationKeypadMode&&(e+="\x1B[?66h"),r.bracketedPasteMode&&(e+="\x1B[?2004h"),r.insertMode&&(e+="\x1B[4h"),r.originMode&&(e+="\x1B[?6h"),r.reverseWraparoundMode&&(e+="\x1B[?45h"),r.sendFocusMode&&(e+="\x1B[?1004h"),r.wraparoundMode===!1&&(e+="\x1B[?7l"),r.mouseTrackingMode!=="none")switch(r.mouseTrackingMode){case"x10":e+="\x1B[?9h";break;case"vt200":e+="\x1B[?1000h";break;case"drag":e+="\x1B[?1002h";break;case"any":e+="\x1B[?1003h";break}return e}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let e=t!=null&&t.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,t.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,t==null?void 0:t.scrollback);if(!(t!=null&&t.excludeAltBuffer)&&this._terminal.buffer.active.type==="alternate"){let r=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);e+=`\x1B[?1049h\x1B[H${r}`}return t!=null&&t.excludeModes||(e+=this._serializeModes(this._terminal)),e}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t||{})}dispose(){}},M=class extends S{constructor(t,e,r){super(t),this._terminal=e,this._options=r,this._currentRow="",this._htmlContent="",e._core._themeService?this._ansiColors=e._core._themeService.colors.ansi:this._ansiColors=E}_padStart(t,e,r){return e=e>>0,r=r??" ",t.length>e?t:(e-=t.length,e>r.length&&(r+=r.repeat(e/r.length)),r.slice(0,e)+t)}_beforeSerialize(t,e,r){var h,a;this._htmlContent+="<html><body><!--StartFragment--><pre>";let n="#000000",o="#ffffff";(this._options.includeGlobalBackground??!1)&&(n=((h=this._terminal.options.theme)==null?void 0:h.foreground)??"#ffffff",o=((a=this._terminal.options.theme)==null?void 0:a.background)??"#000000");let u=[];u.push("color: "+n+";"),u.push("background-color: "+o+";"),u.push("font-family: "+this._terminal.options.fontFamily+";"),u.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+u.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(t,e){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(t,e){let r=e?t.getFgColor():t.getBgColor();if(e?t.isFgRGB():t.isBgRGB())return"#"+[r>>16&255,r>>8&255,r&255].map(n=>this._padStart(n.toString(16),2,"0")).join("");if(e?t.isFgPalette():t.isBgPalette())return this._ansiColors[r].css}_diffStyle(t,e){let r=[],n=!T(t,e),o=!w(t,e),u=!z(t,e);if(n||o||u){let h=this._getHexColor(t,!0);h&&r.push("color: "+h+";");let a=this._getHexColor(t,!1);return a&&r.push("background-color: "+a+";"),t.isInverse()&&r.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&r.push("font-weight: bold;"),t.isUnderline()&&t.isOverline()?r.push("text-decoration: overline underline;"):t.isUnderline()?r.push("text-decoration: underline;"):t.isOverline()&&r.push("text-decoration: overline;"),t.isBlink()&&r.push("text-decoration: blink;"),t.isInvisible()&&r.push("visibility: hidden;"),t.isItalic()&&r.push("font-style: italic;"),t.isDim()&&r.push("opacity: 0.5;"),t.isStrikethrough()&&r.push("text-decoration: line-through;"),r}}_nextCell(t,e,r,n){if(t.getWidth()===0)return;let o=t.getChars()==="",u=this._diffStyle(t,e);u&&(this._currentRow+=u.length===0?"</span><span>":"</span><span style='"+u.join(" ")+"'>"),o?this._currentRow+=" ":this._currentRow+=O(t.getChars())}_serializeString(){return this._htmlContent}},ws,CommandParser=(ws=class{static splitByOperators(e){const r=[];let n="",o=!1,u=!1;for(let a=0;a<e.length;a++){const l=e[a];if(l==="'"&&!u){o=!o,n+=l;continue}if(l==='"'&&!o){u=!u,n+=l;continue}if(o||u){n+=l;continue}const f=e.slice(a,a+2);if(f===">>"&&n.endsWith("2")){const C=n.slice(0,-1).trim();C&&r.push({type:"command",value:C}),n="",r.push({type:"2>>",value:"2>>"}),a++;continue}if(f==="&&"||f==="||"||f===">>"){const C=n.trim();C&&r.push({type:"command",value:C}),n="",r.push({type:f,value:f}),a++;continue}if(l===">"&&n.endsWith("2")){const C=n.slice(0,-1).trim();C&&r.push({type:"command",value:C}),n="",r.push({type:"2>",value:"2>"});continue}if(l==="|"){const C=n.trim();C&&r.push({type:"command",value:C}),n="",r.push({type:"|",value:"|"});continue}if(l===">"){const C=n.trim();C&&r.push({type:"command",value:C}),n="",r.push({type:">",value:">"});continue}if(l===";"){const C=n.trim();C&&r.push({type:"command",value:C}),n="",r.push({type:";",value:";"});continue}n+=l}const h=n.trim();return h&&r.push({type:"command",value:h}),r}parse(e){const r=/(?:--?([a-zA-Z0-9-_]+)(?:=("[^"]*"|'[^']*'|[^\s]+))?)|(?:[^\s]+)/g,n=Array.from(e.matchAll(r));if(n.length===0)return{commandName:"",args:[],tokens:[]};const o=[],u=[],h=[];for(const a of n)if(a[1]){const l=a[1],f=a[2]!==void 0;let C=a[2];C?C=C.replace(/^['"]|['"]$/g,""):f||(C=!0);const d=this.parseValue(C);u.push({name:l,value:d}),h.push({kind:"flag",name:l,value:d,hasEquals:f})}else a[0].startsWith("-")||(o.push(a[0]),h.push({kind:"word",value:a[0]}));return{commandName:o.join(" "),args:u,tokens:h}}parseValue(e){return typeof e!="string"?e:e.length>0&&!isNaN(Number(e))?Number(e):e==="true"||e==="false"?e==="true":e}},ws.OPERATORS=["&&","||","2>>","2>",">>",">","|",";"],ws),CliArgsParser=class{static convertToRecord(t,e){const r={},n=(o,u)=>{var h;r[o.name]=u,(h=o.aliases)==null||h.forEach(a=>{r[a]=u})};return t.forEach(o=>{var h;const u=(h=e.parameters)==null?void 0:h.find(a=>{var l;return a.name===o.name||((l=a.aliases)==null?void 0:l.some(f=>f===o.name))});if(u){let a=o.value;switch(u.type){case"array":{a=[...Array.isArray(r[u.name])?r[u.name]:[],o.value];break}case"boolean":a=a===!0||a==="true"||a==="1"||a==="yes"||a==="y"||a===1;break;default:a=o.value;break}n(u,a)}else r[o.name]=o.value}),r}};function reconcileArgs(t,e){const r=[],n=[];for(let o=0;o<t.length;o++){const u=t[o];if(u.kind==="word"){n.push(u.value);continue}const h=findDescriptor(u.name,e);if(h&&h.type!=="boolean"&&!u.hasEquals&&o+1<t.length&&t[o+1].kind==="word"){const a=t[o+1];r.push({name:u.name,value:parseValue(a.value)}),o++}else r.push({name:u.name,value:u.value})}return{args:r,commandParts:n}}function findDescriptor(t,e){if(e)return e.find(r=>{var n;return r.name===t||((n=r.aliases)==null?void 0:n.some(o=>o===t))})}function parseValue(t){return t.length>0&&!isNaN(Number(t))?Number(t):t==="true"||t==="false"?t==="true":t}var groupBy=(t,e)=>t.reduce((r,n)=>{const o=e(n);return r.has(o)||r.set(o,[]),r.get(o).push(n),r},new Map),getGreetingBasedOnTime=t=>{const e=new Date().getHours();return e>=5&&e<12?"☀️ Good morning! Wishing you a productive day ahead!":e>=12&&e<18?"🌤️ Good afternoon! Keep up the great work!":e>=18&&e<22?"🌆 Good evening! Hope you had a fantastic day!":"🌙 Good night! Rest well and see you tomorrow!"},openLink=t=>{try{window.open(t,"_blank")}catch(e){console.error(e)}},ProcessExitedError=class extends Error{constructor(t){super(`Process exited with code ${t}`),this.name="ProcessExitedError",this.code=t,Object.setPrototypeOf(this,new.target.prototype)}},CliCommandProcessorRegistry=class{constructor(t){this.processors=[],t&&this.processors.push(...t)}registerProcessor(t){var r,n;const e=this.getProcessorByName(t.command);if(e){if(e===t)return;const o=this.processors.findIndex(u=>u.command===t.command);if(t.extendsProcessor){if((r=t.processors)!=null&&r.length){e.processors||(e.processors=[]);for(const u of t.processors)e.processors.find(a=>a.command===u.command)||e.processors.push(u)}return}if((n=e.metadata)!=null&&n.sealed){console.warn(`Processor with command: ${t.command} is sealed and cannot be replaced.`);return}this.processors[o]=t}else this.processors.push(t)}unregisterProcessor(t){var n;const e=this.getProcessorByName(t.command);if(e&&(n=e.metadata)!=null&&n.sealed&&!e.originalProcessor){console.warn(`Processor with command: ${t.command} is sealed and cannot be removed.`);return}const r=this.processors.findIndex(o=>o.command===t.command);if(r!==-1){const o=this.processors[r];o.originalProcessor?this.processors[r]=o.originalProcessor:this.processors.splice(r,1)}}findProcessor(t,e){return this.findProcessorInCollection(t,e,this.processors)}findProcessorInCollection(t,e,r){const n=t.toLowerCase(),o=r.find(u=>{var h;return u.command.toLowerCase()===n||((h=u.aliases)==null?void 0:h.some(a=>a.toLowerCase()===n))});if(o){if(e.length===0)return o;if(o.processors&&o.processors.length>0)return this.findProcessorInCollection(e[0],e.slice(1),o.processors);if(o.acceptsRawInput||o.valueRequired)return o}}getRootProcessor(t){return t.parent?this.getRootProcessor(t.parent):t}getProcessorByName(t){return this.processors.find(e=>e.command.toLowerCase()===t.toLowerCase())}},CliProcessorsRegistry_TOKEN="cli-processors-registry",CliStateStoreManager_TOKEN="cli-state-store-manager",CliCommandHistory_TOKEN="cli-command-history",ICliPingServerService_TOKEN="cli-ping-server-service",CliModuleRegistry_TOKEN="cli-module-registry",CliBackgroundServiceRegistry_TOKEN="cli-background-service-registry",CliPackageManagerService_TOKEN="cli-package-manager-service",LIBRARY_VERSION="2.0.0-beta.10",API_VERSION=2,CliAliasCommandProcessor=class{constructor(){this.command="alias",this.author=DefaultLibraryAuthor,this.description="Manage aliases for commands",this.metadata={icon:"🔥",module:"misc",sealed:!0},this.stateConfiguration={initialState:{aliases:{}},storeName:"aliases"},this.userAliases={},this.processors=[{command:"ls",description:"List all aliases",processCommand:async(t,e)=>{const{writer:r}=e;r.writeln("Aliases:"),Object.entries(this.userAliases).forEach(([n,o])=>{r.writeInfo(` ${n} -> ${o}`)}),Object.keys(this.userAliases).length===0&&r.writeInfo(" No aliases defined")}}]}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.alias.long_description","Create shortcut aliases for frequently used commands")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("alias --<name>=<command>",CliForegroundColor.Cyan)} ${r.t("cli.alias.create_new","Create a new alias")}`),e.writeln(` ${e.wrapInColor("alias ls",CliForegroundColor.Cyan)} ${r.t("cli.alias.list_all","List all aliases")}`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` alias --h=help ${e.wrapInColor('# "h" → runs "help"',CliForegroundColor.Green)}`),e.writeln(` alias --cls=clear ${e.wrapInColor('# "cls" → runs "clear"',CliForegroundColor.Green)}`),e.writeln(),e.writeln(`💡 ${r.t("cli.alias.remove_hint","Use {command} to remove an alias",{command:"unalias <name>"})}`)}async processCommand(t,e){const r=e.services.get(CliProcessorsRegistry_TOKEN),{writer:n}=e,o=Object.keys(t.args);if(o.length===0){n.writeError("No aliases provided"),e.process.exit(-1);return}for(const u of o){if(r.processors.some(h=>h.command===u)){n.writeError(`${u} cannot be aliased to ${t.args[u]}`),e.process.exit(-1);return}e.writer.writeInfo(`${u} -> ${t.args[u]}`)}e.state.updateState({aliases:{...this.userAliases,...t.args}}),await e.state.persist()}async initialize(t){var e;(e=this.stateSubscription)==null||e.unsubscribe(),this.stateSubscription=t.state.select(r=>r.aliases).subscribe(r=>{this.userAliases=r??{}})}},CliCaptureCommandProcessor=class{constructor(){this.command="capture",this.description="Export terminal output to a downloadable file",this.aliases=["export-output"],this.author=DefaultLibraryAuthor,this.metadata={icon:CliIcon.Save,module:"system"},this.parameters=[{name:"format",description:"Output format: html (default) or txt",required:!1,type:"string"},{name:"filename",description:"Output filename (without extension)",required:!1,type:"string"},{name:"lines",description:"Number of recent lines to capture (default: all)",required:!1,type:"number"}]}async processCommand(t,e){var C,d,P,H,W,U;const r=((C=t.args)==null?void 0:C.format)??"html",n=((d=t.args)==null?void 0:d.filename)??`terminal-${Date.now()}`,o=(P=t.args)==null?void 0:P.lines;if(r!=="html"&&r!=="txt"){e.writer.writeError('Format must be "html" or "txt"'),e.process.exit(-1);return}const u=e.terminal,h=(H=u==null?void 0:u.buffer)==null?void 0:H.active;if(!h){e.writer.writeError("Terminal buffer is not available"),e.process.exit(-1);return}const a=h.length,l=o?Math.max(0,a-o):0,f=[];for(let L=l;L<a;L++){const N=h.getLine(L);N&&f.push(N.translateToString(!0))}if(r==="txt"){const L=f.join(`
94
- `);this.download(`${n}.txt`,L,"text/plain"),e.writer.writeSuccess(`Downloaded ${n}.txt (${f.length} lines)`)}else{const L=(U=(W=e.terminal)==null?void 0:W.options)==null?void 0:U.theme,N=this.toHtml(f,L);this.download(`${n}.html`,N,"text/html"),e.writer.writeSuccess(`Downloaded ${n}.html (${f.length} lines)`)}}sanitizeCssColor(t,e){return t&&/^[a-zA-Z0-9#(),. %]+$/.test(t)?t:e}toHtml(t,e){const r=this.sanitizeCssColor(e==null?void 0:e.background,"#0c0c0c"),n=this.sanitizeCssColor(e==null?void 0:e.foreground,"#cccccc"),o=t.map(u=>this.escapeHtml(u)).join(`
95
- `);return`<!DOCTYPE html>
96
- <html>
97
- <head>
98
- <meta charset="utf-8">
99
- <title>Terminal Output</title>
100
- <style>
101
- body { background: ${r}; color: ${n}; font-family: 'Courier New', monospace; font-size: 14px; padding: 16px; white-space: pre-wrap; word-break: break-all; }
102
- </style>
103
- </head>
104
- <body>${o}</body>
105
- </html>`}escapeHtml(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}download(t,e,r){const n=new Blob([e],{type:r}),o=URL.createObjectURL(n),u=document.createElement("a");u.href=o,u.download=t,u.click(),setTimeout(()=>URL.revokeObjectURL(o),1e3)}},CliCalCommandProcessor=class{constructor(){this.command="cal",this.aliases=["calendar"],this.description="Display a calendar",this.author=DefaultLibraryAuthor,this.metadata={icon:"📅",module:"misc"},this.parameters=[{name:"month",aliases:["m"],description:"Month (1-12)",type:"number",required:!1},{name:"year",aliases:["y"],description:"Year (e.g. 2024)",type:"number",required:!1}]}async processCommand(t,e){const{writer:r}=e,n=new Date,o=parseInt(t.args.month||t.args.m)||n.getMonth()+1,u=parseInt(t.args.year||t.args.y)||n.getFullYear();if(o<1||o>12){r.writeError("Month must be between 1 and 12"),e.process.exit(-1);return}const a=`${["January","February","March","April","May","June","July","August","September","October","November","December"][o-1]} ${u}`,l=Math.max(0,Math.floor((20-a.length)/2));r.writeln(r.wrapInColor(" ".repeat(l)+a,CliForegroundColor.Yellow)),r.writeln(r.wrapInColor("Su Mo Tu We Th Fr Sa",CliForegroundColor.Cyan));const f=new Date(u,o-1,1).getDay(),C=new Date(u,o,0).getDate(),d=n.getDate(),P=n.getMonth()+1===o&&n.getFullYear()===u;let H=" ".repeat(f);for(let W=1;W<=C;W++){const U=String(W).padStart(2);P&&W===d?H+=`\x1B[7m${U}\x1B[0m `:H+=U+" ",((f+W)%7===0||W===C)&&(r.writeln(H),H="")}}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.cal.long_description","Display a monthly calendar")),e.writeln(r.t("cli.cal.highlight_note","Current day is highlighted")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("cal",CliForegroundColor.Cyan)} ${r.t("cli.cal.current_month","Current month")}`),e.writeln(` ${e.wrapInColor("cal --month=3 --year=2024",CliForegroundColor.Cyan)} ${r.t("cli.cal.specific_month","Specific month")}`)}},CliClearCommandProcessor=class{constructor(){this.command="clear",this.aliases=["cls"],this.description="Clears the terminal",this.author=DefaultLibraryAuthor,this.metadata={icon:"🧹",module:"misc"}}async processCommand(t,e){e.terminal.clear()}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.clear.long_description","Clears all content from the terminal screen")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("clear",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(`⌨️ ${r.t("cli.clear.shortcut","Shortcut:")} ${e.wrapInColor("Ctrl+L",CliForegroundColor.Yellow)}`)}},CliClipboardCommandProcessor=class{constructor(){this.command="clipboard",this.aliases=["cb","pbcopy"],this.description="Copy to or paste from the clipboard",this.author=DefaultLibraryAuthor,this.processors=[],this.metadata={icon:"📎",module:"misc"},this.processors=[{command:"copy",aliases:["cp"],description:"Copy text to clipboard",acceptsRawInput:!0,valueRequired:!0,processCommand:async(t,e)=>{const r=t.value||t.data||"";try{await navigator.clipboard.writeText(r),e.writer.writeSuccess("Copied to clipboard")}catch{e.writer.writeError("Failed to copy. Clipboard access may be denied by the browser."),e.process.exit(-1)}},writeDescription:t=>{const{writer:e}=t;e.writeln("Copy text to the system clipboard"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("clipboard copy <text>",CliForegroundColor.Cyan)}`)}},{command:"paste",aliases:["p"],description:"Paste text from clipboard",processCommand:async(t,e)=>{try{const r=await navigator.clipboard.readText();r?(e.writer.writeln(r),e.process.output(r)):e.writer.writeInfo("Clipboard is empty")}catch{e.writer.writeError("Failed to paste. Clipboard access may be denied by the browser."),e.process.exit(-1)}},writeDescription:t=>{const{writer:e}=t;e.writeln("Read text from the system clipboard"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("clipboard paste",CliForegroundColor.Cyan)}`)}}]}async processCommand(t,e){e.executor.showHelp(t,e)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.clipboard.long_description","Copy text to or paste text from the system clipboard")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("clipboard copy <text>",CliForegroundColor.Cyan)} ${r.t("cli.clipboard.copy_desc","Copy text to clipboard")}`),e.writeln(` ${e.wrapInColor("clipboard paste",CliForegroundColor.Cyan)} ${r.t("cli.clipboard.paste_desc","Paste from clipboard")}`)}},CliColorCommandProcessor=class{constructor(){this.command="color",this.aliases=["colour"],this.description="Convert and preview colors (hex, rgb, hsl)",this.author=DefaultLibraryAuthor,this.acceptsRawInput=!0,this.valueRequired=!0,this.metadata={icon:"🎨",module:"misc"}}async processCommand(t,e){const{writer:r}=e,n=(t.value||"").trim();let o,u,h;try{if(n.startsWith("#"))[o,u,h]=this.parseHex(n);else if(n.startsWith("rgb"))[o,u,h]=this.parseRgb(n);else if(n.startsWith("hsl"))[o,u,h]=this.hslToRgb(...this.parseHsl(n));else if(/^[0-9a-fA-F]{3,8}$/.test(n))[o,u,h]=this.parseHex("#"+n);else{r.writeError("Unrecognized color format. Use hex (#ff0000), rgb(255,0,0), or hsl(0,100%,50%)"),e.process.exit(-1);return}}catch{r.writeError("Invalid color value"),e.process.exit(-1);return}const a=this.rgbToHex(o,u,h),[l,f,C]=this.rgbToHsl(o,u,h),d=`\x1B[48;2;${o};${u};${h}m \x1B[0m`;r.writeln(`${d}`),r.writeln(` ${r.wrapInColor("HEX:",CliForegroundColor.Cyan)} ${a}`),r.writeln(` ${r.wrapInColor("RGB:",CliForegroundColor.Cyan)} rgb(${o}, ${u}, ${h})`),r.writeln(` ${r.wrapInColor("HSL:",CliForegroundColor.Cyan)} hsl(${l}, ${f}%, ${C}%)`),e.process.output({hex:a,rgb:{r:o,g:u,b:h},hsl:{h:l,s:f,l:C}})}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.color.long_description","Convert between color formats and preview colors")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("color <value>",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(`📝 ${r.t("cli.color.supported_formats","Supported formats:")}`),e.writeln(` color #ff6600 ${e.wrapInColor("# Hex",CliForegroundColor.Green)}`),e.writeln(` color ff6600 ${e.wrapInColor("# Hex without #",CliForegroundColor.Green)}`),e.writeln(` color rgb(255,102,0) ${e.wrapInColor("# RGB",CliForegroundColor.Green)}`),e.writeln(` color hsl(24,100%,50%) ${e.wrapInColor("# HSL",CliForegroundColor.Green)}`)}parseHex(t){return t=t.replace("#",""),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]}parseRgb(t){const e=t.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(!e)throw new Error("Invalid RGB");return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}parseHsl(t){const e=t.match(/(\d+)\s*,\s*(\d+)%?\s*,\s*(\d+)%?/);if(!e)throw new Error("Invalid HSL");return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}rgbToHex(t,e,r){return"#"+[t,e,r].map(n=>n.toString(16).padStart(2,"0")).join("")}rgbToHsl(t,e,r){t/=255,e/=255,r/=255;const n=Math.max(t,e,r),o=Math.min(t,e,r);let u=0,h=0;const a=(n+o)/2;if(n!==o){const l=n-o;switch(h=a>.5?l/(2-n-o):l/(n+o),n){case t:u=((e-r)/l+(e<r?6:0))/6;break;case e:u=((r-t)/l+2)/6;break;case r:u=((t-e)/l+4)/6;break}}return[Math.round(u*360),Math.round(h*100),Math.round(a*100)]}hslToRgb(t,e,r){t/=360,e/=100,r/=100;let n,o,u;if(e===0)n=o=u=r;else{const h=(f,C,d)=>(d<0&&(d+=1),d>1&&(d-=1),d<.16666666666666666?f+(C-f)*6*d:d<.5?C:d<.6666666666666666?f+(C-f)*(.6666666666666666-d)*6:f),a=r<.5?r*(1+e):r+e-r*e,l=2*r-a;n=h(l,a,t+1/3),o=h(l,a,t),u=h(l,a,t-1/3)}return[Math.round(n*255),Math.round(o*255),Math.round(u*255)]}},lengthUnits={m:{m:1,km:.001,cm:100,mm:1e3,mi:621371e-9,ft:3.28084,in:39.3701,yd:1.09361},km:{m:1e3,km:1,cm:1e5,mm:1e6,mi:.621371,ft:3280.84,in:39370.1,yd:1093.61},cm:{m:.01,km:1e-5,cm:1,mm:10,mi:621371e-11,ft:.0328084,in:.393701,yd:.0109361},mm:{m:.001,km:1e-6,cm:.1,mm:1,mi:62137e-11,ft:.00328084,in:.0393701,yd:.00109361},mi:{m:1609.34,km:1.60934,cm:160934,mm:1609340,mi:1,ft:5280,in:63360,yd:1760},ft:{m:.3048,km:3048e-7,cm:30.48,mm:304.8,mi:189394e-9,ft:1,in:12,yd:.333333},in:{m:.0254,km:254e-7,cm:2.54,mm:25.4,mi:157828e-10,ft:.0833333,in:1,yd:.0277778},yd:{m:.9144,km:9144e-7,cm:91.44,mm:914.4,mi:568182e-9,ft:3,in:36,yd:1}},weightUnits={kg:{kg:1,g:1e3,mg:1e6,lb:2.20462,oz:35.274,t:.001},g:{kg:.001,g:1,mg:1e3,lb:.00220462,oz:.035274,t:1e-6},mg:{kg:1e-6,g:.001,mg:1,lb:220462e-11,oz:35274e-9,t:1e-9},lb:{kg:.453592,g:453.592,mg:453592,lb:1,oz:16,t:453592e-9},oz:{kg:.0283495,g:28.3495,mg:28349.5,lb:.0625,oz:1,t:283495e-10},t:{kg:1e3,g:1e6,mg:1e9,lb:2204.62,oz:35274,t:1}},dataUnits={b:{b:1,kb:1/1024,mb:1/1024**2,gb:1/1024**3,tb:1/1024**4},kb:{b:1024,kb:1,mb:1/1024,gb:1/1024**2,tb:1/1024**3},mb:{b:1024**2,kb:1024,mb:1,gb:1/1024,tb:1/1024**2},gb:{b:1024**3,kb:1024**2,mb:1024,gb:1,tb:1/1024},tb:{b:1024**4,kb:1024**3,mb:1024**2,gb:1024,tb:1}},categories=[{name:"length",units:lengthUnits,unitNames:{m:"meters",km:"kilometers",cm:"centimeters",mm:"millimeters",mi:"miles",ft:"feet",in:"inches",yd:"yards"}},{name:"weight",units:weightUnits,unitNames:{kg:"kilograms",g:"grams",mg:"milligrams",lb:"pounds",oz:"ounces",t:"tonnes"}},{name:"data",units:dataUnits,unitNames:{b:"bytes",kb:"kilobytes",mb:"megabytes",gb:"gigabytes",tb:"terabytes"}}],CliConvertCommandProcessor=class{constructor(){this.command="convert",this.aliases=["conv"],this.description="Convert between units (length, weight, temperature, data)",this.author=DefaultLibraryAuthor,this.acceptsRawInput=!0,this.valueRequired=!0,this.metadata={icon:"📐",module:"misc"}}async processCommand(t,e){const{writer:r}=e,o=(t.value||"").trim().match(/^([\d.]+)\s*([a-zA-Z°]+)\s+(?:to\s+)?([a-zA-Z°]+)$/i);if(!o){r.writeError("Usage: convert <value> <from> to <to>"),r.writeInfo("Example: convert 100 km to mi"),e.process.exit(-1);return}const u=parseFloat(o[1]),h=o[2].toLowerCase(),a=o[3].toLowerCase();if(isNaN(u)){r.writeError("Invalid number"),e.process.exit(-1);return}if(this.isTemperatureUnit(h)&&this.isTemperatureUnit(a)){const l=this.convertTemperature(u,h,a);if(l!==null){const f=Math.round(l*1e3)/1e3;r.writeln(` ${u} ${this.tempLabel(h)} = ${r.wrapInColor(String(f),CliForegroundColor.Cyan)} ${this.tempLabel(a)}`),e.process.output(f);return}}for(const l of categories)if(l.units[h]&&l.units[h][a]!==void 0){const f=u*l.units[h][a],C=Math.round(f*1e6)/1e6,d=l.unitNames[h]||h,P=l.unitNames[a]||a;r.writeln(` ${u} ${d} = ${r.wrapInColor(String(C),CliForegroundColor.Cyan)} ${P}`),e.process.output(C);return}r.writeError(`Cannot convert from "${h}" to "${a}"`),r.writeln(),r.writeInfo("Supported units:"),r.writeln(" Length: m, km, cm, mm, mi, ft, in, yd"),r.writeln(" Weight: kg, g, mg, lb, oz, t"),r.writeln(" Temperature: c, f, k"),r.writeln(" Data: b, kb, mb, gb, tb"),e.process.exit(-1)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.convert.long_description","Convert between various units of measurement")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("convert <value> <from> to <to>",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` convert 100 km to mi ${e.wrapInColor("# → 62.1371 miles",CliForegroundColor.Green)}`),e.writeln(` convert 72 f to c ${e.wrapInColor("# → 22.222 celsius",CliForegroundColor.Green)}`),e.writeln(` convert 1024 mb to gb ${e.wrapInColor("# → 1 gigabytes",CliForegroundColor.Green)}`),e.writeln(` convert 5.5 lb to kg ${e.wrapInColor("# → 2.494 kilograms",CliForegroundColor.Green)}`),e.writeln(),e.writeln(`📐 ${r.t("cli.convert.supported","Supported:")}`),e.writeln(" Length: m, km, cm, mm, mi, ft, in, yd"),e.writeln(" Weight: kg, g, mg, lb, oz, t"),e.writeln(" Temperature: c, f, k"),e.writeln(" Data: b, kb, mb, gb, tb")}isTemperatureUnit(t){return["c","f","k","°c","°f","°k"].includes(t)}tempLabel(t){const e=t.replace("°","");return{c:"°C",f:"°F",k:"K"}[e]||t}convertTemperature(t,e,r){const n=e.replace("°",""),o=r.replace("°","");let u;switch(n){case"c":u=t;break;case"f":u=(t-32)*5/9;break;case"k":u=t-273.15;break;default:return null}switch(o){case"c":return u;case"f":return u*9/5+32;case"k":return u+273.15;default:return null}}},CliEchoCommandProcessor=class{constructor(){this.command="echo",this.aliases=["print"],this.description="Prints the specified text",this.acceptsRawInput=!0,this.author=DefaultLibraryAuthor,this.metadata={icon:"📢",module:"misc"}}async processCommand(t,e){const r=t.value||t.data||"";if(typeof r=="object")e.writer.writeJson(r),e.process.output(r);else{const n=this.interpretEscapes(this.stripQuotes(r));e.writer.writeln(n),e.process.output(n)}}stripQuotes(t){return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}interpretEscapes(t){return t.replace(/\\([\\nrtv0])/g,(e,r)=>{switch(r){case"n":return`
106
- `;case"t":return" ";case"r":return"\r";case"v":return"\v";case"0":return"\0";case"\\":return"\\";default:return r}})}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.echo.long_description","Prints the specified text to the terminal")),e.writeln(r.t("cli.echo.piping_note","Supports text and JSON object output via piping")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("echo <text>",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` echo Hello World ${e.wrapInColor("# Print text",CliForegroundColor.Green)}`),e.writeln(` echo "Hello, World!" ${e.wrapInColor("# Print quoted text",CliForegroundColor.Green)}`)}},CliEvalCommandProcessor=class{constructor(){this.command="eval",this.aliases=["calc","js"],this.description="Evaluate a JavaScript expression",this.author=DefaultLibraryAuthor,this.acceptsRawInput=!0,this.metadata={icon:"🧮",module:"misc"}}async processCommand(command,context){var t;if(!((t=context.options)!=null&&t.allowEval)){context.writer.writeError("eval is disabled by default for security. Set allowEval: true in CliOptions to enable it."),context.process.exit(1,{silent:!0});return}try{const output=eval(command.value??"");if(Array.isArray(output)){context.writer.writeln("Output:"),context.writer.writeJson(output);return}if(typeof output=="object"){context.writer.writeln("Output:"),context.writer.writeJson(output);return}context.writer.writeln("Output: "+(output==null?void 0:output.toString()))}catch(e){context.writer.writeError(e.toString())}}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.eval.long_description",this.description)),e.writeln(r.t("cli.eval.supports","Supports arithmetic, strings, arrays, objects, and any valid JS")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("eval <expression>",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` eval 1 + 1 ${e.wrapInColor("# → 2",CliForegroundColor.Green)}`),e.writeln(` eval "Hello, " + "World!" ${e.wrapInColor("# → Hello, World!",CliForegroundColor.Green)}`),e.writeln(` eval Math.random() ${e.wrapInColor("# → 0.1234...",CliForegroundColor.Green)}`),e.writeln(` eval [1,2,3].map(x => x * 2) ${e.wrapInColor("# → [2, 4, 6]",CliForegroundColor.Green)}`)}},CliJsonCommandProcessor=class{constructor(){this.command="json",this.description="Format, minify, or validate JSON",this.author=DefaultLibraryAuthor,this.processors=[],this.metadata={icon:"📋",module:"misc"},this.processors=[{command:"format",aliases:["fmt","pretty"],description:"Pretty-print JSON with indentation",acceptsRawInput:!0,valueRequired:!0,processCommand:async(t,e)=>{const r=t.value||t.data||"";try{const n=typeof r=="object"?r:JSON.parse(r),o=JSON.stringify(n,null,2);e.writer.writeln(o),e.process.output(o)}catch{e.writer.writeError("Invalid JSON input"),e.process.exit(-1)}},writeDescription:t=>{const{writer:e}=t;e.writeln("Pretty-print JSON with 2-space indentation"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("json format <json>",CliForegroundColor.Cyan)}`)}},{command:"minify",aliases:["min"],description:"Minify JSON by removing whitespace",acceptsRawInput:!0,valueRequired:!0,processCommand:async(t,e)=>{const r=t.value||t.data||"";try{const n=typeof r=="object"?r:JSON.parse(r),o=JSON.stringify(n);e.writer.writeln(o),e.process.output(o)}catch{e.writer.writeError("Invalid JSON input"),e.process.exit(-1)}},writeDescription:t=>{const{writer:e}=t;e.writeln("Minify JSON by removing all unnecessary whitespace"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("json minify <json>",CliForegroundColor.Cyan)}`)}},{command:"validate",aliases:["check"],description:"Validate whether a string is valid JSON",acceptsRawInput:!0,valueRequired:!0,processCommand:async(t,e)=>{const r=t.value||t.data||"";try{JSON.parse(r),e.writer.writeSuccess("Valid JSON")}catch(n){e.writer.writeError(`Invalid JSON: ${n.message}`),e.process.exit(-1)}},writeDescription:t=>{const{writer:e}=t;e.writeln("Check whether a string is valid JSON"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("json validate <json>",CliForegroundColor.Cyan)}`)}}]}async processCommand(t,e){e.executor.showHelp(t,e)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.json.long_description","Format, minify, or validate JSON strings")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("json format <json>",CliForegroundColor.Cyan)} ${r.t("cli.json.format_desc","Pretty-print JSON")}`),e.writeln(` ${e.wrapInColor("json minify <json>",CliForegroundColor.Cyan)} ${r.t("cli.json.minify_desc","Remove whitespace")}`),e.writeln(` ${e.wrapInColor("json validate <json>",CliForegroundColor.Cyan)} ${r.t("cli.json.validate_desc","Check if valid JSON")}`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` json format {"a":1,"b":2} ${e.wrapInColor("# Pretty-print",CliForegroundColor.Green)}`),e.writeln(` json validate {"valid":true} ${e.wrapInColor("# Check validity",CliForegroundColor.Green)}`)}},LOREM_WORDS=["lorem","ipsum","dolor","sit","amet","consectetur","adipiscing","elit","sed","do","eiusmod","tempor","incididunt","ut","labore","et","dolore","magna","aliqua","enim","ad","minim","veniam","quis","nostrud","exercitation","ullamco","laboris","nisi","aliquip","ex","ea","commodo","consequat","duis","aute","irure","in","reprehenderit","voluptate","velit","esse","cillum","fugiat","nulla","pariatur","excepteur","sint","occaecat","cupidatat","non","proident","sunt","culpa","qui","officia","deserunt","mollit","anim","id","est","laborum"],CliLoremCommandProcessor=class{constructor(){this.command="lorem",this.aliases=["lipsum"],this.description="Generate lorem ipsum placeholder text",this.author=DefaultLibraryAuthor,this.processors=[],this.metadata={icon:"📝",module:"misc"},this.processors=[{command:"words",aliases:["w"],description:"Generate a number of words",parameters:[{name:"count",aliases:["n"],description:"Number of words (default: 10)",type:"number",required:!1}],processCommand:async(t,e)=>{const r=Math.min(parseInt(t.args.count||t.args.n)||10,1e3),n=this.generateWords(r);e.writer.writeln(n),e.process.output(n)},writeDescription:t=>{const{writer:e}=t;e.writeln("Generate a specific number of lorem ipsum words"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("lorem words [--count=N]",CliForegroundColor.Cyan)}`)}},{command:"sentences",aliases:["s"],description:"Generate a number of sentences",parameters:[{name:"count",aliases:["n"],description:"Number of sentences (default: 3)",type:"number",required:!1}],processCommand:async(t,e)=>{const r=Math.min(parseInt(t.args.count||t.args.n)||3,50),n=[];for(let u=0;u<r;u++){const h=Math.floor(Math.random()*10)+5,a=this.generateWords(h);n.push(a.charAt(0).toUpperCase()+a.slice(1)+".")}const o=n.join(" ");e.writer.writeln(o),e.process.output(o)},writeDescription:t=>{const{writer:e}=t;e.writeln("Generate lorem ipsum sentences"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("lorem sentences [--count=N]",CliForegroundColor.Cyan)}`)}},{command:"paragraphs",aliases:["p"],description:"Generate a number of paragraphs",parameters:[{name:"count",aliases:["n"],description:"Number of paragraphs (default: 1)",type:"number",required:!1}],processCommand:async(t,e)=>{const r=Math.min(parseInt(t.args.count||t.args.n)||1,20),n=[];for(let u=0;u<r;u++){const h=Math.floor(Math.random()*4)+3,a=[];for(let l=0;l<h;l++){const f=Math.floor(Math.random()*10)+5,C=this.generateWords(f);a.push(C.charAt(0).toUpperCase()+C.slice(1)+".")}n.push(a.join(" "))}const o=n.join(`
107
-
108
- `);e.writer.writeln(o),e.process.output(o)},writeDescription:t=>{const{writer:e}=t;e.writeln("Generate lorem ipsum paragraphs"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("lorem paragraphs [--count=N]",CliForegroundColor.Cyan)}`)}}]}async processCommand(t,e){e.executor.showHelp(t,e)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.lorem.long_description","Generate lorem ipsum placeholder text")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("lorem words [--count=N]",CliForegroundColor.Cyan)} ${r.t("cli.lorem.gen_words","Generate words")}`),e.writeln(` ${e.wrapInColor("lorem sentences [--count=N]",CliForegroundColor.Cyan)} ${r.t("cli.lorem.gen_sentences","Generate sentences")}`),e.writeln(` ${e.wrapInColor("lorem paragraphs [--count=N]",CliForegroundColor.Cyan)} ${r.t("cli.lorem.gen_paragraphs","Generate paragraphs")}`)}generateWords(t){const e=[];for(let r=0;r<t;r++)e.push(LOREM_WORDS[Math.floor(Math.random()*LOREM_WORDS.length)]);return e.join(" ")}},CliOpenCommandProcessor=class{constructor(){this.command="open",this.description="Open a URL in a new browser tab",this.author=DefaultLibraryAuthor,this.acceptsRawInput=!0,this.valueRequired=!0,this.metadata={icon:"🌐",module:"misc"}}async processCommand(t,e){let r=t.value||"";!r.startsWith("http://")&&!r.startsWith("https://")&&(r="https://"+r);try{new URL(r)}catch{e.writer.writeError(`Invalid URL: ${t.value}`),e.process.exit(-1);return}window.open(r,"_blank")?e.writer.writeSuccess(`Opened ${e.writer.wrapInColor(r,CliForegroundColor.Blue)}`):(e.writer.writeError("Failed to open URL. Pop-ups may be blocked by the browser."),e.process.exit(-1))}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.open.long_description","Open a URL in a new browser tab")),e.writeln(r.t("cli.open.auto_https","Automatically adds https:// if no protocol is specified")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("open <url>",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` open google.com ${e.wrapInColor("# Opens https://google.com",CliForegroundColor.Green)}`),e.writeln(` open https://github.com ${e.wrapInColor("# Opens GitHub",CliForegroundColor.Green)}`)}},CliRandomCommandProcessor=class{constructor(){this.command="random",this.aliases=["rand"],this.description="Generate random values",this.author=DefaultLibraryAuthor,this.processors=[],this.metadata={icon:"🎲",module:"misc"},this.processors=[{command:"number",aliases:["num"],description:"Generate a random number",parameters:[{name:"min",description:"Minimum value (default: 0)",type:"number",required:!1},{name:"max",description:"Maximum value (default: 100)",type:"number",required:!1},{name:"count",aliases:["n"],description:"How many numbers to generate (default: 1)",type:"number",required:!1}],processCommand:async(t,e)=>{const r=parseInt(t.args.min)||0,n=parseInt(t.args.max)||100,o=Math.min(parseInt(t.args.count||t.args.n)||1,100),u=[];for(let a=0;a<o;a++)u.push(Math.floor(Math.random()*(n-r+1))+r);const h=u.join(", ");e.writer.writeln(h),e.process.output(u.length===1?u[0]:u)},writeDescription:t=>{const{writer:e}=t;e.writeln("Generate random numbers within a range"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("random number [--min=N] [--max=N] [--count=N]",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(`📝 ${t.translator.t("cli.common.examples","Examples:")}`),e.writeln(` random number ${e.wrapInColor("# 0-100",CliForegroundColor.Green)}`),e.writeln(` random number --min=1 --max=6 ${e.wrapInColor("# Dice roll",CliForegroundColor.Green)}`),e.writeln(` random number --count=5 ${e.wrapInColor("# 5 numbers",CliForegroundColor.Green)}`)}},{command:"string",aliases:["str"],description:"Generate a random string",parameters:[{name:"length",aliases:["l"],description:"String length (default: 16)",type:"number",required:!1},{name:"charset",description:"Character set: alphanumeric, alpha, numeric, hex (default: alphanumeric)",type:"string",required:!1}],processCommand:async(t,e)=>{const r=Math.min(parseInt(t.args.length||t.args.l)||16,1024),n=t.args.charset||"alphanumeric",o={alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",alpha:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",numeric:"0123456789",hex:"0123456789abcdef"},u=o[n];if(!u){e.writer.writeError(`Unknown charset: ${n}. Available: ${Object.keys(o).join(", ")}`),e.process.exit(-1);return}const h=new Uint32Array(r);crypto.getRandomValues(h);const a=Array.from(h).map(l=>u[l%u.length]).join("");e.writer.writeln(a),e.process.output(a)},writeDescription:t=>{const{writer:e}=t;e.writeln("Generate a cryptographically random string"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("random string [--length=N] [--charset=TYPE]",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(` Charsets: ${e.wrapInColor("alphanumeric, alpha, numeric, hex",CliForegroundColor.Yellow)}`)}},{command:"uuid",description:"Generate a random UUID v4",processCommand:async(t,e)=>{const r=crypto.randomUUID();e.writer.writeln(r),e.process.output(r)},writeDescription:t=>{const{writer:e}=t;e.writeln("Generate a cryptographically random UUID v4"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("random uuid",CliForegroundColor.Cyan)}`)}},{command:"coin",aliases:["flip"],description:"Flip a coin",processCommand:async(t,e)=>{const r=Math.random()<.5?"Heads":"Tails";e.writer.writeln(`🪙 ${r}`),e.process.output(r)}},{command:"dice",aliases:["roll"],description:"Roll a dice",parameters:[{name:"sides",aliases:["s"],description:"Number of sides (default: 6)",type:"number",required:!1}],processCommand:async(t,e)=>{const r=parseInt(t.args.sides||t.args.s)||6,n=Math.floor(Math.random()*r)+1;e.writer.writeln(`🎲 ${n}`),e.process.output(n)}}]}async processCommand(t,e){e.executor.showHelp(t,e)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.random.long_description","Generate random numbers, strings, UUIDs, and more")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("random number",CliForegroundColor.Cyan)} ${r.t("cli.random.number_desc","Random number (0-100)")}`),e.writeln(` ${e.wrapInColor("random string",CliForegroundColor.Cyan)} ${r.t("cli.random.string_desc","Random string (16 chars)")}`),e.writeln(` ${e.wrapInColor("random uuid",CliForegroundColor.Cyan)} ${r.t("cli.random.uuid_desc","Random UUID v4")}`),e.writeln(` ${e.wrapInColor("random coin",CliForegroundColor.Cyan)} ${r.t("cli.random.coin_desc","Flip a coin")}`),e.writeln(` ${e.wrapInColor("random dice",CliForegroundColor.Cyan)} ${r.t("cli.random.dice_desc","Roll a dice")}`)}},CliScreenCommandProcessor=class{constructor(){this.command="screen",this.aliases=["display"],this.description="Display screen and terminal information",this.author=DefaultLibraryAuthor,this.metadata={icon:"🖥️",module:"misc"}}async processCommand(t,e){var o;const{writer:r}=e;function n(u,h){r.writeln(` ${r.wrapInColor(u.padEnd(22),CliForegroundColor.Cyan)} ${h}`)}r.writeln(r.wrapInColor("🖥️ Screen:",CliForegroundColor.Yellow)),n("Resolution:",`${screen.width} x ${screen.height}`),n("Available:",`${screen.availWidth} x ${screen.availHeight}`),n("Color Depth:",`${screen.colorDepth}-bit`),n("Pixel Ratio:",`${window.devicePixelRatio}x`),n("Orientation:",((o=screen.orientation)==null?void 0:o.type)||"unknown"),r.writeln(),r.writeln(r.wrapInColor("🪟 Viewport:",CliForegroundColor.Yellow)),n("Inner Size:",`${window.innerWidth} x ${window.innerHeight}`),n("Outer Size:",`${window.outerWidth} x ${window.outerHeight}`),r.writeln(),r.writeln(r.wrapInColor("📟 Terminal:",CliForegroundColor.Yellow)),n("Columns:",`${e.terminal.cols}`),n("Rows:",`${e.terminal.rows}`)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.screen.long_description","Display screen, viewport, and terminal dimensions")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("screen",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(`📝 ${r.t("cli.screen.shows","Shows: resolution, color depth, pixel ratio, viewport size, terminal size")}`)}},CliSeqCommandProcessor=class{constructor(){this.command="seq",this.aliases=["sequence"],this.description="Print a sequence of numbers",this.author=DefaultLibraryAuthor,this.acceptsRawInput=!0,this.valueRequired=!0,this.metadata={icon:"🔢",module:"misc"},this.parameters=[{name:"step",aliases:["s"],description:"Step increment (default: 1)",type:"number",required:!1},{name:"separator",aliases:["sep"],description:"Separator between numbers (default: newline)",type:"string",required:!1}]}async processCommand(t,e){const{writer:r}=e,n=(t.value||"").split(/\s+/).map(Number);let o,u;const h=parseFloat(t.args.step||t.args.s)||1,a=t.args.separator||t.args.sep||`
109
- `;if(n.length===1)o=1,u=n[0];else if(n.length>=2)o=n[0],u=n[1];else{r.writeError("Usage: seq <end> or seq <start> <end>"),e.process.exit(-1);return}if(isNaN(o)||isNaN(u)){r.writeError("Invalid numbers"),e.process.exit(-1);return}const l=1e4,f=[];if(h>0)for(let C=o;C<=u&&f.length<l;C+=h)f.push(C);else if(h<0)for(let C=o;C>=u&&f.length<l;C+=h)f.push(C);else{r.writeError("Step cannot be 0"),e.process.exit(-1);return}r.writeln(f.join(a)),e.process.output(f)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.seq.long_description","Print a sequence of numbers")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("seq <end>",CliForegroundColor.Cyan)} ${r.t("cli.seq.numbers_to_end","Numbers from 1 to end")}`),e.writeln(` ${e.wrapInColor("seq <start> <end>",CliForegroundColor.Cyan)} ${r.t("cli.seq.numbers_range","Numbers from start to end")}`),e.writeln(` ${e.wrapInColor("seq <start> <end> --step=N",CliForegroundColor.Cyan)} ${r.t("cli.seq.with_step","With custom step")}`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` seq 5 ${e.wrapInColor("# 1, 2, 3, 4, 5",CliForegroundColor.Green)}`),e.writeln(` seq 2 10 --step=2 ${e.wrapInColor("# 2, 4, 6, 8, 10",CliForegroundColor.Green)}`),e.writeln(` seq 1 5 --sep=", " ${e.wrapInColor("# 1, 2, 3, 4, 5",CliForegroundColor.Green)}`)}},CliSleepCommandProcessor=class{constructor(){this.command="sleep",this.aliases=["wait"],this.description="Sleep for a specified amount of time",this.author=DefaultLibraryAuthor,this.metadata={sealed:!0,module:"misc",icon:CliIcon.Timer},this.valueRequired=!0}async processCommand(t,e){const{writer:r,onAbort:n}=e,o=parseInt(t.value);if(isNaN(o)||o<0){r.writeError(`Invalid time value: "${t.value}". Please provide a positive number in milliseconds.`);return}let u=!1;await new Promise(h=>{const a=setTimeout(()=>{l.unsubscribe(),h()},o),l=n.subscribe(()=>{clearTimeout(a),u=!0,h()})}),u||r.writeInfo(`Slept for ${o}ms`)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.sleep.long_description","Pauses execution for the specified duration (in milliseconds)")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("sleep <milliseconds>",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` sleep 1000 ${e.wrapInColor("# Sleep for 1 second",CliForegroundColor.Green)}`),e.writeln(` sleep 5000 ${e.wrapInColor("# Sleep for 5 seconds",CliForegroundColor.Green)}`)}},CliTimeCommandProcessor=class{constructor(){this.command="time",this.aliases=["date"],this.description="Display the current local and UTC time",this.author=DefaultLibraryAuthor,this.version=LIBRARY_VERSION,this.processors=[],this.metadata={sealed:!0,module:"misc",icon:CliIcon.Timer},this.processors=[{command:"now",description:"Display the current time",processCommand:async(t,e)=>{const r=new Date,n=r.toLocaleString(),o=r.toUTCString();e.writer.writeSuccess(`🕒 Local Time: ${e.writer.wrapInColor(n,CliForegroundColor.White)}`),e.writer.writeSuccess(`🌐 UTC Time: ${e.writer.wrapInColor(o,CliForegroundColor.White)}`),e.process.output(r)}}]}async processCommand(t,e){e.executor.showHelp(t,e)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.time.long_description","Display the current local and UTC time")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("time now",CliForegroundColor.Cyan)} 🕒 ${r.t("cli.time.show_current","Show current local and UTC time")}`)}},CliTimestampCommandProcessor=class{constructor(){this.command="timestamp",this.aliases=["ts","epoch"],this.description="Convert between Unix timestamps and dates",this.author=DefaultLibraryAuthor,this.processors=[],this.metadata={icon:"🕐",module:"misc"},this.processors=[{command:"now",description:"Show current Unix timestamp",processCommand:async(t,e)=>{const{writer:r}=e,n=Date.now(),o=Math.floor(n/1e3);r.writeln(` ${r.wrapInColor("Seconds:",CliForegroundColor.Cyan)} ${o}`),r.writeln(` ${r.wrapInColor("Milliseconds:",CliForegroundColor.Cyan)} ${n}`),e.process.output(o)}},{command:"to-date",aliases:["todate","parse"],description:"Convert a Unix timestamp to a date",acceptsRawInput:!0,valueRequired:!0,processCommand:async(t,e)=>{const{writer:r}=e;let n=parseInt(t.value||"");if(isNaN(n)){r.writeError("Invalid timestamp"),e.process.exit(-1);return}n<1e12&&(n*=1e3);const o=new Date(n);r.writeln(` ${r.wrapInColor("Local:",CliForegroundColor.Cyan)} ${o.toLocaleString()}`),r.writeln(` ${r.wrapInColor("UTC:",CliForegroundColor.Cyan)} ${o.toUTCString()}`),r.writeln(` ${r.wrapInColor("ISO:",CliForegroundColor.Cyan)} ${o.toISOString()}`),e.process.output(o.toISOString())},writeDescription:t=>{const{writer:e}=t;e.writeln("Convert a Unix timestamp to a human-readable date"),e.writeln("Auto-detects seconds vs milliseconds"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("timestamp to-date <timestamp>",CliForegroundColor.Cyan)}`)}},{command:"from-date",aliases:["fromdate"],description:"Convert a date string to a Unix timestamp",acceptsRawInput:!0,valueRequired:!0,processCommand:async(t,e)=>{const{writer:r}=e,n=t.value||"",o=new Date(n);if(isNaN(o.getTime())){r.writeError(`Invalid date: ${n}`),e.process.exit(-1);return}const u=Math.floor(o.getTime()/1e3);r.writeln(` ${r.wrapInColor("Seconds:",CliForegroundColor.Cyan)} ${u}`),r.writeln(` ${r.wrapInColor("Milliseconds:",CliForegroundColor.Cyan)} ${o.getTime()}`),e.process.output(u)},writeDescription:t=>{const{writer:e}=t;e.writeln("Convert a date string to a Unix timestamp"),e.writeln(),e.writeln(`📋 ${t.translator.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("timestamp from-date <date>",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(`📝 ${t.translator.t("cli.common.examples","Examples:")}`),e.writeln(` timestamp from-date 2024-01-01 ${e.wrapInColor("# ISO date",CliForegroundColor.Green)}`),e.writeln(` timestamp from-date "Jan 1, 2024 12:00" ${e.wrapInColor("# Human-readable",CliForegroundColor.Green)}`)}}]}async processCommand(t,e){e.executor.showHelp(t,e)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.timestamp.long_description","Convert between Unix timestamps and human-readable dates")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("timestamp now",CliForegroundColor.Cyan)} ${r.t("cli.timestamp.current","Current Unix timestamp")}`),e.writeln(` ${e.wrapInColor("timestamp to-date <ts>",CliForegroundColor.Cyan)} ${r.t("cli.timestamp.to_date","Timestamp to date")}`),e.writeln(` ${e.wrapInColor("timestamp from-date <date>",CliForegroundColor.Cyan)} ${r.t("cli.timestamp.from_date","Date to timestamp")}`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` timestamp to-date 1704067200 ${e.wrapInColor("# → Jan 1, 2024",CliForegroundColor.Green)}`),e.writeln(` timestamp from-date 2024-01-01 ${e.wrapInColor("# → 1704067200",CliForegroundColor.Green)}`)}},CliUnAliasCommandProcessor=class{constructor(){this.command="unalias",this.author=DefaultLibraryAuthor,this.description="Remove aliases for commands",this.valueRequired=!0,this.stateConfiguration={initialState:{},storeName:"aliases"},this.metadata={icon:"🔥",module:"misc",sealed:!0}}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.unalias.long_description","Remove a previously defined command alias")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("unalias <name>",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` unalias h ${e.wrapInColor('# Remove the "h" alias',CliForegroundColor.Green)}`),e.writeln(` unalias cls ${e.wrapInColor('# Remove the "cls" alias',CliForegroundColor.Green)}`)}async processCommand(t,e){const{writer:r}=e,n=t.value,{aliases:o}=e.state.getState();if(!o[n]){r.writeError(`Alias ${n} not found`),e.process.exit(-1);return}const u={};Object.keys(o).filter(h=>h!==n).forEach(h=>{u[h]=o[h]}),e.state.updateState({aliases:u}),await e.state.persist()}},CliUnameCommandProcessor=class{constructor(){this.command="uname",this.aliases=["sysinfo"],this.description="Prints detailed system and browser information",this.author=DefaultLibraryAuthor,this.metadata={sealed:!0,icon:CliIcon.Flame,module:"misc"}}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.uname.long_description","Prints detailed system and browser information including:")),e.writeln(` 💾 ${r.t("cli.uname.cli_versions","CLI core and library versions")}`),e.writeln(` 🌐 ${r.t("cli.uname.browser_info","Browser name, version, user agent, language, and platform")}`),e.writeln(` 🖥 ${r.t("cli.uname.os","Operating system")}`),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("uname",CliForegroundColor.Cyan)}`)}async processCommand(t,e){const{writer:r}=e;function n(o,u){r.writeln(`- ${r.wrapInColor(o,CliForegroundColor.Cyan)}: ${u}`)}if(r.writeInfo("CLI:"),n("Core version",LIBRARY_VERSION$1),n("Cli version",LIBRARY_VERSION),r.writeln(),typeof navigator<"u"){r.writeInfo("Browser Information:"),n("User Agent",navigator.userAgent),n("Language",navigator.language),n("Platform",navigator.platform);const o=this.parseUserAgent(navigator.userAgent);n("Browser",o.browserName),n("Version",o.version),n("OS",o.os)}else r.writeError("Browser information is not available in this environment.")}parseUserAgent(t){var o,u,h,a;let e="Unknown",r="Unknown",n="Unknown";return t.includes("Chrome")?(e="Chrome",r=((o=t.match(/Chrome\/([\d.]+)/))==null?void 0:o[1])||"Unknown"):t.includes("Firefox")?(e="Firefox",r=((u=t.match(/Firefox\/([\d.]+)/))==null?void 0:u[1])||"Unknown"):t.includes("Safari")&&!t.includes("Chrome")?(e="Safari",r=((h=t.match(/Version\/([\d.]+)/))==null?void 0:h[1])||"Unknown"):(t.includes("MSIE")||t.includes("Trident"))&&(e="Internet Explorer",r=((a=t.match(/(?:MSIE |rv:)([\d.]+)/))==null?void 0:a[1])||"Unknown"),t.includes("Windows")?n="Windows":t.includes("Mac OS")?n="Mac OS":t.includes("Linux")?n="Linux":t.includes("Android")?n="Android":(t.includes("iPhone")||t.includes("iPad"))&&(n="iOS"),{browserName:e,version:r,os:n}}},CliUptimeCommandProcessor=class{constructor(){this.command="uptime",this.description="Show session uptime",this.author=DefaultLibraryAuthor,this.metadata={icon:"⏱️",module:"misc"}}async initialize(t){try{t.backgroundServices.register({name:"uptime-tracker",description:"Tracks terminal session uptime",type:"daemon",onStart:async e=>{e.log("Uptime tracking started"),await new Promise(r=>{e.signal.addEventListener("abort",()=>r(),{once:!0})}),e.log("Uptime tracking stopped")}}),await t.backgroundServices.start("uptime-tracker")}catch{}}async processCommand(t,e){const r=e.backgroundServices.getStatus("uptime-tracker"),{writer:n}=e;if(!r||r.status!=="running"){n.writeError("Uptime tracker is not running."),n.writeInfo(`Use ${n.wrapInColor("services start uptime-tracker",CliForegroundColor.Cyan)} to restart.`);return}const o=r.startedAt.getTime(),u=Date.now()-o,h=Math.floor(u/1e3)%60,a=Math.floor(u/(1e3*60))%60,l=Math.floor(u/(1e3*60*60))%24,f=Math.floor(u/(1e3*60*60*24)),C=[];f>0&&C.push(`${f}d`),l>0&&C.push(`${l}h`),a>0&&C.push(`${a}m`),C.push(`${h}s`);const d=C.join(" "),P=new Date(o).toLocaleString();n.writeln(`⏱️ Uptime: ${n.wrapInColor(d,CliForegroundColor.Cyan)}`),n.writeln(`📅 Started: ${n.wrapInColor(P,CliForegroundColor.Green)}`)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.uptime.long_description","Show how long the current terminal session has been active")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("uptime",CliForegroundColor.Cyan)}`)}},CliYesCommandProcessor=class{constructor(){this.command="yes",this.description="Output a string repeatedly",this.author=DefaultLibraryAuthor,this.acceptsRawInput=!0,this.metadata={icon:"✅",module:"misc"},this.parameters=[{name:"count",aliases:["n"],description:"Number of repetitions (default: 20)",type:"number",required:!1}]}async processCommand(t,e){const r=t.value||"y",n=Math.min(parseInt(t.args.count||t.args.n)||20,1e3);for(let o=0;o<n;o++)e.writer.writeln(r)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.yes.long_description","Output a string repeatedly")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("yes [text] [--count=N]",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` yes ${e.wrapInColor('# Outputs "y" 20 times',CliForegroundColor.Green)}`),e.writeln(` yes hello --count=5 ${e.wrapInColor('# Outputs "hello" 5 times',CliForegroundColor.Green)}`)}},SYSTEM_OPTIONS=[{key:"logLevel",label:"Log Level",description:"Controls how much logging the CLI outputs",type:"select",defaultValue:"ERROR",options:[{label:"None",value:"None"},{label:"Debug",value:"Debug"},{label:"Log",value:"Log"},{label:"Info",value:"Info"},{label:"Warn",value:"Warn"},{label:"Error",value:"Error"}]},{key:"welcomeMessage",label:"Welcome Message",description:"When to display the welcome message on startup",type:"select",defaultValue:"always",options:[{label:"Always",value:"always"},{label:"Once",value:"once"},{label:"Daily",value:"daily"},{label:"Never",value:"never"}]},{key:"language",label:"Language",description:"Display language for the CLI interface",type:"select",defaultValue:"en",options:[{label:"English",value:"en"}]},{key:"cursorBlink",label:"Cursor Blink",description:"Whether the terminal cursor blinks",type:"boolean",defaultValue:!0},{key:"cursorStyle",label:"Cursor Style",description:"Terminal cursor shape",type:"select",defaultValue:"block",options:[{label:"Block",value:"block"},{label:"Underline",value:"underline"},{label:"Bar",value:"bar"}]},{key:"scrollback",label:"Scrollback",description:"Number of scrollback lines to retain",type:"number",defaultValue:1e3,validator:t=>t<0||t>1e5?{valid:!1,message:"Scrollback must be between 0 and 100,000"}:{valid:!0}},{key:"fontSize",label:"Font Size",description:"Terminal font size in pixels",type:"number",defaultValue:20,validator:t=>t<8||t>40?{valid:!1,message:"Font size must be between 8 and 40"}:{valid:!0}},{key:"fontFamily",label:"Font Family",description:"Terminal font family",type:"string",defaultValue:"monospace"},{key:"smoothScrollDuration",label:"Smooth Scroll",description:"Smooth scroll duration in milliseconds (0 to disable)",type:"number",defaultValue:0,validator:t=>t<0||t>1e3?{valid:!1,message:"Smooth scroll duration must be between 0 and 1,000 ms"}:{valid:!0}},{key:"greeting",label:"Greeting",description:"Show animated time-based greeting on startup",type:"boolean",defaultValue:!0}],LOG_LEVEL_MAP={None:CliLogLevel.None,Debug:CliLogLevel.DEBUG,Log:CliLogLevel.LOG,Info:CliLogLevel.INFO,Warn:CliLogLevel.WARN,Error:CliLogLevel.ERROR},CliConfigureCommandProcessor=class ri{constructor(){this.command="configure",this.description="Manage system and plugin configuration",this.author=DefaultLibraryAuthor,this.version="1.0.0",this.processors=[],this.metadata={sealed:!0,icon:"⚙",module:"system"},this.stateConfiguration={initialState:{system:ri.buildDefaults(SYSTEM_OPTIONS),plugins:{}},storeName:"configure"},this.processors=[this.buildListProcessor(),this.buildGetProcessor(),this.buildSetProcessor(),this.buildResetProcessor()]}async processCommand(e,r){const n=r.services.get(CliProcessorsRegistry_TOKEN),o=resolveConfigurationCategories(n);await this.showMainMenu(r,o)}async initialize(e){const r=e.state.getState();r!=null&&r.system&&this.applySystemSettings(r.system,e)}writeDescription(e){const{writer:r,translator:n}=e;r.writeln(n.t("cli.configure.long_description","Manage system and plugin configuration interactively or via subcommands")),r.writeln(),r.writeln(n.t("cli.common.usage","Usage:")),r.writeln(` ${r.wrapInColor("configure",CliForegroundColor.Cyan)} ${n.t("cli.configure.open_menu","Open interactive configuration menu")}`),r.writeln(` ${r.wrapInColor("configure list",CliForegroundColor.Cyan)} ${n.t("cli.configure.list_opts","List all configuration options")}`),r.writeln(` ${r.wrapInColor("configure get <category.key>",CliForegroundColor.Cyan)} ${n.t("cli.configure.get_value","Get a configuration value")}`),r.writeln(` ${r.wrapInColor("configure set <category.key> <value>",CliForegroundColor.Cyan)} ${n.t("cli.configure.set_value","Set a configuration value")}`),r.writeln(` ${r.wrapInColor("configure reset [category]",CliForegroundColor.Cyan)} ${n.t("cli.configure.reset_defaults","Reset configuration to defaults")}`),r.writeln(),r.writeln(n.t("cli.common.examples","Examples:")),r.writeln(` configure get system.logLevel ${r.wrapInColor("# Get the current log level",CliForegroundColor.Green)}`),r.writeln(` configure set system.logLevel Debug ${r.wrapInColor("# Set log level to Debug",CliForegroundColor.Green)}`),r.writeln(` configure set system.welcomeMessage never ${r.wrapInColor("# Disable welcome message",CliForegroundColor.Green)}`),r.writeln(` configure reset system ${r.wrapInColor("# Reset system config to defaults",CliForegroundColor.Green)}`),r.writeln(` configure reset ${r.wrapInColor("# Reset all configuration",CliForegroundColor.Green)}`)}async showMainMenu(e,r){const n=e.translator;for(;;){const o=[{label:n.t("cli.configure.system","System"),value:"system"}];for(const[h]of r)o.push({label:h.charAt(0).toUpperCase()+h.slice(1),value:h});o.push({label:n.t("cli.configure.exit","Exit"),value:"__exit__"});const u=await e.reader.readSelect("Configuration categories:",o);if(u===null||u==="__exit__")return;if(u==="system")await this.showCategoryMenu(e,"System","system",SYSTEM_OPTIONS);else{const h=r.get(u);h&&await this.showCategoryMenu(e,u,u,h.options)}}}async showCategoryMenu(e,r,n,o){if(n==="system"){const u=o.find(h=>h.key==="language");if(u)try{const a=e.services.get(ICliTranslationService_TOKEN).getAvailableLocales();a.length>0&&(u.options=a.map(l=>({label:this.getLanguageLabel(l),value:l})))}catch{}}for(;;){const u=[];for(const l of o){const f=this.getConfigValue(e,n,l.key,l.defaultValue),C=`${l.label.padEnd(25)} [${f}]`;u.push({label:C,value:l.key})}u.push({label:e.translator.t("cli.configure.back","Back"),value:"__back__"});const h=await e.reader.readSelect(`${r} settings:`,u);if(h===null||h==="__back__")return;const a=o.find(l=>l.key===h);a&&await this.editOption(e,n,a)}}async editOption(e,r,n){const o=this.getConfigValue(e,r,n.key,n.defaultValue);e.writer.writeln(),e.writer.writeln(`${e.writer.wrapInColor(n.label,CliForegroundColor.Cyan)}: ${n.description}`),e.writer.writeln(` ${e.translator.t("cli.configure.current_value","Current value:")} ${e.writer.wrapInColor(String(o),CliForegroundColor.Yellow)}`),e.writer.writeln();let u=null;switch(n.type){case"select":{if(!n.options)break;const h=n.options.map(a=>({label:a.value===o?`${a.label} (current)`:a.label,value:a.value}));u=await e.reader.readSelect("Select a value:",h);break}case"boolean":{u=await e.reader.readConfirm(`${n.label}?`,o===!0);break}case"number":{u=await e.reader.readNumber(`${n.label}: `,{default:typeof o=="number"?o:void 0});break}case"string":{u=await e.reader.readLine(`${n.label} [${o}]: `),u===""&&(u=o);break}}if(u!==null){if(n.validator){const h=n.validator(u);if(!h.valid){e.writer.writeError(h.message||e.translator.t("cli.configure.invalid_value","Invalid value"));return}}this.setConfigValue(e,r,n.key,u),await e.state.persist(),e.writer.writeSuccess(e.translator.t("cli.configure.set_to","Set {label} to {value}",{label:n.label,value:String(u)}))}}setConfigValue(e,r,n,o){const u=e.state.getState();if(r==="system")u.system={...u.system,[n]:o},e.state.updateState({system:u.system}),this.applySystemSettings(u.system,e);else{const h=u.plugins[r]||{};u.plugins={...u.plugins,[r]:{...h,[n]:o}},e.state.updateState({plugins:u.plugins})}}getConfigValue(e,r,n,o){var h,a,l;const u=e.state.getState();return r==="system"?((h=u==null?void 0:u.system)==null?void 0:h[n])??o:((l=(a=u==null?void 0:u.plugins)==null?void 0:a[r])==null?void 0:l[n])??o}getAllOptions(e){const r=[];for(const o of SYSTEM_OPTIONS)r.push({stateKey:"system",option:o});const n=resolveConfigurationCategories(e);for(const[o,{options:u}]of n)for(const h of u)r.push({stateKey:o,option:h});return r}applySystemSettings(e,r){var n;if(e.logLevel){const o=LOG_LEVEL_MAP[e.logLevel];o!==void 0&&r.logger.setCliLogLevel(o)}if(e.language)try{r.services.get(ICliTranslationService_TOKEN).setLocale(e.language)}catch{}(n=r.terminal)!=null&&n.options&&(e.cursorBlink!==void 0&&(r.terminal.options.cursorBlink=e.cursorBlink),e.cursorStyle&&(r.terminal.options.cursorStyle=e.cursorStyle),e.scrollback!==void 0&&(r.terminal.options.scrollback=e.scrollback),e.fontSize!==void 0&&(r.terminal.options.fontSize=e.fontSize),e.fontFamily&&(r.terminal.options.fontFamily=e.fontFamily),e.smoothScrollDuration!==void 0&&(r.terminal.options.smoothScrollDuration=e.smoothScrollDuration))}buildListProcessor(){return{command:"list",aliases:["ls"],description:"List all configuration options and their current values",processCommand:async(e,r)=>{const n=r.services.get(CliProcessorsRegistry_TOKEN),o=this.getAllOptions(n);let u="";const h={};for(const{stateKey:a,option:l}of o){const f=this.getConfigValue(r,a,l.key,l.defaultValue);if(a!==u){u=a;const P=a==="system"?"System":a;r.writer.writeln(),r.writer.writeln(r.writer.wrapInColor(` ${P}`,CliForegroundColor.Cyan)),r.writer.writeln(r.writer.wrapInColor(` ${"─".repeat(40)}`,CliForegroundColor.Cyan))}const C=`${a}.${l.key}`.padEnd(30),d=r.writer.wrapInColor(String(f),CliForegroundColor.Yellow);r.writer.writeln(` ${C} ${d}`),h[a]||(h[a]={}),h[a][l.key]=f}r.writer.writeln(),r.process.output(h)}}}buildGetProcessor(){return{command:"get",description:"Get a configuration value (e.g. configure get system.logLevel)",valueRequired:!0,processCommand:async(e,r)=>{const n=e.value,o=n.indexOf(".");if(o===-1){r.writer.writeError(r.translator.t("cli.configure.invalid_format_get","Invalid format. Use: configure get <category.key>"));return}const u=n.substring(0,o),h=n.substring(o+1),a=r.services.get(CliProcessorsRegistry_TOKEN),f=this.getAllOptions(a).find(d=>d.stateKey===u&&d.option.key===h);if(!f){r.writer.writeError(r.translator.t("cli.configure.unknown_key","Unknown configuration key: {path}",{path:n}));return}const C=this.getConfigValue(r,u,h,f.option.defaultValue);r.writer.writeln(`${r.writer.wrapInColor(n,CliForegroundColor.Cyan)} = ${r.writer.wrapInColor(String(C),CliForegroundColor.Yellow)}`),r.process.output(C)}}}buildSetProcessor(){return{command:"set",description:"Set a configuration value (e.g. configure set system.logLevel Debug)",valueRequired:!0,acceptsRawInput:!0,processCommand:async(e,r)=>{const n=e.value,o=n.indexOf(" ");if(o===-1){r.writer.writeError(r.translator.t("cli.configure.invalid_format_set","Invalid format. Use: configure set <category.key> <value>"));return}const u=n.substring(0,o),h=n.substring(o+1).trim(),a=u.indexOf(".");if(a===-1){r.writer.writeError(r.translator.t("cli.configure.invalid_format_set","Invalid format. Use: configure set <category.key> <value>"));return}const l=u.substring(0,a),f=u.substring(a+1),C=r.services.get(CliProcessorsRegistry_TOKEN),P=this.getAllOptions(C).find(U=>U.stateKey===l&&U.option.key===f);if(!P){r.writer.writeError(r.translator.t("cli.configure.unknown_key","Unknown configuration key: {path}",{path:u}));return}const H=this.coerceValue(h,P.option,r.translator);if(H.error){r.writer.writeError(H.error);return}const W=H.value;if(P.option.validator){const U=P.option.validator(W);if(!U.valid){r.writer.writeError(U.message||`Invalid value for ${u}`);return}}this.setConfigValue(r,l,f,W),await r.state.persist(),r.writer.writeSuccess(r.translator.t("cli.configure.set_success","Set {path} to {value}",{path:u,value:String(W)}))}}}buildResetProcessor(){return{command:"reset",description:"Reset configuration to defaults (optionally for a specific category)",acceptsRawInput:!0,processCommand:async(e,r)=>{var u;const n=r.translator,o=(u=e.value)==null?void 0:u.trim();if(o)if(o==="system"){const h=ri.buildDefaults(SYSTEM_OPTIONS),a=r.state.getState();r.state.updateState({system:h,plugins:a.plugins}),this.applySystemSettings(h,r),await r.state.persist(),r.writer.writeSuccess(n.t("cli.configure.system_reset","System configuration reset to defaults"))}else{const h=r.services.get(CliProcessorsRegistry_TOKEN),l=resolveConfigurationCategories(h).get(o);if(!l){r.writer.writeError(n.t("cli.configure.unknown_category","Unknown category: {category}",{category:o}));return}const f=ri.buildDefaults(l.options),C=r.state.getState(),d={...C.plugins,[o]:f};r.state.updateState({system:C.system,plugins:d}),await r.state.persist(),r.writer.writeSuccess(n.t("cli.configure.category_reset",'Configuration for "{category}" reset to defaults',{category:o}))}else{if(!await r.reader.readConfirm(n.t("cli.configure.reset_confirm","Reset all configuration to defaults?"),!1)){r.writer.writeInfo(n.t("cli.configure.reset_cancelled","Reset cancelled"));return}r.state.reset(),await r.state.persist();const a=ri.buildDefaults(SYSTEM_OPTIONS);this.applySystemSettings(a,r),r.writer.writeSuccess(n.t("cli.configure.all_reset","All configuration reset to defaults"))}}}}coerceValue(e,r,n){switch(r.type){case"number":{const o=Number(e);return isNaN(o)?{value:null,error:n.t("cli.configure.invalid_number","Invalid number: {value}",{value:e})}:{value:o}}case"boolean":{const o=e.toLowerCase();return["true","1","yes"].includes(o)?{value:!0}:["false","0","no"].includes(o)?{value:!1}:{value:null,error:n.t("cli.configure.invalid_boolean",'Invalid boolean value: "{value}". Use true or false.',{value:e})}}case"select":if(r.options){const o=r.options.find(u=>String(u.value).toLowerCase()===e.toLowerCase());if(!o){const u=r.options.map(h=>h.value).join(", ");return{value:null,error:n.t("cli.configure.invalid_options","Invalid value. Valid options: {options}",{options:u})}}return{value:o.value}}return{value:e};default:return{value:e}}}getLanguageLabel(e){return{en:"English",es:"Español",fr:"Français",de:"Deutsch",pt:"Português",it:"Italiano",ja:"日本語",ko:"한국어",zh:"中文",ru:"Русский",ar:"العربية",ro:"Română"}[e]||e}static buildDefaults(e){return e.reduce((r,n)=>(r[n.key]=n.defaultValue,r),{})}},CliSnippetCommandProcessor=class{constructor(){this.command="snippet",this.description="Save and reuse parameterized command templates",this.aliases=["snip"],this.author=DefaultLibraryAuthor,this.metadata={icon:CliIcon.Code,module:"system"},this.stateConfiguration={storeName:"snippets",initialState:{snippets:{}}},this.processors=[{command:"list",description:"List all saved snippets",processCommand:async(t,e)=>{const{snippets:r}=e.state.getState(),n=Object.entries(r);if(n.length===0){e.writer.writeInfo('No snippets saved yet. Use: snippet save <name> "<template>"');return}e.writer.writeln(e.writer.wrapInColor("Saved snippets:",CliForegroundColor.Yellow));for(const[o,u]of n)e.writer.writeln(` ${e.writer.wrapInColor(o,CliForegroundColor.Cyan)} ${u}`)}},{command:"save",description:'Save a new snippet: snippet save <name> "<template>"',acceptsRawInput:!0,valueRequired:!0,processCommand:async(t,e)=>{const r=(t.value??"").trim(),n=r.indexOf(" ");if(n===-1){e.writer.writeError('Usage: snippet save <name> "<template>"');return}const o=r.slice(0,n).trim();let u=r.slice(n+1).trim();if((u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'"))&&(u=u.slice(1,-1)),!o||!u){e.writer.writeError('Usage: snippet save <name> "<template>"');return}const{snippets:h}=e.state.getState(),a={...h,[o]:u};e.state.updateState({snippets:a}),await e.state.persist(),e.writer.writeSuccess(`Snippet "${o}" saved`)}},{command:"show",description:"Show a snippet template: snippet show <name>",acceptsRawInput:!0,valueRequired:!0,processCommand:async(t,e)=>{const r=(t.value??"").trim(),{snippets:n}=e.state.getState();if(!(r in n)){e.writer.writeError(`Snippet "${r}" not found`);return}e.writer.writeln(`${e.writer.wrapInColor(r,CliForegroundColor.Cyan)}: ${n[r]}`)}},{command:"delete",description:"Delete a snippet: snippet delete <name>",aliases:["rm","remove"],acceptsRawInput:!0,valueRequired:!0,processCommand:async(t,e)=>{const r=(t.value??"").trim(),{snippets:n}=e.state.getState();if(!(r in n)){e.writer.writeError(`Snippet "${r}" not found`);return}const o={...n};delete o[r],e.state.updateState({snippets:o}),await e.state.persist(),e.writer.writeSuccess(`Snippet "${r}" deleted`)}},{command:"run",description:"Run a snippet with variable values: snippet run <name> var1=val1 var2=val2",acceptsRawInput:!0,valueRequired:!0,processCommand:async(t,e)=>{const r=(t.value??"").trim(),n=r.indexOf(" "),o=n===-1?r:r.slice(0,n),u=n===-1?"":r.slice(n+1).trim(),{snippets:h}=e.state.getState();if(!(o in h)){e.writer.writeError(`Snippet "${o}" not found`);return}const a={},l=/(\w+)=(?:"([^"]*)"|([\S]*))/g;let f;for(;(f=l.exec(u))!==null;)a[f[1]]=f[2]??f[3]??"";let C=h[o];for(const[P,H]of Object.entries(a))C=C.replace(new RegExp(`\\{\\{${P}\\}\\}`,"g"),H);const d=[...C.matchAll(/\{\{(\w+)\}\}/g)].map(P=>P[1]);if(d.length>0){e.writer.writeError(`Missing variables: ${d.join(", ")}. Usage: snippet run ${o} ${d.map(P=>`${P}=value`).join(" ")}`);return}e.writer.writeInfo(`Running: ${C}`),await e.executor.executeCommand(C,e)}}]}async processCommand(t,e){const{snippets:r}=e.state.getState(),n=Object.keys(r).length;e.writer.writeln(`${n} snippet(s) saved. Sub-commands: list, save, show, run, delete`)}};function computeDiff(t,e){const r=t===""?[]:t.split(`
110
- `),n=e===""?[]:e.split(`
111
- `),o=r.length,u=n.length,h=Array.from({length:o+1},()=>new Array(u+1).fill(0));for(let C=o-1;C>=0;C--)for(let d=u-1;d>=0;d--)h[C][d]=r[C]===n[d]?1+h[C+1][d+1]:Math.max(h[C+1][d],h[C][d+1]);const a=[];let l=0,f=0;for(;l<o&&f<u;)r[l]===n[f]?(a.push({type:"same",text:r[l++]}),f++):h[l+1][f]>=h[l][f+1]?a.push({type:"remove",text:r[l++]}):a.push({type:"add",text:n[f++]});for(;l<o;)a.push({type:"remove",text:r[l++]});for(;f<u;)a.push({type:"add",text:n[f++]});return a}function formatDiff(t,e=3){const r=[],n=new Set;t.forEach((h,a)=>{h.type!=="same"&&n.add(a)});const o=new Set;for(const h of n)for(let a=Math.max(0,h-e);a<=Math.min(t.length-1,h+e);a++)o.add(a);let u=-1;for(let h=0;h<t.length;h++){if(!o.has(h))continue;u!==-1&&h>u+1&&r.push("\x1B[2m...\x1B[0m");const{type:a,text:l}=t[h];a==="add"?r.push(`\x1B[32m+ ${l}\x1B[0m`):a==="remove"?r.push(`\x1B[31m- ${l}\x1B[0m`):r.push(`\x1B[2m ${l}\x1B[0m`),u=h}return r}var CliDiffCommandProcessor=class{constructor(){this.command="diff",this.description="Show colored diff between two text inputs",this.author=DefaultLibraryAuthor,this.metadata={icon:CliIcon.Edit,module:"system"},this.parameters=[{name:"b",description:"Second text to compare",required:!1,type:"string"},{name:"a",description:"First text (alternative to pipe)",required:!1,type:"string"},{name:"context",description:"Number of context lines around changes (default: 3)",required:!1,type:"number"}]}async processCommand(t,e){var P;const r=t.args.a??t.value??"",n=t.args.b,o=(P=t.args)==null?void 0:P.context,u=o!==void 0?parseInt(String(o),10):NaN,h=Number.isFinite(u)&&u>=0?u:3;if(n===void 0){e.writer.writeError(`Usage: diff --a "text1" --b "text2"
112
- echo "text1" | diff --b "text2"`);return}const a=computeDiff(r,n);if(!a.some(H=>H.type!=="same")){e.writer.writeSuccess("No differences found");return}const f=a.filter(H=>H.type==="add").length,C=a.filter(H=>H.type==="remove").length;e.writer.writeln(`\x1B[32m+${f} added\x1B[0m \x1B[31m-${C} removed\x1B[0m`),e.writer.writeln("");const d=formatDiff(a,h);for(const H of d)e.writer.writeln(H)}},BOLD="\x1B[1m",DIM="\x1B[2m",RESET="\x1B[0m",CliHelpCommandProcessor=class{constructor(){this.command="help",this.aliases=["man"],this.description="Displays help for a command",this.acceptsRawInput=!0,this.author=DefaultLibraryAuthor,this.metadata={sealed:!0,icon:CliIcon.Help,module:"system"}}async processCommand(t,e){const{writer:r}=e,n=e.translator,o=e.services.get(CliProcessorsRegistry_TOKEN),[u,...h]=t.command.split(" ");if(h.length===0)await e.executor.executeCommand("version",e),[...groupBy(o.processors.filter(f=>{var C;return!((C=f.metadata)!=null&&C.hidden)}),f=>{var C;return((C=f.metadata)==null?void 0:C.module)||"uncategorized"}).entries()].sort(([f],[C])=>f==="uncategorized"?1:C==="uncategorized"?-1:0).forEach(([f,C])=>{const d=this.formatModuleName(f);r.writeln(` ${BOLD}${r.wrapInColor(d,CliForegroundColor.Yellow)}${RESET}`),C.forEach(P=>{var N,x;const H=((N=P==null?void 0:P.metadata)==null?void 0:N.icon)||CliIcon.Extension,W=r.wrapInColor(P.command.padEnd(20),CliForegroundColor.Cyan),U=(x=P.aliases)!=null&&x.length?`${DIM} ${P.aliases.join(", ")}${RESET}`:"",L=this.translateDescription(P.description,P.command,e);r.writeln(` ${H} ${W} ${L}${U}`)}),r.writeln()}),r.writeln(` ${BOLD}${r.wrapInColor(n.t("cli.help.shortcuts","Shortcuts"),CliForegroundColor.Yellow)}${RESET}`),await e.executor.executeCommand("hotkeys",e),r.writeln(),r.writeln(` ${DIM}${n.t("cli.help.type","Type")}${RESET} ${r.wrapInColor(n.t("cli.help.help_command","help <command>"),CliForegroundColor.Cyan)} ${DIM}${n.t("cli.help.for_details","for detailed information")}${RESET}`);else{const a=o.findProcessor(h[0],h.slice(1));a?this.writeProcessorDescription(a,e):(r.writeError(n.t("cli.help.unknown_command","Unknown command: {command}",{command:h[0]})),r.writeln(),r.writeln(` ${DIM}${n.t("cli.help.type","Type")}${RESET} ${r.wrapInColor("help",CliForegroundColor.Cyan)} ${DIM}${n.t("cli.help.see_all","to see all available commands")}${RESET}`))}}writeDescription(t){const{writer:e}=t,r=t.translator;e.writeln(r.t("cli.help.long_description","Displays help information for commands")),e.writeln(),e.writeln(e.wrapInColor(r.t("cli.common.usage","Usage:"),CliForegroundColor.Yellow)),e.writeln(` ${e.wrapInColor("help",CliForegroundColor.Cyan)} ${r.t("cli.help.show_all","Show all available commands")}`),e.writeln(` ${e.wrapInColor("help <command>",CliForegroundColor.Cyan)} ${r.t("cli.help.show_details","Show details for a command")}`),e.writeln(` ${e.wrapInColor("help <command> <sub>",CliForegroundColor.Cyan)} ${r.t("cli.help.show_sub_details","Show details for a subcommand")}`),e.writeln(),e.writeln(e.wrapInColor(r.t("cli.common.examples","Examples:"),CliForegroundColor.Yellow)),e.writeln(` help pkg ${DIM}# ${r.t("cli.help.example_pkg","Package manager help")}${RESET}`),e.writeln(` help theme apply ${DIM}# ${r.t("cli.help.example_theme","Theme apply subcommand help")}${RESET}`)}translateDescription(t,e,r){return t?r.translator.t(`cli.${e}.description`,t):""}writeProcessorDescription(t,e){var f,C,d,P,H;const{writer:r}=e,n=e.translator,o=((f=t.metadata)==null?void 0:f.icon)||"",u=`${BOLD}${r.wrapInColor(t.command,CliForegroundColor.Cyan)}${RESET}`,h=`${DIM}v${t.version||"1.0.0"}${RESET}`;if(r.writeln(),r.writeln(` ${o}${o?" ":""}${u} ${h}`),t.description){const W=this.translateDescription(t.description,t.command,e);r.writeln(` ${W}`)}if((C=t.aliases)!=null&&C.length&&r.writeln(` ${DIM}${n.t("cli.help.aliases","Aliases:")}${RESET} ${t.aliases.map(W=>r.wrapInColor(W,CliForegroundColor.Magenta)).join(", ")}`),t.originalProcessor){r.writeln(),r.writeln(` ${BOLD}${r.wrapInColor(n.t("cli.help.extension_chain","Extension chain"),CliForegroundColor.Yellow)}${RESET}`);let W=t.originalProcessor,U=1;for(;W;){const L=((d=W.metadata)==null?void 0:d.module)||"unknown",N=W.version||"1.0.0";r.writeln(` ${"└".padStart(U+1," ")} ${r.wrapInColor(W.command,CliForegroundColor.Cyan)} ${DIM}v${N}${RESET} ${DIM}(${L})${RESET}`),W=W.originalProcessor,U++}}t.writeDescription&&(r.writeln(),t.writeDescription(e)),(P=t.processors)!=null&&P.length&&(r.writeln(),r.writeln(` ${BOLD}${r.wrapInColor(n.t("cli.help.subcommands","Subcommands"),CliForegroundColor.Yellow)}${RESET}`),t.processors.forEach(W=>{var x;const U=r.wrapInColor(W.command.padEnd(16),CliForegroundColor.Cyan),L=(x=W.aliases)!=null&&x.length?`${DIM} (${W.aliases.join(", ")})${RESET}`:"",N=this.translateDescription(W.description,`${t.command}.${W.command}`,e);r.writeln(` ${U} ${N}${L}`)}));const a=t.parameters||[],l=e.executor.getGlobalParameters();a.length>0&&(r.writeln(),r.writeln(` ${BOLD}${r.wrapInColor(n.t("cli.help.options","Options"),CliForegroundColor.Yellow)}${RESET}`),a.forEach(W=>{this.writeParameter(W,r,n)})),l.length>0&&(r.writeln(),r.writeln(` ${BOLD}${r.wrapInColor(n.t("cli.help.global_options","Global options"),CliForegroundColor.Yellow)}${RESET}`),l.forEach(W=>{this.writeParameter(W,r,n)})),(H=t.metadata)!=null&&H.requireServer&&(r.writeln(),r.writeln(` ${r.wrapInColor(n.t("cli.help.requires_server","Requires a connected server"),CliForegroundColor.Red)}`)),r.writeln()}formatModuleName(t){if(t.startsWith("@qodalis/cli-")){const e=t.replace("@qodalis/cli-","");return e.charAt(0).toUpperCase()+e.slice(1)}return t.startsWith("server:")?`Server (${t.substring(7)})`:t.charAt(0).toUpperCase()+t.slice(1)}writeParameter(t,e,r){var l;const n=(l=t.aliases)!=null&&l.length?`, ${t.aliases.map(f=>`-${f}`).join(", ")}`:"",o=e.wrapInColor(`--${t.name}${n}`,CliForegroundColor.Cyan),u=`${DIM}<${t.type}>${RESET}`,h=t.required?e.wrapInColor(` ${r.t("cli.help.required","(required)")}`,CliForegroundColor.Red):"",a=t.defaultValue!==void 0&&!t.required?`${DIM} [${t.defaultValue}]${RESET}`:"";e.writeln(` ${o} ${u} ${t.description}${h}${a}`)}},CLi_Name_Art_Full=`
113
- ____ _ _ _ _____ _ _____
114
- / __ \\ | | | (_) / ____| | |_ _|
115
- | | | | ___ __| | __ _| |_ ___ | | | | | |
116
- | | | |/ _ \\ / _\` |/ _\` | | / __| | | | | | |
117
- | |__| | (_) | (_| | (_| | | \\__ \\ | |____| |____ _| |_
118
- \\___\\_\\\\___/ \\__,_|\\__,_|_|_|___/ \\_____|______|_____|
119
- `,CLi_Name_Art_Compact=`
120
- ___ _ _ _
121
- / _ \\ ___ __| |__ _| (_)___
122
- | (_) / _ \\/ _\` / _\` | | (_-<
123
- \\__\\_\\___/\\__,_\\__,_|_|_/__/ CLI
124
- `,getCliNameArt=t=>t>=60?CLi_Name_Art_Full:t>=35?CLi_Name_Art_Compact:`
125
- Qodalis CLI
126
- `,hotkeysInfo=[{key:"Ctrl + C",description:"Cancel command or copy selection"},{key:"Ctrl + V",description:"Paste from clipboard"},{key:"Ctrl + L",description:"Clear the terminal screen"},{key:"↑ / ↓",description:"Navigate command history"},{key:"Tab",description:"Autocomplete command"}],DIM2="\x1B[2m",RESET2="\x1B[0m",CliVersionCommandProcessor=class{constructor(){this.command="version",this.aliases=["ver"],this.description="Prints the version information",this.processors=[],this.author=DefaultLibraryAuthor,this.metadata={sealed:!0,icon:CliIcon.Settings,module:"system"}}async processCommand(t,e){const{writer:r}=e;r.writeln(r.wrapInColor(getCliNameArt(e.terminal.cols),CliForegroundColor.Cyan)),r.writeln(` ${DIM2}CLI${RESET2} ${r.wrapInColor(`v${LIBRARY_VERSION}`,CliForegroundColor.Green)} ${DIM2}Core${RESET2} ${r.wrapInColor(`v${LIBRARY_VERSION$1}`,CliForegroundColor.Green)}`);let n="vanilla";try{n=e.services.get("cli-framework")}catch{}r.writeln(` ${DIM2}Framework${RESET2} ${r.wrapInColor(n,CliForegroundColor.Cyan)}`),r.writeln(` ${DIM2}Docs${RESET2} ${r.wrapInColor("https://cli.qodalis.com/docs/",CliForegroundColor.Blue)}`),r.writeln()}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.version.long_description","Prints the current version of the CLI and documentation link")),e.writeln(),e.writeln(e.wrapInColor(r.t("cli.common.usage","Usage:"),CliForegroundColor.Yellow)),e.writeln(` ${e.wrapInColor("version",CliForegroundColor.Cyan)}`),e.writeln(),e.writeln(` ${DIM2}Docs${RESET2} ${e.wrapInColor("https://cli.qodalis.com/docs/",CliForegroundColor.Blue)}`)}},githubUrl="https://github.com/qodalis-solutions/web-cli",feedbackTypes=[{command:"report-bug",label:"🐞 Report a Bug",icon:"🐞",description:"Reports a bug on GitHub",gitHubLabel:"bug",gitHubTemplate:"bug_report.md",titlePrompt:"Bug title: ",descriptionPrompt:"Describe the bug (what happened vs what you expected): "},{command:"request-feature",label:"✨ Request a Feature",icon:"✨",description:"Requests a new feature on GitHub",gitHubLabel:"feature-request",gitHubTemplate:"feature_request.md",titlePrompt:"Feature title: ",descriptionPrompt:"Describe the feature you would like: "},{command:"request-command",label:"🧩 Request a Command",icon:"🧩",description:"Requests a new command on GitHub",gitHubLabel:"command-request",gitHubTemplate:"command-request.md",titlePrompt:"Command name or title: ",descriptionPrompt:"Describe what the command should do: "}];function collectSystemInfo(t){const e=[];e.push(`- **CLI Version:** ${LIBRARY_VERSION}`),e.push(`- **Core Version:** ${LIBRARY_VERSION$1}`);let r="vanilla";try{r=t.services.get("cli-framework")}catch{}return e.push(`- **Framework:** ${r}`),e.push(`- **Terminal:** ${t.terminal.cols}x${t.terminal.rows}`),typeof navigator<"u"&&(e.push(`- **Browser:** ${navigator.userAgent}`),e.push(`- **Language:** ${navigator.language}`),e.push(`- **Platform:** ${navigator.platform}`),e.push(`- **Online:** ${navigator.onLine}`)),typeof screen<"u"&&e.push(`- **Screen:** ${screen.width}x${screen.height}`),e.join(`
127
- `)}function buildIssueBody(t,e){const r=[];return t&&r.push(`## Description
128
-
129
- ${t}`),r.push(`## System Info
130
-
131
- ${e}`),r.join(`
132
-
133
- `)}function buildGitHubUrl(t,e,r){const n=new URLSearchParams;return n.set("labels",t.gitHubLabel),n.set("template",t.gitHubTemplate),n.set("title",e),n.set("body",r),`${githubUrl}/issues/new?${n.toString()}`}async function runInteractiveFlow(t,e,r){const{writer:n,reader:o}=r;let u=e==null?void 0:e.trim();if(!u){if(u=await o.readLine(t.titlePrompt)??void 0,!(u!=null&&u.trim())){n.writeInfo("Feedback cancelled.");return}u=u.trim()}n.writeln();const h=await o.readConfirm("Add a description?",!1);let a;if(h){const H=await o.readLine(t.descriptionPrompt);H!=null&&H.trim()&&(a=H.trim())}const l=collectSystemInfo(r);n.writeln(),n.writeln(`${n.wrapInColor("── Summary ──",CliForegroundColor.Cyan)}`),n.writeln(` Type: ${t.icon} ${t.command}`),n.writeln(` Title: ${n.wrapInColor(u,CliForegroundColor.White)}`),a&&n.writeln(` Desc: ${a}`),n.writeln(),n.writeln(`${n.wrapInColor("── System Info (auto-attached) ──",CliForegroundColor.Cyan)}`),n.writeln(` CLI: ${LIBRARY_VERSION} Core: ${LIBRARY_VERSION$1}`);let f="vanilla";try{f=r.services.get("cli-framework")}catch{}if(n.writeln(` Framework: ${f} Terminal: ${r.terminal.cols}x${r.terminal.rows}`),typeof navigator<"u"&&n.writeln(` Platform: ${navigator.platform} Language: ${navigator.language}`),n.writeln(),!await o.readConfirm("Open on GitHub?",!0)){n.writeInfo("Feedback cancelled.");return}const d=buildIssueBody(a,l),P=buildGitHubUrl(t,u,d);openLink(P),n.writeln(),n.writeSuccess(`Opened ${t.command} on GitHub. Thank you for your feedback!`)}var CliFeedbackCommandProcessor=class{constructor(){var t;this.command="feedback",this.aliases=["support"],this.description="Allows users to report bugs or request features",this.processors=[],this.author=DefaultLibraryAuthor,this.metadata={sealed:!0,icon:CliIcon.Bug,module:"system"};for(const e of feedbackTypes)(t=this.processors)==null||t.push({command:e.command,description:e.description,acceptsRawInput:!0,async processCommand({value:r},n){await runInteractiveFlow(e,r,n)},writeDescription(r){const{writer:n}=r;n.writeln(`${e.icon} ${e.description}`),n.writeln(),n.writeln(`📋 ${r.translator.t("cli.common.usage","Usage:")}`),n.writeln(` ${n.wrapInColor(`feedback ${e.command}`,CliForegroundColor.Cyan)} Interactive mode`),n.writeln(` ${n.wrapInColor(`feedback ${e.command} <title>`,CliForegroundColor.Cyan)} Provide title upfront`)}})}async processCommand(t,e){const{writer:r,reader:n}=e;r.writeln("📣 What would you like to do?"),r.writeln();const o=feedbackTypes.map(a=>({label:a.label,value:a.command})),u=await n.readSelect("Select feedback type:",o);if(!u){r.writeInfo("Feedback cancelled.");return}const h=feedbackTypes.find(a=>a.command===u);h&&(r.writeln(),await runInteractiveFlow(h,void 0,e))}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.feedback.long_description","Report bugs, request features, or suggest new commands — interactively or inline.")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("feedback",CliForegroundColor.Cyan)} Interactive wizard`),e.writeln(` ${e.wrapInColor("feedback report-bug",CliForegroundColor.Cyan)} 🐞 Report a bug`),e.writeln(` ${e.wrapInColor("feedback report-bug <title>",CliForegroundColor.Cyan)} 🐞 Report with title`),e.writeln(` ${e.wrapInColor("feedback request-feature",CliForegroundColor.Cyan)} ✨ Request a feature`),e.writeln(` ${e.wrapInColor("feedback request-feature <title>",CliForegroundColor.Cyan)} ✨ Request with title`),e.writeln(` ${e.wrapInColor("feedback request-command",CliForegroundColor.Cyan)} 🧩 Request a command`),e.writeln(` ${e.wrapInColor("feedback request-command <title>",CliForegroundColor.Cyan)} 🧩 Request with title`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` feedback ${e.wrapInColor("# Start interactive wizard",CliForegroundColor.Green)}`),e.writeln(` feedback report-bug "Login page crashes" ${e.wrapInColor("# Opens bug report with title",CliForegroundColor.Green)}`),e.writeln(` feedback request-feature "Dark mode support" ${e.wrapInColor("# Opens feature request with title",CliForegroundColor.Green)}`)}},CliHistoryCommandProcessor=class{constructor(){var e,r,n;this.command="history",this.aliases=["hist"],this.description="Prints the command history of the current session",this.processors=[],this.author=DefaultLibraryAuthor,this.metadata={sealed:!0,icon:CliIcon.Code,module:"system"},(e=this.processors)==null||e.push({command:"list",description:this.description,processCommand:this.processCommand.bind(this),writeDescription:this.writeDescription.bind(this)}),(r=this.processors)==null||r.push({command:"clear",description:"Clears the command history",processCommand:async(o,u)=>{await u.services.get(CliCommandHistory_TOKEN).clearHistory(),u.writer.writeInfo("Command history cleared")},writeDescription:o=>{o.writer.writeln("Clears the command history")}});const t=[{name:"n",description:"Maximum number of results to show",required:!1,type:"number"}];(n=this.processors)==null||n.push({command:"search",description:"Search command history for a pattern",parameters:t,processCommand:async(o,u)=>{var P;const h=u.services.get(CliCommandHistory_TOKEN),a=(o.value??"").trim(),l=((P=o.args)==null?void 0:P.n)??0,f=h.search(a);if(f.length===0){u.writer.writeInfo(a?`No history entries matching "${a}"`:"📜 No command history yet");return}const C=l>0?f.slice(-l):f,d=l>0?f.length-C.length:0;u.writer.writeln(u.writer.wrapInColor(`📜 ${f.length} match${f.length!==1?"es":""}${a?` for "${a}"`:""}:`,CliForegroundColor.Yellow)),C.forEach((H,W)=>{const U=d+W,L=a?H.replace(new RegExp(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi"),N=>u.writer.wrapInColor(N,CliForegroundColor.Cyan)):H;u.writer.writeln(` ${u.writer.wrapInColor(String(U+1).padStart(3),CliForegroundColor.Yellow)} ${L}`)})},writeDescription:o=>{o.writer.writeln("Search command history for a pattern (case-insensitive substring match)"),o.writer.writeln(),o.writer.writeln(`📋 ${o.translator.t("cli.common.usage","Usage:")}`),o.writer.writeln(` ${o.writer.wrapInColor("history search git",CliForegroundColor.Cyan)} Show all history entries containing "git"`),o.writer.writeln(` ${o.writer.wrapInColor("history search git --n 5",CliForegroundColor.Cyan)} Show last 5 matches`)}})}async processCommand(t,e){const{writer:r}=e,o=e.services.get(CliCommandHistory_TOKEN).getHistory();if(o.length===0){r.writeInfo("📜 No command history yet");return}else r.writeln(r.wrapInColor(`📜 Command history (${o.length} entries):`,CliForegroundColor.Yellow)),o.forEach((u,h)=>{r.writeln(` ${r.wrapInColor(String(h+1).padStart(3),CliForegroundColor.Yellow)} ${u}`)})}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.history.long_description","Prints the command history of the current session")),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("history",CliForegroundColor.Cyan)} ${r.t("cli.history.show","Show command history")}`),e.writeln(` ${e.wrapInColor("history search <q>",CliForegroundColor.Cyan)} ${r.t("cli.history.search","Search history for pattern")}`),e.writeln(` ${e.wrapInColor("history clear",CliForegroundColor.Cyan)} ${r.t("cli.history.clear","Clear all history")}`),e.writeln(),e.writeln(`💡 ${r.t("cli.history.arrow_hint","Use {keys} arrow keys to navigate through history",{keys:"↑/↓"})}`),e.writeln(`💡 ${r.t("cli.history.prefix_hint","Type a prefix then {key} to search history by prefix",{key:"↑"})}`)}},DIM3="\x1B[2m",RESET3="\x1B[0m",CliHotKeysCommandProcessor=class{constructor(){this.command="hotkeys",this.aliases=["shortcuts","keys"],this.description="Displays the hotkeys information",this.processors=[],this.author=DefaultLibraryAuthor,this.metadata={sealed:!0,icon:"🔥",module:"system"}}async processCommand(t,e){const{writer:r}=e;hotkeysInfo.forEach(n=>{r.writeln(` ${r.wrapInColor(n.key.padEnd(12),CliForegroundColor.Cyan)} ${DIM3}${n.description}${RESET3}`)})}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.hotkeys.long_description","Displays all available keyboard shortcuts and hotkeys")),e.writeln(),e.writeln(e.wrapInColor(r.t("cli.common.usage","Usage:"),CliForegroundColor.Yellow)),e.writeln(` ${e.wrapInColor("hotkeys",CliForegroundColor.Cyan)}`)}},BUILTIN_SOURCES={unpkg:{url:"https://unpkg.com/",kind:"file"},jsdelivr:{url:"https://cdn.jsdelivr.net/npm/",kind:"file"},npm:{url:"https://registry.npmjs.org/",kind:"registry"}},ScriptLoaderService=class{constructor(){this.sources=new Map(Object.entries(BUILTIN_SOURCES)),this.primary="unpkg"}addSource(t,e,r="file"){this.sources.set(t,{url:e.endsWith("/")?e:e+"/",kind:r})}getSources(){return Array.from(this.sources.keys())}getSource(t){return this.sources.get(t)}getSourceUrl(t){var e;return(e=this.sources.get(t))==null?void 0:e.url}getSourcesByKind(t){const e=[];for(const[r,n]of this.sources)n.kind===t&&e.push({name:r,url:n.url});return e}setCdnSource(t){this.sources.has(t)&&(this.primary=t)}getCdnSource(){return this.primary}injectScript(t){return new Promise((e,r)=>{const n=document.createElement("script");n.src=t,n.async=!0,n.onload=()=>e(),n.onerror=()=>r(new Error(`Failed to load script: ${t}`)),document.head.appendChild(n)})}getScript(t,e){const{onProgress:r,signal:n}=e||{};let o=0;return new Promise((u,h)=>{const a=new XMLHttpRequest;if(a.open("GET",t,!0),n){if(n.aborted){h(new Error("Aborted"));return}n.addEventListener("abort",()=>{a.abort(),h(new Error("Aborted"))})}a.onprogress=l=>{if(l.lengthComputable){const f=Math.round(l.loaded/l.total*100);o=f,r==null||r(f)}else o+=20,r==null||r(o)},a.onload=()=>{a.status===200?(r==null||r(100),o=100,u({xhr:a,content:a.responseText})):h(new Error(`Failed to load package: ${t}, Status: ${a.status}, Message: ${a.responseText}`))},a.onerror=()=>{h(new Error(`Failed to load package: ${t}`))},a.send()})}injectBodyScript(t){const e=document.createElement("script");e.text=t,document.head.appendChild(e)}getCdnUrls(t){const e=[],r=this.sources.get(this.primary);r&&r.kind==="file"&&e.push(`${r.url}${t}`);for(const[n,o]of this.sources)n!==this.primary&&o.kind==="file"&&e.push(`${o.url}${t}`);return e}getScriptWithFallback(t,e){const r=this.getCdnUrls(t);return this.getScriptFromUrls(r,e)}injectScriptWithFallback(t){const e=this.getCdnUrls(t);return this.injectScriptFromUrls(e)}async getScriptFromUrls(t,e){let r;for(const n of t)try{return await this.getScript(n,e)}catch(o){if((o==null?void 0:o.message)==="Aborted")throw o;r=o}throw r}async injectScriptFromUrls(t){let e;for(const r of t)try{return await this.injectScript(r)}catch(n){e=n}throw e}},CliPackageManagerService=class{constructor(){this.storageKey="cli-packages",this.QODALIS_COMMAND_PREFIX="@qodalis/cli-",this.cache=null,this.migrationDone=!1}setStore(t){this.store=t}async getPackages(){if(this.cache!==null)return this.cache;if(!this.migrationDone){this.migrationDone=!0;try{const e=localStorage.getItem("cliPackages");e&&(localStorage.removeItem("cliPackages"),await this.store.set(this.storageKey,JSON.parse(e)))}catch{}}const t=await this.store.get(this.storageKey);return this.cache=t??[],this.cache}async getPackage(t){return(await this.getPackages()).find(e=>e.name===t||e.name===this.QODALIS_COMMAND_PREFIX+t)}async hasPackage(t){return await this.getPackage(t)!==void 0}async addPackage(t){const e=await this.getPackages();if(e.find(r=>r.name===t.name))throw new Error(`Package with name "${t.name}" already exists.`);e.push(t),await this.savePackages(e)}async removePackage(t){const e=await this.getPackages(),r=e.find(o=>o.name===t||o.name===this.QODALIS_COMMAND_PREFIX+t);if(!r)throw new Error(`Package with name "${t}" not found.`);const n=e.filter(o=>o.name!==r.name);if(e.length===n.length)throw new Error(`Package with name "${t}" not found.`);return await this.savePackages(n),r}async updatePackage(t){const e=await this.getPackages(),r=e.findIndex(n=>n.name===t.name);if(r===-1)throw new Error(`Package with name "${t.name}" not found.`);e[r]=t,await this.savePackages(e)}async savePackages(t){this.cache=t,await this.store.set(this.storageKey,t)}},CliPackagesCommandProcessor=class{constructor(){this.command="pkg",this.aliases=["packages"],this.description="Manage packages in the cli",this.author=DefaultLibraryAuthor,this.version="1.0.3",this.processors=[],this.metadata={sealed:!0,icon:"📦",module:"system"},this.stateConfiguration={initialState:{cdnSource:"unpkg"}},this.registeredDependencies=[],this.scriptsLoader=new ScriptLoaderService,this.packagesManager=new CliPackageManagerService;const t=this,e=this.scriptsLoader,r=this.packagesManager;this.processors=[{command:"ls",description:"List all packages in the cli",author:DefaultLibraryAuthor,async processCommand(n,o){const u=await r.getPackages();if(u.length===0){o.writer.writeInfo("📦 No packages installed"),o.writer.writeln(),o.writer.writeInfo(`💡 Use ${o.writer.wrapInColor("pkg add <name>",CliForegroundColor.Cyan)} to install a package`);return}o.writer.writeln(o.writer.wrapInColor(`📦 Installed packages (${u.length}):`,CliForegroundColor.Yellow)),u.forEach(h=>{o.writer.writeln(` ${o.writer.wrapInColor(h.name,CliForegroundColor.Cyan)}@${o.writer.wrapInColor(h.version,CliForegroundColor.Green)}`)})},writeDescription(n){n.writer.writeln("List all installed packages and their versions"),n.writer.writeln(),n.writer.writeln(`📋 ${n.translator.t("cli.common.usage","Usage:")}`),n.writer.writeln(` ${n.writer.wrapInColor("pkg ls",CliForegroundColor.Cyan)}`)}},{command:"browse",description:"List all available packages from all configured sources",async processCommand(n,o){const{progressBar:u,writer:h}=o,{signal:a,cleanup:l}=t.createAbortSignal(o);u.show();const f=r.QODALIS_COMMAND_PREFIX,C=["browser-storage","curl","guid","password-generator","qr","regex","server-logs","speed-test","string","text-to-image","todo","yesno"],d=new Map,P=e.getSourcesByKind("registry");for(const N of P){if(a.aborted)break;u.setText(`Searching ${N.name} registry`);try{const x=`${N.url}-/v1/search?text=${encodeURIComponent(f)}&size=250`,j=await e.getScript(x,{signal:a}),V=JSON.parse(j.content||"{}");for(const Y of V.objects||[]){const J=Y.package;!J.name.startsWith(f)||J.name===`${f}core`||d.has(J.name)||d.set(J.name,{name:J.name,shortName:J.name.replace(f,""),version:J.version,description:J.description||"",source:N.name})}}catch{if(a.aborted)break}}const H=e.getSourcesByKind("file");for(const N of H){if(a.aborted)break;u.setText(`Scanning ${N.name}`);for(const x of C){if(a.aborted)break;const j=`${f}${x}`;u.setText(`Scanning ${N.name}: ${x}`);try{const V=`${N.url}${j}/package.json`,Y=await e.getScript(V,{signal:a}),J=JSON.parse(Y.content||"{}"),X=d.get(j);X?(X.source.includes(N.name)||(X.source+=`, ${N.name}`),J.version&&J.version!==X.version&&(X.version=J.version,X.source=N.name)):d.set(j,{name:j,shortName:x,version:J.version||"latest",description:J.description||"",source:N.name})}catch{}}}if(l(),a.aborted)return;u.complete();const W=Array.from(d.values()).sort((N,x)=>N.name.localeCompare(x.name));if(W.length===0){h.writeInfo("📦 No packages found across any source");return}const U=await r.getPackages(),L=new Map(U.map(N=>[N.name,N.version]));h.writeln(h.wrapInColor(`📦 Available packages (${W.length}):`,CliForegroundColor.Yellow)),h.writeln();for(const N of W){const x=L.get(N.name);let j;x?x===N.version?j=h.wrapInColor("✅ installed",CliForegroundColor.Green):j=h.wrapInColor(`🔄 ${x} → ${N.version}`,CliForegroundColor.Yellow):j=h.wrapInColor("📥 not installed",CliForegroundColor.Magenta);const V=h.wrapInColor(`[${N.source}]`,CliForegroundColor.Blue);h.writeln(` ${h.wrapInColor(N.shortName,CliForegroundColor.Cyan)} ${h.wrapInColor(`v${N.version}`,CliForegroundColor.Green)} ${j} ${V}`),N.description&&h.writeln(` ${N.description}`)}h.writeln(),h.writeInfo(`💡 Use ${h.wrapInColor("pkg add <name>",CliForegroundColor.Cyan)} to install a package`)},writeDescription(n){n.writer.writeln("Browse all available packages across all configured sources"),n.writer.writeln(),n.writer.writeln(`📋 ${n.translator.t("cli.common.usage","Usage:")}`),n.writer.writeln(` ${n.writer.wrapInColor("pkg browse",CliForegroundColor.Cyan)}`),n.writer.writeln(),n.writer.writeln("Shows each package with its latest version, install status, and source:"),n.writer.writeln(` ${n.writer.wrapInColor("✅ installed",CliForegroundColor.Green)} Already installed and up to date`),n.writer.writeln(` ${n.writer.wrapInColor("🔄 update",CliForegroundColor.Yellow)} Installed but a newer version exists`),n.writer.writeln(` ${n.writer.wrapInColor("📥 not installed",CliForegroundColor.Magenta)} Not yet installed`),n.writer.writeln(),n.writer.writeln("🌐 Sources queried:"),n.writer.writeln(` ${n.writer.wrapInColor("registry",CliForegroundColor.Cyan)} npm-compatible search API (e.g. npmjs.org, Verdaccio)`),n.writer.writeln(` ${n.writer.wrapInColor("file",CliForegroundColor.Cyan)} Static file servers, probed for known packages`)}},{command:"add",description:"Add a package to the cli, e.g. pkg add guid.",valueRequired:!0,async processCommand(n,o){const{signal:u,cleanup:h}=t.createAbortSignal(o),a=n.value.split(" ");for(const l of a){if(u.aborted)break;await t.addPackage(l,o,u)}h()},writeDescription(n){const{writer:o}=n;o.writeln("Install one or more packages from the Qodalis registry"),o.writeln(),o.writeln(`📋 ${n.translator.t("cli.common.usage","Usage:")}`),o.writeln(` ${o.wrapInColor("pkg add <package> [package2...]",CliForegroundColor.Cyan)}`),o.writeln(),o.writeln(`📝 ${n.translator.t("cli.common.examples","Examples:")}`),o.writeln(` pkg add guid ${o.wrapInColor("# Short name",CliForegroundColor.Green)}`),o.writeln(` pkg add @qodalis/cli-guid ${o.wrapInColor("# Full name",CliForegroundColor.Green)}`),o.writeln(` pkg add guid server-logs ${o.wrapInColor("# Multiple packages",CliForegroundColor.Green)}`),o.writeln(),o.writeInfo("💡 Short names are automatically prefixed with @qodalis/cli-")}},{command:"remove",description:"Remove a package from the cli",valueRequired:!0,async processCommand(n,o){const{signal:u,cleanup:h}=t.createAbortSignal(o),a=n.value.split(" ");for(const l of a){if(u.aborted)break;await t.removePackage(l,o)}h()},writeDescription(n){const{writer:o}=n;o.writeln("Remove one or more installed packages"),o.writeln(),o.writeln(`📋 ${n.translator.t("cli.common.usage","Usage:")}`),o.writeln(` ${o.wrapInColor("pkg remove <package> [package2...]",CliForegroundColor.Cyan)}`),o.writeln(),o.writeln(`📝 ${n.translator.t("cli.common.examples","Examples:")}`),o.writeln(` pkg remove guid ${o.wrapInColor("# Remove one package",CliForegroundColor.Green)}`),o.writeln(` pkg remove guid server-logs ${o.wrapInColor("# Remove multiple",CliForegroundColor.Green)}`)}},{command:"versions",description:"Show all published versions of a package",valueRequired:!0,acceptsRawInput:!0,async processCommand(n,o){var P;const{progressBar:u,writer:h}=o,{signal:a,cleanup:l}=t.createAbortSignal(o),f=n.value.trim(),C=r.QODALIS_COMMAND_PREFIX,d=f.startsWith(C)?f:`${C}${f}`;u.show(),u.setText(`Fetching versions for ${f}`);try{const H=await e.getScript(`https://registry.npmjs.org/${encodeURIComponent(d)}`,{signal:a});if(a.aborted){l();return}const W=JSON.parse(H.content||"{}");if(!W.versions){u.complete(),h.writeError(`Package ${f} not found`),l();return}const U=Object.keys(W.versions),L=W.time||{},N=((P=W["dist-tags"])==null?void 0:P.latest)||"",x=await r.getPackage(f);u.complete(),h.writeln(h.wrapInColor(`📦 ${d} — ${U.length} version${U.length!==1?"s":""}:`,CliForegroundColor.Yellow)),h.writeln();for(const j of U){const V=L[j]?new Date(L[j]).toLocaleDateString():"",Y=[];j===N&&Y.push(h.wrapInColor("latest",CliForegroundColor.Green)),x&&x.version===j&&Y.push(h.wrapInColor("installed",CliForegroundColor.Cyan));const J=Y.length>0?` [${Y.join(", ")}]`:"";h.writeln(` ${h.wrapInColor(`v${j}`,CliForegroundColor.White)} ${h.wrapInColor(V,CliForegroundColor.Yellow)}${J}`)}h.writeln()}catch(H){if(a.aborted){l();return}u.complete(),h.writeError((H==null?void 0:H.toString())||"Failed to fetch versions")}l()},writeDescription(n){n.writer.writeln("Show all published versions of a package from the npm registry"),n.writer.writeln(),n.writer.writeln(`📋 ${n.translator.t("cli.common.usage","Usage:")}`),n.writer.writeln(` ${n.writer.wrapInColor("pkg versions <package>",CliForegroundColor.Cyan)}`),n.writer.writeln(),n.writer.writeln(`📝 ${n.translator.t("cli.common.examples","Examples:")}`),n.writer.writeln(` pkg versions guid ${n.writer.wrapInColor("# Short name",CliForegroundColor.Green)}`),n.writer.writeln(` pkg versions @qodalis/cli-guid ${n.writer.wrapInColor("# Full name",CliForegroundColor.Green)}`)}},{command:"check",description:"Check installed packages for available updates",async processCommand(n,o){const u=await r.getPackages();if(u.length===0){o.writer.writeInfo("📦 No packages installed"),o.writer.writeln(),o.writer.writeInfo(`💡 Use ${o.writer.wrapInColor("pkg add <name>",CliForegroundColor.Cyan)} to install a package`);return}const{progressBar:h,writer:a}=o,{signal:l,cleanup:f}=t.createAbortSignal(o);h.show();const C=[],d=[],P=[];for(const H of u){if(l.aborted)break;h.setText(`Checking ${H.name}`);try{const W=await e.getScriptWithFallback(`${H.name}/package.json`,{signal:l}).then(U=>JSON.parse(U.content||"{}"));W.version&&W.version!==H.version?C.push({name:H.name,current:H.version,latest:W.version}):d.push(H.name)}catch{if(l.aborted)break;P.push({name:H.name,error:"Failed to check"})}}if(f(),!l.aborted){if(h.complete(),C.length>0){a.writeln(a.wrapInColor(`🔄 Updates available (${C.length}):`,CliForegroundColor.Yellow)),a.writeln();for(const H of C)a.writeln(` ${a.wrapInColor(H.name,CliForegroundColor.Cyan)} ${a.wrapInColor(H.current,CliForegroundColor.Red)} → ${a.wrapInColor(H.latest,CliForegroundColor.Green)}`);a.writeln(),a.writeInfo(`💡 Run ${a.wrapInColor("pkg update",CliForegroundColor.Cyan)} to update all packages`)}if(d.length>0){C.length>0&&a.writeln(),a.writeln(a.wrapInColor(`✅ Up to date (${d.length}):`,CliForegroundColor.Green)),a.writeln();for(const H of d)a.writeln(` ${a.wrapInColor(H,CliForegroundColor.Cyan)}`)}if(P.length>0){a.writeln();for(const H of P)a.writeWarning(`⚠️ ${H.name}: ${H.error}`)}C.length===0&&P.length===0&&(a.writeln(),a.writeSuccess("🎉 All packages are up to date!"))}},writeDescription(n){n.writer.writeln("Check installed packages for newer versions available on the registry"),n.writer.writeln(),n.writer.writeln(`📋 ${n.translator.t("cli.common.usage","Usage:")}`),n.writer.writeln(` ${n.writer.wrapInColor("pkg check",CliForegroundColor.Cyan)}`),n.writer.writeln(),n.writer.writeInfo(`💡 Use ${n.writer.wrapInColor("pkg update",CliForegroundColor.Cyan)} to apply updates`)}},{command:"update",description:"Update a package in the cli to the latest version or update all packages",acceptsRawInput:!0,valueRequired:!1,async processCommand(n,o){const{signal:u,cleanup:h}=t.createAbortSignal(o);if(n.value){const a=n.value.trim(),l=a.lastIndexOf("@");let f,C;l>0&&!a.slice(0,l).endsWith("/")?(f=a.slice(0,l),C=a.slice(l+1)):f=a,await t.updatePackage(f,o,u,C)}else{const a=await r.getPackages();for(const l of a){if(u.aborted)break;await t.updatePackage(l.name,o,u)}u.aborted||o.writer.writeSuccess("All packages updated")}h()},writeDescription(n){n.writer.writeln("Update packages to their latest versions or to a specific version"),n.writer.writeln(),n.writer.writeln(`📋 ${n.translator.t("cli.common.usage","Usage:")}`),n.writer.writeln(` ${n.writer.wrapInColor("pkg update <package>",CliForegroundColor.Cyan)} Update to latest`),n.writer.writeln(` ${n.writer.wrapInColor("pkg update <package>@<version>",CliForegroundColor.Cyan)} Update to specific version`),n.writer.writeln(` ${n.writer.wrapInColor("pkg update",CliForegroundColor.Cyan)} Update all packages`),n.writer.writeln(),n.writer.writeln(`📝 ${n.translator.t("cli.common.examples","Examples:")}`),n.writer.writeln(` pkg update guid ${n.writer.wrapInColor("# Update to latest",CliForegroundColor.Green)}`),n.writer.writeln(` pkg update guid@1.0.2 ${n.writer.wrapInColor("# Install specific version",CliForegroundColor.Green)}`)}},{command:"source",description:"Get or set the package source for downloads",acceptsRawInput:!0,processors:[{command:"get",description:"Show the current CDN source",async processCommand(n,o){const u=e.getCdnSource(),a=e.getSources().filter(l=>l!==u);o.writer.writeln(`🌐 Current source: ${o.writer.wrapInColor(u,CliForegroundColor.Cyan)}`),a.length>0&&o.writer.writeln(` Fallbacks: ${a.map(l=>o.writer.wrapInColor(l,CliForegroundColor.Yellow)).join(", ")}`)}},{command:"set",description:"Set the preferred package source (interactive if no name given)",acceptsRawInput:!0,async processCommand(n,o){let u=(n.value||"").trim().toLowerCase();const h=e.getSources();if(!u){const l=e.getCdnSource(),f=h.map(d=>{const P=e.getSource(d);return{label:`${d}${d===l?" (active)":""} ${(P==null?void 0:P.url)||""}`,value:d}}),C=await o.reader.readSelect("Select package source:",f);if(!C){o.writer.writeInfo("Source selection cancelled");return}u=C}if(!h.includes(u)){o.writer.writeError(`Invalid source "${u}". Available sources: ${h.join(", ")}`);return}e.setCdnSource(u),o.state.updateState({cdnSource:u}),await o.state.persist(),o.writer.writeSuccess(`Package source set to ${o.writer.wrapInColor(u,CliForegroundColor.Cyan)}`);const a=h.filter(l=>l!==u);a.length>0&&o.writer.writeln(` Fallbacks: ${a.map(l=>o.writer.wrapInColor(l,CliForegroundColor.Yellow)).join(", ")}`)},writeDescription(n){const o=e.getSources();n.writer.writeln("Set the preferred source for package downloads"),n.writer.writeln(),n.writer.writeln(`📋 ${n.translator.t("cli.common.usage","Usage:")}`),n.writer.writeln(` ${n.writer.wrapInColor("pkg source set <name>",CliForegroundColor.Cyan)}`),n.writer.writeln(),n.writer.writeln("🌐 Available sources:");for(const u of o){const h=e.getSource(u),a=h?`[${h.kind}]`:"";n.writer.writeln(` ${n.writer.wrapInColor(u,CliForegroundColor.Cyan)} ${n.writer.wrapInColor(a,CliForegroundColor.Yellow)} ${(h==null?void 0:h.url)||""}`)}}}],async processCommand(n,o){const u=e.getCdnSource(),a=e.getSources().filter(l=>l!==u);o.writer.writeln(`🌐 Current source: ${o.writer.wrapInColor(u,CliForegroundColor.Cyan)}`),a.length>0&&o.writer.writeln(` Fallbacks: ${a.map(l=>o.writer.wrapInColor(l,CliForegroundColor.Yellow)).join(", ")}`),o.writer.writeln(),o.writer.writeInfo(`💡 Use ${o.writer.wrapInColor("pkg source set <name>",CliForegroundColor.Cyan)} to change`)},writeDescription(n){const o=e.getSources();n.writer.writeln("Manage the source used for downloading packages"),n.writer.writeln(),n.writer.writeln("📋 Commands:"),n.writer.writeln(` ${n.writer.wrapInColor("pkg source",CliForegroundColor.Cyan)} Show current source`),n.writer.writeln(` ${n.writer.wrapInColor("pkg source get",CliForegroundColor.Cyan)} Show current source`),n.writer.writeln(` ${n.writer.wrapInColor("pkg source set <name>",CliForegroundColor.Cyan)} Set preferred source`),n.writer.writeln(),n.writer.writeln("🌐 Available sources:");for(const u of o){const h=e.getSourceUrl(u)||"";n.writer.writeln(` ${n.writer.wrapInColor(u,CliForegroundColor.Cyan)} ${h}`)}n.writer.writeln(),n.writer.writeInfo("The non-selected source is used as a fallback.")}}]}createAbortSignal(t){const e=new AbortController,r=t.onAbort.subscribe(()=>{e.abort()});return{signal:e.signal,cleanup:()=>r.unsubscribe()}}async processCommand(t,e){await e.executor.showHelp(t,e)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(this.description),e.writeln(),e.writeln(`📋 ${r.t("cli.common.usage","Usage:")}`),e.writeln(` ${e.wrapInColor("pkg ls",CliForegroundColor.Cyan)} List installed packages`),e.writeln(` ${e.wrapInColor("pkg browse",CliForegroundColor.Cyan)} Browse all available packages`),e.writeln(` ${e.wrapInColor("pkg add <package>",CliForegroundColor.Cyan)} Install a package`),e.writeln(` ${e.wrapInColor("pkg remove <package>",CliForegroundColor.Cyan)} Remove a package`),e.writeln(` ${e.wrapInColor("pkg versions <package>",CliForegroundColor.Cyan)} Show all published versions`),e.writeln(` ${e.wrapInColor("pkg check",CliForegroundColor.Cyan)} Check for available updates`),e.writeln(` ${e.wrapInColor("pkg update [package]",CliForegroundColor.Cyan)} Update one or all packages`),e.writeln(` ${e.wrapInColor("pkg source [get|set <name>]",CliForegroundColor.Cyan)} Get or set package source`),e.writeln(),e.writeln(`🌐 Browse packages: ${e.wrapInColor("https://www.npmjs.com/org/qodalis",CliForegroundColor.Blue)}`),e.writeln(),e.writeln(`📝 ${r.t("cli.common.examples","Examples:")}`),e.writeln(` pkg add guid ${e.wrapInColor("# Install @qodalis/cli-guid",CliForegroundColor.Green)}`),e.writeln(` pkg add guid server-logs ${e.wrapInColor("# Install multiple packages",CliForegroundColor.Green)}`),e.writeln(` pkg update ${e.wrapInColor("# Update all packages",CliForegroundColor.Green)}`)}async initialize(t){var o;this.registry=t.services.get(CliProcessorsRegistry_TOKEN);const e=t.services.get("cli-key-value-store");this.packagesManager.setStore(e),t.services.set([{provide:CliPackageManagerService_TOKEN,useValue:this.packagesManager}]);const r=(o=t.options)==null?void 0:o.packageSources;if(r!=null&&r.sources)for(const u of r.sources)this.scriptsLoader.addSource(u.name,u.url,u.kind||"file");r!=null&&r.primary&&this.scriptsLoader.setCdnSource(r.primary),t.state.select(u=>u.cdnSource).subscribe(u=>{u&&this.scriptsLoader.setCdnSource(u)});const n=await this.packagesManager.getPackages();for(const u of n)await this.registerPackageDependencies(u,t),await this.injectScriptWithCdnFallback(u.url)}async removePackage(t,e){var r;e.progressBar.show();try{const n=await this.packagesManager.removePackage(t);if(n){const o=window[n.name];o&&((r=o.processors)==null||r.forEach(u=>{this.registry.unregisterProcessor(u)}))}e.progressBar.complete(),e.writer.writeSuccess(`Package ${n.name}@${n.version} removed successfully`)}catch(n){e.progressBar.complete(),e.writer.writeError((n==null?void 0:n.toString())||"Unknown error")}}async addPackage(t,e,r){if(await this.packagesManager.hasPackage(t)){e.writer.writeInfo(`Package ${t} already installed`);return}const o=`pkg-install:${t}`;try{e.backgroundServices.register({name:o,description:`Installing package '${t}'`,type:"job",onStart:async u=>{u.log(`Installing ${t}`),await this.doAddPackage(t,e,r),u.log(`Installation of ${t} complete`)}}),await e.backgroundServices.start(o)}catch{await this.doAddPackage(t,e,r)}}async doAddPackage(t,e,r){const{progressBar:n}=e;n.show(),n.setText(`Fetching package ${t}`);try{const o=t.startsWith(this.packagesManager.QODALIS_COMMAND_PREFIX)?t:`${this.packagesManager.QODALIS_COMMAND_PREFIX}${t}`;let u=await this.scriptsLoader.getScriptWithFallback(`${o}/package.json`,{signal:r}).then(f=>JSON.parse(f.content||"{}")).catch(()=>null);if(r!=null&&r.aborted||(!u&&o!==t&&(n.setText(`Trying ${t}`),u=await this.scriptsLoader.getScriptWithFallback(`${t}/package.json`,{signal:r}).then(f=>JSON.parse(f.content||"{}")).catch(()=>null)),r!=null&&r.aborted))return;if(!u)throw n.setText("Package not found"),new Error(`Package ${t} not found`);n.setText("Downloading package");const h=this.resolvePackageCdnPath(u),a=await this.scriptsLoader.getScriptWithFallback(h,{signal:r});if(r!=null&&r.aborted)return;n.setText("Registering dependencies");const l={name:u.name,version:u.version||"latest",url:a.xhr.responseURL,dependencies:u.cliDependencies||[]};await this.registerPackageDependencies(l,e),n.setText("Injecting package"),a.content&&await this.scriptsLoader.injectBodyScript(a.content),n.setText("Saving package"),await this.packagesManager.addPackage(l),e.progressBar.complete(),e.writer.writeSuccess(`Package ${u.name}@${u.version} added successfully`)}catch(o){if(r!=null&&r.aborted)return;e.progressBar.complete(),e.writer.writeError((o==null?void 0:o.toString())||"Unknown error")}}async updatePackage(t,e,r,n){const{progressBar:o,writer:u}=e;o.show();try{o.setText(`Updating package ${t}`);const h=await this.packagesManager.getPackage(t);if(!h){o.complete(),u.writeError(`Package ${t} not found`);return}const a=n?`@${n}`:"",l=`${h.name}${a}`;o.setText(n?`Fetching ${h.name}@${n}`:`Checking for updates for package ${h.name}`);const f=await this.scriptsLoader.getScriptWithFallback(l+"/package.json",{signal:r}).then(H=>JSON.parse(H.content||"{}"));if(r!=null&&r.aborted)return;if(f.version===h.version){o.complete(),u.writeInfo(`Package ${h.name} is already at version ${h.version}`);return}o.setText(`Downloading package ${h.name}@${f.version}`);const C=this.resolvePackageCdnPath(f,a),d=await this.scriptsLoader.getScriptWithFallback(C,{signal:r});if(r!=null&&r.aborted)return;o.setText("Registering dependencies");const P={name:f.name,version:f.version||"latest",url:d.xhr.responseURL,dependencies:f.cliDependencies||[]};await this.registerPackageDependencies(P,e),o.setText(`Injecting package ${h.name}`),d.content&&await this.scriptsLoader.injectBodyScript(d.content),o.setText(`Saving package ${h.name}`),await this.packagesManager.updatePackage(P),o.complete(),u.writeSuccess(`Package ${h.name} updated to version ${f.version} from ${h.version}`)}catch(h){if(r!=null&&r.aborted)return;o.complete(),u.writeError((h==null?void 0:h.toString())||"Unknown error")}}async injectScriptWithCdnFallback(t){let e=t;for(const r of this.scriptsLoader.getSources()){const n=this.scriptsLoader.getSourceUrl(r);if(n&&e.startsWith(n)){e=e.slice(n.length);break}}await this.scriptsLoader.injectScriptWithFallback(e)}async registerPackageDependencies(t,{logger:e}){if(t.dependencies&&t.dependencies.length>0){e.info(`Injecting package ${t.name} dependencies`);for(const r of t.dependencies){if(this.registeredDependencies.includes(r.name)){e.info(`Dependency ${r.globalName} already registered`);continue}if(await this.injectScriptWithCdnFallback(r.url),r.globalName)if(await this.waitForGlobal(r.globalName,3e3))e.info(`Dependency ${r.globalName} is available in global scope`);else{e.error(`Dependency ${r.globalName} not found in global scope within timeout`);return}this.registeredDependencies.push(r.name)}}else e.info(`Package ${t.name} has no dependencies`)}resolvePackageCdnPath(t,e=""){const r=t.unpkg||t.umd||t.main,n=`${t.name}${e}`;if(r){const o=r.replace(/^\.\//,"");return`${n}/${o}`}return n}waitForGlobal(t,e){return new Promise(r=>{let o=0;const u=()=>{window[t]?r(!0):o>=e?r(!1):(o+=50,setTimeout(u,50))};u()})}},Ct,CliServerConnection=(Ct=class{constructor(e,r,n){this._config=e,this._backgroundServices=r,this._logger=n,this._connected=!1,this._commands=[],this._capabilities=null,this._eventSocket=null,this._apiVersion=1,this._basePath="",this._wsReconnectAttempts=0,this._wsReconnectTimer=null,this._healthCheckTimer=null,this._healthCheckAttempts=0}get config(){return this._config}get connected(){return this._connected}get commands(){return this._commands}get capabilities(){return this._capabilities}get apiVersion(){return this._apiVersion}async connect(){var e;try{const r=this.normalizeUrl(this._config.url),n=await ServerVersionNegotiator.discover(r);n?(this._apiVersion=n.apiVersion,this._basePath=n.basePath):(this._apiVersion=1,this._basePath=`${r}/api/v1/qcli`),this._commands=await this.fetchCommands(),this._connected=!0,this._capabilities=await this.fetchCapabilities(),this.connectEventSocket(),this.stopHealthCheck()}catch(r){(e=this._logger)==null||e.warn(`Failed to connect to server "${this._config.name}": ${r}`),this._connected=!1,this._commands=[],this._capabilities=null}}disconnect(){this._wsReconnectTimer&&(clearTimeout(this._wsReconnectTimer),this._wsReconnectTimer=null),this._wsReconnectAttempts=0,this.stopHealthCheck(),this._connected=!1,this._commands=[],this._capabilities=null,this._apiVersion=1,this._basePath="",this.closeEventSocket()}startHealthCheck(){this.stopHealthCheck(),this._healthCheckAttempts=0,this.scheduleNextHealthCheck()}scheduleNextHealthCheck(){this._healthCheckTimer=setTimeout(async()=>{var r,n,o,u;if(this._healthCheckAttempts++,this._healthCheckAttempts>Ct.HEALTH_CHECK_MAX_ATTEMPTS){(r=this._logger)==null||r.debug(`Health check gave up for "${this._config.name}" after ${Ct.HEALTH_CHECK_MAX_ATTEMPTS} attempts.`),this.stopHealthCheck();return}(n=this._logger)==null||n.debug(`Health check ${this._healthCheckAttempts}/${Ct.HEALTH_CHECK_MAX_ATTEMPTS} for "${this._config.name}"...`),await this.ping()?((o=this._logger)==null||o.debug(`Server "${this._config.name}" is back online, reconnecting...`),this.stopHealthCheck(),await this.connect(),this._connected&&((u=this.onReconnected)==null||u.call(this))):this.scheduleNextHealthCheck()},Ct.HEALTH_CHECK_INTERVAL_MS)}stopHealthCheck(){this._healthCheckTimer&&(clearTimeout(this._healthCheckTimer),this._healthCheckTimer=null),this._healthCheckAttempts=0}async fetchCommands(){const e=`${this._basePath}/commands`,r=await this.httpFetch(e);if(!r.ok)throw new Error(`Server ${this._config.name} returned ${r.status}`);return r.json()}async fetchCapabilities(){var e;try{const r=`${this._basePath}/capabilities`,n=await this.httpFetch(r);return n.ok?n.json():null}catch(r){return(e=this._logger)==null||e.debug(`Failed to fetch capabilities for "${this._config.name}": ${r}`),null}}async execute(e){const r=`${this._basePath}/execute`,n=await this.httpFetchWithRetry(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return n.ok?n.json():{exitCode:1,outputs:[{type:"text",value:`Server error: ${n.status} ${n.statusText}`,style:"error"}]}}async executeStream(e,r){var f;const n=`${this._basePath}/execute/stream`,o=await this.httpFetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Server error: ${o.status} ${o.statusText}`);const u=(f=o.body)==null?void 0:f.getReader();if(!u)throw new Error("Response body is not readable");const h=new TextDecoder;let a="",l=0;try{for(;;){const{done:C,value:d}=await u.read();if(C)break;a+=h.decode(d,{stream:!0});const P=a.split(`
134
-
135
- `);a=P.pop()??"";for(const H of P){if(!H.trim())continue;let W="message",U="";for(const L of H.split(`
136
- `))L.startsWith("event: ")?W=L.slice(7):L.startsWith("data: ")&&(U=L.slice(6));if(U)try{const L=JSON.parse(U);if(W==="output")r(L);else if(W==="done")l=L.exitCode??0;else if(W==="error")throw new Error(L.message??"Stream error")}catch(L){if(L.message&&!L.message.includes("JSON"))throw L}}}}finally{u.releaseLock()}return{exitCode:l}}async ping(){var e;try{const n=`${this.normalizeUrl(this._config.url)}/api/qcli/versions`;return(await this.httpFetch(n)).ok}catch(r){return(e=this._logger)==null||e.debug(`Ping failed for "${this._config.name}": ${r}`),!1}}connectEventSocket(){var r;if(!this._backgroundServices){this.connectEventSocketDirect();return}const e=`server-events:${this._config.name}`;try{this._backgroundServices.register({name:e,description:`Event stream for server '${this._config.name}'`,type:"daemon",onStart:async n=>{const o=this.normalizeUrl(this._config.url),u=this.toWebSocketUrl(o)+"/ws/v1/qcli/events";n.log(`Connecting to ${u}`),this._eventSocket=new WebSocket(u),this._eventSocket.onopen=()=>{this._wsReconnectAttempts=0,this._wsReconnectTimer&&(clearTimeout(this._wsReconnectTimer),this._wsReconnectTimer=null)},this._eventSocket.onmessage=h=>{try{const a=JSON.parse(h.data);n.emit({source:e,type:a.type||"server-event",data:a}),a.type==="disconnect"&&this.handleServerDisconnect()}catch{}},this._eventSocket.onclose=()=>{this._connected&&(n.log("WebSocket closed unexpectedly, scheduling reconnect","warn"),this.scheduleWsReconnect())},this._eventSocket.onerror=()=>{n.log("WebSocket error","error")}},onStop:async()=>{this.closeEventSocketDirect()}}),this._backgroundServices.start(e).catch(n=>{var o;(o=this._logger)==null||o.debug(`Background event service failed for "${this._config.name}", falling back to direct: ${n}`),this.connectEventSocketDirect()})}catch(n){(r=this._logger)==null||r.debug(`Failed to register event service for "${this._config.name}", falling back to direct: ${n}`),this.connectEventSocketDirect()}}connectEventSocketDirect(){var e;try{const r=this.normalizeUrl(this._config.url),n=this.toWebSocketUrl(r)+"/ws/v1/qcli/events";this._eventSocket=new WebSocket(n),this._eventSocket.onopen=()=>{this._wsReconnectAttempts=0,this._wsReconnectTimer&&(clearTimeout(this._wsReconnectTimer),this._wsReconnectTimer=null)},this._eventSocket.onmessage=o=>{try{JSON.parse(o.data).type==="disconnect"&&this.handleServerDisconnect()}catch{}},this._eventSocket.onclose=()=>{this._connected&&this.scheduleWsReconnect()},this._eventSocket.onerror=()=>{}}catch(r){(e=this._logger)==null||e.debug(`WebSocket not available for "${this._config.name}": ${r}`)}}handleServerDisconnect(){var e;this._connected=!1,this._commands=[],this._capabilities=null,this.closeEventSocket(),(e=this.onDisconnect)==null||e.call(this)}closeEventSocket(){if(this._backgroundServices){const e=`server-events:${this._config.name}`,r=this._backgroundServices.getStatus(e);if(r&&r.status==="running"){this._backgroundServices.stop(e).catch(()=>{});return}}this.closeEventSocketDirect()}closeEventSocketDirect(){this._wsReconnectTimer&&(clearTimeout(this._wsReconnectTimer),this._wsReconnectTimer=null),this._eventSocket&&(this._eventSocket.onclose=null,this._eventSocket.onmessage=null,this._eventSocket.onerror=null,(this._eventSocket.readyState===WebSocket.OPEN||this._eventSocket.readyState===WebSocket.CONNECTING)&&this._eventSocket.close(),this._eventSocket=null)}scheduleWsReconnect(){var r;if(this._wsReconnectAttempts>=Ct.WS_MAX_RECONNECT_ATTEMPTS){(r=this._logger)==null||r.warn(`WebSocket reconnect failed after ${this._wsReconnectAttempts} attempts for "${this._config.name}". Marking disconnected.`),this.handleServerDisconnect();return}this.closeEventSocketDirect();const e=Math.min(1e3*Math.pow(2,this._wsReconnectAttempts),Ct.WS_MAX_RECONNECT_DELAY_MS);this._wsReconnectTimer=setTimeout(()=>{var n;this._wsReconnectAttempts++,(n=this._logger)==null||n.debug(`WebSocket reconnect attempt ${this._wsReconnectAttempts} for "${this._config.name}"...`),this.connectEventSocket()},e)}async httpFetchWithRetry(e,r,n=1){var o;try{return await this.httpFetch(e,r)}catch(u){if(n>0&&u.name!=="AbortError")return(o=this._logger)==null||o.debug(`Transient fetch error for "${this._config.name}", retrying in 1s: ${u.message}`),await new Promise(h=>setTimeout(h,1e3)),this.httpFetchWithRetry(e,r,n-1);throw u}}httpFetch(e,r){const n=this._config.timeout??3e4,o=new AbortController,u=setTimeout(()=>o.abort(),n),h={...this._config.headers??{},...(r==null?void 0:r.headers)??{}};return fetch(e,{...r,headers:h,signal:o.signal}).finally(()=>clearTimeout(u))}normalizeUrl(e){return e.endsWith("/")?e.slice(0,-1):e}toWebSocketUrl(e){if(!e||e.startsWith("/")){const r=typeof location<"u"&&location.protocol==="https:"?"wss:":"ws:",n=typeof location<"u"?location.host:"localhost";return`${r}//${n}`}return e.replace(/^https:/,"wss:").replace(/^http:/,"ws:")}},Ct.WS_MAX_RECONNECT_ATTEMPTS=5,Ct.WS_MAX_RECONNECT_DELAY_MS=3e4,Ct.HEALTH_CHECK_INTERVAL_MS=3e4,Ct.HEALTH_CHECK_MAX_ATTEMPTS=5,Ct);function renderSingleOutput(t,e){switch(t.type){case"text":{const r=t.style;r==="success"?e.writer.writeSuccess(t.value):r==="error"?e.writer.writeError(t.value):r==="info"?e.writer.writeInfo(t.value):r==="warning"?e.writer.writeWarning(t.value):e.writer.writeln(t.value);break}case"table":e.writer.writeTable(t.headers,t.rows);break;case"list":e.writer.writeList(t.items,{ordered:t.ordered});break;case"json":e.writer.writeJson(t.value);break;case"key-value":{const r={};for(const n of t.entries)r[n.key]=n.value;e.writer.writeKeyValue(r);break}}}function renderServerResponse(t,e){for(const r of t.outputs??[])renderSingleOutput(r,e);t.exitCode!==0&&e.process.exit(t.exitCode)}async function executeOnServer(t,e,r,n,o,u){var a,l,f,C;if(!t.connected){o.writer.writeError(`Server '${e}' is not reachable. Run 'server reconnect ${e}' to retry.`),o.process.exit(1);return}const h={...n,command:u&&u.length>0?u[0]:r.command,chainCommands:u&&u.length>1?u.slice(1):[]};try{if((a=t.capabilities)!=null&&a.streaming){const d=await t.executeStream(h,P=>renderSingleOutput(P,o));d.exitCode!==0&&o.process.exit(d.exitCode)}else{(l=o.spinner)==null||l.show("Executing on server...");const d=await t.execute(h);(f=o.spinner)==null||f.hide(),renderServerResponse(d,o)}}catch(d){(C=o.spinner)==null||C.hide(),d.name==="AbortError"?o.writer.writeError(`Request to server '${e}' timed out after ${t.config.timeout??3e4}ms.`):o.writer.writeError(`Error communicating with server '${e}': ${d.message}`),o.process.exit(1)}}var CliServerProxyProcessor=class Uc{constructor(e,r,n,o=!1,u=[]){var h,a;this.connection=e,this.descriptor=r,this.serverName=n,this.commandPath=[...u,r.command],this.command=o?r.command:`${n}:${r.command}`,this.description=r.description,this.version=r.version,this.metadata={module:`server:${n}`,icon:"🖥",requireServer:!0},this.parameters=(h=r.parameters)==null?void 0:h.map(l=>({name:l.name,aliases:l.aliases,description:l.description,required:l.required,type:l.type,defaultValue:l.defaultValue})),this.processors=(a=r.processors)==null?void 0:a.map(l=>new Uc(e,l,n,!0,this.commandPath))}async processCommand(e,r){return executeOnServer(this.connection,this.serverName,this.descriptor,e,r,this.commandPath)}},CliServerMultiProxyProcessor=class Wc{constructor(e,r,n=[]){var u,h;this.entries=e,this.provider=r;const o=e[0].descriptor;this.commandPath=[...n,o.command],this.command=o.command,this.description=o.description,this.metadata={module:"server:multi",icon:"🖥",requireServer:!0},this.parameters=(u=o.parameters)==null?void 0:u.map(a=>({name:a.name,aliases:a.aliases,description:a.description,required:a.required,type:a.type,defaultValue:a.defaultValue})),this.processors=(h=o.processors)==null?void 0:h.map(a=>{const l=e.map(f=>{var d;const C=(d=f.descriptor.processors)==null?void 0:d.find(P=>P.command===a.command);return C?{serverName:f.serverName,connection:f.connection,descriptor:C}:null}).filter(f=>f!==null);return new Wc(l,this.provider,this.commandPath)})}async processCommand(e,r){const n=this.provider.defaultServer;if(n){const a=this.entries.find(f=>f.serverName===n&&f.connection.connected);if(a)return executeOnServer(a.connection,a.serverName,a.descriptor,e,r,this.commandPath);const l=this.entries.find(f=>f.connection.connected);if(l)return r.writer.writeWarning(`Default server '${n}' is unreachable, falling back to '${l.serverName}'.`),executeOnServer(l.connection,l.serverName,l.descriptor,e,r,this.commandPath);r.writer.writeError("No servers are reachable for this command."),r.process.exit(1);return}const o=this.entries.filter(a=>a.connection.connected);if(o.length===0){r.writer.writeError("No servers are reachable for this command."),r.process.exit(1);return}if(o.length===1)return executeOnServer(o[0].connection,o[0].serverName,o[0].descriptor,e,r,this.commandPath);const u=await r.reader.readSelectInline(`'${this.command}' exists on multiple servers:`,o.map(a=>({label:a.serverName,value:a.serverName})));if(!u){r.writer.writeInfo("Command cancelled.");return}const h=o.find(a=>a.serverName===u);return executeOnServer(h.connection,h.serverName,h.descriptor,e,r,this.commandPath)}},CliServerManager_TOKEN="cli-server-manager",CliServerManager=class{constructor(t){this.registry=t,this.connections=new Map,this._defaultServer=null}get defaultServer(){return this._defaultServer}setDefaultServer(t){if(t!==null&&!this.connections.has(t))throw new Error(`Unknown server: ${t}`);this._defaultServer=t,this.unregisterBareAliases(),this.registerBareAliases()}async connectAll(t,e,r,n){this._logger=e,this._cliLogger=n,this._backgroundServices=r;for(const o of t){if(o.enabled===!1)continue;const u=new CliServerConnection(o,r,n);this.connections.set(o.name,u),u.onDisconnect=()=>{this.handleDisconnect(o.name)},u.onReconnected=()=>{e==null||e.info(`Server '${o.name}' reconnected (${u.commands.length} commands, API v${u.apiVersion}).`),this.registerProxyProcessors(u,o.name),this.unregisterBareAliases(),this.registerBareAliases()},await u.connect(),u.connected?(e==null||e.info(`Connected to server '${o.name}' (${u.commands.length} commands)`),this.registerProxyProcessors(u,o.name)):e==null||e.warn(`Could not connect to server '${o.name}' at ${o.url}. Commands from this server will not be available.`)}this.registerBareAliases()}async reconnect(t){const e=this.connections.get(t);return e?(e.stopHealthCheck(),this.unregisterServerProcessors(t),e.onDisconnect=()=>{this.handleDisconnect(t)},e.onReconnected=()=>{var r;(r=this._logger)==null||r.info(`Server '${t}' reconnected (${e.commands.length} commands, API v${e.apiVersion}).`),this.registerProxyProcessors(e,t),this.unregisterBareAliases(),this.registerBareAliases()},await e.connect(),e.connected?(this.registerProxyProcessors(e,t),this.registerBareAliases(),{success:!0,commandCount:e.commands.length}):{success:!1,commandCount:0}):{success:!1,commandCount:0}}getConnection(t){return this.connections.get(t)}handleDisconnect(t){var r;(r=this._logger)==null||r.warn(`Server '${t}' disconnected. Its commands are no longer available. Starting health check...`),this.unregisterServerProcessors(t);const e=this.connections.get(t);e&&e.startHealthCheck()}unregisterServerProcessors(t){const e=`${t}:`,r=this.registry.processors.filter(n=>n.command.startsWith(e));for(const n of r)this.registry.unregisterProcessor(n);this.unregisterBareAliases(),this.registerBareAliases()}unregisterBareAliases(){var t,e;for(const r of[...this.registry.processors])(((t=r.metadata)==null?void 0:t.module)==="server:multi"||(e=r.metadata)!=null&&e.requireServer&&!r.command.includes(":"))&&this.registry.unregisterProcessor(r)}registerProxyProcessors(t,e){for(const r of t.commands){const n=new CliServerProxyProcessor(t,r,e);this.registry.registerProcessor(n)}}registerBareAliases(){var e;const t=new Map;for(const[r,n]of this.connections)if(n.connected)for(const o of n.commands){const u=t.get(o.command)??[];u.push(r),t.set(o.command,u)}for(const[r,n]of t){const o=this.registry.findProcessor(r,[]);if(!(o&&!((e=o.metadata)!=null&&e.requireServer)))if(n.length===1){const u=n[0],h=`${u}:${r}`;if(!this.registry.findProcessor(h,[]))continue;const l=this.connections.get(u),f=l.commands.find(d=>d.command===r),C=new CliServerProxyProcessor(l,f,u);C.command=r,C.aliases=[h],this.registry.registerProcessor(C)}else{const u=n.map(a=>{const l=this.connections.get(a),f=l.commands.find(C=>C.command===r);return{serverName:a,connection:l,descriptor:f}}),h=new CliServerMultiProxyProcessor(u,this);this.registry.registerProcessor(h)}}}},JsFallbackAccelerator=class{constructor(){this.ruleSets=new Map}textSearch(t,e,r,n,o,u){if(!e)return[-1,-1];const h=t.split(`
137
- `),a=o?e:e.toLowerCase();for(let l=r;l<h.length;l++){const f=o?h[l]:h[l].toLowerCase(),C=l===r?n+1:0,d=f.indexOf(a,C);if(d!==-1)return[l,d]}if(!u)return[-1,-1];for(let l=0;l<=r;l++){const f=o?h[l]:h[l].toLowerCase(),C=l===r?n:f.length,d=f.indexOf(a);if(d!==-1&&d<C)return[l,d]}return[-1,-1]}textReplaceAll(t,e,r,n){if(!e)return{count:0,text:t};const o=t.split(`
138
- `);let u=0;for(let h=0;h<o.length;h++){let a=o[h],l="",f=0;for(;f<=a.length;){const C=n?a:a.toLowerCase(),d=n?e:e.toLowerCase(),P=C.indexOf(d,f);if(P===-1){l+=a.slice(f);break}l+=a.slice(f,P)+r,f=P+e.length,u++}o[h]!==l&&(o[h]=l)}return{count:u,text:o.join(`
139
- `)}}prefixMatch(t,e){const r=e.toLowerCase(),n=[];for(const o of t)o.toLowerCase().startsWith(r)&&n.push(o);return n.sort()}registerRuleSet(t,e){const r=[];for(const n of e.split(`
140
- `)){if(!n)continue;const o=n.split(" ");if(!(o.length<2))try{r.push({pattern:new RegExp(o[0]),tokenType:o[1],captureGroup:o[2]?parseInt(o[2],10):0})}catch{}}this.ruleSets.set(t,r)}tokenizeLine(t,e){const r=this.ruleSets.get(e);if(!r||!t)return"";const n=[];let o=0;for(;o<t.length;){let u=!1;for(const h of r){h.pattern.lastIndex=0;const a=t.slice(o),l=h.pattern.exec(a);if(l){let f,C;if(h.captureGroup>0&&l[h.captureGroup]!==void 0){const d=l[h.captureGroup],P=l[0].indexOf(d);f=o+l.index+P,C=f+d.length}else f=o+l.index,C=o+l.index+l[0].length;if(o+l.index+l[0].length>o){n.push(`${f},${C},${h.tokenType}`),o=o+l.index+l[0].length,u=!0;break}}}u||o++}return n.join(`
141
- `)}commonPrefix(t){if(t.length===0)return"";let e=t[0];for(let r=1;r<t.length;r++)for(;!t[r].startsWith(e);)if(e=e.slice(0,-1),e==="")return"";return e}},accelerator=null,initialized=!1,wasmLoaded=!1,WASM_SEARCH_PATHS=["/assets/wasm/qodalis_cli_wasm_bg.wasm","./assets/wasm/qodalis_cli_wasm_bg.wasm","/wasm/qodalis_cli_wasm_bg.wasm"],wasm,cachedDataViewMemory0=null,cachedInt32ArrayMemory0=null,cachedUint8ArrayMemory0=null,WASM_VECTOR_LEN=0,cachedTextDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});cachedTextDecoder.decode();var MAX_SAFARI_DECODE_BYTES=2146435072,numBytesDecoded=0,cachedTextEncoder=new TextEncoder;"encodeInto"in cachedTextEncoder||(cachedTextEncoder.encodeInto=function(t,e){const r=cachedTextEncoder.encode(t);return e.set(r),{read:t.length,written:r.length}});function getDataViewMemory0(){return(cachedDataViewMemory0===null||cachedDataViewMemory0.buffer.detached===!0||cachedDataViewMemory0.buffer.detached===void 0&&cachedDataViewMemory0.buffer!==wasm.memory.buffer)&&(cachedDataViewMemory0=new DataView(wasm.memory.buffer)),cachedDataViewMemory0}function getInt32ArrayMemory0(){return(cachedInt32ArrayMemory0===null||cachedInt32ArrayMemory0.byteLength===0)&&(cachedInt32ArrayMemory0=new Int32Array(wasm.memory.buffer)),cachedInt32ArrayMemory0}function getUint8ArrayMemory0(){return(cachedUint8ArrayMemory0===null||cachedUint8ArrayMemory0.byteLength===0)&&(cachedUint8ArrayMemory0=new Uint8Array(wasm.memory.buffer)),cachedUint8ArrayMemory0}function decodeText(t,e){return numBytesDecoded+=e,numBytesDecoded>=MAX_SAFARI_DECODE_BYTES&&(cachedTextDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),cachedTextDecoder.decode(),numBytesDecoded=e),cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(t,t+e))}function getStringFromWasm0(t,e){return t=t>>>0,decodeText(t,e)}function passStringToWasm0(t,e,r){if(r===void 0){const a=cachedTextEncoder.encode(t),l=e(a.length,1)>>>0;return getUint8ArrayMemory0().subarray(l,l+a.length).set(a),WASM_VECTOR_LEN=a.length,l}let n=t.length,o=e(n,1)>>>0;const u=getUint8ArrayMemory0();let h=0;for(;h<n;h++){const a=t.charCodeAt(h);if(a>127)break;u[o+h]=a}if(h!==n){h!==0&&(t=t.slice(h)),o=r(o,n,n=h+t.length*3,1)>>>0;const a=getUint8ArrayMemory0().subarray(o+h,o+n),l=cachedTextEncoder.encodeInto(t,a);h+=l.written,o=r(o,n,h,1)>>>0}return WASM_VECTOR_LEN=h,o}function getArrayI32FromWasm0(t,e){return t=t>>>0,getInt32ArrayMemory0().subarray(t/4,t/4+e)}function wasmTextSearch(t,e,r,n,o,u){try{const h=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),l=WASM_VECTOR_LEN,f=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),C=WASM_VECTOR_LEN;wasm.text_search(h,a,l,f,C,r,n,o,u);const d=getDataViewMemory0().getInt32(h+0,!0),P=getDataViewMemory0().getInt32(h+4,!0),H=getArrayI32FromWasm0(d,P).slice();return wasm.__wbindgen_export3(d,P*4,4),H}finally{wasm.__wbindgen_add_to_stack_pointer(16)}}function wasmTextReplaceAll(t,e,r,n){let o,u;try{const h=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),l=WASM_VECTOR_LEN,f=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),C=WASM_VECTOR_LEN,d=passStringToWasm0(r,wasm.__wbindgen_export,wasm.__wbindgen_export2),P=WASM_VECTOR_LEN;return wasm.text_replace_all(h,a,l,f,C,d,P,n),o=getDataViewMemory0().getInt32(h+0,!0),u=getDataViewMemory0().getInt32(h+4,!0),getStringFromWasm0(o,u)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(o,u,1)}}function wasmPrefixMatch(t,e){let r,n;try{const o=wasm.__wbindgen_add_to_stack_pointer(-16),u=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),h=WASM_VECTOR_LEN,a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),l=WASM_VECTOR_LEN;return wasm.prefix_match(o,u,h,a,l),r=getDataViewMemory0().getInt32(o+0,!0),n=getDataViewMemory0().getInt32(o+4,!0),getStringFromWasm0(r,n)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function wasmCommonPrefix(t){let e,r;try{const n=wasm.__wbindgen_add_to_stack_pointer(-16),o=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),u=WASM_VECTOR_LEN;return wasm.common_prefix(n,o,u),e=getDataViewMemory0().getInt32(n+0,!0),r=getDataViewMemory0().getInt32(n+4,!0),getStringFromWasm0(e,r)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(e,r,1)}}function wasmRegisterRuleSet(t,e){const r=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,o=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),u=WASM_VECTOR_LEN;wasm.register_rule_set(r,n,o,u)}function wasmTokenizeLine(t,e){let r,n;try{const o=wasm.__wbindgen_add_to_stack_pointer(-16),u=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),h=WASM_VECTOR_LEN,a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),l=WASM_VECTOR_LEN;return wasm.tokenize_line(o,u,h,a,l),r=getDataViewMemory0().getInt32(o+0,!0),n=getDataViewMemory0().getInt32(o+4,!0),getStringFromWasm0(r,n)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}async function instantiateWasm(t){const e={__proto__:null,"./qodalis_cli_wasm_bg.js":{__proto__:null}},{instance:r}=await WebAssembly.instantiate(t,e);wasm=r.exports,cachedDataViewMemory0=null,cachedInt32ArrayMemory0=null,cachedUint8ArrayMemory0=null}async function fetchWasmBinary(t){for(const e of t)try{const r=await fetch(e);if(r.ok)return await r.arrayBuffer()}catch{}throw new Error("WASM binary not found")}function createWasmAccelerator(){return{textSearch(t,e,r,n,o,u){const h=wasmTextSearch(t,e,r,n,o,u);return[h[0],h[1]]},textReplaceAll(t,e,r,n){const o=wasmTextReplaceAll(t,e,r,n),u=o.indexOf(`
142
- `);return{count:parseInt(o.slice(0,u),10),text:o.slice(u+1)}},prefixMatch(t,e){const r=wasmPrefixMatch(t.join(`
143
- `),e);return r===""?[]:r.split(`
144
- `)},commonPrefix(t){return wasmCommonPrefix(t.join(`
145
- `))},registerRuleSet(t,e){wasmRegisterRuleSet(t,e)},tokenizeLine(t,e){return wasmTokenizeLine(t,e)}}}async function initWasmAccelerator(t){if(initialized&&accelerator)return accelerator;try{const e=t?[t,...WASM_SEARCH_PATHS]:WASM_SEARCH_PATHS,r=await fetchWasmBinary(e);await instantiateWasm(r),accelerator=createWasmAccelerator(),wasmLoaded=!0}catch{accelerator=new JsFallbackAccelerator}return initialized=!0,accelerator}function getAccelerator(){return accelerator||(accelerator=new JsFallbackAccelerator),accelerator}function isWasmAccelerated(){return wasmLoaded}var CliDebugCommandProcessor=class{constructor(){this.command="debug",this.description="Displays detailed system diagnostics and CLI internals",this.author=DefaultLibraryAuthor,this.metadata={sealed:!0,icon:CliIcon.Bug,module:"system",hidden:!0},this.processors=[{command:"processors",description:"List all registered command processors",metadata:{icon:CliIcon.Extension,module:"system"},processCommand:async(t,e)=>{var u,h,a,l,f,C,d;const{writer:r}=e,n=e.services.get(CliProcessorsRegistry_TOKEN);r.writeln(r.wrapInColor("Registered Processors:",CliForegroundColor.Yellow)),r.writeln();const o=[];for(const P of n.processors){const H=this.countProcessors(P.processors||[]);o.push([P.command,((u=P.aliases)==null?void 0:u.join(", "))||"-",P.version||"-",((h=P.metadata)==null?void 0:h.module)||"uncategorized",(a=P.metadata)!=null&&a.sealed?"yes":"no",(l=P.metadata)!=null&&l.hidden?"yes":"no",String(H),((C=(f=P.originalProcessor)==null?void 0:f.metadata)==null?void 0:C.module)||"-",((d=P.author)==null?void 0:d.name)||"-"])}r.writeTable(["Command","Aliases","Version","Module","Sealed","Hidden","Children","Extends","Author"],o),r.writeln(),r.writeln(`Total: ${r.wrapInColor(String(n.processors.length),CliForegroundColor.Cyan)} root processors`)}},{command:"modules",description:"List all loaded CLI modules",metadata:{icon:CliIcon.Module,module:"system"},processCommand:async(t,e)=>{const{writer:r}=e;let n;try{n=e.services.get(CliModuleRegistry_TOKEN)}catch{r.writeError("Module registry not available.");return}const o=n.getAll();r.writeln(r.wrapInColor("Loaded Modules:",CliForegroundColor.Yellow)),r.writeln();const u=o.map(h=>{var a,l;return[h.name,h.version||"-",h.description||"-",String(((a=h.processors)==null?void 0:a.length)||0),((l=h.dependencies)==null?void 0:l.join(", "))||"-"]});r.writeTable(["Name","Version","Description","Processors","Dependencies"],u),r.writeln(),r.writeln(`Total: ${r.wrapInColor(String(o.length),CliForegroundColor.Cyan)} modules`)}},{command:"state",description:"Inspect all state stores and their values",metadata:{icon:CliIcon.Database,module:"system"},processCommand:async(t,e)=>{const{writer:r}=e,o=e.services.get(CliStateStoreManager_TOKEN).getStoreEntries();if(r.writeln(r.wrapInColor("State Stores:",CliForegroundColor.Yellow)),r.writeln(),o.length===0)r.writeln(" No state stores initialized yet.");else for(const u of o)r.writeln(` ${r.wrapInColor(u.name,CliForegroundColor.Cyan)}:`),r.writeJson(u.state),r.writeln();r.writeln(`Total: ${r.wrapInColor(String(o.length),CliForegroundColor.Cyan)} stores`)}},{command:"services",description:"List all registered services in the DI container",metadata:{icon:CliIcon.Gear,module:"system"},processCommand:async(t,e)=>{const{writer:r}=e,n=e.services;if(!n.getRegisteredServiceDetails){r.writeError("Service introspection not available.");return}const o=n.getRegisteredServiceDetails();r.writeln(r.wrapInColor("Registered Services:",CliForegroundColor.Yellow)),r.writeln(),r.writeTable(["Token","Type","Multi"],o.map(u=>[u.token,u.type,u.multi?"yes":"no"])),r.writeln(),r.writeln(`Total: ${r.wrapInColor(String(o.length),CliForegroundColor.Cyan)} services`)}},{command:"environment",description:"Show browser, terminal, and framework information",metadata:{icon:CliIcon.Network,module:"system"},processCommand:async(t,e)=>{var o;const{writer:r}=e;r.writeln(r.wrapInColor("Environment:",CliForegroundColor.Yellow)),r.writeln(),r.writeln(` ${r.wrapInColor("Core Version:",CliForegroundColor.Cyan)} ${LIBRARY_VERSION$1}`),r.writeln(` ${r.wrapInColor("CLI Version:",CliForegroundColor.Cyan)} ${LIBRARY_VERSION}`);let n="vanilla";try{n=e.services.get("cli-framework")}catch{}r.writeln(` ${r.wrapInColor("Framework:",CliForegroundColor.Cyan)} ${n}`),r.writeln(` ${r.wrapInColor("Terminal Cols:",CliForegroundColor.Cyan)} ${e.terminal.cols}`),r.writeln(` ${r.wrapInColor("Terminal Rows:",CliForegroundColor.Cyan)} ${e.terminal.rows}`),r.writeln(` ${r.wrapInColor("Log Level:",CliForegroundColor.Cyan)} ${((o=e.options)==null?void 0:o.logLevel)??"default"}`),r.writeln(),typeof navigator<"u"?(r.writeln(` ${r.wrapInColor("User Agent:",CliForegroundColor.Cyan)} ${navigator.userAgent}`),r.writeln(` ${r.wrapInColor("Language:",CliForegroundColor.Cyan)} ${navigator.language}`),r.writeln(` ${r.wrapInColor("Platform:",CliForegroundColor.Cyan)} ${navigator.platform}`),r.writeln(` ${r.wrapInColor("Online:",CliForegroundColor.Cyan)} ${navigator.onLine}`),r.writeln(` ${r.wrapInColor("Cookies Enabled:",CliForegroundColor.Cyan)} ${navigator.cookieEnabled}`)):r.writeln(" Browser information not available.")}},{command:"history",description:"Show command history statistics",metadata:{icon:CliIcon.Logs,module:"system"},processCommand:async(t,e)=>{const{writer:r}=e,o=e.services.get(CliCommandHistory_TOKEN).getHistory(),u=o.length;if(r.writeln(r.wrapInColor("Command History Stats:",CliForegroundColor.Yellow)),r.writeln(),r.writeln(` ${r.wrapInColor("Total Commands:",CliForegroundColor.Cyan)} ${u}`),u>0){const h=new Set(o.map(d=>d.split(" ")[0]));r.writeln(` ${r.wrapInColor("Unique Commands:",CliForegroundColor.Cyan)} ${h.size}`);const a=new Map;for(const d of o){const P=d.split(" ")[0];a.set(P,(a.get(P)||0)+1)}const f=Array.from(a.entries()).sort((d,P)=>P[1]-d[1]).slice(0,10);r.writeln(),r.writeln(r.wrapInColor(" Most Used:",CliForegroundColor.Yellow)),r.writeTable(["Command","Count"],f.map(([d,P])=>[d,String(P)])),r.writeln(),r.writeln(r.wrapInColor(" Recent Commands:",CliForegroundColor.Yellow));const C=o.slice(-10);for(let d=C.length-1;d>=0;d--)r.writeln(` ${r.wrapInColor(String(o.length-(C.length-1-d)),CliForegroundColor.Green)} ${C[d]}`)}}},{command:"health",description:"Check system health: storage, connectivity, processor status",metadata:{icon:CliIcon.Heart,module:"system"},processCommand:async(t,e)=>{const{writer:r}=e;r.writeln(r.wrapInColor("Health Check:",CliForegroundColor.Yellow)),r.writeln();const n=typeof indexedDB<"u";r.writeln(` ${n?CliIcon.CheckIcon:CliIcon.CrossIcon} IndexedDB: ${n?"available":"unavailable"}`);let o=!1;try{localStorage.setItem("__cli_health_test","1"),localStorage.removeItem("__cli_health_test"),o=!0}catch{}r.writeln(` ${o?CliIcon.CheckIcon:CliIcon.CrossIcon} localStorage: ${o?"available":"unavailable"}`);const u=typeof navigator<"u"?navigator.onLine:!1;r.writeln(` ${u?CliIcon.CheckIcon:CliIcon.CrossIcon} Network: ${u?"online":"offline"}`);const h=e.services.get(CliProcessorsRegistry_TOKEN);r.writeln(` ${CliIcon.CheckIcon} Processors: ${h.processors.length} loaded`);try{const C=e.services.get(CliModuleRegistry_TOKEN).getAll();r.writeln(` ${CliIcon.CheckIcon} Modules: ${C.length} loaded`)}catch{r.writeln(` ${CliIcon.WarningIcon} Modules: registry not available`)}const a=isWasmAccelerated();r.writeln(` ${a?CliIcon.CheckIcon:CliIcon.WarningIcon} WASM Accelerator: ${a?"loaded":"using JS fallback"}`);const l=e.services.get(CliCommandHistory_TOKEN);r.writeln(` ${CliIcon.CheckIcon} History: ${l.getHistory().length} commands stored`)}},{command:"export",description:"Export all debug info as JSON",metadata:{icon:CliIcon.Save,module:"system"},processCommand:async(t,e)=>{const{writer:r}=e,n=e.services.get(CliProcessorsRegistry_TOKEN),o=e.services.get(CliCommandHistory_TOKEN),u=e.services.get(CliStateStoreManager_TOKEN),h={versions:{core:LIBRARY_VERSION$1,cli:LIBRARY_VERSION},wasmAccelerated:isWasmAccelerated(),environment:{userAgent:typeof navigator<"u"?navigator.userAgent:"N/A",language:typeof navigator<"u"?navigator.language:"N/A",platform:typeof navigator<"u"?navigator.platform:"N/A",online:typeof navigator<"u"?navigator.onLine:!1,terminalCols:e.terminal.cols,terminalRows:e.terminal.rows},processors:n.processors.map(l=>{var f,C,d,P,H;return{command:l.command,aliases:l.aliases||[],version:l.version||null,module:((f=l.metadata)==null?void 0:f.module)||"uncategorized",sealed:((C=l.metadata)==null?void 0:C.sealed)||!1,hidden:((d=l.metadata)==null?void 0:d.hidden)||!1,children:this.countProcessors(l.processors||[]),extends:((H=(P=l.originalProcessor)==null?void 0:P.metadata)==null?void 0:H.module)||null}}),history:{total:o.getHistory().length},state:u.getStoreEntries()};try{const l=e.services.get(CliModuleRegistry_TOKEN);h.modules=l.getAll().map(f=>{var C;return{name:f.name,version:f.version||null,description:f.description||null,processors:((C=f.processors)==null?void 0:C.length)||0,dependencies:f.dependencies||[]}})}catch{h.modules="registry not available"}const a=e.services;a.getRegisteredTokens&&(h.services=a.getRegisteredTokens());try{const l=e.services.get(CliServerManager_TOKEN);l&&l.connections.size>0&&(h.servers=Array.from(l.connections.entries()).map(([f,C])=>({name:f,url:C.config.url,connected:C.connected,commands:C.connected?C.commands.length:0})))}catch{}r.writeJson(h)}},{command:"servers",description:"List configured servers and their connection status",metadata:{icon:CliIcon.Server,module:"system"},processCommand:async(t,e)=>{const{writer:r}=e;let n;try{n=e.services.get(CliServerManager_TOKEN)}catch{}if(!n||n.connections.size===0){r.writeInfo("No servers configured.");return}r.writeln(r.wrapInColor("Configured Servers:",CliForegroundColor.Yellow)),r.writeln();const o=[];for(const[a,l]of n.connections)o.push([a,l.config.url,l.connected?"Connected":"Disconnected",l.connected?String(l.commands.length):"-",l.config.timeout?`${l.config.timeout}ms`:"default"]);r.writeTable(["Name","URL","Status","Commands","Timeout"],o),r.writeln();const u=Array.from(n.connections.values()).filter(a=>a.connected).length,h=n.connections.size;r.writeln(`Total: ${r.wrapInColor(String(h),CliForegroundColor.Cyan)} servers (${r.wrapInColor(String(u),CliForegroundColor.Green)} connected)`)}}]}async processCommand(t,e){const{writer:r}=e,n=e.services.get(CliProcessorsRegistry_TOKEN);r.writeln(r.wrapInColor(`${CliIcon.Bug} CLI Debug Info`,CliForegroundColor.Yellow)),r.writeDivider({char:"="}),r.writeln(` ${r.wrapInColor("Core Version:",CliForegroundColor.Cyan)} ${LIBRARY_VERSION$1}`),r.writeln(` ${r.wrapInColor("CLI Version:",CliForegroundColor.Cyan)} ${LIBRARY_VERSION}`);let o="vanilla";try{o=e.services.get("cli-framework")}catch{}r.writeln(` ${r.wrapInColor("Framework:",CliForegroundColor.Cyan)} ${o}`),r.writeln(` ${r.wrapInColor("Terminal:",CliForegroundColor.Cyan)} ${e.terminal.cols}x${e.terminal.rows}`),r.writeln(` ${r.wrapInColor("Processors:",CliForegroundColor.Cyan)} ${n.processors.length}`);try{const a=e.services.get(CliModuleRegistry_TOKEN);r.writeln(` ${r.wrapInColor("Modules:",CliForegroundColor.Cyan)} ${a.getAll().length}`)}catch{}try{const a=e.services.get(CliServerManager_TOKEN);if(a&&a.connections.size>0){const l=Array.from(a.connections.values()).filter(f=>f.connected).length;r.writeln(` ${r.wrapInColor("Servers:",CliForegroundColor.Cyan)} ${l}/${a.connections.size} connected`)}}catch{}const u=e.services.get(CliCommandHistory_TOKEN);r.writeln(` ${r.wrapInColor("History:",CliForegroundColor.Cyan)} ${u.getHistory().length} commands`);const h=isWasmAccelerated()?"active":"inactive (JS fallback)";r.writeln(` ${r.wrapInColor("WASM Accelerator:",CliForegroundColor.Cyan)} ${h}`),r.writeDivider({char:"="}),r.writeln(),r.writeln(`${CliIcon.Light} Subcommands:`);for(const a of this.processors||[])r.writeln(` ${r.wrapInColor(`debug ${a.command}`,CliForegroundColor.Cyan)} ${a.description}`)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.debug.long_description","Displays detailed system diagnostics and CLI internals.")),e.writeln(r.t("cli.debug.hidden_note","This command is hidden from the help listing but accessible directly.")),e.writeln(),e.writeln(r.t("cli.common.usage","Usage:")),e.writeln(` ${e.wrapInColor("debug",CliForegroundColor.Cyan)} ${r.t("cli.debug.summary","System summary")}`),e.writeln(` ${e.wrapInColor("debug processors",CliForegroundColor.Cyan)} ${r.t("cli.debug.processors","All registered processors")}`),e.writeln(` ${e.wrapInColor("debug modules",CliForegroundColor.Cyan)} ${r.t("cli.debug.modules","All loaded modules")}`),e.writeln(` ${e.wrapInColor("debug state",CliForegroundColor.Cyan)} ${r.t("cli.debug.state","Inspect state stores")}`),e.writeln(` ${e.wrapInColor("debug services",CliForegroundColor.Cyan)} List DI services`),e.writeln(` ${e.wrapInColor("debug environment",CliForegroundColor.Cyan)} Browser/terminal info`),e.writeln(` ${e.wrapInColor("debug history",CliForegroundColor.Cyan)} Command history stats`),e.writeln(` ${e.wrapInColor("debug health",CliForegroundColor.Cyan)} System health check`),e.writeln(` ${e.wrapInColor("debug export",CliForegroundColor.Cyan)} Export all as JSON`),e.writeln(` ${e.wrapInColor("debug servers",CliForegroundColor.Cyan)} Server connections`)}countProcessors(t){let e=t.length;for(const r of t)r.processors&&(e+=this.countProcessors(r.processors));return e}},NanoEditorBuffer=class{constructor(){this.lines=[""],this.cursorRow=0,this.cursorCol=0,this.scrollOffset=0,this.dirty=!1,this.clipboard=[]}load(t){this.lines=t.split(`
146
- `),this.lines.length===0&&(this.lines=[""]),this.cursorRow=0,this.cursorCol=0,this.scrollOffset=0,this.dirty=!1}getContent(){return this.lines.join(`
147
- `)}insertChar(t){const e=this.lines[this.cursorRow];this.lines[this.cursorRow]=e.slice(0,this.cursorCol)+t+e.slice(this.cursorCol),this.cursorCol+=t.length,this.dirty=!0}insertNewline(){const t=this.lines[this.cursorRow],e=t.slice(0,this.cursorCol),r=t.slice(this.cursorCol);this.lines[this.cursorRow]=e,this.lines.splice(this.cursorRow+1,0,r),this.cursorRow++,this.cursorCol=0,this.dirty=!0}deleteCharBefore(){if(this.cursorCol>0){const t=this.lines[this.cursorRow];this.lines[this.cursorRow]=t.slice(0,this.cursorCol-1)+t.slice(this.cursorCol),this.cursorCol--,this.dirty=!0}else if(this.cursorRow>0){const t=this.lines[this.cursorRow-1],e=this.lines[this.cursorRow];this.cursorCol=t.length,this.lines[this.cursorRow-1]=t+e,this.lines.splice(this.cursorRow,1),this.cursorRow--,this.dirty=!0}}deleteCharAt(){const t=this.lines[this.cursorRow];this.cursorCol<t.length?(this.lines[this.cursorRow]=t.slice(0,this.cursorCol)+t.slice(this.cursorCol+1),this.dirty=!0):this.cursorRow<this.lines.length-1&&(this.lines[this.cursorRow]=t+this.lines[this.cursorRow+1],this.lines.splice(this.cursorRow+1,1),this.dirty=!0)}deleteLine(){const t=this.lines[this.cursorRow];this.clipboard.push(t),this.lines.length===1?(this.lines[0]="",this.cursorCol=0):(this.lines.splice(this.cursorRow,1),this.cursorRow>=this.lines.length&&(this.cursorRow=this.lines.length-1),this.cursorCol=Math.min(this.cursorCol,this.lines[this.cursorRow].length)),this.dirty=!0}uncutLines(){return this.clipboard.length===0?!1:(this.lines.splice(this.cursorRow,0,...this.clipboard),this.cursorRow+=this.clipboard.length,this.cursorCol=Math.min(this.cursorCol,this.lines[this.cursorRow].length),this.clipboard=[],this.dirty=!0,!0)}moveUp(){this.cursorRow>0&&(this.cursorRow--,this.cursorCol=Math.min(this.cursorCol,this.lines[this.cursorRow].length))}moveDown(){this.cursorRow<this.lines.length-1&&(this.cursorRow++,this.cursorCol=Math.min(this.cursorCol,this.lines[this.cursorRow].length))}moveLeft(){this.cursorCol>0?this.cursorCol--:this.cursorRow>0&&(this.cursorRow--,this.cursorCol=this.lines[this.cursorRow].length)}moveRight(){this.cursorCol<this.lines[this.cursorRow].length?this.cursorCol++:this.cursorRow<this.lines.length-1&&(this.cursorRow++,this.cursorCol=0)}moveHome(){this.cursorCol=0}moveEnd(){this.cursorCol=this.lines[this.cursorRow].length}pageUp(t){this.cursorRow=Math.max(0,this.cursorRow-t),this.cursorCol=Math.min(this.cursorCol,this.lines[this.cursorRow].length)}pageDown(t){this.cursorRow=Math.min(this.lines.length-1,this.cursorRow+t),this.cursorCol=Math.min(this.cursorCol,this.lines[this.cursorRow].length)}moveToStart(){this.cursorRow=0,this.cursorCol=0}moveToEnd(){this.cursorRow=this.lines.length-1,this.cursorCol=this.lines[this.cursorRow].length}searchForward(t,e=!1){if(!t)return!1;const r=getAccelerator(),n=this.lines.join(`
148
- `),[o,u]=r.textSearch(n,t,this.cursorRow,this.cursorCol,e,!0);return o===-1?!1:(this.cursorRow=o,this.cursorCol=u,!0)}replaceNext(t,e,r=!1){if(!t)return!1;const n=this.lines[this.cursorRow],o=r?t:t.toLowerCase();return(r?n:n.toLowerCase()).startsWith(o,this.cursorCol)?(this.lines[this.cursorRow]=n.slice(0,this.cursorCol)+e+n.slice(this.cursorCol+t.length),this.cursorCol+=e.length,this.dirty=!0,!0):!1}replaceAll(t,e,r=!1){if(!t)return 0;const n=getAccelerator(),o=this.lines.join(`
149
- `),u=n.textReplaceAll(o,t,e,r);return u.count>0&&(this.lines=u.text.split(`
150
- `),this.dirty=!0),u.count}ensureVisible(t){this.cursorRow<this.scrollOffset?this.scrollOffset=this.cursorRow:this.cursorRow>=this.scrollOffset+t&&(this.scrollOffset=this.cursorRow-t+1)}},NanoEditorRenderer=class{constructor(t){this.terminal=t}enterAlternateScreen(){this.terminal.write("\x1B[?1049h"),this.terminal.write("\x1B[?25l")}leaveAlternateScreen(){this.terminal.write("\x1B[?25h"),this.terminal.write("\x1B[?1049l")}get contentHeight(){return this.terminal.rows-3}render(t,e,r){const{rows:n,cols:o}=this.terminal;t.ensureVisible(this.contentHeight);let u="\x1B[?25l";u+="\x1B[H",u+=this.renderTitleBar(e,t.dirty,o);for(let l=0;l<this.contentHeight;l++){const f=t.scrollOffset+l;if(u+=`\x1B[${l+2};1H`,u+="\x1B[2K",f<t.lines.length){const C=t.lines[f];this.highlightEngine?u+=this.highlightEngine.renderLine(f,C,o):u+=C.length>o?C.slice(0,o):C}}u+=`\x1B[${n-1};1H`,u+=this.renderShortcutBar(o),u+=`\x1B[${n};1H`,u+=this.renderStatusBar(r,o);const h=t.cursorRow-t.scrollOffset+2,a=t.cursorCol+1;u+=`\x1B[${h};${a}H`,u+="\x1B[?25h",this.terminal.write(u)}renderStatusOnly(t,e){const{rows:r,cols:n}=this.terminal;let o=`\x1B[${r};1H`;o+=this.renderStatusBar(e,n);const u=t.cursorRow-t.scrollOffset+2,h=t.cursorCol+1;o+=`\x1B[${u};${h}H`,this.terminal.write(o)}renderHelp(){const{rows:t,cols:e}=this.terminal,r=[""," CLI Nano Help",""," Main shortcuts:",""," ^G Help ^O Write Out ^F Search ^K Cut Line"," ^X Exit ^R Read File ^\\ Replace ^U Paste Line",""," Navigation:",""," ^A Home ^E End ^Y Page Up ^V Page Down"," ^P Prev Line ^N Next Line Arrow Keys ^B Backward",""," Other:",""," ^C Cur Pos ^S Save (alt) ^J Justify ^T To Spell",""," Arrow keys, Home, End, Page Up, Page Down also work.","",""," [ Press any key to return ]"];let n="\x1B[?25l\x1B[H";n+=`\x1B[7m${" CLI Nano Help".padEnd(e)}\x1B[0m`;for(let u=0;u<t-2;u++)n+=`\x1B[${u+2};1H\x1B[2K`,u<r.length&&(n+=r[u].slice(0,e));n+=`\x1B[${t};1H`,n+=`\x1B[7m${" [ Press any key to return ]".padEnd(e)}\x1B[0m`,this.terminal.write(n)}renderTitleBar(t,e,r){return`\x1B[7m${` CLI Nano ${t||"New Buffer"}${e?" (modified)":""}`.padEnd(r)}\x1B[0m`}renderShortcutBar(t){return`\x1B[7m${"^G Help ^O Write Out ^F Search ^K Cut ^C Cur Pos".padEnd(t)}\x1B[0m`}renderStatusBar(t,e){return`\x1B[7m${(t||"^X Exit ^R Read File ^\\ Replace ^U Paste ^S Save").padEnd(e)}\x1B[0m`}};function truncateAnsi(t,e){let r=0,n=0,o="",u=!1;for(;n<t.length&&r<e;)if(t[n]==="\x1B"&&n+1<t.length&&t[n+1]==="["){let h=n+2;for(;h<t.length&&!(t.charCodeAt(h)>=64&&t.charCodeAt(h)<=126);)h++;if(h<t.length){const a=t.slice(n,h+1);o+=a,a==="\x1B[0m"?u=!1:u=!0,n=h+1}else break}else o+=t[n],r++,n++;return u&&(o+="\x1B[0m"),o}function parseTokens(t){return t?t.split(`
151
- `).map(e=>{const[r,n,...o]=e.split(",");return{start:parseInt(r,10),end:parseInt(n,10),tokenType:o.join(",")}}):[]}var SyntaxHighlightEngine=class{constructor(t,e,r){this.highlighter=t,this.theme=e,this.accelerator=r,this.cache=new Map,this.registeredRuleSets=new Set}invalidate(t){for(const e of this.cache.keys())e>=t&&this.cache.delete(e)}renderLine(t,e,r){var u;const n=t===0?this.highlighter.initialState:((u=this.cache.get(t-1))==null?void 0:u.exitState)??this.highlighter.initialState,o=this.cache.get(t);if(o&&o.lineContent===e&&o.entryState===n)return truncateAnsi(o.rendered,r);try{const h=`${this.highlighter.id}:${n}`;if(!this.registeredRuleSets.has(h)){const P=this.highlighter.getRules(n).map(H=>`${H.pattern.source} ${H.tokenType} ${H.captureGroup??0}`).join(`
152
- `);this.accelerator.registerRuleSet(h,P),this.registeredRuleSets.add(h)}const a=this.accelerator.tokenizeLine(e,h),l=parseTokens(a),f=this.highlighter.getNextLineState(e,n),C=this.applyTheme(e,l);return this.cache.set(t,{lineContent:e,entryState:n,exitState:f,rendered:C}),truncateAnsi(C,r)}catch{return e.length>r?e.slice(0,r):e}}applyTheme(t,e){if(e.length===0)return t;let r="",n=0;for(const o of e){o.start>n&&(r+=t.slice(n,o.start));const u=this.theme.colors[o.tokenType],h=t.slice(o.start,o.end);u?r+=u+h+"\x1B[0m":r+=h,n=o.end}return n<t.length&&(r+=t.slice(n)),r}},defaultSyntaxTheme={name:"default",colors:{keyword:"\x1B[93m",string:"\x1B[32m",number:"\x1B[36m",comment:"\x1B[90m",tag:"\x1B[91m",attribute:"\x1B[33m",value:"\x1B[36m",punctuation:"\x1B[97m",heading:"\x1B[1;93m",link:"\x1B[4;36m",bold:"\x1B[1m",italic:"\x1B[3m",code:"\x1B[90;47m"}},FS_TOKEN="cli-file-system-service",CliNanoCommandProcessor=class{constructor(){this.command="nano",this.aliases=["edit"],this.description="Open the built-in text editor",this.author=DefaultLibraryAuthor,this.acceptsRawInput=!0,this.metadata={icon:"📝",module:"system"},this.filePath=null,this.fs=null,this.resizeDisposable=null,this.statusTimeout=null,this.inputMode="normal",this.inputBuffer="",this.searchNeedle="",this.replaceWith="",this.replaceAllMode=!1}async processCommand(t,e){this.context=e,this.buffer=new NanoEditorBuffer,this.renderer=new NanoEditorRenderer(e.terminal),this.inputMode="normal",this.inputBuffer="",this.searchNeedle="",this.replaceWith="",this.statusMessage=void 0;try{this.fs=e.services.get(FS_TOKEN)}catch{this.fs=null}const r=(t.value||"").trim();if(r){if(this.filePath=r,this.fs)try{const n=this.fs.resolvePath(this.filePath);if(this.fs.exists(n)&&!this.fs.isDirectory(n)){const o=this.fs.readFile(n);o!==null&&this.buffer.load(o),this.filePath=n}else if(this.fs.exists(n)&&this.fs.isDirectory(n)){e.writer.writeError(`${this.filePath} is a directory`);return}else this.filePath=n}catch(n){e.writer.writeError(n.message||"Error opening file");return}}else this.filePath=null;this.setupHighlighting(this.filePath),e.enterFullScreenMode(this),this.renderer.render(this.buffer,this.filePath||"New Buffer"),this.resizeDisposable=e.terminal.onResize(()=>{this.inputMode==="help"?this.renderer.renderHelp():this.renderer.render(this.buffer,this.filePath||"New Buffer",this.statusMessage)})}async onData(t,e){var r,n,o,u;switch(this.inputMode){case"help":this.inputMode="normal",this.render();return;case"filename":this.handleTextPrompt(t,h=>{h?(this.filePath=this.fs.resolvePath(h),this.save()):this.showStatus("Cancelled")});return;case"search":this.handleTextPrompt(t,h=>{h?(this.searchNeedle=h,this.buffer.searchForward(this.searchNeedle)?this.render():this.showStatus(`"${this.searchNeedle}" not found`)):this.showStatus("Cancelled")});return;case"replace-needle":this.handleTextPrompt(t,h=>{h?(this.searchNeedle=h,this.inputMode="replace-with",this.inputBuffer=this.replaceWith,this.renderPrompt(`Replace with: ${this.inputBuffer}`)):this.showStatus("Cancelled")});return;case"replace-with":this.handleTextPrompt(t,h=>{if(this.replaceWith=h??"",this.replaceAllMode){const a=this.buffer.replaceAll(this.searchNeedle,this.replaceWith);this.showStatus(a>0?`Replaced ${a} occurrence${a>1?"s":""}`:`"${this.searchNeedle}" not found`)}else this.buffer.searchForward(this.searchNeedle)?(this.inputMode="replace-confirm",this.render(),this.renderPrompt("Replace this instance? [Y]es/[N]o/[A]ll/[C]ancel")):this.showStatus(`"${this.searchNeedle}" not found`)});return;case"replace-confirm":this.handleReplaceConfirm(t);return;case"exit-save-prompt":this.handleExitSavePrompt(t);return;case"read-file":this.handleTextPrompt(t,h=>{h?this.readFileIntoBuffer(h):this.showStatus("Cancelled")});return}if(t===""){this.exitEditor();return}if(t===""){await this.writeOut();return}if(t===""){await this.save();return}if(t==="\x07"){this.inputMode="help",this.renderer.renderHelp();return}if(t===""||t===""){this.inputMode="search",this.inputBuffer=this.searchNeedle,this.renderPrompt(`Search: ${this.inputBuffer}`);return}if(t===""){this.replaceAllMode=!1,this.inputMode="replace-needle",this.inputBuffer=this.searchNeedle,this.renderPrompt(`Search (to replace): ${this.inputBuffer}`);return}if(t==="\v"){this.buffer.deleteLine(),(r=this.renderer.highlightEngine)==null||r.invalidate(this.buffer.cursorRow),this.render();return}if(t===""){this.buffer.uncutLines()?((n=this.renderer.highlightEngine)==null||n.invalidate(this.buffer.cursorRow),this.render()):this.showStatus("Clipboard is empty");return}if(t===""){const h=this.buffer.cursorRow+1,a=this.buffer.cursorCol+1,l=this.buffer.lines.length;this.showStatus(`line ${h}/${l}, col ${a}`);return}if(t===""){if(!this.fs){this.showStatus("No filesystem available");return}this.inputMode="read-file",this.inputBuffer="",this.renderPrompt("File to insert: ");return}if(t===""){this.buffer.moveHome(),this.render();return}if(t===""){this.buffer.moveEnd(),this.render();return}if(t===""){this.buffer.moveUp(),this.render();return}if(t===""){this.buffer.moveDown(),this.render();return}if(t===""){this.buffer.moveLeft(),this.render();return}if(t===""){this.buffer.pageUp(this.renderer.contentHeight),this.render();return}if(t===""){this.buffer.pageDown(this.renderer.contentHeight),this.render();return}if(t==="\r"){this.buffer.insertNewline(),(o=this.renderer.highlightEngine)==null||o.invalidate(this.buffer.cursorRow-1),this.render();return}if(t===""){const h=this.buffer.cursorCol===0&&this.buffer.cursorRow>0;this.buffer.deleteCharBefore(),h&&((u=this.renderer.highlightEngine)==null||u.invalidate(this.buffer.cursorRow)),this.render();return}if(t==="\x1B[3~"){this.buffer.deleteCharAt(),this.render();return}if(t==="\x1B[A"){this.buffer.moveUp(),this.render();return}if(t==="\x1B[B"){this.buffer.moveDown(),this.render();return}if(t==="\x1B[C"){this.buffer.moveRight(),this.render();return}if(t==="\x1B[D"){this.buffer.moveLeft(),this.render();return}if(t==="\x1B[H"||t==="\x1B[1~"){this.buffer.moveHome(),this.render();return}if(t==="\x1B[F"||t==="\x1B[4~"){this.buffer.moveEnd(),this.render();return}if(t==="\x1B[5~"){this.buffer.pageUp(this.renderer.contentHeight),this.render();return}if(t==="\x1B[6~"){this.buffer.pageDown(this.renderer.contentHeight),this.render();return}t.startsWith("\x1B")||t.length===1&&t.charCodeAt(0)<32||(this.buffer.insertChar(t),this.render())}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.nano.long_description","Open the built-in nano-style text editor")),e.writeln(),e.writeln(r.t("cli.common.usage","Usage:")),e.writeln(` ${e.wrapInColor("nano",CliForegroundColor.Cyan)} ${r.t("cli.nano.open_empty","Open empty scratch buffer")}`),e.writeln(` ${e.wrapInColor("nano <file>",CliForegroundColor.Cyan)} ${r.t("cli.nano.open_file","Open or create a file")}`),e.writeln(),e.writeln(r.t("cli.nano.keyboard_shortcuts","Keyboard shortcuts:")),e.writeln(` ${e.wrapInColor("^X",CliForegroundColor.Yellow)} Exit ${e.wrapInColor("^O",CliForegroundColor.Yellow)} Write Out (save)`),e.writeln(` ${e.wrapInColor("^G",CliForegroundColor.Yellow)} Help ${e.wrapInColor("^F",CliForegroundColor.Yellow)} Search`),e.writeln(` ${e.wrapInColor("^K",CliForegroundColor.Yellow)} Cut line ${e.wrapInColor("^U",CliForegroundColor.Yellow)} Paste line`),e.writeln(` ${e.wrapInColor("^\\",CliForegroundColor.Yellow)} Replace ${e.wrapInColor("^R",CliForegroundColor.Yellow)} Read File`),e.writeln(` ${e.wrapInColor("^C",CliForegroundColor.Yellow)} Cursor position ${e.wrapInColor("^S",CliForegroundColor.Yellow)} Save (quick)`),e.writeln(` ${e.wrapInColor("^A",CliForegroundColor.Yellow)} Home ${e.wrapInColor("^E",CliForegroundColor.Yellow)} End`),e.writeln(` ${e.wrapInColor("^Y",CliForegroundColor.Yellow)} Page Up ${e.wrapInColor("^V",CliForegroundColor.Yellow)} Page Down`)}setupHighlighting(t){var e;if(!t){this.renderer.highlightEngine=void 0;return}try{const r=this.context.services.get("syntax-highlighter-registry"),n="."+((e=t.split(".").pop())==null?void 0:e.toLowerCase()),o=r.getByExtension(n);o?this.renderer.highlightEngine=new SyntaxHighlightEngine(o,defaultSyntaxTheme,getAccelerator()):this.renderer.highlightEngine=void 0}catch{this.renderer.highlightEngine=void 0}}render(){this.renderer.render(this.buffer,this.filePath||"New Buffer",this.statusMessage)}renderPrompt(t){this.renderer.renderStatusOnly(this.buffer,` ${t}`)}showStatus(t,e=2e3){this.statusMessage=` ${t}`,this.renderer.renderStatusOnly(this.buffer,this.statusMessage),this.statusTimeout&&clearTimeout(this.statusTimeout),this.statusTimeout=setTimeout(()=>{this.statusMessage=void 0,this.render()},e)}handleTextPrompt(t,e){if(t==="\r"){this.inputMode="normal",e(this.inputBuffer.trim()||null);return}if(t==="\x1B"||t===""){this.inputMode="normal",e(null);return}if(t==="")this.inputBuffer.length>0&&(this.inputBuffer=this.inputBuffer.slice(0,-1));else if(t.length===1&&t.charCodeAt(0)>=32)this.inputBuffer+=t;else return;const r=this.getPromptLabel();this.renderPrompt(`${r}${this.inputBuffer}`)}getPromptLabel(){switch(this.inputMode){case"filename":return"File Name to Write: ";case"search":return"Search: ";case"replace-needle":return"Search (to replace): ";case"replace-with":return"Replace with: ";case"read-file":return"File to insert: ";default:return""}}handleReplaceConfirm(t){const e=t.toLowerCase();if(e==="y")this.buffer.replaceNext(this.searchNeedle,this.replaceWith),this.buffer.searchForward(this.searchNeedle)?(this.render(),this.renderPrompt("Replace this instance? [Y]es/[N]o/[A]ll/[C]ancel")):(this.inputMode="normal",this.showStatus("No more occurrences"));else if(e==="n")this.buffer.searchForward(this.searchNeedle)?(this.render(),this.renderPrompt("Replace this instance? [Y]es/[N]o/[A]ll/[C]ancel")):(this.inputMode="normal",this.showStatus("No more occurrences"));else if(e==="a"){const r=this.buffer.replaceAll(this.searchNeedle,this.replaceWith);this.inputMode="normal",this.showStatus(`Replaced ${r} occurrence${r!==1?"s":""}`)}else(e==="c"||t==="\x1B"||t==="")&&(this.inputMode="normal",this.showStatus("Cancelled"))}exitEditor(){if(!this.buffer.dirty){this.cleanup();return}this.inputMode="exit-save-prompt",this.renderPrompt("Save modified buffer? [Y]es/[N]o/[C]ancel")}handleExitSavePrompt(t){const e=t.toLowerCase();e==="y"?(this.inputMode="normal",this.save().then(()=>{this.cleanup()})):e==="n"?(this.inputMode="normal",this.cleanup()):(e==="c"||t==="\x1B"||t==="")&&(this.inputMode="normal",this.render())}async writeOut(){if(!this.fs){this.showStatus("No filesystem available — install @qodalis/cli-files");return}if(!this.filePath){this.inputMode="filename",this.inputBuffer="",this.renderPrompt("File Name to Write: ");return}this.inputMode="filename",this.inputBuffer=this.filePath,this.renderPrompt(`File Name to Write: ${this.inputBuffer}`)}async save(){if(!this.fs){this.showStatus("No filesystem available — install @qodalis/cli-files");return}if(!this.filePath){this.inputMode="filename",this.inputBuffer="",this.renderPrompt("File Name to Write: ");return}try{const t=this.buffer.getContent();this.fs.exists(this.filePath)?this.fs.writeFile(this.filePath,t):this.fs.createFile(this.filePath,t),await this.fs.persist(),this.buffer.dirty=!1,this.showStatus(`Wrote ${this.buffer.lines.length} lines to ${this.filePath}`)}catch(t){this.showStatus(`Error: ${t.message}`)}}readFileIntoBuffer(t){if(!this.fs){this.showStatus("No filesystem available");return}try{const e=this.fs.resolvePath(t);if(!this.fs.exists(e)){this.showStatus(`File not found: ${t}`);return}if(this.fs.isDirectory(e)){this.showStatus(`${t} is a directory`);return}const r=this.fs.readFile(e);if(r===null){this.showStatus(`Could not read: ${t}`);return}const n=r.split(`
153
- `);this.buffer.lines.splice(this.buffer.cursorRow+1,0,...n),this.buffer.dirty=!0,this.showStatus(`Read ${n.length} lines from ${t}`)}catch(e){this.showStatus(`Error: ${e.message}`)}}cleanup(){var t;this.statusTimeout&&clearTimeout(this.statusTimeout),(t=this.resizeDisposable)==null||t.dispose(),this.context.exitFullScreenMode()}};function formatUptime(t){const e=Math.floor(t/1e3)%60,r=Math.floor(t/(1e3*60))%60,n=Math.floor(t/(1e3*60*60))%24,o=Math.floor(t/(1e3*60*60*24)),u=[];return o>0&&u.push(`${o}d`),n>0&&u.push(`${n}h`),r>0&&u.push(`${r}m`),u.push(`${e}s`),u.join(" ")}function colorStatus(t,e){switch(t){case"running":return e(t,CliForegroundColor.Green);case"stopped":return e(t,CliForegroundColor.White);case"failed":return e(t,CliForegroundColor.Red);case"done":return e(t,CliForegroundColor.Cyan);case"pending":return e(t,CliForegroundColor.Yellow);default:return t}}var CliServicesCommandProcessor=class{constructor(){this.command="services",this.aliases=["svc"],this.description="Manage background services and jobs",this.author=DefaultLibraryAuthor,this.processors=[],this.metadata={sealed:!0,icon:"⚙",module:"system"},this.processors=[{command:"list",aliases:["ls"],description:"List all registered background services",processCommand:async(t,e)=>{const{writer:r}=e,n=e.backgroundServices.list();if(n.length===0){r.writeInfo("No background services registered");return}const o=n.map(u=>[u.name,u.type,colorStatus(u.status,r.wrapInColor.bind(r)),u.executionMode,u.status==="running"&&u.uptime!=null?formatUptime(u.uptime):"-"]);r.writeTable(["Name","Type","Status","Mode","Uptime"],o)},writeDescription:t=>{const{writer:e}=t;e.writeln("List all registered background services with their status"),e.writeln(),e.writeln(` ${e.wrapInColor("services list",CliForegroundColor.Cyan)}`)}},{command:"start",description:"Start a background service",valueRequired:!0,processCommand:async(t,e)=>{const r=t.value;try{await e.backgroundServices.start(r),e.writer.writeSuccess(`Service '${r}' started`)}catch(n){e.writer.writeError((n==null?void 0:n.message)||`Failed to start service '${r}'`),e.process.exit(-1)}},writeDescription:t=>{const{writer:e}=t;e.writeln("Start a registered background service"),e.writeln(),e.writeln(` ${e.wrapInColor("services start <name>",CliForegroundColor.Cyan)}`)}},{command:"stop",description:"Stop a running background service",valueRequired:!0,processCommand:async(t,e)=>{const r=t.value;try{await e.backgroundServices.stop(r),e.writer.writeSuccess(`Service '${r}' stopped`)}catch(n){e.writer.writeError((n==null?void 0:n.message)||`Failed to stop service '${r}'`),e.process.exit(-1)}},writeDescription:t=>{const{writer:e}=t;e.writeln("Stop a running background service"),e.writeln(),e.writeln(` ${e.wrapInColor("services stop <name>",CliForegroundColor.Cyan)}`)}},{command:"restart",description:"Restart a background service",valueRequired:!0,processCommand:async(t,e)=>{const r=t.value;try{await e.backgroundServices.restart(r),e.writer.writeSuccess(`Service '${r}' restarted`)}catch(n){e.writer.writeError((n==null?void 0:n.message)||`Failed to restart service '${r}'`),e.process.exit(-1)}},writeDescription:t=>{const{writer:e}=t;e.writeln("Restart a background service (stop then start)"),e.writeln(),e.writeln(` ${e.wrapInColor("services restart <name>",CliForegroundColor.Cyan)}`)}},{command:"logs",description:"Show logs for a background service",valueRequired:!0,processCommand:async(t,e)=>{const r=t.value,n=parseInt(t.args.limit||t.args.n)||50,{writer:o}=e,u=e.backgroundServices.getLogs(r,n);if(u.length===0){o.writeInfo(`No log entries for service '${r}'`);return}for(const h of u){const a=new Date(h.timestamp).toLocaleString();let l;switch(h.level){case"error":l=o.wrapInColor("ERR",CliForegroundColor.Red);break;case"warn":l=o.wrapInColor("WRN",CliForegroundColor.Yellow);break;default:l=o.wrapInColor("INF",CliForegroundColor.Cyan);break}o.writeln(`[${a}] ${l} ${h.message}`)}},writeDescription:t=>{const{writer:e}=t;e.writeln("Display recent log entries for a background service"),e.writeln(),e.writeln(` ${e.wrapInColor("services logs <name>",CliForegroundColor.Cyan)}`),e.writeln(` ${e.wrapInColor("services logs <name> --limit 100",CliForegroundColor.Cyan)}`)}},{command:"info",description:"Show detailed information about a service",valueRequired:!0,processCommand:async(t,e)=>{const r=t.value,{writer:n}=e,o=e.backgroundServices.getStatus(r);if(!o){n.writeError(`Service '${r}' not found`),e.process.exit(-1);return}n.writeln(n.wrapInColor(`Service: ${o.name}`,CliForegroundColor.Cyan)),n.writeln(` Description : ${o.description||"-"}`),n.writeln(` Type : ${o.type}`),n.writeln(` Status : ${colorStatus(o.status,n.wrapInColor.bind(n))}`),n.writeln(` Mode : ${o.executionMode}`),o.startedAt&&n.writeln(` Started at : ${new Date(o.startedAt).toLocaleString()}`),o.stoppedAt&&n.writeln(` Stopped at : ${new Date(o.stoppedAt).toLocaleString()}`),o.status==="running"&&o.uptime!=null&&n.writeln(` Uptime : ${n.wrapInColor(formatUptime(o.uptime),CliForegroundColor.Green)}`),o.error&&n.writeln(` Error : ${n.wrapInColor(o.error,CliForegroundColor.Red)}`)},writeDescription:t=>{const{writer:e}=t;e.writeln("Show detailed information about a specific background service"),e.writeln(),e.writeln(` ${e.wrapInColor("services info <name>",CliForegroundColor.Cyan)}`)}}]}async processCommand(t,e){e.executor.showHelp(t,e)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.services.long_description","Manage background services and jobs")),e.writeln(),e.writeln(` ${e.wrapInColor("services list",CliForegroundColor.Cyan)} ${r.t("cli.services.list_desc","List all services")}`),e.writeln(` ${e.wrapInColor("services start <name>",CliForegroundColor.Cyan)} ${r.t("cli.services.start_desc","Start a service")}`),e.writeln(` ${e.wrapInColor("services stop <name>",CliForegroundColor.Cyan)} ${r.t("cli.services.stop_desc","Stop a service")}`),e.writeln(` ${e.wrapInColor("services restart <name>",CliForegroundColor.Cyan)} ${r.t("cli.services.restart_desc","Restart a service")}`),e.writeln(` ${e.wrapInColor("services logs <name>",CliForegroundColor.Cyan)} ${r.t("cli.services.logs_desc","View service logs")}`),e.writeln(` ${e.wrapInColor("services info <name>",CliForegroundColor.Cyan)} ${r.t("cli.services.info_desc","Service details")}`)}},CliProcessRegistry_TOKEN="cli-process-registry",CliProcessRegistry=class{constructor(){this.nextPid=1,this.processes=new Map,this.maxHistory=50}get currentPid(){return this._currentPid}register(t,e){const r=this.nextPid++,n=new AbortController,o=(e==null?void 0:e.type)??"command";return this.processes.set(r,{pid:r,name:(e==null?void 0:e.name)??t,type:o,command:t,startTime:Date.now(),status:"running",abortController:n,onKill:e==null?void 0:e.onKill}),o==="command"&&(this._currentPid=r),this.pruneHistory(),{pid:r,abortController:n}}complete(t,e){const r=this.processes.get(t);r&&r.status==="running"&&(r.status="completed",r.exitCode=e),this._currentPid===t&&(this._currentPid=void 0)}fail(t){const e=this.processes.get(t);e&&e.status==="running"&&(e.status="failed",e.exitCode=-1),this._currentPid===t&&(this._currentPid=void 0)}kill(t){const e=this.processes.get(t);return!e||e.status!=="running"?!1:(e.onKill&&Promise.resolve(e.onKill()).catch(()=>{}),e.abortController.abort(),e.status="killed",e.exitCode=-9,this._currentPid===t&&(this._currentPid=void 0),!0)}list(){return Array.from(this.processes.values()).map(({abortController:t,onKill:e,...r})=>r)}pruneHistory(){const e=Array.from(this.processes.entries()).filter(([,r])=>r.status!=="running");if(e.length>this.maxHistory){const r=e.slice(0,e.length-this.maxHistory);for(const[n]of r)this.processes.delete(n)}}},CliPsCommandProcessor=class{constructor(){this.command="ps",this.description="List running and recent processes",this.author=DefaultLibraryAuthor,this.metadata={icon:"📋",sealed:!0}}async processCommand(t,e){let r;try{r=e.services.get(CliProcessRegistry_TOKEN)}catch{e.writer.writeInfo("Process registry not available");return}const n=r.list();if(n.length===0){e.writer.writeInfo("No processes");return}const o=["PID","NAME","TYPE","STATUS","EXIT","TIME","COMMAND"],u=n.map(h=>{const a=`${Math.round((Date.now()-h.startTime)/1e3)}s`;return[String(h.pid),h.name,h.type,h.status,h.exitCode!==void 0?String(h.exitCode):"-",a,h.command]});e.writer.writeTable(o,u)}},CliKillCommandProcessor=class{constructor(){this.command="kill",this.description="Terminate a running process by PID",this.author=DefaultLibraryAuthor,this.valueRequired=!0,this.metadata={icon:"💀",sealed:!0}}async processCommand(t,e){var u;let r;try{r=e.services.get(CliProcessRegistry_TOKEN)}catch{e.writer.writeError("Process registry not available");return}const n=(u=t.value)==null?void 0:u.trim();if(!n){e.writer.writeError("kill: missing PID");return}const o=parseInt(n,10);if(isNaN(o)){e.writer.writeError(`kill: invalid PID: ${n}`);return}r.kill(o)?e.writer.writeSuccess(`Killed process ${o}`):e.writer.writeError(`kill: no running process with PID ${o}`)}},ESC="\x1B",CSI=`${ESC}[`,ansi={clearScreen:`${CSI}2J`,cursorHome:`${CSI}H`,hideCursor:`${CSI}?25l`,cursorTo:(t,e)=>`${CSI}${t};${e}H`,fg:{green:`${CSI}32m`,cyan:`${CSI}36m`,yellow:`${CSI}93m`,white:`${CSI}97m`,red:`${CSI}91m`,gray:`${CSI}90m`},bg:{blue:`${CSI}44m`},bold:`${CSI}1m`,dim:`${CSI}2m`,inverse:`${CSI}7m`,reset:`${CSI}0m`},BOX={topLeft:"┌",topRight:"┐",bottomLeft:"└",bottomRight:"┘",horizontal:"─",vertical:"│"};function formatElapsed(t){const e=Math.floor(t/1e3)%60,r=Math.floor(t/(1e3*60))%60,n=Math.floor(t/(1e3*60*60))%24,o=Math.floor(t/(1e3*60*60*24)),u=[];return o>0&&u.push(`${o}d`),n>0&&u.push(`${n}h`),r>0&&u.push(`${r}m`),u.push(`${e}s`),u.join(" ")}function statusColor(t){switch(t){case"running":return ansi.fg.green;case"completed":case"done":return ansi.fg.cyan;case"pending":return ansi.fg.yellow;case"stopped":return ansi.fg.white;case"failed":case"killed":return ansi.fg.red;default:return ansi.fg.white}}function truncate(t,e){return t.length<=e?t:t.substring(0,e-1)+"…"}function pad(t,e){return t.length>=e?t.substring(0,e):t+" ".repeat(e-t.length)}var CliHtopCommandProcessor=class{constructor(){this.command="htop",this.description="Interactive process and service monitor",this.author=DefaultLibraryAuthor,this.metadata={icon:"📊",sealed:!0,module:"system"},this.context=null,this.registry=null,this.refreshTimer=null,this.rows=[],this.selectedIndex=0,this.scrollOffset=0,this.termCols=80,this.termRows=24,this.showingLogs=!1,this.errorMessage=null,this.errorTimeout=null}async processCommand(t,e){try{this.registry=e.services.get(CliProcessRegistry_TOKEN)}catch{e.writer.writeError("Process registry not available");return}this.context=e,this.termCols=e.terminal.cols||80,this.termRows=e.terminal.rows||24,this.selectedIndex=0,this.scrollOffset=0,this.showingLogs=!1,this.errorMessage=null,e.enterFullScreenMode(this),this.refreshData(),this.render(),this.refreshTimer=e.createInterval(()=>{this.showingLogs||(this.refreshData(),this.render())},1e3)}async onData(t,e){if(this.showingLogs){this.showingLogs=!1,this.render();return}switch(t){case`${ESC}[A`:this.moveSelection(-1),this.render();break;case`${ESC}[B`:this.moveSelection(1),this.render();break;case"q":case ESC:this.exit(e);break;case"k":this.actionKill();break;case"s":await this.actionStart();break;case"t":await this.actionStop();break;case"r":await this.actionRestart();break;case"l":this.actionLogs();break}}onResize(t,e,r){this.termCols=t,this.termRows=e,this.clampScroll(),this.render()}onDispose(t){this.refreshTimer=null,this.context=null,this.registry=null,this.rows=[]}writeDescription(t){const{writer:e}=t;e.writeln("Interactive process and service monitor"),e.writeln(),e.writeln("Usage:"),e.writeln(` ${e.wrapInColor("htop",36)}`)}refreshData(){if(!this.registry||!this.context)return;const t=this.registry.list(),e=this.context.backgroundServices.list(),r=new Set;for(const o of e)o.pid!==void 0&&r.add(o.pid);const n=[];for(const o of t)r.has(o.pid)||n.push({pid:o.pid,name:o.name,type:o.type,status:o.status,time:formatElapsed(Date.now()-o.startTime),mode:"main",source:"process"});for(const o of e){let u="-";o.status==="running"&&o.startedAt&&(u=formatElapsed(Date.now()-new Date(o.startedAt).getTime())),n.push({pid:o.pid??0,name:o.name,type:o.type,status:o.status,time:u,mode:o.executionMode==="worker"?"worker":"main",source:"service",serviceInfo:o})}n.sort((o,u)=>{const h=o.status==="running"?0:1,a=u.status==="running"?0:1;return h!==a?h-a:u.pid-o.pid}),this.rows=n,this.rows.length===0?this.selectedIndex=0:this.selectedIndex=Math.min(this.selectedIndex,this.rows.length-1),this.clampScroll()}actionKill(){const t=this.rows[this.selectedIndex];if(!(!t||t.status!=="running")){if(t.name==="htop"&&t.source==="process"){this.context&&this.exit(this.context);return}try{this.registry&&this.registry.kill(t.pid)}catch(e){this.showError((e==null?void 0:e.message)||"Kill failed")}this.refreshData(),this.render()}}async actionStart(){const t=this.rows[this.selectedIndex];if(!(!t||t.source!=="service")&&!(t.status!=="stopped"&&t.status!=="pending"&&t.status!=="failed")){try{await this.context.backgroundServices.start(t.name)}catch(e){this.showError((e==null?void 0:e.message)||"Start failed")}this.refreshData(),this.render()}}async actionStop(){const t=this.rows[this.selectedIndex];if(!(!t||t.source!=="service"||t.status!=="running")){try{await this.context.backgroundServices.stop(t.name)}catch(e){this.showError((e==null?void 0:e.message)||"Stop failed")}this.refreshData(),this.render()}}async actionRestart(){const t=this.rows[this.selectedIndex];if(!(!t||t.source!=="service")){try{await this.context.backgroundServices.restart(t.name)}catch(e){this.showError((e==null?void 0:e.message)||"Restart failed")}this.refreshData(),this.render()}}actionLogs(){const t=this.rows[this.selectedIndex];!t||t.source!=="service"||!this.context||(this.showingLogs=!0,this.renderLogsOverlay(t.name))}moveSelection(t){this.rows.length!==0&&(this.selectedIndex+=t,this.selectedIndex<0?this.selectedIndex=this.rows.length-1:this.selectedIndex>=this.rows.length&&(this.selectedIndex=0),this.clampScroll())}get visibleRows(){return Math.max(1,this.termRows-4)}clampScroll(){this.selectedIndex<this.scrollOffset?this.scrollOffset=this.selectedIndex:this.selectedIndex>=this.scrollOffset+this.visibleRows&&(this.scrollOffset=this.selectedIndex-this.visibleRows+1),this.scrollOffset=Math.max(0,this.scrollOffset)}render(){if(!this.context)return;const t=[],e=this.termCols;t.push(ansi.clearScreen,ansi.cursorHome,ansi.hideCursor);const r=this.rows.filter(H=>H.status==="running").length,n=this.rows.length;let o;this.errorMessage?o=`${ansi.bold}${ansi.fg.red} htop ${ansi.reset}${ansi.fg.red}${ansi.dim} ${this.errorMessage}${ansi.reset}`:o=`${ansi.bold}${ansi.fg.cyan} htop${ansi.reset}${ansi.fg.gray} — ${r} running / ${n} total${ansi.reset}`;const u=`${ansi.fg.gray}Refresh: 1s${ansi.reset}`;t.push(ansi.cursorTo(1,1)),t.push(o),t.push(ansi.cursorTo(1,Math.max(1,e-11))),t.push(u),t.push(ansi.cursorTo(2,1)),t.push(ansi.fg.gray,BOX.horizontal.repeat(e),ansi.reset);const h=6,a=9,l=11,f=8,C=9,d=Math.max(10,e-h-a-l-f-C-2);if(t.push(ansi.cursorTo(3,1)),t.push(ansi.bold,ansi.fg.white," ",pad("PID",h),pad("NAME",d),pad("TYPE",a),pad("STATUS",l),pad("MODE",f),pad("TIME",C),ansi.reset),this.rows.length===0){const H="No processes",W=Math.floor(this.visibleRows/2)+4,U=Math.max(1,Math.floor((e-H.length)/2));t.push(ansi.cursorTo(W,U)),t.push(ansi.fg.gray,H,ansi.reset)}else{const H=Math.min(this.scrollOffset+this.visibleRows,this.rows.length);for(let W=this.scrollOffset;W<H;W++){const U=this.rows[W],L=4+(W-this.scrollOffset),N=W===this.selectedIndex,x=N?">":" ",j=pad(String(U.pid),h),V=pad(truncate(U.name,d-1),d),Y=pad(U.type,a),J=pad(U.status,l),X=pad(U.mode,f),G=pad(U.time,C);t.push(ansi.cursorTo(L,1)),N&&t.push(ansi.inverse),t.push(x,j,V,Y,N?"":statusColor(U.status),J,N?"":ansi.reset,X,G);const ee=1+h+d+a+l+f+C;ee<e&&t.push(" ".repeat(e-ee)),N&&t.push(ansi.reset)}this.scrollOffset>0&&(t.push(ansi.cursorTo(4,e)),t.push(ansi.fg.gray,"↑",ansi.reset)),H<this.rows.length&&(t.push(ansi.cursorTo(3+this.visibleRows,e)),t.push(ansi.fg.gray,"↓",ansi.reset))}const P=this.termRows-1;t.push(ansi.cursorTo(P,1)),t.push(ansi.fg.gray,BOX.horizontal.repeat(e),ansi.reset),t.push(ansi.cursorTo(this.termRows,1)),t.push(ansi.dim," ",this.buildFooter(),ansi.reset),this.context.terminal.write(t.join(""))}buildFooter(){const t=this.rows[this.selectedIndex],e=[];return t&&(t.status==="running"&&e.push("k:Kill"),t.source==="service"&&(t.status==="stopped"||t.status==="pending"||t.status==="failed")&&e.push("s:Start"),t.source==="service"&&t.status==="running"&&e.push("t:Stop"),t.source==="service"&&(e.push("r:Restart"),e.push("l:Logs"))),e.push("q:Quit"),e.push("↑↓:Navigate"),e.join(" ")}renderLogsOverlay(t){if(!this.context)return;const e=this.context.backgroundServices.getLogs(t,15),r=[],n=Math.min(this.termCols-4,70),o=Math.min(this.termRows-4,e.length+4),u=Math.max(1,Math.floor((this.termCols-n)/2)),h=Math.max(1,Math.floor((this.termRows-o)/2)),a=n-2,l=` Logs: ${truncate(t,a-10)} `,f=BOX.topLeft+BOX.horizontal+l+BOX.horizontal.repeat(Math.max(0,n-l.length-3))+BOX.topRight;r.push(ansi.cursorTo(h,u)),r.push(ansi.fg.cyan,f,ansi.reset);const C=o-3;if(e.length===0){const H="No log entries";r.push(ansi.cursorTo(h+1,u)),r.push(ansi.fg.cyan,BOX.vertical,ansi.reset," ",ansi.fg.gray,pad(H,a-1),ansi.reset,ansi.fg.cyan,BOX.vertical,ansi.reset);for(let W=2;W<=C;W++)r.push(ansi.cursorTo(h+W,u)),r.push(ansi.fg.cyan,BOX.vertical,ansi.reset," ".repeat(a),ansi.fg.cyan,BOX.vertical,ansi.reset)}else{const H=e.slice(-C);let W=0;for(const U of H){const L=new Date(U.timestamp).toLocaleTimeString(),N=U.level==="error"?`${ansi.fg.red}ERR${ansi.reset}`:U.level==="warn"?`${ansi.fg.yellow}WRN${ansi.reset}`:`${ansi.fg.cyan}INF${ansi.reset}`,x=`[${L}] ${N} ${truncate(U.message,a-18)}`;r.push(ansi.cursorTo(h+1+W,u)),r.push(ansi.fg.cyan,BOX.vertical,ansi.reset," ",x),r.push(ansi.cursorTo(h+1+W,u+n-1)),r.push(ansi.fg.cyan,BOX.vertical,ansi.reset),W++}for(let U=W;U<C;U++)r.push(ansi.cursorTo(h+1+U,u)),r.push(ansi.fg.cyan,BOX.vertical,ansi.reset," ".repeat(a),ansi.fg.cyan,BOX.vertical,ansi.reset)}const d="Press any key to close",P=Math.max(0,Math.floor((a-d.length)/2));r.push(ansi.cursorTo(h+C+1,u)),r.push(ansi.fg.cyan,BOX.vertical,ansi.reset," ".repeat(P),ansi.fg.gray,d,ansi.reset," ".repeat(Math.max(0,a-P-d.length)),ansi.fg.cyan,BOX.vertical,ansi.reset),r.push(ansi.cursorTo(h+C+2,u)),r.push(ansi.fg.cyan,BOX.bottomLeft,BOX.horizontal.repeat(n-2),BOX.bottomRight,ansi.reset),this.context.terminal.write(r.join(""))}showError(t){this.errorMessage=t,this.errorTimeout&&this.errorTimeout.clear(),this.context&&(this.errorTimeout=this.context.createInterval(()=>{var e;this.errorMessage=null,(e=this.errorTimeout)==null||e.clear(),this.errorTimeout=null},3e3))}exit(t){t.exitFullScreenMode(),this.context=null}},systemProcessors=[new CliHelpCommandProcessor,new CliVersionCommandProcessor,new CliFeedbackCommandProcessor,new CliHistoryCommandProcessor,new CliPackagesCommandProcessor,new CliHotKeysCommandProcessor,new CliDebugCommandProcessor,new CliNanoCommandProcessor,new CliServicesCommandProcessor,new CliPsCommandProcessor,new CliKillCommandProcessor,new CliHtopCommandProcessor],themes={...DefaultThemes},themeInfos={...DefaultThemeInfos};function hexToRgb(t){const e=/^#?([0-9A-Fa-f]{6})$/.exec(t);if(!e)return null;const r=parseInt(e[1],16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function colorSwatch(t){if(!t)return" ";const e=hexToRgb(t);return e?`\x1B[48;2;${e.r};${e.g};${e.b}m \x1B[0m`:" "}function colorText(t,e){if(!e)return t;const r=hexToRgb(e);return r?`\x1B[38;2;${r.r};${r.g};${r.b}m${t}\x1B[0m`:t}var PALETTE_KEYS=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],CliThemeCommandProcessor=class{constructor(){this.command="theme",this.aliases=["themes"],this.description="Interact with the theme",this.author=DefaultLibraryAuthor,this.version="2.0.0",this.processors=[],this.metadata={sealed:!0,icon:"🎨",module:"system"},this.stateConfiguration={initialState:{selectedTheme:"default",customOptions:null}},this.themeOptions=Object.keys(themeOptions),this.processors=[{command:"list",description:"List available themes with color previews",processCommand:async(t,e)=>{const n=e.state.getState().selectedTheme||"",o=Object.entries(themeInfos).filter(([,a])=>a.category==="dark"),u=Object.entries(themeInfos).filter(([,a])=>a.category==="light"),h=(a,l)=>{e.writer.writeln(e.writer.wrapInColor(` ${a}`,CliForegroundColor.Yellow)),e.writer.writeln();for(const[f,C]of l){const d=f===n?" (active)":"",P=PALETTE_KEYS.map(W=>colorSwatch(C.theme[W])).join(""),H=e.writer.wrapInColor(f.padEnd(22),CliForegroundColor.Cyan);e.writer.writeln(` ${P} ${H} ${C.description}${d}`)}e.writer.writeln()};e.writer.writeln("Available themes:"),e.writer.writeln(),h("Dark",o),h("Light",u),e.writer.writeInfo(`Use ${e.writer.wrapInColor("theme apply <name>",CliForegroundColor.Cyan)} or ${e.writer.wrapInColor("theme apply",CliForegroundColor.Cyan)} to select interactively`)}},{command:"current",description:"Show the current theme with color swatches",processCommand:async(t,e)=>{const n=e.state.getState().selectedTheme||"custom",o=e.terminal.options.theme;e.writer.writeln(`Current theme: ${e.writer.wrapInColor(n,CliForegroundColor.Cyan)}`),e.writer.writeln();const u=o.background,h=o.foreground;e.writer.writeln(` ${colorSwatch(u)} background ${u||"default"}`),e.writer.writeln(` ${colorSwatch(h)} foreground ${h||"default"}`),o.cursor&&e.writer.writeln(` ${colorSwatch(o.cursor)} cursor ${o.cursor}`),e.writer.writeln(),e.writer.writeln(" Normal colors:");const a=PALETTE_KEYS.slice(0,8);for(const f of a){const C=o[f];C&&e.writer.writeln(` ${colorSwatch(C)} ${String(f).padEnd(10)} ${C}`)}e.writer.writeln(),e.writer.writeln(" Bright colors:");const l=PALETTE_KEYS.slice(8);for(const f of l){const C=o[f];C&&e.writer.writeln(` ${colorSwatch(C)} ${String(f).padEnd(16)} ${C}`)}e.process.output({theme:n,colors:o})}},{command:"preview",description:"Preview a theme without applying it",valueRequired:!0,processCommand:async(t,e)=>{const r=t.value,n=themes[r];if(!n){e.writer.writeError(`Theme not found: ${r}. Use ${e.writer.wrapInColor("theme list",CliForegroundColor.Cyan)} to see available themes.`);return}this.renderThemePreview(r,n,e)}},{command:"apply",description:"Apply a theme (interactive with live preview if no name given)",acceptsRawInput:!0,processCommand:async(t,e)=>{var n;let r=(n=t.value)==null?void 0:n.trim();if(!r){const o={...e.terminal.options.theme},u=Object.keys(themes).map(a=>({label:a,value:a})),h=await e.reader.readSelect("Select a theme (live preview):",u,{onChange:a=>{themes[a]&&(e.terminal.options.theme=themes[a],this.applyStyles(e))}});if(!h){e.terminal.options.theme=o,this.applyStyles(e),e.writer.writeInfo("Theme selection cancelled");return}r=h}if(!themes[r]){e.writer.writeError(`Theme not found: ${r}. Use ${e.writer.wrapInColor("theme list",CliForegroundColor.Cyan)} to see available themes.`);return}e.terminal.options.theme=themes[r],e.state.updateState({selectedTheme:r,customOptions:null}),await e.state.persist(),this.applyStyles(e),e.writer.writeSuccess(`Theme "${r}" applied`)}},{command:"set",acceptsRawInput:!0,description:"Set a theme variable",parameters:[{name:"save",description:"Save the theme settings",type:"boolean",required:!1}],processCommand:async(t,e)=>{const[r,n]=t.command.split(" ").slice(2);if(!r||!n){e.writer.writeError("Usage: theme set <key> <value>"),e.writer.writeln(),e.writer.writeInfo(`Available keys: ${this.themeOptions.join(", ")}`);return}if(!this.themeOptions.includes(r)){e.writer.writeError(`Unsupported key: ${r}`),e.writer.writeln(),e.writer.writeInfo(`Supported keys: ${this.themeOptions.join(", ")}`);return}e.terminal.options.theme={...e.terminal.options.theme,[r]:n},e.state.updateState({selectedTheme:null,customOptions:e.terminal.options.theme});const o=colorSwatch(n);e.writer.writeSuccess(`Set ${r} to ${o} ${n}`),this.applyStyles(e),t.args.save&&await this.saveTheme(e)}},{command:"save",description:"Save the current theme settings",processCommand:async(t,e)=>{e.state.getState().selectedTheme||e.state.updateState({selectedTheme:null,customOptions:{...e.terminal.options.theme}}),await this.saveTheme(e)}},{command:"reset",description:"Reset the theme to the default",processCommand:async(t,e)=>{e.terminal.options.theme={...this.defaultTheme},e.state.reset(),await e.state.persist(),this.applyStyles(e),e.writer.writeSuccess("Theme reset to default")}},{command:"search",description:"Search themes by name, tag, or description",valueRequired:!0,processCommand:async(t,e)=>{const r=t.value.toLowerCase(),n=Object.entries(themeInfos).filter(([o,u])=>o.toLowerCase().includes(r)||u.description.toLowerCase().includes(r)||u.tags.some(h=>h.toLowerCase().includes(r)));if(n.length===0){e.writer.writeWarning(`No themes matching "${t.value}"`);return}e.writer.writeln(`Found ${n.length} theme${n.length>1?"s":""} matching "${t.value}":`),e.writer.writeln();for(const[o,u]of n){const h=PALETTE_KEYS.map(f=>colorSwatch(u.theme[f])).join(""),a=e.writer.wrapInColor(o.padEnd(22),CliForegroundColor.Cyan),l=u.tags.map(f=>e.writer.wrapInColor(`#${f}`,CliForegroundColor.Magenta)).join(" ");e.writer.writeln(` ${h} ${a} ${u.description} ${l}`)}}},{command:"random",description:'Apply a random theme (optionally filter by "dark" or "light")',processCommand:async(t,e)=>{var h;const r=(h=t.value)==null?void 0:h.toLowerCase();let n=Object.entries(themeInfos);(r==="dark"||r==="light")&&(n=n.filter(([,a])=>a.category===r));const[o,u]=n[Math.floor(Math.random()*n.length)];e.terminal.options.theme=u.theme,e.state.updateState({selectedTheme:o,customOptions:null}),await e.state.persist(),this.applyStyles(e),e.writer.writeSuccess(`Random theme "${o}" applied`)}},{command:"export",description:"Export the current theme as JSON",processCommand:async(t,e)=>{const r=e.terminal.options.theme,n=JSON.stringify(r,null,2);e.writer.writeln(n),e.process.output({json:n})}},{command:"import",description:"Import a theme from JSON",processCommand:async(t,e)=>{e.writer.writeln("Paste your theme JSON (single line or multi-line, then press Enter on an empty line):");let r="";for(;;){const o=await e.reader.readLine("");if(o===null||o.trim()==="")break;r+=o}if(!r.trim()){e.writer.writeWarning("Import cancelled - no input");return}let n;try{n=JSON.parse(r)}catch{e.writer.writeError("Invalid JSON. Please provide a valid theme object.");return}if(typeof n!="object"||n===null||!n.background||!n.foreground){e.writer.writeError('Theme must be an object with at least "background" and "foreground" properties.');return}e.terminal.options.theme=n,e.state.updateState({selectedTheme:null,customOptions:n}),await e.state.persist(),this.applyStyles(e),e.writer.writeSuccess("Custom theme imported and applied")}}]}async initialize(t){this.defaultTheme=t.terminal.options.theme;const e=t.state.getState();if(e.selectedTheme&&e.selectedTheme!=="default"){const r=themes[e.selectedTheme];r&&(t.terminal.options.theme=r)}else e.customOptions&&(t.terminal.options.theme=e.customOptions);this.applyStyles(t)}async processCommand(t,e){e.executor.showHelp(t,e)}renderThemePreview(t,e,r){const{writer:n}=r,o=e.background,u=e.foreground;if(n.writeln(`Theme: ${n.wrapInColor(t,CliForegroundColor.Cyan)}`),n.writeln(),o&&u){const f=hexToRgb(o),C=hexToRgb(u);if(f&&C){const d=`\x1B[48;2;${f.r};${f.g};${f.b}m\x1B[38;2;${C.r};${C.g};${C.b}m ${t.padEnd(20)} Sample text \x1B[0m`;n.writeln(` ${d}`),n.writeln()}}n.writeln(" Normal:");const h=["black","red","green","yellow","blue","magenta","cyan","white"];let a=" ";for(const f of h){const C=e[f];a+=colorSwatch(C)+" "}n.writeln(a),a=" ";for(const f of h){const C=e[f];a+=colorText(String(f).slice(0,2).padEnd(2),C)+" "}n.writeln(a),n.writeln(),n.writeln(" Bright:");const l=["brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"];a=" ";for(const f of l){const C=e[f];a+=colorSwatch(C)+" "}n.writeln(a),a=" ";for(const f of l){const C=e[f],d=String(f).replace("bright","").slice(0,2).toLowerCase();a+=colorText(d.padEnd(2),C)+" "}n.writeln(a),n.writeln(),n.writeln(` ${colorSwatch(o)} background ${o||"default"}`),n.writeln(` ${colorSwatch(u)} foreground ${u||"default"}`),e.cursor&&n.writeln(` ${colorSwatch(e.cursor)} cursor ${e.cursor}`)}applyStyles(t){var r;const e=document.getElementsByClassName("terminal-container");for(const n of Array.from(e))n.style.background=((r=t.terminal.options.theme)==null?void 0:r.background)||this.defaultTheme.background}async saveTheme(t){await t.state.persist(),t.writer.writeSuccess("Theme saved")}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.theme.long_description","Customize the terminal appearance with themes and colors")),e.writeln(),e.writeln(r.t("cli.common.usage","Usage:")),e.writeln(` ${e.wrapInColor("theme list",CliForegroundColor.Cyan)} List themes grouped by dark/light`),e.writeln(` ${e.wrapInColor("theme apply",CliForegroundColor.Cyan)} Select a theme interactively`),e.writeln(` ${e.wrapInColor("theme apply <name>",CliForegroundColor.Cyan)} Apply a theme by name`),e.writeln(` ${e.wrapInColor("theme preview <name>",CliForegroundColor.Cyan)} Preview a theme without applying`),e.writeln(` ${e.wrapInColor("theme search <keyword>",CliForegroundColor.Cyan)} Search by name, tag, or description`),e.writeln(` ${e.wrapInColor("theme random [dark|light]",CliForegroundColor.Cyan)} Apply a random theme`),e.writeln(` ${e.wrapInColor("theme current",CliForegroundColor.Cyan)} Show active theme with swatches`),e.writeln(` ${e.wrapInColor("theme set <key> <value>",CliForegroundColor.Cyan)} Set a theme variable`),e.writeln(` ${e.wrapInColor("theme export",CliForegroundColor.Cyan)} Export current theme as JSON`),e.writeln(` ${e.wrapInColor("theme import",CliForegroundColor.Cyan)} Import a theme from JSON`),e.writeln(` ${e.wrapInColor("theme save",CliForegroundColor.Cyan)} Save current settings`),e.writeln(` ${e.wrapInColor("theme reset",CliForegroundColor.Cyan)} Reset to default`),e.writeln(),e.writeln(r.t("cli.common.examples","Examples:")),e.writeln(` theme apply dracula ${e.wrapInColor("# Apply the Dracula theme",CliForegroundColor.Green)}`),e.writeln(` theme apply tokyoNight ${e.wrapInColor("# Apply Tokyo Night",CliForegroundColor.Green)}`),e.writeln(` theme preview nord ${e.wrapInColor("# Preview Nord palette",CliForegroundColor.Green)}`),e.writeln(` theme search retro ${e.wrapInColor("# Find retro-style themes",CliForegroundColor.Green)}`),e.writeln(` theme random dark ${e.wrapInColor("# Apply a random dark theme",CliForegroundColor.Green)}`),e.writeln(` theme set background #1a1a2e ${e.wrapInColor("# Change background color",CliForegroundColor.Green)}`),e.writeln(` theme export ${e.wrapInColor("# Export theme as JSON",CliForegroundColor.Green)}`),e.writeln(),e.writeln(`Available color keys: ${e.wrapInColor(this.themeOptions.join(", ")??"",CliForegroundColor.Blue)}`)}},themeOptions={background:"",foreground:"",black:"",blue:"",brightBlack:"",brightBlue:"",brightCyan:"",brightGreen:"",brightMagenta:"",brightRed:"",brightWhite:"",brightYellow:"",cyan:"",green:"",magenta:"",red:"",white:"",yellow:"",cursor:"",cursorAccent:"",selectionBackground:"",selectionForeground:"",selectionInactiveBackground:""},CliPingCommandProcessor=class{constructor(){this.command="ping",this.description="Send ICMP-like pings to a host",this.author=DefaultLibraryAuthor,this.acceptsRawInput=!0,this.metadata={icon:"🏓"},this.parameters=[{name:"c",aliases:["count"],description:"Number of pings to send (default: 4, 0 = infinite)",required:!1,type:"number"},{name:"i",aliases:["interval"],description:"Interval between pings in seconds (default: 1)",required:!1,type:"number"}]}async processCommand(t,e){var U;const r=(t.value||"").trim();if(!r){e.writer.writeError("ping: missing host operand"),e.writer.writeln(`Usage: ${e.writer.wrapInColor("ping [-c count] [-i interval] <host>",CliForegroundColor.Cyan)}`),e.process.exit(1,{silent:!0});return}const n=t.args.c??t.args.count??4,o=t.args.i??t.args.interval??1,u=Math.max(200,o*1e3),h=this.normalizeUrl(r);e.writer.writeln(`PING ${r} (${h}):`);const a=[];let l=0,f=0,C=0,d=!1;const P=e.onAbort.subscribe(()=>{d=!0});try{const L=n===0?1/0:n;for(;C<L&&!d;){l++;const N=performance.now();try{const x=await fetch(h,{method:"HEAD",mode:"no-cors",cache:"no-store",signal:e.signal}),j=performance.now()-N,V=j.toFixed(1);f++,a.push(j);const Y=x.type==="opaque"?"ok":`status=${x.status}`;e.writer.writeln(`${h}: seq=${C} ${Y} time=${V} ms`)}catch(x){if((x==null?void 0:x.name)==="AbortError"){d=!0;break}const j=performance.now()-N;e.writer.writeln(`${h}: seq=${C} request timed out (${j.toFixed(1)} ms)`)}C++,C<L&&!d&&(await this.sleep(u,e),(U=e.signal)!=null&&U.aborted&&(d=!0))}}finally{P.unsubscribe()}e.writer.writeln(""),e.writer.writeln(`--- ${r} ping statistics ---`);const H=l-f,W=l>0?(H/l*100).toFixed(0):"0";if(e.writer.writeln(`${l} packets transmitted, ${f} received, ${W}% packet loss`),a.length>0){const L=Math.min(...a).toFixed(1),N=Math.max(...a).toFixed(1),x=(a.reduce((J,X)=>J+X,0)/a.length).toFixed(1),j=a.reduce((J,X)=>J+X,0)/a.length,V=a.reduce((J,X)=>J+(X-j)**2,0)/a.length,Y=Math.sqrt(V).toFixed(1);e.writer.writeln(`rtt min/avg/max/mdev = ${L}/${x}/${N}/${Y} ms`)}f===0&&e.process.exit(1,{silent:!0})}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.ping.long_description","Send ICMP-like HTTP pings to a host and display round-trip statistics")),e.writeln(),e.writeln(r.t("cli.common.usage","Usage:")),e.writeln(` ${e.wrapInColor("ping <host>",CliForegroundColor.Cyan)}`),e.writeln(` ${e.wrapInColor("ping -c 10 google.com",CliForegroundColor.Cyan)}`),e.writeln(` ${e.wrapInColor("ping -c 0 -i 2 example.com",CliForegroundColor.Cyan)} (infinite, 2s interval)`),e.writeln(),e.writeln(r.t("cli.help.options","Options:")),e.writeln(" -c, --count Number of pings (default: 4, 0 = infinite)"),e.writeln(" -i, --interval Seconds between pings (default: 1)"),e.writeln(),e.writeln(r.t("cli.ping.ctrl_c","Press Ctrl+C to stop and show statistics."))}normalizeUrl(t){return t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}`}sleep(t,e){return new Promise(r=>{const n=setTimeout(r,t),o=()=>{clearTimeout(n),r()};e.signal&&e.signal.addEventListener("abort",o,{once:!0})})}},ICliEnvironment_TOKEN="cli-environment",CliEnvironment=class{constructor(){this.vars=new Map,this.vars.set("SHELL","/bin/sh"),this.vars.set("TERM","xterm-256color"),this.vars.set("LANG","en_US.UTF-8"),this.vars.set("PWD","/"),this.vars.set("HOME","/home/user"),this.vars.set("USER","user"),this.vars.set("PATH","/usr/local/bin:/usr/bin:/bin")}get(t){return this.vars.get(t)}set(t,e){this.vars.set(t,e)}unset(t){this.vars.delete(t)}getAll(){const t={};for(const[e,r]of this.vars)t[e]=r;return t}has(t){return this.vars.has(t)}},CliExportCommandProcessor=class{constructor(){this.command="export",this.description="Set environment variables",this.author=DefaultLibraryAuthor,this.acceptsRawInput=!0,this.metadata={icon:"📦",module:"system"}}async processCommand(t,e){const r=e.services.get(ICliEnvironment_TOKEN),n=(t.value||"").trim();if(!n){const a=r.getAll(),l=Object.keys(a).sort();for(const f of l)e.writer.writeln(`declare -x ${f}="${a[f]}"`);return}const o=n.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);if(!o){e.writer.writeError(`export: invalid syntax: ${n}`),e.process.exit(1,{silent:!0});return}const u=o[1];let h=o[2];(h.startsWith('"')&&h.endsWith('"')||h.startsWith("'")&&h.endsWith("'"))&&(h=h.slice(1,-1)),r.set(u,h)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.export.long_description","Set or display environment variables")),e.writeln(),e.writeln(r.t("cli.common.usage","Usage:")),e.writeln(` ${e.wrapInColor("export",CliForegroundColor.Cyan)} ${r.t("cli.export.show_all","Show all variables")}`),e.writeln(` ${e.wrapInColor("export VAR=value",CliForegroundColor.Cyan)} ${r.t("cli.export.set_var","Set a variable")}`),e.writeln(` ${e.wrapInColor('export VAR="hello world"',CliForegroundColor.Cyan)} ${r.t("cli.export.set_spaces","Set with spaces")}`)}},CliUnsetCommandProcessor=class{constructor(){this.command="unset",this.description="Remove environment variables",this.author=DefaultLibraryAuthor,this.acceptsRawInput=!0,this.metadata={icon:"🗑️",module:"system"}}async processCommand(t,e){const r=e.services.get(ICliEnvironment_TOKEN),n=(t.value||"").trim();if(!n){e.writer.writeError("unset: missing variable name"),e.process.exit(1,{silent:!0});return}r.has(n)&&r.unset(n)}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.unset.long_description","Remove an environment variable")),e.writeln(),e.writeln(r.t("cli.common.usage","Usage:")),e.writeln(` ${e.wrapInColor("unset VAR",CliForegroundColor.Cyan)}`)}},CliEnvCommandProcessor=class{constructor(){this.command="env",this.aliases=["printenv"],this.description="Display environment variables",this.author=DefaultLibraryAuthor,this.acceptsRawInput=!0,this.metadata={icon:"🌍",module:"system"}}async processCommand(t,e){const r=e.services.get(ICliEnvironment_TOKEN),n=(t.value||"").trim();if(n){const a=r.get(n);a!==void 0?(e.writer.writeln(a),e.process.output(a)):e.process.exit(1,{silent:!0});return}const o=r.getAll(),u=Object.keys(o).sort(),h=[];for(const a of u)h.push(`${a}=${o[a]}`);e.writer.writeln(h.join(`
154
- `)),e.process.output(h.join(`
155
- `))}writeDescription(t){const{writer:e,translator:r}=t;e.writeln(r.t("cli.env.long_description","Display environment variables")),e.writeln(),e.writeln(r.t("cli.common.usage","Usage:")),e.writeln(` ${e.wrapInColor("env",CliForegroundColor.Cyan)} ${r.t("cli.env.show_all","Show all variables")}`),e.writeln(` ${e.wrapInColor("printenv VAR",CliForegroundColor.Cyan)} ${r.t("cli.env.show_single","Show single variable")}`)}},DEFAULT_FONT_SIZE=20,MIN_FONT_SIZE=8,MAX_FONT_SIZE=40,STEP=2,CliFontSizeCommandProcessor=class{constructor(){this.command="font-size",this.description="Adjust the terminal font size",this.aliases=["fontsize"],this.author=DefaultLibraryAuthor,this.metadata={icon:CliIcon.Settings,module:"system"},this.stateConfiguration={storeName:"font-size",initialState:{fontSize:DEFAULT_FONT_SIZE}},this.processors=[{command:"increase",description:`Increase font size by ${STEP}px (max ${MAX_FONT_SIZE})`,processCommand:async(t,e)=>{await this.setFontSize(e,this.getCurrent(e)+STEP)}},{command:"decrease",description:`Decrease font size by ${STEP}px (min ${MIN_FONT_SIZE})`,processCommand:async(t,e)=>{await this.setFontSize(e,this.getCurrent(e)-STEP)}},{command:"reset",description:`Reset font size to default (${DEFAULT_FONT_SIZE}px)`,processCommand:async(t,e)=>{await this.setFontSize(e,DEFAULT_FONT_SIZE)}},{command:"set",description:"Set font size to a specific value",valueRequired:!0,acceptsRawInput:!0,processCommand:async(t,e)=>{const r=parseInt(t.value??"",10);if(isNaN(r)||r<MIN_FONT_SIZE||r>MAX_FONT_SIZE){e.writer.writeError(`Font size must be between ${MIN_FONT_SIZE} and ${MAX_FONT_SIZE}`);return}await this.setFontSize(e,r)}}]}async initialize(t){var r;const e=t.state.getState();(e==null?void 0:e.fontSize)!=null&&((r=t.terminal)!=null&&r.options)&&(t.terminal.options.fontSize=e.fontSize)}async processCommand(t,e){const r=this.getCurrent(e);e.writer.writeKeyValue({"Current font size":`${r}px`}),e.writer.writeln(),e.writer.writeln("Usage:"),e.writer.writeln(` ${e.writer.wrapInColor("font-size increase",CliForegroundColor.Cyan)} Increase by ${STEP}px`),e.writer.writeln(` ${e.writer.wrapInColor("font-size decrease",CliForegroundColor.Cyan)} Decrease by ${STEP}px`),e.writer.writeln(` ${e.writer.wrapInColor("font-size set <n>",CliForegroundColor.Cyan)} Set to exact size`),e.writer.writeln(` ${e.writer.wrapInColor("font-size reset",CliForegroundColor.Cyan)} Reset to default (${DEFAULT_FONT_SIZE}px)`)}getCurrent(t){var n,o;const e=(o=(n=t.terminal)==null?void 0:n.options)==null?void 0:o.fontSize;if(e!=null)return e;const r=t.state.getState();return(r==null?void 0:r.fontSize)??DEFAULT_FONT_SIZE}async setFontSize(t,e){var n;const r=Math.min(MAX_FONT_SIZE,Math.max(MIN_FONT_SIZE,e));(n=t.terminal)!=null&&n.options&&(t.terminal.options.fontSize=r),t.state.updateState({fontSize:r}),await t.state.persist(),t.writer.writeSuccess(`Font size set to ${r}px`)}},miscProcessors=[new CliClearCommandProcessor,new CliEchoCommandProcessor,new CliEvalCommandProcessor,new CliAliasCommandProcessor,new CliUnAliasCommandProcessor,new CliSleepCommandProcessor,new CliUnameCommandProcessor,new CliTimeCommandProcessor,new CliJsonCommandProcessor,new CliRandomCommandProcessor,new CliUptimeCommandProcessor,new CliOpenCommandProcessor,new CliLoremCommandProcessor,new CliTimestampCommandProcessor,new CliColorCommandProcessor,new CliCalCommandProcessor,new CliSeqCommandProcessor,new CliScreenCommandProcessor,new CliClipboardCommandProcessor,new CliConvertCommandProcessor,new CliYesCommandProcessor],builtinProcessors=[...miscProcessors,...systemProcessors,new CliThemeCommandProcessor,new CliConfigureCommandProcessor,new CliPingCommandProcessor,new CliExportCommandProcessor,new CliUnsetCommandProcessor,new CliEnvCommandProcessor,new CliFontSizeCommandProcessor,new CliCaptureCommandProcessor,new CliSnippetCommandProcessor,new CliDiffCommandProcessor],CliExecutionProcess=class{constructor(t){this.context=t,this.running=!1,this.outputCalled=!1}exit(t,e){if(t=t??0,this.exited=!0,this.exitCode=t,this.running=!1,!(e!=null&&e.silent))throw new ProcessExitedError(t)}output(t){this.data=t,this.outputCalled=!0}start(){this.exited=void 0,this.exitCode=void 0,this.data=void 0,this.outputCalled=!1,this.running=!0}end(){this.running=!1,this.exited||(this.exitCode=0)}},CliCommandExecutionContext=class{constructor(t,e){this.context=t,this.setCurrentLine=r=>{this.context.setCurrentLine(r)},this.userSession=t.userSession,this.spinner=t.spinner,this.progressBar=t.progressBar,this.textAnimator=t.textAnimator,this.onAbort=t.onAbort,this.signal=t.signal,this.terminal=t.terminal,this.writer=t.writer,this.executor=t.executor,this.clipboard=t.clipboard,this.options=t.options,this.setContextProcessor=t.setContextProcessor,this.clearLine=()=>t.clearLine(),this.showPrompt=r=>t.showPrompt(r),this.clearCurrentLine=()=>t.clearCurrentLine(),this.refreshCurrentLine=()=>t.refreshCurrentLine(),this.process=t.process,this.logger=t.logger,this.services=t.services,this.translator=t.translator,this.reader=t.reader,this.enterFullScreenMode=(r,n)=>t.enterFullScreenMode(r,n),this.exitFullScreenMode=()=>t.exitFullScreenMode(),this.createInterval=(r,n)=>t.createInterval(r,n),this.createTimeout=(r,n)=>t.createTimeout(r,n),this.backgroundServices=t.backgroundServices,this.state=t.services.get(CliStateStoreManager_TOKEN).getProcessorStateStore(e)}get promptLength(){return this.context.promptLength}set promptLength(t){this.context.promptLength=t}get currentLine(){return this.context.currentLine}get cursorPosition(){return this.context.cursorPosition}set cursorPosition(t){this.context.cursorPosition=t}},ServiceLogBuffer=class{constructor(t=1e3){this.maxSize=t,this.head=0,this.size=0,this.buffer=new Array(t)}add(t,e="info"){const r={timestamp:new Date,level:e,message:t};this.buffer[this.head]=r,this.head=(this.head+1)%this.maxSize,this.size<this.maxSize&&this.size++}get(t){const e=t!==void 0?Math.min(t,this.size):this.size,r=new Array(e),n=(this.head-e+this.maxSize)%this.maxSize;for(let o=0;o<e;o++)r[o]=this.buffer[(n+o)%this.maxSize];return r}clear(){this.buffer=new Array(this.maxSize),this.head=0,this.size=0}},CliMainThreadServiceRunner=class{constructor(t,e,r,n,o){this.service=t,this.logBuffer=e,this.emitEvent=r,this.sharedState=n,this.sharedServices=o,this.mode="main-thread",this.timers=new Set,this.abortController=null}async start(){this.abortController=new AbortController;const t={signal:this.abortController.signal,emit:e=>{this.emitEvent({...e,timestamp:new Date})},log:(e,r="info")=>{this.logBuffer.add(e,r)},createInterval:(e,r)=>{let n=setInterval(e,r);const o={clear:()=>{clearInterval(n),this.timers.delete(o)},setDelay:u=>{clearInterval(n),n=setInterval(e,u)}};return this.timers.add(o),o},createTimeout:(e,r)=>{const n=setTimeout(()=>{this.timers.delete(o),e()},r),o={clear:()=>{clearTimeout(n),this.timers.delete(o)}};return this.timers.add(o),o},state:this.sharedState,services:this.sharedServices};await this.service.onStart(t)}async stop(){var t;if(this.clearAllTimers(),(t=this.abortController)==null||t.abort(),this.service.onStop&&this.abortController){const e={signal:this.abortController.signal,emit:r=>this.emitEvent({...r,timestamp:new Date}),log:(r,n="info")=>this.logBuffer.add(r,n),createInterval:()=>{throw new Error("Cannot create timers during stop")},createTimeout:()=>{throw new Error("Cannot create timers during stop")},state:this.sharedState,services:this.sharedServices};await this.service.onStop(e)}this.abortController=null}clearAllTimers(){for(const t of this.timers)t.clear();this.timers.clear()}},CliWorkerServiceRunner=class{constructor(t,e,r,n,o){this.service=t,this.logBuffer=e,this.emitEvent=r,this.onStatusChange=n,this.sharedState=o,this.mode="worker",this.worker=null}async start(t){if(!this.service.workerFactory)throw new Error(`Service "${this.service.name}" is workerCompatible but has no workerFactory`);this.worker=this.service.workerFactory(),this.worker.onmessage=r=>{const n=r.data;switch(n.type){case"log":this.logBuffer.add(n.message,n.level);break;case"event":this.emitEvent({...n.event,timestamp:new Date});break;case"state-update":this.sharedState.updateState(n.patch);break;case"status":this.onStatusChange(n.status);break;case"error":this.logBuffer.add(n.message,"error"),this.emitEvent({source:this.service.name,type:"service-error",data:{error:n.message,stack:n.stack},timestamp:new Date}),this.onStatusChange("failed");break}},this.worker.onerror=r=>{this.logBuffer.add(`Worker error: ${r.message}`,"error"),this.onStatusChange("failed")};const e={type:"start",config:t};this.worker.postMessage(e)}async stop(){if(!this.worker)return;const t=this.worker,e={type:"stop"};t.postMessage(e),await Promise.race([new Promise(r=>{const n=t.onmessage;t.onmessage=o=>{n&&n(o),o.data.type==="status"&&o.data.status==="stopped"&&r()}}),new Promise(r=>setTimeout(r,5e3))]),this.terminate()}terminate(){this.worker&&(this.worker.onmessage=null,this.worker.onerror=null,this.worker.terminate(),this.worker=null)}},CliBackgroundServiceRegistry=class{constructor(t,e,r){this.state=t,this.services=e,this.writer=r,this.entries=new Map,this.handlers=[],this.isFullScreen=!1,this.notificationQueue=[]}setProcessRegistry(t){this.processRegistry=t}register(t){if(this.entries.has(t.name))throw new Error(`Service "${t.name}" is already registered`);this.entries.set(t.name,{service:t,status:"pending",logBuffer:new ServiceLogBuffer,runner:null}),this.emitLifecycleEvent("service-registered",t.name,{name:t.name,type:t.type})}async start(t){const e=this.getEntry(t);if(e.status==="running")throw new Error(`Service "${t}" is already running`);if(this.processRegistry){const o=e.service.type==="daemon"?"daemon":e.service.type==="job"?"job":"service",u=this.processRegistry.register(t,{name:t,type:o,onKill:()=>this.stop(t)});e.pid=u.pid}const r=e.service.workerCompatible&&e.service.workerFactory&&typeof Worker<"u",n=e.service.type==="daemon";if(r){const o=new CliWorkerServiceRunner(e.service,e.logBuffer,u=>this.dispatchEvent(u),u=>this.updateStatus(t,u),this.state);if(e.runner=o,e.status="running",e.startedAt=new Date,e.stoppedAt=void 0,e.error=void 0,n)o.start().catch(u=>this.handleStartError(e,t,u));else try{await o.start()}catch(u){this.handleStartError(e,t,u)}this.emitLifecycleEvent("service-started",t,{name:t,mode:"worker"})}else{const o=new CliMainThreadServiceRunner(e.service,e.logBuffer,u=>this.dispatchEvent(u),this.state,this.services);if(e.runner=o,e.status="running",e.startedAt=new Date,e.stoppedAt=void 0,e.error=void 0,n)o.start().catch(u=>this.handleStartError(e,t,u));else try{await o.start()}catch(u){this.handleStartError(e,t,u)}this.emitLifecycleEvent("service-started",t,{name:t,mode:"main-thread"})}}async stop(t){const e=this.getEntry(t);e.status==="running"&&(e.runner&&await e.runner.stop(),e.status="stopped",e.stoppedAt=new Date,e.runner=null,this.completeInProcessRegistry(e,0),this.emitLifecycleEvent("service-stopped",t,{name:t}))}async restart(t){const e=this.getEntry(t);if(e.service.type!=="daemon")throw new Error(`Cannot restart "${t}": only daemon services can be restarted`);e.status==="running"&&await this.stop(t),await this.start(t)}async startJob(t,e,r){const n={name:t,type:"job",async onStart(o){await e(o)}};this.register(n),this.start(t).then(()=>{const o=this.entries.get(t);if(o&&o.status==="running"){const u=o.startedAt?Date.now()-o.startedAt.getTime():0;o.status="done",o.stoppedAt=new Date,o.runner=null,this.completeInProcessRegistry(o,0),this.emitLifecycleEvent("service-completed",t,{name:t,duration:u})}}).catch(o=>{const u=this.entries.get(t);if(u){const h=o instanceof Error?o:new Error(String(o));u.status="failed",u.error=h.message,u.stoppedAt=new Date,u.runner=null,this.failInProcessRegistry(u),this.emitLifecycleEvent("service-failed",t,{name:t,error:h.message})}})}getStatus(t){const e=this.entries.get(t);if(e)return this.toInfo(e)}list(){return Array.from(this.entries.values()).map(t=>this.toInfo(t))}getLogs(t,e){return this.getEntry(t).logBuffer.get(e)}on(t,e){const r={handler:t,filter:e};return this.handlers.push(r),()=>{const n=this.handlers.indexOf(r);n>=0&&this.handlers.splice(n,1)}}async destroyAll(){const t=Array.from(this.entries.values()).filter(e=>e.status==="running");await Promise.allSettled(t.map(async e=>{try{e.runner&&(await Promise.race([e.runner.stop(),new Promise(r=>setTimeout(r,5e3))]),e.runner instanceof CliWorkerServiceRunner&&e.runner.terminate())}catch{}e.status="stopped",e.stoppedAt=new Date,e.runner=null})),this.entries.clear(),this.handlers.length=0}setFullScreen(t){this.isFullScreen=t,t||this.flushNotificationQueue()}getEntry(t){const e=this.entries.get(t);if(!e)throw new Error(`No service registered with name "${t}"`);return e}toInfo(t){const e=t.runner?t.runner.mode:"main-thread",r=t.status==="running"&&t.startedAt?Date.now()-t.startedAt.getTime():void 0;return{pid:t.pid,name:t.service.name,description:t.service.description,type:t.service.type,status:t.status,executionMode:e,startedAt:t.startedAt,stoppedAt:t.stoppedAt,error:t.error,uptime:r}}updateStatus(t,e){const r=this.entries.get(t);if(!r)return;const n=r.status;r.status=e,e==="stopped"||e==="done"?(r.stoppedAt=new Date,r.runner=null,this.completeInProcessRegistry(r,0)):e==="failed"&&(r.stoppedAt=new Date,r.runner=null,this.failInProcessRegistry(r)),this.emitLifecycleEvent("status-change",t,{name:t,from:n,to:e})}handleStartError(t,e,r){const n=r instanceof Error?r:new Error(String(r));t.status="failed",t.error=n.message,t.stoppedAt=new Date,t.runner=null,t.logBuffer.add(`Failed to start: ${n.message}`,"error"),this.failInProcessRegistry(t),t.service.onError&&t.service.onError(n,{}),this.emitLifecycleEvent("service-failed",e,{name:e,error:n.message})}dispatchEvent(t){const e=t.timestamp?t:{...t,timestamp:new Date};for(const{handler:n,filter:o}of this.handlers)if(!(o!=null&&o.source&&o.source!==e.source)&&!(o!=null&&o.type&&o.type!==e.type))try{n(e)}catch{}const r=e.data;r!=null&&r.notify&&this.notify(e)}emitLifecycleEvent(t,e,r){this.dispatchEvent({source:e,type:t,data:r,timestamp:new Date})}notify(t){if(this.isFullScreen){this.notificationQueue.push(t);return}this.writeNotification(t)}flushNotificationQueue(){for(const t of this.notificationQueue)this.writeNotification(t);this.notificationQueue=[]}writeNotification(t){if(!this.writer)return;const e=t.data,r=(e==null?void 0:e.message)??(e==null?void 0:e.error)??t.type;this.writer.writeln(""),this.writer.writeln(`┌─ [${t.source}] ${r}`),this.writer.writeln("└"+"─".repeat(40))}completeInProcessRegistry(t,e){t.pid!==void 0&&this.processRegistry&&this.processRegistry.complete(t.pid,e)}failInProcessRegistry(t){t.pid!==void 0&&this.processRegistry&&this.processRegistry.fail(t.pid)}},CliFullScreenManager=class{constructor(t,e){this.terminal=t,this.backgroundServices=e,this.resizeDisposable=null}enter(t,e,r,n){this.terminal.write("\x1B[?1049h"),this.terminal.write("\x1B[H"),n!=null&&n.showCursor?this.terminal.write("\x1B[?25h"):this.terminal.write("\x1B[?25l"),this.backgroundServices.setFullScreen(!0),e(t,!0,!0),t.onResize&&(this.resizeDisposable=this.terminal.onResize(({cols:o,rows:u})=>{t.onResize(o,u,r)}))}exit(t,e,r,n,o){var h;const u=t;this.backgroundServices.setFullScreen(!1),r(),(h=this.resizeDisposable)==null||h.dispose(),this.resizeDisposable=null,u!=null&&u.onDispose&&u.onDispose(o),this.terminal.write("\x1B[?25h"),this.terminal.write("\x1B[?1049l"),e(void 0),n()}dispose(){var t;(t=this.resizeDisposable)==null||t.dispose(),this.resizeDisposable=null}},CliTimerManager=class{constructor(){this.managedTimers=new Set}createInterval(t,e){let r=setInterval(t,e);const n={clear:()=>{clearInterval(r),this.managedTimers.delete(n)},setDelay:o=>{clearInterval(r),r=setInterval(t,o)}};return this.managedTimers.add(n),n}createTimeout(t,e){const r=setTimeout(()=>{this.managedTimers.delete(n),t()},e),n={clear:()=>{clearTimeout(r),this.managedTimers.delete(n)}};return this.managedTimers.add(n),n}clearAll(){for(const t of this.managedTimers)t.clear();this.managedTimers.clear()}},CliTerminalWriter=class{constructor(t){this.terminal=t}write(t){this.terminal.write(t)}writeln(t){this.terminal.writeln(t||"")}writeSuccess(t){this.writeLog(t,CliForegroundColor.Green,CliIcon.CheckIcon)}writeInfo(t){this.writeLog(t,CliForegroundColor.Cyan,CliIcon.InfoIcon)}writeWarning(t){this.writeLog(t,CliForegroundColor.Yellow,CliIcon.WarningIcon)}writeError(t){this.writeLog(t,CliForegroundColor.Red,CliIcon.CrossIcon)}writeLog(t,e,r){this.terminal.writeln(this.wrapInColor(r?r+" "+t:t,e))}writeDivider(t){const{color:e,length:r,char:n}=t||{};let o=r??80;const u=n??"-";this.terminal.cols<o&&(o=this.terminal.cols);let h=u.repeat(o);e&&(h=this.wrapInColor(h,e)),this.writeln(h)}wrapInColor(t,e){return e+t+CliForegroundColor.Reset}wrapInBackgroundColor(t,e){return e+t+CliForegroundColor.Reset}writeJson(t){this.terminal.writeln(formatJson(t))}writeToFile(t,e){const r=new Blob([e],{type:"text/plain"}),n=document.createElement("a");n.href=URL.createObjectURL(r),n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}writeObjectsAsTable(t){if(t.length===0){this.writeInfo("No objects to display");return}const e=Object.keys(t[0]),r=t.map(n=>e.map(o=>n[o]));this.writeTable(e,r)}writeList(t,e){const{ordered:r,prefix:n,color:o}=e||{};t.forEach((u,h)=>{const l=` ${n??(r?`${h+1}.`:"•")} ${u}`;this.writeln(o?this.wrapInColor(l,o):l)})}writeKeyValue(t,e){const r=Array.isArray(t)?t:Object.entries(t),n=Math.max(...r.map(([h])=>h.length)),o=(e==null?void 0:e.separator)??":",u=(e==null?void 0:e.keyColor)??CliForegroundColor.Yellow;for(const[h,a]of r){const l=h.padEnd(n);this.writeln(` ${this.wrapInColor(l,u)} ${o} ${a}`)}}writeColumns(t,e){const r=(e==null?void 0:e.columns)??3,n=(e==null?void 0:e.padding)??2,o=Math.max(...t.map(u=>u.length))+n;for(let u=0;u<t.length;u+=r){const h=t.slice(u,u+r);this.writeln(h.map(a=>a.padEnd(o)).join(""))}}writeLink(t,e){this.writeln(`\x1B]8;;${e}\x07${t}\x1B]8;;\x07`)}writeBox(t,e){const r=Array.isArray(t)?t:[t],n=(e==null?void 0:e.padding)??1,o=e==null?void 0:e.borderColor,u=f=>o?this.wrapInColor(f,o):f,a=Math.max(...r.map(f=>visibleLength(f)),e!=null&&e.title?visibleLength(e.title)+2:0)+n*2;if(e!=null&&e.title){const f=` ${e.title} `,C=a-visibleLength(f),d=Math.floor(C/2),P=C-d;this.writeln(u("┌"+"─".repeat(d)+f+"─".repeat(P)+"┐"))}else this.writeln(u("┌"+"─".repeat(a)+"┐"));const l=" ".repeat(n);for(const f of r){const C=a-n*2-visibleLength(f);this.writeln(u("│")+l+f+" ".repeat(Math.max(0,C))+l+u("│"))}this.writeln(u("└"+"─".repeat(a)+"┘"))}writeIndented(t,e=1){const r=" ".repeat(e);this.writeln(`${r}${t}`)}writeTable(t,e,r){const n=this.terminal.cols,o=t.map((P,H)=>Math.max(visibleLength(P),...e.map(W=>visibleLength(W[H]??"")))),u=(t.length-1)*3,h=n-u,a=o.reduce((P,H)=>P+H,0);let l;if(a<=h||h<t.length){if(l=[...o],r!=null&&r.fullWidth&&a<h){const P=h-a;let H=0;l=o.map((W,U)=>{const L=U<l.length-1?Math.floor(W/a*P):P-H;return H+=L,W+L})}}else{l=o.map(W=>Math.max(4,Math.floor(W/a*h)));let H=l.reduce((W,U)=>W+U,0);for(let W=0;H<h&&W<l.length;W++){const U=o.indexOf(Math.max(...o.filter((L,N)=>N>=W)));l[U]++,H++}}const f=(P,H)=>{const W=P??"";return visibleLength(W)<=H?W:stripAnsi(W).slice(0,Math.max(0,H-1))+"…"},C=(P,H)=>{const W=f(P,H),U=visibleLength(W),L=Math.max(0,H-U);return W+" ".repeat(L)};this.write(t.map((P,H)=>this.wrapInColor(C(P,l[H]),CliForegroundColor.Yellow)).join(" | ")+`\r
156
- `);const d=Math.min(n,l.reduce((P,H)=>P+H+3,-3));this.write("-".repeat(d)+`\r
157
- `),e.forEach(P=>{this.write(P.map((H,W)=>C(H,l[W])).join(" | ")+`\r
158
- `)})}},CliTerminalSpinner=class{constructor(t){this.terminal=t,this.isRunning=!1,this.text="",this.spinnerFrames=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],this.spinnerColors=["\x1B[38;5;39m","\x1B[38;5;45m","\x1B[38;5;49m","\x1B[38;5;48m","\x1B[38;5;83m","\x1B[38;5;118m","\x1B[38;5;154m","\x1B[38;5;220m","\x1B[38;5;214m","\x1B[38;5;171m"],this.spinnerIndex=0,this.savedCurrentLine="",this.lastContentLength=0,this.lastLineCount=1}show(t){t&&(this.text=t),!this.isRunning&&(this.context&&(this.savedCurrentLine=this.context.currentLine,this.context.setCurrentLine("")),this.lastContentLength=0,this.lastLineCount=1,this.isRunning=!0,this.resizeDisposable=this.terminal.onResize(()=>{this.lastLineCount=Math.max(this.lastLineCount,this.calcLineCount(this.lastContentLength))}),this.spinnerInterval=setInterval(()=>{this.clearCurrentLine();const e="\x1B[0m",r=this.spinnerFrames[this.spinnerIndex],n=this.spinnerColors[this.spinnerIndex%this.spinnerColors.length],o=this.text.length>0?` ${this.text}`:"",u=`${n}${r}${e}${o}`,h=1+o.length;this.terminal.write(u),this.lastContentLength=h,this.lastLineCount=this.calcLineCount(h),this.context&&this.context.setCurrentLine(u),this.spinnerIndex=(this.spinnerIndex+1)%this.spinnerFrames.length},80))}hide(){var t;this.isRunning=!1,this.spinnerInterval&&(clearInterval(this.spinnerInterval),this.spinnerInterval=null),(t=this.resizeDisposable)==null||t.dispose(),this.resizeDisposable=void 0,this.clearCurrentLine(),this.context&&this.context.setCurrentLine(this.savedCurrentLine),this.text="",this.savedCurrentLine="",this.lastContentLength=0,this.lastLineCount=1}setText(t){this.text=t}clearCurrentLine(){const t=Math.max(this.lastLineCount,this.calcLineCount(this.lastContentLength));for(let e=0;e<t;e++)this.terminal.write("\x1B[2K"),e<t-1&&this.terminal.write("\x1B[A");this.terminal.write("\r")}calcLineCount(t){return Math.max(1,Math.ceil(t/this.terminal.cols))}},CliTerminalProgressBar=class{constructor(t){this.terminal=t,this.isRunning=!1,this.text="",this.progress=0,this.total=100,this.progressText="",this.progressTextPlainLength=0,this.savedCurrentLine="",this.tickCount=0,this.lastLineCount=1}show(t){this.isRunning=!0,this.progress=0,this.tickCount=0,this.lastLineCount=1,this.text=t||"",this.context&&(this.savedCurrentLine=this.context.currentLine,this.context.setCurrentLine("")),this.resizeDisposable=this.terminal.onResize(()=>{this.lastLineCount=Math.max(this.lastLineCount,this.calcLineCount(this.progressTextPlainLength))}),this.progressBarInterval=setInterval(()=>{if(this.tickCount++,this.tickCount%3===0&&this.progress<90){const e=this.progress<30?2:this.progress<60?1:.5;this.progress=Math.min(90,this.progress+e)}this.updateProgressBar(),this.progress>this.total&&(this.progress=this.total,this.hide())},100)}hide(){var t;this.isRunning=!1,this.progressBarInterval&&(clearInterval(this.progressBarInterval),this.progressBarInterval=null),(t=this.resizeDisposable)==null||t.dispose(),this.resizeDisposable=void 0,this.clearCurrentLine(),this.context&&this.context.setCurrentLine(this.savedCurrentLine),this.text="",this.progressText="",this.progressTextPlainLength=0,this.savedCurrentLine="",this.lastLineCount=1}update(t,e){(e==null?void 0:e.type)==="increment"?this.progress+=t:this.progress=t,this.progress>this.total&&(this.progress=this.total),this.updateProgressBar()}complete(){this.progress=100,this.hide()}setText(t){this.text=t,this.updateProgressBar()}updateProgressBar(){const t=Math.round(this.progress),e=30,r=Math.round(t/this.total*e),n=e-r,o="\x1B[0m",u="\x1B[36m",h="\x1B[1;36m",a="\x1B[2m",l=this.tickCount%(r+4);let f="";for(let W=0;W<r;W++){const U=W>=l-1&&W<=l;f+=`${U?h:u}━${o}`}const C=`${a}${"─".repeat(n)}${o}`,d=`${u}[${o}${f}${C}${u}]${o}`,P=`${u}${t}%${o}`.padStart(4," "),H=this.text.length>0?` ${a}${this.text}${o}`:"";this.clearCurrentLine(),this.progressText=`${d} ${P} ${H}`,this.progressTextPlainLength=1+e+1+1+4+1+this.text.length+1,this.terminal.write(this.progressText),this.lastLineCount=this.calcLineCount(this.progressTextPlainLength),this.context&&this.context.setCurrentLine(this.progressText)}clearCurrentLine(){const t=Math.max(this.lastLineCount,this.calcLineCount(this.progressTextPlainLength));for(let e=0;e<t;e++)this.terminal.write("\x1B[2K"),e<t-1&&this.terminal.write("\x1B[A");this.terminal.write("\r")}calcLineCount(t){return Math.max(1,Math.ceil(t/this.terminal.cols))}},CliTerminalTextAnimator=class{constructor(t){this.terminal=t,this.isRunning=!1,this.text="",this.textColor="\x1B[38;5;249m"}show(t){this.showText(t||"")}showText(t,e){var l;const{speed:r,removeAfterTyping:n}=e||{};if(this.isRunning)return Promise.resolve();this.isRunning=!0,this.text=t||this.text;const o=((l=this.context)==null?void 0:l.currentLine)||"";let u=0,h=!0;const a="\x1B[0m";return new Promise(f=>{this.animationInterval=setInterval(()=>{if(h){const C=this.text[u];this.terminal.write(`${this.textColor}${C}${a}`),u++,u===this.text.length&&(h=!1)}else n?(clearInterval(this.animationInterval),this.animationInterval=null,delay(1e3).then(()=>{this.context&&(this.context.setCurrentLine(o+this.text),this.context.clearCurrentLine()),this.isRunning=!1,f()})):(this.terminal.write("\b \b"),u--,u<0&&(clearInterval(this.animationInterval),this.animationInterval=null,this.isRunning=!1,f()))},r||100)})}hide(){this.isRunning&&(this.isRunning=!1,this.animationInterval&&(clearInterval(this.animationInterval),this.animationInterval=null),this.text="")}},CliClipboard=class{constructor(t){this.context=t}async write(t){try{await navigator.clipboard.writeText(t)}catch{this.context.writer.writeError("Failed to write to clipboard")}}async read(){try{return await navigator.clipboard.readText()}catch{return this.context.writer.writeError("Failed to read from clipboard"),""}}},InputModeBase=class{constructor(t,e){this.host=t,this.resolve=e,this._resolved=!1,this.extraLines=0}get isResolved(){return this._resolved}handleKeyEvent(t){return t.code==="KeyC"&&t.ctrlKey||t.code==="Escape"?(this.abort(),!1):!0}resolveAndPop(t){this._resolved||(this._resolved=!0,this.host.terminal.write(`\r
159
- `),this.host.popMode(),this.resolve(t))}abort(){this._resolved||(this._resolved=!0,this.host.terminal.write(`\r
160
- `),this.host.popMode(),this.resolve(null))}redrawLine(t,e,r){let n="";if(this.extraLines>0){n+="\x1B[s";for(let u=0;u<this.extraLines;u++)n+="\x1B[B\x1B[2K";n+="\x1B[u",this.extraLines=0}n+="\x1B[2K\r"+t+e;const o=e.length-r;o>0&&(n+=`\x1B[${o}D`),this.host.terminal.write(n)}writeHelp(t){this.extraLines++,this.host.terminal.write(`\r
161
- \x1B[2m${t}\x1B[0m\x1B[${this.extraLines}A`)}writeError(t){this.extraLines++,this.host.terminal.write(`\r
162
- \x1B[31m✘ ${t}\x1B[0m\x1B[${this.extraLines}A`)}clearExtraLines(){if(this.extraLines>0){let t="\x1B[s";for(let e=0;e<this.extraLines;e++)t+="\x1B[B\x1B[2K";t+="\x1B[u",this.host.terminal.write(t),this.extraLines=0}}},LineInputMode=class extends InputModeBase{constructor(t,e,r,n){super(t,e),this.promptText=r,this.options=n,this.hasError=!1,this.buffer=(n==null?void 0:n.default)??"",this.cursorPosition=this.buffer.length}activate(){var e;const t=`\x1B[36m?\x1B[0m ${this.promptText}`;this.host.writeToTerminal(t),this.buffer?this.host.writeToTerminal(this.buffer):(e=this.options)!=null&&e.placeholder&&(this.host.writeToTerminal(`\x1B[2m${this.options.placeholder}\x1B[0m`),this.host.terminal.write(`\x1B[${this.options.placeholder.length}D`))}async handleInput(t){var e,r;if(this.hasError&&(this.hasError=!1,this.clearExtraLines()),t==="\r"){if((e=this.options)!=null&&e.validate){const n=this.options.validate(this.buffer);if(n){this.hasError=!0,this.writeError(n);return}}this.resolveAndPop(this.buffer)}else if(t==="")this.cursorPosition>0&&(this.buffer=this.buffer.slice(0,this.cursorPosition-1)+this.buffer.slice(this.cursorPosition),this.cursorPosition--,this.renderLine());else if(t==="\x1B[D")this.cursorPosition>0&&(this.cursorPosition--,this.host.terminal.write(t));else if(t==="\x1B[C")this.cursorPosition<this.buffer.length&&(this.cursorPosition++,this.host.terminal.write(t));else if(!t.startsWith("\x1B")){const n=t.replace(/[\r\n]+/g,"");this.buffer=this.buffer.slice(0,this.cursorPosition)+n+this.buffer.slice(this.cursorPosition),this.cursorPosition+=n.length,this.cursorPosition===this.buffer.length&&this.extraLines===0&&!this.hasError&&!((r=this.options)!=null&&r.placeholder&&this.buffer.length===n.length)?this.host.terminal.write(n):this.renderLine()}}onResize(){this.renderLine()}renderLine(){var e;const t=`\x1B[36m?\x1B[0m ${this.promptText}`;if(this.buffer.length===0&&((e=this.options)!=null&&e.placeholder)){const r=`\x1B[2m${this.options.placeholder}\x1B[0m`;this.redrawLine(t,r,0)}else this.redrawLine(t,this.buffer,this.cursorPosition)}},PasswordInputMode=class extends InputModeBase{constructor(t,e,r){super(t,e),this.promptText=r,this.buffer=""}activate(){const t=`\x1B[36m?\x1B[0m ${this.promptText}`;this.host.writeToTerminal(t)}async handleInput(t){if(t==="\r")this.resolveAndPop(this.buffer);else if(t==="")this.buffer.length>0&&(this.buffer=this.buffer.slice(0,-1),this.renderLine());else if(!t.startsWith("\x1B")){const e=t.replace(/[\r\n]+/g,"");this.buffer+=e,this.extraLines===0?this.host.terminal.write("*".repeat(e.length)):this.renderLine()}}onResize(){this.renderLine()}renderLine(){const t=`\x1B[36m?\x1B[0m ${this.promptText}`,e="*".repeat(this.buffer.length);this.redrawLine(t,e,e.length)}},ConfirmInputMode=class extends InputModeBase{constructor(t,e,r,n=!1){super(t,e),this.promptText=r,this.defaultValue=n,this.buffer=""}activate(){const t=this.defaultValue?"(Y/n)":"(y/N)",e=`\x1B[36m?\x1B[0m ${this.promptText} ${t}: `;this.host.writeToTerminal(e)}async handleInput(t){if(t==="\r")if(this.buffer==="")this.resolveAndPop(this.defaultValue);else{const e=this.buffer.toLowerCase();e==="y"?this.resolveAndPop(!0):e==="n"&&this.resolveAndPop(!1)}else if(t==="")this.buffer.length>0&&(this.buffer=this.buffer.slice(0,-1),this.renderLine());else if(!t.startsWith("\x1B")){const e=t.toLowerCase();(e==="y"||e==="n")&&(this.buffer=e,this.renderLine())}}onResize(){this.renderLine()}renderLine(){const t=this.defaultValue?"(Y/n)":"(y/N)",e=`\x1B[36m?\x1B[0m ${this.promptText} ${t}: `;this.redrawLine(e,this.buffer,this.buffer.length)}},NumberInputMode=class extends InputModeBase{constructor(t,e,r,n){super(t,e),this.promptText=r,this.options=n,this.hasError=!1,this.buffer=(n==null?void 0:n.default)!=null?String(n.default):"",this.cursorPosition=this.buffer.length}activate(){const t=this.buildPrompt();this.host.writeToTerminal(t),this.buffer&&this.host.writeToTerminal(this.buffer)}async handleInput(t){var e,r,n;if(this.hasError&&(this.hasError=!1,this.clearExtraLines()),t==="\r"){if(this.buffer===""||this.buffer==="-"){((e=this.options)==null?void 0:e.default)!=null&&this.resolveAndPop(this.options.default);return}const o=parseInt(this.buffer,10);if(isNaN(o)){this.hasError=!0,this.writeError("Please enter a valid number");return}if(((r=this.options)==null?void 0:r.min)!=null&&o<this.options.min){this.hasError=!0,this.writeError(`Value must be at least ${this.options.min}`);return}if(((n=this.options)==null?void 0:n.max)!=null&&o>this.options.max){this.hasError=!0,this.writeError(`Value must be at most ${this.options.max}`);return}this.resolveAndPop(o)}else if(t==="")this.cursorPosition>0&&(this.buffer=this.buffer.slice(0,this.cursorPosition-1)+this.buffer.slice(this.cursorPosition),this.cursorPosition--,this.renderLine());else if(t==="\x1B[D")this.cursorPosition>0&&(this.cursorPosition--,this.host.terminal.write(t));else if(t==="\x1B[C")this.cursorPosition<this.buffer.length&&(this.cursorPosition++,this.host.terminal.write(t));else if(!t.startsWith("\x1B")){for(const o of t)o>="0"&&o<="9"?(this.buffer=this.buffer.slice(0,this.cursorPosition)+o+this.buffer.slice(this.cursorPosition),this.cursorPosition++):o==="-"&&this.cursorPosition===0&&!this.buffer.startsWith("-")&&(this.buffer="-"+this.buffer,this.cursorPosition++);this.renderLine()}}onResize(){this.renderLine()}buildPrompt(){const{min:t,max:e}=this.options??{};let r="";return t!=null&&e!=null?r=` \x1B[2m(${t}–${e})\x1B[0m`:t!=null?r=` \x1B[2m(min: ${t})\x1B[0m`:e!=null&&(r=` \x1B[2m(max: ${e})\x1B[0m`),`\x1B[36m?\x1B[0m ${this.promptText}${r}`}renderLine(){const t=this.buildPrompt();this.redrawLine(t,this.buffer,this.cursorPosition)}},SelectInputMode=class extends InputModeBase{constructor(t,e,r,n,o){super(t,e),this.promptText=r,this.options=n,this.selectOptions=o,this.selectedIndex=0,this.scrollOffset=0,this.filter="",this.renderedLines=0,this.filteredOptions=[...n],this.maxVisible=Math.min(n.length,t.getTerminalRows()-4)}activate(){var t;if(this.host.terminal.write("\x1B[?25l"),(t=this.selectOptions)!=null&&t.default){const e=this.filteredOptions.findIndex(r=>r.value===this.selectOptions.default);e>=0&&(this.selectedIndex=e,this.selectedIndex>=this.maxVisible&&(this.scrollOffset=this.selectedIndex-this.maxVisible+1))}else this.selectedIndex=this.findNextSelectable(-1,1);this.renderAll()}handleKeyEvent(t){var e;return(e=this.selectOptions)!=null&&e.searchable&&this.filter.length>0&&t.code==="Escape"?(this.clearFilter(),!1):super.handleKeyEvent(t)}resolveAndPop(t){this.clearRenderedLines();const e=this.options.find(n=>n.value===t),r=e?e.label:t;this.host.terminal.write("\x1B[2K\r"),this.host.terminal.write(`\x1B[32m✔\x1B[0m ${this.promptText} \x1B[36m${r}\x1B[0m`),this.host.terminal.write("\x1B[?25h"),super.resolveAndPop(t)}abort(){this.clearRenderedLines(),this.host.terminal.write("\x1B[2K\r"),this.host.terminal.write(`\x1B[33m✘\x1B[0m ${this.promptText} \x1B[2mcancelled\x1B[0m`),this.host.terminal.write("\x1B[?25h"),super.abort()}async handleInput(t){var e,r;if(t==="\x1B[A")this.moveSelection(-1);else if(t==="\x1B[B")this.moveSelection(1);else if(t==="\r"){const o=this.buildDisplayList().filter(u=>u.type==="option"&&!u.option.disabled);if(o.length>0&&this.selectedIndex<o.length){const u=o[this.selectedIndex];this.resolveAndPop(u.option.value)}}else t===""?(e=this.selectOptions)!=null&&e.searchable&&this.filter.length>0&&(this.filter=this.filter.slice(0,-1),this.applyFilter(),this.renderAll()):t.startsWith("\x1B")||(r=this.selectOptions)!=null&&r.searchable&&t.length===1&&t>=" "&&(this.filter+=t,this.applyFilter(),this.renderAll())}onResize(t,e){this.maxVisible=Math.min(this.filteredOptions.length,e-4),this.scrollOffset+this.maxVisible>this.getSelectableCount()&&(this.scrollOffset=Math.max(0,this.getSelectableCount()-this.maxVisible)),this.renderAll()}buildDisplayList(){const t=[];let e;for(const r of this.filteredOptions)r.group&&r.group!==e&&(t.push({type:"group-header",groupName:r.group}),e=r.group),t.push({type:"option",option:r});return t}getSelectableCount(){return this.filteredOptions.filter(t=>!t.disabled).length}moveSelection(t){var o;const e=this.getSelectableCount();if(e===0)return;let r=this.selectedIndex+t;r<0&&(r=e-1),r>=e&&(r=0),this.selectedIndex=r,this.selectedIndex<this.scrollOffset?this.scrollOffset=this.selectedIndex:this.selectedIndex>=this.scrollOffset+this.maxVisible&&(this.scrollOffset=this.selectedIndex-this.maxVisible+1);const n=this.filteredOptions.filter(u=>!u.disabled);(o=this.selectOptions)!=null&&o.onChange&&n[this.selectedIndex]&&this.selectOptions.onChange(n[this.selectedIndex].value),this.renderAll()}findNextSelectable(t,e){const r=this.filteredOptions.length;if(r===0)return 0;let n=t+e;for(let o=0;o<r;o++){if(n<0&&(n=r-1),n>=r&&(n=0),!this.filteredOptions[n].disabled)return n;n+=e}return 0}applyFilter(){if(this.filter.length===0)this.filteredOptions=[...this.options];else{const e=this.filter.toLowerCase();this.filteredOptions=this.options.filter(r=>r.label.toLowerCase().includes(e))}this.selectedIndex=0,this.scrollOffset=0,this.maxVisible=Math.min(this.filteredOptions.length,this.host.getTerminalRows()-4),this.filteredOptions.filter(e=>!e.disabled).length>0&&(this.selectedIndex=0)}clearFilter(){this.filter="",this.applyFilter(),this.renderAll()}renderAll(){this.clearRenderedLines(),this.renderPrompt(),this.renderOptions(),this.renderHelpBar(),this.renderedLines>0&&this.host.terminal.write(`\x1B[${this.renderedLines}A`)}clearRenderedLines(){if(this.renderedLines>0){this.host.terminal.write("\x1B[s");for(let t=0;t<this.renderedLines;t++)this.host.terminal.write("\x1B[B\x1B[2K");this.host.terminal.write("\x1B[u"),this.renderedLines=0}}renderPrompt(){var t;this.host.terminal.write("\x1B[2K\r"),(t=this.selectOptions)!=null&&t.searchable?this.filter.length>0?this.host.terminal.write(`\x1B[36m?\x1B[0m ${this.promptText}: ${this.filter}`):this.host.terminal.write(`\x1B[36m?\x1B[0m ${this.promptText}: \x1B[2mType to filter...\x1B[0m`):this.host.terminal.write(`\x1B[36m?\x1B[0m ${this.promptText}:`)}renderOptions(){const t=this.buildDisplayList(),e=this.filteredOptions.filter(h=>!h.disabled),r=this.scrollOffset,n=Math.min(e.length,this.scrollOffset+this.maxVisible);r>0&&(this.host.terminal.write(`\r
163
- \x1B[2m ↑ ${r} more above\x1B[0m`),this.renderedLines++);let o=0;for(const h of t)if(h.type==="group-header")this.isGroupVisible(h.groupName,t,r,n)&&(this.host.terminal.write(`\r
164
- \x1B[35m── ${h.groupName} ──\x1B[0m`),this.renderedLines++);else{const a=h.option;if(a.disabled)this.isDisabledOptionVisible(t,h,r,n)&&(this.renderOptionLine(a,!1,!1),this.renderedLines++);else{if(o>=r&&o<n){const l=o===this.selectedIndex;this.renderOptionLine(a,l,!1),this.renderedLines++}o++}}const u=e.length-n;u>0&&(this.host.terminal.write(`\r
165
- \x1B[2m ↓ ${u} more below\x1B[0m`),this.renderedLines++)}isGroupVisible(t,e,r,n){let o=0;for(const u of e)if(u.type==="option"&&!u.option.disabled){if(u.option.group===t&&o>=r&&o<n)return!0;o++}return!1}isDisabledOptionVisible(t,e,r,n){const o=t.indexOf(e);let u=0;for(let h=0;h<t.length;h++)if(t[h].type==="option"&&!t[h].option.disabled){if(h>o)return u>=r&&u<n;u++}return u>0&&u-1>=r&&u-1<n}renderOptionLine(t,e,r){const n=this.highlightMatch(t.label),o=t.description?` \x1B[2;3m— ${t.description}\x1B[0m`:"";t.disabled?this.host.terminal.write(`\r
166
- \x1B[2m${t.label}${o} (disabled)\x1B[0m`):e?this.host.terminal.write(`\r
167
- \x1B[48;5;24m\x1B[38;5;117m❯ ${n}${o}\x1B[0m`):this.host.terminal.write(`\r
168
- ${n}${o}`)}highlightMatch(t){if(!this.filter||this.filter.length===0)return t;const e=t.toLowerCase(),r=this.filter.toLowerCase(),n=e.indexOf(r);if(n<0)return t;const o=t.substring(0,n),u=t.substring(n,n+this.filter.length),h=t.substring(n+this.filter.length);return`${o}\x1B[33m${u}\x1B[0m${h}`}renderHelpBar(){var e;let t;if((e=this.selectOptions)!=null&&e.searchable)if(this.filter.length>0){const r=this.filteredOptions.filter(o=>!o.disabled).length,n=this.options.filter(o=>!o.disabled).length;t=`${r} of ${n} matches · backspace to clear filter · enter to select · esc to cancel`}else t="↑/↓ navigate · type to filter · enter to select · esc to cancel";else t="↑/↓ navigate · enter to select · esc to cancel";this.host.terminal.write(`\r
169
- \x1B[2m${t}\x1B[0m`),this.renderedLines++}},InlineSelectInputMode=class extends InputModeBase{constructor(t,e,r,n,o){super(t,e),this.promptText=r,this.options=n,this.selectOptions=o,this.selectedIndex=0,this.visibleStart=0,this.visibleEnd=0,this.selectableOptions=n.filter(u=>!u.disabled)}activate(){var t;if(this.host.terminal.write("\x1B[?25l"),(t=this.selectOptions)!=null&&t.default){const e=this.selectableOptions.findIndex(r=>r.value===this.selectOptions.default);e>=0&&(this.selectedIndex=e)}this.calculateVisibleWindow(),this.render()}resolveAndPop(t){this.clearExtraLines();const e=this.selectableOptions.find(n=>n.value===t),r=e?e.label:t;this.host.terminal.write("\x1B[2K\r"),this.host.terminal.write(`\x1B[32m✔\x1B[0m ${this.promptText}: \x1B[36m${r}\x1B[0m`),this.host.terminal.write("\x1B[?25h"),super.resolveAndPop(t)}abort(){this.clearExtraLines(),this.host.terminal.write("\x1B[2K\r"),this.host.terminal.write(`\x1B[33m✘\x1B[0m ${this.promptText}: \x1B[2mcancelled\x1B[0m`),this.host.terminal.write("\x1B[?25h"),super.abort()}async handleInput(t){t==="\x1B[C"?this.moveSelection(1):t==="\x1B[D"?this.moveSelection(-1):t==="\r"&&this.selectableOptions.length>0&&this.resolveAndPop(this.selectableOptions[this.selectedIndex].value)}onResize(t,e){this.calculateVisibleWindow(),this.render()}moveSelection(t){var r;if(this.selectableOptions.length===0)return;let e=this.selectedIndex+t;e<0&&(e=this.selectableOptions.length-1),e>=this.selectableOptions.length&&(e=0),this.selectedIndex=e,this.adjustVisibleWindow(),(r=this.selectOptions)!=null&&r.onChange&&this.selectOptions.onChange(this.selectableOptions[this.selectedIndex].value),this.render()}getPromptPrefix(){return`? ${this.promptText}: `}getRenderedPromptPrefix(){return`\x1B[36m?\x1B[0m ${this.promptText}: `}getOptionWidth(t,e){return e?t.label.length+4:t.label.length+2}calculateVisibleWindow(){const t=this.host.getTerminalCols(),e=this.getPromptPrefix().length,r=t-e;if(this.selectableOptions.length===0){this.visibleStart=0,this.visibleEnd=0;return}let n=0;for(let o=0;o<this.selectableOptions.length;o++)n+=this.getOptionWidth(this.selectableOptions[o],o===this.selectedIndex);if(n<=r){this.visibleStart=0,this.visibleEnd=this.selectableOptions.length;return}this.adjustVisibleWindow()}adjustVisibleWindow(){const t=this.host.getTerminalCols(),e=this.getPromptPrefix().length,r=t-e;if(this.selectableOptions.length===0)return;let n=0;for(let l=0;l<this.selectableOptions.length;l++)n+=this.getOptionWidth(this.selectableOptions[l],l===this.selectedIndex);if(n<=r){this.visibleStart=0,this.visibleEnd=this.selectableOptions.length;return}const o=2;this.selectedIndex<this.visibleStart&&(this.visibleStart=this.selectedIndex);let u=0;this.visibleStart>0&&(u+=o);let a=this.visibleStart;for(let l=this.visibleStart;l<this.selectableOptions.length;l++){const f=this.getOptionWidth(this.selectableOptions[l],l===this.selectedIndex),d=l<this.selectableOptions.length-1?o:0;if(u+f+d<=r)u+=f,a=l+1;else break}if(this.selectedIndex>=a){a=this.selectedIndex+1,u=this.getOptionWidth(this.selectableOptions[this.selectedIndex],!0),a<this.selectableOptions.length&&(u+=o);let f=this.selectedIndex;for(let C=this.selectedIndex-1;C>=0;C--){const d=this.getOptionWidth(this.selectableOptions[C],!1),H=C>0?o:0,W=f>0?o:0;if(u-W+d+H<=r)u=u-W+d+H,f=C;else break}this.visibleStart=f,a=this.selectedIndex+1,u=0,this.visibleStart>0&&(u+=o);for(let C=this.visibleStart;C<a;C++)u+=this.getOptionWidth(this.selectableOptions[C],C===this.selectedIndex);for(let C=a;C<this.selectableOptions.length;C++){const d=this.getOptionWidth(this.selectableOptions[C],!1),H=C<this.selectableOptions.length-1?o:0;if(u+d+H<=r)u+=d,a=C+1;else break}}this.visibleEnd=a}render(){if(this.clearExtraLines(),this.host.terminal.write("\x1B[2K\r"),this.host.terminal.write(this.getRenderedPromptPrefix()),this.selectableOptions.length===0)return;const t=this.visibleStart>0,e=this.visibleEnd<this.selectableOptions.length;t&&this.host.terminal.write("\x1B[2m◂\x1B[0m ");for(let r=this.visibleStart;r<this.visibleEnd;r++){const n=this.selectableOptions[r];r===this.selectedIndex?this.host.terminal.write(`\x1B[36m[ ${n.label} ]\x1B[0m`):this.host.terminal.write(` ${n.label} `)}e&&this.host.terminal.write(" \x1B[2m▸\x1B[0m"),this.writeHelp("←/→ navigate · enter to select · esc to cancel")}},MultiSelectInputMode=class extends InputModeBase{constructor(t,e,r,n,o){super(t,e),this.promptText=r,this.options=n,this.selectOptions=o,this.selectedIndex=0,this.scrollOffset=0,this.filter="",this.renderedLines=0,this.filteredOptions=[...n],this.maxVisible=Math.min(n.length,t.getTerminalRows()-4),this.checkedState=new Map;for(const u of n)this.checkedState.set(u.value,u.checked===!0)}activate(){this.host.terminal.write("\x1B[?25l"),this.selectedIndex=0,this.filteredOptions.filter(e=>!e.disabled).length>0&&(this.selectedIndex=0),this.renderAll()}handleKeyEvent(t){var e;return(e=this.selectOptions)!=null&&e.searchable&&this.filter.length>0&&t.code==="Escape"?(this.clearFilter(),!1):super.handleKeyEvent(t)}resolveAndPop(t){this.clearRenderedLines();const e=t.map(n=>{const o=this.options.find(u=>u.value===n);return o?o.label:n}),r=e.length>0?e.join(", "):"none";this.host.terminal.write("\x1B[2K\r"),this.host.terminal.write(`\x1B[32m✔\x1B[0m ${this.promptText} \x1B[36m${r}\x1B[0m`),this.host.terminal.write("\x1B[?25h"),super.resolveAndPop(t)}abort(){this.clearRenderedLines(),this.host.terminal.write("\x1B[2K\r"),this.host.terminal.write(`\x1B[33m✘\x1B[0m ${this.promptText} \x1B[2mcancelled\x1B[0m`),this.host.terminal.write("\x1B[?25h"),super.abort()}async handleInput(t){var e,r,n;t==="\x1B[A"?this.moveSelection(-1):t==="\x1B[B"?this.moveSelection(1):t===" "?this.toggleCurrent():t==="a"&&(!((e=this.selectOptions)!=null&&e.searchable)||this.filter.length===0)?this.toggleAll():t==="\r"?this.resolveAndPop(this.getCheckedValues()):t===""?(r=this.selectOptions)!=null&&r.searchable&&this.filter.length>0&&(this.filter=this.filter.slice(0,-1),this.applyFilter(),this.renderAll()):t.startsWith("\x1B")||(n=this.selectOptions)!=null&&n.searchable&&t.length===1&&t>=" "&&(this.filter+=t,this.applyFilter(),this.renderAll())}onResize(t,e){this.maxVisible=Math.min(this.filteredOptions.length,e-4),this.scrollOffset+this.maxVisible>this.getSelectableCount()&&(this.scrollOffset=Math.max(0,this.getSelectableCount()-this.maxVisible)),this.renderAll()}buildDisplayList(){const t=[];let e;for(const r of this.filteredOptions)r.group&&r.group!==e&&(t.push({type:"group-header",groupName:r.group}),e=r.group),t.push({type:"option",option:r});return t}getSelectableCount(){return this.filteredOptions.filter(t=>!t.disabled).length}getCheckedValues(){const t=[];for(const e of this.options)this.checkedState.get(e.value)===!0&&t.push(e.value);return t}moveSelection(t){const e=this.getSelectableCount();if(e===0)return;let r=this.selectedIndex+t;r<0&&(r=e-1),r>=e&&(r=0),this.selectedIndex=r,this.selectedIndex<this.scrollOffset?this.scrollOffset=this.selectedIndex:this.selectedIndex>=this.scrollOffset+this.maxVisible&&(this.scrollOffset=this.selectedIndex-this.maxVisible+1),this.renderAll()}toggleCurrent(){var n;const t=this.filteredOptions.filter(o=>!o.disabled);if(t.length===0||this.selectedIndex>=t.length)return;const e=t[this.selectedIndex],r=this.checkedState.get(e.value)===!0;this.checkedState.set(e.value,!r),(n=this.selectOptions)!=null&&n.onChange&&this.selectOptions.onChange(this.getCheckedValues()),this.renderAll()}toggleAll(){var r;const t=this.options.filter(n=>!n.disabled),e=t.every(n=>this.checkedState.get(n.value)===!0);for(const n of t)this.checkedState.set(n.value,!e);(r=this.selectOptions)!=null&&r.onChange&&this.selectOptions.onChange(this.getCheckedValues()),this.renderAll()}applyFilter(){if(this.filter.length===0)this.filteredOptions=[...this.options];else{const t=this.filter.toLowerCase();this.filteredOptions=this.options.filter(e=>e.label.toLowerCase().includes(t))}this.selectedIndex=0,this.scrollOffset=0,this.maxVisible=Math.min(this.filteredOptions.length,this.host.getTerminalRows()-4)}clearFilter(){this.filter="",this.applyFilter(),this.renderAll()}renderAll(){this.clearRenderedLines(),this.renderPrompt(),this.renderOptions(),this.renderHelpBar(),this.renderedLines>0&&this.host.terminal.write(`\x1B[${this.renderedLines}A`)}clearRenderedLines(){if(this.renderedLines>0){this.host.terminal.write("\x1B[s");for(let t=0;t<this.renderedLines;t++)this.host.terminal.write("\x1B[B\x1B[2K");this.host.terminal.write("\x1B[u"),this.renderedLines=0}}renderPrompt(){var t;this.host.terminal.write("\x1B[2K\r"),(t=this.selectOptions)!=null&&t.searchable?this.filter.length>0?this.host.terminal.write(`\x1B[36m?\x1B[0m ${this.promptText}: ${this.filter}`):this.host.terminal.write(`\x1B[36m?\x1B[0m ${this.promptText}: \x1B[2mType to filter...\x1B[0m`):this.host.terminal.write(`\x1B[36m?\x1B[0m ${this.promptText}:`)}renderOptions(){const t=this.buildDisplayList(),e=this.filteredOptions.filter(h=>!h.disabled),r=this.scrollOffset,n=Math.min(e.length,this.scrollOffset+this.maxVisible);r>0&&(this.host.terminal.write(`\r
170
- \x1B[2m ↑ ${r} more above\x1B[0m`),this.renderedLines++);let o=0;for(const h of t)if(h.type==="group-header")this.isGroupVisible(h.groupName,t,r,n)&&(this.host.terminal.write(`\r
171
- \x1B[35m── ${h.groupName} ──\x1B[0m`),this.renderedLines++);else{const a=h.option;if(a.disabled)this.isDisabledOptionVisible(t,h,r,n)&&(this.renderOptionLine(a,!1),this.renderedLines++);else{if(o>=r&&o<n){const l=o===this.selectedIndex;this.renderOptionLine(a,l),this.renderedLines++}o++}}const u=e.length-n;u>0&&(this.host.terminal.write(`\r
172
- \x1B[2m ↓ ${u} more below\x1B[0m`),this.renderedLines++)}isGroupVisible(t,e,r,n){let o=0;for(const u of e)if(u.type==="option"&&!u.option.disabled){if(u.option.group===t&&o>=r&&o<n)return!0;o++}return!1}isDisabledOptionVisible(t,e,r,n){const o=t.indexOf(e);let u=0;for(let h=0;h<t.length;h++)if(t[h].type==="option"&&!t[h].option.disabled){if(h>o)return u>=r&&u<n;u++}return u>0&&u-1>=r&&u-1<n}renderOptionLine(t,e){const r=this.checkedState.get(t.value)===!0,n=this.highlightMatch(t.label),o=t.description?` \x1B[2;3m— ${t.description}\x1B[0m`:"",u=r?"\x1B[32m◉\x1B[0m":"\x1B[2m○\x1B[0m";if(t.disabled){const h=r?"\x1B[2m◉\x1B[0m":"\x1B[2m○\x1B[0m";this.host.terminal.write(`\r
173
- ${h} \x1B[2m${t.label}${o} (disabled)\x1B[0m`)}else e?this.host.terminal.write(`\r
174
- \x1B[48;5;24m\x1B[38;5;117m❯ ${u} ${n}${o}\x1B[0m`):this.host.terminal.write(`\r
175
- ${u} ${n}${o}`)}highlightMatch(t){if(!this.filter||this.filter.length===0)return t;const e=t.toLowerCase(),r=this.filter.toLowerCase(),n=e.indexOf(r);if(n<0)return t;const o=t.substring(0,n),u=t.substring(n,n+this.filter.length),h=t.substring(n+this.filter.length);return`${o}\x1B[33m${u}\x1B[0m${h}`}renderHelpBar(){var r;const t=this.getCheckedValues().length;let e;if((r=this.selectOptions)!=null&&r.searchable)if(this.filter.length>0){const n=this.filteredOptions.filter(u=>!u.disabled).length,o=this.options.filter(u=>!u.disabled).length;e=`${t} selected · ${n} of ${o} matches · space to toggle · enter to confirm`}else e=`${t} selected · space to toggle · a to select all · type to filter · enter to confirm`;else e=`${t} selected · space to toggle · a to select all · enter to confirm`;this.host.terminal.write(`\r
176
- \x1B[2m${e}\x1B[0m`),this.renderedLines++}},DateInputMode=class extends InputModeBase{constructor(t,e,r,n){super(t,e),this.promptText=r,this.options=n,this.hasError=!1,this.format=(n==null?void 0:n.format)??"YYYY-MM-DD",this.separator=this.extractSeparator(this.format),this.buffer=(n==null?void 0:n.default)??"",this.cursorPosition=this.buffer.length}activate(){const t=this.buildPrompt();this.host.writeToTerminal(t),this.buffer&&this.host.writeToTerminal(this.buffer)}async handleInput(t){if(this.hasError&&(this.hasError=!1,this.clearExtraLines()),t==="\r"){const e=this.validateBuffer();if(e){this.hasError=!0,this.writeError(e);return}this.resolveAndPop(this.buffer)}else if(t==="")this.cursorPosition>0&&(this.buffer=this.buffer.slice(0,this.cursorPosition-1)+this.buffer.slice(this.cursorPosition),this.cursorPosition--,this.renderLine());else if(t==="\x1B[D")this.cursorPosition>0&&(this.cursorPosition--,this.host.terminal.write(t));else if(t==="\x1B[C")this.cursorPosition<this.buffer.length&&(this.cursorPosition++,this.host.terminal.write(t));else if(!t.startsWith("\x1B")){for(const e of t)(e>="0"&&e<="9"||e===this.separator)&&(this.buffer=this.buffer.slice(0,this.cursorPosition)+e+this.buffer.slice(this.cursorPosition),this.cursorPosition++);this.renderLine()}}onResize(){this.renderLine()}buildPrompt(){return`\x1B[36m?\x1B[0m ${this.promptText} \x1B[2m(${this.format})\x1B[0m`}renderLine(){const t=this.buildPrompt();this.redrawLine(t,this.buffer,this.cursorPosition)}extractSeparator(t){for(const e of t)if(e<"A"||e>"z"||e>"Z"&&e<"a")return e;return"-"}parseBuffer(){const t=this.buffer.split(this.separator),e=this.format.split(this.separator);if(t.length!==e.length)return null;let r=0,n=0,o=0;for(let u=0;u<e.length;u++){const h=e[u].toUpperCase(),a=parseInt(t[u],10);if(isNaN(a))return null;h==="YYYY"?r=a:h==="MM"?n=a:h==="DD"&&(o=a)}return{year:r,month:n,day:o}}validateBuffer(){var u,h;if(!this.buffer)return`Please enter a date in ${this.format} format`;const t=this.parseBuffer();if(!t)return`Invalid date format, expected ${this.format}`;const{year:e,month:r,day:n}=t;if(r<1||r>12)return"Month must be between 1 and 12";const o=this.daysInMonth(e,r);if(n<1||n>o)return`Day must be between 1 and ${o} for the given month`;if((u=this.options)!=null&&u.min){const a=this.parseDate(this.options.min),l=new Date(e,r-1,n);if(a&&l<a)return`Date must not be before ${this.options.min}`}if((h=this.options)!=null&&h.max){const a=this.parseDate(this.options.max),l=new Date(e,r-1,n);if(a&&l>a)return`Date must not be after ${this.options.max}`}return null}daysInMonth(t,e){return new Date(t,e,0).getDate()}parseDate(t){const e=t.split(this.separator),r=this.format.split(this.separator);if(e.length!==r.length)return null;let n=0,o=0,u=0;for(let h=0;h<r.length;h++){const a=r[h].toUpperCase(),l=parseInt(e[h],10);if(isNaN(l))return null;a==="YYYY"?n=l:a==="MM"?o=l:a==="DD"&&(u=l)}return new Date(n,o-1,u)}},FileInputMode=class extends InputModeBase{constructor(t,e,r,n){super(t,e),this.promptText=r,this.options=n,this.waiting=!1}activate(){var r;const t=this.host.filePickerProvider,e=(r=this.options)!=null&&r.accept?` \x1B[2m(${this.options.accept})\x1B[0m`:"";if(this.host.writeToTerminal(`\x1B[36m?\x1B[0m ${this.promptText}${e}: `),!t.isSupported){this.host.writeToTerminal("\x1B[2m(file picker not available)\x1B[0m"),this.abort();return}this.host.writeToTerminal("\x1B[33mOpening file picker...\x1B[0m"),this.waiting=!0,this.pickFiles(t)}async pickFiles(t){var e;try{let r;if((e=this.options)!=null&&e.directory){const o=await t.pickDirectory();r=o?[o]:null}else r=await t.pickFiles(this.options);if(this.waiting=!1,!r||this.isResolved){this.host.terminal.write("\x1B[2K\r"),this.host.writeToTerminal(`\x1B[36m?\x1B[0m ${this.promptText}: \x1B[2m(cancelled)\x1B[0m\r
177
- `),this.isResolved||this.abort();return}this.host.terminal.write("\x1B[2K\r"),this.host.writeToTerminal(`\x1B[36m?\x1B[0m ${this.promptText}:\r
178
- `);let n=0;for(const o of r){const u=this.formatSize(o.size);this.host.writeToTerminal(` \x1B[32m✔\x1B[0m ${o.name} \x1B[2m(${u})\x1B[0m\r
179
- `),n+=o.size}r.length>1&&this.host.writeToTerminal(` \x1B[2m${r.length} files selected · ${this.formatSize(n)} total\x1B[0m\r
180
- `),this.resolveAndPop(r)}catch{if(this.waiting=!1,this.isResolved)return;this.host.terminal.write("\x1B[2K\r"),this.host.writeToTerminal(`\x1B[36m?\x1B[0m ${this.promptText}: \x1B[31m(error)\x1B[0m\r
181
- `),this.abort()}}async handleInput(t){}formatSize(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}},CliInputReader=class{constructor(t){this.host=t}readLine(t,e){return new Promise(r=>{const n=new LineInputMode(this.host,r,t,e);this.host.pushMode(n)})}readPassword(t){return new Promise(e=>{const r=new PasswordInputMode(this.host,e,t);this.host.pushMode(r)})}readConfirm(t,e=!1){return new Promise(r=>{const n=new ConfirmInputMode(this.host,r,t,e);this.host.pushMode(n)})}readSelect(t,e,r){return!e||e.length===0?Promise.reject(new Error("readSelect requires at least one option")):new Promise(n=>{const o=new SelectInputMode(this.host,n,t,e,r);this.host.pushMode(o)})}readSelectInline(t,e,r){return!e||e.length===0?Promise.reject(new Error("readSelectInline requires at least one option")):new Promise(n=>{const o=new InlineSelectInputMode(this.host,n,t,e,r);this.host.pushMode(o)})}readMultiSelect(t,e,r){return!e||e.length===0?Promise.reject(new Error("readMultiSelect requires at least one option")):new Promise(n=>{const o=new MultiSelectInputMode(this.host,n,t,e,r);this.host.pushMode(o)})}readNumber(t,e){return new Promise(r=>{const n=new NumberInputMode(this.host,r,t,e);this.host.pushMode(n)})}readDate(t,e){return new Promise(r=>{const n=new DateInputMode(this.host,r,t,e);this.host.pushMode(n)})}readFile(t,e){return new Promise(r=>{const n=new FileInputMode(this.host,r,t,e);this.host.pushMode(n)})}},BrowserFilePickerProvider=class{constructor(){this.isSupported=typeof document<"u"}async pickFiles(t){if(!this.isSupported)return null;if(t!=null&&t.directory){const e=await this.pickDirectory();return e?[e]:null}return new Promise(e=>{const r=document.createElement("input");r.type="file",r.style.display="none",t!=null&&t.accept&&(r.accept=t.accept),t!=null&&t.multiple&&(r.multiple=!0),r.addEventListener("change",async()=>{const n=r.files;if(!n||n.length===0){e(null),r.remove();return}const o=(t==null?void 0:t.readAs)??"text",u=[];for(let h=0;h<n.length;h++){const a=n[h],l=await this.readFile(a,o);u.push({name:a.name,content:l,size:a.size,type:a.type||"application/octet-stream"})}e(u),r.remove()}),r.addEventListener("cancel",()=>{e(null),r.remove()}),document.body.appendChild(r),r.click()})}async pickDirectory(){return this.isSupported?new Promise(t=>{const e=document.createElement("input");e.type="file",e.style.display="none",e.webkitdirectory=!0,e.addEventListener("change",()=>{var n;const r=e.files;if(!r||r.length===0)t(null);else{const o=((n=r[0].webkitRelativePath)==null?void 0:n.split("/"))??[];t({name:o[0]||"selected-directory",content:"",size:0,type:"inode/directory"})}e.remove()}),e.addEventListener("cancel",()=>{t(null),e.remove()}),document.body.appendChild(e),e.click()}):null}readFile(t,e){return new Promise((r,n)=>{const o=new FileReader;o.onload=()=>r(o.result),o.onerror=()=>n(o.error),e==="arraybuffer"?o.readAsArrayBuffer(t):o.readAsText(t)})}},NoopFilePickerProvider=class{constructor(){this.isSupported=!1}async pickFiles(t){return null}async pickDirectory(){return null}},CliCompletionEngine=class{constructor(){this.providers=[],this.lastCandidates=[],this.tabCount=0,this.lastInput=""}setProviders(t){this.providers=[...t].sort((e,r)=>e.priority-r.priority)}addProvider(t){this.providers.push(t),this.providers.sort((e,r)=>e.priority-r.priority)}resetState(){this.tabCount=0,this.lastCandidates=[],this.lastInput=""}async complete(t,e){const r=this.buildContext(t,e);if(t===this.lastInput?this.tabCount++:(this.tabCount=1,this.lastInput=t,this.lastCandidates=[]),this.tabCount===1){const n=await this.fetchCompletions(r);if(this.lastCandidates=n,n.length===0)return{action:"none"};if(n.length===1)return this.lastInput="",this.tabCount=0,{action:"complete",replacement:n[0],tokenStart:r.tokenStart,token:r.token};const o=this.commonPrefix(n);return o.length>r.token.length?(this.lastInput=t.slice(0,r.tokenStart)+o+t.slice(r.tokenStart+r.token.length),{action:"complete",replacement:o,tokenStart:r.tokenStart,token:r.token}):{action:"none"}}return this.tabCount>=2&&this.lastCandidates.length>1?{action:"show-candidates",candidates:this.lastCandidates}:{action:"none"}}buildContext(t,e){const r=t.slice(0,e),n=this.tokenize(r),o=this.tokenize(t);let u=0,h="",a=0;return n.length===0||r.endsWith(" ")?(h="",u=e,a=n.length):(h=n[n.length-1],u=r.lastIndexOf(h),a=n.length-1),{input:t,cursor:e,token:h,tokenStart:u,tokenIndex:a,tokens:o}}tokenize(t){return t.split(/\s+/).filter(Boolean)}async fetchCompletions(t){for(const e of this.providers){const r=await e.getCompletions(t);if(r.length>0)return r}return[]}async completeSingle(t,e){if(!t)return null;const r=this.buildContext(t,e),n=await this.fetchCompletions(r);if(n.length!==1)return null;const o=n[0];return o.startsWith(r.token)?t.slice(0,r.tokenStart)+o:null}commonPrefix(t){return getAccelerator().commonPrefix(t)}},CliLineBuffer=class{constructor(){this._text="",this._cursorPosition=0}get text(){return this._text}get cursorPosition(){return this._cursorPosition}set cursorPosition(t){this._cursorPosition=Math.max(0,Math.min(t,this._text.length))}insert(t){this._text=this._text.slice(0,this._cursorPosition)+t+this._text.slice(this._cursorPosition),this._cursorPosition+=t.length}deleteCharBefore(){this._cursorPosition>0&&(this._text=this._text.slice(0,this._cursorPosition-1)+this._text.slice(this._cursorPosition),this._cursorPosition--)}deleteCharAt(){this._cursorPosition<this._text.length&&(this._text=this._text.slice(0,this._cursorPosition)+this._text.slice(this._cursorPosition+1))}moveCursorLeft(){this._cursorPosition>0&&this._cursorPosition--}moveCursorRight(){this._cursorPosition<this._text.length&&this._cursorPosition++}moveHome(){this._cursorPosition=0}moveEnd(){this._cursorPosition=this._text.length}clear(){this._text="",this._cursorPosition=0}setText(t){this._text=t,this._cursorPosition=t.length}},CommandLineMode=class{constructor(t){this.host=t,this.historyIndex=0,this.isExecutingCommand=!1,this.selectionStart=null,this.selectionEnd=null,this.ghostText="",this.ghostDebounceTimer=null,this.historySearchPrefix=null,this.bufferSetByHistory=!1}activate(){this.host.commandHistory.initialize().then(()=>{this.historyIndex=this.host.commandHistory.getLastIndex()})}async handleInput(t){const e=this.host.lineBuffer;if(t===" "){this.clearGhostText(),await this.handleTabCompletion();return}if(this.host.completionEngine.resetState(),t==="\r"){if(this.clearGhostText(),this.host.terminal.write(`\r
182
- `),e.text){await this.host.commandHistory.addCommand(e.text),this.historyIndex=this.host.commandHistory.getLastIndex(),this.bufferSetByHistory=!1,this.isExecutingCommand=!0;const r=this.host.getExecutionContext();await r.executor.executeCommand(e.text,r),this.isExecutingCommand=!1}this.host.isRawModeActive()||this.host.showPrompt()}else t==="\x1B[A"?this.showPreviousCommand():t==="\x1B[B"?this.showNextCommand():t==="\x1B[D"?e.cursorPosition>0&&(e.moveCursorLeft(),this.host.terminal.write(t)):t==="\x1B[C"?this.ghostText&&e.cursorPosition===e.text.length?(e.insert(this.ghostText),this.ghostText="",this.refreshLine()):e.cursorPosition<e.text.length&&(e.moveCursorRight(),this.host.terminal.write(t)):t===""?this.handleBackspace():this.handleInputText(t)}handleKeyEvent(t){if(t.code==="KeyC"&&t.ctrlKey)return this.host.abort(),this.host.terminal.writeln("Ctrl+C"),this.host.getExecutionContext().setContextProcessor(void 0),this.isExecutingCommand||this.host.showPrompt(),!1;if(t.code==="Escape")return this.host.abort(),this.host.showPrompt({newLine:!0}),!1;if(t.code==="KeyV"&&t.ctrlKey)return!1;if(t.code==="KeyL"&&t.ctrlKey)return t.preventDefault(),this.host.lineBuffer.clear(),this.host.terminal.clear(),this.host.showPrompt({reset:!0}),!1;if(t.shiftKey&&(t.code==="ArrowLeft"||t.code==="ArrowRight")){this.selectionStart||(this.selectionStart=this.getTerminalCursorPosition());const e=this.host.lineBuffer;return t.code==="ArrowLeft"?e.moveCursorLeft():e.moveCursorRight(),this.selectionEnd=this.getTerminalCursorPosition(),this.updateSelection(),!1}else this.selectionStart=null;return!0}handleInputText(t){t=t.replace(/[\r\n\t]+/g,""),this.clearGhostText(),this.clearHistorySearch(),this.bufferSetByHistory=!1,this.host.lineBuffer.insert(t),this.refreshLine(),this.scheduleGhostText()}clearGhostText(){this.ghostText="",this.ghostDebounceTimer!==null&&(clearTimeout(this.ghostDebounceTimer),this.ghostDebounceTimer=null)}scheduleGhostText(){this.ghostDebounceTimer=setTimeout(()=>{this.computeAndShowGhostText()},120)}async computeAndShowGhostText(){const t=this.host.lineBuffer;if(!(!t.text||t.cursorPosition<t.text.length))try{const e=await this.host.completionEngine.completeSingle(t.text,t.cursorPosition);e&&e.startsWith(t.text)&&(this.ghostText=e.slice(t.text.length),this.renderGhostText())}catch{}}handleBackspace(){const t=this.host.lineBuffer;this.clearGhostText(),this.clearHistorySearch(),t.cursorPosition>0&&(t.deleteCharBefore(),this.refreshLine())}async handleTabCompletion(){const t=this.host.lineBuffer,e=await this.host.completionEngine.complete(t.text,t.cursorPosition);switch(e.action){case"complete":{const{replacement:r,tokenStart:n,token:o}=e;if(r===void 0||n===void 0||o===void 0)break;const u=t.text.slice(0,n),h=t.text.slice(n+o.length),a=h.length===0&&!r.endsWith("/")?" ":"";t.setText(u+r+a+h),t.cursorPosition=n+r.length+a.length,this.refreshLine();break}case"show-candidates":{const r=e.candidates??[];if(r.length===0)break;this.host.terminal.write(`\r
183
- `);const n=Math.max(...r.map(l=>l.length)),o=Math.max(1,Math.floor((this.host.terminal.cols||80)/(n+2)));let u="";for(let l=0;l<r.length;l++)u+=r[l].padEnd(n+2),(l+1)%o===0&&(this.host.terminal.write(u+`\r
184
- `),u="");u&&this.host.terminal.write(u+`\r
185
- `);const h=this.host.lineRenderer.getPromptString(this.host.getPromptOptions());this.host.terminal.write(h),this.host.setPromptLength(this.host.terminal.buffer.active.cursorX),this.host.terminal.write(t.text);const a=t.text.length-t.cursorPosition;a>0&&this.host.terminal.write(`\x1B[${a}D`);break}}}showPreviousCommand(){this.clearGhostText();const t=this.host.lineBuffer;if(t.text&&!this.bufferSetByHistory&&this.historySearchPrefix===null&&(this.historySearchPrefix=t.text,this.historyIndex=this.host.commandHistory.getLastIndex()),this.historySearchPrefix!==null){const e=this.host.commandHistory.searchBackward(this.historySearchPrefix,this.historyIndex);e!==-1&&(this.historyIndex=e,this.displayCommandFromHistory());return}this.historyIndex>0&&(this.historyIndex--,this.displayCommandFromHistory())}showNextCommand(){this.clearGhostText();const t=this.host.lineBuffer;if(this.historySearchPrefix!==null){const e=this.host.commandHistory.searchForward(this.historySearchPrefix,this.historyIndex);if(e!==-1)this.historyIndex=e,this.displayCommandFromHistory();else{const r=this.host.getPromptLength()+t.text.length,n=this.historySearchPrefix;this.clearHistorySearch(),t.setText(n),this.refreshLine(r)}return}if(this.historyIndex<this.host.commandHistory.getLastIndex()-1)this.historyIndex++,this.displayCommandFromHistory();else{this.historyIndex=this.host.commandHistory.getLastIndex();const e=this.host.getPromptLength()+t.text.length;t.clear(),this.refreshLine(e)}}clearHistorySearch(){this.historySearchPrefix=null,this.bufferSetByHistory=!1,this.historyIndex=this.host.commandHistory.getLastIndex()}displayCommandFromHistory(){const t=this.host.lineBuffer,e=this.host.getPromptLength()+t.text.length,r=this.host.commandHistory.getCommand(this.historyIndex)||"";t.setText(r),this.bufferSetByHistory=!0,this.refreshLine(e)}refreshLine(t){const e=this.host.lineRenderer.getPromptString(this.host.getPromptOptions());this.host.lineRenderer.refreshLine(this.host.lineBuffer.text,this.host.lineBuffer.cursorPosition,this.host.getPromptLength(),e,t),this.renderGhostText()}renderGhostText(){if(!this.ghostText)return;const t=this.host.lineBuffer;if(t.cursorPosition<t.text.length)return;const e=this.ghostText;this.host.terminal.write(`\x1B[2m\x1B[38;5;240m${e}\x1B[0m\x1B[${e.length}D`)}getTerminalCursorPosition(){const t=this.host.terminal._core.buffer.x,e=this.host.terminal._core.buffer.y;return{x:t,y:e}}updateSelection(){if(this.selectionStart&&this.selectionEnd){const t=Math.min(this.selectionStart.y,this.selectionEnd.y),e=Math.max(this.selectionStart.y,this.selectionEnd.y);if(t===e){const r=Math.min(this.selectionStart.x,this.selectionEnd.x),n=Math.max(this.selectionStart.x,this.selectionEnd.x);this.host.terminal.select(r,t,Math.abs(n-r))}else this.host.terminal.selectLines(t,e)}}},RawMode=class{constructor(t,e,r=!1){this.processor=t,this.context=e,this.fullScreen=r}async handleInput(t){this.processor.onData&&await this.processor.onData(t,this.context)}handleKeyEvent(t){return!this.fullScreen&&t.code==="KeyC"&&t.ctrlKey?(this.context.setContextProcessor(void 0),this.context.writer.writeln(""),this.context.showPrompt(),!1):(t.ctrlKey&&t.preventDefault(),!0)}},CliTerminalLineRenderer=class{constructor(t,e){this.terminal=t,this.writer=e}getPromptString(t){var u;const e=t.userName??"";let r=t.hideUserName||!e?"":`\x1B[32m${e}\x1B[0m:`;t.contextProcessor&&(r=`${t.contextProcessor}`);const n=((u=t.pathProvider)==null?void 0:u.call(t))??null,o=n!==null?`\x1B[34m${n}\x1B[0m`:"\x1B[34m~\x1B[0m";return`${r}${o}$ `}renderPrompt(t){const e=this.getPromptString(t);return this.terminal.write(e),e.replace(/\x1b\[[0-9;]*[A-Za-z]/g,"").length}refreshLine(t,e,r,n,o){const u=r+t.length,h=this.terminal.cols,a=o!==void 0?Math.max(u,o):u,l=Math.max(1,Math.ceil(a/h));let f="";for(let d=1;d<l;d++)f+="\x1B[A";f+="\r\x1B[J",f+=n,f+=colorFirstWord(t,d=>this.writer.wrapInColor(d,CliForegroundColor.Yellow)??t);const C=t.length-e;C>0&&(f+=`\x1B[${C}D`),this.terminal.write(f)}clearLine(t){clearTerminalLine(this.terminal,t)}},CliExecutionContext=class{constructor(t,e,r,n){this.terminal=e,this.executor=r,this.onAbort=new Subject,this.completionEngine=new CliCompletionEngine,this.promptLength=0,this.lineBuffer=new CliLineBuffer,this.modeStack=[],this.timerManager=new CliTimerManager,this.setContextProcessor=(a,l,f)=>{var C;if(!a){(C=this.contextProcessor)!=null&&C.onData&&this.popMode(),this.contextProcessor=void 0;return}l||this.writer.writeInfo("Set "+(a==null?void 0:a.command)+" as context processor, press Ctrl+C to exit"),this.contextProcessor=a,a.onData&&this.pushMode(new RawMode(a,this,f))},this.services=t.services,this.translator=t.translator,this.stateStoreManager=t.stateStoreManager,this.state=this.stateStoreManager.getStateStore("shared"),this.options=n,this.writer=new CliTerminalWriter(e);const o=new CliTerminalSpinner(e),u=new CliTerminalProgressBar(e),h=new CliTerminalTextAnimator(e);o.context=this,u.context=this,h.context=this,this.spinner=o,this.progressBar=u,this.textAnimator=h,this.clipboard=new CliClipboard(this),this.process=new CliExecutionProcess(this),this.filePickerProvider=typeof document<"u"?new BrowserFilePickerProvider:new NoopFilePickerProvider,this.reader=new CliInputReader(this),this.logger=t.logger,this.logger.setCliLogLevel((n==null?void 0:n.logLevel)||CliLogLevel.ERROR),this.commandHistory=t.commandHistory,this.lineRenderer=new CliTerminalLineRenderer(e,this.writer),this.backgroundServices=new CliBackgroundServiceRegistry(this.state,t.services,this.writer),this.fullScreenManager=new CliFullScreenManager(e,this.backgroundServices)}writeToTerminal(t){this.terminal.write(t)}getTerminalRows(){return this.terminal.rows}getTerminalCols(){return this.terminal.cols}get currentLine(){return this.lineBuffer.text}get cursorPosition(){return this.lineBuffer.cursorPosition}set cursorPosition(t){this.lineBuffer.cursorPosition=t}initializeTerminalListeners(){const t=new CommandLineMode(this);this.pushMode(t),this.terminal.onData(async r=>{if(this.isProgressRunning())return;const n=this.currentMode;n&&await n.handleInput(r)}),this.terminal.onKey(async r=>{}),this.terminal.attachCustomKeyEventHandler(r=>{if(r.type==="keydown"){const n=this.currentMode;if(n)return n.handleKeyEvent(r)}return!0});const e=this.terminal.element;e&&(this.windowKeydownListener=r=>{if(e.contains(document.activeElement)&&r.ctrlKey&&!r.altKey&&!r.metaKey){const n=r.key.toLowerCase();["f","s","q","o","k","u","g","r","n","h"].includes(n)&&r.preventDefault()}},window.addEventListener("keydown",this.windowKeydownListener,!0))}setCurrentLine(t){this.lineBuffer.setText(t)}clearLine(){this.lineRenderer.clearLine(this.promptLength+this.lineBuffer.text.length)}showPrompt(t){const{reset:e,newLine:r,keepCurrentLine:n}=t||{};e&&this.terminal.write("\x1B[2K\r"),r&&this.terminal.write(`\r
186
- `),n||this.lineBuffer.clear(),this.promptLength=this.lineRenderer.renderPrompt(this.getPromptOptions())}clearCurrentLine(){this.clearLine(),this.showPrompt()}refreshCurrentLine(t){const e=this.lineRenderer.getPromptString(this.getPromptOptions());this.lineRenderer.refreshLine(this.lineBuffer.text,this.lineBuffer.cursorPosition,this.promptLength,e,t)}handleTerminalResize(){var o;if(this.isRawModeActive()&&((o=this.contextProcessor)!=null&&o.onResize)){this.contextProcessor.onResize(this.terminal.cols,this.terminal.rows,this);return}if(this.isProgressRunning()||this.isRawModeActive())return;const t=this.currentMode;if(t!=null&&t.onResize){t.onResize(this.terminal.cols,this.terminal.rows);return}const e=this.terminal.buffer.active;let r=e.cursorY;for(;r>0;){const u=e.getLine(e.baseY+r);if(!(u!=null&&u.isWrapped))break;r--}const n=e.cursorY-r+1;this.refreshCurrentLine(n*this.terminal.cols)}isRawModeActive(){var t;return!!((t=this.contextProcessor)!=null&&t.onData)}enterFullScreenMode(t,e){this.fullScreenManager.enter(t,this.setContextProcessor,this,e)}exitFullScreenMode(){this.fullScreenManager.exit(this.contextProcessor,this.setContextProcessor,()=>this.timerManager.clearAll(),()=>this.showPrompt(),this)}createInterval(t,e){return this.timerManager.createInterval(t,e)}createTimeout(t,e){return this.timerManager.createTimeout(t,e)}isProgressRunning(){return this.progressBar.isRunning||this.spinner.isRunning||this.textAnimator.isRunning}abort(){var t,e;this.progressBar.isRunning&&this.progressBar.complete(),(t=this.spinner)!=null&&t.isRunning&&this.spinner.hide(),(e=this.textAnimator)!=null&&e.isRunning&&this.textAnimator.hide(),this.onAbort.next()}setSession(t){this.userSession=t}getPromptOptions(){var e,r;let t=!1;try{const n=this.services.get("cli-users-module-config");t=(n==null?void 0:n.hideUserName)??!1}catch{}return{userName:(e=this.userSession)==null?void 0:e.displayName,hideUserName:t,contextProcessor:(r=this.contextProcessor)==null?void 0:r.command,pathProvider:this.promptPathProvider}}getPromptLength(){return this.promptLength}setPromptLength(t){this.promptLength=t}getExecutionContext(){return this}dispose(){var t;(t=this.contextProcessor)!=null&&t.onDispose&&this.contextProcessor.onDispose(this),this.backgroundServices.destroyAll().catch(()=>{}),this.timerManager.clearAll(),this.fullScreenManager.dispose(),this.windowKeydownListener&&(window.removeEventListener("keydown",this.windowKeydownListener,!0),this.windowKeydownListener=void 0),this.stateStoreManager.dispose()}get currentMode(){return this.modeStack.length>0?this.modeStack[this.modeStack.length-1]:void 0}pushMode(t){const e=this.currentMode;e!=null&&e.deactivate&&e.deactivate(),this.modeStack.push(t),t.activate&&t.activate()}popMode(){const t=this.modeStack.pop();t!=null&&t.deactivate&&t.deactivate();const e=this.currentMode;e!=null&&e.activate&&e.activate()}},CapturingTerminalWriter=class{constructor(t){this.inner=t,this._lines=[],this._jsonValues=[],this._tableObjects=[],this._stderrLines=[]}write(t){this._lines.push(stripAnsi(t)),this.inner.write(t)}writeln(t){t!==void 0&&t!==""&&this._lines.push(stripAnsi(t)),this.inner.writeln(t)}writeJson(t){this._jsonValues.push(t),this.inner.writeJson(t)}writeObjectsAsTable(t){this._tableObjects.push(t),this.inner.writeObjectsAsTable(t)}writeTable(t,e){this.inner.writeTable(t,e)}writeSuccess(t){this.inner.writeSuccess(t)}writeInfo(t){this.inner.writeInfo(t)}writeWarning(t){this._stderrLines.push(stripAnsi(t)),this.inner.writeWarning(t)}writeError(t){this._stderrLines.push(stripAnsi(t)),this.inner.writeError(t)}wrapInColor(t,e){return this.inner.wrapInColor(t,e)}wrapInBackgroundColor(t,e){return this.inner.wrapInBackgroundColor(t,e)}writeToFile(t,e){this.inner.writeToFile(t,e)}writeDivider(t){this.inner.writeDivider(t)}writeList(t,e){this.inner.writeList(t,e)}writeKeyValue(t,e){this.inner.writeKeyValue(t,e)}writeColumns(t,e){this.inner.writeColumns(t,e)}writeLink(t,e){this._lines.push(stripAnsi(t)),this.inner.writeLink(t,e)}writeBox(t,e){(Array.isArray(t)?t:[t]).forEach(n=>this._lines.push(stripAnsi(n))),this.inner.writeBox(t,e)}writeIndented(t,e){this._lines.push(stripAnsi(t)),this.inner.writeIndented(t,e)}hasOutput(){return this._lines.length>0||this._jsonValues.length>0||this._tableObjects.length>0}getCapturedData(){if(this._jsonValues.length>0)return this._jsonValues.length===1?this._jsonValues[0]:this._jsonValues;if(this._tableObjects.length>0)return this._tableObjects.length===1?this._tableObjects[0]:this._tableObjects.flat();if(this._lines.length>0)return this._lines.join(`
187
- `).replace(/\r\n/g,`
188
- `).trim()||void 0}hasStderr(){return this._stderrLines.length>0}getCapturedStderr(){if(this._stderrLines.length!==0)return this._stderrLines.join(`
189
- `).trim()||void 0}},versionGlobalParameter={parameter:{name:"version",aliases:["v"],type:"boolean",description:"Displays the version of the command",required:!1},priority:0,handle(t,e,r,n){return t.v||t.version?(n.writer.writeln(`${n.writer.wrapInColor(e.version||"1.0.0",CliForegroundColor.Cyan)}`),!0):!1}},helpGlobalParameter={parameter:{name:"help",aliases:["h"],type:"boolean",description:"Displays help for the command",required:!1},priority:10,async handle(t,e,r,n){var o;return(o=r.command)!=null&&o.startsWith("help")?!1:t.h||t.help?(await n.executor.showHelp(r,n),!0):!1}},contextGlobalParameter={parameter:{name:"context",aliases:[],type:"boolean",description:"Sets the command as the active context",required:!1},priority:20,handle(t,e,r,n){return t.context?(n.setContextProcessor(e),!0):!1}},FS_TOKEN2="cli-file-system-service";async function writeOutputToFile(t,e){let r;try{r=e.services.get(FS_TOKEN2)}catch{e.writer.writeError("> redirect requires @qodalis/cli-files plugin");return}const n=e.process.data;if(n!=null)try{const o=r.resolvePath(t.trim()),u=typeof n=="string"?n:JSON.stringify(n);r.exists(o)?r.writeFile(o,u):r.createFile(o,u),await r.persist()}catch(o){e.writer.writeError(`> failed: ${o.message||o}`)}}async function appendOutputToFile(t,e){let r;try{r=e.services.get(FS_TOKEN2)}catch{e.writer.writeError(">> redirect requires @qodalis/cli-files plugin");return}const n=e.process.data;if(n!=null)try{const o=r.resolvePath(t.trim()),u=typeof n=="string"?n:JSON.stringify(n);r.exists(o)?r.writeFile(o,u,!0):r.createFile(o,u),await r.persist()}catch(o){e.writer.writeError(`>> failed: ${o.message||o}`)}}async function writeStderrToFile(t,e,r){const n=r==null?void 0:r.getCapturedStderr();if(!n)return;let o;try{o=e.services.get(FS_TOKEN2)}catch{e.writer.writeError("2> redirect requires @qodalis/cli-files plugin");return}try{const u=o.resolvePath(t.trim());o.exists(u)?o.writeFile(u,n):o.createFile(u,n),await o.persist()}catch(u){e.writer.writeError(`2> failed: ${u.message||u}`)}}async function appendStderrToFile(t,e,r){const n=r==null?void 0:r.getCapturedStderr();if(!n)return;let o;try{o=e.services.get(FS_TOKEN2)}catch{e.writer.writeError("2>> redirect requires @qodalis/cli-files plugin");return}try{const u=o.resolvePath(t.trim());o.exists(u)?o.writeFile(u,n,!0):o.createFile(u,n),await o.persist()}catch(u){e.writer.writeError(`2>> failed: ${u.message||u}`)}}async function tryExecuteScript(t,e,r){const n="cli-file-system-service";let o;try{o=e.services.get(n)}catch{return!1}const u=o.resolvePath(t),h=o.getNode(u);if(!h||h.type!=="file")return!1;const a=h.permissions||"rw-r--r--";if(!(a.length>=3&&a[2]==="x"))return e.writer.writeError(`${t}: Permission denied (missing execute permission)`),e.writer.writeInfo(`Use ${e.writer.wrapInColor(`chmod u+x ${t}`,CliForegroundColor.Cyan)} to make it executable, or run with ${e.writer.wrapInColor(`sh ${t}`,CliForegroundColor.Cyan)}`),e.process.exit(126,{silent:!0}),!0;const f=o.readFile(u);if(f==null)return e.writer.writeError(`${t}: Cannot read file`),e.process.exit(1,{silent:!0}),!0;const C=f.split(`
190
- `),d={};let P=!0;for(const H of C){const W=H.trim();if(!W||W.startsWith("#"))continue;if(W==="set -e"){P=!0;continue}if(W==="set +e"){P=!1;continue}const U=W.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);if(U){const x=U[1];let j=U[2];(j.startsWith('"')&&j.endsWith('"')||j.startsWith("'")&&j.endsWith("'"))&&(j=j.slice(1,-1)),j=substituteVars(j,d),d[x]=j;continue}const L=substituteVars(W,d);await r(L,e);const N=e.process.exitCode;if(P&&N!==void 0&&N!==0)return e.writer.writeError(`${t}: script aborted at line: ${W}`),!0}return!0}function substituteVars(t,e){let r=t.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(n,o)=>e[o]??"");return r=r.replace(/\$([A-Za-z_][A-Za-z0-9_]*)/g,(n,o)=>e[o]??""),r}function expandEnvironmentVars(t,e){let r;try{r=e.services.get(ICliEnvironment_TOKEN)}catch{return t}const n=t.split("'");for(let o=0;o<n.length;o++)o%2===0&&(n[o]=n[o].replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(u,h)=>r.get(h)??""),n[o]=n[o].replace(/\$([A-Za-z_][A-Za-z0-9_]*)/g,(u,h)=>r.get(h)??""));return n.join("'")}var CliCommandExecutor=class{constructor(t){this.registry=t,this.commandParser=new CommandParser,this.globalParameters=[],this.registerGlobalParameter(versionGlobalParameter),this.registerGlobalParameter(helpGlobalParameter),this.registerGlobalParameter(contextGlobalParameter)}registerGlobalParameter(t){this.globalParameters.push(t),this.globalParameters.sort((e,r)=>(e.priority??0)-(r.priority??0))}getGlobalParameters(){return this.globalParameters.map(t=>t.parameter)}async executeCommand(t,e){const r=CommandParser.splitByOperators(t);let n;e instanceof CliCommandExecutionContext?n=e.context:n=e;let o=!0,u=!0,h,a;for(let l=0;l<r.length;l++){const f=r[l];if(f.type==="&&"){u=o;continue}else if(f.type==="||"){u=!o;continue}else if(f.type==="|"){u=!0;continue}else if(f.type===";"){u=!0,h=void 0;continue}else if(f.type===">>"){const C=r[l+1];if(l++,!C||C.type!=="command"){e.writer.writeError("Missing file path after >>"),o=!1;continue}u&&(await appendOutputToFile(C.value,e),h=void 0);continue}else if(f.type===">"){const C=r[l+1];if(l++,!C||C.type!=="command"){e.writer.writeError("Missing file path after >"),o=!1;continue}u&&(await writeOutputToFile(C.value,e),h=void 0);continue}else if(f.type==="2>>"){const C=r[l+1];if(l++,!C||C.type!=="command"){e.writer.writeError("Missing file path after 2>>"),o=!1;continue}u&&await appendStderrToFile(C.value,e,a);continue}else if(f.type==="2>"){const C=r[l+1];if(l++,!C||C.type!=="command"){e.writer.writeError("Missing file path after 2>"),o=!1;continue}u&&await writeStderrToFile(C.value,e,a);continue}if(u){try{a=await this.executeSingleCommand(f.value,h,n),o=e.process.exitCode===void 0||e.process.exitCode===0,h=e.process.data}catch(C){o=!1,e.writer.writeError(`Command ${f.value} failed: ${C}`)}u=!0}}}async executeSingleCommand(t,e,r){var G,ee,ne;const n=r.process;t=expandEnvironmentVars(t,r);const o=t.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);if(o)try{const ae=r.services.get(ICliEnvironment_TOKEN);let ce=o[2];(ce.startsWith('"')&&ce.endsWith('"')||ce.startsWith("'")&&ce.endsWith("'"))&&(ce=ce.slice(1,-1)),ae.set(o[1],ce),n.start(),n.end();return}catch{}n.start();let u;try{u=r.services.get(CliProcessRegistry_TOKEN).register(t)}catch{}const h=this.commandParser.parse(t);let{commandName:a}=h,l=h.args;const[f,...C]=a.split(" ");let d=C.map(ae=>ae.toLowerCase());const P=r.contextProcessor?r.contextProcessor.processors??[]:this.registry.processors,H=this.registry.findProcessorInCollection(f,d,P);if((G=H==null?void 0:H.parameters)!=null&&G.length){const ae=reconcileArgs(h.tokens,H.parameters);l=ae.args,a=ae.commandParts.join(" ")}if(!H){const ae=this.registry.findProcessor("alias",[]),ce=(ae==null?void 0:ae.userAliases)??{};if(ce[f])return this.completeProcess(u,r,0),await this.executeSingleCommand(ce[f],e,r);if((f.startsWith("./")||f.startsWith("/"))&&await tryExecuteScript(f,r,this.executeCommand.bind(this))){this.completeProcess(u,r,0),n.end();return}r.writer.writeError(`Command not found: ${r.writer.wrapInColor(a,CliForegroundColor.Cyan)}`),r.writer.writeln(),r.writer.writeInfo(`💡 Type ${r.writer.wrapInColor("help",CliForegroundColor.Cyan)} for a list of available commands`),r.writer.writeInfo(`📦 Use ${r.writer.wrapInColor("pkg add <name>",CliForegroundColor.Cyan)} to install additional commands`),this.failProcess(u,r),r.process.exit(-1,{silent:!0});return}const W=CliArgsParser.convertToRecord(l,H),U={command:a,chainCommands:d,rawCommand:t,args:W,data:e};for(const ae of this.globalParameters)if(!this.processorOwnsParameter(H,ae.parameter)&&await ae.handle(W,H,U,r)){this.completeProcess(u,r,0),n.end();return}const L=H.acceptsRawInput||H.valueRequired?getRightOfWord(a,H.command):void 0;U.value=L;const N=!!L||!!e,x=Object.keys(W).length>0;if(H.valueRequired&&!N&&!x){r.writer.writeError(`Value required: ${r.writer.wrapInColor(`${a} <value>`,CliForegroundColor.Cyan)}`),r.process.exit(-1);return}if(!this.validateBeforeExecution(r,H,W,N)){n.end();return}if(H.validateBeforeExecution){const ae=H.validateBeforeExecution(U,r);if(ae.valid===!1){r.writer.writeError((ae==null?void 0:ae.message)||"An error occurred while validating the command."),r.process.exit(-1);return}}let j=null;const V=new CliCommandExecutionContext(r,H),Y=new AbortController;V.signal=Y.signal;const J=r.onAbort.subscribe(()=>{Y.abort()}),X=new CapturingTerminalWriter(V.writer);V.writer=X;try{const ae=H.hooks??[];for(const ce of ae.filter(oe=>oe.when==="before"))await ce.execute(V);j=new CancellablePromise(async(ce,oe)=>{H.processCommand(U,V).then(()=>{ce()}).catch(we=>{oe(we)})}),await j.execute();for(const ce of ae.filter(oe=>oe.when==="after"))await ce.execute(V);return!n.outputCalled&&X.hasOutput()&&(n.data=X.getCapturedData()),this.completeProcess(u,r,r.process.exitCode??0),n.exited||n.end(),X}catch(ae){(ee=r.spinner)==null||ee.hide(),ae instanceof ProcessExitedError?(ae.code===0?this.completeProcess(u,r,0):this.failProcess(u,r),j==null||j.cancel(),(ne=r.abort)==null||ne.call(r),ae.code!==0?r.writer.writeError(`Process exited with code ${ae.code}`):r.writer.writeInfo("Process exited successfully with code 0")):(this.failProcess(u,r),r.writer.writeError(`Error executing command: ${ae}`),r.process.exit(-1))}finally{J.unsubscribe()}return X}completeProcess(t,e,r){if(t)try{e.services.get(CliProcessRegistry_TOKEN).complete(t.pid,r)}catch{}}failProcess(t,e){if(t)try{e.services.get(CliProcessRegistry_TOKEN).fail(t.pid)}catch{}}async showHelp(t,e){try{await this.executeCommand("help "+t.rawCommand,e)}catch(r){e.writer.writeError(`Error executing command: ${r}`)}}validateBeforeExecution(t,e,r,n){var u,h,a,l,f;if(!n&&((u=e.parameters)!=null&&u.some(C=>C.required))){const C=(h=e.parameters)==null?void 0:h.filter(d=>{var P;return d.required&&!r[d.name]&&!((P=d.aliases)!=null&&P.some(H=>r[H]))});if(C!=null&&C.length)return t.writer.writeError(`Missing required parameters: ${C.map(d=>t.writer.wrapInColor(`--${d.name}`,CliForegroundColor.Cyan)).join(", ")}`),!1}const o=((f=(l=(a=e.parameters)==null?void 0:a.filter(C=>C.validator))==null?void 0:l.map(C=>({parameter:C,value:getParameterValue(C,r)})))==null?void 0:f.filter(C=>C.value))??[];if(o.length>0){const C=o.map(d=>({name:d.parameter.name,result:d.parameter.validator(d.value)})).filter(d=>!d.result.valid).map(d=>({name:d.name,message:d.result.message}));if(C!=null&&C.length)return t.writer.writeError("Invalid parameters:"),C.forEach((d,P)=>{t.writer.writeln(` ${P+1}. ${t.writer.wrapInColor(`--${d.name}`,CliForegroundColor.Cyan)} = "${r[d.name]}" → ${d.message}`)}),!1}return!0}processorOwnsParameter(t,e){const r=new Set([e.name,...e.aliases??[]]),n=t.parameters;return n?n.some(o=>{var u;return r.has(o.name)||((u=o.aliases)==null?void 0:u.some(h=>r.has(h)))}):!1}},CliServiceContainer=class{constructor(){this.services=new Map,this.multiServices=new Map}get(t){if(this.multiServices.has(t))return this.multiServices.get(t);if(this.services.has(t))return this.services.get(t);const e=typeof t=="string"?t:typeof t=="function"?t.name:String(t);throw new Error(`CliServiceContainer: No provider found for token "${e}".`)}set(t){if(Array.isArray(t))for(const e of t)this.registerProvider(e);else this.registerProvider(t)}getRegisteredTokens(){const t=[];for(const e of this.services.keys())t.push(typeof e=="string"?e:typeof e=="function"?e.name:String(e));for(const e of this.multiServices.keys()){const r=typeof e=="string"?e:typeof e=="function"?e.name:String(e);t.push(`${r} (multi)`)}return t}getRegisteredServiceDetails(){const t=[];for(const[e,r]of this.services.entries())t.push({token:typeof e=="string"?e:typeof e=="function"?e.name:String(e),type:this.describeValue(r),multi:!1});for(const[e,r]of this.multiServices.entries())t.push({token:typeof e=="string"?e:typeof e=="function"?e.name:String(e),type:`[${r.map(n=>this.describeValue(n)).join(", ")}]`,multi:!0});return t}describeValue(t){var e;return t===null?"null":t===void 0?"undefined":typeof t=="string"?`string("${t.length>30?t.slice(0,30)+"...":t}")`:typeof t=="number"?`number(${t})`:typeof t=="boolean"?`boolean(${t})`:Array.isArray(t)?`Array(${t.length})`:typeof t=="object"&&((e=t.constructor)!=null&&e.name)?t.constructor.name:typeof t}registerProvider(t){const e=this.resolveProvider(t);if(t.multi){const r=this.multiServices.get(t.provide)??[];r.push(e),this.multiServices.set(t.provide,r)}else this.services.set(t.provide,e)}resolveProvider(t){if("useValue"in t)return t.useValue;if("useFactory"in t)return t.useFactory();if("useClass"in t)return new t.useClass;throw new Error("CliServiceContainer: Provider must specify useValue, useFactory, or useClass.")}},CliLogger=class{constructor(){this.CliLogLevel=CliLogLevel.ERROR}setCliLogLevel(t){this.CliLogLevel=t}log(...t){this.CliLogLevel<=CliLogLevel.LOG&&console.log(...t)}info(...t){this.CliLogLevel<=CliLogLevel.INFO&&console.info(...t)}warn(...t){this.CliLogLevel<=CliLogLevel.WARN&&console.warn(...t)}error(...t){this.CliLogLevel<=CliLogLevel.ERROR&&console.error(...t)}debug(...t){this.CliLogLevel<=CliLogLevel.DEBUG&&console.debug(...t)}},CliCommandHistory=class{constructor(t){this.store=t,this.storageKey="cli-command-history",this.commandHistory=[]}async addCommand(t){const e=t.trim();if(!e)return;const r=this.commandHistory.indexOf(e);r!==-1&&this.commandHistory.splice(r,1),this.commandHistory.push(e),await this.saveHistory()}getLastIndex(){return this.commandHistory.length}getHistory(){return[...this.commandHistory]}async clearHistory(){this.commandHistory=[],await this.saveHistory()}async setHistory(t){this.commandHistory=[...t],await this.saveHistory()}getCommand(t){return this.commandHistory[t]}search(t){if(!t)return[...this.commandHistory];const e=t.toLowerCase();return this.commandHistory.filter(r=>r.toLowerCase().includes(e))}searchBackward(t,e){for(let r=e-1;r>=0;r--)if(this.commandHistory[r].startsWith(t))return r;return-1}searchForward(t,e){for(let r=e+1;r<this.commandHistory.length;r++)if(this.commandHistory[r].startsWith(t))return r;return-1}async saveHistory(){const t=this.commandHistory.slice(-500);return await this.store.set(this.storageKey,t)}async loadHistory(){const t=localStorage.getItem("cliCommandHistory");t&&(localStorage.removeItem("cliCommandHistory"),await this.store.set(this.storageKey,JSON.parse(t)));const e=await this.store.get(this.storageKey);e&&(this.commandHistory=e)}async initialize(){await this.loadHistory()}},welcomeModule={apiVersion:2,name:"@qodalis/cli-welcome",priority:-1,configure(t){return{...this,config:t}},async onAfterBoot(t){var o,u,h;const e=this.config||{};let r=e.show;try{const l=t.services.get(CliStateStoreManager_TOKEN).getStateStore(CLI_CONFIGURE_STORE_NAME);await l.initialize();const f=l.getState();(o=f==null?void 0:f.system)!=null&&o.welcomeMessage&&(r=f.system.welcomeMessage)}catch{}if(r&&!shouldDisplayWelcomeMessage(r)){t.showPrompt();return}e.message?t.terminal.writeln(e.message):[`🚀 Welcome to Web CLI [Version ${t.writer.wrapInColor(LIBRARY_VERSION,CliForegroundColor.Green)}]`,`(c) ${new Date().getFullYear()} Qodalis Solutions. All rights reserved.`,getCliNameArt(t.terminal.cols),"",`📖 ${t.writer.wrapInColor("Documentation:",CliForegroundColor.Green)} https://cli.qodalis.com/docs/`,"",`💡 Type ${t.writer.wrapInColor("'help'",CliForegroundColor.Cyan)} to see available commands`,""].forEach(l=>{t.terminal.write(l+`\r
191
- `)}),recordWelcomeMessageDisplay(),t.showPrompt();let n=!0;try{const l=t.services.get(CliStateStoreManager_TOKEN).getStateStore(CLI_CONFIGURE_STORE_NAME);await l.initialize();const f=l.getState();((u=f==null?void 0:f.system)==null?void 0:u.greeting)===!1&&(n=!1)}catch{}n&&await((h=t.textAnimator)==null?void 0:h.showText(getGreetingBasedOnTime(),{speed:60,removeAfterTyping:!0}))}};function shouldDisplayWelcomeMessage(t){const e=localStorage.getItem("cliWelcomeMessageLastDisplayed");switch(t){case"always":return!0;case"once":return!e;case"daily":if(!e)return!0;const r=new Date,n=new Date(e);return r.toDateString()!==n.toDateString();case"never":return!1;default:return!0}}function recordWelcomeMessageDisplay(){localStorage.setItem("cliWelcomeMessageLastDisplayed",new Date().toISOString())}var CliBoot=class{constructor(t,e){this.registry=t,this.services=e,this.initialized=!1,this.initializing=!1,this.bootedModules=new Set,this.initializedProcessors=new Set,this.moduleRegistry=new CliModuleRegistry}getModuleRegistry(){return this.moduleRegistry}async boot(t,e){var u,h,a;if((u=t.spinner)==null||u.show(CliIcon.Rocket+" Booting..."),this.initialized||this.initializing){await this.bootShared(t),(h=t.spinner)==null||h.hide();return}this.initializing=!0,this.moduleRegistry.onWarn=l=>t.logger.warn(l),initializeBrowserEnvironment({context:t,registry:this.moduleRegistry}),this.moduleRegistry.onModuleBoot(async l=>{await this.bootModule(l,t)});const r=this.buildCoreModule();await this.bootModule(r,t);const n=e.filter(l=>{const f=l.apiVersion;return typeof f!="number"||f<API_VERSION?(t.writer.writeWarning(`Plugin "${l.name}" targets API version ${f??"unknown"}, but this runtime requires API version ${API_VERSION}. Skipping. See https://qodalis.com/docs/upgrade-v2`),!1):!0}),o=this.topologicalSort(n,t);for(const l of o)await this.bootModule(l,t);await this.bootShared(t),(a=t.spinner)==null||a.hide(),this.initialized=!0}async bootModule(t,e){var r,n;if(!this.bootedModules.has(t.name)){for(const o of t.dependencies??[])if(!this.bootedModules.has(o)){e.writer.writeWarning(`Module "${t.name}" requires "${o}" which is not loaded. Skipping.`);return}if(e.logger.info(`Booting module: ${t.name}`),t.services&&t.services.length>0&&this.services.set(t.services),t.translations)for(const[o,u]of Object.entries(t.translations))e.translator.addTranslations(o,u);if(t.onInit)try{await t.onInit(e)}catch(o){e.logger.error(`Error in onInit for module "${t.name}":`,o)}if(t.onSetup){const o=e.services.get("cli-key-value-store"),u=`cli-module-setup:${t.name}`,h=await o.get(u);if(!(h!=null&&h.installed))try{(r=e.spinner)==null||r.hide(),await t.onSetup(e)&&await o.set(u,{installed:!0,installedAt:Date.now()})}catch(a){e.logger.error(`Setup failed for module "${t.name}":`,a)}finally{(n=e.spinner)==null||n.show()}}if(t.processors&&t.processors.length>0){const o=this.filterByVersion(t.processors,e);for(const u of o)this.registry.registerProcessor(u);await this.initializeProcessorsInternal(e,o)}this.bootedModules.add(t.name),this.moduleRegistry.has(t.name)||this.moduleRegistry.track(t)}}buildCoreModule(){return{apiVersion:API_VERSION,name:"@qodalis/cli-core",version:LIBRARY_VERSION$1,description:"Core CLI services and utilities",processors:[...builtinProcessors]}}topologicalSort(t,e){const r=new Map(t.map(a=>[a.name,a])),n=new Set,o=new Set,u=[],h=a=>{if(n.has(a))return;if(o.has(a)){e.writer.writeError(`Circular dependency detected involving module "${a}". Aborting module loading.`);return}const l=r.get(a);if(l){o.add(a);for(const f of l.dependencies??[]){if(!r.has(f)&&!this.bootedModules.has(f)){e.writer.writeWarning(`Module "${a}" depends on "${f}" which is not loaded. Skipping "${a}".`),o.delete(a);return}h(f)}o.delete(a),n.add(a),u.push(l)}};for(const a of t)h(a.name);return u}filterByVersion(t,e){return t.filter(r=>{const n=r.metadata;return n!=null&&n.requiredCoreVersion&&!satisfiesVersionRange(LIBRARY_VERSION$1,n.requiredCoreVersion)?(e.writer.writeWarning(`Plugin "${r.command}" requires cli-core ${n.requiredCoreVersion} but ${LIBRARY_VERSION$1} is installed. Skipping.`),!1):n!=null&&n.requiredCliVersion&&!satisfiesVersionRange(LIBRARY_VERSION,n.requiredCliVersion)?(e.writer.writeWarning(`Plugin "${r.command}" requires cli ${n.requiredCliVersion} but ${LIBRARY_VERSION} is installed. Skipping.`),!1):!0})}async bootShared(t){const e=this.registry.processors.filter(r=>!this.initializedProcessors.has(r));e.length>0&&await this.initializeProcessorsInternal(t,e)}async initializeProcessorsInternal(t,e,r){for(const n of e)if(!this.initializedProcessors.has(n))try{if(n.parent=r,n.initialize){const o=new CliCommandExecutionContext(t,n);await o.state.initialize(),await n.initialize(o)}this.initializedProcessors.add(n),n.processors&&n.processors.length>0&&await this.initializeProcessorsInternal(t,n.processors,n)}catch(o){t.logger.error(`Error initializing processor "${n.command}":`,o)}}},CliDefaultPingServerService=class{ping(){return new Promise(t=>setTimeout(t,2e3))}},CliDragDropService=class{constructor(t){this._container=t,this._subject=new Subject,this._dragOver=e=>e.preventDefault(),this._drop=e=>{var n;e.preventDefault();const r=Array.from(((n=e.dataTransfer)==null?void 0:n.files)??[]);r.length>0&&this._subject.next(r)},this._container.addEventListener("dragover",this._dragOver),this._container.addEventListener("drop",this._drop)}get onFileDrop(){return this._subject.asObservable()}destroy(){this._container.removeEventListener("dragover",this._dragOver),this._container.removeEventListener("drop",this._drop),this._subject.complete()}},OverlayAddon=class{constructor(){this.overlayNode=document.createElement("div"),this.overlayNode.style.cssText=`border-radius: 15px;
192
- font-size: xx-large;
193
- opacity: 0.75;
194
- padding: 0.2em 0.5em 0.2em 0.5em;
195
- position: absolute;
196
- -webkit-user-select: none;
197
- -webkit-transition: opacity 180ms ease-in;
198
- -moz-user-select: none;
199
- -moz-transition: opacity 180ms ease-in;`,this.overlayNode.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()},!0)}activate(t){this.terminal=t}dispose(){}showOverlay(t,e){const{terminal:r,overlayNode:n}=this;if(!r.element)return;n.style.color="#101010",n.style.backgroundColor="#f0f0f0",n.textContent=t,n.style.opacity="0.75",n.parentNode||r.element.appendChild(n);const o=r.element.getBoundingClientRect(),u=n.getBoundingClientRect();n.style.top=(o.height-u.height)/2+"px",n.style.left=(o.width-u.width)/2+"px",this.overlayTimeout&&clearTimeout(this.overlayTimeout),e&&(this.overlayTimeout=window.setTimeout(()=>{n.style.opacity="0",this.overlayTimeout=window.setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),this.overlayTimeout=void 0,n.style.opacity="0.75"},200)},e||1500))}},CliKeyValueStore=class{constructor(){this.dbName="CliKeyValueDB",this.storeName="KeyValueStore"}initialize(){return new Promise((t,e)=>{const r=indexedDB.open(this.dbName,1);r.onupgradeneeded=n=>{const o=n.target.result;o.objectStoreNames.contains(this.storeName)||o.createObjectStore(this.storeName)},r.onsuccess=n=>{this.db=n.target.result,t()},r.onerror=()=>{var n;e(new Error(`Failed to open IndexedDB "${this.dbName}": ${((n=r.error)==null?void 0:n.message)??"unknown error"}`))}})}async get(t){return new Promise((e,r)=>{try{const u=this.db.transaction(this.storeName,"readonly").objectStore(this.storeName).get(t);u.onsuccess=()=>{e(u.result)},u.onerror=()=>{var h;r(new Error(`IndexedDB get("${t}") failed: ${((h=u.error)==null?void 0:h.message)??"unknown error"}`))}}catch(n){r(new Error(`IndexedDB get("${t}") failed: ${n instanceof Error?n.message:n}`))}})}async set(t,e){return new Promise((r,n)=>{const h=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(e,t);h.onsuccess=()=>r(),h.onerror=()=>{var a;n(new Error(`IndexedDB set("${t}") failed: ${((a=h.error)==null?void 0:a.message)??"unknown error"}`))}})}async remove(t){return new Promise((e,r)=>{const u=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(t);u.onsuccess=()=>e(),u.onerror=()=>{var h;r(new Error(`IndexedDB remove("${t}") failed: ${((h=u.error)==null?void 0:h.message)??"unknown error"}`))}})}async clear(){return new Promise((t,e)=>{const o=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).clear();o.onsuccess=()=>t(),o.onerror=()=>{var u;e(new Error(`IndexedDB clear() failed: ${((u=o.error)==null?void 0:u.message)??"unknown error"}`))}})}},CliStateStore=class{constructor(t,e,r){this.services=t,this.name=e,this.initialState=r,this.state$=new BehaviorSubject(r),this.storageKey=`store-state-${e}`}getState(){return this.state$.getValue()}updateState(t){this.state$.next({...this.getState(),...t})}select(t){return this.state$.asObservable().pipe(map(t),distinctUntilChanged())}subscribe(t){return this.state$.asObservable().subscribe(t)}reset(){this.state$.next(this.initialState)}async persist(){await this.services.get("cli-key-value-store").set(this.storageKey,this.getState())}async initialize(){try{const e=await this.services.get("cli-key-value-store").get(this.storageKey);e&&this.state$.next(e)}catch(t){console.error(`CliStateStore: Failed to load state for "${this.name}":`,t)}}dispose(){this.state$.complete()}},CliStateStoreManager=class{constructor(t,e){this.services=t,this.registry=e,this.stores=new Map}getStateStore(t,e){return this.stores.has(t)||this.stores.set(t,new CliStateStore(this.services,t,e??{})),this.stores.get(t)}getProcessorStateStore(t){var r,n;const e=this.registry.getRootProcessor(t);return this.getStateStore(((r=e.stateConfiguration)==null?void 0:r.storeName)||e.command,(n=e.stateConfiguration)==null?void 0:n.initialState)}getStoreEntries(){const t=[];return this.stores.forEach((e,r)=>{t.push({name:r,state:e.getState()})}),t}dispose(){this.stores.forEach(t=>{t.dispose&&t.dispose()}),this.stores.clear()}},CliCommandCompletionProvider=class{constructor(t){this.registry=t,this.priority=100}getCompletions(t){var a,l,f;const{tokens:e,tokenIndex:r,token:n}=t;if(r===0)return this.getCommandNames(this.registry.processors,n);const o=e[0],u=this.registry.findProcessor(o,[]);if(!((a=u==null?void 0:u.processors)!=null&&a.length))return[];let h=u;for(let C=1;C<r;C++){const d=(l=h.processors)==null?void 0:l.find(P=>P.command===e[C]);if(!((f=d==null?void 0:d.processors)!=null&&f.length))return[];h=d}return this.getCommandNames(h.processors??[],n)}getCommandNames(t,e){const r=[];for(const n of t)r.push(n.command),n.aliases&&r.push(...n.aliases);return getAccelerator().prefixMatch(r,e)}},CliParameterCompletionProvider=class{constructor(t,e){this.registry=t,this.executor=e,this.priority=200}getCompletions(t){const{tokens:e,token:r}=t;if(!r.startsWith("-"))return[];if(e.length===0)return[];const n=e[0],o=e.slice(1).filter(d=>!d.startsWith("-")),u=this.registry.findProcessorInCollection(n,o,this.registry.processors),h=[...(u==null?void 0:u.parameters)??[],...this.executor.getGlobalParameters()];if(h.length===0)return[];const a=r.startsWith("--"),l=a?r.slice(2):r.slice(1),f=[];for(const d of h)if(a)f.push(`--${d.name}`);else{if(d.aliases)for(const P of d.aliases)f.push(`-${P}`);f.push(`--${d.name}`)}const C=a?`--${l}`:`-${l}`;return getAccelerator().prefixMatch(f,C)}},SERVICE_NAME_SUBCOMMANDS=new Set(["start","stop","restart","logs","info"]),CliServiceNameCompletionProvider=class{constructor(t){this.backgroundServices=t,this.priority=50}getCompletions(t){const{tokens:e,tokenIndex:r,token:n}=t;if(r!==2||e.length<2)return[];const o=e[0].toLowerCase();if(o!=="services"&&o!=="svc")return[];const u=e[1].toLowerCase();if(!SERVICE_NAME_SUBCOMMANDS.has(u))return[];const h=n.toLowerCase();return this.backgroundServices.list().map(l=>l.name).filter(l=>l.toLowerCase().startsWith(h)).sort()}},INSTALLED_PKG_SUBCOMMANDS=new Set(["remove","rm","update"]),CliPackageNameCompletionProvider=class{constructor(t){this.services=t,this.priority=50,this.QODALIS_PREFIX="@qodalis/cli-"}async getCompletions(t){const{tokens:e,tokenIndex:r,token:n}=t;if(r<2||e.length<2)return[];const o=e[0].toLowerCase();if(o!=="pkg"&&o!=="packages")return[];const u=e[1].toLowerCase();if(!INSTALLED_PKG_SUBCOMMANDS.has(u))return[];let h;try{h=this.services.get(CliPackageManagerService_TOKEN)}catch{return[]}const a=await h.getPackages(),l=n.toLowerCase(),f=new Set(e.slice(2,r).map(d=>d.toLowerCase())),C=[];for(const d of a){const P=d.name,H=P.startsWith(this.QODALIS_PREFIX)?P.slice(this.QODALIS_PREFIX.length):null;f.has(P.toLowerCase())||H&&f.has(H.toLowerCase())||(P.toLowerCase().startsWith(l)&&C.push(P),H&&H.toLowerCase().startsWith(l)&&C.push(H))}return C.sort()}},THEME_NAME_SUBCOMMANDS=new Set(["preview","apply"]),RANDOM_FILTER_VALUES=["dark","light"],SEARCH_TAGS=["popular","retro","fun","pastel","accessibility","built-in","dark","light"],CliThemeNameCompletionProvider=class{constructor(){this.priority=50,this.themeNames=Object.keys(DefaultThemes)}getCompletions(t){const{tokens:e,tokenIndex:r,token:n}=t;if(r!==2||e.length<2)return[];const o=e[0].toLowerCase();if(o!=="theme"&&o!=="themes")return[];const u=e[1].toLowerCase(),h=n.toLowerCase();return THEME_NAME_SUBCOMMANDS.has(u)?this.themeNames.filter(a=>a.toLowerCase().startsWith(h)).sort():u==="random"?RANDOM_FILTER_VALUES.filter(a=>a.startsWith(h)):u==="search"?SEARCH_TAGS.filter(a=>a.startsWith(h)):[]}},CliAliasNameCompletionProvider=class{constructor(t){this.stateStoreManager=t,this.priority=50}getCompletions(t){const{tokens:e,tokenIndex:r,token:n}=t;if(r!==1||e.length<1)return[];if(e[0].toLowerCase()!=="unalias")return[];const h=this.stateStoreManager.getStateStore("aliases").getState(),a=h==null?void 0:h.aliases;if(!a||typeof a!="object")return[];const l=n.toLowerCase();return Object.keys(a).filter(f=>f.toLowerCase().startsWith(l)).sort()}},SERVER_NAME_SUBCOMMANDS=new Set(["status","reconnect","default"]),CliServerNameCompletionProvider=class{constructor(t){this.serverManager=t,this.priority=50}getCompletions(t){var u;const{tokens:e,tokenIndex:r,token:n}=t,o=(u=e[0])==null?void 0:u.toLowerCase();if(o==="ssh"&&r===1)return this.matchServerNames(n,!0);if(o==="server"&&r===2&&e.length>=2){const h=e[1].toLowerCase();if(SERVER_NAME_SUBCOMMANDS.has(h))return this.matchServerNames(n)}return[]}matchServerNames(t,e=!1){var o;const r=t.toLowerCase(),n=[];for(const[u,h]of this.serverManager.connections)e&&!((o=h.capabilities)!=null&&o.shell)||u.toLowerCase().startsWith(r)&&n.push(u);return n.sort()}},CONFIG_KEY_SUBCOMMANDS=new Set(["get","set"]),SYSTEM_KEYS=["logLevel","welcomeMessage"],CliConfigKeyCompletionProvider=class{constructor(t){this.registry=t,this.priority=50}getCompletions(t){const{tokens:e,tokenIndex:r,token:n}=t;if(r!==2||e.length<2)return[];if(e[0].toLowerCase()!=="configure")return[];const u=e[1].toLowerCase();if(!CONFIG_KEY_SUBCOMMANDS.has(u))return[];const h=this.getAllConfigKeys(),a=n.toLowerCase();return h.filter(l=>l.toLowerCase().startsWith(a)).sort()}getAllConfigKeys(){const t=[];for(const r of SYSTEM_KEYS)t.push(`system.${r}`);const e=resolveConfigurationCategories(this.registry);for(const[r,{options:n}]of e)for(const o of n)t.push(`${r}.${o.key}`);return t}},CliServerCommandProcessor=class{constructor(){this.command="server",this.description="Manage remote CLI server connections",this.metadata={icon:CliIcon.Server,module:"@qodalis/cli-server",sealed:!0},this.processors=[new ServerListProcessor,new ServerStatusProcessor,new ServerReconnectProcessor,new ServerDefaultProcessor]}async processCommand(t,e){e.writer.writeln("Usage: server <list|status|reconnect|default>"),e.writer.writeln('Run "help server" for details.')}},ServerListProcessor=class{constructor(){this.command="list",this.description="Show configured servers and their connection status"}async processCommand(t,e){const r=e.services.get(CliServerManager_TOKEN);if(!r||r.connections.size===0){e.writer.writeInfo("No servers configured.");return}const n=["Name","URL","Status","API","Commands"],o=[],u=r.defaultServer;for(const[h,a]of r.connections){const l=h===u;o.push([l?`${h} *`:h,a.config.url,a.connected?"Connected":"Disconnected",a.connected?`v${a.apiVersion}`:"-",a.connected?String(a.commands.length):"-"])}e.writer.writeTable(n,o),u&&e.writer.writeInfo("* = default server")}},ServerStatusProcessor=class{constructor(){this.command="status",this.description="Ping a server and show its version",this.valueRequired=!0}async processCommand(t,e){var h,a;const r=t.value;if(!r){e.writer.writeError("Usage: server status <server-name>"),e.process.exit(1);return}const n=e.services.get(CliServerManager_TOKEN),o=n==null?void 0:n.getConnection(r);if(!o){e.writer.writeError(`Unknown server: ${r}`),e.process.exit(1);return}(h=e.spinner)==null||h.show(`Pinging ${r}...`);const u=await o.ping();(a=e.spinner)==null||a.hide(),u?(e.writer.writeSuccess(`Server '${r}' is reachable`),e.writer.writeKeyValue({URL:o.config.url,Connected:String(o.connected),"API Version":o.connected?`v${o.apiVersion}`:"unknown",Commands:String(o.commands.length)})):e.writer.writeError(`Server '${r}' is not reachable at ${o.config.url}`)}},ServerReconnectProcessor=class{constructor(){this.command="reconnect",this.description="Re-fetch commands from a server",this.valueRequired=!0}async processCommand(t,e){var u,h;const r=t.value;if(!r){e.writer.writeError("Usage: server reconnect <server-name>"),e.process.exit(1);return}const n=e.services.get(CliServerManager_TOKEN);if(!n){e.writer.writeError("Server manager not available."),e.process.exit(1);return}(u=e.spinner)==null||u.show(`Reconnecting to ${r}...`);const o=await n.reconnect(r);(h=e.spinner)==null||h.hide(),o.success?e.writer.writeSuccess(`Reconnected to '${r}'. ${o.commandCount} commands available.`):(e.writer.writeError(`Could not reconnect to '${r}'.`),e.process.exit(1))}},ServerDefaultProcessor=class{constructor(){this.command="default",this.description="Get or set the default server for ambiguous commands",this.acceptsRawInput=!0,this.parameters=[{name:"--clear",description:"Remove default server preference",required:!1,type:"boolean"}]}async processCommand(t,e){var o;const r=e.services.get(CliServerManager_TOKEN);if(!r){e.writer.writeError("Server manager not available."),e.process.exit(1);return}if((o=t.args)!=null&&o.clear){r.setDefaultServer(null),e.writer.writeSuccess("Default server cleared.");return}const n=t.value;if(!n){const u=r.defaultServer;u?e.writer.writeInfo(`Default server: ${u}`):e.writer.writeInfo('No default server set. Run "server default <name>" to set one.');return}try{r.setDefaultServer(n),e.writer.writeSuccess(`Default server set to '${n}'.`)}catch{e.writer.writeError(`Unknown server: ${n}`),e.process.exit(1)}}},CliSshCommandProcessor=class{constructor(){this.command="ssh",this.description="Open a remote shell session on a server",this.acceptsRawInput=!0,this.valueRequired=!1,this.metadata={module:"@qodalis/cli-server",icon:"🖥"},this.parameters=[{name:"server",description:"Name of the server to connect to",required:!1,type:"string"}],this.socket=null,this.context=null,this.resolved=!1}async processCommand(t,e){var a;const r=e.services.get(CliServerManager_TOKEN);if(!r){e.writer.writeError("Server manager not available."),e.process.exit(1);return}const n=[];for(const[l,f]of r.connections)f.connected&&((a=f.capabilities)!=null&&a.shell)&&n.push({name:l,connection:f});if(n.length===0){e.writer.writeError("No servers with shell access are available."),e.process.exit(1);return}const{serverName:o,oneShotCmd:u,connection:h}=await this.resolveServer(t,n,e);!o||!h||(u?await this.executeOneShot(h,o,u,e):await this.executeInteractive(h,o,e))}async onData(t,e){var r;if(((r=this.socket)==null?void 0:r.readyState)===WebSocket.OPEN){const n={type:"stdin",data:t};this.socket.send(JSON.stringify(n))}}onResize(t,e,r){var n;if(((n=this.socket)==null?void 0:n.readyState)===WebSocket.OPEN){const o={type:"resize",cols:t,rows:e};this.socket.send(JSON.stringify(o))}}onDispose(t){this.socket&&((this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING)&&this.socket.close(),this.socket=null),this.context=null}async resolveServer(t,e,r){var f,C;const n={serverName:null,oneShotCmd:null,connection:null},o=(f=t.args)==null?void 0:f.server;if(o&&typeof o=="string"){const d=e.find(P=>P.name===o);return d?{serverName:o,oneShotCmd:null,connection:d.connection}:(r.writer.writeError(`Server '${o}' not found or does not support shell access.`),r.process.exit(1),n)}const u=(C=t.value)==null?void 0:C.trim();if(u){const d=u.split(/\s+/),P=d[0],H=e.find(W=>W.name===P);if(H){const W=d.slice(1).join(" ")||null;return{serverName:P,oneShotCmd:W,connection:H.connection}}return r.writer.writeError(`Server '${P}' not found or does not support shell access.`),r.process.exit(1),n}if(e.length===1)return{serverName:e[0].name,oneShotCmd:null,connection:e[0].connection};const h=r.services.get(CliServerManager_TOKEN);if(h!=null&&h.defaultServer){const d=e.find(P=>P.name===h.defaultServer);if(d)return{serverName:d.name,oneShotCmd:null,connection:d.connection}}const a=await r.reader.readSelectInline("Select a server for shell access:",e.map(d=>({label:d.name,value:d.name})));if(!a)return r.writer.writeInfo("Shell cancelled."),n;const l=e.find(d=>d.name===a);return{serverName:a,oneShotCmd:null,connection:l.connection}}async executeInteractive(t,e,r){var h;this.context=r;const n=r.terminal.cols,o=r.terminal.rows,u=this.buildShellUrl(t,n,o);return(h=r.spinner)==null||h.show(`Connecting to ${e}...`),this.resolved=!1,new Promise(a=>{var f;const l=()=>{this.resolved||(this.resolved=!0,a())};try{this.socket=new WebSocket(u)}catch(C){(f=r.spinner)==null||f.hide(),r.writer.writeError(`Failed to connect to '${e}': ${C.message}`),r.process.exit(1),l();return}this.socket.onopen=()=>{},this.socket.onmessage=C=>{var P,H;const d=JSON.parse(C.data);switch(d.type){case"ready":(P=r.spinner)==null||P.hide(),r.writer.writeInfo(`Connected to ${e} (${d.os}, ${d.shell})`),r.enterFullScreenMode(this),r.terminal.write("\x1B[2J\x1B[H\x1B[?25h");break;case"stdout":r.terminal.write(d.data);break;case"stderr":r.terminal.write(d.data);break;case"exit":r.exitFullScreenMode(),r.writer.writeInfo(`Shell exited with code ${d.code}.`),r.process.exit(d.code),this.cleanup(),l();break;case"error":(H=r.spinner)==null||H.hide(),r.exitFullScreenMode(),r.writer.writeError(`Server error: ${d.message}`),r.process.exit(1),this.cleanup(),l();break}},this.socket.onclose=()=>{var C;(C=r.spinner)==null||C.hide(),this.context&&!this.resolved&&(r.exitFullScreenMode(),r.writer.writeWarning(`Connection to '${e}' closed.`),r.process.exit(1)),this.cleanup(),l()},this.socket.onerror=()=>{var C;(C=r.spinner)==null||C.hide(),this.resolved||(r.writer.writeError(`WebSocket error connecting to '${e}'.`),r.process.exit(1)),this.cleanup(),l()}})}async executeOneShot(t,e,r,n){var a;const o=n.terminal.cols,u=n.terminal.rows,h=this.buildShellUrl(t,o,u,r);return(a=n.spinner)==null||a.show(`Running on ${e}...`),new Promise(l=>{var f;try{this.socket=new WebSocket(h)}catch(C){(f=n.spinner)==null||f.hide(),n.writer.writeError(`Failed to connect to '${e}': ${C.message}`),n.process.exit(1),l();return}this.socket.onmessage=C=>{var P,H;const d=JSON.parse(C.data);switch(d.type){case"ready":(P=n.spinner)==null||P.hide();break;case"stdout":n.writer.writeln(d.data);break;case"stderr":n.writer.writeError(d.data);break;case"exit":d.code!==0&&n.process.exit(d.code),this.cleanup(),l();break;case"error":(H=n.spinner)==null||H.hide(),n.writer.writeError(`Server error: ${d.message}`),n.process.exit(1),this.cleanup(),l();break}},this.socket.onclose=()=>{var C;(C=n.spinner)==null||C.hide(),this.cleanup(),l()},this.socket.onerror=()=>{var C;(C=n.spinner)==null||C.hide(),n.writer.writeError(`WebSocket error connecting to '${e}'.`),n.process.exit(1),this.cleanup(),l()}})}buildShellUrl(t,e,r,n){let h=`${(t.config.url.endsWith("/")?t.config.url.slice(0,-1):t.config.url).replace(/^https:/,"wss:").replace(/^http:/,"ws:")}/ws/v1/qcli/shell?cols=${e}&rows=${r}`;return n&&(h+=`&cmd=${encodeURIComponent(n)}`),h}cleanup(){this.socket&&(this.socket.onmessage=null,this.socket.onclose=null,this.socket.onerror=null,(this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING)&&this.socket.close(),this.socket=null),this.context=null}};function createServerModule(){return{apiVersion:2,name:"@qodalis/cli-server",description:"Remote server command integration",priority:-10,processors:[new CliServerCommandProcessor,new CliSshCommandProcessor],services:[]}}function getTerminalOptions(t){return{cursorBlink:!0,allowProposedApi:!0,fontSize:20,theme:DefaultThemes.default,convertEol:!0,...t??{}}}function initializeTerminal(t,e){var a;const r=new xtermExports.Terminal(e),n=new addonFitExports.FitAddon;r.loadAddon(n),r.loadAddon(new addonWebLinksExports.WebLinksAddon),r.loadAddon(new OverlayAddon),r.loadAddon(new addonUnicode11Exports.Unicode11Addon);const o=new D;r.loadAddon(o),r.open(t),n.fit(),t.classList.add("terminal-container"),t.style.background=((a=e.theme)==null?void 0:a.background)??"#000";const u=l=>l.preventDefault();t.addEventListener("wheel",u,{passive:!1}),r.focus();const h=new CliDragDropService(t);return{terminal:r,fitAddon:n,serializeAddon:o,dragDropService:h,wheelListener:u}}var LAYOUT_TIMEOUT_MS=1e4;function waitForLayout(t){return new Promise((e,r)=>{const n=Date.now()+LAYOUT_TIMEOUT_MS,o=()=>{if(t.offsetWidth>0&&t.offsetHeight>0){e();return}if(Date.now()>=n){r(new Error(`CliEngine.start(): container has zero dimensions after ${LAYOUT_TIMEOUT_MS}ms. Ensure the container element is visible and laid out before calling start().`));return}requestAnimationFrame(o)};o()})}var SyntaxHighlighterRegistry=class{constructor(){this.highlighters=new Map,this.extensionMap=new Map}register(t){this.highlighters.set(t.id,t);for(const e of t.extensions)this.extensionMap.set(e,t.id)}unregister(t){const e=this.highlighters.get(t);if(e){for(const r of e.extensions)this.extensionMap.delete(r);this.highlighters.delete(t)}}getByExtension(t){const e=this.extensionMap.get(t);return e?this.highlighters.get(e)??null:null}getRegisteredLanguages(){return Array.from(this.highlighters.keys())}},JsonHighlighter=class{constructor(){this.id="json",this.extensions=[".json",".jsonc"],this.initialState=0}getRules(t){return t===1?[{pattern:/.*?\*\//,tokenType:"comment"},{pattern:/.*/,tokenType:"comment"}]:[{pattern:/\/\/.*$/,tokenType:"comment"},{pattern:/\/\*.*?\*\//,tokenType:"comment"},{pattern:/\/\*.*$/,tokenType:"comment"},{pattern:/"(?:[^"\\]|\\.)*"/,tokenType:"string"},{pattern:/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/,tokenType:"number"},{pattern:/\b(?:true|false|null)\b/,tokenType:"keyword"},{pattern:/[{}\[\]:,]/,tokenType:"punctuation"}]}getNextLineState(t,e){if(e===1)return t.includes("*/")?0:1;const r=t.replace(/"(?:[^"\\]|\\.)*"/g,"").replace(/\/\/.*$/,""),n=r.lastIndexOf("/*");return n===-1?0:r.indexOf("*/",n)===-1?1:0}},HtmlHighlighter=class{constructor(){this.id="html",this.extensions=[".html",".htm",".xml",".svg"],this.initialState=0}getRules(t){return t===1?[{pattern:/.*?-->/,tokenType:"comment"},{pattern:/.*/,tokenType:"comment"}]:[{pattern:/<!--.*?-->/,tokenType:"comment"},{pattern:/<!--.*$/,tokenType:"comment"},{pattern:/(<\/?)([\w-]+)/,tokenType:"tag",captureGroup:2},{pattern:/"[^"]*"/,tokenType:"value"},{pattern:/'[^']*'/,tokenType:"value"},{pattern:/([\w-]+)(\s*=)/,tokenType:"attribute",captureGroup:1},{pattern:/\/?>/,tokenType:"punctuation"},{pattern:/<\/?/,tokenType:"punctuation"},{pattern:/=/,tokenType:"punctuation"}]}getNextLineState(t,e){if(e===1)return t.includes("-->")?0:1;const r=t.lastIndexOf("<!--");return r===-1?0:t.indexOf("-->",r)===-1?1:0}},MarkdownHighlighter=class{constructor(){this.id="markdown",this.extensions=[".md",".mdx",".markdown"],this.initialState=0}getRules(t){return t===1?[{pattern:/^```/,tokenType:"string"},{pattern:/.*/,tokenType:"code"}]:[{pattern:/^#{1,6}\s+.*$/,tokenType:"heading"},{pattern:/^```/,tokenType:"string"},{pattern:/`[^`]+`/,tokenType:"code"},{pattern:/\[[^\]]+\]\([^)]+\)/,tokenType:"link"},{pattern:/\*\*[^*]+\*\*/,tokenType:"bold"},{pattern:/__[^_]+__/,tokenType:"bold"},{pattern:/\*[^*]+\*/,tokenType:"italic"},{pattern:/_[^_]+_/,tokenType:"italic"},{pattern:/^[-*>]\s/,tokenType:"punctuation"}]}getNextLineState(t,e){return t.trimStart().startsWith("```")?e===0?1:0:e}},YamlHighlighter=class{constructor(){this.id="yaml",this.extensions=[".yaml",".yml"],this.initialState=0}getRules(){return[{pattern:/#.*$/,tokenType:"comment"},{pattern:/"(?:[^"\\]|\\.)*"/,tokenType:"string"},{pattern:/'[^']*'/,tokenType:"string"},{pattern:/\b(?:true|false|null|~)\b/,tokenType:"keyword"},{pattern:/-?\d+(?:\.\d+)?/,tokenType:"number"},{pattern:/([\w][\w.\-]*)(\s*:)/,tokenType:"tag",captureGroup:1},{pattern:/[-:\[\]{}]/,tokenType:"punctuation"}]}getNextLineState(){return 0}},CliTranslationService=class{constructor(){this.locale="en",this.translations=new Map}t(t,e,r){var o,u;let n;if(this.locale!=="en"&&(n=(o=this.translations.get(this.locale))==null?void 0:o[t]),n===void 0&&(n=(u=this.translations.get("en"))==null?void 0:u[t]),n===void 0&&(n=e),r)for(const[h,a]of Object.entries(r))n=n.replace(new RegExp(`\\{${h}\\}`,"g"),String(a));return n}getLocale(){return this.locale}setLocale(t){this.locale=t}addTranslations(t,e){const r=this.translations.get(t)||{};this.translations.set(t,{...r,...e})}getAvailableLocales(){return[...new Set(["en",...this.translations.keys()])].sort()}};async function initializeServices(t){const{registry:e,pendingServices:r,dragDropService:n}=t,o=new CliKeyValueStore;await o.initialize();const u=new CliServiceContainer,h=new CliLogger,a=new CliCommandHistory(o);await a.initialize(),u.set([{provide:"cli-key-value-store",useValue:o}]);const l=new CliStateStoreManager(u,e),f=new CliProcessRegistry;u.set([{provide:CliStateStoreManager_TOKEN,useValue:l},{provide:CliProcessorsRegistry_TOKEN,useValue:e},{provide:CliCommandHistory_TOKEN,useValue:a},{provide:CliProcessRegistry_TOKEN,useValue:f}]),r.length>0&&u.set(r);const C=new Set(r.map(H=>H.provide));C.has(ICliPingServerService_TOKEN)||u.set([{provide:ICliPingServerService_TOKEN,useValue:new CliDefaultPingServerService}]);const d=new SyntaxHighlighterRegistry;d.register(new JsonHighlighter),d.register(new HtmlHighlighter),d.register(new MarkdownHighlighter),d.register(new YamlHighlighter),u.set([{provide:"syntax-highlighter-registry",useValue:d}]),C.has(ICliEnvironment_TOKEN)||u.set([{provide:ICliEnvironment_TOKEN,useValue:new CliEnvironment}]),u.set([{provide:ICliDragDropService_TOKEN,useValue:n}]);const P=new CliTranslationService;return u.set([{provide:ICliTranslationService_TOKEN,useValue:P}]),{services:u,logger:h,commandHistory:a,stateStoreManager:l,processRegistry:f,translator:P}}var CliEngine=class{constructor(t,e){this.container=t,this.options=e,this.userModules=[],this.pendingServices=[],this.resizeVersion=0,this.resizeScheduled=!1,this.registry=new CliCommandProcessorRegistry}registerModule(t){this.userModules.push(t)}registerModules(t){this.userModules.push(...t)}registerProcessor(t){this.userModules.push({apiVersion:2,name:`__inline_${t.command}`,processors:[t]})}registerProcessors(t){this.userModules.push({apiVersion:2,name:"__inline_processors",processors:t})}registerService(t,e){this.pendingServices.push({provide:t,useValue:e})}async start(){var U,L,N,x;initWasmAccelerator().catch(()=>{}),await waitForLayout(this.container);const t=getTerminalOptions((U=this.options)==null?void 0:U.terminalOptions),e=initializeTerminal(this.container,t);this.terminal=e.terminal,this.fitAddon=e.fitAddon,this.serializeAddon=e.serializeAddon,this.dragDropService=e.dragDropService,this.wheelListener=e.wheelListener,this.handleResize();const{services:r,logger:n,commandHistory:o,stateStoreManager:u,processRegistry:h,translator:a}=await initializeServices({registry:this.registry,pendingServices:this.pendingServices,dragDropService:this.dragDropService});this.bootService=new CliBoot(this.registry,r),r.set([{provide:CliModuleRegistry_TOKEN,useValue:this.bootService.getModuleRegistry()}]);const l=new CliCommandExecutor(this.registry);this.executionContext=new CliExecutionContext({services:r,logger:n,commandHistory:o,stateStoreManager:u,translator:a},this.terminal,l,{...this.options??{},terminalOptions:t}),this.executionContext.initializeTerminalListeners(),this.executionContext.backgroundServices.setProcessRegistry(h),r.set([{provide:CliBackgroundServiceRegistry_TOKEN,useValue:this.executionContext.backgroundServices}]);const f=new CliServerManager(this.registry);r.set([{provide:CliServerManager_TOKEN,useValue:f}]),(L=this.options)!=null&&L.servers&&this.options.servers.length>0&&await f.connectAll(this.options.servers,{warn:j=>this.executionContext.logger.warn(j),info:j=>this.executionContext.logger.info(j)},this.executionContext.backgroundServices,this.executionContext.logger);const C=createServerModule(),d=(N=this.options)!=null&&N.snapshot?[C,...this.userModules]:[welcomeModule,C,...this.userModules];await this.bootService.boot(this.executionContext,d);const P=[new CliServiceNameCompletionProvider(this.executionContext.backgroundServices),new CliPackageNameCompletionProvider(r),new CliThemeNameCompletionProvider,new CliAliasNameCompletionProvider(u),new CliServerNameCompletionProvider(f),new CliConfigKeyCompletionProvider(this.registry),new CliCommandCompletionProvider(this.registry),new CliParameterCompletionProvider(this.registry,l)];let H=[];try{H=r.get(ICliCompletionProvider_TOKEN)??[]}catch{}this.executionContext.completionEngine.setProviders([...H,...P]);const W=[...d].sort((j,V)=>(j.priority??0)-(V.priority??0));for(const j of W)if(j.onAfterBoot)try{await j.onAfterBoot(this.executionContext)}catch(V){this.executionContext.logger.error(`Error in onAfterBoot for module "${j.name}":`,V)}(x=this.options)!=null&&x.snapshot&&await this.restoreSnapshot(this.options.snapshot)}destroy(){var t,e,r,n;if((t=this.executionContext)==null||t.dispose(),this.bootService&&this.executionContext){const o=this.bootService.getModuleRegistry().getAll();for(const u of o)if(u.onDestroy)try{u.onDestroy(this.executionContext)}catch(h){this.executionContext.logger.error(`Error in onDestroy for module "${u.name}":`,h)}}this.resizeListener&&window.removeEventListener("resize",this.resizeListener),this.wheelListener&&this.container.removeEventListener("wheel",this.wheelListener),this.resizeVersion=-1,this.resizeScheduled=!1,(e=this.resizeObserver)==null||e.disconnect(),(r=this.dragDropService)==null||r.destroy(),(n=this.terminal)==null||n.dispose()}focus(){requestAnimationFrame(()=>{var t;this.safeFit(),(t=this.terminal)==null||t.focus()})}getTerminal(){return this.terminal}getContext(){return this.executionContext}getRegistry(){return this.registry}async execute(t){this.executionContext&&await this.executionContext.executor.executeCommand(t,this.executionContext)}snapshot(){if(!this.executionContext)throw new Error("Cannot snapshot before engine has started");const t=this.executionContext.services.get(CliStateStoreManager_TOKEN);return{version:1,timestamp:Date.now(),terminal:{serializedBuffer:this.serializeAddon.serialize(),cols:this.terminal.cols,rows:this.terminal.rows},commandHistory:this.executionContext.commandHistory.getHistory(),stateStores:t.getStoreEntries()}}async restoreSnapshot(t){t.terminal.serializedBuffer&&await new Promise(r=>{this.terminal.write(t.terminal.serializedBuffer,r)}),await this.executionContext.commandHistory.setHistory(t.commandHistory);const e=this.executionContext.services.get(CliStateStoreManager_TOKEN);for(const r of t.stateStores)e.getStateStore(r.name).updateState(r.state)}handleResize(){this.resizeListener=()=>this.safeFit(),window.addEventListener("resize",this.resizeListener),this.resizeObserver=new ResizeObserver(()=>this.safeFit()),this.resizeObserver.observe(this.container)}safeFit(){if(this.container.offsetWidth>0&&this.container.offsetHeight>0){const t=this.terminal.cols;this.fitAddon.fit(),this.executionContext&&t!==this.terminal.cols&&(this.resizeVersion++,this.resizeScheduled||(this.resizeScheduled=!0,this.deferResizeFix()))}}deferResizeFix(){if(this.resizeVersion<0)return;const t=this.resizeVersion;this.terminal.write("",()=>{var e;if(!(this.resizeVersion<0)){if(this.resizeVersion!==t){this.deferResizeFix();return}this.resizeScheduled=!1,(e=this.executionContext)==null||e.handleTerminalResize()}})}},CliContext=reactExports.createContext({engine:null});function useCli(){return reactExports.useContext(CliContext)}var CliConfigCtx=reactExports.createContext({});function useCliConfig(){return reactExports.useContext(CliConfigCtx)}function CliConfigProvider({modules:t,processors:e,options:r,services:n,children:o}){return jsxRuntimeExports.jsx(CliConfigCtx.Provider,{value:{modules:t,processors:e,options:r,services:n},children:o})}function useCliEngine(t,e){const[r,n]=reactExports.useState(null),o=reactExports.useRef(null),u=reactExports.useRef(null);return reactExports.useEffect(()=>{if(e!=null&&e.disabled||!t.current)return;const h=t.current;return u.current=setTimeout(()=>{if(u.current=null,!h)return;const a=new CliEngine(h,e==null?void 0:e.options);if(a.registerService("cli-framework","React"),e!=null&&e.services)for(const[l,f]of Object.entries(e.services))a.registerService(l,f);e!=null&&e.modules&&a.registerModules(e.modules),e!=null&&e.processors&&a.registerProcessors(e.processors),o.current=a,a.start().then(()=>n(a))},0),()=>{if(u.current!==null){clearTimeout(u.current),u.current=null;return}o.current&&(o.current.destroy(),o.current=null,n(null))}},[]),r}function Cli({modules:t,processors:e,options:r,services:n,snapshot:o,onReady:u,style:h,className:a}){const l=useCli(),f=useCliConfig(),C=reactExports.useRef(null),d=!!l.engine,P=t??f.modules,H=e??f.processors,W=r??f.options,U=n??f.services,L=o?{...W,snapshot:o}:W,N=useCliEngine(C,{modules:P,processors:H,options:L,services:U,disabled:d}),x=l.engine??N;return reactExports.useEffect(()=>{x&&u&&u(x)},[x,u]),d?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}):jsxRuntimeExports.jsx("div",{ref:C,style:{height:"100%",...h},className:a})}const options={servers:[{name:"current",url:window.location.origin}]};function TerminalPage(){return jsxRuntimeExports.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntimeExports.jsx(PageHeader,{title:"Terminal",subtitle:"Execute CLI commands directly on the server"}),jsxRuntimeExports.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntimeExports.jsx("div",{className:"h-full bg-black/40 border border-white/[0.08] rounded-xl overflow-hidden",children:jsxRuntimeExports.jsx(CliConfigProvider,{options,children:jsxRuntimeExports.jsx(Cli,{style:{height:"100%"}})})})})]})}function RequireAuth({children:t}){const{user:e,loading:r}=useAuth();return r?jsxRuntimeExports.jsx("div",{className:"min-h-screen flex items-center justify-center text-slate-400",children:"Loading..."}):e?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:t}):jsxRuntimeExports.jsx(Navigate,{to:"/login",replace:!0})}function AppRoutes(){return jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{path:"/login",element:jsxRuntimeExports.jsx(LoginPage,{})}),jsxRuntimeExports.jsxs(Route,{element:jsxRuntimeExports.jsx(RequireAuth,{children:jsxRuntimeExports.jsx(FeaturesProvider,{children:jsxRuntimeExports.jsx(WebSocketProvider,{children:jsxRuntimeExports.jsx(DashboardLayout,{})})})}),children:[jsxRuntimeExports.jsx(Route,{index:!0,element:jsxRuntimeExports.jsx(OverviewPage,{})}),jsxRuntimeExports.jsx(Route,{path:"commands",element:jsxRuntimeExports.jsx(CommandsPage,{})}),jsxRuntimeExports.jsx(Route,{path:"jobs",element:jsxRuntimeExports.jsx(JobsPage,{})}),jsxRuntimeExports.jsx(Route,{path:"jobs/:id",element:jsxRuntimeExports.jsx(JobDetail,{})}),jsxRuntimeExports.jsx(Route,{path:"plugins",element:jsxRuntimeExports.jsx(PluginsPage,{})}),jsxRuntimeExports.jsx(Route,{path:"filesystem",element:jsxRuntimeExports.jsx(FilesystemPage,{})}),jsxRuntimeExports.jsx(Route,{path:"events",element:jsxRuntimeExports.jsx(EventsPage,{})}),jsxRuntimeExports.jsx(Route,{path:"config",element:jsxRuntimeExports.jsx(ConfigPage,{})}),jsxRuntimeExports.jsx(Route,{path:"logs",element:jsxRuntimeExports.jsx(LogsPage,{})}),jsxRuntimeExports.jsx(Route,{path:"terminal",element:jsxRuntimeExports.jsx(TerminalPage,{})})]}),jsxRuntimeExports.jsx(Route,{path:"*",element:jsxRuntimeExports.jsx(Navigate,{to:"/",replace:!0})})]})}function App(){return jsxRuntimeExports.jsx(AuthProvider,{children:jsxRuntimeExports.jsx(AppRoutes,{})})}clientExports.createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(reactExports.StrictMode,{children:jsxRuntimeExports.jsx(BrowserRouter,{basename:"/qcli/admin",children:jsxRuntimeExports.jsx(App,{})})}));