@mmmbuto/nexuscrew 0.7.7 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +153 -25
- package/bin/nexuscrew.js +10 -4
- package/frontend/dist/assets/index-COsoJxXQ.css +32 -0
- package/frontend/dist/assets/index-Dey9rdY-.js +90 -0
- package/frontend/dist/assets/qr-scanner-worker.min-D85Z9gVD.js +98 -0
- package/frontend/dist/index.html +2 -2
- package/frontend/dist/sw.js +29 -0
- package/frontend/dist/version.json +1 -0
- package/lib/auth/middleware.js +7 -1
- package/lib/auth/token.js +31 -1
- package/lib/cli/commands.js +502 -43
- package/lib/cli/doctor.js +160 -0
- package/lib/cli/fleet-service.js +16 -3
- package/lib/cli/init.js +69 -11
- package/lib/cli/path.js +24 -0
- package/lib/cli/service.js +14 -8
- package/lib/cli/url.js +63 -0
- package/lib/config.js +5 -0
- package/lib/decks/routes.js +81 -0
- package/lib/decks/store.js +123 -0
- package/lib/files/routes.js +57 -1
- package/lib/files/store.js +16 -1
- package/lib/fleet/builtin.js +151 -24
- package/lib/fleet/definitions.js +26 -0
- package/lib/fleet/managed.js +381 -0
- package/lib/fleet/routes.js +5 -4
- package/lib/mcp/server.js +381 -0
- package/lib/nodes/commands.js +411 -0
- package/lib/nodes/peering.js +116 -0
- package/lib/nodes/store.js +425 -0
- package/lib/nodes/tunnel-supervisor.js +102 -0
- package/lib/nodes/tunnel.js +315 -0
- package/lib/notify/asks.js +150 -0
- package/lib/notify/events.js +59 -0
- package/lib/notify/notifier.js +37 -0
- package/lib/notify/persist.js +73 -0
- package/lib/notify/push.js +289 -0
- package/lib/notify/routes.js +260 -0
- package/lib/proxy/federation.js +217 -0
- package/lib/proxy/node-proxy.js +305 -0
- package/lib/pty/attach.js +34 -9
- package/lib/pty/provider.js +21 -6
- package/lib/server.js +291 -14
- package/lib/settings/routes.js +685 -0
- package/lib/ws/bridge.js +10 -1
- package/package.json +8 -2
- package/skills/nexuscrew-agent/SKILL.md +83 -0
- package/skills/nexuscrew-agent/bin/nc-deliver +23 -0
- package/skills/nexuscrew-agent/bin/nc-send +48 -0
- package/frontend/dist/assets/index-DUbtTZMj.css +0 -32
- package/frontend/dist/assets/index-EVa9bnAC.js +0 -81
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))n(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const h of a.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&n(h)}).observe(document,{childList:!0,subtree:!0});function r(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(l){if(l.ep)return;l.ep=!0;const a=r(l);fetch(l.href,a)}})();function Gh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fc={exports:{}},ln={},pc={exports:{}},Pe={};/**
|
|
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 tp;function w0(){if(tp)return Pe;tp=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),h=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.iterator;function w(R){return R===null||typeof R!="object"?null:(R=y&&R[y]||R["@@iterator"],typeof R=="function"?R:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,b={};function E(R,Q,ce){this.props=R,this.context=Q,this.refs=b,this.updater=ce||v}E.prototype.isReactComponent={},E.prototype.setState=function(R,Q){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,Q,"setState")},E.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function W(){}W.prototype=E.prototype;function B(R,Q,ce){this.props=R,this.context=Q,this.refs=b,this.updater=ce||v}var $=B.prototype=new W;$.constructor=B,C($,E.prototype),$.isPureReactComponent=!0;var P=Array.isArray,J=Object.prototype.hasOwnProperty,A={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function N(R,Q,ce){var he,pe={},ve=null,we=null;if(Q!=null)for(he in Q.ref!==void 0&&(we=Q.ref),Q.key!==void 0&&(ve=""+Q.key),Q)J.call(Q,he)&&!M.hasOwnProperty(he)&&(pe[he]=Q[he]);var V=arguments.length-2;if(V===1)pe.children=ce;else if(1<V){for(var re=Array(V),ke=0;ke<V;ke++)re[ke]=arguments[ke+2];pe.children=re}if(R&&R.defaultProps)for(he in V=R.defaultProps,V)pe[he]===void 0&&(pe[he]=V[he]);return{$$typeof:e,type:R,key:ve,ref:we,props:pe,_owner:A.current}}function j(R,Q){return{$$typeof:e,type:R.type,key:Q,ref:R.ref,props:R.props,_owner:R._owner}}function I(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function U(R){var Q={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(ce){return Q[ce]})}var H=/\/+/g;function O(R,Q){return typeof R=="object"&&R!==null&&R.key!=null?U(""+R.key):Q.toString(36)}function K(R,Q,ce,he,pe){var ve=typeof R;(ve==="undefined"||ve==="boolean")&&(R=null);var we=!1;if(R===null)we=!0;else switch(ve){case"string":case"number":we=!0;break;case"object":switch(R.$$typeof){case e:case t:we=!0}}if(we)return we=R,pe=pe(we),R=he===""?"."+O(we,0):he,P(pe)?(ce="",R!=null&&(ce=R.replace(H,"$&/")+"/"),K(pe,Q,ce,"",function(ke){return ke})):pe!=null&&(I(pe)&&(pe=j(pe,ce+(!pe.key||we&&we.key===pe.key?"":(""+pe.key).replace(H,"$&/")+"/")+R)),Q.push(pe)),1;if(we=0,he=he===""?".":he+":",P(R))for(var V=0;V<R.length;V++){ve=R[V];var re=he+O(ve,V);we+=K(ve,Q,ce,re,pe)}else if(re=w(R),typeof re=="function")for(R=re.call(R),V=0;!(ve=R.next()).done;)ve=ve.value,re=he+O(ve,V++),we+=K(ve,Q,ce,re,pe);else if(ve==="object")throw Q=String(R),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.");return we}function ee(R,Q,ce){if(R==null)return R;var he=[],pe=0;return K(R,he,"","",function(ve){return Q.call(ce,ve,pe++)}),he}function Z(R){if(R._status===-1){var Q=R._result;Q=Q(),Q.then(function(ce){(R._status===0||R._status===-1)&&(R._status=1,R._result=ce)},function(ce){(R._status===0||R._status===-1)&&(R._status=2,R._result=ce)}),R._status===-1&&(R._status=0,R._result=Q)}if(R._status===1)return R._result.default;throw R._result}var L={current:null},D={transition:null},te={ReactCurrentDispatcher:L,ReactCurrentBatchConfig:D,ReactCurrentOwner:A};function X(){throw Error("act(...) is not supported in production builds of React.")}return Pe.Children={map:ee,forEach:function(R,Q,ce){ee(R,function(){Q.apply(this,arguments)},ce)},count:function(R){var Q=0;return ee(R,function(){Q++}),Q},toArray:function(R){return ee(R,function(Q){return Q})||[]},only:function(R){if(!I(R))throw Error("React.Children.only expected to receive a single React element child.");return R}},Pe.Component=E,Pe.Fragment=r,Pe.Profiler=l,Pe.PureComponent=B,Pe.StrictMode=n,Pe.Suspense=_,Pe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=te,Pe.act=X,Pe.cloneElement=function(R,Q,ce){if(R==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+R+".");var he=C({},R.props),pe=R.key,ve=R.ref,we=R._owner;if(Q!=null){if(Q.ref!==void 0&&(ve=Q.ref,we=A.current),Q.key!==void 0&&(pe=""+Q.key),R.type&&R.type.defaultProps)var V=R.type.defaultProps;for(re in Q)J.call(Q,re)&&!M.hasOwnProperty(re)&&(he[re]=Q[re]===void 0&&V!==void 0?V[re]:Q[re])}var re=arguments.length-2;if(re===1)he.children=ce;else if(1<re){V=Array(re);for(var ke=0;ke<re;ke++)V[ke]=arguments[ke+2];he.children=V}return{$$typeof:e,type:R.type,key:pe,ref:ve,props:he,_owner:we}},Pe.createContext=function(R){return R={$$typeof:h,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},R.Provider={$$typeof:a,_context:R},R.Consumer=R},Pe.createElement=N,Pe.createFactory=function(R){var Q=N.bind(null,R);return Q.type=R,Q},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(R){return{$$typeof:d,render:R}},Pe.isValidElement=I,Pe.lazy=function(R){return{$$typeof:g,_payload:{_status:-1,_result:R},_init:Z}},Pe.memo=function(R,Q){return{$$typeof:p,type:R,compare:Q===void 0?null:Q}},Pe.startTransition=function(R){var Q=D.transition;D.transition={};try{R()}finally{D.transition=Q}},Pe.unstable_act=X,Pe.useCallback=function(R,Q){return L.current.useCallback(R,Q)},Pe.useContext=function(R){return L.current.useContext(R)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(R){return L.current.useDeferredValue(R)},Pe.useEffect=function(R,Q){return L.current.useEffect(R,Q)},Pe.useId=function(){return L.current.useId()},Pe.useImperativeHandle=function(R,Q,ce){return L.current.useImperativeHandle(R,Q,ce)},Pe.useInsertionEffect=function(R,Q){return L.current.useInsertionEffect(R,Q)},Pe.useLayoutEffect=function(R,Q){return L.current.useLayoutEffect(R,Q)},Pe.useMemo=function(R,Q){return L.current.useMemo(R,Q)},Pe.useReducer=function(R,Q,ce){return L.current.useReducer(R,Q,ce)},Pe.useRef=function(R){return L.current.useRef(R)},Pe.useState=function(R){return L.current.useState(R)},Pe.useSyncExternalStore=function(R,Q,ce){return L.current.useSyncExternalStore(R,Q,ce)},Pe.useTransition=function(){return L.current.useTransition()},Pe.version="18.3.1",Pe}var ip;function Qh(){return ip||(ip=1,pc.exports=w0()),pc.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 rp;function C0(){if(rp)return ln;rp=1;var e=Qh(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function h(d,_,p){var g,y={},w=null,v=null;p!==void 0&&(w=""+p),_.key!==void 0&&(w=""+_.key),_.ref!==void 0&&(v=_.ref);for(g in _)n.call(_,g)&&!a.hasOwnProperty(g)&&(y[g]=_[g]);if(d&&d.defaultProps)for(g in _=d.defaultProps,_)y[g]===void 0&&(y[g]=_[g]);return{$$typeof:t,type:d,key:w,ref:v,props:y,_owner:l.current}}return ln.Fragment=r,ln.jsx=h,ln.jsxs=h,ln}var sp;function b0(){return sp||(sp=1,fc.exports=C0()),fc.exports}var f=b0(),z=Qh();const x0=Gh(z);var Ho={},mc={exports:{}},zt={},_c={exports:{}},gc={};/**
|
|
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 np;function k0(){return np||(np=1,(function(e){function t(D,te){var X=D.length;D.push(te);e:for(;0<X;){var R=X-1>>>1,Q=D[R];if(0<l(Q,te))D[R]=te,D[X]=Q,X=R;else break e}}function r(D){return D.length===0?null:D[0]}function n(D){if(D.length===0)return null;var te=D[0],X=D.pop();if(X!==te){D[0]=X;e:for(var R=0,Q=D.length,ce=Q>>>1;R<ce;){var he=2*(R+1)-1,pe=D[he],ve=he+1,we=D[ve];if(0>l(pe,X))ve<Q&&0>l(we,pe)?(D[R]=we,D[ve]=X,R=ve):(D[R]=pe,D[he]=X,R=he);else if(ve<Q&&0>l(we,X))D[R]=we,D[ve]=X,R=ve;else break e}}return te}function l(D,te){var X=D.sortIndex-te.sortIndex;return X!==0?X:D.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var h=Date,d=h.now();e.unstable_now=function(){return h.now()-d}}var _=[],p=[],g=1,y=null,w=3,v=!1,C=!1,b=!1,E=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function $(D){for(var te=r(p);te!==null;){if(te.callback===null)n(p);else if(te.startTime<=D)n(p),te.sortIndex=te.expirationTime,t(_,te);else break;te=r(p)}}function P(D){if(b=!1,$(D),!C)if(r(_)!==null)C=!0,Z(J);else{var te=r(p);te!==null&&L(P,te.startTime-D)}}function J(D,te){C=!1,b&&(b=!1,W(N),N=-1),v=!0;var X=w;try{for($(te),y=r(_);y!==null&&(!(y.expirationTime>te)||D&&!U());){var R=y.callback;if(typeof R=="function"){y.callback=null,w=y.priorityLevel;var Q=R(y.expirationTime<=te);te=e.unstable_now(),typeof Q=="function"?y.callback=Q:y===r(_)&&n(_),$(te)}else n(_);y=r(_)}if(y!==null)var ce=!0;else{var he=r(p);he!==null&&L(P,he.startTime-te),ce=!1}return ce}finally{y=null,w=X,v=!1}}var A=!1,M=null,N=-1,j=5,I=-1;function U(){return!(e.unstable_now()-I<j)}function H(){if(M!==null){var D=e.unstable_now();I=D;var te=!0;try{te=M(!0,D)}finally{te?O():(A=!1,M=null)}}else A=!1}var O;if(typeof B=="function")O=function(){B(H)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,ee=K.port2;K.port1.onmessage=H,O=function(){ee.postMessage(null)}}else O=function(){E(H,0)};function Z(D){M=D,A||(A=!0,O())}function L(D,te){N=E(function(){D(e.unstable_now())},te)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(D){D.callback=null},e.unstable_continueExecution=function(){C||v||(C=!0,Z(J))},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_getFirstCallbackNode=function(){return r(_)},e.unstable_next=function(D){switch(w){case 1:case 2:case 3:var te=3;break;default:te=w}var X=w;w=te;try{return D()}finally{w=X}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(D,te){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var X=w;w=D;try{return te()}finally{w=X}},e.unstable_scheduleCallback=function(D,te,X){var R=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?R+X:R):X=R,D){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=X+Q,D={id:g++,callback:te,priorityLevel:D,startTime:X,expirationTime:Q,sortIndex:-1},X>R?(D.sortIndex=X,t(p,D),r(_)===null&&D===r(p)&&(b?(W(N),N=-1):b=!0,L(P,X-R))):(D.sortIndex=Q,t(_,D),C||v||(C=!0,Z(J))),D},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(D){var te=w;return function(){var X=w;w=te;try{return D.apply(this,arguments)}finally{w=X}}}})(gc)),gc}var op;function E0(){return op||(op=1,_c.exports=k0()),_c.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 lp;function N0(){if(lp)return zt;lp=1;var e=Qh(),t=E0();function r(i){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+i,o=1;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,l={};function a(i,s){h(i,s),h(i+"Capture",s)}function h(i,s){for(l[i]=s,i=0;i<s.length;i++)n.add(s[i])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_=Object.prototype.hasOwnProperty,p=/^[: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]*$/,g={},y={};function w(i){return _.call(y,i)?!0:_.call(g,i)?!1:p.test(i)?y[i]=!0:(g[i]=!0,!1)}function v(i,s,o,c){if(o!==null&&o.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return c?!1:o!==null?!o.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function C(i,s,o,c){if(s===null||typeof s>"u"||v(i,s,o,c))return!0;if(c)return!1;if(o!==null)switch(o.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function b(i,s,o,c,u,m,S){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=c,this.attributeNamespace=u,this.mustUseProperty=o,this.propertyName=i,this.type=s,this.sanitizeURL=m,this.removeEmptyString=S}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){E[i]=new b(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var s=i[0];E[s]=new b(s,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){E[i]=new b(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){E[i]=new b(i,2,!1,i,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(i){E[i]=new b(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){E[i]=new b(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){E[i]=new b(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){E[i]=new b(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){E[i]=new b(i,5,!1,i.toLowerCase(),null,!1,!1)});var W=/[\-:]([a-z])/g;function B(i){return i[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(i){var s=i.replace(W,B);E[s]=new b(s,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var s=i.replace(W,B);E[s]=new b(s,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var s=i.replace(W,B);E[s]=new b(s,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){E[i]=new b(i,1,!1,i.toLowerCase(),null,!1,!1)}),E.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){E[i]=new b(i,1,!1,i.toLowerCase(),null,!0,!0)});function $(i,s,o,c){var u=E.hasOwnProperty(s)?E[s]:null;(u!==null?u.type!==0:c||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(C(s,o,u,c)&&(o=null),c||u===null?w(s)&&(o===null?i.removeAttribute(s):i.setAttribute(s,""+o)):u.mustUseProperty?i[u.propertyName]=o===null?u.type===3?!1:"":o:(s=u.attributeName,c=u.attributeNamespace,o===null?i.removeAttribute(s):(u=u.type,o=u===3||u===4&&o===!0?"":""+o,c?i.setAttributeNS(c,s,o):i.setAttribute(s,o))))}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,J=Symbol.for("react.element"),A=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),U=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),L=Symbol.for("react.offscreen"),D=Symbol.iterator;function te(i){return i===null||typeof i!="object"?null:(i=D&&i[D]||i["@@iterator"],typeof i=="function"?i:null)}var X=Object.assign,R;function Q(i){if(R===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);R=s&&s[1]||""}return`
|
|
34
|
+
`+R+i}var ce=!1;function he(i,s){if(!i||ce)return"";ce=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(G){var c=G}Reflect.construct(i,[],s)}else{try{s.call()}catch(G){c=G}i.call(s.prototype)}else{try{throw Error()}catch(G){c=G}i()}}catch(G){if(G&&c&&typeof G.stack=="string"){for(var u=G.stack.split(`
|
|
35
|
+
`),m=c.stack.split(`
|
|
36
|
+
`),S=u.length-1,k=m.length-1;1<=S&&0<=k&&u[S]!==m[k];)k--;for(;1<=S&&0<=k;S--,k--)if(u[S]!==m[k]){if(S!==1||k!==1)do if(S--,k--,0>k||u[S]!==m[k]){var T=`
|
|
37
|
+
`+u[S].replace(" at new "," at ");return i.displayName&&T.includes("<anonymous>")&&(T=T.replace("<anonymous>",i.displayName)),T}while(1<=S&&0<=k);break}}}finally{ce=!1,Error.prepareStackTrace=o}return(i=i?i.displayName||i.name:"")?Q(i):""}function pe(i){switch(i.tag){case 5:return Q(i.type);case 16:return Q("Lazy");case 13:return Q("Suspense");case 19:return Q("SuspenseList");case 0:case 2:case 15:return i=he(i.type,!1),i;case 11:return i=he(i.type.render,!1),i;case 1:return i=he(i.type,!0),i;default:return""}}function ve(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case M:return"Fragment";case A:return"Portal";case j:return"Profiler";case N:return"StrictMode";case O:return"Suspense";case K:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case U:return(i.displayName||"Context")+".Consumer";case I:return(i._context.displayName||"Context")+".Provider";case H:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ee:return s=i.displayName||null,s!==null?s:ve(i.type)||"Memo";case Z:s=i._payload,i=i._init;try{return ve(i(s))}catch{}}return null}function we(i){var s=i.type;switch(i.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=s.render,i=i.displayName||i.name||"",s.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ve(s);case 8:return s===N?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function V(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function re(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ke(i){var s=re(i)?"checked":"value",o=Object.getOwnPropertyDescriptor(i.constructor.prototype,s),c=""+i[s];if(!i.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,m=o.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return u.call(this)},set:function(S){c=""+S,m.call(this,S)}}),Object.defineProperty(i,s,{enumerable:o.enumerable}),{getValue:function(){return c},setValue:function(S){c=""+S},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function ge(i){i._valueTracker||(i._valueTracker=ke(i))}function Ae(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var o=s.getValue(),c="";return i&&(c=re(i)?i.checked?"true":"false":i.value),i=c,i!==o?(s.setValue(i),!0):!1}function xe(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function Tt(i,s){var o=s.checked;return X({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??i._wrapperState.initialChecked})}function Ri(i,s){var o=s.defaultValue==null?"":s.defaultValue,c=s.checked!=null?s.checked:s.defaultChecked;o=V(s.value!=null?s.value:o),i._wrapperState={initialChecked:c,initialValue:o,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function $i(i,s){s=s.checked,s!=null&&$(i,"checked",s,!1)}function vs(i,s){$i(i,s);var o=V(s.value),c=s.type;if(o!=null)c==="number"?(o===0&&i.value===""||i.value!=o)&&(i.value=""+o):i.value!==""+o&&(i.value=""+o);else if(c==="submit"||c==="reset"){i.removeAttribute("value");return}s.hasOwnProperty("value")?ys(i,s.type,o):s.hasOwnProperty("defaultValue")&&ys(i,s.type,V(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(i.defaultChecked=!!s.defaultChecked)}function Pn(i,s,o){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var c=s.type;if(!(c!=="submit"&&c!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+i._wrapperState.initialValue,o||s===i.value||(i.value=s),i.defaultValue=s}o=i.name,o!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,o!==""&&(i.name=o)}function ys(i,s,o){(s!=="number"||xe(i.ownerDocument)!==i)&&(o==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+o&&(i.defaultValue=""+o))}var _r=Array.isArray;function pi(i,s,o,c){if(i=i.options,s){s={};for(var u=0;u<o.length;u++)s["$"+o[u]]=!0;for(o=0;o<i.length;o++)u=s.hasOwnProperty("$"+i[o].value),i[o].selected!==u&&(i[o].selected=u),u&&c&&(i[o].defaultSelected=!0)}else{for(o=""+V(o),s=null,u=0;u<i.length;u++){if(i[u].value===o){i[u].selected=!0,c&&(i[u].defaultSelected=!0);return}s!==null||i[u].disabled||(s=i[u])}s!==null&&(s.selected=!0)}}function Ss(i,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return X({},s,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function ue(i,s){var o=s.value;if(o==null){if(o=s.children,s=s.defaultValue,o!=null){if(s!=null)throw Error(r(92));if(_r(o)){if(1<o.length)throw Error(r(93));o=o[0]}s=o}s==null&&(s=""),o=s}i._wrapperState={initialValue:V(o)}}function Re(i,s){var o=V(s.value),c=V(s.defaultValue);o!=null&&(o=""+o,o!==i.value&&(i.value=o),s.defaultValue==null&&i.defaultValue!==o&&(i.defaultValue=o)),c!=null&&(i.defaultValue=""+c)}function Mi(i){var s=i.textContent;s===i._wrapperState.initialValue&&s!==""&&s!==null&&(i.value=s)}function ws(i){switch(i){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 xl(i,s){return i==null||i==="http://www.w3.org/1999/xhtml"?ws(s):i==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var Ln,pu=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,o,c,u){MSApp.execUnsafeLocalFunction(function(){return i(s,o,c,u)})}:i})(function(i,s){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=s;else{for(Ln=Ln||document.createElement("div"),Ln.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Ln.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;s.firstChild;)i.appendChild(s.firstChild)}});function Cs(i,s){if(s){var o=i.firstChild;if(o&&o===i.lastChild&&o.nodeType===3){o.nodeValue=s;return}}i.textContent=s}var bs={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},kg=["Webkit","ms","Moz","O"];Object.keys(bs).forEach(function(i){kg.forEach(function(s){s=s+i.charAt(0).toUpperCase()+i.substring(1),bs[s]=bs[i]})});function mu(i,s,o){return s==null||typeof s=="boolean"||s===""?"":o||typeof s!="number"||s===0||bs.hasOwnProperty(i)&&bs[i]?(""+s).trim():s+"px"}function _u(i,s){i=i.style;for(var o in s)if(s.hasOwnProperty(o)){var c=o.indexOf("--")===0,u=mu(o,s[o],c);o==="float"&&(o="cssFloat"),c?i.setProperty(o,u):i[o]=u}}var Eg=X({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 kl(i,s){if(s){if(Eg[i]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,i));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function El(i,s){if(i.indexOf("-")===-1)return typeof s.is=="string";switch(i){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 Nl=null;function Rl(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Ml=null,Hr=null,Wr=null;function gu(i){if(i=Ks(i)){if(typeof Ml!="function")throw Error(r(280));var s=i.stateNode;s&&(s=to(s),Ml(i.stateNode,i.type,s))}}function vu(i){Hr?Wr?Wr.push(i):Wr=[i]:Hr=i}function yu(){if(Hr){var i=Hr,s=Wr;if(Wr=Hr=null,gu(i),s)for(i=0;i<s.length;i++)gu(s[i])}}function Su(i,s){return i(s)}function wu(){}var Dl=!1;function Cu(i,s,o){if(Dl)return i(s,o);Dl=!0;try{return Su(i,s,o)}finally{Dl=!1,(Hr!==null||Wr!==null)&&(wu(),yu())}}function xs(i,s){var o=i.stateNode;if(o===null)return null;var c=to(o);if(c===null)return null;o=c[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(i=i.type,c=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!c;break e;default:i=!1}if(i)return null;if(o&&typeof o!="function")throw Error(r(231,s,typeof o));return o}var Pl=!1;if(d)try{var ks={};Object.defineProperty(ks,"passive",{get:function(){Pl=!0}}),window.addEventListener("test",ks,ks),window.removeEventListener("test",ks,ks)}catch{Pl=!1}function Ng(i,s,o,c,u,m,S,k,T){var G=Array.prototype.slice.call(arguments,3);try{s.apply(o,G)}catch(ne){this.onError(ne)}}var Es=!1,Tn=null,Bn=!1,Ll=null,Rg={onError:function(i){Es=!0,Tn=i}};function Mg(i,s,o,c,u,m,S,k,T){Es=!1,Tn=null,Ng.apply(Rg,arguments)}function Dg(i,s,o,c,u,m,S,k,T){if(Mg.apply(this,arguments),Es){if(Es){var G=Tn;Es=!1,Tn=null}else throw Error(r(198));Bn||(Bn=!0,Ll=G)}}function gr(i){var s=i,o=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(o=s.return),i=s.return;while(i)}return s.tag===3?o:null}function bu(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function xu(i){if(gr(i)!==i)throw Error(r(188))}function Pg(i){var s=i.alternate;if(!s){if(s=gr(i),s===null)throw Error(r(188));return s!==i?null:i}for(var o=i,c=s;;){var u=o.return;if(u===null)break;var m=u.alternate;if(m===null){if(c=u.return,c!==null){o=c;continue}break}if(u.child===m.child){for(m=u.child;m;){if(m===o)return xu(u),i;if(m===c)return xu(u),s;m=m.sibling}throw Error(r(188))}if(o.return!==c.return)o=u,c=m;else{for(var S=!1,k=u.child;k;){if(k===o){S=!0,o=u,c=m;break}if(k===c){S=!0,c=u,o=m;break}k=k.sibling}if(!S){for(k=m.child;k;){if(k===o){S=!0,o=m,c=u;break}if(k===c){S=!0,c=m,o=u;break}k=k.sibling}if(!S)throw Error(r(189))}}if(o.alternate!==c)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?i:s}function ku(i){return i=Pg(i),i!==null?Eu(i):null}function Eu(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var s=Eu(i);if(s!==null)return s;i=i.sibling}return null}var Nu=t.unstable_scheduleCallback,Ru=t.unstable_cancelCallback,Lg=t.unstable_shouldYield,Tg=t.unstable_requestPaint,Ze=t.unstable_now,Bg=t.unstable_getCurrentPriorityLevel,Tl=t.unstable_ImmediatePriority,Mu=t.unstable_UserBlockingPriority,An=t.unstable_NormalPriority,Ag=t.unstable_LowPriority,Du=t.unstable_IdlePriority,jn=null,mi=null;function jg(i){if(mi&&typeof mi.onCommitFiberRoot=="function")try{mi.onCommitFiberRoot(jn,i,void 0,(i.current.flags&128)===128)}catch{}}var oi=Math.clz32?Math.clz32:zg,Og=Math.log,Ig=Math.LN2;function zg(i){return i>>>=0,i===0?32:31-(Og(i)/Ig|0)|0}var On=64,In=4194304;function Ns(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function zn(i,s){var o=i.pendingLanes;if(o===0)return 0;var c=0,u=i.suspendedLanes,m=i.pingedLanes,S=o&268435455;if(S!==0){var k=S&~u;k!==0?c=Ns(k):(m&=S,m!==0&&(c=Ns(m)))}else S=o&~u,S!==0?c=Ns(S):m!==0&&(c=Ns(m));if(c===0)return 0;if(s!==0&&s!==c&&(s&u)===0&&(u=c&-c,m=s&-s,u>=m||u===16&&(m&4194240)!==0))return s;if((c&4)!==0&&(c|=o&16),s=i.entangledLanes,s!==0)for(i=i.entanglements,s&=c;0<s;)o=31-oi(s),u=1<<o,c|=i[o],s&=~u;return c}function Fg(i,s){switch(i){case 1:case 2:case 4:return s+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 s+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 Hg(i,s){for(var o=i.suspendedLanes,c=i.pingedLanes,u=i.expirationTimes,m=i.pendingLanes;0<m;){var S=31-oi(m),k=1<<S,T=u[S];T===-1?((k&o)===0||(k&c)!==0)&&(u[S]=Fg(k,s)):T<=s&&(i.expiredLanes|=k),m&=~k}}function Bl(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function Pu(){var i=On;return On<<=1,(On&4194240)===0&&(On=64),i}function Al(i){for(var s=[],o=0;31>o;o++)s.push(i);return s}function Rs(i,s,o){i.pendingLanes|=s,s!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,s=31-oi(s),i[s]=o}function Wg(i,s){var o=i.pendingLanes&~s;i.pendingLanes=s,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=s,i.mutableReadLanes&=s,i.entangledLanes&=s,s=i.entanglements;var c=i.eventTimes;for(i=i.expirationTimes;0<o;){var u=31-oi(o),m=1<<u;s[u]=0,c[u]=-1,i[u]=-1,o&=~m}}function jl(i,s){var o=i.entangledLanes|=s;for(i=i.entanglements;o;){var c=31-oi(o),u=1<<c;u&s|i[c]&s&&(i[c]|=s),o&=~u}}var Oe=0;function Lu(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var Tu,Ol,Bu,Au,ju,Il=!1,Fn=[],Ui=null,Ki=null,Vi=null,Ms=new Map,Ds=new Map,qi=[],$g="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 Ou(i,s){switch(i){case"focusin":case"focusout":Ui=null;break;case"dragenter":case"dragleave":Ki=null;break;case"mouseover":case"mouseout":Vi=null;break;case"pointerover":case"pointerout":Ms.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ds.delete(s.pointerId)}}function Ps(i,s,o,c,u,m){return i===null||i.nativeEvent!==m?(i={blockedOn:s,domEventName:o,eventSystemFlags:c,nativeEvent:m,targetContainers:[u]},s!==null&&(s=Ks(s),s!==null&&Ol(s)),i):(i.eventSystemFlags|=c,s=i.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),i)}function Ug(i,s,o,c,u){switch(s){case"focusin":return Ui=Ps(Ui,i,s,o,c,u),!0;case"dragenter":return Ki=Ps(Ki,i,s,o,c,u),!0;case"mouseover":return Vi=Ps(Vi,i,s,o,c,u),!0;case"pointerover":var m=u.pointerId;return Ms.set(m,Ps(Ms.get(m)||null,i,s,o,c,u)),!0;case"gotpointercapture":return m=u.pointerId,Ds.set(m,Ps(Ds.get(m)||null,i,s,o,c,u)),!0}return!1}function Iu(i){var s=vr(i.target);if(s!==null){var o=gr(s);if(o!==null){if(s=o.tag,s===13){if(s=bu(o),s!==null){i.blockedOn=s,ju(i.priority,function(){Bu(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){i.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Hn(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var o=Fl(i.domEventName,i.eventSystemFlags,s[0],i.nativeEvent);if(o===null){o=i.nativeEvent;var c=new o.constructor(o.type,o);Nl=c,o.target.dispatchEvent(c),Nl=null}else return s=Ks(o),s!==null&&Ol(s),i.blockedOn=o,!1;s.shift()}return!0}function zu(i,s,o){Hn(i)&&o.delete(s)}function Kg(){Il=!1,Ui!==null&&Hn(Ui)&&(Ui=null),Ki!==null&&Hn(Ki)&&(Ki=null),Vi!==null&&Hn(Vi)&&(Vi=null),Ms.forEach(zu),Ds.forEach(zu)}function Ls(i,s){i.blockedOn===s&&(i.blockedOn=null,Il||(Il=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Kg)))}function Ts(i){function s(u){return Ls(u,i)}if(0<Fn.length){Ls(Fn[0],i);for(var o=1;o<Fn.length;o++){var c=Fn[o];c.blockedOn===i&&(c.blockedOn=null)}}for(Ui!==null&&Ls(Ui,i),Ki!==null&&Ls(Ki,i),Vi!==null&&Ls(Vi,i),Ms.forEach(s),Ds.forEach(s),o=0;o<qi.length;o++)c=qi[o],c.blockedOn===i&&(c.blockedOn=null);for(;0<qi.length&&(o=qi[0],o.blockedOn===null);)Iu(o),o.blockedOn===null&&qi.shift()}var $r=P.ReactCurrentBatchConfig,Wn=!0;function Vg(i,s,o,c){var u=Oe,m=$r.transition;$r.transition=null;try{Oe=1,zl(i,s,o,c)}finally{Oe=u,$r.transition=m}}function qg(i,s,o,c){var u=Oe,m=$r.transition;$r.transition=null;try{Oe=4,zl(i,s,o,c)}finally{Oe=u,$r.transition=m}}function zl(i,s,o,c){if(Wn){var u=Fl(i,s,o,c);if(u===null)ra(i,s,c,$n,o),Ou(i,c);else if(Ug(u,i,s,o,c))c.stopPropagation();else if(Ou(i,c),s&4&&-1<$g.indexOf(i)){for(;u!==null;){var m=Ks(u);if(m!==null&&Tu(m),m=Fl(i,s,o,c),m===null&&ra(i,s,c,$n,o),m===u)break;u=m}u!==null&&c.stopPropagation()}else ra(i,s,c,null,o)}}var $n=null;function Fl(i,s,o,c){if($n=null,i=Rl(c),i=vr(i),i!==null)if(s=gr(i),s===null)i=null;else if(o=s.tag,o===13){if(i=bu(s),i!==null)return i;i=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null);return $n=i,null}function Fu(i){switch(i){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(Bg()){case Tl:return 1;case Mu:return 4;case An:case Ag:return 16;case Du:return 536870912;default:return 16}default:return 16}}var Yi=null,Hl=null,Un=null;function Hu(){if(Un)return Un;var i,s=Hl,o=s.length,c,u="value"in Yi?Yi.value:Yi.textContent,m=u.length;for(i=0;i<o&&s[i]===u[i];i++);var S=o-i;for(c=1;c<=S&&s[o-c]===u[m-c];c++);return Un=u.slice(i,1<c?1-c:void 0)}function Kn(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function Vn(){return!0}function Wu(){return!1}function $t(i){function s(o,c,u,m,S){this._reactName=o,this._targetInst=u,this.type=c,this.nativeEvent=m,this.target=S,this.currentTarget=null;for(var k in i)i.hasOwnProperty(k)&&(o=i[k],this[k]=o?o(m):m[k]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?Vn:Wu,this.isPropagationStopped=Wu,this}return X(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Vn)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Vn)},persist:function(){},isPersistent:Vn}),s}var Ur={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wl=$t(Ur),Bs=X({},Ur,{view:0,detail:0}),Yg=$t(Bs),$l,Ul,As,qn=X({},Bs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vl,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==As&&(As&&i.type==="mousemove"?($l=i.screenX-As.screenX,Ul=i.screenY-As.screenY):Ul=$l=0,As=i),$l)},movementY:function(i){return"movementY"in i?i.movementY:Ul}}),$u=$t(qn),Xg=X({},qn,{dataTransfer:0}),Gg=$t(Xg),Qg=X({},Bs,{relatedTarget:0}),Kl=$t(Qg),Jg=X({},Ur,{animationName:0,elapsedTime:0,pseudoElement:0}),Zg=$t(Jg),ev=X({},Ur,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),tv=$t(ev),iv=X({},Ur,{data:0}),Uu=$t(iv),rv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sv={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"},nv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ov(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=nv[i])?!!s[i]:!1}function Vl(){return ov}var lv=X({},Bs,{key:function(i){if(i.key){var s=rv[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Kn(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?sv[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vl,charCode:function(i){return i.type==="keypress"?Kn(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Kn(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),av=$t(lv),cv=X({},qn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ku=$t(cv),hv=X({},Bs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vl}),uv=$t(hv),dv=X({},Ur,{propertyName:0,elapsedTime:0,pseudoElement:0}),fv=$t(dv),pv=X({},qn,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),mv=$t(pv),_v=[9,13,27,32],ql=d&&"CompositionEvent"in window,js=null;d&&"documentMode"in document&&(js=document.documentMode);var gv=d&&"TextEvent"in window&&!js,Vu=d&&(!ql||js&&8<js&&11>=js),qu=" ",Yu=!1;function Xu(i,s){switch(i){case"keyup":return _v.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gu(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Kr=!1;function vv(i,s){switch(i){case"compositionend":return Gu(s);case"keypress":return s.which!==32?null:(Yu=!0,qu);case"textInput":return i=s.data,i===qu&&Yu?null:i;default:return null}}function yv(i,s){if(Kr)return i==="compositionend"||!ql&&Xu(i,s)?(i=Hu(),Un=Hl=Yi=null,Kr=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Vu&&s.locale!=="ko"?null:s.data;default:return null}}var Sv={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 Qu(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!Sv[i.type]:s==="textarea"}function Ju(i,s,o,c){vu(c),s=Jn(s,"onChange"),0<s.length&&(o=new Wl("onChange","change",null,o,c),i.push({event:o,listeners:s}))}var Os=null,Is=null;function wv(i){_d(i,0)}function Yn(i){var s=Gr(i);if(Ae(s))return i}function Cv(i,s){if(i==="change")return s}var Zu=!1;if(d){var Yl;if(d){var Xl="oninput"in document;if(!Xl){var ed=document.createElement("div");ed.setAttribute("oninput","return;"),Xl=typeof ed.oninput=="function"}Yl=Xl}else Yl=!1;Zu=Yl&&(!document.documentMode||9<document.documentMode)}function td(){Os&&(Os.detachEvent("onpropertychange",id),Is=Os=null)}function id(i){if(i.propertyName==="value"&&Yn(Is)){var s=[];Ju(s,Is,i,Rl(i)),Cu(wv,s)}}function bv(i,s,o){i==="focusin"?(td(),Os=s,Is=o,Os.attachEvent("onpropertychange",id)):i==="focusout"&&td()}function xv(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Yn(Is)}function kv(i,s){if(i==="click")return Yn(s)}function Ev(i,s){if(i==="input"||i==="change")return Yn(s)}function Nv(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var li=typeof Object.is=="function"?Object.is:Nv;function zs(i,s){if(li(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var o=Object.keys(i),c=Object.keys(s);if(o.length!==c.length)return!1;for(c=0;c<o.length;c++){var u=o[c];if(!_.call(s,u)||!li(i[u],s[u]))return!1}return!0}function rd(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function sd(i,s){var o=rd(i);i=0;for(var c;o;){if(o.nodeType===3){if(c=i+o.textContent.length,i<=s&&c>=s)return{node:o,offset:s-i};i=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=rd(o)}}function nd(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?nd(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function od(){for(var i=window,s=xe();s instanceof i.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)i=s.contentWindow;else break;s=xe(i.document)}return s}function Gl(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}function Rv(i){var s=od(),o=i.focusedElem,c=i.selectionRange;if(s!==o&&o&&o.ownerDocument&&nd(o.ownerDocument.documentElement,o)){if(c!==null&&Gl(o)){if(s=c.start,i=c.end,i===void 0&&(i=s),"selectionStart"in o)o.selectionStart=s,o.selectionEnd=Math.min(i,o.value.length);else if(i=(s=o.ownerDocument||document)&&s.defaultView||window,i.getSelection){i=i.getSelection();var u=o.textContent.length,m=Math.min(c.start,u);c=c.end===void 0?m:Math.min(c.end,u),!i.extend&&m>c&&(u=c,c=m,m=u),u=sd(o,m);var S=sd(o,c);u&&S&&(i.rangeCount!==1||i.anchorNode!==u.node||i.anchorOffset!==u.offset||i.focusNode!==S.node||i.focusOffset!==S.offset)&&(s=s.createRange(),s.setStart(u.node,u.offset),i.removeAllRanges(),m>c?(i.addRange(s),i.extend(S.node,S.offset)):(s.setEnd(S.node,S.offset),i.addRange(s)))}}for(s=[],i=o;i=i.parentNode;)i.nodeType===1&&s.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<s.length;o++)i=s[o],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var Mv=d&&"documentMode"in document&&11>=document.documentMode,Vr=null,Ql=null,Fs=null,Jl=!1;function ld(i,s,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Jl||Vr==null||Vr!==xe(c)||(c=Vr,"selectionStart"in c&&Gl(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Fs&&zs(Fs,c)||(Fs=c,c=Jn(Ql,"onSelect"),0<c.length&&(s=new Wl("onSelect","select",null,s,o),i.push({event:s,listeners:c}),s.target=Vr)))}function Xn(i,s){var o={};return o[i.toLowerCase()]=s.toLowerCase(),o["Webkit"+i]="webkit"+s,o["Moz"+i]="moz"+s,o}var qr={animationend:Xn("Animation","AnimationEnd"),animationiteration:Xn("Animation","AnimationIteration"),animationstart:Xn("Animation","AnimationStart"),transitionend:Xn("Transition","TransitionEnd")},Zl={},ad={};d&&(ad=document.createElement("div").style,"AnimationEvent"in window||(delete qr.animationend.animation,delete qr.animationiteration.animation,delete qr.animationstart.animation),"TransitionEvent"in window||delete qr.transitionend.transition);function Gn(i){if(Zl[i])return Zl[i];if(!qr[i])return i;var s=qr[i],o;for(o in s)if(s.hasOwnProperty(o)&&o in ad)return Zl[i]=s[o];return i}var cd=Gn("animationend"),hd=Gn("animationiteration"),ud=Gn("animationstart"),dd=Gn("transitionend"),fd=new Map,pd="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 Xi(i,s){fd.set(i,s),a(s,[i])}for(var ea=0;ea<pd.length;ea++){var ta=pd[ea],Dv=ta.toLowerCase(),Pv=ta[0].toUpperCase()+ta.slice(1);Xi(Dv,"on"+Pv)}Xi(cd,"onAnimationEnd"),Xi(hd,"onAnimationIteration"),Xi(ud,"onAnimationStart"),Xi("dblclick","onDoubleClick"),Xi("focusin","onFocus"),Xi("focusout","onBlur"),Xi(dd,"onTransitionEnd"),h("onMouseEnter",["mouseout","mouseover"]),h("onMouseLeave",["mouseout","mouseover"]),h("onPointerEnter",["pointerout","pointerover"]),h("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hs="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(" "),Lv=new Set("cancel close invalid load scroll toggle".split(" ").concat(Hs));function md(i,s,o){var c=i.type||"unknown-event";i.currentTarget=o,Dg(c,s,void 0,i),i.currentTarget=null}function _d(i,s){s=(s&4)!==0;for(var o=0;o<i.length;o++){var c=i[o],u=c.event;c=c.listeners;e:{var m=void 0;if(s)for(var S=c.length-1;0<=S;S--){var k=c[S],T=k.instance,G=k.currentTarget;if(k=k.listener,T!==m&&u.isPropagationStopped())break e;md(u,k,G),m=T}else for(S=0;S<c.length;S++){if(k=c[S],T=k.instance,G=k.currentTarget,k=k.listener,T!==m&&u.isPropagationStopped())break e;md(u,k,G),m=T}}}if(Bn)throw i=Ll,Bn=!1,Ll=null,i}function He(i,s){var o=s[ca];o===void 0&&(o=s[ca]=new Set);var c=i+"__bubble";o.has(c)||(gd(s,i,2,!1),o.add(c))}function ia(i,s,o){var c=0;s&&(c|=4),gd(o,i,c,s)}var Qn="_reactListening"+Math.random().toString(36).slice(2);function Ws(i){if(!i[Qn]){i[Qn]=!0,n.forEach(function(o){o!=="selectionchange"&&(Lv.has(o)||ia(o,!1,i),ia(o,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Qn]||(s[Qn]=!0,ia("selectionchange",!1,s))}}function gd(i,s,o,c){switch(Fu(s)){case 1:var u=Vg;break;case 4:u=qg;break;default:u=zl}o=u.bind(null,s,o,i),u=void 0,!Pl||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(u=!0),c?u!==void 0?i.addEventListener(s,o,{capture:!0,passive:u}):i.addEventListener(s,o,!0):u!==void 0?i.addEventListener(s,o,{passive:u}):i.addEventListener(s,o,!1)}function ra(i,s,o,c,u){var m=c;if((s&1)===0&&(s&2)===0&&c!==null)e:for(;;){if(c===null)return;var S=c.tag;if(S===3||S===4){var k=c.stateNode.containerInfo;if(k===u||k.nodeType===8&&k.parentNode===u)break;if(S===4)for(S=c.return;S!==null;){var T=S.tag;if((T===3||T===4)&&(T=S.stateNode.containerInfo,T===u||T.nodeType===8&&T.parentNode===u))return;S=S.return}for(;k!==null;){if(S=vr(k),S===null)return;if(T=S.tag,T===5||T===6){c=m=S;continue e}k=k.parentNode}}c=c.return}Cu(function(){var G=m,ne=Rl(o),oe=[];e:{var se=fd.get(i);if(se!==void 0){var fe=Wl,_e=i;switch(i){case"keypress":if(Kn(o)===0)break e;case"keydown":case"keyup":fe=av;break;case"focusin":_e="focus",fe=Kl;break;case"focusout":_e="blur",fe=Kl;break;case"beforeblur":case"afterblur":fe=Kl;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=$u;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=Gg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=uv;break;case cd:case hd:case ud:fe=Zg;break;case dd:fe=fv;break;case"scroll":fe=Yg;break;case"wheel":fe=mv;break;case"copy":case"cut":case"paste":fe=tv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=Ku}var ye=(s&4)!==0,et=!ye&&i==="scroll",q=ye?se!==null?se+"Capture":null:se;ye=[];for(var F=G,Y;F!==null;){Y=F;var le=Y.stateNode;if(Y.tag===5&&le!==null&&(Y=le,q!==null&&(le=xs(F,q),le!=null&&ye.push($s(F,le,Y)))),et)break;F=F.return}0<ye.length&&(se=new fe(se,_e,null,o,ne),oe.push({event:se,listeners:ye}))}}if((s&7)===0){e:{if(se=i==="mouseover"||i==="pointerover",fe=i==="mouseout"||i==="pointerout",se&&o!==Nl&&(_e=o.relatedTarget||o.fromElement)&&(vr(_e)||_e[Di]))break e;if((fe||se)&&(se=ne.window===ne?ne:(se=ne.ownerDocument)?se.defaultView||se.parentWindow:window,fe?(_e=o.relatedTarget||o.toElement,fe=G,_e=_e?vr(_e):null,_e!==null&&(et=gr(_e),_e!==et||_e.tag!==5&&_e.tag!==6)&&(_e=null)):(fe=null,_e=G),fe!==_e)){if(ye=$u,le="onMouseLeave",q="onMouseEnter",F="mouse",(i==="pointerout"||i==="pointerover")&&(ye=Ku,le="onPointerLeave",q="onPointerEnter",F="pointer"),et=fe==null?se:Gr(fe),Y=_e==null?se:Gr(_e),se=new ye(le,F+"leave",fe,o,ne),se.target=et,se.relatedTarget=Y,le=null,vr(ne)===G&&(ye=new ye(q,F+"enter",_e,o,ne),ye.target=Y,ye.relatedTarget=et,le=ye),et=le,fe&&_e)t:{for(ye=fe,q=_e,F=0,Y=ye;Y;Y=Yr(Y))F++;for(Y=0,le=q;le;le=Yr(le))Y++;for(;0<F-Y;)ye=Yr(ye),F--;for(;0<Y-F;)q=Yr(q),Y--;for(;F--;){if(ye===q||q!==null&&ye===q.alternate)break t;ye=Yr(ye),q=Yr(q)}ye=null}else ye=null;fe!==null&&vd(oe,se,fe,ye,!1),_e!==null&&et!==null&&vd(oe,et,_e,ye,!0)}}e:{if(se=G?Gr(G):window,fe=se.nodeName&&se.nodeName.toLowerCase(),fe==="select"||fe==="input"&&se.type==="file")var Se=Cv;else if(Qu(se))if(Zu)Se=Ev;else{Se=xv;var Ce=bv}else(fe=se.nodeName)&&fe.toLowerCase()==="input"&&(se.type==="checkbox"||se.type==="radio")&&(Se=kv);if(Se&&(Se=Se(i,G))){Ju(oe,Se,o,ne);break e}Ce&&Ce(i,se,G),i==="focusout"&&(Ce=se._wrapperState)&&Ce.controlled&&se.type==="number"&&ys(se,"number",se.value)}switch(Ce=G?Gr(G):window,i){case"focusin":(Qu(Ce)||Ce.contentEditable==="true")&&(Vr=Ce,Ql=G,Fs=null);break;case"focusout":Fs=Ql=Vr=null;break;case"mousedown":Jl=!0;break;case"contextmenu":case"mouseup":case"dragend":Jl=!1,ld(oe,o,ne);break;case"selectionchange":if(Mv)break;case"keydown":case"keyup":ld(oe,o,ne)}var be;if(ql)e:{switch(i){case"compositionstart":var Ee="onCompositionStart";break e;case"compositionend":Ee="onCompositionEnd";break e;case"compositionupdate":Ee="onCompositionUpdate";break e}Ee=void 0}else Kr?Xu(i,o)&&(Ee="onCompositionEnd"):i==="keydown"&&o.keyCode===229&&(Ee="onCompositionStart");Ee&&(Vu&&o.locale!=="ko"&&(Kr||Ee!=="onCompositionStart"?Ee==="onCompositionEnd"&&Kr&&(be=Hu()):(Yi=ne,Hl="value"in Yi?Yi.value:Yi.textContent,Kr=!0)),Ce=Jn(G,Ee),0<Ce.length&&(Ee=new Uu(Ee,i,null,o,ne),oe.push({event:Ee,listeners:Ce}),be?Ee.data=be:(be=Gu(o),be!==null&&(Ee.data=be)))),(be=gv?vv(i,o):yv(i,o))&&(G=Jn(G,"onBeforeInput"),0<G.length&&(ne=new Uu("onBeforeInput","beforeinput",null,o,ne),oe.push({event:ne,listeners:G}),ne.data=be))}_d(oe,s)})}function $s(i,s,o){return{instance:i,listener:s,currentTarget:o}}function Jn(i,s){for(var o=s+"Capture",c=[];i!==null;){var u=i,m=u.stateNode;u.tag===5&&m!==null&&(u=m,m=xs(i,o),m!=null&&c.unshift($s(i,m,u)),m=xs(i,s),m!=null&&c.push($s(i,m,u))),i=i.return}return c}function Yr(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function vd(i,s,o,c,u){for(var m=s._reactName,S=[];o!==null&&o!==c;){var k=o,T=k.alternate,G=k.stateNode;if(T!==null&&T===c)break;k.tag===5&&G!==null&&(k=G,u?(T=xs(o,m),T!=null&&S.unshift($s(o,T,k))):u||(T=xs(o,m),T!=null&&S.push($s(o,T,k)))),o=o.return}S.length!==0&&i.push({event:s,listeners:S})}var Tv=/\r\n?/g,Bv=/\u0000|\uFFFD/g;function yd(i){return(typeof i=="string"?i:""+i).replace(Tv,`
|
|
38
|
+
`).replace(Bv,"")}function Zn(i,s,o){if(s=yd(s),yd(i)!==s&&o)throw Error(r(425))}function eo(){}var sa=null,na=null;function oa(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var la=typeof setTimeout=="function"?setTimeout:void 0,Av=typeof clearTimeout=="function"?clearTimeout:void 0,Sd=typeof Promise=="function"?Promise:void 0,jv=typeof queueMicrotask=="function"?queueMicrotask:typeof Sd<"u"?function(i){return Sd.resolve(null).then(i).catch(Ov)}:la;function Ov(i){setTimeout(function(){throw i})}function aa(i,s){var o=s,c=0;do{var u=o.nextSibling;if(i.removeChild(o),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(c===0){i.removeChild(u),Ts(s);return}c--}else o!=="$"&&o!=="$?"&&o!=="$!"||c++;o=u}while(o);Ts(s)}function Gi(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return i}function wd(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var o=i.data;if(o==="$"||o==="$!"||o==="$?"){if(s===0)return i;s--}else o==="/$"&&s++}i=i.previousSibling}return null}var Xr=Math.random().toString(36).slice(2),_i="__reactFiber$"+Xr,Us="__reactProps$"+Xr,Di="__reactContainer$"+Xr,ca="__reactEvents$"+Xr,Iv="__reactListeners$"+Xr,zv="__reactHandles$"+Xr;function vr(i){var s=i[_i];if(s)return s;for(var o=i.parentNode;o;){if(s=o[Di]||o[_i]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(i=wd(i);i!==null;){if(o=i[_i])return o;i=wd(i)}return s}i=o,o=i.parentNode}return null}function Ks(i){return i=i[_i]||i[Di],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function Gr(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(r(33))}function to(i){return i[Us]||null}var ha=[],Qr=-1;function Qi(i){return{current:i}}function We(i){0>Qr||(i.current=ha[Qr],ha[Qr]=null,Qr--)}function Fe(i,s){Qr++,ha[Qr]=i.current,i.current=s}var Ji={},bt=Qi(Ji),Bt=Qi(!1),yr=Ji;function Jr(i,s){var o=i.type.contextTypes;if(!o)return Ji;var c=i.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===s)return c.__reactInternalMemoizedMaskedChildContext;var u={},m;for(m in o)u[m]=s[m];return c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=s,i.__reactInternalMemoizedMaskedChildContext=u),u}function At(i){return i=i.childContextTypes,i!=null}function io(){We(Bt),We(bt)}function Cd(i,s,o){if(bt.current!==Ji)throw Error(r(168));Fe(bt,s),Fe(Bt,o)}function bd(i,s,o){var c=i.stateNode;if(s=s.childContextTypes,typeof c.getChildContext!="function")return o;c=c.getChildContext();for(var u in c)if(!(u in s))throw Error(r(108,we(i)||"Unknown",u));return X({},o,c)}function ro(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Ji,yr=bt.current,Fe(bt,i),Fe(Bt,Bt.current),!0}function xd(i,s,o){var c=i.stateNode;if(!c)throw Error(r(169));o?(i=bd(i,s,yr),c.__reactInternalMemoizedMergedChildContext=i,We(Bt),We(bt),Fe(bt,i)):We(Bt),Fe(Bt,o)}var Pi=null,so=!1,ua=!1;function kd(i){Pi===null?Pi=[i]:Pi.push(i)}function Fv(i){so=!0,kd(i)}function Zi(){if(!ua&&Pi!==null){ua=!0;var i=0,s=Oe;try{var o=Pi;for(Oe=1;i<o.length;i++){var c=o[i];do c=c(!0);while(c!==null)}Pi=null,so=!1}catch(u){throw Pi!==null&&(Pi=Pi.slice(i+1)),Nu(Tl,Zi),u}finally{Oe=s,ua=!1}}return null}var Zr=[],es=0,no=null,oo=0,Gt=[],Qt=0,Sr=null,Li=1,Ti="";function wr(i,s){Zr[es++]=oo,Zr[es++]=no,no=i,oo=s}function Ed(i,s,o){Gt[Qt++]=Li,Gt[Qt++]=Ti,Gt[Qt++]=Sr,Sr=i;var c=Li;i=Ti;var u=32-oi(c)-1;c&=~(1<<u),o+=1;var m=32-oi(s)+u;if(30<m){var S=u-u%5;m=(c&(1<<S)-1).toString(32),c>>=S,u-=S,Li=1<<32-oi(s)+u|o<<u|c,Ti=m+i}else Li=1<<m|o<<u|c,Ti=i}function da(i){i.return!==null&&(wr(i,1),Ed(i,1,0))}function fa(i){for(;i===no;)no=Zr[--es],Zr[es]=null,oo=Zr[--es],Zr[es]=null;for(;i===Sr;)Sr=Gt[--Qt],Gt[Qt]=null,Ti=Gt[--Qt],Gt[Qt]=null,Li=Gt[--Qt],Gt[Qt]=null}var Ut=null,Kt=null,Ue=!1,ai=null;function Nd(i,s){var o=ti(5,null,null,0);o.elementType="DELETED",o.stateNode=s,o.return=i,s=i.deletions,s===null?(i.deletions=[o],i.flags|=16):s.push(o)}function Rd(i,s){switch(i.tag){case 5:var o=i.type;return s=s.nodeType!==1||o.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(i.stateNode=s,Ut=i,Kt=Gi(s.firstChild),!0):!1;case 6:return s=i.pendingProps===""||s.nodeType!==3?null:s,s!==null?(i.stateNode=s,Ut=i,Kt=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(o=Sr!==null?{id:Li,overflow:Ti}:null,i.memoizedState={dehydrated:s,treeContext:o,retryLane:1073741824},o=ti(18,null,null,0),o.stateNode=s,o.return=i,i.child=o,Ut=i,Kt=null,!0):!1;default:return!1}}function pa(i){return(i.mode&1)!==0&&(i.flags&128)===0}function ma(i){if(Ue){var s=Kt;if(s){var o=s;if(!Rd(i,s)){if(pa(i))throw Error(r(418));s=Gi(o.nextSibling);var c=Ut;s&&Rd(i,s)?Nd(c,o):(i.flags=i.flags&-4097|2,Ue=!1,Ut=i)}}else{if(pa(i))throw Error(r(418));i.flags=i.flags&-4097|2,Ue=!1,Ut=i}}}function Md(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;Ut=i}function lo(i){if(i!==Ut)return!1;if(!Ue)return Md(i),Ue=!0,!1;var s;if((s=i.tag!==3)&&!(s=i.tag!==5)&&(s=i.type,s=s!=="head"&&s!=="body"&&!oa(i.type,i.memoizedProps)),s&&(s=Kt)){if(pa(i))throw Dd(),Error(r(418));for(;s;)Nd(i,s),s=Gi(s.nextSibling)}if(Md(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));e:{for(i=i.nextSibling,s=0;i;){if(i.nodeType===8){var o=i.data;if(o==="/$"){if(s===0){Kt=Gi(i.nextSibling);break e}s--}else o!=="$"&&o!=="$!"&&o!=="$?"||s++}i=i.nextSibling}Kt=null}}else Kt=Ut?Gi(i.stateNode.nextSibling):null;return!0}function Dd(){for(var i=Kt;i;)i=Gi(i.nextSibling)}function ts(){Kt=Ut=null,Ue=!1}function _a(i){ai===null?ai=[i]:ai.push(i)}var Hv=P.ReactCurrentBatchConfig;function Vs(i,s,o){if(i=o.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(o._owner){if(o=o._owner,o){if(o.tag!==1)throw Error(r(309));var c=o.stateNode}if(!c)throw Error(r(147,i));var u=c,m=""+i;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===m?s.ref:(s=function(S){var k=u.refs;S===null?delete k[m]:k[m]=S},s._stringRef=m,s)}if(typeof i!="string")throw Error(r(284));if(!o._owner)throw Error(r(290,i))}return i}function ao(i,s){throw i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i))}function Pd(i){var s=i._init;return s(i._payload)}function Ld(i){function s(q,F){if(i){var Y=q.deletions;Y===null?(q.deletions=[F],q.flags|=16):Y.push(F)}}function o(q,F){if(!i)return null;for(;F!==null;)s(q,F),F=F.sibling;return null}function c(q,F){for(q=new Map;F!==null;)F.key!==null?q.set(F.key,F):q.set(F.index,F),F=F.sibling;return q}function u(q,F){return q=lr(q,F),q.index=0,q.sibling=null,q}function m(q,F,Y){return q.index=Y,i?(Y=q.alternate,Y!==null?(Y=Y.index,Y<F?(q.flags|=2,F):Y):(q.flags|=2,F)):(q.flags|=1048576,F)}function S(q){return i&&q.alternate===null&&(q.flags|=2),q}function k(q,F,Y,le){return F===null||F.tag!==6?(F=lc(Y,q.mode,le),F.return=q,F):(F=u(F,Y),F.return=q,F)}function T(q,F,Y,le){var Se=Y.type;return Se===M?ne(q,F,Y.props.children,le,Y.key):F!==null&&(F.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===Z&&Pd(Se)===F.type)?(le=u(F,Y.props),le.ref=Vs(q,F,Y),le.return=q,le):(le=To(Y.type,Y.key,Y.props,null,q.mode,le),le.ref=Vs(q,F,Y),le.return=q,le)}function G(q,F,Y,le){return F===null||F.tag!==4||F.stateNode.containerInfo!==Y.containerInfo||F.stateNode.implementation!==Y.implementation?(F=ac(Y,q.mode,le),F.return=q,F):(F=u(F,Y.children||[]),F.return=q,F)}function ne(q,F,Y,le,Se){return F===null||F.tag!==7?(F=Mr(Y,q.mode,le,Se),F.return=q,F):(F=u(F,Y),F.return=q,F)}function oe(q,F,Y){if(typeof F=="string"&&F!==""||typeof F=="number")return F=lc(""+F,q.mode,Y),F.return=q,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case J:return Y=To(F.type,F.key,F.props,null,q.mode,Y),Y.ref=Vs(q,null,F),Y.return=q,Y;case A:return F=ac(F,q.mode,Y),F.return=q,F;case Z:var le=F._init;return oe(q,le(F._payload),Y)}if(_r(F)||te(F))return F=Mr(F,q.mode,Y,null),F.return=q,F;ao(q,F)}return null}function se(q,F,Y,le){var Se=F!==null?F.key:null;if(typeof Y=="string"&&Y!==""||typeof Y=="number")return Se!==null?null:k(q,F,""+Y,le);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case J:return Y.key===Se?T(q,F,Y,le):null;case A:return Y.key===Se?G(q,F,Y,le):null;case Z:return Se=Y._init,se(q,F,Se(Y._payload),le)}if(_r(Y)||te(Y))return Se!==null?null:ne(q,F,Y,le,null);ao(q,Y)}return null}function fe(q,F,Y,le,Se){if(typeof le=="string"&&le!==""||typeof le=="number")return q=q.get(Y)||null,k(F,q,""+le,Se);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case J:return q=q.get(le.key===null?Y:le.key)||null,T(F,q,le,Se);case A:return q=q.get(le.key===null?Y:le.key)||null,G(F,q,le,Se);case Z:var Ce=le._init;return fe(q,F,Y,Ce(le._payload),Se)}if(_r(le)||te(le))return q=q.get(Y)||null,ne(F,q,le,Se,null);ao(F,le)}return null}function _e(q,F,Y,le){for(var Se=null,Ce=null,be=F,Ee=F=0,dt=null;be!==null&&Ee<Y.length;Ee++){be.index>Ee?(dt=be,be=null):dt=be.sibling;var je=se(q,be,Y[Ee],le);if(je===null){be===null&&(be=dt);break}i&&be&&je.alternate===null&&s(q,be),F=m(je,F,Ee),Ce===null?Se=je:Ce.sibling=je,Ce=je,be=dt}if(Ee===Y.length)return o(q,be),Ue&&wr(q,Ee),Se;if(be===null){for(;Ee<Y.length;Ee++)be=oe(q,Y[Ee],le),be!==null&&(F=m(be,F,Ee),Ce===null?Se=be:Ce.sibling=be,Ce=be);return Ue&&wr(q,Ee),Se}for(be=c(q,be);Ee<Y.length;Ee++)dt=fe(be,q,Ee,Y[Ee],le),dt!==null&&(i&&dt.alternate!==null&&be.delete(dt.key===null?Ee:dt.key),F=m(dt,F,Ee),Ce===null?Se=dt:Ce.sibling=dt,Ce=dt);return i&&be.forEach(function(ar){return s(q,ar)}),Ue&&wr(q,Ee),Se}function ye(q,F,Y,le){var Se=te(Y);if(typeof Se!="function")throw Error(r(150));if(Y=Se.call(Y),Y==null)throw Error(r(151));for(var Ce=Se=null,be=F,Ee=F=0,dt=null,je=Y.next();be!==null&&!je.done;Ee++,je=Y.next()){be.index>Ee?(dt=be,be=null):dt=be.sibling;var ar=se(q,be,je.value,le);if(ar===null){be===null&&(be=dt);break}i&&be&&ar.alternate===null&&s(q,be),F=m(ar,F,Ee),Ce===null?Se=ar:Ce.sibling=ar,Ce=ar,be=dt}if(je.done)return o(q,be),Ue&&wr(q,Ee),Se;if(be===null){for(;!je.done;Ee++,je=Y.next())je=oe(q,je.value,le),je!==null&&(F=m(je,F,Ee),Ce===null?Se=je:Ce.sibling=je,Ce=je);return Ue&&wr(q,Ee),Se}for(be=c(q,be);!je.done;Ee++,je=Y.next())je=fe(be,q,Ee,je.value,le),je!==null&&(i&&je.alternate!==null&&be.delete(je.key===null?Ee:je.key),F=m(je,F,Ee),Ce===null?Se=je:Ce.sibling=je,Ce=je);return i&&be.forEach(function(S0){return s(q,S0)}),Ue&&wr(q,Ee),Se}function et(q,F,Y,le){if(typeof Y=="object"&&Y!==null&&Y.type===M&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case J:e:{for(var Se=Y.key,Ce=F;Ce!==null;){if(Ce.key===Se){if(Se=Y.type,Se===M){if(Ce.tag===7){o(q,Ce.sibling),F=u(Ce,Y.props.children),F.return=q,q=F;break e}}else if(Ce.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===Z&&Pd(Se)===Ce.type){o(q,Ce.sibling),F=u(Ce,Y.props),F.ref=Vs(q,Ce,Y),F.return=q,q=F;break e}o(q,Ce);break}else s(q,Ce);Ce=Ce.sibling}Y.type===M?(F=Mr(Y.props.children,q.mode,le,Y.key),F.return=q,q=F):(le=To(Y.type,Y.key,Y.props,null,q.mode,le),le.ref=Vs(q,F,Y),le.return=q,q=le)}return S(q);case A:e:{for(Ce=Y.key;F!==null;){if(F.key===Ce)if(F.tag===4&&F.stateNode.containerInfo===Y.containerInfo&&F.stateNode.implementation===Y.implementation){o(q,F.sibling),F=u(F,Y.children||[]),F.return=q,q=F;break e}else{o(q,F);break}else s(q,F);F=F.sibling}F=ac(Y,q.mode,le),F.return=q,q=F}return S(q);case Z:return Ce=Y._init,et(q,F,Ce(Y._payload),le)}if(_r(Y))return _e(q,F,Y,le);if(te(Y))return ye(q,F,Y,le);ao(q,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"?(Y=""+Y,F!==null&&F.tag===6?(o(q,F.sibling),F=u(F,Y),F.return=q,q=F):(o(q,F),F=lc(Y,q.mode,le),F.return=q,q=F),S(q)):o(q,F)}return et}var is=Ld(!0),Td=Ld(!1),co=Qi(null),ho=null,rs=null,ga=null;function va(){ga=rs=ho=null}function ya(i){var s=co.current;We(co),i._currentValue=s}function Sa(i,s,o){for(;i!==null;){var c=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),i===o)break;i=i.return}}function ss(i,s){ho=i,ga=rs=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&s)!==0&&(jt=!0),i.firstContext=null)}function Jt(i){var s=i._currentValue;if(ga!==i)if(i={context:i,memoizedValue:s,next:null},rs===null){if(ho===null)throw Error(r(308));rs=i,ho.dependencies={lanes:0,firstContext:i}}else rs=rs.next=i;return s}var Cr=null;function wa(i){Cr===null?Cr=[i]:Cr.push(i)}function Bd(i,s,o,c){var u=s.interleaved;return u===null?(o.next=o,wa(s)):(o.next=u.next,u.next=o),s.interleaved=o,Bi(i,c)}function Bi(i,s){i.lanes|=s;var o=i.alternate;for(o!==null&&(o.lanes|=s),o=i,i=i.return;i!==null;)i.childLanes|=s,o=i.alternate,o!==null&&(o.childLanes|=s),o=i,i=i.return;return o.tag===3?o.stateNode:null}var er=!1;function Ca(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ad(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function Ai(i,s){return{eventTime:i,lane:s,tag:0,payload:null,callback:null,next:null}}function tr(i,s,o){var c=i.updateQueue;if(c===null)return null;if(c=c.shared,(Be&2)!==0){var u=c.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),c.pending=s,Bi(i,o)}return u=c.interleaved,u===null?(s.next=s,wa(c)):(s.next=u.next,u.next=s),c.interleaved=s,Bi(i,o)}function uo(i,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194240)!==0)){var c=s.lanes;c&=i.pendingLanes,o|=c,s.lanes=o,jl(i,o)}}function jd(i,s){var o=i.updateQueue,c=i.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var u=null,m=null;if(o=o.firstBaseUpdate,o!==null){do{var S={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};m===null?u=m=S:m=m.next=S,o=o.next}while(o!==null);m===null?u=m=s:m=m.next=s}else u=m=s;o={baseState:c.baseState,firstBaseUpdate:u,lastBaseUpdate:m,shared:c.shared,effects:c.effects},i.updateQueue=o;return}i=o.lastBaseUpdate,i===null?o.firstBaseUpdate=s:i.next=s,o.lastBaseUpdate=s}function fo(i,s,o,c){var u=i.updateQueue;er=!1;var m=u.firstBaseUpdate,S=u.lastBaseUpdate,k=u.shared.pending;if(k!==null){u.shared.pending=null;var T=k,G=T.next;T.next=null,S===null?m=G:S.next=G,S=T;var ne=i.alternate;ne!==null&&(ne=ne.updateQueue,k=ne.lastBaseUpdate,k!==S&&(k===null?ne.firstBaseUpdate=G:k.next=G,ne.lastBaseUpdate=T))}if(m!==null){var oe=u.baseState;S=0,ne=G=T=null,k=m;do{var se=k.lane,fe=k.eventTime;if((c&se)===se){ne!==null&&(ne=ne.next={eventTime:fe,lane:0,tag:k.tag,payload:k.payload,callback:k.callback,next:null});e:{var _e=i,ye=k;switch(se=s,fe=o,ye.tag){case 1:if(_e=ye.payload,typeof _e=="function"){oe=_e.call(fe,oe,se);break e}oe=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=ye.payload,se=typeof _e=="function"?_e.call(fe,oe,se):_e,se==null)break e;oe=X({},oe,se);break e;case 2:er=!0}}k.callback!==null&&k.lane!==0&&(i.flags|=64,se=u.effects,se===null?u.effects=[k]:se.push(k))}else fe={eventTime:fe,lane:se,tag:k.tag,payload:k.payload,callback:k.callback,next:null},ne===null?(G=ne=fe,T=oe):ne=ne.next=fe,S|=se;if(k=k.next,k===null){if(k=u.shared.pending,k===null)break;se=k,k=se.next,se.next=null,u.lastBaseUpdate=se,u.shared.pending=null}}while(!0);if(ne===null&&(T=oe),u.baseState=T,u.firstBaseUpdate=G,u.lastBaseUpdate=ne,s=u.shared.interleaved,s!==null){u=s;do S|=u.lane,u=u.next;while(u!==s)}else m===null&&(u.shared.lanes=0);kr|=S,i.lanes=S,i.memoizedState=oe}}function Od(i,s,o){if(i=s.effects,s.effects=null,i!==null)for(s=0;s<i.length;s++){var c=i[s],u=c.callback;if(u!==null){if(c.callback=null,c=o,typeof u!="function")throw Error(r(191,u));u.call(c)}}}var qs={},gi=Qi(qs),Ys=Qi(qs),Xs=Qi(qs);function br(i){if(i===qs)throw Error(r(174));return i}function ba(i,s){switch(Fe(Xs,s),Fe(Ys,i),Fe(gi,qs),i=s.nodeType,i){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:xl(null,"");break;default:i=i===8?s.parentNode:s,s=i.namespaceURI||null,i=i.tagName,s=xl(s,i)}We(gi),Fe(gi,s)}function ns(){We(gi),We(Ys),We(Xs)}function Id(i){br(Xs.current);var s=br(gi.current),o=xl(s,i.type);s!==o&&(Fe(Ys,i),Fe(gi,o))}function xa(i){Ys.current===i&&(We(gi),We(Ys))}var Ve=Qi(0);function po(i){for(var s=i;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var ka=[];function Ea(){for(var i=0;i<ka.length;i++)ka[i]._workInProgressVersionPrimary=null;ka.length=0}var mo=P.ReactCurrentDispatcher,Na=P.ReactCurrentBatchConfig,xr=0,qe=null,nt=null,ht=null,_o=!1,Gs=!1,Qs=0,Wv=0;function xt(){throw Error(r(321))}function Ra(i,s){if(s===null)return!1;for(var o=0;o<s.length&&o<i.length;o++)if(!li(i[o],s[o]))return!1;return!0}function Ma(i,s,o,c,u,m){if(xr=m,qe=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,mo.current=i===null||i.memoizedState===null?Vv:qv,i=o(c,u),Gs){m=0;do{if(Gs=!1,Qs=0,25<=m)throw Error(r(301));m+=1,ht=nt=null,s.updateQueue=null,mo.current=Yv,i=o(c,u)}while(Gs)}if(mo.current=yo,s=nt!==null&&nt.next!==null,xr=0,ht=nt=qe=null,_o=!1,s)throw Error(r(300));return i}function Da(){var i=Qs!==0;return Qs=0,i}function vi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ht===null?qe.memoizedState=ht=i:ht=ht.next=i,ht}function Zt(){if(nt===null){var i=qe.alternate;i=i!==null?i.memoizedState:null}else i=nt.next;var s=ht===null?qe.memoizedState:ht.next;if(s!==null)ht=s,nt=i;else{if(i===null)throw Error(r(310));nt=i,i={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},ht===null?qe.memoizedState=ht=i:ht=ht.next=i}return ht}function Js(i,s){return typeof s=="function"?s(i):s}function Pa(i){var s=Zt(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var c=nt,u=c.baseQueue,m=o.pending;if(m!==null){if(u!==null){var S=u.next;u.next=m.next,m.next=S}c.baseQueue=u=m,o.pending=null}if(u!==null){m=u.next,c=c.baseState;var k=S=null,T=null,G=m;do{var ne=G.lane;if((xr&ne)===ne)T!==null&&(T=T.next={lane:0,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),c=G.hasEagerState?G.eagerState:i(c,G.action);else{var oe={lane:ne,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null};T===null?(k=T=oe,S=c):T=T.next=oe,qe.lanes|=ne,kr|=ne}G=G.next}while(G!==null&&G!==m);T===null?S=c:T.next=k,li(c,s.memoizedState)||(jt=!0),s.memoizedState=c,s.baseState=S,s.baseQueue=T,o.lastRenderedState=c}if(i=o.interleaved,i!==null){u=i;do m=u.lane,qe.lanes|=m,kr|=m,u=u.next;while(u!==i)}else u===null&&(o.lanes=0);return[s.memoizedState,o.dispatch]}function La(i){var s=Zt(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var c=o.dispatch,u=o.pending,m=s.memoizedState;if(u!==null){o.pending=null;var S=u=u.next;do m=i(m,S.action),S=S.next;while(S!==u);li(m,s.memoizedState)||(jt=!0),s.memoizedState=m,s.baseQueue===null&&(s.baseState=m),o.lastRenderedState=m}return[m,c]}function zd(){}function Fd(i,s){var o=qe,c=Zt(),u=s(),m=!li(c.memoizedState,u);if(m&&(c.memoizedState=u,jt=!0),c=c.queue,Ta($d.bind(null,o,c,i),[i]),c.getSnapshot!==s||m||ht!==null&&ht.memoizedState.tag&1){if(o.flags|=2048,Zs(9,Wd.bind(null,o,c,u,s),void 0,null),ut===null)throw Error(r(349));(xr&30)!==0||Hd(o,s,u)}return u}function Hd(i,s,o){i.flags|=16384,i={getSnapshot:s,value:o},s=qe.updateQueue,s===null?(s={lastEffect:null,stores:null},qe.updateQueue=s,s.stores=[i]):(o=s.stores,o===null?s.stores=[i]:o.push(i))}function Wd(i,s,o,c){s.value=o,s.getSnapshot=c,Ud(s)&&Kd(i)}function $d(i,s,o){return o(function(){Ud(s)&&Kd(i)})}function Ud(i){var s=i.getSnapshot;i=i.value;try{var o=s();return!li(i,o)}catch{return!0}}function Kd(i){var s=Bi(i,1);s!==null&&di(s,i,1,-1)}function Vd(i){var s=vi();return typeof i=="function"&&(i=i()),s.memoizedState=s.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Js,lastRenderedState:i},s.queue=i,i=i.dispatch=Kv.bind(null,qe,i),[s.memoizedState,i]}function Zs(i,s,o,c){return i={tag:i,create:s,destroy:o,deps:c,next:null},s=qe.updateQueue,s===null?(s={lastEffect:null,stores:null},qe.updateQueue=s,s.lastEffect=i.next=i):(o=s.lastEffect,o===null?s.lastEffect=i.next=i:(c=o.next,o.next=i,i.next=c,s.lastEffect=i)),i}function qd(){return Zt().memoizedState}function go(i,s,o,c){var u=vi();qe.flags|=i,u.memoizedState=Zs(1|s,o,void 0,c===void 0?null:c)}function vo(i,s,o,c){var u=Zt();c=c===void 0?null:c;var m=void 0;if(nt!==null){var S=nt.memoizedState;if(m=S.destroy,c!==null&&Ra(c,S.deps)){u.memoizedState=Zs(s,o,m,c);return}}qe.flags|=i,u.memoizedState=Zs(1|s,o,m,c)}function Yd(i,s){return go(8390656,8,i,s)}function Ta(i,s){return vo(2048,8,i,s)}function Xd(i,s){return vo(4,2,i,s)}function Gd(i,s){return vo(4,4,i,s)}function Qd(i,s){if(typeof s=="function")return i=i(),s(i),function(){s(null)};if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function Jd(i,s,o){return o=o!=null?o.concat([i]):null,vo(4,4,Qd.bind(null,s,i),o)}function Ba(){}function Zd(i,s){var o=Zt();s=s===void 0?null:s;var c=o.memoizedState;return c!==null&&s!==null&&Ra(s,c[1])?c[0]:(o.memoizedState=[i,s],i)}function ef(i,s){var o=Zt();s=s===void 0?null:s;var c=o.memoizedState;return c!==null&&s!==null&&Ra(s,c[1])?c[0]:(i=i(),o.memoizedState=[i,s],i)}function tf(i,s,o){return(xr&21)===0?(i.baseState&&(i.baseState=!1,jt=!0),i.memoizedState=o):(li(o,s)||(o=Pu(),qe.lanes|=o,kr|=o,i.baseState=!0),s)}function $v(i,s){var o=Oe;Oe=o!==0&&4>o?o:4,i(!0);var c=Na.transition;Na.transition={};try{i(!1),s()}finally{Oe=o,Na.transition=c}}function rf(){return Zt().memoizedState}function Uv(i,s,o){var c=nr(i);if(o={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null},sf(i))nf(s,o);else if(o=Bd(i,s,o,c),o!==null){var u=Mt();di(o,i,c,u),of(o,s,c)}}function Kv(i,s,o){var c=nr(i),u={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null};if(sf(i))nf(s,u);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=s.lastRenderedReducer,m!==null))try{var S=s.lastRenderedState,k=m(S,o);if(u.hasEagerState=!0,u.eagerState=k,li(k,S)){var T=s.interleaved;T===null?(u.next=u,wa(s)):(u.next=T.next,T.next=u),s.interleaved=u;return}}catch{}finally{}o=Bd(i,s,u,c),o!==null&&(u=Mt(),di(o,i,c,u),of(o,s,c))}}function sf(i){var s=i.alternate;return i===qe||s!==null&&s===qe}function nf(i,s){Gs=_o=!0;var o=i.pending;o===null?s.next=s:(s.next=o.next,o.next=s),i.pending=s}function of(i,s,o){if((o&4194240)!==0){var c=s.lanes;c&=i.pendingLanes,o|=c,s.lanes=o,jl(i,o)}}var yo={readContext:Jt,useCallback:xt,useContext:xt,useEffect:xt,useImperativeHandle:xt,useInsertionEffect:xt,useLayoutEffect:xt,useMemo:xt,useReducer:xt,useRef:xt,useState:xt,useDebugValue:xt,useDeferredValue:xt,useTransition:xt,useMutableSource:xt,useSyncExternalStore:xt,useId:xt,unstable_isNewReconciler:!1},Vv={readContext:Jt,useCallback:function(i,s){return vi().memoizedState=[i,s===void 0?null:s],i},useContext:Jt,useEffect:Yd,useImperativeHandle:function(i,s,o){return o=o!=null?o.concat([i]):null,go(4194308,4,Qd.bind(null,s,i),o)},useLayoutEffect:function(i,s){return go(4194308,4,i,s)},useInsertionEffect:function(i,s){return go(4,2,i,s)},useMemo:function(i,s){var o=vi();return s=s===void 0?null:s,i=i(),o.memoizedState=[i,s],i},useReducer:function(i,s,o){var c=vi();return s=o!==void 0?o(s):s,c.memoizedState=c.baseState=s,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:s},c.queue=i,i=i.dispatch=Uv.bind(null,qe,i),[c.memoizedState,i]},useRef:function(i){var s=vi();return i={current:i},s.memoizedState=i},useState:Vd,useDebugValue:Ba,useDeferredValue:function(i){return vi().memoizedState=i},useTransition:function(){var i=Vd(!1),s=i[0];return i=$v.bind(null,i[1]),vi().memoizedState=i,[s,i]},useMutableSource:function(){},useSyncExternalStore:function(i,s,o){var c=qe,u=vi();if(Ue){if(o===void 0)throw Error(r(407));o=o()}else{if(o=s(),ut===null)throw Error(r(349));(xr&30)!==0||Hd(c,s,o)}u.memoizedState=o;var m={value:o,getSnapshot:s};return u.queue=m,Yd($d.bind(null,c,m,i),[i]),c.flags|=2048,Zs(9,Wd.bind(null,c,m,o,s),void 0,null),o},useId:function(){var i=vi(),s=ut.identifierPrefix;if(Ue){var o=Ti,c=Li;o=(c&~(1<<32-oi(c)-1)).toString(32)+o,s=":"+s+"R"+o,o=Qs++,0<o&&(s+="H"+o.toString(32)),s+=":"}else o=Wv++,s=":"+s+"r"+o.toString(32)+":";return i.memoizedState=s},unstable_isNewReconciler:!1},qv={readContext:Jt,useCallback:Zd,useContext:Jt,useEffect:Ta,useImperativeHandle:Jd,useInsertionEffect:Xd,useLayoutEffect:Gd,useMemo:ef,useReducer:Pa,useRef:qd,useState:function(){return Pa(Js)},useDebugValue:Ba,useDeferredValue:function(i){var s=Zt();return tf(s,nt.memoizedState,i)},useTransition:function(){var i=Pa(Js)[0],s=Zt().memoizedState;return[i,s]},useMutableSource:zd,useSyncExternalStore:Fd,useId:rf,unstable_isNewReconciler:!1},Yv={readContext:Jt,useCallback:Zd,useContext:Jt,useEffect:Ta,useImperativeHandle:Jd,useInsertionEffect:Xd,useLayoutEffect:Gd,useMemo:ef,useReducer:La,useRef:qd,useState:function(){return La(Js)},useDebugValue:Ba,useDeferredValue:function(i){var s=Zt();return nt===null?s.memoizedState=i:tf(s,nt.memoizedState,i)},useTransition:function(){var i=La(Js)[0],s=Zt().memoizedState;return[i,s]},useMutableSource:zd,useSyncExternalStore:Fd,useId:rf,unstable_isNewReconciler:!1};function ci(i,s){if(i&&i.defaultProps){s=X({},s),i=i.defaultProps;for(var o in i)s[o]===void 0&&(s[o]=i[o]);return s}return s}function Aa(i,s,o,c){s=i.memoizedState,o=o(c,s),o=o==null?s:X({},s,o),i.memoizedState=o,i.lanes===0&&(i.updateQueue.baseState=o)}var So={isMounted:function(i){return(i=i._reactInternals)?gr(i)===i:!1},enqueueSetState:function(i,s,o){i=i._reactInternals;var c=Mt(),u=nr(i),m=Ai(c,u);m.payload=s,o!=null&&(m.callback=o),s=tr(i,m,u),s!==null&&(di(s,i,u,c),uo(s,i,u))},enqueueReplaceState:function(i,s,o){i=i._reactInternals;var c=Mt(),u=nr(i),m=Ai(c,u);m.tag=1,m.payload=s,o!=null&&(m.callback=o),s=tr(i,m,u),s!==null&&(di(s,i,u,c),uo(s,i,u))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var o=Mt(),c=nr(i),u=Ai(o,c);u.tag=2,s!=null&&(u.callback=s),s=tr(i,u,c),s!==null&&(di(s,i,c,o),uo(s,i,c))}};function lf(i,s,o,c,u,m,S){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(c,m,S):s.prototype&&s.prototype.isPureReactComponent?!zs(o,c)||!zs(u,m):!0}function af(i,s,o){var c=!1,u=Ji,m=s.contextType;return typeof m=="object"&&m!==null?m=Jt(m):(u=At(s)?yr:bt.current,c=s.contextTypes,m=(c=c!=null)?Jr(i,u):Ji),s=new s(o,m),i.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=So,i.stateNode=s,s._reactInternals=i,c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=u,i.__reactInternalMemoizedMaskedChildContext=m),s}function cf(i,s,o,c){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,c),s.state!==i&&So.enqueueReplaceState(s,s.state,null)}function ja(i,s,o,c){var u=i.stateNode;u.props=o,u.state=i.memoizedState,u.refs={},Ca(i);var m=s.contextType;typeof m=="object"&&m!==null?u.context=Jt(m):(m=At(s)?yr:bt.current,u.context=Jr(i,m)),u.state=i.memoizedState,m=s.getDerivedStateFromProps,typeof m=="function"&&(Aa(i,s,m,o),u.state=i.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(s=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),s!==u.state&&So.enqueueReplaceState(u,u.state,null),fo(i,o,u,c),u.state=i.memoizedState),typeof u.componentDidMount=="function"&&(i.flags|=4194308)}function os(i,s){try{var o="",c=s;do o+=pe(c),c=c.return;while(c);var u=o}catch(m){u=`
|
|
39
|
+
Error generating stack: `+m.message+`
|
|
40
|
+
`+m.stack}return{value:i,source:s,stack:u,digest:null}}function Oa(i,s,o){return{value:i,source:null,stack:o??null,digest:s??null}}function Ia(i,s){try{console.error(s.value)}catch(o){setTimeout(function(){throw o})}}var Xv=typeof WeakMap=="function"?WeakMap:Map;function hf(i,s,o){o=Ai(-1,o),o.tag=3,o.payload={element:null};var c=s.value;return o.callback=function(){No||(No=!0,Za=c),Ia(i,s)},o}function uf(i,s,o){o=Ai(-1,o),o.tag=3;var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var u=s.value;o.payload=function(){return c(u)},o.callback=function(){Ia(i,s)}}var m=i.stateNode;return m!==null&&typeof m.componentDidCatch=="function"&&(o.callback=function(){Ia(i,s),typeof c!="function"&&(rr===null?rr=new Set([this]):rr.add(this));var S=s.stack;this.componentDidCatch(s.value,{componentStack:S!==null?S:""})}),o}function df(i,s,o){var c=i.pingCache;if(c===null){c=i.pingCache=new Xv;var u=new Set;c.set(s,u)}else u=c.get(s),u===void 0&&(u=new Set,c.set(s,u));u.has(o)||(u.add(o),i=c0.bind(null,i,s,o),s.then(i,i))}function ff(i){do{var s;if((s=i.tag===13)&&(s=i.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return i;i=i.return}while(i!==null);return null}function pf(i,s,o,c,u){return(i.mode&1)===0?(i===s?i.flags|=65536:(i.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(s=Ai(-1,1),s.tag=2,tr(o,s,1))),o.lanes|=1),i):(i.flags|=65536,i.lanes=u,i)}var Gv=P.ReactCurrentOwner,jt=!1;function Rt(i,s,o,c){s.child=i===null?Td(s,null,o,c):is(s,i.child,o,c)}function mf(i,s,o,c,u){o=o.render;var m=s.ref;return ss(s,u),c=Ma(i,s,o,c,m,u),o=Da(),i!==null&&!jt?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~u,ji(i,s,u)):(Ue&&o&&da(s),s.flags|=1,Rt(i,s,c,u),s.child)}function _f(i,s,o,c,u){if(i===null){var m=o.type;return typeof m=="function"&&!oc(m)&&m.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(s.tag=15,s.type=m,gf(i,s,m,c,u)):(i=To(o.type,null,c,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(m=i.child,(i.lanes&u)===0){var S=m.memoizedProps;if(o=o.compare,o=o!==null?o:zs,o(S,c)&&i.ref===s.ref)return ji(i,s,u)}return s.flags|=1,i=lr(m,c),i.ref=s.ref,i.return=s,s.child=i}function gf(i,s,o,c,u){if(i!==null){var m=i.memoizedProps;if(zs(m,c)&&i.ref===s.ref)if(jt=!1,s.pendingProps=c=m,(i.lanes&u)!==0)(i.flags&131072)!==0&&(jt=!0);else return s.lanes=i.lanes,ji(i,s,u)}return za(i,s,o,c,u)}function vf(i,s,o){var c=s.pendingProps,u=c.children,m=i!==null?i.memoizedState:null;if(c.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},Fe(as,Vt),Vt|=o;else{if((o&1073741824)===0)return i=m!==null?m.baseLanes|o:o,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:i,cachePool:null,transitions:null},s.updateQueue=null,Fe(as,Vt),Vt|=i,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=m!==null?m.baseLanes:o,Fe(as,Vt),Vt|=c}else m!==null?(c=m.baseLanes|o,s.memoizedState=null):c=o,Fe(as,Vt),Vt|=c;return Rt(i,s,u,o),s.child}function yf(i,s){var o=s.ref;(i===null&&o!==null||i!==null&&i.ref!==o)&&(s.flags|=512,s.flags|=2097152)}function za(i,s,o,c,u){var m=At(o)?yr:bt.current;return m=Jr(s,m),ss(s,u),o=Ma(i,s,o,c,m,u),c=Da(),i!==null&&!jt?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~u,ji(i,s,u)):(Ue&&c&&da(s),s.flags|=1,Rt(i,s,o,u),s.child)}function Sf(i,s,o,c,u){if(At(o)){var m=!0;ro(s)}else m=!1;if(ss(s,u),s.stateNode===null)Co(i,s),af(s,o,c),ja(s,o,c,u),c=!0;else if(i===null){var S=s.stateNode,k=s.memoizedProps;S.props=k;var T=S.context,G=o.contextType;typeof G=="object"&&G!==null?G=Jt(G):(G=At(o)?yr:bt.current,G=Jr(s,G));var ne=o.getDerivedStateFromProps,oe=typeof ne=="function"||typeof S.getSnapshotBeforeUpdate=="function";oe||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(k!==c||T!==G)&&cf(s,S,c,G),er=!1;var se=s.memoizedState;S.state=se,fo(s,c,S,u),T=s.memoizedState,k!==c||se!==T||Bt.current||er?(typeof ne=="function"&&(Aa(s,o,ne,c),T=s.memoizedState),(k=er||lf(s,o,k,c,se,T,G))?(oe||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(s.flags|=4194308)):(typeof S.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=c,s.memoizedState=T),S.props=c,S.state=T,S.context=G,c=k):(typeof S.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{S=s.stateNode,Ad(i,s),k=s.memoizedProps,G=s.type===s.elementType?k:ci(s.type,k),S.props=G,oe=s.pendingProps,se=S.context,T=o.contextType,typeof T=="object"&&T!==null?T=Jt(T):(T=At(o)?yr:bt.current,T=Jr(s,T));var fe=o.getDerivedStateFromProps;(ne=typeof fe=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(k!==oe||se!==T)&&cf(s,S,c,T),er=!1,se=s.memoizedState,S.state=se,fo(s,c,S,u);var _e=s.memoizedState;k!==oe||se!==_e||Bt.current||er?(typeof fe=="function"&&(Aa(s,o,fe,c),_e=s.memoizedState),(G=er||lf(s,o,G,c,se,_e,T)||!1)?(ne||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(c,_e,T),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(c,_e,T)),typeof S.componentDidUpdate=="function"&&(s.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof S.componentDidUpdate!="function"||k===i.memoizedProps&&se===i.memoizedState||(s.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||k===i.memoizedProps&&se===i.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=_e),S.props=c,S.state=_e,S.context=T,c=G):(typeof S.componentDidUpdate!="function"||k===i.memoizedProps&&se===i.memoizedState||(s.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||k===i.memoizedProps&&se===i.memoizedState||(s.flags|=1024),c=!1)}return Fa(i,s,o,c,m,u)}function Fa(i,s,o,c,u,m){yf(i,s);var S=(s.flags&128)!==0;if(!c&&!S)return u&&xd(s,o,!1),ji(i,s,m);c=s.stateNode,Gv.current=s;var k=S&&typeof o.getDerivedStateFromError!="function"?null:c.render();return s.flags|=1,i!==null&&S?(s.child=is(s,i.child,null,m),s.child=is(s,null,k,m)):Rt(i,s,k,m),s.memoizedState=c.state,u&&xd(s,o,!0),s.child}function wf(i){var s=i.stateNode;s.pendingContext?Cd(i,s.pendingContext,s.pendingContext!==s.context):s.context&&Cd(i,s.context,!1),ba(i,s.containerInfo)}function Cf(i,s,o,c,u){return ts(),_a(u),s.flags|=256,Rt(i,s,o,c),s.child}var Ha={dehydrated:null,treeContext:null,retryLane:0};function Wa(i){return{baseLanes:i,cachePool:null,transitions:null}}function bf(i,s,o){var c=s.pendingProps,u=Ve.current,m=!1,S=(s.flags&128)!==0,k;if((k=S)||(k=i!==null&&i.memoizedState===null?!1:(u&2)!==0),k?(m=!0,s.flags&=-129):(i===null||i.memoizedState!==null)&&(u|=1),Fe(Ve,u&1),i===null)return ma(s),i=s.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((s.mode&1)===0?s.lanes=1:i.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(S=c.children,i=c.fallback,m?(c=s.mode,m=s.child,S={mode:"hidden",children:S},(c&1)===0&&m!==null?(m.childLanes=0,m.pendingProps=S):m=Bo(S,c,0,null),i=Mr(i,c,o,null),m.return=s,i.return=s,m.sibling=i,s.child=m,s.child.memoizedState=Wa(o),s.memoizedState=Ha,i):$a(s,S));if(u=i.memoizedState,u!==null&&(k=u.dehydrated,k!==null))return Qv(i,s,S,c,k,u,o);if(m){m=c.fallback,S=s.mode,u=i.child,k=u.sibling;var T={mode:"hidden",children:c.children};return(S&1)===0&&s.child!==u?(c=s.child,c.childLanes=0,c.pendingProps=T,s.deletions=null):(c=lr(u,T),c.subtreeFlags=u.subtreeFlags&14680064),k!==null?m=lr(k,m):(m=Mr(m,S,o,null),m.flags|=2),m.return=s,c.return=s,c.sibling=m,s.child=c,c=m,m=s.child,S=i.child.memoizedState,S=S===null?Wa(o):{baseLanes:S.baseLanes|o,cachePool:null,transitions:S.transitions},m.memoizedState=S,m.childLanes=i.childLanes&~o,s.memoizedState=Ha,c}return m=i.child,i=m.sibling,c=lr(m,{mode:"visible",children:c.children}),(s.mode&1)===0&&(c.lanes=o),c.return=s,c.sibling=null,i!==null&&(o=s.deletions,o===null?(s.deletions=[i],s.flags|=16):o.push(i)),s.child=c,s.memoizedState=null,c}function $a(i,s){return s=Bo({mode:"visible",children:s},i.mode,0,null),s.return=i,i.child=s}function wo(i,s,o,c){return c!==null&&_a(c),is(s,i.child,null,o),i=$a(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Qv(i,s,o,c,u,m,S){if(o)return s.flags&256?(s.flags&=-257,c=Oa(Error(r(422))),wo(i,s,S,c)):s.memoizedState!==null?(s.child=i.child,s.flags|=128,null):(m=c.fallback,u=s.mode,c=Bo({mode:"visible",children:c.children},u,0,null),m=Mr(m,u,S,null),m.flags|=2,c.return=s,m.return=s,c.sibling=m,s.child=c,(s.mode&1)!==0&&is(s,i.child,null,S),s.child.memoizedState=Wa(S),s.memoizedState=Ha,m);if((s.mode&1)===0)return wo(i,s,S,null);if(u.data==="$!"){if(c=u.nextSibling&&u.nextSibling.dataset,c)var k=c.dgst;return c=k,m=Error(r(419)),c=Oa(m,c,void 0),wo(i,s,S,c)}if(k=(S&i.childLanes)!==0,jt||k){if(c=ut,c!==null){switch(S&-S){case 4:u=2;break;case 16:u=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:u=32;break;case 536870912:u=268435456;break;default:u=0}u=(u&(c.suspendedLanes|S))!==0?0:u,u!==0&&u!==m.retryLane&&(m.retryLane=u,Bi(i,u),di(c,i,u,-1))}return nc(),c=Oa(Error(r(421))),wo(i,s,S,c)}return u.data==="$?"?(s.flags|=128,s.child=i.child,s=h0.bind(null,i),u._reactRetry=s,null):(i=m.treeContext,Kt=Gi(u.nextSibling),Ut=s,Ue=!0,ai=null,i!==null&&(Gt[Qt++]=Li,Gt[Qt++]=Ti,Gt[Qt++]=Sr,Li=i.id,Ti=i.overflow,Sr=s),s=$a(s,c.children),s.flags|=4096,s)}function xf(i,s,o){i.lanes|=s;var c=i.alternate;c!==null&&(c.lanes|=s),Sa(i.return,s,o)}function Ua(i,s,o,c,u){var m=i.memoizedState;m===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:o,tailMode:u}:(m.isBackwards=s,m.rendering=null,m.renderingStartTime=0,m.last=c,m.tail=o,m.tailMode=u)}function kf(i,s,o){var c=s.pendingProps,u=c.revealOrder,m=c.tail;if(Rt(i,s,c.children,o),c=Ve.current,(c&2)!==0)c=c&1|2,s.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&xf(i,o,s);else if(i.tag===19)xf(i,o,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}c&=1}if(Fe(Ve,c),(s.mode&1)===0)s.memoizedState=null;else switch(u){case"forwards":for(o=s.child,u=null;o!==null;)i=o.alternate,i!==null&&po(i)===null&&(u=o),o=o.sibling;o=u,o===null?(u=s.child,s.child=null):(u=o.sibling,o.sibling=null),Ua(s,!1,u,o,m);break;case"backwards":for(o=null,u=s.child,s.child=null;u!==null;){if(i=u.alternate,i!==null&&po(i)===null){s.child=u;break}i=u.sibling,u.sibling=o,o=u,u=i}Ua(s,!0,o,null,m);break;case"together":Ua(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Co(i,s){(s.mode&1)===0&&i!==null&&(i.alternate=null,s.alternate=null,s.flags|=2)}function ji(i,s,o){if(i!==null&&(s.dependencies=i.dependencies),kr|=s.lanes,(o&s.childLanes)===0)return null;if(i!==null&&s.child!==i.child)throw Error(r(153));if(s.child!==null){for(i=s.child,o=lr(i,i.pendingProps),s.child=o,o.return=s;i.sibling!==null;)i=i.sibling,o=o.sibling=lr(i,i.pendingProps),o.return=s;o.sibling=null}return s.child}function Jv(i,s,o){switch(s.tag){case 3:wf(s),ts();break;case 5:Id(s);break;case 1:At(s.type)&&ro(s);break;case 4:ba(s,s.stateNode.containerInfo);break;case 10:var c=s.type._context,u=s.memoizedProps.value;Fe(co,c._currentValue),c._currentValue=u;break;case 13:if(c=s.memoizedState,c!==null)return c.dehydrated!==null?(Fe(Ve,Ve.current&1),s.flags|=128,null):(o&s.child.childLanes)!==0?bf(i,s,o):(Fe(Ve,Ve.current&1),i=ji(i,s,o),i!==null?i.sibling:null);Fe(Ve,Ve.current&1);break;case 19:if(c=(o&s.childLanes)!==0,(i.flags&128)!==0){if(c)return kf(i,s,o);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Fe(Ve,Ve.current),c)break;return null;case 22:case 23:return s.lanes=0,vf(i,s,o)}return ji(i,s,o)}var Ef,Ka,Nf,Rf;Ef=function(i,s){for(var o=s.child;o!==null;){if(o.tag===5||o.tag===6)i.appendChild(o.stateNode);else if(o.tag!==4&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},Ka=function(){},Nf=function(i,s,o,c){var u=i.memoizedProps;if(u!==c){i=s.stateNode,br(gi.current);var m=null;switch(o){case"input":u=Tt(i,u),c=Tt(i,c),m=[];break;case"select":u=X({},u,{value:void 0}),c=X({},c,{value:void 0}),m=[];break;case"textarea":u=Ss(i,u),c=Ss(i,c),m=[];break;default:typeof u.onClick!="function"&&typeof c.onClick=="function"&&(i.onclick=eo)}kl(o,c);var S;o=null;for(G in u)if(!c.hasOwnProperty(G)&&u.hasOwnProperty(G)&&u[G]!=null)if(G==="style"){var k=u[G];for(S in k)k.hasOwnProperty(S)&&(o||(o={}),o[S]="")}else G!=="dangerouslySetInnerHTML"&&G!=="children"&&G!=="suppressContentEditableWarning"&&G!=="suppressHydrationWarning"&&G!=="autoFocus"&&(l.hasOwnProperty(G)?m||(m=[]):(m=m||[]).push(G,null));for(G in c){var T=c[G];if(k=u!=null?u[G]:void 0,c.hasOwnProperty(G)&&T!==k&&(T!=null||k!=null))if(G==="style")if(k){for(S in k)!k.hasOwnProperty(S)||T&&T.hasOwnProperty(S)||(o||(o={}),o[S]="");for(S in T)T.hasOwnProperty(S)&&k[S]!==T[S]&&(o||(o={}),o[S]=T[S])}else o||(m||(m=[]),m.push(G,o)),o=T;else G==="dangerouslySetInnerHTML"?(T=T?T.__html:void 0,k=k?k.__html:void 0,T!=null&&k!==T&&(m=m||[]).push(G,T)):G==="children"?typeof T!="string"&&typeof T!="number"||(m=m||[]).push(G,""+T):G!=="suppressContentEditableWarning"&&G!=="suppressHydrationWarning"&&(l.hasOwnProperty(G)?(T!=null&&G==="onScroll"&&He("scroll",i),m||k===T||(m=[])):(m=m||[]).push(G,T))}o&&(m=m||[]).push("style",o);var G=m;(s.updateQueue=G)&&(s.flags|=4)}},Rf=function(i,s,o,c){o!==c&&(s.flags|=4)};function en(i,s){if(!Ue)switch(i.tailMode){case"hidden":s=i.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?i.tail=null:o.sibling=null;break;case"collapsed":o=i.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:c.sibling=null}}function kt(i){var s=i.alternate!==null&&i.alternate.child===i.child,o=0,c=0;if(s)for(var u=i.child;u!==null;)o|=u.lanes|u.childLanes,c|=u.subtreeFlags&14680064,c|=u.flags&14680064,u.return=i,u=u.sibling;else for(u=i.child;u!==null;)o|=u.lanes|u.childLanes,c|=u.subtreeFlags,c|=u.flags,u.return=i,u=u.sibling;return i.subtreeFlags|=c,i.childLanes=o,s}function Zv(i,s,o){var c=s.pendingProps;switch(fa(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(s),null;case 1:return At(s.type)&&io(),kt(s),null;case 3:return c=s.stateNode,ns(),We(Bt),We(bt),Ea(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(lo(s)?s.flags|=4:i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,ai!==null&&(ic(ai),ai=null))),Ka(i,s),kt(s),null;case 5:xa(s);var u=br(Xs.current);if(o=s.type,i!==null&&s.stateNode!=null)Nf(i,s,o,c,u),i.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!c){if(s.stateNode===null)throw Error(r(166));return kt(s),null}if(i=br(gi.current),lo(s)){c=s.stateNode,o=s.type;var m=s.memoizedProps;switch(c[_i]=s,c[Us]=m,i=(s.mode&1)!==0,o){case"dialog":He("cancel",c),He("close",c);break;case"iframe":case"object":case"embed":He("load",c);break;case"video":case"audio":for(u=0;u<Hs.length;u++)He(Hs[u],c);break;case"source":He("error",c);break;case"img":case"image":case"link":He("error",c),He("load",c);break;case"details":He("toggle",c);break;case"input":Ri(c,m),He("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!m.multiple},He("invalid",c);break;case"textarea":ue(c,m),He("invalid",c)}kl(o,m),u=null;for(var S in m)if(m.hasOwnProperty(S)){var k=m[S];S==="children"?typeof k=="string"?c.textContent!==k&&(m.suppressHydrationWarning!==!0&&Zn(c.textContent,k,i),u=["children",k]):typeof k=="number"&&c.textContent!==""+k&&(m.suppressHydrationWarning!==!0&&Zn(c.textContent,k,i),u=["children",""+k]):l.hasOwnProperty(S)&&k!=null&&S==="onScroll"&&He("scroll",c)}switch(o){case"input":ge(c),Pn(c,m,!0);break;case"textarea":ge(c),Mi(c);break;case"select":case"option":break;default:typeof m.onClick=="function"&&(c.onclick=eo)}c=u,s.updateQueue=c,c!==null&&(s.flags|=4)}else{S=u.nodeType===9?u:u.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=ws(o)),i==="http://www.w3.org/1999/xhtml"?o==="script"?(i=S.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof c.is=="string"?i=S.createElement(o,{is:c.is}):(i=S.createElement(o),o==="select"&&(S=i,c.multiple?S.multiple=!0:c.size&&(S.size=c.size))):i=S.createElementNS(i,o),i[_i]=s,i[Us]=c,Ef(i,s,!1,!1),s.stateNode=i;e:{switch(S=El(o,c),o){case"dialog":He("cancel",i),He("close",i),u=c;break;case"iframe":case"object":case"embed":He("load",i),u=c;break;case"video":case"audio":for(u=0;u<Hs.length;u++)He(Hs[u],i);u=c;break;case"source":He("error",i),u=c;break;case"img":case"image":case"link":He("error",i),He("load",i),u=c;break;case"details":He("toggle",i),u=c;break;case"input":Ri(i,c),u=Tt(i,c),He("invalid",i);break;case"option":u=c;break;case"select":i._wrapperState={wasMultiple:!!c.multiple},u=X({},c,{value:void 0}),He("invalid",i);break;case"textarea":ue(i,c),u=Ss(i,c),He("invalid",i);break;default:u=c}kl(o,u),k=u;for(m in k)if(k.hasOwnProperty(m)){var T=k[m];m==="style"?_u(i,T):m==="dangerouslySetInnerHTML"?(T=T?T.__html:void 0,T!=null&&pu(i,T)):m==="children"?typeof T=="string"?(o!=="textarea"||T!=="")&&Cs(i,T):typeof T=="number"&&Cs(i,""+T):m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&m!=="autoFocus"&&(l.hasOwnProperty(m)?T!=null&&m==="onScroll"&&He("scroll",i):T!=null&&$(i,m,T,S))}switch(o){case"input":ge(i),Pn(i,c,!1);break;case"textarea":ge(i),Mi(i);break;case"option":c.value!=null&&i.setAttribute("value",""+V(c.value));break;case"select":i.multiple=!!c.multiple,m=c.value,m!=null?pi(i,!!c.multiple,m,!1):c.defaultValue!=null&&pi(i,!!c.multiple,c.defaultValue,!0);break;default:typeof u.onClick=="function"&&(i.onclick=eo)}switch(o){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return kt(s),null;case 6:if(i&&s.stateNode!=null)Rf(i,s,i.memoizedProps,c);else{if(typeof c!="string"&&s.stateNode===null)throw Error(r(166));if(o=br(Xs.current),br(gi.current),lo(s)){if(c=s.stateNode,o=s.memoizedProps,c[_i]=s,(m=c.nodeValue!==o)&&(i=Ut,i!==null))switch(i.tag){case 3:Zn(c.nodeValue,o,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&Zn(c.nodeValue,o,(i.mode&1)!==0)}m&&(s.flags|=4)}else c=(o.nodeType===9?o:o.ownerDocument).createTextNode(c),c[_i]=s,s.stateNode=c}return kt(s),null;case 13:if(We(Ve),c=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(Ue&&Kt!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Dd(),ts(),s.flags|=98560,m=!1;else if(m=lo(s),c!==null&&c.dehydrated!==null){if(i===null){if(!m)throw Error(r(318));if(m=s.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(r(317));m[_i]=s}else ts(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;kt(s),m=!1}else ai!==null&&(ic(ai),ai=null),m=!0;if(!m)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=o,s):(c=c!==null,c!==(i!==null&&i.memoizedState!==null)&&c&&(s.child.flags|=8192,(s.mode&1)!==0&&(i===null||(Ve.current&1)!==0?ot===0&&(ot=3):nc())),s.updateQueue!==null&&(s.flags|=4),kt(s),null);case 4:return ns(),Ka(i,s),i===null&&Ws(s.stateNode.containerInfo),kt(s),null;case 10:return ya(s.type._context),kt(s),null;case 17:return At(s.type)&&io(),kt(s),null;case 19:if(We(Ve),m=s.memoizedState,m===null)return kt(s),null;if(c=(s.flags&128)!==0,S=m.rendering,S===null)if(c)en(m,!1);else{if(ot!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(S=po(i),S!==null){for(s.flags|=128,en(m,!1),c=S.updateQueue,c!==null&&(s.updateQueue=c,s.flags|=4),s.subtreeFlags=0,c=o,o=s.child;o!==null;)m=o,i=c,m.flags&=14680066,S=m.alternate,S===null?(m.childLanes=0,m.lanes=i,m.child=null,m.subtreeFlags=0,m.memoizedProps=null,m.memoizedState=null,m.updateQueue=null,m.dependencies=null,m.stateNode=null):(m.childLanes=S.childLanes,m.lanes=S.lanes,m.child=S.child,m.subtreeFlags=0,m.deletions=null,m.memoizedProps=S.memoizedProps,m.memoizedState=S.memoizedState,m.updateQueue=S.updateQueue,m.type=S.type,i=S.dependencies,m.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),o=o.sibling;return Fe(Ve,Ve.current&1|2),s.child}i=i.sibling}m.tail!==null&&Ze()>cs&&(s.flags|=128,c=!0,en(m,!1),s.lanes=4194304)}else{if(!c)if(i=po(S),i!==null){if(s.flags|=128,c=!0,o=i.updateQueue,o!==null&&(s.updateQueue=o,s.flags|=4),en(m,!0),m.tail===null&&m.tailMode==="hidden"&&!S.alternate&&!Ue)return kt(s),null}else 2*Ze()-m.renderingStartTime>cs&&o!==1073741824&&(s.flags|=128,c=!0,en(m,!1),s.lanes=4194304);m.isBackwards?(S.sibling=s.child,s.child=S):(o=m.last,o!==null?o.sibling=S:s.child=S,m.last=S)}return m.tail!==null?(s=m.tail,m.rendering=s,m.tail=s.sibling,m.renderingStartTime=Ze(),s.sibling=null,o=Ve.current,Fe(Ve,c?o&1|2:o&1),s):(kt(s),null);case 22:case 23:return sc(),c=s.memoizedState!==null,i!==null&&i.memoizedState!==null!==c&&(s.flags|=8192),c&&(s.mode&1)!==0?(Vt&1073741824)!==0&&(kt(s),s.subtreeFlags&6&&(s.flags|=8192)):kt(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function e0(i,s){switch(fa(s),s.tag){case 1:return At(s.type)&&io(),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return ns(),We(Bt),We(bt),Ea(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 5:return xa(s),null;case 13:if(We(Ve),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ts()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return We(Ve),null;case 4:return ns(),null;case 10:return ya(s.type._context),null;case 22:case 23:return sc(),null;case 24:return null;default:return null}}var bo=!1,Et=!1,t0=typeof WeakSet=="function"?WeakSet:Set,me=null;function ls(i,s){var o=i.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(c){Ge(i,s,c)}else o.current=null}function Va(i,s,o){try{o()}catch(c){Ge(i,s,c)}}var Mf=!1;function i0(i,s){if(sa=Wn,i=od(),Gl(i)){if("selectionStart"in i)var o={start:i.selectionStart,end:i.selectionEnd};else e:{o=(o=i.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var u=c.anchorOffset,m=c.focusNode;c=c.focusOffset;try{o.nodeType,m.nodeType}catch{o=null;break e}var S=0,k=-1,T=-1,G=0,ne=0,oe=i,se=null;t:for(;;){for(var fe;oe!==o||u!==0&&oe.nodeType!==3||(k=S+u),oe!==m||c!==0&&oe.nodeType!==3||(T=S+c),oe.nodeType===3&&(S+=oe.nodeValue.length),(fe=oe.firstChild)!==null;)se=oe,oe=fe;for(;;){if(oe===i)break t;if(se===o&&++G===u&&(k=S),se===m&&++ne===c&&(T=S),(fe=oe.nextSibling)!==null)break;oe=se,se=oe.parentNode}oe=fe}o=k===-1||T===-1?null:{start:k,end:T}}else o=null}o=o||{start:0,end:0}}else o=null;for(na={focusedElem:i,selectionRange:o},Wn=!1,me=s;me!==null;)if(s=me,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,me=i;else for(;me!==null;){s=me;try{var _e=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var ye=_e.memoizedProps,et=_e.memoizedState,q=s.stateNode,F=q.getSnapshotBeforeUpdate(s.elementType===s.type?ye:ci(s.type,ye),et);q.__reactInternalSnapshotBeforeUpdate=F}break;case 3:var Y=s.stateNode.containerInfo;Y.nodeType===1?Y.textContent="":Y.nodeType===9&&Y.documentElement&&Y.removeChild(Y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(le){Ge(s,s.return,le)}if(i=s.sibling,i!==null){i.return=s.return,me=i;break}me=s.return}return _e=Mf,Mf=!1,_e}function tn(i,s,o){var c=s.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var u=c=c.next;do{if((u.tag&i)===i){var m=u.destroy;u.destroy=void 0,m!==void 0&&Va(s,o,m)}u=u.next}while(u!==c)}}function xo(i,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var o=s=s.next;do{if((o.tag&i)===i){var c=o.create;o.destroy=c()}o=o.next}while(o!==s)}}function qa(i){var s=i.ref;if(s!==null){var o=i.stateNode;switch(i.tag){case 5:i=o;break;default:i=o}typeof s=="function"?s(i):s.current=i}}function Df(i){var s=i.alternate;s!==null&&(i.alternate=null,Df(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&(delete s[_i],delete s[Us],delete s[ca],delete s[Iv],delete s[zv])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function Pf(i){return i.tag===5||i.tag===3||i.tag===4}function Lf(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Pf(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Ya(i,s,o){var c=i.tag;if(c===5||c===6)i=i.stateNode,s?o.nodeType===8?o.parentNode.insertBefore(i,s):o.insertBefore(i,s):(o.nodeType===8?(s=o.parentNode,s.insertBefore(i,o)):(s=o,s.appendChild(i)),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=eo));else if(c!==4&&(i=i.child,i!==null))for(Ya(i,s,o),i=i.sibling;i!==null;)Ya(i,s,o),i=i.sibling}function Xa(i,s,o){var c=i.tag;if(c===5||c===6)i=i.stateNode,s?o.insertBefore(i,s):o.appendChild(i);else if(c!==4&&(i=i.child,i!==null))for(Xa(i,s,o),i=i.sibling;i!==null;)Xa(i,s,o),i=i.sibling}var yt=null,hi=!1;function ir(i,s,o){for(o=o.child;o!==null;)Tf(i,s,o),o=o.sibling}function Tf(i,s,o){if(mi&&typeof mi.onCommitFiberUnmount=="function")try{mi.onCommitFiberUnmount(jn,o)}catch{}switch(o.tag){case 5:Et||ls(o,s);case 6:var c=yt,u=hi;yt=null,ir(i,s,o),yt=c,hi=u,yt!==null&&(hi?(i=yt,o=o.stateNode,i.nodeType===8?i.parentNode.removeChild(o):i.removeChild(o)):yt.removeChild(o.stateNode));break;case 18:yt!==null&&(hi?(i=yt,o=o.stateNode,i.nodeType===8?aa(i.parentNode,o):i.nodeType===1&&aa(i,o),Ts(i)):aa(yt,o.stateNode));break;case 4:c=yt,u=hi,yt=o.stateNode.containerInfo,hi=!0,ir(i,s,o),yt=c,hi=u;break;case 0:case 11:case 14:case 15:if(!Et&&(c=o.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){u=c=c.next;do{var m=u,S=m.destroy;m=m.tag,S!==void 0&&((m&2)!==0||(m&4)!==0)&&Va(o,s,S),u=u.next}while(u!==c)}ir(i,s,o);break;case 1:if(!Et&&(ls(o,s),c=o.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=o.memoizedProps,c.state=o.memoizedState,c.componentWillUnmount()}catch(k){Ge(o,s,k)}ir(i,s,o);break;case 21:ir(i,s,o);break;case 22:o.mode&1?(Et=(c=Et)||o.memoizedState!==null,ir(i,s,o),Et=c):ir(i,s,o);break;default:ir(i,s,o)}}function Bf(i){var s=i.updateQueue;if(s!==null){i.updateQueue=null;var o=i.stateNode;o===null&&(o=i.stateNode=new t0),s.forEach(function(c){var u=u0.bind(null,i,c);o.has(c)||(o.add(c),c.then(u,u))})}}function ui(i,s){var o=s.deletions;if(o!==null)for(var c=0;c<o.length;c++){var u=o[c];try{var m=i,S=s,k=S;e:for(;k!==null;){switch(k.tag){case 5:yt=k.stateNode,hi=!1;break e;case 3:yt=k.stateNode.containerInfo,hi=!0;break e;case 4:yt=k.stateNode.containerInfo,hi=!0;break e}k=k.return}if(yt===null)throw Error(r(160));Tf(m,S,u),yt=null,hi=!1;var T=u.alternate;T!==null&&(T.return=null),u.return=null}catch(G){Ge(u,s,G)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Af(s,i),s=s.sibling}function Af(i,s){var o=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(ui(s,i),yi(i),c&4){try{tn(3,i,i.return),xo(3,i)}catch(ye){Ge(i,i.return,ye)}try{tn(5,i,i.return)}catch(ye){Ge(i,i.return,ye)}}break;case 1:ui(s,i),yi(i),c&512&&o!==null&&ls(o,o.return);break;case 5:if(ui(s,i),yi(i),c&512&&o!==null&&ls(o,o.return),i.flags&32){var u=i.stateNode;try{Cs(u,"")}catch(ye){Ge(i,i.return,ye)}}if(c&4&&(u=i.stateNode,u!=null)){var m=i.memoizedProps,S=o!==null?o.memoizedProps:m,k=i.type,T=i.updateQueue;if(i.updateQueue=null,T!==null)try{k==="input"&&m.type==="radio"&&m.name!=null&&$i(u,m),El(k,S);var G=El(k,m);for(S=0;S<T.length;S+=2){var ne=T[S],oe=T[S+1];ne==="style"?_u(u,oe):ne==="dangerouslySetInnerHTML"?pu(u,oe):ne==="children"?Cs(u,oe):$(u,ne,oe,G)}switch(k){case"input":vs(u,m);break;case"textarea":Re(u,m);break;case"select":var se=u._wrapperState.wasMultiple;u._wrapperState.wasMultiple=!!m.multiple;var fe=m.value;fe!=null?pi(u,!!m.multiple,fe,!1):se!==!!m.multiple&&(m.defaultValue!=null?pi(u,!!m.multiple,m.defaultValue,!0):pi(u,!!m.multiple,m.multiple?[]:"",!1))}u[Us]=m}catch(ye){Ge(i,i.return,ye)}}break;case 6:if(ui(s,i),yi(i),c&4){if(i.stateNode===null)throw Error(r(162));u=i.stateNode,m=i.memoizedProps;try{u.nodeValue=m}catch(ye){Ge(i,i.return,ye)}}break;case 3:if(ui(s,i),yi(i),c&4&&o!==null&&o.memoizedState.isDehydrated)try{Ts(s.containerInfo)}catch(ye){Ge(i,i.return,ye)}break;case 4:ui(s,i),yi(i);break;case 13:ui(s,i),yi(i),u=i.child,u.flags&8192&&(m=u.memoizedState!==null,u.stateNode.isHidden=m,!m||u.alternate!==null&&u.alternate.memoizedState!==null||(Ja=Ze())),c&4&&Bf(i);break;case 22:if(ne=o!==null&&o.memoizedState!==null,i.mode&1?(Et=(G=Et)||ne,ui(s,i),Et=G):ui(s,i),yi(i),c&8192){if(G=i.memoizedState!==null,(i.stateNode.isHidden=G)&&!ne&&(i.mode&1)!==0)for(me=i,ne=i.child;ne!==null;){for(oe=me=ne;me!==null;){switch(se=me,fe=se.child,se.tag){case 0:case 11:case 14:case 15:tn(4,se,se.return);break;case 1:ls(se,se.return);var _e=se.stateNode;if(typeof _e.componentWillUnmount=="function"){c=se,o=se.return;try{s=c,_e.props=s.memoizedProps,_e.state=s.memoizedState,_e.componentWillUnmount()}catch(ye){Ge(c,o,ye)}}break;case 5:ls(se,se.return);break;case 22:if(se.memoizedState!==null){If(oe);continue}}fe!==null?(fe.return=se,me=fe):If(oe)}ne=ne.sibling}e:for(ne=null,oe=i;;){if(oe.tag===5){if(ne===null){ne=oe;try{u=oe.stateNode,G?(m=u.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none"):(k=oe.stateNode,T=oe.memoizedProps.style,S=T!=null&&T.hasOwnProperty("display")?T.display:null,k.style.display=mu("display",S))}catch(ye){Ge(i,i.return,ye)}}}else if(oe.tag===6){if(ne===null)try{oe.stateNode.nodeValue=G?"":oe.memoizedProps}catch(ye){Ge(i,i.return,ye)}}else if((oe.tag!==22&&oe.tag!==23||oe.memoizedState===null||oe===i)&&oe.child!==null){oe.child.return=oe,oe=oe.child;continue}if(oe===i)break e;for(;oe.sibling===null;){if(oe.return===null||oe.return===i)break e;ne===oe&&(ne=null),oe=oe.return}ne===oe&&(ne=null),oe.sibling.return=oe.return,oe=oe.sibling}}break;case 19:ui(s,i),yi(i),c&4&&Bf(i);break;case 21:break;default:ui(s,i),yi(i)}}function yi(i){var s=i.flags;if(s&2){try{e:{for(var o=i.return;o!==null;){if(Pf(o)){var c=o;break e}o=o.return}throw Error(r(160))}switch(c.tag){case 5:var u=c.stateNode;c.flags&32&&(Cs(u,""),c.flags&=-33);var m=Lf(i);Xa(i,m,u);break;case 3:case 4:var S=c.stateNode.containerInfo,k=Lf(i);Ya(i,k,S);break;default:throw Error(r(161))}}catch(T){Ge(i,i.return,T)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function r0(i,s,o){me=i,jf(i)}function jf(i,s,o){for(var c=(i.mode&1)!==0;me!==null;){var u=me,m=u.child;if(u.tag===22&&c){var S=u.memoizedState!==null||bo;if(!S){var k=u.alternate,T=k!==null&&k.memoizedState!==null||Et;k=bo;var G=Et;if(bo=S,(Et=T)&&!G)for(me=u;me!==null;)S=me,T=S.child,S.tag===22&&S.memoizedState!==null?zf(u):T!==null?(T.return=S,me=T):zf(u);for(;m!==null;)me=m,jf(m),m=m.sibling;me=u,bo=k,Et=G}Of(i)}else(u.subtreeFlags&8772)!==0&&m!==null?(m.return=u,me=m):Of(i)}}function Of(i){for(;me!==null;){var s=me;if((s.flags&8772)!==0){var o=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Et||xo(5,s);break;case 1:var c=s.stateNode;if(s.flags&4&&!Et)if(o===null)c.componentDidMount();else{var u=s.elementType===s.type?o.memoizedProps:ci(s.type,o.memoizedProps);c.componentDidUpdate(u,o.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var m=s.updateQueue;m!==null&&Od(s,m,c);break;case 3:var S=s.updateQueue;if(S!==null){if(o=null,s.child!==null)switch(s.child.tag){case 5:o=s.child.stateNode;break;case 1:o=s.child.stateNode}Od(s,S,o)}break;case 5:var k=s.stateNode;if(o===null&&s.flags&4){o=k;var T=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":T.autoFocus&&o.focus();break;case"img":T.src&&(o.src=T.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var G=s.alternate;if(G!==null){var ne=G.memoizedState;if(ne!==null){var oe=ne.dehydrated;oe!==null&&Ts(oe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Et||s.flags&512&&qa(s)}catch(se){Ge(s,s.return,se)}}if(s===i){me=null;break}if(o=s.sibling,o!==null){o.return=s.return,me=o;break}me=s.return}}function If(i){for(;me!==null;){var s=me;if(s===i){me=null;break}var o=s.sibling;if(o!==null){o.return=s.return,me=o;break}me=s.return}}function zf(i){for(;me!==null;){var s=me;try{switch(s.tag){case 0:case 11:case 15:var o=s.return;try{xo(4,s)}catch(T){Ge(s,o,T)}break;case 1:var c=s.stateNode;if(typeof c.componentDidMount=="function"){var u=s.return;try{c.componentDidMount()}catch(T){Ge(s,u,T)}}var m=s.return;try{qa(s)}catch(T){Ge(s,m,T)}break;case 5:var S=s.return;try{qa(s)}catch(T){Ge(s,S,T)}}}catch(T){Ge(s,s.return,T)}if(s===i){me=null;break}var k=s.sibling;if(k!==null){k.return=s.return,me=k;break}me=s.return}}var s0=Math.ceil,ko=P.ReactCurrentDispatcher,Ga=P.ReactCurrentOwner,ei=P.ReactCurrentBatchConfig,Be=0,ut=null,it=null,St=0,Vt=0,as=Qi(0),ot=0,rn=null,kr=0,Eo=0,Qa=0,sn=null,Ot=null,Ja=0,cs=1/0,Oi=null,No=!1,Za=null,rr=null,Ro=!1,sr=null,Mo=0,nn=0,ec=null,Do=-1,Po=0;function Mt(){return(Be&6)!==0?Ze():Do!==-1?Do:Do=Ze()}function nr(i){return(i.mode&1)===0?1:(Be&2)!==0&&St!==0?St&-St:Hv.transition!==null?(Po===0&&(Po=Pu()),Po):(i=Oe,i!==0||(i=window.event,i=i===void 0?16:Fu(i.type)),i)}function di(i,s,o,c){if(50<nn)throw nn=0,ec=null,Error(r(185));Rs(i,o,c),((Be&2)===0||i!==ut)&&(i===ut&&((Be&2)===0&&(Eo|=o),ot===4&&or(i,St)),It(i,c),o===1&&Be===0&&(s.mode&1)===0&&(cs=Ze()+500,so&&Zi()))}function It(i,s){var o=i.callbackNode;Hg(i,s);var c=zn(i,i===ut?St:0);if(c===0)o!==null&&Ru(o),i.callbackNode=null,i.callbackPriority=0;else if(s=c&-c,i.callbackPriority!==s){if(o!=null&&Ru(o),s===1)i.tag===0?Fv(Hf.bind(null,i)):kd(Hf.bind(null,i)),jv(function(){(Be&6)===0&&Zi()}),o=null;else{switch(Lu(c)){case 1:o=Tl;break;case 4:o=Mu;break;case 16:o=An;break;case 536870912:o=Du;break;default:o=An}o=Xf(o,Ff.bind(null,i))}i.callbackPriority=s,i.callbackNode=o}}function Ff(i,s){if(Do=-1,Po=0,(Be&6)!==0)throw Error(r(327));var o=i.callbackNode;if(hs()&&i.callbackNode!==o)return null;var c=zn(i,i===ut?St:0);if(c===0)return null;if((c&30)!==0||(c&i.expiredLanes)!==0||s)s=Lo(i,c);else{s=c;var u=Be;Be|=2;var m=$f();(ut!==i||St!==s)&&(Oi=null,cs=Ze()+500,Nr(i,s));do try{l0();break}catch(k){Wf(i,k)}while(!0);va(),ko.current=m,Be=u,it!==null?s=0:(ut=null,St=0,s=ot)}if(s!==0){if(s===2&&(u=Bl(i),u!==0&&(c=u,s=tc(i,u))),s===1)throw o=rn,Nr(i,0),or(i,c),It(i,Ze()),o;if(s===6)or(i,c);else{if(u=i.current.alternate,(c&30)===0&&!n0(u)&&(s=Lo(i,c),s===2&&(m=Bl(i),m!==0&&(c=m,s=tc(i,m))),s===1))throw o=rn,Nr(i,0),or(i,c),It(i,Ze()),o;switch(i.finishedWork=u,i.finishedLanes=c,s){case 0:case 1:throw Error(r(345));case 2:Rr(i,Ot,Oi);break;case 3:if(or(i,c),(c&130023424)===c&&(s=Ja+500-Ze(),10<s)){if(zn(i,0)!==0)break;if(u=i.suspendedLanes,(u&c)!==c){Mt(),i.pingedLanes|=i.suspendedLanes&u;break}i.timeoutHandle=la(Rr.bind(null,i,Ot,Oi),s);break}Rr(i,Ot,Oi);break;case 4:if(or(i,c),(c&4194240)===c)break;for(s=i.eventTimes,u=-1;0<c;){var S=31-oi(c);m=1<<S,S=s[S],S>u&&(u=S),c&=~m}if(c=u,c=Ze()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*s0(c/1960))-c,10<c){i.timeoutHandle=la(Rr.bind(null,i,Ot,Oi),c);break}Rr(i,Ot,Oi);break;case 5:Rr(i,Ot,Oi);break;default:throw Error(r(329))}}}return It(i,Ze()),i.callbackNode===o?Ff.bind(null,i):null}function tc(i,s){var o=sn;return i.current.memoizedState.isDehydrated&&(Nr(i,s).flags|=256),i=Lo(i,s),i!==2&&(s=Ot,Ot=o,s!==null&&ic(s)),i}function ic(i){Ot===null?Ot=i:Ot.push.apply(Ot,i)}function n0(i){for(var s=i;;){if(s.flags&16384){var o=s.updateQueue;if(o!==null&&(o=o.stores,o!==null))for(var c=0;c<o.length;c++){var u=o[c],m=u.getSnapshot;u=u.value;try{if(!li(m(),u))return!1}catch{return!1}}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function or(i,s){for(s&=~Qa,s&=~Eo,i.suspendedLanes|=s,i.pingedLanes&=~s,i=i.expirationTimes;0<s;){var o=31-oi(s),c=1<<o;i[o]=-1,s&=~c}}function Hf(i){if((Be&6)!==0)throw Error(r(327));hs();var s=zn(i,0);if((s&1)===0)return It(i,Ze()),null;var o=Lo(i,s);if(i.tag!==0&&o===2){var c=Bl(i);c!==0&&(s=c,o=tc(i,c))}if(o===1)throw o=rn,Nr(i,0),or(i,s),It(i,Ze()),o;if(o===6)throw Error(r(345));return i.finishedWork=i.current.alternate,i.finishedLanes=s,Rr(i,Ot,Oi),It(i,Ze()),null}function rc(i,s){var o=Be;Be|=1;try{return i(s)}finally{Be=o,Be===0&&(cs=Ze()+500,so&&Zi())}}function Er(i){sr!==null&&sr.tag===0&&(Be&6)===0&&hs();var s=Be;Be|=1;var o=ei.transition,c=Oe;try{if(ei.transition=null,Oe=1,i)return i()}finally{Oe=c,ei.transition=o,Be=s,(Be&6)===0&&Zi()}}function sc(){Vt=as.current,We(as)}function Nr(i,s){i.finishedWork=null,i.finishedLanes=0;var o=i.timeoutHandle;if(o!==-1&&(i.timeoutHandle=-1,Av(o)),it!==null)for(o=it.return;o!==null;){var c=o;switch(fa(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&io();break;case 3:ns(),We(Bt),We(bt),Ea();break;case 5:xa(c);break;case 4:ns();break;case 13:We(Ve);break;case 19:We(Ve);break;case 10:ya(c.type._context);break;case 22:case 23:sc()}o=o.return}if(ut=i,it=i=lr(i.current,null),St=Vt=s,ot=0,rn=null,Qa=Eo=kr=0,Ot=sn=null,Cr!==null){for(s=0;s<Cr.length;s++)if(o=Cr[s],c=o.interleaved,c!==null){o.interleaved=null;var u=c.next,m=o.pending;if(m!==null){var S=m.next;m.next=u,c.next=S}o.pending=c}Cr=null}return i}function Wf(i,s){do{var o=it;try{if(va(),mo.current=yo,_o){for(var c=qe.memoizedState;c!==null;){var u=c.queue;u!==null&&(u.pending=null),c=c.next}_o=!1}if(xr=0,ht=nt=qe=null,Gs=!1,Qs=0,Ga.current=null,o===null||o.return===null){ot=1,rn=s,it=null;break}e:{var m=i,S=o.return,k=o,T=s;if(s=St,k.flags|=32768,T!==null&&typeof T=="object"&&typeof T.then=="function"){var G=T,ne=k,oe=ne.tag;if((ne.mode&1)===0&&(oe===0||oe===11||oe===15)){var se=ne.alternate;se?(ne.updateQueue=se.updateQueue,ne.memoizedState=se.memoizedState,ne.lanes=se.lanes):(ne.updateQueue=null,ne.memoizedState=null)}var fe=ff(S);if(fe!==null){fe.flags&=-257,pf(fe,S,k,m,s),fe.mode&1&&df(m,G,s),s=fe,T=G;var _e=s.updateQueue;if(_e===null){var ye=new Set;ye.add(T),s.updateQueue=ye}else _e.add(T);break e}else{if((s&1)===0){df(m,G,s),nc();break e}T=Error(r(426))}}else if(Ue&&k.mode&1){var et=ff(S);if(et!==null){(et.flags&65536)===0&&(et.flags|=256),pf(et,S,k,m,s),_a(os(T,k));break e}}m=T=os(T,k),ot!==4&&(ot=2),sn===null?sn=[m]:sn.push(m),m=S;do{switch(m.tag){case 3:m.flags|=65536,s&=-s,m.lanes|=s;var q=hf(m,T,s);jd(m,q);break e;case 1:k=T;var F=m.type,Y=m.stateNode;if((m.flags&128)===0&&(typeof F.getDerivedStateFromError=="function"||Y!==null&&typeof Y.componentDidCatch=="function"&&(rr===null||!rr.has(Y)))){m.flags|=65536,s&=-s,m.lanes|=s;var le=uf(m,k,s);jd(m,le);break e}}m=m.return}while(m!==null)}Kf(o)}catch(Se){s=Se,it===o&&o!==null&&(it=o=o.return);continue}break}while(!0)}function $f(){var i=ko.current;return ko.current=yo,i===null?yo:i}function nc(){(ot===0||ot===3||ot===2)&&(ot=4),ut===null||(kr&268435455)===0&&(Eo&268435455)===0||or(ut,St)}function Lo(i,s){var o=Be;Be|=2;var c=$f();(ut!==i||St!==s)&&(Oi=null,Nr(i,s));do try{o0();break}catch(u){Wf(i,u)}while(!0);if(va(),Be=o,ko.current=c,it!==null)throw Error(r(261));return ut=null,St=0,ot}function o0(){for(;it!==null;)Uf(it)}function l0(){for(;it!==null&&!Lg();)Uf(it)}function Uf(i){var s=Yf(i.alternate,i,Vt);i.memoizedProps=i.pendingProps,s===null?Kf(i):it=s,Ga.current=null}function Kf(i){var s=i;do{var o=s.alternate;if(i=s.return,(s.flags&32768)===0){if(o=Zv(o,s,Vt),o!==null){it=o;return}}else{if(o=e0(o,s),o!==null){o.flags&=32767,it=o;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{ot=6,it=null;return}}if(s=s.sibling,s!==null){it=s;return}it=s=i}while(s!==null);ot===0&&(ot=5)}function Rr(i,s,o){var c=Oe,u=ei.transition;try{ei.transition=null,Oe=1,a0(i,s,o,c)}finally{ei.transition=u,Oe=c}return null}function a0(i,s,o,c){do hs();while(sr!==null);if((Be&6)!==0)throw Error(r(327));o=i.finishedWork;var u=i.finishedLanes;if(o===null)return null;if(i.finishedWork=null,i.finishedLanes=0,o===i.current)throw Error(r(177));i.callbackNode=null,i.callbackPriority=0;var m=o.lanes|o.childLanes;if(Wg(i,m),i===ut&&(it=ut=null,St=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||Ro||(Ro=!0,Xf(An,function(){return hs(),null})),m=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||m){m=ei.transition,ei.transition=null;var S=Oe;Oe=1;var k=Be;Be|=4,Ga.current=null,i0(i,o),Af(o,i),Rv(na),Wn=!!sa,na=sa=null,i.current=o,r0(o),Tg(),Be=k,Oe=S,ei.transition=m}else i.current=o;if(Ro&&(Ro=!1,sr=i,Mo=u),m=i.pendingLanes,m===0&&(rr=null),jg(o.stateNode),It(i,Ze()),s!==null)for(c=i.onRecoverableError,o=0;o<s.length;o++)u=s[o],c(u.value,{componentStack:u.stack,digest:u.digest});if(No)throw No=!1,i=Za,Za=null,i;return(Mo&1)!==0&&i.tag!==0&&hs(),m=i.pendingLanes,(m&1)!==0?i===ec?nn++:(nn=0,ec=i):nn=0,Zi(),null}function hs(){if(sr!==null){var i=Lu(Mo),s=ei.transition,o=Oe;try{if(ei.transition=null,Oe=16>i?16:i,sr===null)var c=!1;else{if(i=sr,sr=null,Mo=0,(Be&6)!==0)throw Error(r(331));var u=Be;for(Be|=4,me=i.current;me!==null;){var m=me,S=m.child;if((me.flags&16)!==0){var k=m.deletions;if(k!==null){for(var T=0;T<k.length;T++){var G=k[T];for(me=G;me!==null;){var ne=me;switch(ne.tag){case 0:case 11:case 15:tn(8,ne,m)}var oe=ne.child;if(oe!==null)oe.return=ne,me=oe;else for(;me!==null;){ne=me;var se=ne.sibling,fe=ne.return;if(Df(ne),ne===G){me=null;break}if(se!==null){se.return=fe,me=se;break}me=fe}}}var _e=m.alternate;if(_e!==null){var ye=_e.child;if(ye!==null){_e.child=null;do{var et=ye.sibling;ye.sibling=null,ye=et}while(ye!==null)}}me=m}}if((m.subtreeFlags&2064)!==0&&S!==null)S.return=m,me=S;else e:for(;me!==null;){if(m=me,(m.flags&2048)!==0)switch(m.tag){case 0:case 11:case 15:tn(9,m,m.return)}var q=m.sibling;if(q!==null){q.return=m.return,me=q;break e}me=m.return}}var F=i.current;for(me=F;me!==null;){S=me;var Y=S.child;if((S.subtreeFlags&2064)!==0&&Y!==null)Y.return=S,me=Y;else e:for(S=F;me!==null;){if(k=me,(k.flags&2048)!==0)try{switch(k.tag){case 0:case 11:case 15:xo(9,k)}}catch(Se){Ge(k,k.return,Se)}if(k===S){me=null;break e}var le=k.sibling;if(le!==null){le.return=k.return,me=le;break e}me=k.return}}if(Be=u,Zi(),mi&&typeof mi.onPostCommitFiberRoot=="function")try{mi.onPostCommitFiberRoot(jn,i)}catch{}c=!0}return c}finally{Oe=o,ei.transition=s}}return!1}function Vf(i,s,o){s=os(o,s),s=hf(i,s,1),i=tr(i,s,1),s=Mt(),i!==null&&(Rs(i,1,s),It(i,s))}function Ge(i,s,o){if(i.tag===3)Vf(i,i,o);else for(;s!==null;){if(s.tag===3){Vf(s,i,o);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(rr===null||!rr.has(c))){i=os(o,i),i=uf(s,i,1),s=tr(s,i,1),i=Mt(),s!==null&&(Rs(s,1,i),It(s,i));break}}s=s.return}}function c0(i,s,o){var c=i.pingCache;c!==null&&c.delete(s),s=Mt(),i.pingedLanes|=i.suspendedLanes&o,ut===i&&(St&o)===o&&(ot===4||ot===3&&(St&130023424)===St&&500>Ze()-Ja?Nr(i,0):Qa|=o),It(i,s)}function qf(i,s){s===0&&((i.mode&1)===0?s=1:(s=In,In<<=1,(In&130023424)===0&&(In=4194304)));var o=Mt();i=Bi(i,s),i!==null&&(Rs(i,s,o),It(i,o))}function h0(i){var s=i.memoizedState,o=0;s!==null&&(o=s.retryLane),qf(i,o)}function u0(i,s){var o=0;switch(i.tag){case 13:var c=i.stateNode,u=i.memoizedState;u!==null&&(o=u.retryLane);break;case 19:c=i.stateNode;break;default:throw Error(r(314))}c!==null&&c.delete(s),qf(i,o)}var Yf;Yf=function(i,s,o){if(i!==null)if(i.memoizedProps!==s.pendingProps||Bt.current)jt=!0;else{if((i.lanes&o)===0&&(s.flags&128)===0)return jt=!1,Jv(i,s,o);jt=(i.flags&131072)!==0}else jt=!1,Ue&&(s.flags&1048576)!==0&&Ed(s,oo,s.index);switch(s.lanes=0,s.tag){case 2:var c=s.type;Co(i,s),i=s.pendingProps;var u=Jr(s,bt.current);ss(s,o),u=Ma(null,s,c,i,u,o);var m=Da();return s.flags|=1,typeof u=="object"&&u!==null&&typeof u.render=="function"&&u.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,At(c)?(m=!0,ro(s)):m=!1,s.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,Ca(s),u.updater=So,s.stateNode=u,u._reactInternals=s,ja(s,c,i,o),s=Fa(null,s,c,!0,m,o)):(s.tag=0,Ue&&m&&da(s),Rt(null,s,u,o),s=s.child),s;case 16:c=s.elementType;e:{switch(Co(i,s),i=s.pendingProps,u=c._init,c=u(c._payload),s.type=c,u=s.tag=f0(c),i=ci(c,i),u){case 0:s=za(null,s,c,i,o);break e;case 1:s=Sf(null,s,c,i,o);break e;case 11:s=mf(null,s,c,i,o);break e;case 14:s=_f(null,s,c,ci(c.type,i),o);break e}throw Error(r(306,c,""))}return s;case 0:return c=s.type,u=s.pendingProps,u=s.elementType===c?u:ci(c,u),za(i,s,c,u,o);case 1:return c=s.type,u=s.pendingProps,u=s.elementType===c?u:ci(c,u),Sf(i,s,c,u,o);case 3:e:{if(wf(s),i===null)throw Error(r(387));c=s.pendingProps,m=s.memoizedState,u=m.element,Ad(i,s),fo(s,c,null,o);var S=s.memoizedState;if(c=S.element,m.isDehydrated)if(m={element:c,isDehydrated:!1,cache:S.cache,pendingSuspenseBoundaries:S.pendingSuspenseBoundaries,transitions:S.transitions},s.updateQueue.baseState=m,s.memoizedState=m,s.flags&256){u=os(Error(r(423)),s),s=Cf(i,s,c,o,u);break e}else if(c!==u){u=os(Error(r(424)),s),s=Cf(i,s,c,o,u);break e}else for(Kt=Gi(s.stateNode.containerInfo.firstChild),Ut=s,Ue=!0,ai=null,o=Td(s,null,c,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ts(),c===u){s=ji(i,s,o);break e}Rt(i,s,c,o)}s=s.child}return s;case 5:return Id(s),i===null&&ma(s),c=s.type,u=s.pendingProps,m=i!==null?i.memoizedProps:null,S=u.children,oa(c,u)?S=null:m!==null&&oa(c,m)&&(s.flags|=32),yf(i,s),Rt(i,s,S,o),s.child;case 6:return i===null&&ma(s),null;case 13:return bf(i,s,o);case 4:return ba(s,s.stateNode.containerInfo),c=s.pendingProps,i===null?s.child=is(s,null,c,o):Rt(i,s,c,o),s.child;case 11:return c=s.type,u=s.pendingProps,u=s.elementType===c?u:ci(c,u),mf(i,s,c,u,o);case 7:return Rt(i,s,s.pendingProps,o),s.child;case 8:return Rt(i,s,s.pendingProps.children,o),s.child;case 12:return Rt(i,s,s.pendingProps.children,o),s.child;case 10:e:{if(c=s.type._context,u=s.pendingProps,m=s.memoizedProps,S=u.value,Fe(co,c._currentValue),c._currentValue=S,m!==null)if(li(m.value,S)){if(m.children===u.children&&!Bt.current){s=ji(i,s,o);break e}}else for(m=s.child,m!==null&&(m.return=s);m!==null;){var k=m.dependencies;if(k!==null){S=m.child;for(var T=k.firstContext;T!==null;){if(T.context===c){if(m.tag===1){T=Ai(-1,o&-o),T.tag=2;var G=m.updateQueue;if(G!==null){G=G.shared;var ne=G.pending;ne===null?T.next=T:(T.next=ne.next,ne.next=T),G.pending=T}}m.lanes|=o,T=m.alternate,T!==null&&(T.lanes|=o),Sa(m.return,o,s),k.lanes|=o;break}T=T.next}}else if(m.tag===10)S=m.type===s.type?null:m.child;else if(m.tag===18){if(S=m.return,S===null)throw Error(r(341));S.lanes|=o,k=S.alternate,k!==null&&(k.lanes|=o),Sa(S,o,s),S=m.sibling}else S=m.child;if(S!==null)S.return=m;else for(S=m;S!==null;){if(S===s){S=null;break}if(m=S.sibling,m!==null){m.return=S.return,S=m;break}S=S.return}m=S}Rt(i,s,u.children,o),s=s.child}return s;case 9:return u=s.type,c=s.pendingProps.children,ss(s,o),u=Jt(u),c=c(u),s.flags|=1,Rt(i,s,c,o),s.child;case 14:return c=s.type,u=ci(c,s.pendingProps),u=ci(c.type,u),_f(i,s,c,u,o);case 15:return gf(i,s,s.type,s.pendingProps,o);case 17:return c=s.type,u=s.pendingProps,u=s.elementType===c?u:ci(c,u),Co(i,s),s.tag=1,At(c)?(i=!0,ro(s)):i=!1,ss(s,o),af(s,c,u),ja(s,c,u,o),Fa(null,s,c,!0,i,o);case 19:return kf(i,s,o);case 22:return vf(i,s,o)}throw Error(r(156,s.tag))};function Xf(i,s){return Nu(i,s)}function d0(i,s,o,c){this.tag=i,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(i,s,o,c){return new d0(i,s,o,c)}function oc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function f0(i){if(typeof i=="function")return oc(i)?1:0;if(i!=null){if(i=i.$$typeof,i===H)return 11;if(i===ee)return 14}return 2}function lr(i,s){var o=i.alternate;return o===null?(o=ti(i.tag,s,i.key,i.mode),o.elementType=i.elementType,o.type=i.type,o.stateNode=i.stateNode,o.alternate=i,i.alternate=o):(o.pendingProps=s,o.type=i.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=i.flags&14680064,o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,s=i.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=i.sibling,o.index=i.index,o.ref=i.ref,o}function To(i,s,o,c,u,m){var S=2;if(c=i,typeof i=="function")oc(i)&&(S=1);else if(typeof i=="string")S=5;else e:switch(i){case M:return Mr(o.children,u,m,s);case N:S=8,u|=8;break;case j:return i=ti(12,o,s,u|2),i.elementType=j,i.lanes=m,i;case O:return i=ti(13,o,s,u),i.elementType=O,i.lanes=m,i;case K:return i=ti(19,o,s,u),i.elementType=K,i.lanes=m,i;case L:return Bo(o,u,m,s);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case I:S=10;break e;case U:S=9;break e;case H:S=11;break e;case ee:S=14;break e;case Z:S=16,c=null;break e}throw Error(r(130,i==null?i:typeof i,""))}return s=ti(S,o,s,u),s.elementType=i,s.type=c,s.lanes=m,s}function Mr(i,s,o,c){return i=ti(7,i,c,s),i.lanes=o,i}function Bo(i,s,o,c){return i=ti(22,i,c,s),i.elementType=L,i.lanes=o,i.stateNode={isHidden:!1},i}function lc(i,s,o){return i=ti(6,i,null,s),i.lanes=o,i}function ac(i,s,o){return s=ti(4,i.children!==null?i.children:[],i.key,s),s.lanes=o,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}function p0(i,s,o,c,u){this.tag=s,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Al(0),this.expirationTimes=Al(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Al(0),this.identifierPrefix=c,this.onRecoverableError=u,this.mutableSourceEagerHydrationData=null}function cc(i,s,o,c,u,m,S,k,T){return i=new p0(i,s,o,k,T),s===1?(s=1,m===!0&&(s|=8)):s=0,m=ti(3,null,null,s),i.current=m,m.stateNode=i,m.memoizedState={element:c,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ca(m),i}function m0(i,s,o){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:A,key:c==null?null:""+c,children:i,containerInfo:s,implementation:o}}function Gf(i){if(!i)return Ji;i=i._reactInternals;e:{if(gr(i)!==i||i.tag!==1)throw Error(r(170));var s=i;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(At(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(i.tag===1){var o=i.type;if(At(o))return bd(i,o,s)}return s}function Qf(i,s,o,c,u,m,S,k,T){return i=cc(o,c,!0,i,u,m,S,k,T),i.context=Gf(null),o=i.current,c=Mt(),u=nr(o),m=Ai(c,u),m.callback=s??null,tr(o,m,u),i.current.lanes=u,Rs(i,u,c),It(i,c),i}function Ao(i,s,o,c){var u=s.current,m=Mt(),S=nr(u);return o=Gf(o),s.context===null?s.context=o:s.pendingContext=o,s=Ai(m,S),s.payload={element:i},c=c===void 0?null:c,c!==null&&(s.callback=c),i=tr(u,s,S),i!==null&&(di(i,u,S,m),uo(i,u,S)),S}function jo(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function Jf(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var o=i.retryLane;i.retryLane=o!==0&&o<s?o:s}}function hc(i,s){Jf(i,s),(i=i.alternate)&&Jf(i,s)}function _0(){return null}var Zf=typeof reportError=="function"?reportError:function(i){console.error(i)};function uc(i){this._internalRoot=i}Oo.prototype.render=uc.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));Ao(i,s,null,null)},Oo.prototype.unmount=uc.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Er(function(){Ao(null,i,null,null)}),s[Di]=null}};function Oo(i){this._internalRoot=i}Oo.prototype.unstable_scheduleHydration=function(i){if(i){var s=Au();i={blockedOn:null,target:i,priority:s};for(var o=0;o<qi.length&&s!==0&&s<qi[o].priority;o++);qi.splice(o,0,i),o===0&&Iu(i)}};function dc(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Io(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function ep(){}function g0(i,s,o,c,u){if(u){if(typeof c=="function"){var m=c;c=function(){var G=jo(S);m.call(G)}}var S=Qf(s,c,i,0,null,!1,!1,"",ep);return i._reactRootContainer=S,i[Di]=S.current,Ws(i.nodeType===8?i.parentNode:i),Er(),S}for(;u=i.lastChild;)i.removeChild(u);if(typeof c=="function"){var k=c;c=function(){var G=jo(T);k.call(G)}}var T=cc(i,0,!1,null,null,!1,!1,"",ep);return i._reactRootContainer=T,i[Di]=T.current,Ws(i.nodeType===8?i.parentNode:i),Er(function(){Ao(s,T,o,c)}),T}function zo(i,s,o,c,u){var m=o._reactRootContainer;if(m){var S=m;if(typeof u=="function"){var k=u;u=function(){var T=jo(S);k.call(T)}}Ao(s,S,i,u)}else S=g0(o,s,i,u,c);return jo(S)}Tu=function(i){switch(i.tag){case 3:var s=i.stateNode;if(s.current.memoizedState.isDehydrated){var o=Ns(s.pendingLanes);o!==0&&(jl(s,o|1),It(s,Ze()),(Be&6)===0&&(cs=Ze()+500,Zi()))}break;case 13:Er(function(){var c=Bi(i,1);if(c!==null){var u=Mt();di(c,i,1,u)}}),hc(i,1)}},Ol=function(i){if(i.tag===13){var s=Bi(i,134217728);if(s!==null){var o=Mt();di(s,i,134217728,o)}hc(i,134217728)}},Bu=function(i){if(i.tag===13){var s=nr(i),o=Bi(i,s);if(o!==null){var c=Mt();di(o,i,s,c)}hc(i,s)}},Au=function(){return Oe},ju=function(i,s){var o=Oe;try{return Oe=i,s()}finally{Oe=o}},Ml=function(i,s,o){switch(s){case"input":if(vs(i,o),s=o.name,o.type==="radio"&&s!=null){for(o=i;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<o.length;s++){var c=o[s];if(c!==i&&c.form===i.form){var u=to(c);if(!u)throw Error(r(90));Ae(c),vs(c,u)}}}break;case"textarea":Re(i,o);break;case"select":s=o.value,s!=null&&pi(i,!!o.multiple,s,!1)}},Su=rc,wu=Er;var v0={usingClientEntryPoint:!1,Events:[Ks,Gr,to,vu,yu,rc]},on={findFiberByHostInstance:vr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},y0={bundleType:on.bundleType,version:on.version,rendererPackageName:on.rendererPackageName,rendererConfig:on.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=ku(i),i===null?null:i.stateNode},findFiberByHostInstance:on.findFiberByHostInstance||_0,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 Fo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fo.isDisabled&&Fo.supportsFiber)try{jn=Fo.inject(y0),mi=Fo}catch{}}return zt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=v0,zt.createPortal=function(i,s){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!dc(s))throw Error(r(200));return m0(i,s,null,o)},zt.createRoot=function(i,s){if(!dc(i))throw Error(r(299));var o=!1,c="",u=Zf;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onRecoverableError!==void 0&&(u=s.onRecoverableError)),s=cc(i,1,!1,null,null,o,!1,c,u),i[Di]=s.current,Ws(i.nodeType===8?i.parentNode:i),new uc(s)},zt.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=ku(s),i=i===null?null:i.stateNode,i},zt.flushSync=function(i){return Er(i)},zt.hydrate=function(i,s,o){if(!Io(s))throw Error(r(200));return zo(null,i,s,!0,o)},zt.hydrateRoot=function(i,s,o){if(!dc(i))throw Error(r(405));var c=o!=null&&o.hydratedSources||null,u=!1,m="",S=Zf;if(o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(S=o.onRecoverableError)),s=Qf(s,null,i,1,o??null,u,!1,m,S),i[Di]=s.current,Ws(i),c)for(i=0;i<c.length;i++)o=c[i],u=o._getVersion,u=u(o._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[o,u]:s.mutableSourceEagerHydrationData.push(o,u);return new Oo(s)},zt.render=function(i,s,o){if(!Io(s))throw Error(r(200));return zo(null,i,s,!1,o)},zt.unmountComponentAtNode=function(i){if(!Io(i))throw Error(r(40));return i._reactRootContainer?(Er(function(){zo(null,null,i,!1,function(){i._reactRootContainer=null,i[Di]=null})}),!0):!1},zt.unstable_batchedUpdates=rc,zt.unstable_renderSubtreeIntoContainer=function(i,s,o,c){if(!Io(o))throw Error(r(200));if(i==null||i._reactInternals===void 0)throw Error(r(38));return zo(i,s,o,!1,c)},zt.version="18.3.1-next-f1338f8080-20240426",zt}var ap;function R0(){if(ap)return mc.exports;ap=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),mc.exports=N0(),mc.exports}var cp;function M0(){if(cp)return Ho;cp=1;var e=R0();return Ho.createRoot=e.createRoot,Ho.hydrateRoot=e.hydrateRoot,Ho}var D0=M0();const P0=Gh(D0);function gt(e,t,r={}){return fetch(e,{...r,headers:{...r.headers||{},Authorization:`Bearer ${t}`}})}const Jm=e=>`nc_seen_${e}`;async function Te(e,t,r={}){const n=await gt(e,t,{method:r.method||"GET",headers:{"content-type":"application/json"},body:r.body?JSON.stringify(r.body):void 0}),l=await n.json().catch(()=>({}));if(!n.ok){const a=new Error(l.error||`HTTP ${n.status}`);throw a.status=n.status,a.data=l,a}return l}const gl=e=>Te("/api/fleet/status",e),Zm=(e,t)=>Te("/api/fleet/up",e,{method:"POST",body:t}),e_=(e,t)=>Te("/api/fleet/down",e,{method:"POST",body:t}),hp=(e,t)=>Te("/api/fleet/restart",e,{method:"POST",body:{cell:t}}),L0=e=>Te("/api/fleet/definitions",e),T0=(e,t)=>Te("/api/fleet/define-engine",e,{method:"POST",body:{def:t}}),B0=(e,t,r,n)=>Te("/api/fleet/edit-engine",e,{method:"POST",body:{id:t,patch:r,envChanges:n}}),A0=(e,t)=>Te("/api/fleet/remove-engine",e,{method:"POST",body:{id:t}}),j0=(e,t)=>Te("/api/fleet/define-cell",e,{method:"POST",body:{def:t}}),O0=(e,t,r)=>Te("/api/fleet/edit-cell",e,{method:"POST",body:{id:t,patch:r}}),I0=(e,t,r=!1)=>Te("/api/fleet/remove-cell",e,{method:"POST",body:{id:t,stop:r}}),kn=e=>Array.isArray(e)&&e.length?`/api/route/${e.map(encodeURIComponent).join("/")}/_`:"/api",t_=(e,t,r)=>Te(`${kn(r)}/sessions`,e,{method:"POST",body:t}),i_=(e,t,r)=>Te(`${kn(r)}/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),r_=(e,t,r)=>Te(`${kn(r)}/fs/dirs${t?`?path=${encodeURIComponent(t)}`:""}`,e),s_=e=>Te("/api/settings",e),z0=e=>Te("/api/nodes",e),F0=e=>Te("/api/topology",e),H0=(e,t)=>Te(`${kn(t)}/sessions`,e),W0=(e,t)=>Te(`${kn(t)}/config`,e),$0=(e,t)=>Te("/api/settings/config",e,{method:"POST",body:t}),U0=e=>Te("/api/settings/token/rotate",e,{method:"POST"}),n_=(e,t)=>Te("/api/settings/nodes/pair",e,{method:"POST",body:t}),K0=e=>Te("/api/settings/peering/invite",e,{method:"POST"}),V0=(e,t)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"DELETE"}),q0=(e,t,r)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/${r}`,e,{method:"POST"}),up=(e,t,r,n=[])=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{visibility:r,selected:n}}),Y0=e=>Te("/api/settings/service/regenerate",e,{method:"POST"}),X0=(e,t=!0)=>Te(`/api/asks${t?"?open=1":""}`,e),G0=(e,t,r)=>Te(`/api/asks/${encodeURIComponent(t)}/answer`,e,{method:"POST",body:{text:r}}),vc=e=>Te("/api/decks",e),dp=(e,t)=>Te("/api/decks",e,{method:"POST",body:{name:t}}),Wo=(e,t,r,n)=>Te(`/api/decks/${encodeURIComponent(t)}`,e,{method:"PUT",body:{layout:r,expectedRevision:n}}),Q0=(e,t,r,n)=>Te(`/api/decks/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{name:r,expectedRevision:n}}),J0=(e,t,r)=>Te(`/api/decks/${encodeURIComponent(t)}`,e,{method:"DELETE",body:{expectedRevision:r}}),Z0={power:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M12 3v8"}),f.jsx("path",{d:"M6.6 6.6a8 8 0 1 0 10.8 0"})]}),folder:f.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h3.6a2 2 0 0 1 1.4.6L12.4 6H18a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z"}),keyboard:f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),f.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),f.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),f.jsx("path",{d:"M12 18v3"})]}),enter:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),f.jsx("polyline",{points:"9 9 5 13 9 17"})]}),send:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M22 2 15 22 11 13 2 9Z"}),f.jsx("path",{d:"M22 2 11 13"})]}),trash:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M4 7h16"}),f.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),f.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),f.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:f.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),f.jsx("polyline",{points:"21 3 21 8 16 8"})]}),upload:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M12 16V5"}),f.jsx("polyline",{points:"8 9 12 5 16 9"}),f.jsx("path",{d:"M5 20h14"})]}),chevronLeft:f.jsx("polyline",{points:"14 6 8 12 14 18"}),attach:f.jsx("path",{d:"M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"}),file:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),f.jsx("polyline",{points:"14 2 14 8 20 8"})]}),camera:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M14.5 4h-5L7.5 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.5z"}),f.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),image:f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),f.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),f.jsx("path",{d:"M21 15l-5-5L5 21"})]}),zoomIn:f.jsxs(f.Fragment,{children:[f.jsx("circle",{cx:"11",cy:"11",r:"7"}),f.jsx("path",{d:"M21 21l-4.35-4.35"}),f.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:f.jsxs(f.Fragment,{children:[f.jsx("circle",{cx:"11",cy:"11",r:"7"}),f.jsx("path",{d:"M21 21l-4.35-4.35"}),f.jsx("path",{d:"M8 11h6"})]}),gear:f.jsxs(f.Fragment,{children:[f.jsx("circle",{cx:"12",cy:"12",r:"3"}),f.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),copy:f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),f.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})};function ze({name:e,size:t=20}){return f.jsx("svg",{className:"nc-icon",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:Z0[e]||null})}const o_="nc_pins";function l_(){try{const e=JSON.parse(localStorage.getItem(o_));return Array.isArray(e)?e:[]}catch{return[]}}function a_(e,t){const r=e.includes(t)?e.filter(n=>n!==t):[...e,t];try{localStorage.setItem(o_,JSON.stringify(r))}catch{}return r}function mn(e,t,r){const n=e.indexOf(t);return[n===-1?1e9:n,-(r||0)]}function ih(e,t){return e[0]-t[0]||e[1]-t[1]}const Jh=["it","en","es"];function ey(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return Jh.includes(t)?t:"en"}catch{return"en"}}const Jo=ey(),c_="nc_lang",rh="nc-lang";function h_(){return typeof localStorage<"u"?localStorage:null}const $o={it:{"update-available":"nuova versione {v} disponibile","install-version-mismatch":"installazione incompleta: frontend e server non coincidono (v{v})",reload:"ricarica","grid-empty":"trascina qui una sessione dalla sidebar, o doppio-clic per la vista singola",pin:"fissa in cima",sessions:"sessioni","new-session":"nuova sessione",new:"nuova",fleet:"Flotta","fleet-tmux":"flotta tmux","other-sessions":"Altre sessioni",files:"file",refresh:"aggiorna","filter-placeholder":"filtra sessioni…","loading-fleet":"carico la flotta…","no-sessions":"nessuna sessione tmux viva — la flotta parte al boot (systemd)","no-match":'nessuna sessione contiene "{q}"',"copy-url":"clicca per copiare l'URL","ssh-only":"solo tunnel SSH/VPN","new-files-outbox":"nuovi file in outbox",terminate:"termina","terminate-confirm":'Terminare la sessione "{name}"?',"cell-on":"tmux vivo","cell-off":"spenta","cell-degraded":"degradata: unit attiva, tmux morto","power-on":"accendi","power-off":"spegni","state-on":"accesa","state-off":"spenta",engine:"Engine",model:"Modello","model-default":"Modello predefinito del provider","model-remembered":"Ultimo modello usato con questo engine","boot-persist":"avvia al boot","remove-boot":"togli anche dal boot","no-remote-control":"⚠ engine non-native: niente RC da app claude.ai (da qui la piloti comunque)",cancel:"annulla",name:"nome","name-invalid":"nome non valido: a-zA-Z0-9._- max 64, senza '-' iniziale",cwd:"cartella",browse:"sfoglia","fs-home":"home","fs-parent":".. su",preset:"preset","preset-2x2":"griglia 2×2","preset-columns":"colonne","preset-equalize":"equalizza",collapse:"comprimi",expand:"espandi",create:"crea","auth-prompt":"Incolla il token (stampato dal server):","remember-device":"ricorda su questo device","zoom-out":"testo più piccolo","zoom-in":"testo più grande",composer:"composer",windows:"{n} finestre","empty-files":"vuota",upload:"carica","no-sessions-short":"nessuna sessione","composer-placeholder":"scrivi o detta…",attach:"allega","attach-file":"File","attach-camera":"Fotocamera","attach-gallery":"Galleria","attach-uploading":"carico…",voice:"voice",send:"invia",close:"chiudi","lang-label":"lingua",decks:"deck","new-deck":"nuovo deck","deck-name":"nome deck","open-deck-window":"apri in una nuova finestra","deck-current":"questo deck (finestra corrente)","rename-deck":"rinomina deck","delete-deck":"elimina deck","delete-deck-confirm":'Eliminare il deck "{name}"?',"send-to-deck":"manda al deck…","deck-autosave":"salvataggio automatico",saving:"salvataggio…",saved:"salvato","popup-blocked":"popup bloccato: apri qui","select-drag":"trascina per selezionare","copy-manual":"seleziona e copia manualmente","toggle-sidebar":"mostra/nascondi la barra laterale",settings:"impostazioni","tab-roles":"ruoli","tab-nodes":"nodi",local:"Locale",location:"Dove","pairing-link":"link di pairing","pairing-required":"nome, alias SSH e link di pairing sono obbligatori","scan-qr":"scansiona QR","pairing-qr-invalid":"QR di pairing non valido","invite-node":"invita un nodo","create-pairing-link":"crea link / QR","visibility-network":"tutta la rete","visibility-relay":"solo relay","visibility-selected":"nodi selezionati","hydra-simple":"locale + nodi, una sola rete","local-ready":"Questo dispositivo è pronto. Puoi usarlo da solo o collegarlo a un nodo.","local-only":"solo locale","add-node":"aggiungi nodo",connect:"collega","node-connected":"Nodo collegato. La rete verrà sincronizzata automaticamente.","tab-system":"sistema","tab-fleet":"flotta","fleet-editor-unavailable":"Editor disponibile solo con il provider fleet builtin.","fleet-managed":"gestito da NexusCrew","fleet-custom":"comando personalizzato","fleet-managed-help":"Client, provider e avvio sono gestiti internamente; i segreti non vengono mostrati.","fleet-model-default":"modello predefinito (opzionale)","fleet-model-required":"modello (obbligatorio)","fleet-standard-permissions":"permessi standard","fleet-unsafe-permissions":"non sicuro · ignora approvazioni/sandbox","fleet-unsafe-warning":"Modalità non sicura esplicita: il worker può agire senza le normali approvazioni o protezioni sandbox.","fleet-provider-display":"nome visualizzato del provider","fleet-custom-provider-default":"Provider personalizzato","fleet-api-key-env":"NOME_VARIABILE_API_KEY","fleet-provider-id":"id-provider","fleet-custom-secret-help":"NexusCrew salva solo il nome della variabile d’ambiente, mai il suo valore.","fleet-model-override":"modello alternativo","fleet-ready":"pronto","fleet-not-ready":"non configurato","fleet-engines":"Engine","fleet-cells":"Celle / sessioni cloud",edit:"modifica",save:"salva",label:"etichetta","command-path":"path assoluto del comando","args-lines":"argomenti, uno per riga","env-write-only":"I valori env sono write-only: vuoto mantiene il valore esistente.","fleet-new-engine":"Nuovo engine","fleet-new-cell":"Nuova cella","fleet-saved":"Definizione salvata.","fleet-restart-confirm":"Modifica salvata. Riavviare ora: {cells}?","fleet-remove-engine":'Eliminare l’engine "{id}"?',"fleet-remove-cell":'Eliminare la cella "{id}"? Se è attiva verrà prima fermata.',"settings-readonly":"READONLY attivo: le modifiche sono bloccate dal server (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"questa macchina guarda altri nodi via tunnel SSH","role-node":"nodo (raggiungibile)","role-node-desc":"questa macchina si pubblica via reverse tunnel su un rendezvous","rendezvous-ssh":"rendezvous ssh (user@host)","published-port":"porta pubblicata (opzionale)","no-nodes":"nessun nodo remoto configurato","node-add":"aggiungi nodo","node-connect-help":"La porta SSH serve a raggiungere il server SSH. La porta NexusCrew è invece la porta locale mostrata da `nexuscrew status` sul nodo remoto.","node-name-label":"Nome del nodo","node-ssh-label":"Host SSH","node-ssh-port-label":"Porta SSH","node-ssh-port-help":"Di solito 22; usa la porta pubblica del server SSH.","node-app-port-label":"Porta NexusCrew sul nodo","node-app-port-help":"È la porta mostrata da `nexuscrew status` sul nodo remoto.","node-name-ph":"nome (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"porta remota (opz.)","node-remove-confirm":'Rimuovere il nodo "{name}"?',"node-test":"test","tunnel-start":"avvia tunnel","tunnel-stop":"ferma tunnel","tunnel-restart":"riavvia tunnel","tunnel-up":"tunnel su","tunnel-down":"tunnel giù","authorized-keys-hint":"incolla questa riga in ~/.ssh/authorized_keys sull'host remoto:",copy:"copia",copied:"copiato","token-rotate":"ruota token","token-rotate-explain":"Il nuovo token NON verrà mostrato: recuperalo con `nexuscrew url`. La sessione si invalida al riavvio del service.","service-regenerate":"rigenera service","service-installed":"service installato","service-missing":"service non installato","service-active":"attivo","service-inactive":"non attivo",confirm:"conferma",add:"aggiungi",enable:"attiva","wizard-title":"benvenuto in NexusCrew","wizard-skip":"configura dopo dai settings","wizard-step-roles":"ruoli di questa installazione","wizard-step-node":"primo nodo remoto (opzionale)","wizard-step-rendezvous":"rendezvous per il ruolo nodo","wizard-done":"tutto pronto","wizard-done-desc":"setup completato — puoi cambiare tutto dai settings",next:"continua",back:"indietro",skip:"salta",finish:"fine","err-node-name":"nome non valido (a-z, 0-9, -, max 32)","err-ssh":"ssh non valido (atteso user@host)","err-port":"porta non valida (1–65535)","err-ssh-port":"porta SSH non valida (1–65535)","err-node-port":"porta NexusCrew non valida (1–65535)","err-rendezvous-required":"serve un rendezvous ssh (user@host) per attivare il ruolo nodo","node-sessions":"{n} sessioni","tunnel-down-since":"tunnel giù da {t}","node-unreachable":"nodo non raggiungibile","asks-title":"domande dalle celle","ask-reply-ph":"scrivi la risposta…","push-enable":"attiva notifiche push","push-disable":"disattiva notifiche push","push-on":"push attive su questo device","push-off":"push non attive","push-denied":"permesso notifiche negato dal browser","push-unsupported":"push non supportate in questo browser"},en:{"update-available":"new version {v} available","install-version-mismatch":"incomplete installation: frontend and server do not match (v{v})",reload:"reload","grid-empty":"drag a session here from the sidebar, or double-click for single view",pin:"pin to top",sessions:"sessions","new-session":"new session",new:"new",fleet:"Fleet","fleet-tmux":"tmux fleet","other-sessions":"Other sessions",files:"files",refresh:"refresh","filter-placeholder":"filter sessions…","loading-fleet":"loading fleet…","no-sessions":"no live tmux sessions — the fleet starts at boot (systemd)","no-match":'no session matches "{q}"',"copy-url":"click to copy URL","ssh-only":"SSH/VPN tunnel only","new-files-outbox":"new files in outbox",terminate:"terminate","terminate-confirm":'Terminate session "{name}"?',"cell-on":"tmux alive","cell-off":"off","cell-degraded":"degraded: unit active, tmux dead","power-on":"power on","power-off":"power off","state-on":"running","state-off":"stopped",engine:"Engine",model:"Model","model-default":"Provider default model","model-remembered":"Last model used with this engine","boot-persist":"start at boot","remove-boot":"also remove from boot","no-remote-control":"⚠ non-native engine: no claude.ai app RC (you can still drive it from here)",cancel:"cancel",name:"name","name-invalid":"invalid name: a-zA-Z0-9._- max 64, no leading '-'",cwd:"folder",browse:"browse","fs-home":"home","fs-parent":".. up",preset:"preset","preset-2x2":"2×2 grid","preset-columns":"columns","preset-equalize":"equalize",collapse:"collapse",expand:"expand",create:"create","auth-prompt":"Paste the token (printed by the server):","remember-device":"remember on this device","zoom-out":"smaller text","zoom-in":"bigger text",composer:"composer",windows:"{n} windows","empty-files":"empty",upload:"upload","no-sessions-short":"no sessions","composer-placeholder":"type or dictate…",attach:"attach","attach-file":"File","attach-camera":"Camera","attach-gallery":"Gallery","attach-uploading":"uploading…",voice:"voice",send:"send",close:"close","lang-label":"language",decks:"decks","new-deck":"new deck","deck-name":"deck name","open-deck-window":"open in a new window","deck-current":"this deck (current window)","rename-deck":"rename deck","delete-deck":"delete deck","delete-deck-confirm":'Delete deck "{name}"?',"send-to-deck":"send to deck…","deck-autosave":"autosave",saving:"saving…",saved:"saved","popup-blocked":"popup blocked: open here","select-drag":"drag to select","copy-manual":"select and copy manually","toggle-sidebar":"show/hide the sidebar",settings:"settings","tab-roles":"roles","tab-nodes":"nodes",local:"Local",location:"Location","pairing-link":"pairing link","pairing-required":"name, SSH alias and pairing link are required","scan-qr":"scan QR","pairing-qr-invalid":"invalid pairing QR","invite-node":"invite a node","create-pairing-link":"create link / QR","visibility-network":"whole network","visibility-relay":"relay only","visibility-selected":"selected nodes","hydra-simple":"local + nodes, one network","local-ready":"This device is ready. Use it alone or connect it to a node.","local-only":"local only","add-node":"add node",connect:"connect","node-connected":"Node connected. The network will synchronize automatically.","tab-system":"system","tab-fleet":"fleet","fleet-editor-unavailable":"The editor is available only with the builtin fleet provider.","fleet-managed":"managed by NexusCrew","fleet-custom":"custom command","fleet-managed-help":"Client, provider and launch are managed internally; secrets are never displayed.","fleet-model-default":"default model (optional)","fleet-model-required":"model (required)","fleet-standard-permissions":"standard permissions","fleet-unsafe-permissions":"unsafe · bypass approvals/sandbox","fleet-unsafe-warning":"Explicit unsafe mode: the worker can act without normal approval or sandbox gates.","fleet-provider-display":"provider display name","fleet-custom-provider-default":"Custom provider","fleet-api-key-env":"API_KEY_ENV_NAME","fleet-provider-id":"provider-id","fleet-custom-secret-help":"NexusCrew stores only the environment-variable name, never its value.","fleet-model-override":"model override","fleet-ready":"ready","fleet-not-ready":"not configured","fleet-engines":"Engines","fleet-cells":"Cells / cloud sessions",edit:"edit",save:"save",label:"label","command-path":"absolute command path","args-lines":"arguments, one per line","env-write-only":"Environment values are write-only: blank keeps the existing value.","fleet-new-engine":"New engine","fleet-new-cell":"New cell","fleet-saved":"Definition saved.","fleet-restart-confirm":"Change saved. Restart now: {cells}?","fleet-remove-engine":'Delete engine "{id}"?',"fleet-remove-cell":'Delete cell "{id}"? If active it will be stopped first.',"settings-readonly":"READONLY active: changes are blocked by the server (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"this machine watches other nodes via SSH tunnels","role-node":"node (reachable)","role-node-desc":"this machine publishes itself via reverse tunnel to a rendezvous","rendezvous-ssh":"rendezvous ssh (user@host)","published-port":"published port (optional)","no-nodes":"no remote nodes configured","node-add":"add node","node-connect-help":"The SSH port reaches the SSH server. The NexusCrew port is the local port reported by `nexuscrew status` on the remote node.","node-name-label":"Node name","node-ssh-label":"SSH host","node-ssh-port-label":"SSH port","node-ssh-port-help":"Usually 22; use the SSH server public port.","node-app-port-label":"NexusCrew port on node","node-app-port-help":"The port reported by `nexuscrew status` on the remote node.","node-name-ph":"name (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"remote port (opt.)","node-remove-confirm":'Remove node "{name}"?',"node-test":"test","tunnel-start":"start tunnel","tunnel-stop":"stop tunnel","tunnel-restart":"restart tunnel","tunnel-up":"tunnel up","tunnel-down":"tunnel down","authorized-keys-hint":"paste this line into ~/.ssh/authorized_keys on the remote host:",copy:"copy",copied:"copied","token-rotate":"rotate token","token-rotate-explain":"The new token will NOT be shown: retrieve it with `nexuscrew url`. The session is invalidated when the service restarts.","service-regenerate":"regenerate service","service-installed":"service installed","service-missing":"service not installed","service-active":"active","service-inactive":"not active",confirm:"confirm",add:"add",enable:"enable","wizard-title":"welcome to NexusCrew","wizard-skip":"configure later from settings","wizard-step-roles":"roles of this install","wizard-step-node":"first remote node (optional)","wizard-step-rendezvous":"rendezvous for the node role","wizard-done":"all set","wizard-done-desc":"setup complete — you can change everything from settings",next:"continue",back:"back",skip:"skip",finish:"finish","err-node-name":"invalid name (a-z, 0-9, -, max 32)","err-ssh":"invalid ssh (expected user@host)","err-port":"invalid port (1–65535)","err-ssh-port":"invalid SSH port (1–65535)","err-node-port":"invalid NexusCrew port (1–65535)","err-rendezvous-required":"a rendezvous ssh (user@host) is required to enable the node role","node-sessions":"{n} sessions","tunnel-down-since":"tunnel down for {t}","node-unreachable":"node unreachable","asks-title":"questions from the cells","ask-reply-ph":"type your answer…","push-enable":"enable push notifications","push-disable":"disable push notifications","push-on":"push active on this device","push-off":"push not active","push-denied":"notification permission denied by the browser","push-unsupported":"push not supported in this browser"},es:{"update-available":"nueva versión {v} disponible","install-version-mismatch":"instalación incompleta: frontend y servidor no coinciden (v{v})",reload:"recargar","grid-empty":"arrastra aquí una sesión desde la barra lateral, o doble clic para vista única",pin:"fijar arriba",sessions:"sesiones","new-session":"nueva sesión",new:"nueva",fleet:"Flota","fleet-tmux":"flota tmux","other-sessions":"Otras sesiones",files:"archivos",refresh:"actualizar","filter-placeholder":"filtrar sesiones…","loading-fleet":"cargando flota…","no-sessions":"sin sesiones tmux vivas — la flota arranca en el boot (systemd)","no-match":"ninguna sesión coincide con «{q}»","copy-url":"clic para copiar la URL","ssh-only":"solo túnel SSH/VPN","new-files-outbox":"archivos nuevos en outbox",terminate:"terminar","terminate-confirm":"¿Terminar la sesión «{name}»?","cell-on":"tmux activo","cell-off":"apagada","cell-degraded":"degradada: unit activa, tmux muerto","power-on":"encender","power-off":"apagar","state-on":"encendida","state-off":"apagada",engine:"Motor",model:"Modelo","model-default":"Modelo predeterminado del proveedor","model-remembered":"Último modelo usado con este motor","boot-persist":"iniciar en el boot","remove-boot":"quitar también del boot","no-remote-control":"⚠ motor no nativo: sin RC de la app claude.ai (aquí puedes pilotarla igual)",cancel:"cancelar",name:"nombre","name-invalid":"nombre inválido: a-zA-Z0-9._- máx 64, sin '-' inicial",cwd:"carpeta",browse:"explorar","fs-home":"home","fs-parent":".. arriba",preset:"preset","preset-2x2":"cuadrícula 2×2","preset-columns":"columnas","preset-equalize":"igualar",collapse:"contraer",expand:"expandir",create:"crear","auth-prompt":"Pega el token (impreso por el servidor):","remember-device":"recordar en este dispositivo","zoom-out":"texto más pequeño","zoom-in":"texto más grande",composer:"composer",windows:"{n} ventanas","empty-files":"vacía",upload:"subir","no-sessions-short":"sin sesiones","composer-placeholder":"escribe o dicta…",attach:"adjuntar","attach-file":"Archivo","attach-camera":"Cámara","attach-gallery":"Galería","attach-uploading":"subiendo…",voice:"voz",send:"enviar",close:"cerrar","lang-label":"idioma",decks:"decks","new-deck":"nuevo deck","deck-name":"nombre del deck","open-deck-window":"abrir en una ventana nueva","deck-current":"este deck (ventana actual)","rename-deck":"renombrar deck","delete-deck":"eliminar deck","delete-deck-confirm":"¿Eliminar el deck «{name}»?","send-to-deck":"enviar al deck…","deck-autosave":"guardado automático",saving:"guardando…",saved:"guardado","popup-blocked":"ventana bloqueada: abrir aquí","select-drag":"arrastra para seleccionar","copy-manual":"selecciona y copia manualmente","toggle-sidebar":"mostrar/ocultar la barra lateral",settings:"ajustes","tab-roles":"roles","tab-nodes":"nodos",local:"Local",location:"Ubicación","pairing-link":"enlace de emparejamiento","pairing-required":"nombre, alias SSH y enlace son obligatorios","scan-qr":"escanear QR","pairing-qr-invalid":"QR de emparejamiento no válido","invite-node":"invitar un nodo","create-pairing-link":"crear enlace / QR","visibility-network":"toda la red","visibility-relay":"solo relay","visibility-selected":"nodos seleccionados","hydra-simple":"local + nodos, una red","local-ready":"Este dispositivo está listo. Úsalo solo o conéctalo a un nodo.","local-only":"solo local","add-node":"añadir nodo",connect:"conectar","node-connected":"Nodo conectado. La red se sincronizará automáticamente.","tab-system":"sistema","tab-fleet":"flota","fleet-editor-unavailable":"El editor solo está disponible con el proveedor builtin.","fleet-managed":"gestionado por NexusCrew","fleet-custom":"comando personalizado","fleet-managed-help":"Cliente, proveedor e inicio se gestionan internamente; los secretos nunca se muestran.","fleet-model-default":"modelo predeterminado (opcional)","fleet-model-required":"modelo (obligatorio)","fleet-standard-permissions":"permisos estándar","fleet-unsafe-permissions":"inseguro · omitir aprobaciones/sandbox","fleet-unsafe-warning":"Modo inseguro explícito: el worker puede actuar sin las aprobaciones normales ni las protecciones del sandbox.","fleet-provider-display":"nombre visible del proveedor","fleet-custom-provider-default":"Proveedor personalizado","fleet-api-key-env":"NOMBRE_VARIABLE_API_KEY","fleet-provider-id":"id-proveedor","fleet-custom-secret-help":"NexusCrew guarda solo el nombre de la variable de entorno, nunca su valor.","fleet-model-override":"modelo alternativo","fleet-ready":"listo","fleet-not-ready":"no configurado","fleet-engines":"Motores","fleet-cells":"Celdas / sesiones cloud",edit:"editar",save:"guardar",label:"etiqueta","command-path":"ruta absoluta del comando","args-lines":"argumentos, uno por línea","env-write-only":"Los valores env son de solo escritura: vacío conserva el valor existente.","fleet-new-engine":"Nuevo motor","fleet-new-cell":"Nueva celda","fleet-saved":"Definición guardada.","fleet-restart-confirm":"Cambio guardado. ¿Reiniciar ahora: {cells}?","fleet-remove-engine":'¿Eliminar el motor "{id}"?',"fleet-remove-cell":'¿Eliminar la celda "{id}"? Si está activa se detendrá primero.',"settings-readonly":"READONLY activo: los cambios están bloqueados por el servidor (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"esta máquina observa otros nodos vía túneles SSH","role-node":"nodo (alcanzable)","role-node-desc":"esta máquina se publica vía túnel inverso hacia un rendezvous","rendezvous-ssh":"rendezvous ssh (user@host)","published-port":"puerto publicado (opcional)","no-nodes":"sin nodos remotos configurados","node-add":"añadir nodo","node-connect-help":"El puerto SSH conecta con el servidor SSH. El puerto NexusCrew es el puerto local indicado por `nexuscrew status` en el nodo remoto.","node-name-label":"Nombre del nodo","node-ssh-label":"Host SSH","node-ssh-port-label":"Puerto SSH","node-ssh-port-help":"Normalmente 22; usa el puerto público del servidor SSH.","node-app-port-label":"Puerto NexusCrew del nodo","node-app-port-help":"El puerto indicado por `nexuscrew status` en el nodo remoto.","node-name-ph":"nombre (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"puerto remoto (opc.)","node-remove-confirm":"¿Eliminar el nodo «{name}»?","node-test":"test","tunnel-start":"iniciar túnel","tunnel-stop":"detener túnel","tunnel-restart":"reiniciar túnel","tunnel-up":"túnel activo","tunnel-down":"túnel caído","authorized-keys-hint":"pega esta línea en ~/.ssh/authorized_keys del host remoto:",copy:"copiar",copied:"copiado","token-rotate":"rotar token","token-rotate-explain":"El nuevo token NO se mostrará: recupéralo con `nexuscrew url`. La sesión se invalida al reiniciar el service.","service-regenerate":"regenerar service","service-installed":"service instalado","service-missing":"service no instalado","service-active":"activo","service-inactive":"no activo",confirm:"confirmar",add:"añadir",enable:"activar","wizard-title":"bienvenido a NexusCrew","wizard-skip":"configura después desde ajustes","wizard-step-roles":"roles de esta instalación","wizard-step-node":"primer nodo remoto (opcional)","wizard-step-rendezvous":"rendezvous para el rol nodo","wizard-done":"todo listo","wizard-done-desc":"configuración completa — puedes cambiarlo todo desde ajustes",next:"continuar",back:"atrás",skip:"omitir",finish:"terminar","err-node-name":"nombre inválido (a-z, 0-9, -, máx 32)","err-ssh":"ssh inválido (se espera user@host)","err-port":"puerto inválido (1–65535)","err-ssh-port":"puerto SSH inválido (1–65535)","err-node-port":"puerto NexusCrew inválido (1–65535)","err-rendezvous-required":"se necesita un rendezvous ssh (user@host) para activar el rol nodo","node-sessions":"{n} sesiones","tunnel-down-since":"túnel caído desde hace {t}","node-unreachable":"nodo inalcanzable","asks-title":"preguntas de las celdas","ask-reply-ph":"escribe la respuesta…","push-enable":"activar notificaciones push","push-disable":"desactivar notificaciones push","push-on":"push activas en este dispositivo","push-off":"push no activas","push-denied":"permiso de notificaciones denegado por el navegador","push-unsupported":"push no soportadas en este navegador"}};function sh(){const e=h_(),t=e?e.getItem(c_):null;return Jh.includes(t)?t:Jo}function ty(e){const t=h_();if(t)try{t.setItem(c_,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(rh))}function x(e){const t=sh(),r=$o[t]||$o[Jo];return Object.prototype.hasOwnProperty.call(r,e)?r[e]:Object.prototype.hasOwnProperty.call($o[Jo],e)?$o[Jo][e]:e}function iy(e){return typeof window>"u"?()=>{}:(window.addEventListener(rh,e),()=>window.removeEventListener(rh,e))}const u_=Jh;function Wt(){return[z.useSyncExternalStore(iy,sh,sh),ty]}function d_({cell:e,engines:t=[],onConfirm:r,onClose:n}){var $;Wt();const l=!!(e&&e.active),a=t.length?t:[{id:(e==null?void 0:e.engine)||"native",label:(e==null?void 0:e.engine)||"native",rc:((e==null?void 0:e.engine)||"native")==="native"}],[h,d]=z.useState((e==null?void 0:e.engine)||a[0].id),_=a.find(P=>P.id===h),p=P=>{var A,M;const J=a.find(N=>N.id===P);return((A=e==null?void 0:e.models)==null?void 0:A[P])||((e==null?void 0:e.engine)===P?e==null?void 0:e.model:"")||(J==null?void 0:J.model)||((M=J==null?void 0:J.models)==null?void 0:M[0])||""},[g,y]=z.useState(()=>p((e==null?void 0:e.engine)||a[0].id)),[w,v]=z.useState((e==null?void 0:e.boot)??!0),[C,b]=z.useState(!1),[E,W]=z.useState(null);async function B(P){P.preventDefault(),b(!0),W(null);try{l?await r({action:"down",boot:w}):await r({action:"up",engine:h,model:g,boot:w}),n()}catch(J){W(String(J&&J.message||J)),b(!1)}}return f.jsx("div",{className:"nc-sheet-overlay",onClick:n,children:f.jsxs("form",{className:"nc-sheet",onClick:P=>P.stopPropagation(),onSubmit:B,children:[f.jsxs("div",{className:"nc-sheet-head",children:[f.jsx("b",{children:e==null?void 0:e.cell}),f.jsx("span",{className:"nc-sheet-state",children:x(l?"state-on":"state-off")})]}),l?f.jsxs("label",{className:"nc-check",children:[f.jsx("input",{type:"checkbox",checked:w,onChange:P=>v(P.target.checked)}),x("remove-boot")]}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"nc-sheet-label",children:x("engine")}),f.jsx("div",{className:"nc-engines",children:a.map(P=>f.jsxs("label",{className:`nc-engine${h===P.id?" sel":""}`,children:[f.jsx("input",{type:"radio",name:"ps-engine",checked:h===P.id,onChange:()=>{d(P.id),y(p(P.id))}}),P.label,P.label.toLowerCase()!==P.id.toLowerCase()&&f.jsxs("small",{className:"nc-engine-id",children:[" (",P.id,")"]})]},P.id))}),_&&(_.models||[]).length>0&&f.jsxs("label",{className:"nc-field",children:[f.jsx("span",{children:x("model")}),f.jsx("select",{value:g,onChange:P=>y(P.target.value),children:_.models.map(P=>f.jsx("option",{value:P,children:P},P))}),f.jsx("small",{children:($=e==null?void 0:e.models)!=null&&$[h]?x("model-remembered"):x("model-default")})]}),f.jsxs("label",{className:"nc-check",children:[f.jsx("input",{type:"checkbox",checked:w,onChange:P=>v(P.target.checked)}),x("boot-persist")]}),_&&!_.rc&&f.jsx("div",{className:"nc-note",children:x("no-remote-control")})]}),E&&f.jsx("div",{className:"nc-err",children:E}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{type:"button",className:"nc-btn ghost",onClick:n,disabled:C,children:x("cancel")}),f.jsx("button",{type:"submit",className:"nc-btn primary",disabled:C,children:x(l?"power-off":"power-on")})]})]})})}const ry=/^[\w.-]{1,64}$/;function f_({presets:e=["shell"],targets:t=[],token:r,onCreate:n,onClose:l}){Wt();const[a,h]=z.useState(""),[d,_]=z.useState("~"),[p,g]=z.useState(e[0]||"shell"),[y,w]=z.useState(e),[v,C]=z.useState(""),[b,E]=z.useState(!1),[W,B]=z.useState(null),[$,P]=z.useState(null),[J,A]=z.useState(null),M=ry.test(a)&&!a.startsWith("-");async function N(I){A(null);try{const U=v?v.split("/"):[],H=await r_(r,I,U);P(H),_(H.path)}catch(U){A(String(U&&U.message||U))}}async function j(I){if(I.preventDefault(),!!M){E(!0),B(null);try{await n({name:a,cwd:d==="~"?"":d,preset:p},v?v.split("/"):[]),l()}catch(U){B(String(U&&U.message||U)),E(!1)}}}return f.jsx("div",{className:"nc-sheet-overlay",onClick:l,children:f.jsxs("form",{className:"nc-sheet",onClick:I=>I.stopPropagation(),onSubmit:j,children:[f.jsx("div",{className:"nc-sheet-head",children:f.jsx("b",{children:x("new-session")})}),f.jsxs("label",{className:"nc-field",children:[x("location"),f.jsxs("select",{value:v,onChange:async I=>{const U=I.target.value;C(U),P(null);try{const H=await W0(r,U?U.split("/"):[]),O=Array.isArray(H.presets)&&H.presets.length?H.presets:["shell"];w(O),g(O[0])}catch{w(["shell"]),g("shell")}},children:[f.jsx("option",{value:"",children:x("local")}),t.map(I=>f.jsx("option",{value:I.route.join("/"),children:I.label},I.route.join("/")))]})]}),f.jsxs("label",{className:"nc-field",children:[x("name"),f.jsx("input",{value:a,onChange:I=>h(I.target.value),autoFocus:!0,placeholder:"worker-1"})]}),a&&!M&&f.jsx("div",{className:"nc-err",children:x("name-invalid")}),f.jsxs("label",{className:"nc-field",children:[x("cwd"),f.jsxs("div",{className:"nc-cwd-row",children:[f.jsx("input",{value:d,onChange:I=>_(I.target.value),placeholder:"~"}),r&&f.jsx("button",{type:"button",className:"nc-btn ghost nc-cwd-browse",onClick:()=>$?P(null):N(d==="~"?"":d),children:x("browse")})]})]}),$&&f.jsxs("div",{className:"nc-fs",onMouseDown:I=>I.stopPropagation(),children:[f.jsx("div",{className:"nc-fs-path",title:$.path,children:$.path}),f.jsxs("div",{className:"nc-fs-list",children:[f.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:()=>N($.home),children:["⌂ ",x("fs-home")]}),$.parent&&f.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:()=>N($.parent),children:["↑ ",x("fs-parent")]}),$.dirs.map(I=>f.jsxs("button",{type:"button",className:"nc-fs-item",onClick:()=>N(`${$.path.replace(/\/$/,"")}/${I}`),children:["📁 ",I]},I)),$.dirs.length===0&&f.jsx("div",{className:"nc-fs-empty",children:"—"})]}),J&&f.jsx("div",{className:"nc-err",children:J})]}),f.jsxs("label",{className:"nc-field",children:[x("preset"),f.jsx("select",{value:p,onChange:I=>g(I.target.value),children:y.map(I=>f.jsx("option",{value:I,children:I},I))})]}),W&&f.jsx("div",{className:"nc-err",children:W}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{type:"button",className:"nc-btn ghost",onClick:l,disabled:b,children:x("cancel")}),f.jsx("button",{type:"submit",className:"nc-btn primary",disabled:b||!M,children:x("create")})]})]})})}const sy=4e3;function p_(e,t=!0){const[r,n]=z.useState([]),l=z.useRef({});return z.useEffect(()=>{if(!t||!e){n([]);return}let a=!0;async function h(){let _=[];try{const g=await F0(e);_=Array.isArray(g.nodes)?g.nodes:[]}catch{_=[]}if(!a)return;const p=[];await Promise.all(_.map(async g=>{var w;const y=g.route.join("/");try{const v=await H0(e,g.route);delete l.current[y],p.push({name:g.name,label:g.route.join(" › "),route:g.route,status:"up",sessions:(v.sessions||[]).map(C=>({...C,node:y,route:g.route,key:`${y}:${C.name}`}))})}catch{(w=l.current)[y]||(w[y]=Math.floor(Date.now()/1e3)),p.push({name:g.name,label:g.route.join(" › "),route:g.route,status:"unreachable",sessions:[],downSince:l.current[y]})}})),a&&n(p.sort((g,y)=>g.label.localeCompare(y.label)))}h();const d=setInterval(h,sy);return()=>{a=!1,clearInterval(d)}},[e,t]),r}function fp(e,t){return t?0:e.attached?1:2}function Zo(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function ny(e){return e.status==="down"?e.downSince?x("tunnel-down-since").replace("{t}",Zo(e.downSince)):x("tunnel-down"):e.status==="unreachable"?x("node-unreachable"):""}function oy({onPick:e,token:t,onSettings:r}){const[n,l]=Wt(),a=p_(t),[h,d]=z.useState(null),[_,p]=z.useState(null),[g,y]=z.useState(""),[w,v]=z.useState(""),[C,b]=z.useState({bind:"127.0.0.1",port:""}),[E,W]=z.useState([]),[B,$]=z.useState(!1),[P,J]=z.useState([]),[A,M]=z.useState(["shell","claude","codex-vl","pi"]),[N,j]=z.useState(null),[I,U]=z.useState(!1);async function H(){try{const re=await(await gt("/api/sessions",t)).json();re.error?(p(re.error),d([])):(p(null),d(re.sessions||[]))}catch(V){p(String(V)),d([])}try{const V=await gl(t);$(!!V.available),W(V.available?V.cells||[]:[]),J(V.available?V.engines||[]:[])}catch{$(!1),W([]),J([])}}z.useEffect(()=>{H(),gt("/api/config",t).then(re=>re.json()).then(re=>{v(re.version||""),b({bind:re.bind||"127.0.0.1",port:re.port||""}),Array.isArray(re.presets)&&re.presets.length&&M(re.presets)}).catch(()=>{});const V=setInterval(H,4e3);return()=>clearInterval(V)},[]);async function O(){if(!C.port)return;const V=`http://${C.bind}:${C.port}/#token=${t}`;try{await navigator.clipboard.writeText(V)}catch{}}async function K(V){if(!N)return;const{cell:re}=N;V.action==="up"?await Zm(t,{cell:re,engine:V.engine,model:V.model||"",boot:!!V.boot}):await e_(t,{cell:re,boot:!!V.boot}),H()}async function ee(V,re=[]){try{await i_(t,V,re)}catch{return}H()}async function Z(V,re=[]){await t_(t,V,re),U(!1),H()}const L=z.useMemo(()=>{const V=new Map;for(const re of h||[])V.set(re.name,re);return V},[h]),D=z.useMemo(()=>new Set(E.map(V=>V.tmuxSession)),[E]),[te,X]=z.useState(l_),R=V=>X(re=>a_(re,V)),Q=z.useMemo(()=>{const V=(h||[]).map(ke=>{const ge=Number(localStorage.getItem(Jm(ke.name))||0),Ae=!!(ke.outbox&&ke.outbox.count>0&&ke.outbox.latest>ge);return{...ke,fresh:Ae}}),re=g.trim().toLowerCase();return V.filter(ke=>!re||ke.name.toLowerCase().includes(re)).sort((ke,ge)=>ih(mn(te,ke.name,ke.activity),mn(te,ge.name,ge.activity))||fp(ke,ke.fresh)-fp(ge,ge.fresh)||ke.name.localeCompare(ge.name))},[h,g,te]),ce=Q.filter(V=>!D.has(V.name)),he=z.useMemo(()=>[...E].sort((V,re)=>ih(mn(te,V.tmuxSession,(L.get(V.tmuxSession)||{}).activity),mn(te,re.tmuxSession,(L.get(re.tmuxSession)||{}).activity))||Number(re.active)-Number(V.active)||V.cell.localeCompare(re.cell)),[E,te,L]),pe=h?h.length:0,ve=(h||[]).filter(V=>V.attached).length,we=C.port?`${C.bind}:${C.port}`:C.bind;return f.jsxs("div",{className:"nc-home",children:[f.jsxs("header",{className:"nc-home-head",children:[f.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",f.jsx("span",{className:"nc-cursor"})]}),f.jsxs("div",{className:"nc-home-sub",children:[x("fleet-tmux")," · ",pe," ",x("sessions"),ve>0&&` · ${ve} attached`]}),f.jsxs("span",{className:"nc-head-actions",children:[f.jsx("button",{className:"nc-refresh",onClick:r,title:x("settings"),children:f.jsx(ze,{name:"gear",size:18})}),f.jsx("button",{className:"nc-refresh",onClick:H,title:x("refresh"),children:f.jsx(ze,{name:"refresh",size:18})})]})]}),pe>8&&f.jsx("input",{className:"nc-filter",type:"search",placeholder:x("filter-placeholder"),value:g,onChange:V=>y(V.target.value)}),_&&f.jsx("div",{className:"nc-err",children:_}),B&&E.length>0&&f.jsxs("section",{className:"nc-group",children:[f.jsx("div",{className:"nc-group-title",children:x("fleet")}),he.map(V=>{const re=L.get(V.tmuxSession)||{},ke=V.degraded?"warn":V.tmux?"on":"",ge=[`${V.engine}${V.key?`·${V.key}`:""}`,re.preview].filter(Boolean).join(" · ");return f.jsxs("div",{className:"nc-mcard",children:[f.jsxs("button",{className:"nc-mcard-main",onClick:()=>V.tmux&&e(V.tmuxSession),title:V.degraded?x("cell-degraded"):V.tmux?x("cell-on"):x("cell-off"),children:[f.jsx("span",{className:`dot ${ke}`}),f.jsxs("span",{className:"nc-mcard-text",children:[f.jsx("b",{children:V.cell}),f.jsx("small",{children:ge})]})]}),re.activity?f.jsx("span",{className:"nc-rel",children:Zo(re.activity)}):null,re.outbox&&re.outbox.count>0&&f.jsx("span",{className:"nc-badge",title:x("new-files-outbox"),children:re.outbox.count}),f.jsx("button",{className:`nc-act pin${te.includes(V.tmuxSession)?" on":""}`,title:x("pin"),onClick:()=>R(V.tmuxSession),children:te.includes(V.tmuxSession)?"★":"☆"}),f.jsx("button",{className:`nc-act power${V.tmux?" on":""}${V.degraded?" warn":""}`,onClick:()=>j(V),title:V.active?x("power-off"):x("power-on"),children:f.jsx(ze,{name:"power",size:16})})]},V.cell)})]}),f.jsxs("section",{className:"nc-group",children:[f.jsx("div",{className:"nc-group-title",children:x("local")}),ce.map(V=>f.jsxs("div",{className:"nc-mcard",children:[f.jsxs("button",{className:"nc-mcard-main",onClick:()=>e(V.name),children:[f.jsx("span",{className:V.attached?"dot on":"dot"}),f.jsxs("span",{className:"nc-mcard-text",children:[f.jsx("b",{children:V.name}),f.jsx("small",{children:V.preview?V.preview:V.cmd?V.cmd:x("windows").replace("{n}",String(V.windows||0))})]})]}),V.activity?f.jsx("span",{className:"nc-rel",children:Zo(V.activity)}):null,V.fresh&&f.jsx("span",{className:"nc-badge",title:x("new-files-outbox"),children:V.outbox.count}),f.jsx("button",{className:`nc-act pin${te.includes(V.name)?" on":""}`,title:x("pin"),onClick:()=>R(V.name),children:te.includes(V.name)?"★":"☆"}),f.jsx("button",{className:"nc-menu",title:x("terminate"),onClick:()=>{window.confirm(x("terminate-confirm").replace("{name}",V.name))&&ee(V.name)},children:"⋯"})]},V.name)),h===null&&f.jsx("div",{className:"nc-empty",children:x("loading-fleet")}),h!==null&&ce.length===0&&Q.length===0&&!_&&f.jsx("div",{className:"nc-empty",children:g?x("no-match").replace("{q}",g):x("no-sessions")})]}),a.map(V=>f.jsxs("section",{className:"nc-group",children:[f.jsxs("div",{className:"nc-group-title nc-node-title",children:[f.jsx("span",{className:`dot ${V.status==="up"?"on":"warn"}`}),V.label||V.name," · ",V.status==="up"?x("node-sessions").replace("{n}",String(V.sessions.length)):ny(V)]}),V.status==="up"&&V.sessions.map(re=>f.jsxs("div",{className:"nc-mcard",children:[f.jsxs("button",{className:"nc-mcard-main",onClick:()=>e({session:re.name,node:re.node}),children:[f.jsx("span",{className:re.attached?"dot on":"dot"}),f.jsxs("span",{className:"nc-mcard-text",children:[f.jsx("b",{children:re.name}),f.jsx("small",{children:re.preview?re.preview:re.cmd?re.cmd:x("windows").replace("{n}",String(re.windows||0))})]})]}),re.activity?f.jsx("span",{className:"nc-rel",children:Zo(re.activity)}):null,f.jsx("button",{className:"nc-menu",title:x("terminate"),onClick:()=>{window.confirm(x("terminate-confirm").replace("{name}",re.name))&&ee(re.name,V.route)},children:"⋯"})]},re.key)),V.status==="up"&&V.sessions.length===0&&f.jsx("div",{className:"nc-empty",children:x("no-sessions-short")})]},`nodo-${(V.route||[V.name]).join("/")}`)),f.jsxs("footer",{className:"nc-home-foot",onClick:O,title:x("copy-url"),children:[w&&f.jsxs("span",{children:["v",w]}),f.jsxs("span",{children:[we," · ",x("ssh-only")]}),f.jsx("span",{className:"nc-lang",onClick:V=>V.stopPropagation(),children:u_.map((V,re)=>f.jsxs("span",{children:[re>0&&" · ",f.jsx("button",{className:`nc-lang-btn${n===V?" on":""}`,onClick:()=>l(V),title:V,children:V.toUpperCase()})]},V))})]}),f.jsx("button",{className:"nc-fab",onClick:()=>U(!0),title:x("new-session"),"aria-label":x("new-session"),children:"+"}),N&&f.jsx(d_,{cell:N,engines:P,onConfirm:K,onClose:()=>j(null)}),I&&f.jsx(f_,{presets:A,targets:a.filter(V=>V.status==="up").map(V=>({route:V.route,label:V.label||V.name})),token:t,onCreate:Z,onClose:()=>U(!1)})]})}/**
|
|
41
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
42
|
+
* @license MIT
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
45
|
+
* @license MIT
|
|
46
|
+
*
|
|
47
|
+
* Originally forked from (with the author's permission):
|
|
48
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
49
|
+
* http://bellard.org/jslinux/
|
|
50
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
51
|
+
*/var m_=Object.defineProperty,ly=Object.getOwnPropertyDescriptor,ay=(e,t)=>{for(var r in t)m_(e,r,{get:t[r],enumerable:!0})},Je=(e,t,r,n)=>{for(var l=n>1?void 0:n?ly(t,r):t,a=e.length-1,h;a>=0;a--)(h=e[a])&&(l=(n?h(t,r,l):h(l))||l);return n&&l&&m_(t,r,l),l},de=(e,t)=>(r,n)=>t(r,n,e),pp="Terminal input",nh={get:()=>pp,set:e=>pp=e},mp="Too much output to announce, navigate to rows manually to read",oh={get:()=>mp,set:e=>mp=e};function cy(e){return e.replace(/\r?\n/g,"\r")}function hy(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function uy(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function dy(e,t,r,n){if(e.stopPropagation(),e.clipboardData){let l=e.clipboardData.getData("text/plain");__(l,t,r,n)}}function __(e,t,r,n){e=cy(e),e=hy(e,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function g_(e,t,r){let n=r.getBoundingClientRect(),l=e.clientX-n.left-10,a=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${l}px`,t.style.top=`${a}px`,t.style.zIndex="1000",t.focus()}function _p(e,t,r,n,l){g_(e,t,r),l&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function fr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function vl(e,t=0,r=e.length){let n="";for(let l=t;l<r;++l){let a=e[l];a>65535?(a-=65536,n+=String.fromCharCode((a>>10)+55296)+String.fromCharCode(a%1024+56320)):n+=String.fromCharCode(a)}return n}var fy=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let n=0,l=0;if(this._interim){let a=e.charCodeAt(l++);56320<=a&&a<=57343?t[n++]=(this._interim-55296)*1024+a-56320+65536:(t[n++]=this._interim,t[n++]=a),this._interim=0}for(let a=l;a<r;++a){let h=e.charCodeAt(a);if(55296<=h&&h<=56319){if(++a>=r)return this._interim=h,n;let d=e.charCodeAt(a);56320<=d&&d<=57343?t[n++]=(h-55296)*1024+d-56320+65536:(t[n++]=h,t[n++]=d);continue}h!==65279&&(t[n++]=h)}return n}},py=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let n=0,l,a,h,d,_=0,p=0;if(this.interim[0]){let w=!1,v=this.interim[0];v&=(v&224)===192?31:(v&240)===224?15:7;let C=0,b;for(;(b=this.interim[++C]&63)&&C<4;)v<<=6,v|=b;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,W=E-C;for(;p<W;){if(p>=r)return 0;if(b=e[p++],(b&192)!==128){p--,w=!0;break}else this.interim[C++]=b,v<<=6,v|=b&63}w||(E===2?v<128?p--:t[n++]=v:E===3?v<2048||v>=55296&&v<=57343||v===65279||(t[n++]=v):v<65536||v>1114111||(t[n++]=v)),this.interim.fill(0)}let g=r-4,y=p;for(;y<r;){for(;y<g&&!((l=e[y])&128)&&!((a=e[y+1])&128)&&!((h=e[y+2])&128)&&!((d=e[y+3])&128);)t[n++]=l,t[n++]=a,t[n++]=h,t[n++]=d,y+=4;if(l=e[y++],l<128)t[n++]=l;else if((l&224)===192){if(y>=r)return this.interim[0]=l,n;if(a=e[y++],(a&192)!==128){y--;continue}if(_=(l&31)<<6|a&63,_<128){y--;continue}t[n++]=_}else if((l&240)===224){if(y>=r)return this.interim[0]=l,n;if(a=e[y++],(a&192)!==128){y--;continue}if(y>=r)return this.interim[0]=l,this.interim[1]=a,n;if(h=e[y++],(h&192)!==128){y--;continue}if(_=(l&15)<<12|(a&63)<<6|h&63,_<2048||_>=55296&&_<=57343||_===65279)continue;t[n++]=_}else if((l&248)===240){if(y>=r)return this.interim[0]=l,n;if(a=e[y++],(a&192)!==128){y--;continue}if(y>=r)return this.interim[0]=l,this.interim[1]=a,n;if(h=e[y++],(h&192)!==128){y--;continue}if(y>=r)return this.interim[0]=l,this.interim[1]=a,this.interim[2]=h,n;if(d=e[y++],(d&192)!==128){y--;continue}if(_=(l&7)<<18|(a&63)<<12|(h&63)<<6|d&63,_<65536||_>1114111)continue;t[n++]=_}}return n}},v_="",pr=" ",En=class y_{constructor(){this.fg=0,this.bg=0,this.extended=new ol}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new y_;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ol=class S_{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new S_(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ni=class w_ extends En{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ol,this.combinedData=""}static fromCharData(t){let r=new w_;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?fr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let l=t[1].charCodeAt(1);56320<=l&&l<=57343?this.content=(n-55296)*1024+l-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},gp="di$target",lh="di$dependencies",yc=new Map;function my(e){return e[lh]||[]}function vt(e){if(yc.has(e))return yc.get(e);let t=function(r,n,l){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");_y(t,r,l)};return t._id=e,yc.set(e,t),t}function _y(e,t,r){t[gp]===t?t[lh].push({id:e,index:r}):(t[lh]=[{id:e,index:r}],t[gp]=t)}var Pt=vt("BufferService"),C_=vt("CoreMouseService"),Ir=vt("CoreService"),gy=vt("CharsetService"),Zh=vt("InstantiationService"),b_=vt("LogService"),Lt=vt("OptionsService"),x_=vt("OscLinkService"),vy=vt("UnicodeService"),Nn=vt("DecorationService"),ah=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var g;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let n=[],l=this._optionsService.rawOptions.linkHandler,a=new ni,h=r.getTrimmedLength(),d=-1,_=-1,p=!1;for(let y=0;y<h;y++)if(!(_===-1&&!r.hasContent(y))){if(r.loadCell(y,a),a.hasExtendedAttrs()&&a.extended.urlId)if(_===-1){_=y,d=a.extended.urlId;continue}else p=a.extended.urlId!==d;else _!==-1&&(p=!0);if(p||_!==-1&&y===h-1){let w=(g=this._oscLinkService.getLinkData(d))==null?void 0:g.uri;if(w){let v={start:{x:_+1,y:e},end:{x:y+(!p&&y===h-1?1:0),y:e}},C=!1;if(!(l!=null&&l.allowNonHttpProtocols))try{let b=new URL(w);["http:","https:"].includes(b.protocol)||(C=!0)}catch{C=!0}C||n.push({text:w,range:v,activate:(b,E)=>l?l.activate(b,E,v):yy(b,E),hover:(b,E)=>{var W;return(W=l==null?void 0:l.hover)==null?void 0:W.call(l,b,E,v)},leave:(b,E)=>{var W;return(W=l==null?void 0:l.leave)==null?void 0:W.call(l,b,E,v)}})}p=!1,a.hasExtendedAttrs()&&a.extended.urlId?(_=y,d=a.extended.urlId):(_=-1,d=-1)}}t(n)}};ah=Je([de(0,Pt),de(1,Lt),de(2,x_)],ah);function yy(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
52
|
+
|
|
53
|
+
WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var yl=vt("CharSizeService"),Hi=vt("CoreBrowserService"),eu=vt("MouseService"),Wi=vt("RenderService"),Sy=vt("SelectionService"),k_=vt("CharacterJoinerService"),_s=vt("ThemeService"),E_=vt("LinkProviderService"),wy=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?vp.isErrorNoTelemetry(e)?new vp(e.message+`
|
|
54
|
+
|
|
55
|
+
`+e.stack):new Error(e.message+`
|
|
56
|
+
|
|
57
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Cy=new wy;function el(e){by(e)||Cy.onUnexpectedError(e)}var ch="Canceled";function by(e){return e instanceof xy?!0:e instanceof Error&&e.name===ch&&e.message===ch}var xy=class extends Error{constructor(){super(ch),this.name=this.message}};function ky(e){return new Error(`Illegal argument: ${e}`)}var vp=class hh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof hh)return t;let r=new hh;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},uh=class N_ extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,N_.prototype)}};function qt(e,t=0){return e[e.length-(1+t)]}var Ey;(e=>{function t(a){return a<0}e.isLessThan=t;function r(a){return a<=0}e.isLessThanOrEqual=r;function n(a){return a>0}e.isGreaterThan=n;function l(a){return a===0}e.isNeitherLessOrGreaterThan=l,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ey||(Ey={}));function Ny(e,t){let r=this,n=!1,l;return function(){return n||(n=!0,t||(l=e.apply(r,arguments))),l}}var R_;(e=>{function t(P){return P&&typeof P=="object"&&typeof P[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*l(P){yield P}e.single=l;function a(P){return t(P)?P:l(P)}e.wrap=a;function h(P){return P||r}e.from=h;function*d(P){for(let J=P.length-1;J>=0;J--)yield P[J]}e.reverse=d;function _(P){return!P||P[Symbol.iterator]().next().done===!0}e.isEmpty=_;function p(P){return P[Symbol.iterator]().next().value}e.first=p;function g(P,J){let A=0;for(let M of P)if(J(M,A++))return!0;return!1}e.some=g;function y(P,J){for(let A of P)if(J(A))return A}e.find=y;function*w(P,J){for(let A of P)J(A)&&(yield A)}e.filter=w;function*v(P,J){let A=0;for(let M of P)yield J(M,A++)}e.map=v;function*C(P,J){let A=0;for(let M of P)yield*J(M,A++)}e.flatMap=C;function*b(...P){for(let J of P)yield*J}e.concat=b;function E(P,J,A){let M=A;for(let N of P)M=J(M,N);return M}e.reduce=E;function*W(P,J,A=P.length){for(J<0&&(J+=P.length),A<0?A+=P.length:A>P.length&&(A=P.length);J<A;J++)yield P[J]}e.slice=W;function B(P,J=Number.POSITIVE_INFINITY){let A=[];if(J===0)return[A,P];let M=P[Symbol.iterator]();for(let N=0;N<J;N++){let j=M.next();if(j.done)return[A,e.empty()];A.push(j.value)}return[A,{[Symbol.iterator](){return M}}]}e.consume=B;async function $(P){let J=[];for await(let A of P)J.push(A);return Promise.resolve(J)}e.asyncToArray=$})(R_||(R_={}));function jr(e){if(R_.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(n){t.push(n)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Ry(...e){return Ke(()=>jr(e))}function Ke(e){return{dispose:Ny(()=>{e()})}}var M_=class D_{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{jr(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?D_.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};M_.DISABLE_DISPOSED_WARNING=!1;var mr=M_,De=class{constructor(){this._store=new mr,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};De.None=Object.freeze({dispose(){}});var ms=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},zi=typeof window=="object"?window:globalThis,dh=class fh{constructor(t){this.element=t,this.next=fh.Undefined,this.prev=fh.Undefined}};dh.Undefined=new dh(void 0);var Ye=dh,yp=class{constructor(){this._first=Ye.Undefined,this._last=Ye.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ye.Undefined}clear(){let e=this._first;for(;e!==Ye.Undefined;){let t=e.next;e.prev=Ye.Undefined,e.next=Ye.Undefined,e=t}this._first=Ye.Undefined,this._last=Ye.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Ye(e);if(this._first===Ye.Undefined)this._first=r,this._last=r;else if(t){let l=this._last;this._last=r,r.prev=l,l.next=r}else{let l=this._first;this._first=r,r.next=l,l.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==Ye.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ye.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ye.Undefined&&e.next!==Ye.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ye.Undefined&&e.next===Ye.Undefined?(this._first=Ye.Undefined,this._last=Ye.Undefined):e.next===Ye.Undefined?(this._last=this._last.prev,this._last.next=Ye.Undefined):e.prev===Ye.Undefined&&(this._first=this._first.next,this._first.prev=Ye.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ye.Undefined;)yield e.element,e=e.next}},My=globalThis.performance&&typeof globalThis.performance.now=="function",Dy=class P_{static create(t){return new P_(t)}constructor(t){this._now=My&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ct;(e=>{e.None=()=>De.None;function t(H,O){return y(H,()=>{},0,void 0,!0,void 0,O)}e.defer=t;function r(H){return(O,K=null,ee)=>{let Z=!1,L;return L=H(D=>{if(!Z)return L?L.dispose():Z=!0,O.call(K,D)},null,ee),Z&&L.dispose(),L}}e.once=r;function n(H,O,K){return p((ee,Z=null,L)=>H(D=>ee.call(Z,O(D)),null,L),K)}e.map=n;function l(H,O,K){return p((ee,Z=null,L)=>H(D=>{O(D),ee.call(Z,D)},null,L),K)}e.forEach=l;function a(H,O,K){return p((ee,Z=null,L)=>H(D=>O(D)&&ee.call(Z,D),null,L),K)}e.filter=a;function h(H){return H}e.signal=h;function d(...H){return(O,K=null,ee)=>{let Z=Ry(...H.map(L=>L(D=>O.call(K,D))));return g(Z,ee)}}e.any=d;function _(H,O,K,ee){let Z=K;return n(H,L=>(Z=O(Z,L),Z),ee)}e.reduce=_;function p(H,O){let K,ee={onWillAddFirstListener(){K=H(Z.fire,Z)},onDidRemoveLastListener(){K==null||K.dispose()}},Z=new ae(ee);return O==null||O.add(Z),Z.event}function g(H,O){return O instanceof Array?O.push(H):O&&O.add(H),H}function y(H,O,K=100,ee=!1,Z=!1,L,D){let te,X,R,Q=0,ce,he={leakWarningThreshold:L,onWillAddFirstListener(){te=H(ve=>{Q++,X=O(X,ve),ee&&!R&&(pe.fire(X),X=void 0),ce=()=>{let we=X;X=void 0,R=void 0,(!ee||Q>1)&&pe.fire(we),Q=0},typeof K=="number"?(clearTimeout(R),R=setTimeout(ce,K)):R===void 0&&(R=0,queueMicrotask(ce))})},onWillRemoveListener(){Z&&Q>0&&(ce==null||ce())},onDidRemoveLastListener(){ce=void 0,te.dispose()}},pe=new ae(he);return D==null||D.add(pe),pe.event}e.debounce=y;function w(H,O=0,K){return e.debounce(H,(ee,Z)=>ee?(ee.push(Z),ee):[Z],O,void 0,!0,void 0,K)}e.accumulate=w;function v(H,O=(ee,Z)=>ee===Z,K){let ee=!0,Z;return a(H,L=>{let D=ee||!O(L,Z);return ee=!1,Z=L,D},K)}e.latch=v;function C(H,O,K){return[e.filter(H,O,K),e.filter(H,ee=>!O(ee),K)]}e.split=C;function b(H,O=!1,K=[],ee){let Z=K.slice(),L=H(X=>{Z?Z.push(X):te.fire(X)});ee&&ee.add(L);let D=()=>{Z==null||Z.forEach(X=>te.fire(X)),Z=null},te=new ae({onWillAddFirstListener(){L||(L=H(X=>te.fire(X)),ee&&ee.add(L))},onDidAddFirstListener(){Z&&(O?setTimeout(D):D())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return ee&&ee.add(te),te.event}e.buffer=b;function E(H,O){return(K,ee,Z)=>{let L=O(new B);return H(function(D){let te=L.evaluate(D);te!==W&&K.call(ee,te)},void 0,Z)}}e.chain=E;let W=Symbol("HaltChainable");class B{constructor(){this.steps=[]}map(O){return this.steps.push(O),this}forEach(O){return this.steps.push(K=>(O(K),K)),this}filter(O){return this.steps.push(K=>O(K)?K:W),this}reduce(O,K){let ee=K;return this.steps.push(Z=>(ee=O(ee,Z),ee)),this}latch(O=(K,ee)=>K===ee){let K=!0,ee;return this.steps.push(Z=>{let L=K||!O(Z,ee);return K=!1,ee=Z,L?Z:W}),this}evaluate(O){for(let K of this.steps)if(O=K(O),O===W)break;return O}}function $(H,O,K=ee=>ee){let ee=(...te)=>D.fire(K(...te)),Z=()=>H.on(O,ee),L=()=>H.removeListener(O,ee),D=new ae({onWillAddFirstListener:Z,onDidRemoveLastListener:L});return D.event}e.fromNodeEventEmitter=$;function P(H,O,K=ee=>ee){let ee=(...te)=>D.fire(K(...te)),Z=()=>H.addEventListener(O,ee),L=()=>H.removeEventListener(O,ee),D=new ae({onWillAddFirstListener:Z,onDidRemoveLastListener:L});return D.event}e.fromDOMEventEmitter=P;function J(H){return new Promise(O=>r(H)(O))}e.toPromise=J;function A(H){let O=new ae;return H.then(K=>{O.fire(K)},()=>{O.fire(void 0)}).finally(()=>{O.dispose()}),O.event}e.fromPromise=A;function M(H,O){return H(K=>O.fire(K))}e.forward=M;function N(H,O,K){return O(K),H(ee=>O(ee))}e.runAndSubscribe=N;class j{constructor(O,K){this._observable=O,this._counter=0,this._hasChanged=!1;let ee={onWillAddFirstListener:()=>{O.addObserver(this)},onDidRemoveLastListener:()=>{O.removeObserver(this)}};this.emitter=new ae(ee),K&&K.add(this.emitter)}beginUpdate(O){this._counter++}handlePossibleChange(O){}handleChange(O,K){this._hasChanged=!0}endUpdate(O){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function I(H,O){return new j(H,O).emitter.event}e.fromObservable=I;function U(H){return(O,K,ee)=>{let Z=0,L=!1,D={beginUpdate(){Z++},endUpdate(){Z--,Z===0&&(H.reportChanges(),L&&(L=!1,O.call(K)))},handlePossibleChange(){},handleChange(){L=!0}};H.addObserver(D),H.reportChanges();let te={dispose(){H.removeObserver(D)}};return ee instanceof mr?ee.add(te):Array.isArray(ee)&&ee.push(te),te}}e.fromObservableLight=U})(Ct||(Ct={}));var ph=class mh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${mh._idPool++}`,mh.all.add(this)}start(t){this._stopWatch=new Dy,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};ph.all=new Set,ph._idPool=0;var Py=ph,Ly=-1,L_=class T_{constructor(t,r,n=(T_._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let n=this.threshold;if(n<=0||r<n)return;this._stacks||(this._stacks=new Map);let l=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,l+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[a,h]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${h}):`;console.warn(d),console.warn(a);let _=new Ay(d,a);this._errorHandler(_)}return()=>{let a=this._stacks.get(t.value)||0;this._stacks.set(t.value,a-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[n,l]of this._stacks)(!t||r<l)&&(t=[n,l],r=l);return t}};L_._idPool=1;var Ty=L_,By=class B_{constructor(t){this.value=t}static create(){let t=new Error;return new B_(t.stack??"")}print(){console.warn(this.value.split(`
|
|
58
|
+
`).slice(2).join(`
|
|
59
|
+
`))}},Ay=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},jy=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Oy=0,Sc=class{constructor(e){this.value=e,this.id=Oy++}},Iy=2,zy,ae=class{constructor(e){var t,r,n,l;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new Ty((e==null?void 0:e.onListenerError)??el,((r=this._options)==null?void 0:r.leakWarningThreshold)??Ly):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new Py(this._options._profName):void 0,this._deliveryQueue=(l=this._options)==null?void 0:l.deliveryQueue}dispose(){var e,t,r,n;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t),(n=this._leakageMon)==null||n.dispose())}get event(){return this._event??(this._event=(e,t,r)=>{var h,d,_,p,g;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let y=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(y);let w=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],v=new jy(`${y}. HINT: Stack shows most frequent listener (${w[1]}-times)`,w[0]);return(((h=this._options)==null?void 0:h.onListenerError)||el)(v),De.None}if(this._disposed)return De.None;t&&(e=e.bind(t));let n=new Sc(e),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=By.create(),l=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof Sc?(this._deliveryQueue??(this._deliveryQueue=new Fy),this._listeners=[this._listeners,n]):this._listeners.push(n):((_=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||_.call(d,this),this._listeners=n,(g=(p=this._options)==null?void 0:p.onDidAddFirstListener)==null||g.call(p,this)),this._size++;let a=Ke(()=>{l==null||l(),this._removeListener(n)});return r instanceof mr?r.add(a):Array.isArray(r)&&r.push(a),a}),this._event}_removeListener(e){var l,a,h,d;if((a=(l=this._options)==null?void 0:l.onWillRemoveListener)==null||a.call(l,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(h=this._options)==null?void 0:h.onDidRemoveLastListener)==null||d.call(h,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let n=this._deliveryQueue.current===this;if(this._size*Iy<=t.length){let _=0;for(let p=0;p<t.length;p++)t[p]?t[_++]=t[p]:n&&(this._deliveryQueue.end--,_<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=_}}_deliver(e,t){var n;if(!e)return;let r=((n=this._options)==null?void 0:n.onListenerError)||el;if(!r){e.value(t);return}try{e.value(t)}catch(l){r(l)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,r,n,l;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(n=this._perfMon)==null||n.start(this._size),this._listeners)if(this._listeners instanceof Sc)this._deliver(this._listeners,e);else{let a=this._deliveryQueue;a.enqueue(this,e,this._listeners.length),this._deliverQueue(a)}(l=this._perfMon)==null||l.stop()}hasListeners(){return this._size>0}},Fy=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},_h=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ae,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ae,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};_h.INSTANCE=new _h;var tu=_h;function Hy(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}tu.INSTANCE.onDidChangeZoomLevel;function Wy(e){return tu.INSTANCE.getZoomFactor(e)}tu.INSTANCE.onDidChangeFullscreen;var gs=typeof navigator=="object"?navigator.userAgent:"",gh=gs.indexOf("Firefox")>=0,$y=gs.indexOf("AppleWebKit")>=0,iu=gs.indexOf("Chrome")>=0,Uy=!iu&&gs.indexOf("Safari")>=0;gs.indexOf("Electron/")>=0;gs.indexOf("Android")>=0;var wc=!1;if(typeof zi.matchMedia=="function"){let e=zi.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=zi.matchMedia("(display-mode: fullscreen)");wc=e.matches,Hy(zi,e,({matches:r})=>{wc&&t.matches||(wc=r)})}var ps="en",vh=!1,yh=!1,tl=!1,A_=!1,Uo,il=ps,Sp=ps,Ky,fi,Ar=globalThis,wt,Xm;typeof Ar.vscode<"u"&&typeof Ar.vscode.process<"u"?wt=Ar.vscode.process:typeof process<"u"&&typeof((Xm=process==null?void 0:process.versions)==null?void 0:Xm.node)=="string"&&(wt=process);var Gm,Vy=typeof((Gm=wt==null?void 0:wt.versions)==null?void 0:Gm.electron)=="string",qy=Vy&&(wt==null?void 0:wt.type)==="renderer",Qm;if(typeof wt=="object"){vh=wt.platform==="win32",yh=wt.platform==="darwin",tl=wt.platform==="linux",tl&&wt.env.SNAP&&wt.env.SNAP_REVISION,wt.env.CI||wt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Uo=ps,il=ps;let e=wt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Uo=t.userLocale,Sp=t.osLocale,il=t.resolvedLanguage||ps,Ky=(Qm=t.languagePack)==null?void 0:Qm.translationsConfigFile}catch{}A_=!0}else typeof navigator=="object"&&!qy?(fi=navigator.userAgent,vh=fi.indexOf("Windows")>=0,yh=fi.indexOf("Macintosh")>=0,(fi.indexOf("Macintosh")>=0||fi.indexOf("iPad")>=0||fi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,tl=fi.indexOf("Linux")>=0,(fi==null?void 0:fi.indexOf("Mobi"))>=0,il=globalThis._VSCODE_NLS_LANGUAGE||ps,Uo=navigator.language.toLowerCase(),Sp=Uo):console.error("Unable to resolve platform.");var j_=vh,ki=yh,Yy=tl,wp=A_,Ei=fi,cr=il,Xy;(e=>{function t(){return cr}e.value=t;function r(){return cr.length===2?cr==="en":cr.length>=3?cr[0]==="e"&&cr[1]==="n"&&cr[2]==="-":!1}e.isDefaultVariant=r;function n(){return cr==="en"}e.isDefault=n})(Xy||(Xy={}));var Gy=typeof Ar.postMessage=="function"&&!Ar.importScripts;(()=>{if(Gy){let e=[];Ar.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let n=0,l=e.length;n<l;n++){let a=e[n];if(a.id===r.data.vscodeScheduleAsyncWork){e.splice(n,1),a.callback();return}}});let t=0;return r=>{let n=++t;e.push({id:n,callback:r}),Ar.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var Qy=!!(Ei&&Ei.indexOf("Chrome")>=0);Ei&&Ei.indexOf("Firefox")>=0;!Qy&&Ei&&Ei.indexOf("Safari")>=0;Ei&&Ei.indexOf("Edg/")>=0;Ei&&Ei.indexOf("Android")>=0;var us=typeof navigator=="object"?navigator:{};wp||document.queryCommandSupported&&document.queryCommandSupported("copy")||us&&us.clipboard&&us.clipboard.writeText,wp||us&&us.clipboard&&us.clipboard.readText;var ru=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Cc=new ru,Cp=new ru,bp=new ru,Jy=new Array(230),O_;(e=>{function t(d){return Cc.keyCodeToStr(d)}e.toString=t;function r(d){return Cc.strToKeyCode(d)}e.fromString=r;function n(d){return Cp.keyCodeToStr(d)}e.toUserSettingsUS=n;function l(d){return bp.keyCodeToStr(d)}e.toUserSettingsGeneral=l;function a(d){return Cp.strToKeyCode(d)||bp.strToKeyCode(d)}e.fromUserSettings=a;function h(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Cc.keyCodeToStr(d)}e.toElectronAccelerator=h})(O_||(O_={}));var Zy=class I_{constructor(t,r,n,l,a){this.ctrlKey=t,this.shiftKey=r,this.altKey=n,this.metaKey=l,this.keyCode=a}equals(t){return t instanceof I_&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",n=this.altKey?"1":"0",l=this.metaKey?"1":"0";return`K${t}${r}${n}${l}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new eS([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},eS=class{constructor(e){if(e.length===0)throw ky("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function tS(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return O_.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(gh)switch(t){case 59:return 85;case 60:if(Yy)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ki)return 57;break}else if($y&&(ki&&t===93||!ki&&t===92))return 57;return Jy[t]||0}var iS=ki?256:2048,rS=512,sS=1024,nS=ki?2048:256,xp=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=tS(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=iS),this.altKey&&(t|=rS),this.shiftKey&&(t|=sS),this.metaKey&&(t|=nS),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Zy(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},kp=new WeakMap;function oS(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var lS=class{static getSameOriginWindowChain(e){let t=kp.get(e);if(!t){t=[],kp.set(e,t);let r=e,n;do n=oS(r),n?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=n;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,n=0,l=this.getSameOriginWindowChain(e);for(let a of l){let h=a.window.deref();if(r+=(h==null?void 0:h.scrollY)??0,n+=(h==null?void 0:h.scrollX)??0,h===t||!a.iframeElement)break;let d=a.iframeElement.getBoundingClientRect();r+=d.top,n+=d.left}return{top:r,left:n}}},Ko=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=lS.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Ep=class{constructor(e,t=0,r=0){var l;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let n=!1;if(iu){let a=navigator.userAgent.match(/Chrome\/(\d+)/);n=(a?parseInt(a[1]):123)<=122}if(e){let a=e,h=e,d=((l=e.view)==null?void 0:l.devicePixelRatio)||1;if(typeof a.wheelDeltaY<"u")n?this.deltaY=a.wheelDeltaY/(120*d):this.deltaY=a.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(e.type==="wheel"){let _=e;_.deltaMode===_.DOM_DELTA_LINE?gh&&!ki?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")Uy&&j_?this.deltaX=-(a.wheelDeltaX/120):n?this.deltaX=a.wheelDeltaX/(120*d):this.deltaX=a.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let _=e;_.deltaMode===_.DOM_DELTA_LINE?gh&&!ki?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},z_=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),aS;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof cS?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ct.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:z_})})(aS||(aS={}));var cS=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?z_:(this._emitter||(this._emitter=new ae),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},su=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new uh("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new uh("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},hS=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new uh("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=Ke(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},uS;(e=>{async function t(n){let l,a=await Promise.all(n.map(h=>h.then(d=>d,d=>{l||(l=d)})));if(typeof l<"u")throw l;return a}e.settled=t;function r(n){return new Promise(async(l,a)=>{try{await n(l,a)}catch(h){a(h)}})}e.withAsyncBody=r})(uS||(uS={}));var Np=class ri{static fromArray(t){return new ri(r=>{r.emitMany(t)})}static fromPromise(t){return new ri(async r=>{r.emitMany(await t)})}static fromPromises(t){return new ri(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new ri(async r=>{await Promise.all(t.map(async n=>{for await(let l of n)r.emitOne(l)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new ae,queueMicrotask(async()=>{let n={emitOne:l=>this.emitOne(l),emitMany:l=>this.emitMany(l),reject:l=>this.reject(l)};try{await Promise.resolve(t(n)),this.resolve()}catch(l){this.reject(l)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ct.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new ri(async n=>{for await(let l of t)n.emitOne(r(l))})}map(t){return ri.map(this,t)}static filter(t,r){return new ri(async n=>{for await(let l of t)r(l)&&n.emitOne(l)})}filter(t){return ri.filter(this,t)}static coalesce(t){return ri.filter(t,r=>!!r)}coalesce(){return ri.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return ri.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Np.EMPTY=Np.fromArray([]);var{getWindow:xi,getWindowId:dS,onDidRegisterWindow:fS}=(function(){let e=new Map,t={window:zi,disposables:new mr};e.set(zi.vscodeWindowId,t);let r=new ae,n=new ae,l=new ae;function a(h,d){return(typeof h=="number"?e.get(h):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:l.event,onDidUnregisterWindow:n.event,registerWindow(h){if(e.has(h.vscodeWindowId))return De.None;let d=new mr,_={window:h,disposables:d.add(new mr)};return e.set(h.vscodeWindowId,_),d.add(Ke(()=>{e.delete(h.vscodeWindowId),n.fire(h)})),d.add(Ne(h,ft.BEFORE_UNLOAD,()=>{l.fire(h)})),r.fire(_),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(h){return h.vscodeWindowId},hasWindow(h){return e.has(h)},getWindowById:a,getWindow(h){var p;let d=h;if((p=d==null?void 0:d.ownerDocument)!=null&&p.defaultView)return d.ownerDocument.defaultView.window;let _=h;return _!=null&&_.view?_.view.window:zi},getDocument(h){return xi(h).document}}})(),pS=class{constructor(e,t,r,n){this._node=e,this._type=t,this._handler=r,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ne(e,t,r,n){return new pS(e,t,r,n)}var Rp=function(e,t,r,n){return Ne(e,t,r,n)},nu,mS=class extends hS{constructor(e){super(),this.defaultTarget=e&&xi(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},Mp=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){el(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,n=new Map,l=a=>{r.set(a,!1);let h=e.get(a)??[];for(t.set(a,h),e.set(a,[]),n.set(a,!0);h.length>0;)h.sort(Mp.sort),h.shift().execute();n.set(a,!1)};nu=(a,h,d=0)=>{let _=dS(a),p=new Mp(h,d),g=e.get(_);return g||(g=[],e.set(_,g)),g.push(p),r.get(_)||(r.set(_,!0),a.requestAnimationFrame(()=>l(_))),p}})();function _S(e){let t=e.getBoundingClientRect(),r=xi(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var ft={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},gS=class{constructor(t){this.domNode=t,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(t){let r=Ft(t);this._maxWidth!==r&&(this._maxWidth=r,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let r=Ft(t);this._width!==r&&(this._width=r,this.domNode.style.width=this._width)}setHeight(t){let r=Ft(t);this._height!==r&&(this._height=r,this.domNode.style.height=this._height)}setTop(t){let r=Ft(t);this._top!==r&&(this._top=r,this.domNode.style.top=this._top)}setLeft(t){let r=Ft(t);this._left!==r&&(this._left=r,this.domNode.style.left=this._left)}setBottom(t){let r=Ft(t);this._bottom!==r&&(this._bottom=r,this.domNode.style.bottom=this._bottom)}setRight(t){let r=Ft(t);this._right!==r&&(this._right=r,this.domNode.style.right=this._right)}setPaddingTop(t){let r=Ft(t);this._paddingTop!==r&&(this._paddingTop=r,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let r=Ft(t);this._paddingLeft!==r&&(this._paddingLeft=r,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let r=Ft(t);this._paddingBottom!==r&&(this._paddingBottom=r,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let r=Ft(t);this._paddingRight!==r&&(this._paddingRight=r,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let r=Ft(t);this._fontSize!==r&&(this._fontSize=r,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let r=Ft(t);this._lineHeight!==r&&(this._lineHeight=r,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let r=Ft(t);this._letterSpacing!==r&&(this._letterSpacing=r,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,r){this.domNode.classList.toggle(t,r),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,r){this.domNode.setAttribute(t,r)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function Ft(e){return typeof e=="number"?`${e}px`:e}function wn(e){return new gS(e)}var F_=class{constructor(){this._hooks=new mr,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,n,l){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=l;let a=e;try{e.setPointerCapture(t),this._hooks.add(Ke(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=xi(e)}this._hooks.add(Ne(a,ft.POINTER_MOVE,h=>{if(h.buttons!==r){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(Ne(a,ft.POINTER_UP,h=>this.stopMonitoring(!0)))}};function vS(e,t,r){let n=null,l=null;if(typeof r.value=="function"?(n="value",l=r.value,l.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(n="get",l=r.get),!l)throw new Error("not supported");let a=`$memoize$${t}`;r[n]=function(...h){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:l.apply(this,h)}),this[a]}}var bi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(bi||(bi={}));var _n=class Nt extends De{constructor(){super(),this.dispatched=!1,this.targets=new yp,this.ignoreTargets=new yp,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ct.runAndSubscribe(fS,({window:t,disposables:r})=>{r.add(Ne(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(Ne(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(Ne(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:zi,disposables:this._store}))}static addTarget(t){if(!Nt.isTouchDevice())return De.None;Nt.INSTANCE||(Nt.INSTANCE=new Nt);let r=Nt.INSTANCE.targets.push(t);return Ke(r)}static ignoreTarget(t){if(!Nt.isTouchDevice())return De.None;Nt.INSTANCE||(Nt.INSTANCE=new Nt);let r=Nt.INSTANCE.ignoreTargets.push(t);return Ke(r)}static isTouchDevice(){return"ontouchstart"in zi||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,l=t.targetTouches.length;n<l;n++){let a=t.targetTouches.item(n);this.activeTouches[a.identifier]={id:a.identifier,initialTarget:a.target,initialTimeStamp:r,initialPageX:a.pageX,initialPageY:a.pageY,rollingTimestamps:[r],rollingPageX:[a.pageX],rollingPageY:[a.pageY]};let h=this.newGestureEvent(bi.Start,a.target);h.pageX=a.pageX,h.pageY=a.pageY,this.dispatchEvent(h)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let n=Date.now(),l=Object.keys(this.activeTouches).length;for(let a=0,h=r.changedTouches.length;a<h;a++){let d=r.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let _=this.activeTouches[d.identifier],p=Date.now()-_.initialTimeStamp;if(p<Nt.HOLD_DELAY&&Math.abs(_.initialPageX-qt(_.rollingPageX))<30&&Math.abs(_.initialPageY-qt(_.rollingPageY))<30){let g=this.newGestureEvent(bi.Tap,_.initialTarget);g.pageX=qt(_.rollingPageX),g.pageY=qt(_.rollingPageY),this.dispatchEvent(g)}else if(p>=Nt.HOLD_DELAY&&Math.abs(_.initialPageX-qt(_.rollingPageX))<30&&Math.abs(_.initialPageY-qt(_.rollingPageY))<30){let g=this.newGestureEvent(bi.Contextmenu,_.initialTarget);g.pageX=qt(_.rollingPageX),g.pageY=qt(_.rollingPageY),this.dispatchEvent(g)}else if(l===1){let g=qt(_.rollingPageX),y=qt(_.rollingPageY),w=qt(_.rollingTimestamps)-_.rollingTimestamps[0],v=g-_.rollingPageX[0],C=y-_.rollingPageY[0],b=[...this.targets].filter(E=>_.initialTarget instanceof Node&&E.contains(_.initialTarget));this.inertia(t,b,n,Math.abs(v)/w,v>0?1:-1,g,Math.abs(C)/w,C>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(bi.End,_.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=r,n.tapCount=0,n}dispatchEvent(t){if(t.type===bi.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>Nt.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===bi.Change||t.type===bi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let r=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let l=0,a=t.initialTarget;for(;a&&a!==n;)l++,a=a.parentElement;r.push([l,n])}r.sort((n,l)=>n[0]-l[0]);for(let[n,l]of r)l.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,n,l,a,h,d,_,p){this.handle=nu(t,()=>{let g=Date.now(),y=g-n,w=0,v=0,C=!0;l+=Nt.SCROLL_FRICTION*y,d+=Nt.SCROLL_FRICTION*y,l>0&&(C=!1,w=a*l*y),d>0&&(C=!1,v=_*d*y);let b=this.newGestureEvent(bi.Change);b.translationX=w,b.translationY=v,r.forEach(E=>E.dispatchEvent(b)),C||this.inertia(t,r,g,l,a,h+w,d,_,p+v)})}onTouchMove(t){let r=Date.now();for(let n=0,l=t.changedTouches.length;n<l;n++){let a=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("end of an UNKNOWN touch",a);continue}let h=this.activeTouches[a.identifier],d=this.newGestureEvent(bi.Change,h.initialTarget);d.translationX=a.pageX-qt(h.rollingPageX),d.translationY=a.pageY-qt(h.rollingPageY),d.pageX=a.pageX,d.pageY=a.pageY,this.dispatchEvent(d),h.rollingPageX.length>3&&(h.rollingPageX.shift(),h.rollingPageY.shift(),h.rollingTimestamps.shift()),h.rollingPageX.push(a.pageX),h.rollingPageY.push(a.pageY),h.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};_n.SCROLL_FRICTION=-.005,_n.HOLD_DELAY=700,_n.CLEAR_TAP_COUNT_TIME=400,Je([vS],_n,"isTouchDevice",1);var yS=_n,ou=class extends De{onclick(e,t){this._register(Ne(e,ft.CLICK,r=>t(new Ko(xi(e),r))))}onmousedown(e,t){this._register(Ne(e,ft.MOUSE_DOWN,r=>t(new Ko(xi(e),r))))}onmouseover(e,t){this._register(Ne(e,ft.MOUSE_OVER,r=>t(new Ko(xi(e),r))))}onmouseleave(e,t){this._register(Ne(e,ft.MOUSE_LEAVE,r=>t(new Ko(xi(e),r))))}onkeydown(e,t){this._register(Ne(e,ft.KEY_DOWN,r=>t(new xp(r))))}onkeyup(e,t){this._register(Ne(e,ft.KEY_UP,r=>t(new xp(r))))}oninput(e,t){this._register(Ne(e,ft.INPUT,t))}onblur(e,t){this._register(Ne(e,ft.BLUR,t))}onfocus(e,t){this._register(Ne(e,ft.FOCUS,t))}onchange(e,t){this._register(Ne(e,ft.CHANGE,t))}ignoreGesture(e){return yS.ignoreTarget(e)}},Dp=11,SS=class extends ou{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=Dp+"px",this.domNode.style.height=Dp+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new F_),this._register(Rp(this.bgDomNode,ft.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Rp(this.domNode,ft.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new mS),this._pointerdownScheduleRepeatTimer=this._register(new su)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,xi(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},wS=class Sh{constructor(t,r,n,l,a,h,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,n=n|0,l=l|0,a=a|0,h=h|0,d=d|0),this.rawScrollLeft=l,this.rawScrollTop=d,r<0&&(r=0),l+r>n&&(l=n-r),l<0&&(l=0),a<0&&(a=0),d+a>h&&(d=h-a),d<0&&(d=0),this.width=r,this.scrollWidth=n,this.scrollLeft=l,this.height=a,this.scrollHeight=h,this.scrollTop=d}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new Sh(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Sh(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,r){let n=this.width!==t.width,l=this.scrollWidth!==t.scrollWidth,a=this.scrollLeft!==t.scrollLeft,h=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,_=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:l,scrollLeftChanged:a,heightChanged:h,scrollHeightChanged:d,scrollTopChanged:_}}},CS=class extends De{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new wS(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var n;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(n=this._smoothScrolling)==null||n.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let n;t?n=new Lp(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=Lp.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},Pp=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function bc(e,t){let r=t-e;return function(n){return e+r*kS(n)}}function bS(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var Lp=class wh{constructor(t,r,n,l){this.from=t,this.to=r,this.duration=l,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,r,n){if(Math.abs(t-r)>2.5*n){let l,a;return t<r?(l=t+.75*n,a=r-.75*n):(l=t-.75*n,a=r+.75*n),bS(bc(t,l),bc(a,r),.33)}return bc(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let n=this.scrollLeft(r),l=this.scrollTop(r);return new Pp(n,l,!1)}return new Pp(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,n){return wh.start(t,r,n)}static start(t,r,n){n=n+10;let l=Date.now()-10;return new wh(t,r,l,n)}};function xS(e){return Math.pow(e,3)}function kS(e){return 1-xS(1-e)}var ES=class extends De{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new su)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},NS=140,H_=class extends ou{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new ES(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new F_),this._shouldRender=!0,this.domNode=wn(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Ne(this.domNode.domNode,ft.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new SS(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=wn(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ne(this.slider.domNode,ft.POINTER_DOWN,l=>{l.button===0&&(l.preventDefault(),this._sliderPointerDown(l))})),this.onclick(this.slider.domNode,l=>{l.leftButton&&l.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),l=this._sliderPointerPosition(e);r<=l&&l<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let l=_S(this.domNode.domNode);t=e.pageX-l.left,r=e.pageY-l.top}let n=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,l=>{let a=this._sliderOrthogonalPointerPosition(l),h=Math.abs(a-r);if(j_&&h>NS){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let d=this._sliderPointerPosition(l)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(d))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},W_=class Ch{constructor(t,r,n,l,a,h){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=l,this._scrollSize=a,this._scrollPosition=h,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Ch(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,n,l,a){let h=Math.max(0,n-t),d=Math.max(0,h-2*r),_=l>0&&l>n;if(!_)return{computedAvailableSize:Math.round(h),computedIsNeeded:_,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let p=Math.round(Math.max(20,Math.floor(n*d/l))),g=(d-p)/(l-n),y=a*g;return{computedAvailableSize:Math.round(h),computedIsNeeded:_,computedSliderSize:Math.round(p),computedSliderRatio:g,computedSliderPosition:Math.round(y)}}_refreshComputedValues(){let t=Ch._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,n=this._scrollPosition;return r<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},RS=class extends H_{constructor(e,t,r){let n=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new W_(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,l.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},MS=class extends H_{constructor(e,t,r){let n=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new W_(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,l.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},DS=500,Tp=50,PS=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},bh=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,n=1,l=this._rear;do{let a=l===this._front?t:Math.pow(2,-n);if(t-=a,r+=this._memory[l].score*a,l===this._front)break;l=(this._capacity+l-1)%this._capacity,n++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(iu){let r=xi(t.browserEvent),n=Wy(r);this.accept(Date.now(),t.deltaX*n,t.deltaY*n)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,n){let l=null,a=new PS(t,r,n);this._front===-1&&this._rear===-1?(this._memory[0]=a,this._front=0,this._rear=0):(l=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=a),a.score=this._computeScore(a,l)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),r){let l=Math.abs(t.deltaX),a=Math.abs(t.deltaY),h=Math.abs(r.deltaX),d=Math.abs(r.deltaY),_=Math.max(Math.min(l,h),1),p=Math.max(Math.min(a,d),1),g=Math.max(l,h),y=Math.max(a,d);g%_===0&&y%p===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};bh.INSTANCE=new bh;var LS=bh,TS=class extends ou{constructor(e,t,r){super(),this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ae),this.onWillScroll=this._onWillScroll.event,this._options=AS(t),this._scrollable=r,this._register(this._scrollable.onScroll(l=>{this._onWillScroll.fire(l),this._onDidScroll(l),this._onScroll.fire(l)}));let n={onMouseWheel:l=>this._onMouseWheel(l),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new MS(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new RS(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=wn(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=wn(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=wn(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,l=>this._onMouseOver(l)),this.onmouseleave(this._listenOnDomNode,l=>this._onMouseLeave(l)),this._hideTimeout=this._register(new su),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=jr(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,ki&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ep(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=jr(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new Ep(r))};this._mouseWheelToDispose.push(Ne(this._listenOnDomNode,ft.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var l;if((l=e.browserEvent)!=null&&l.defaultPrevented)return;let t=LS.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+a===0?h=a=0:Math.abs(a)>=Math.abs(h)?h=0:a=0),this._options.flipAxes&&([a,h]=[h,a]);let d=!ki&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!h&&(h=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let _=this._scrollable.getFutureScrollPosition(),p={};if(a){let g=Tp*a,y=_.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(p,y)}if(h){let g=Tp*h,y=_.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(p,y)}p=this._scrollable.validateScrollPosition(p),(_.scrollLeft!==p.scrollLeft||_.scrollTop!==p.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(p):this._scrollable.setScrollPositionNow(p),r=!0)}let n=r;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,r=e.scrollLeft>0,n=r?" left":"",l=t?" top":"",a=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${l}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${l}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),DS)}},BS=class extends TS{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function AS(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,ki&&(t.className+=" mac"),t}var xh=class extends De{constructor(e,t,r,n,l,a,h,d){super(),this._bufferService=r,this._optionsService=h,this._renderService=d,this._onRequestScrollLines=this._register(new ae),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let _=this._register(new CS({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>nu(n.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{_.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new BS(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},_)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(l.onProtocolChange(p=>{this._scrollableElement.updateOptions({handleMouseWheel:!(p&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ct.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ke(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ke(()=>this._styleElement.remove())),this._register(Ct.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${a.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${a.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${a.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
60
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(p=>this._handleScroll(p)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};xh=Je([de(2,Pt),de(3,Hi),de(4,C_),de(5,_s),de(6,Lt),de(7,Wi)],xh);var kh=class extends De{constructor(e,t,r,n,l){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=n,this._renderService=l,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(a=>this._removeDecoration(a))),this._register(Ke(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var n;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((n=e==null?void 0:e.options)==null?void 0:n.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};kh=Je([de(1,Pt),de(2,Hi),de(3,Nn),de(4,Wi)],kh);var jS=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(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Si={full:0,left:0,center:0,right:0},hr={full:0,left:0,center:0,right:0},an={full:0,left:0,center:0,right:0},ll=class extends De{constructor(e,t,r,n,l,a,h,d){var p;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=n,this._renderService=l,this._optionsService=a,this._themeService=h,this._coreBrowserService=d,this._colorZoneStore=new jS,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(),(p=this._viewportElement.parentElement)==null||p.insertBefore(this._canvas,this._viewportElement),this._register(Ke(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let _=this._canvas.getContext("2d");if(_)this._ctx=_;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);hr.full=this._canvas.width,hr.left=e,hr.center=t,hr.right=e,this._refreshDrawHeightConstants(),an.full=1,an.left=1,an.center=1+hr.left,an.right=1+hr.left+hr.center}_refreshDrawHeightConstants(){Si.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Si.left=t,Si.center=t,Si.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Si.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Si.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Si.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Si.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(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(an[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Si[e.position||"full"]/2),hr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Si[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};ll=Je([de(2,Pt),de(3,Nn),de(4,Wi),de(5,Lt),de(6,_s),de(7,Hi)],ll);var ie;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
61
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ie||(ie={}));var rl;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(rl||(rl={}));var $_;(e=>e.ST=`${ie.ESC}\\`)($_||($_={}));var Eh=class{constructor(e,t,r,n,l,a){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=n,this._coreService=l,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ie.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,l=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=l+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=l+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Eh=Je([de(2,Pt),de(3,Lt),de(4,Ir),de(5,Wi)],Eh);var pt=0,mt=0,_t=0,Qe=0,Bp={css:"#00000000",rgba:0},st;(e=>{function t(l,a,h,d){return d!==void 0?`#${Dr(l)}${Dr(a)}${Dr(h)}${Dr(d)}`:`#${Dr(l)}${Dr(a)}${Dr(h)}`}e.toCss=t;function r(l,a,h,d=255){return(l<<24|a<<16|h<<8|d)>>>0}e.toRgba=r;function n(l,a,h,d){return{css:e.toCss(l,a,h,d),rgba:e.toRgba(l,a,h,d)}}e.toColor=n})(st||(st={}));var $e;(e=>{function t(_,p){if(Qe=(p.rgba&255)/255,Qe===1)return{css:p.css,rgba:p.rgba};let g=p.rgba>>24&255,y=p.rgba>>16&255,w=p.rgba>>8&255,v=_.rgba>>24&255,C=_.rgba>>16&255,b=_.rgba>>8&255;pt=v+Math.round((g-v)*Qe),mt=C+Math.round((y-C)*Qe),_t=b+Math.round((w-b)*Qe);let E=st.toCss(pt,mt,_t),W=st.toRgba(pt,mt,_t);return{css:E,rgba:W}}e.blend=t;function r(_){return(_.rgba&255)===255}e.isOpaque=r;function n(_,p,g){let y=sl.ensureContrastRatio(_.rgba,p.rgba,g);if(y)return st.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=n;function l(_){let p=(_.rgba|255)>>>0;return[pt,mt,_t]=sl.toChannels(p),{css:st.toCss(pt,mt,_t),rgba:p}}e.opaque=l;function a(_,p){return Qe=Math.round(p*255),[pt,mt,_t]=sl.toChannels(_.rgba),{css:st.toCss(pt,mt,_t,Qe),rgba:st.toRgba(pt,mt,_t,Qe)}}e.opacity=a;function h(_,p){return Qe=_.rgba&255,a(_,Qe*p/255)}e.multiplyOpacity=h;function d(_){return[_.rgba>>24&255,_.rgba>>16&255,_.rgba>>8&255]}e.toColorRGB=d})($e||($e={}));var Xe;(e=>{let t,r;try{let l=document.createElement("canvas");l.width=1,l.height=1;let a=l.getContext("2d",{willReadFrequently:!0});a&&(t=a,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(l){if(l.match(/#[\da-f]{3,8}/i))switch(l.length){case 4:return pt=parseInt(l.slice(1,2).repeat(2),16),mt=parseInt(l.slice(2,3).repeat(2),16),_t=parseInt(l.slice(3,4).repeat(2),16),st.toColor(pt,mt,_t);case 5:return pt=parseInt(l.slice(1,2).repeat(2),16),mt=parseInt(l.slice(2,3).repeat(2),16),_t=parseInt(l.slice(3,4).repeat(2),16),Qe=parseInt(l.slice(4,5).repeat(2),16),st.toColor(pt,mt,_t,Qe);case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}let a=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return pt=parseInt(a[1]),mt=parseInt(a[2]),_t=parseInt(a[3]),Qe=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),st.toColor(pt,mt,_t,Qe);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=l,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[pt,mt,_t,Qe]=t.getImageData(0,0,1,1).data,Qe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:st.toRgba(pt,mt,_t,Qe),css:l}}e.toColor=n})(Xe||(Xe={}));var Dt;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,l,a){let h=n/255,d=l/255,_=a/255,p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),y=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4);return p*.2126+g*.7152+y*.0722}e.relativeLuminance2=r})(Dt||(Dt={}));var sl;(e=>{function t(h,d){if(Qe=(d&255)/255,Qe===1)return d;let _=d>>24&255,p=d>>16&255,g=d>>8&255,y=h>>24&255,w=h>>16&255,v=h>>8&255;return pt=y+Math.round((_-y)*Qe),mt=w+Math.round((p-w)*Qe),_t=v+Math.round((g-v)*Qe),st.toRgba(pt,mt,_t)}e.blend=t;function r(h,d,_){let p=Dt.relativeLuminance(h>>8),g=Dt.relativeLuminance(d>>8);if(Ii(p,g)<_){if(g<p){let v=n(h,d,_),C=Ii(p,Dt.relativeLuminance(v>>8));if(C<_){let b=l(h,d,_),E=Ii(p,Dt.relativeLuminance(b>>8));return C>E?v:b}return v}let y=l(h,d,_),w=Ii(p,Dt.relativeLuminance(y>>8));if(w<_){let v=n(h,d,_),C=Ii(p,Dt.relativeLuminance(v>>8));return w>C?y:v}return y}}e.ensureContrastRatio=r;function n(h,d,_){let p=h>>24&255,g=h>>16&255,y=h>>8&255,w=d>>24&255,v=d>>16&255,C=d>>8&255,b=Ii(Dt.relativeLuminance2(w,v,C),Dt.relativeLuminance2(p,g,y));for(;b<_&&(w>0||v>0||C>0);)w-=Math.max(0,Math.ceil(w*.1)),v-=Math.max(0,Math.ceil(v*.1)),C-=Math.max(0,Math.ceil(C*.1)),b=Ii(Dt.relativeLuminance2(w,v,C),Dt.relativeLuminance2(p,g,y));return(w<<24|v<<16|C<<8|255)>>>0}e.reduceLuminance=n;function l(h,d,_){let p=h>>24&255,g=h>>16&255,y=h>>8&255,w=d>>24&255,v=d>>16&255,C=d>>8&255,b=Ii(Dt.relativeLuminance2(w,v,C),Dt.relativeLuminance2(p,g,y));for(;b<_&&(w<255||v<255||C<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),b=Ii(Dt.relativeLuminance2(w,v,C),Dt.relativeLuminance2(p,g,y));return(w<<24|v<<16|C<<8|255)>>>0}e.increaseLuminance=l;function a(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=a})(sl||(sl={}));function Dr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ii(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var OS=class extends En{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},al=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ni}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],n=t.translateToString(!0),l=0,a=0,h=0,d=t.getFg(0),_=t.getBg(0);for(let p=0;p<t.getTrimmedLength();p++)if(t.loadCell(p,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==_){if(p-l>1){let g=this._getJoinedRanges(n,h,a,t,l);for(let y=0;y<g.length;y++)r.push(g[y])}l=p,h=a,d=this._workCell.fg,_=this._workCell.bg}a+=this._workCell.getChars().length||pr.length}if(this._bufferService.cols-l>1){let p=this._getJoinedRanges(n,h,a,t,l);for(let g=0;g<p.length;g++)r.push(p[g])}return r}_getJoinedRanges(e,t,r,n,l){let a=e.substring(t,r),h=[];try{h=this._characterJoiners[0].handler(a)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let _=this._characterJoiners[d].handler(a);for(let p=0;p<_.length;p++)al._mergeRanges(h,_[p])}catch(_){console.error(_)}return this._stringRangesToCellRanges(h,n,l),h}_stringRangesToCellRanges(e,t,r){let n=0,l=!1,a=0,h=e[n];if(h){for(let d=r;d<this._bufferService.cols;d++){let _=t.getWidth(d),p=t.getString(d).length||pr.length;if(_!==0){if(!l&&h[0]<=a&&(h[0]=d,l=!0),h[1]<=a){if(h[1]=d,h=e[++n],!h)break;h[0]<=a?(h[0]=d,l=!0):l=!1}a+=p}}h&&(h[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let n=0;n<e.length;n++){let l=e[n];if(r){if(t[1]<=l[0])return e[n-1][1]=t[1],e;if(t[1]<=l[1])return e[n-1][1]=Math.max(t[1],l[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=l[0])return e.splice(n,0,t),e;if(t[1]<=l[1])return l[0]=Math.min(t[0],l[0]),e;t[0]<l[1]&&(l[0]=Math.min(t[0],l[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};al=Je([de(0,Pt)],al);function IS(e){return 57508<=e&&e<=57558}function zS(e){return 9472<=e&&e<=9631}function FS(e){return IS(e)||zS(e)}function HS(){return{css:{canvas:Vo(),cell:Vo()},device:{canvas:Vo(),cell:Vo(),char:{width:0,height:0,left:0,top:0}}}}function Vo(){return{width:0,height:0}}var Nh=class{constructor(e,t,r,n,l,a,h){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=n,this._coreService=l,this._decorationService=a,this._themeService=h,this._workCell=new ni,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,n,l,a,h,d,_,p,g){let y=[],w=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,C=e.getNoBgTrimmedLength();r&&C<a+1&&(C=a+1);let b,E=0,W="",B=0,$=0,P=0,J=0,A=!1,M=0,N=!1,j=0,I=0,U=[],H=p!==-1&&g!==-1;for(let O=0;O<C;O++){e.loadCell(O,this._workCell);let K=this._workCell.getWidth();if(K===0)continue;let ee=!1,Z=O>=I,L=O,D=this._workCell;if(w.length>0&&O===w[0][0]&&Z){let xe=w.shift(),Tt=this._isCellInSelection(xe[0],t);for(B=xe[0]+1;B<xe[1];B++)Z&&(Z=Tt===this._isCellInSelection(B,t));Z&&(Z=!r||a<xe[0]||a>=xe[1]),Z?(ee=!0,D=new OS(this._workCell,e.translateToString(!0,xe[0],xe[1]),xe[1]-xe[0]),L=xe[1]-1,K=D.getWidth()):I=xe[1]}let te=this._isCellInSelection(O,t),X=r&&O===a,R=H&&O>=p&&O<=g,Q=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,xe=>{Q=!0});let ce=D.getChars()||pr;if(ce===" "&&(D.isUnderline()||D.isOverline())&&(ce=" "),j=K*d-_.get(ce,D.isBold(),D.isItalic()),!b)b=this._document.createElement("span");else if(E&&(te&&N||!te&&!N&&D.bg===$)&&(te&&N&&v.selectionForeground||D.fg===P)&&D.extended.ext===J&&R===A&&j===M&&!X&&!ee&&!Q&&Z){D.isInvisible()?W+=pr:W+=ce,E++;continue}else E&&(b.textContent=W),b=this._document.createElement("span"),E=0,W="";if($=D.bg,P=D.fg,J=D.extended.ext,A=R,M=j,N=te,ee&&a>=O&&a<=L&&(a=O),!this._coreService.isCursorHidden&&X&&this._coreService.isCursorInitialized){if(U.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&U.push("xterm-cursor-blink"),U.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(l)switch(l){case"outline":U.push("xterm-cursor-outline");break;case"block":U.push("xterm-cursor-block");break;case"bar":U.push("xterm-cursor-bar");break;case"underline":U.push("xterm-cursor-underline");break}}if(D.isBold()&&U.push("xterm-bold"),D.isItalic()&&U.push("xterm-italic"),D.isDim()&&U.push("xterm-dim"),D.isInvisible()?W=pr:W=D.getChars()||pr,D.isUnderline()&&(U.push(`xterm-underline-${D.extended.underlineStyle}`),W===" "&&(W=" "),!D.isUnderlineColorDefault()))if(D.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${En.toColorRGB(D.getUnderlineColor()).join(",")})`;else{let xe=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&xe<8&&(xe+=8),b.style.textDecorationColor=v.ansi[xe].css}D.isOverline()&&(U.push("xterm-overline"),W===" "&&(W=" ")),D.isStrikethrough()&&U.push("xterm-strikethrough"),R&&(b.style.textDecoration="underline");let he=D.getFgColor(),pe=D.getFgColorMode(),ve=D.getBgColor(),we=D.getBgColorMode(),V=!!D.isInverse();if(V){let xe=he;he=ve,ve=xe;let Tt=pe;pe=we,we=Tt}let re,ke,ge=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,xe=>{xe.options.layer!=="top"&&ge||(xe.backgroundColorRGB&&(we=50331648,ve=xe.backgroundColorRGB.rgba>>8&16777215,re=xe.backgroundColorRGB),xe.foregroundColorRGB&&(pe=50331648,he=xe.foregroundColorRGB.rgba>>8&16777215,ke=xe.foregroundColorRGB),ge=xe.options.layer==="top")}),!ge&&te&&(re=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,ve=re.rgba>>8&16777215,we=50331648,ge=!0,v.selectionForeground&&(pe=50331648,he=v.selectionForeground.rgba>>8&16777215,ke=v.selectionForeground)),ge&&U.push("xterm-decoration-top");let Ae;switch(we){case 16777216:case 33554432:Ae=v.ansi[ve],U.push(`xterm-bg-${ve}`);break;case 50331648:Ae=st.toColor(ve>>16,ve>>8&255,ve&255),this._addStyle(b,`background-color:#${Ap((ve>>>0).toString(16),"0",6)}`);break;case 0:default:V?(Ae=v.foreground,U.push("xterm-bg-257")):Ae=v.background}switch(re||D.isDim()&&(re=$e.multiplyOpacity(Ae,.5)),pe){case 16777216:case 33554432:D.isBold()&&he<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(he+=8),this._applyMinimumContrast(b,Ae,v.ansi[he],D,re,void 0)||U.push(`xterm-fg-${he}`);break;case 50331648:let xe=st.toColor(he>>16&255,he>>8&255,he&255);this._applyMinimumContrast(b,Ae,xe,D,re,ke)||this._addStyle(b,`color:#${Ap(he.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(b,Ae,v.foreground,D,re,ke)||V&&U.push("xterm-fg-257")}U.length&&(b.className=U.join(" "),U.length=0),!X&&!ee&&!Q&&Z?E++:b.textContent=W,j!==this.defaultSpacing&&(b.style.letterSpacing=`${j}px`),y.push(b),O=L}return b&&E&&(b.textContent=W),y}_applyMinimumContrast(e,t,r,n,l,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||FS(n.getCode()))return!1;let h=this._getContrastCache(n),d;if(!l&&!a&&(d=h.getColor(t.rgba,r.rgba)),d===void 0){let _=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);d=$e.ensureContrastRatio(l||t,a||r,_),h.setColor((l||t).rgba,(a||r).rgba,d??null)}return d?(this._addStyle(e,`color:${d.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,n=this._selectionEnd;return!r||!n?!1:this._columnSelectMode?r[0]<=n[0]?e>=r[0]&&t>=r[1]&&e<n[0]&&t<=n[1]:e<r[0]&&t>=r[1]&&e>=n[0]&&t<=n[1]:t>r[1]&&t<n[1]||r[1]===n[1]&&t===r[1]&&e>=r[0]&&e<n[0]||r[1]<n[1]&&t===n[1]&&e<n[0]||r[1]<n[1]&&t===r[1]&&e>=r[0]}};Nh=Je([de(1,k_),de(2,Lt),de(3,Hi),de(4,Ir),de(5,Nn),de(6,_s)],Nh);function Ap(e,t,r){for(;e.length<r;)e=t+e;return e}var WS=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.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";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontStyle="italic";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold",a.style.fontStyle="italic",this._measureElements=[r,n,l,a],this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(l),this._container.appendChild(a),t.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(e,t,r,n){e===this._font&&t===this._fontSize&&r===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,r){let n=0;if(!t&&!r&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let h=this._measure(e,0);return h>0&&(this._flat[n]=h),h}let l=e;t&&(l+="B"),r&&(l+="I");let a=this._holey.get(l);if(a===void 0){let h=0;t&&(h|=1),r&&(h|=2),a=this._measure(e,h),a>0&&this._holey.set(l,a)}return a}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},$S=class{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(e,t,r,n=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let l=e.buffers.active.ydisp,a=t[1]-l,h=r[1]-l,d=Math.max(a,0),_=Math.min(h,e.rows-1);if(d>=e.rows||_<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=a,this.viewportEndRow=h,this.viewportCappedStartRow=d,this.viewportCappedEndRow=_,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function US(){return new $S}var xc="xterm-dom-renderer-owner-",ii="xterm-rows",qo="xterm-fg-",jp="xterm-bg-",cn="xterm-focus",Yo="xterm-selection",KS=1,Rh=class extends De{constructor(e,t,r,n,l,a,h,d,_,p,g,y,w,v){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=n,this._viewportElement=l,this._helperContainer=a,this._linkifier2=h,this._charSizeService=_,this._optionsService=p,this._bufferService=g,this._coreService=y,this._coreBrowserService=w,this._themeService=v,this._terminalClass=KS++,this._rowElements=[],this._selectionRenderModel=US(),this.onRequestRedraw=this._register(new ae).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ii),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(Yo),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=HS(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(C=>this._injectCss(C))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(Nh,document),this._element.classList.add(xc+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(C=>this._handleLinkHover(C))),this._register(this._linkifier2.onHideLinkUnderline(C=>this._handleLinkLeave(C))),this._register(Ke(()=>{this._element.classList.remove(xc+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new WS(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(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ii} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${ii} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${ii} .xterm-dim { color: ${$e.multiplyOpacity(e.foreground,.5).css};}`,t+=`${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;}`;let r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,l=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${l} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ii}.${cn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${ii}.${cn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ii}.${cn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Yo} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Yo} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Yo} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,h]of e.ansi.entries())t+=`${this._terminalSelector} .${qo}${a} { color: ${h.css}; }${this._terminalSelector} .${qo}${a}.xterm-dim { color: ${$e.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${jp}${a} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${qo}257 { color: ${$e.opaque(e.background).css}; }${this._terminalSelector} .${qo}257.xterm-dim { color: ${$e.multiplyOpacity($e.opaque(e.background),.5).css}; }${this._terminalSelector} .${jp}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let r=this._rowElements.length;r<=t;r++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(cn),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(cn),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,l=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,h=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(r){let _=e[0]>t[0];d.appendChild(this._createSelectionElement(a,_?t[0]:e[0],_?e[0]:t[0],h-a+1))}else{let _=n===a?e[0]:0,p=a===l?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(a,_,p));let g=h-a-1;if(d.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,g)),a!==h){let y=l===h?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(h,0,y))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,r,n=1){let l=this._document.createElement("div"),a=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(r-t);return a+h>this.dimensions.css.canvas.width&&(h=this.dimensions.css.canvas.width-a),l.style.height=`${n*this.dimensions.css.cell.height}px`,l.style.top=`${e*this.dimensions.css.cell.height}px`,l.style.left=`${a}px`,l.style.width=`${h}px`,l}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(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let r=this._bufferService.buffer,n=r.ybase+r.y,l=Math.min(r.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=e;_<=t;_++){let p=_+r.ydisp,g=this._rowElements[_],y=r.lines.get(p);if(!g||!y)break;g.replaceChildren(...this._rowFactory.createRow(y,p,p===n,h,d,l,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${xc}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,r,n,l,a){r<0&&(e=0),n<0&&(t=0);let h=this._bufferService.rows-1;r=Math.max(Math.min(r,h),0),n=Math.max(Math.min(n,h),0),l=Math.min(l,this._bufferService.cols);let d=this._bufferService.buffer,_=d.ybase+d.y,p=Math.min(d.x,l-1),g=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let v=r;v<=n;++v){let C=v+d.ydisp,b=this._rowElements[v],E=d.lines.get(C);if(!b||!E)break;b.replaceChildren(...this._rowFactory.createRow(E,C,C===_,y,w,p,g,this.dimensions.css.cell.width,this._widthCache,a?v===r?e:0:-1,a?(v===n?t:l)-1:-1))}}};Rh=Je([de(7,Zh),de(8,yl),de(9,Lt),de(10,Pt),de(11,Ir),de(12,Hi),de(13,_s)],Rh);var Mh=class extends De{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ae),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new qS(this._optionsService))}catch{this._measureStrategy=this._register(new VS(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Mh=Je([de(2,Lt)],Mh);var U_=class extends De{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},VS=class extends U_{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,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}},qS=class extends U_{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},YS=class extends De{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new XS(this._window)),this._onDprChange=this._register(new ae),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ae),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Ct.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ne(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ne(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,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}},XS=class extends De{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new ms),this._onDprChange=this._register(new ae),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ke(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ne(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},GS=class extends De{constructor(){super(),this.linkProviders=[],this._register(Ke(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function lu(e,t,r){let n=r.getBoundingClientRect(),l=e.getComputedStyle(r),a=parseInt(l.getPropertyValue("padding-left")),h=parseInt(l.getPropertyValue("padding-top"));return[t.clientX-n.left-a,t.clientY-n.top-h]}function QS(e,t,r,n,l,a,h,d,_){if(!a)return;let p=lu(e,t,r);if(p)return p[0]=Math.ceil((p[0]+(_?h/2:0))/h),p[1]=Math.ceil(p[1]/d),p[0]=Math.min(Math.max(p[0],1),n+(_?1:0)),p[1]=Math.min(Math.max(p[1],1),l),p}var Dh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,l){return QS(window,e,t,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(e,t){let r=lu(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};Dh=Je([de(0,Wi),de(1,yl)],Dh);var JS=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!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){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},K_={};ay(K_,{getSafariVersion:()=>ew,isChromeOS:()=>X_,isFirefox:()=>V_,isIpad:()=>tw,isIphone:()=>iw,isLegacyEdge:()=>ZS,isLinux:()=>au,isMac:()=>cl,isNode:()=>Sl,isSafari:()=>q_,isWindows:()=>Y_});var Sl=typeof process<"u"&&"title"in process,Rn=Sl?"node":navigator.userAgent,Mn=Sl?"node":navigator.platform,V_=Rn.includes("Firefox"),ZS=Rn.includes("Edge"),q_=/^((?!chrome|android).)*safari/i.test(Rn);function ew(){if(!q_)return 0;let e=Rn.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var cl=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Mn),tw=Mn==="iPad",iw=Mn==="iPhone",Y_=["Windows","Win16","Win32","WinCE"].includes(Mn),au=Mn.indexOf("Linux")>=0,X_=/\bCrOS\b/.test(Rn),G_=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,r=0,n=e.timeRemaining(),l=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),l=e.timeRemaining(),r*1.5>l){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=l}this.clear()}},rw=class extends G_{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},sw=class extends G_{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},hl=!Sl&&"requestIdleCallback"in window?sw:rw,nw=class{constructor(){this._queue=new hl}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ph=class extends De{constructor(e,t,r,n,l,a,h,d,_){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=l,this._coreBrowserService=d,this._renderer=this._register(new ms),this._pausedResizeTask=new nw,this._observerDisposable=this._register(new ms),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 ae),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ae),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ae),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ae),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new JS((p,g)=>this._renderRows(p,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new ow(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ke(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.buffers.onBufferActivate(()=>{var p;return(p=this._renderer.value)==null?void 0:p.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,!0))),this._register(_.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(p=>this._registerIntersectionObserver(p,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=Ke(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var n;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(n=this._renderer.value)==null||n.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Ph=Je([de(2,Lt),de(3,yl),de(4,Ir),de(5,Nn),de(6,Pt),de(7,Hi),de(8,_s)],Ph);var ow=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function lw(e,t,r,n){let l=r.buffer.x,a=r.buffer.y;if(!r.buffer.hasScrollback)return hw(l,a,e,t,r,n)+wl(a,t,r,n)+uw(l,a,e,t,r,n);let h;if(a===t)return h=l>e?"D":"C",bn(Math.abs(l-e),Cn(h,n));h=a>t?"D":"C";let d=Math.abs(a-t),_=cw(a>t?e:l,r)+(d-1)*r.cols+1+aw(a>t?l:e);return bn(_,Cn(h,n))}function aw(e,t){return e-1}function cw(e,t){return t.cols-e}function hw(e,t,r,n,l,a){return wl(t,n,l,a).length===0?"":bn(J_(e,t,e,t-Or(t,l),!1,l).length,Cn("D",a))}function wl(e,t,r,n){let l=e-Or(e,r),a=t-Or(t,r),h=Math.abs(l-a)-dw(e,t,r);return bn(h,Cn(Q_(e,t),n))}function uw(e,t,r,n,l,a){let h;wl(t,n,l,a).length>0?h=n-Or(n,l):h=t;let d=n,_=fw(e,t,r,n,l,a);return bn(J_(e,h,r,d,_==="C",l).length,Cn(_,a))}function dw(e,t,r){var h;let n=0,l=e-Or(e,r),a=t-Or(t,r);for(let d=0;d<Math.abs(l-a);d++){let _=Q_(e,t)==="A"?-1:1;(h=r.buffer.lines.get(l+_*d))!=null&&h.isWrapped&&n++}return n}function Or(e,t){let r=0,n=t.buffer.lines.get(e),l=n==null?void 0:n.isWrapped;for(;l&&e>=0&&e<t.rows;)r++,n=t.buffer.lines.get(--e),l=n==null?void 0:n.isWrapped;return r}function fw(e,t,r,n,l,a){let h;return wl(r,n,l,a).length>0?h=n-Or(n,l):h=t,e<r&&h<=n||e>=r&&h<n?"C":"D"}function Q_(e,t){return e>t?"A":"B"}function J_(e,t,r,n,l,a){let h=e,d=t,_="";for(;(h!==r||d!==n)&&d>=0&&d<a.buffer.lines.length;)h+=l?1:-1,l&&h>a.cols-1?(_+=a.buffer.translateBufferLineToString(d,!1,e,h),h=0,e=0,d++):!l&&h<0&&(_+=a.buffer.translateBufferLineToString(d,!1,0,e+1),h=a.cols-1,e=h,d--);return _+a.buffer.translateBufferLineToString(d,!1,e,h)}function Cn(e,t){let r=t?"O":"[";return ie.ESC+r+e}function bn(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var pw=class{constructor(e){this._bufferService=e,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.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()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Op(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var kc=50,mw=15,_w=50,gw=500,vw=" ",yw=new RegExp(vw,"g"),Lh=class extends De{constructor(e,t,r,n,l,a,h,d,_){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=l,this._mouseService=a,this._optionsService=h,this._renderService=d,this._coreBrowserService=_,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ni,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ae),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ae),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ae),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ae),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=p=>this._handleMouseMove(p),this._mouseUpListener=p=>this._handleMouseUp(p),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(p=>this._handleTrim(p)),this._register(this._bufferService.buffers.onBufferActivate(p=>this._handleBufferActivate(p))),this.enable(),this._model=new pw(this._bufferService),this._activeSelectionMode=0,this._register(Ke(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(p=>{p.rowsChanged&&this.clearSelection()}))}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(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let l=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let h=e[1];h<=t[1];h++){let d=r.translateBufferLineToString(h,!0,l,a);n.push(d)}}else{let l=e[1]===t[1]?t[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],l));for(let a=e[1]+1;a<=t[1]-1;a++){let h=r.lines.get(a),d=r.translateBufferLineToString(a,!0);h!=null&&h.isWrapped?n[n.length-1]+=d:n.push(d)}if(e[1]!==t[1]){let a=r.lines.get(t[1]),h=r.translateBufferLineToString(t[1],!0,0,t[0]);a&&a.isWrapped?n[n.length-1]+=h:n.push(h)}}return n.map(l=>l.replace(yw," ")).join(Y_?`\r
|
|
62
|
+
`:`
|
|
63
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),au&&e&&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(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n||!t?!1:this._areCoordsInSelection(t,r,n)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n?!1:this._areCoordsInSelection([e,t],r,n)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var l,a;let r=(a=(l=this._linkifier.currentLink)==null?void 0:l.link)==null?void 0:a.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=Op(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=lu(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-kc),kc),t/=kc,t/Math.abs(t)+Math.round(t*(mw-1)))}shouldForceSelection(e){return cl?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),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(),_w)}_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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(cl&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}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(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let n=r.lines.get(this._model.selectionEnd[1]);n&&n.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[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});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<gw&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let n=lw(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let n=0;t>=n;n++){let l=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:l>1&&t!==n&&(r+=l-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let l=this._bufferService.buffer,a=l.lines.get(e[1]);if(!a)return;let h=l.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(a,e[0]),_=d,p=e[0]-d,g=0,y=0,w=0,v=0;if(h.charAt(d)===" "){for(;d>0&&h.charAt(d-1)===" ";)d--;for(;_<h.length&&h.charAt(_+1)===" ";)_++}else{let E=e[0],W=e[0];a.getWidth(E)===0&&(g++,E--),a.getWidth(W)===2&&(y++,W++);let B=a.getString(W).length;for(B>1&&(v+=B-1,_+=B-1);E>0&&d>0&&!this._isCharWordSeparator(a.loadCell(E-1,this._workCell));){a.loadCell(E-1,this._workCell);let $=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,E--):$>1&&(w+=$-1,d-=$-1),d--,E--}for(;W<a.length&&_+1<h.length&&!this._isCharWordSeparator(a.loadCell(W+1,this._workCell));){a.loadCell(W+1,this._workCell);let $=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,W++):$>1&&(v+=$-1,_+=$-1),_++,W++}}_++;let C=d+p-g+w,b=Math.min(this._bufferService.cols,_-d+g+y-w-v);if(!(!t&&h.slice(d,_).trim()==="")){if(r&&C===0&&a.getCodePoint(0)!==32){let E=l.lines.get(e[1]-1);if(E&&a.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let W=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(W){let B=this._bufferService.cols-W.start;C-=B,b+=B}}}if(n&&C+b===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let E=l.lines.get(e[1]+1);if(E!=null&&E.isWrapped&&E.getCodePoint(0)!==32){let W=this._getWordAt([0,e[1]+1],!1,!1,!0);W&&(b+=W.length)}}return{start:C,length:b}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Op(r,this._bufferService.cols)}};Lh=Je([de(3,Pt),de(4,Ir),de(5,eu),de(6,Lt),de(7,Wi),de(8,Hi)],Lh);var Ip=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},zp=class{constructor(){this._color=new Ip,this._css=new Ip}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},lt=Object.freeze((()=>{let e=[Xe.toColor("#2e3436"),Xe.toColor("#cc0000"),Xe.toColor("#4e9a06"),Xe.toColor("#c4a000"),Xe.toColor("#3465a4"),Xe.toColor("#75507b"),Xe.toColor("#06989a"),Xe.toColor("#d3d7cf"),Xe.toColor("#555753"),Xe.toColor("#ef2929"),Xe.toColor("#8ae234"),Xe.toColor("#fce94f"),Xe.toColor("#729fcf"),Xe.toColor("#ad7fa8"),Xe.toColor("#34e2e2"),Xe.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],l=t[r/6%6|0],a=t[r%6];e.push({css:st.toCss(n,l,a),rgba:st.toRgba(n,l,a)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:st.toCss(n,n,n),rgba:st.toRgba(n,n,n)})}return e})()),Pr=Xe.toColor("#ffffff"),gn=Xe.toColor("#000000"),Fp=Xe.toColor("#ffffff"),Hp=gn,hn={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Sw=Pr,Th=class extends De{constructor(e){super(),this._optionsService=e,this._contrastCache=new zp,this._halfContrastCache=new zp,this._onChangeColors=this._register(new ae),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Pr,background:gn,cursor:Fp,cursorAccent:Hp,selectionForeground:void 0,selectionBackgroundTransparent:hn,selectionBackgroundOpaque:$e.blend(gn,hn),selectionInactiveBackgroundTransparent:hn,selectionInactiveBackgroundOpaque:$e.blend(gn,hn),scrollbarSliderBackground:$e.opacity(Pr,.2),scrollbarSliderHoverBackground:$e.opacity(Pr,.4),scrollbarSliderActiveBackground:$e.opacity(Pr,.5),overviewRulerBorder:Pr,ansi:lt.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Ie(e.foreground,Pr),t.background=Ie(e.background,gn),t.cursor=$e.blend(t.background,Ie(e.cursor,Fp)),t.cursorAccent=$e.blend(t.background,Ie(e.cursorAccent,Hp)),t.selectionBackgroundTransparent=Ie(e.selectionBackground,hn),t.selectionBackgroundOpaque=$e.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ie(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=$e.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ie(e.selectionForeground,Bp):void 0,t.selectionForeground===Bp&&(t.selectionForeground=void 0),$e.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=$e.opacity(t.selectionBackgroundTransparent,.3)),$e.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=$e.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ie(e.scrollbarSliderBackground,$e.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ie(e.scrollbarSliderHoverBackground,$e.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ie(e.scrollbarSliderActiveBackground,$e.opacity(t.foreground,.5)),t.overviewRulerBorder=Ie(e.overviewRulerBorder,Sw),t.ansi=lt.slice(),t.ansi[0]=Ie(e.black,lt[0]),t.ansi[1]=Ie(e.red,lt[1]),t.ansi[2]=Ie(e.green,lt[2]),t.ansi[3]=Ie(e.yellow,lt[3]),t.ansi[4]=Ie(e.blue,lt[4]),t.ansi[5]=Ie(e.magenta,lt[5]),t.ansi[6]=Ie(e.cyan,lt[6]),t.ansi[7]=Ie(e.white,lt[7]),t.ansi[8]=Ie(e.brightBlack,lt[8]),t.ansi[9]=Ie(e.brightRed,lt[9]),t.ansi[10]=Ie(e.brightGreen,lt[10]),t.ansi[11]=Ie(e.brightYellow,lt[11]),t.ansi[12]=Ie(e.brightBlue,lt[12]),t.ansi[13]=Ie(e.brightMagenta,lt[13]),t.ansi[14]=Ie(e.brightCyan,lt[14]),t.ansi[15]=Ie(e.brightWhite,lt[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<r;n++)t.ansi[n+16]=Ie(e.extendedAnsi[n],lt[n+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){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[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(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()}}};Th=Je([de(0,Lt)],Th);function Ie(e,t){if(e!==void 0)try{return Xe.toColor(e)}catch{}return t}var ww=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Cw=class{constructor(){this._services=new ww,this._services.set(Zh,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=my(e).sort((a,h)=>a.index-h.index),n=[];for(let a of r){let h=this._services.get(a.id);if(!h)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);n.push(h)}let l=r.length>0?r[0].index:t.length;if(t.length!==l)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${l+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},bw={trace:0,debug:1,info:2,warn:3,error:4,off:5},xw="xterm.js: ",Bh=class extends De{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=bw[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":xw)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Bh=Je([de(0,Lt)],Bh);var Wp=class extends De{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ae),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ae),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ae),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...r){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<r.length;n++)this._array[this._getCyclicIndex(e+n)]=r[n];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let n=this._length+r.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let l=t-1;l>=0;l--)this.set(e+l+r,this.get(e+l));let n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+r,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Me=3,rt=Object.freeze(new En),Xo=0,Ec=2,vn=class Z_{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Me);let l=r||ni.fromCharData([0,v_,1,0]);for(let a=0;a<t;++a)this.setCell(a,l);this.length=t}get(t){let r=this._data[t*Me+0],n=r&2097151;return[this._data[t*Me+1],r&2097152?this._combined[t]:n?fr(n):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*Me+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Me+0]=t|2097152|r[2]<<22):this._data[t*Me+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Me+0]>>22}hasWidth(t){return this._data[t*Me+0]&12582912}getFg(t){return this._data[t*Me+1]}getBg(t){return this._data[t*Me+2]}hasContent(t){return this._data[t*Me+0]&4194303}getCodePoint(t){let r=this._data[t*Me+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Me+0]&2097152}getString(t){let r=this._data[t*Me+0];return r&2097152?this._combined[t]:r&2097151?fr(r&2097151):""}isProtected(t){return this._data[t*Me+2]&536870912}loadCell(t,r){return Xo=t*Me,r.content=this._data[Xo+0],r.fg=this._data[Xo+1],r.bg=this._data[Xo+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Me+0]=r.content,this._data[t*Me+1]=r.fg,this._data[t*Me+2]=r.bg}setCellFromCodepoint(t,r,n,l){l.bg&268435456&&(this._extendedAttrs[t]=l.extended),this._data[t*Me+0]=r|n<<22,this._data[t*Me+1]=l.fg,this._data[t*Me+2]=l.bg}addCodepointToCell(t,r,n){let l=this._data[t*Me+0];l&2097152?this._combined[t]+=fr(r):l&2097151?(this._combined[t]=fr(l&2097151)+fr(r),l&=-2097152,l|=2097152):l=r|1<<22,n&&(l&=-12582913,l|=n<<22),this._data[t*Me+0]=l}insertCells(t,r,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length-t){let l=new ni;for(let a=this.length-t-r-1;a>=0;--a)this.setCell(t+r+a,this.loadCell(t+a,l));for(let a=0;a<r;++a)this.setCell(t+a,n)}else for(let l=t;l<this.length;++l)this.setCell(l,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(t,r,n){if(t%=this.length,r<this.length-t){let l=new ni;for(let a=0;a<this.length-t-r;++a)this.setCell(t+a,this.loadCell(t+r+a,l));for(let a=this.length-r;a<this.length;++a)this.setCell(a,n)}else for(let l=t;l<this.length;++l)this.setCell(l,n);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,n)}replaceCells(t,r,n,l=!1){if(l){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,n);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,n),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,n);t<r&&t<this.length;)this.setCell(t++,n)}resize(t,r){if(t===this.length)return this._data.length*4*Ec<this._data.buffer.byteLength;let n=t*Me;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let l=new Uint32Array(n);l.set(this._data),this._data=l}for(let l=this.length;l<t;++l)this.setCell(l,r)}else{this._data=this._data.subarray(0,n);let l=Object.keys(this._combined);for(let h=0;h<l.length;h++){let d=parseInt(l[h],10);d>=t&&delete this._combined[d]}let a=Object.keys(this._extendedAttrs);for(let h=0;h<a.length;h++){let d=parseInt(a[h],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,n*4*Ec<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Ec<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,t);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new Z_(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Me+0]&4194303)return t+(this._data[t*Me+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Me+0]&4194303||this._data[t*Me+2]&50331648)return t+(this._data[t*Me+0]>>22);return 0}copyCellsFrom(t,r,n,l,a){let h=t._data;if(a)for(let _=l-1;_>=0;_--){for(let p=0;p<Me;p++)this._data[(n+_)*Me+p]=h[(r+_)*Me+p];h[(r+_)*Me+2]&268435456&&(this._extendedAttrs[n+_]=t._extendedAttrs[r+_])}else for(let _=0;_<l;_++){for(let p=0;p<Me;p++)this._data[(n+_)*Me+p]=h[(r+_)*Me+p];h[(r+_)*Me+2]&268435456&&(this._extendedAttrs[n+_]=t._extendedAttrs[r+_])}let d=Object.keys(t._combined);for(let _=0;_<d.length;_++){let p=parseInt(d[_],10);p>=r&&(this._combined[p-r+n]=t._combined[p])}}translateToString(t,r,n,l){r=r??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),l&&(l.length=0);let a="";for(;r<n;){let h=this._data[r*Me+0],d=h&2097151,_=h&2097152?this._combined[r]:d?fr(d):pr;if(a+=_,l)for(let p=0;p<_.length;++p)l.push(r);r+=h>>22||1}return l&&l.push(r),a}};function kw(e,t,r,n,l,a){let h=[];for(let d=0;d<e.length-1;d++){let _=d,p=e.get(++_);if(!p.isWrapped)continue;let g=[e.get(d)];for(;_<e.length&&p.isWrapped;)g.push(p),p=e.get(++_);if(!a&&n>=d&&n<_){d+=g.length-1;continue}let y=0,w=xn(g,y,t),v=1,C=0;for(;v<g.length;){let E=xn(g,v,t),W=E-C,B=r-w,$=Math.min(W,B);g[y].copyCellsFrom(g[v],C,w,$,!1),w+=$,w===r&&(y++,w=0),C+=$,C===E&&(v++,C=0),w===0&&y!==0&&g[y-1].getWidth(r-1)===2&&(g[y].copyCellsFrom(g[y-1],r-1,w++,1,!1),g[y-1].setCell(r-1,l))}g[y].replaceCells(w,r,l);let b=0;for(let E=g.length-1;E>0&&(E>y||g[E].getTrimmedLength()===0);E--)b++;b>0&&(h.push(d+g.length-b),h.push(b)),d+=g.length-1}return h}function Ew(e,t){let r=[],n=0,l=t[n],a=0;for(let h=0;h<e.length;h++)if(l===h){let d=t[++n];e.onDeleteEmitter.fire({index:h-a,amount:d}),h+=d-1,a+=d,l=t[++n]}else r.push(h);return{layout:r,countRemoved:a}}function Nw(e,t){let r=[];for(let n=0;n<t.length;n++)r.push(e.get(t[n]));for(let n=0;n<r.length;n++)e.set(n,r[n]);e.length=t.length}function Rw(e,t,r){let n=[],l=e.map((_,p)=>xn(e,p,t)).reduce((_,p)=>_+p),a=0,h=0,d=0;for(;d<l;){if(l-d<r){n.push(l-d);break}a+=r;let _=xn(e,h,t);a>_&&(a-=_,h++);let p=e[h].getWidth(a-1)===2;p&&a--;let g=p?r-1:r;n.push(g),d+=g}return n}function xn(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,l=e[t+1].getWidth(0)===2;return n&&l?r-1:r}var eg=class tg{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=tg._nextId++,this._onDispose=this.register(new ae),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),jr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};eg._nextId=1;var Mw=eg,ct={},Lr=ct.B;ct[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ct.A={"#":"£"};ct.B=void 0;ct[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ct.C=ct[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ct.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ct.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ct.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ct.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ct.E=ct[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ct.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ct.H=ct[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ct["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var $p=4294967295,Up=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=rt.clone(),this.savedCharset=Lr,this.markers=[],this._nullCell=ni.fromCharData([0,v_,1,0]),this._whitespaceCell=ni.fromCharData([0,pr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new hl,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Wp(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new ol),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new ol),this._whitespaceCell}getBlankLine(e,t){return new vn(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>$p?$p:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=rt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Wp(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(rt),n=0,l=this._getCorrectBufferLength(t);if(l>this.lines.maxLength&&(this.lines.maxLength=l),this.lines.length>0){if(this._cols<e)for(let h=0;h<this.lines.length;h++)n+=+this.lines.get(h).resize(e,r);let a=0;if(this._rows<t)for(let h=this._rows;h<t;h++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new vn(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new vn(e,r)));else for(let h=this._rows;h>t;h--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(l<this.lines.maxLength){let h=this.lines.length-l;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,0)),this.lines.maxLength=l}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let a=0;a<this.lines.length;a++)n+=+this.lines.get(a).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,n=kw(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(rt),r);if(n.length>0){let l=Ew(this.lines,n);Nw(this.lines,l.layout),this._reflowLargerAdjustViewport(e,t,l.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(rt),l=r;for(;l-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new vn(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(rt),l=[],a=0;for(let h=this.lines.length-1;h>=0;h--){let d=this.lines.get(h);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let _=[d];for(;d.isWrapped&&h>0;)d=this.lines.get(--h),_.unshift(d);if(!r){let $=this.ybase+this.y;if($>=h&&$<h+_.length)continue}let p=_[_.length-1].getTrimmedLength(),g=Rw(_,this._cols,e),y=g.length-_.length,w;this.ybase===0&&this.y!==this.lines.length-1?w=Math.max(0,this.y-this.lines.maxLength+y):w=Math.max(0,this.lines.length-this.lines.maxLength+y);let v=[];for(let $=0;$<y;$++){let P=this.getBlankLine(rt,!0);v.push(P)}v.length>0&&(l.push({start:h+_.length+a,newLines:v}),a+=v.length),_.push(...v);let C=g.length-1,b=g[C];b===0&&(C--,b=g[C]);let E=_.length-y-1,W=p;for(;E>=0;){let $=Math.min(W,b);if(_[C]===void 0)break;if(_[C].copyCellsFrom(_[E],W-$,b-$,$,!0),b-=$,b===0&&(C--,b=g[C]),W-=$,W===0){E--;let P=Math.max(E,0);W=xn(_,P,this._cols)}}for(let $=0;$<_.length;$++)g[$]<e&&_[$].setCell(g[$],n);let B=y-w;for(;B-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+y,this.ybase+t-1)}if(l.length>0){let h=[],d=[];for(let b=0;b<this.lines.length;b++)d.push(this.lines.get(b));let _=this.lines.length,p=_-1,g=0,y=l[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let w=0;for(let b=Math.min(this.lines.maxLength-1,_+a-1);b>=0;b--)if(y&&y.start>p+w){for(let E=y.newLines.length-1;E>=0;E--)this.lines.set(b--,y.newLines[E]);b++,h.push({index:p+1,amount:y.newLines.length}),w+=y.newLines.length,y=l[++g]}else this.lines.set(b,d[p--]);let v=0;for(let b=h.length-1;b>=0;b--)h[b].index+=v,this.lines.onInsertEmitter.fire(h[b]),v+=h[b].amount;let C=Math.max(0,_+a-this.lines.maxLength);C>0&&this.lines.onTrimEmitter.fire(C)}}translateBufferLineToString(e,t,r=0,n){let l=this.lines.get(e);return l?l.translateToString(t,r,n):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new Mw(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Dw=class extends De{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ae),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 Up(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Up(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},ig=2,rg=1,Ah=class extends De{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ae),this.onResize=this._onResize.event,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,ig),this.rows=Math.max(e.rawOptions.rows||0,rg),this.buffers=this._register(new Dw(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=r.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let l=r.ybase+r.scrollTop,a=r.ybase+r.scrollBottom;if(r.scrollTop===0){let h=r.lines.isFull;a===r.lines.length-1?h?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(a+1,0,n.clone()),h?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let h=a-l+1;r.lines.shiftElements(l+1,h-1,-1),r.lines.set(a,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};Ah=Je([de(0,Lt)],Ah);var ds={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:cl,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Pw=["normal","bold","100","200","300","400","500","600","700","800","900"],Lw=class extends De{constructor(e){super(),this._onOptionChange=this._register(new ae),this.onOptionChange=this._onOptionChange.event;let t={...ds};for(let r in e)if(r in t)try{let n=e[r];t[r]=this._sanitizeAndValidateOption(r,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ke(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in ds))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in ds))throw new Error(`No option with key "${r}"`);n=this._sanitizeAndValidateOption(r,n),this.rawOptions[r]!==n&&(this.rawOptions[r]=n,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let n={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=ds[e]),!Tw(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=ds[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=Pw.includes(t)?t:ds[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function Tw(e){return e==="block"||e==="underline"||e==="bar"}function yn(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let n in e)r[n]=t<=1?e[n]:e[n]&&yn(e[n],t-1);return r}var Kp=Object.freeze({insertMode:!1}),Vp=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),jh=class extends De{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ae),this.onData=this._onData.event,this._onUserInput=this._register(new ae),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ae),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ae),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=yn(Kp),this.decPrivateModes=yn(Vp)}reset(){this.modes=yn(Kp),this.decPrivateModes=yn(Vp)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};jh=Je([de(0,Pt),de(1,b_),de(2,Lt)],jh);var qp={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Nc(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var Rc=String.fromCharCode,Yp={DEFAULT:e=>{let t=[Nc(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Rc(t[0])}${Rc(t[1])}${Rc(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Nc(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Nc(e,!0)};${e.x};${e.y}${t}`}},Oh=class extends De{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ae),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(qp))this.addProtocol(n,qp[n]);for(let n of Object.keys(Yp))this.addEncoding(n,Yp[n]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let n=t/r,l=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=n+0,Math.abs(e.deltaY)<50&&(l*=.3),this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Oh=Je([de(0,Pt),de(1,Ir),de(2,Lt)],Oh);var Mc=[[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]],Bw=[[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]],at;function Aw(e,t){let r=0,n=t.length-1,l;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(l=r+n>>1,e>t[l][1])r=l+1;else if(e<t[l][0])n=l-1;else return!0;return!1}var jw=class{constructor(){if(this.version="6",!at){at=new Uint8Array(65536),at.fill(1),at[0]=0,at.fill(0,1,32),at.fill(0,127,160),at.fill(2,4352,4448),at[9001]=2,at[9002]=2,at.fill(2,11904,42192),at[12351]=1,at.fill(2,44032,55204),at.fill(2,63744,64256),at.fill(2,65040,65050),at.fill(2,65072,65136),at.fill(2,65280,65377),at.fill(2,65504,65511);for(let e=0;e<Mc.length;++e)at.fill(0,Mc[e][0],Mc[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?at[e]:Aw(e,Bw)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let l=Br.extractWidth(t);l===0?n=!1:l>r&&(r=l)}return Br.createPropertyValue(0,r,n)}},Br=class nl{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ae,this.onChange=this._onChange.event;let t=new jw;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,n=!1){return(t&16777215)<<3|(r&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,n=0,l=t.length;for(let a=0;a<l;++a){let h=t.charCodeAt(a);if(55296<=h&&h<=56319){if(++a>=l)return r+this.wcwidth(h);let p=t.charCodeAt(a);56320<=p&&p<=57343?h=(h-55296)*1024+p-56320+65536:r+=this.wcwidth(p)}let d=this.charProperties(h,n),_=nl.extractWidth(d);nl.extractShouldJoin(d)&&(_-=nl.extractWidth(n)),r+=_,n=d}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},Ow=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Xp(e){var n;let t=(n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:n.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var un=2147483647,Iw=256,sg=class Ih{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>Iw)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new Ih;if(!t.length)return r;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let l=t[n];if(Array.isArray(l))for(let a=0;a<l.length;++a)r.addSubParam(l[a]);else r.addParam(l)}return r}clone(){let t=new Ih(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let r=0;r<this.length;++r){t.push(this.params[r]);let n=this._subParamsIdx[r]>>8,l=this._subParamsIdx[r]&255;l-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,l))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>un?un:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>un?un:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-r>0?this._subParams.subarray(r,n):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let n=this._subParamsIdx[r]>>8,l=this._subParamsIdx[r]&255;l-n>0&&(t[r]=this._subParams.slice(n,l))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,l=n[r-1];n[r-1]=~l?Math.min(l*10+t,un):t}},dn=[],zw=class{constructor(){this._state=0,this._active=dn,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=dn}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=dn,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||dn,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",vl(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,n=this._active.length-1,l=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&r===!1){for(;n>=0&&(r=this._active[n].end(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=dn,this._id=-1,this._state=0}}},Yt=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=vl(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},fn=[],Fw=class{constructor(){this._handlers=Object.create(null),this._active=fn,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=fn}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=fn,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||fn,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",vl(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,n=this._active.length-1,l=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&r===!1){for(;n>=0&&(r=this._active[n].unhook(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=fn,this._ident=0}},Sn=new sg;Sn.addParam(0);var Gp=class{constructor(e){this._handler=e,this._data="",this._params=Sn,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Sn,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=vl(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(r=>(this._params=Sn,this._data="",this._hitLimit=!1,r));return this._params=Sn,this._data="",this._hitLimit=!1,t}},Hw=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,n){this.table[t<<8|e]=r<<4|n}addMany(e,t,r,n){for(let l=0;l<e.length;l++)this.table[t<<8|e[l]]=r<<4|n}},si=160,Ww=(function(){let e=new Hw(4095),t=Array.apply(null,Array(256)).map((d,_)=>_),r=(d,_)=>t.slice(d,_),n=r(32,127),l=r(0,24);l.push(25),l.push.apply(l,r(28,32));let a=r(0,14),h;e.setDefault(1,0),e.addMany(n,0,2,0);for(h in a)e.addMany([24,26,153,154],h,3,0),e.addMany(r(128,144),h,3,0),e.addMany(r(144,152),h,3,0),e.add(156,h,0,0),e.add(27,h,11,1),e.add(157,h,4,8),e.addMany([152,158,159],h,0,7),e.add(155,h,11,3),e.add(144,h,11,9);return e.addMany(l,0,3,0),e.addMany(l,1,3,1),e.add(127,1,0,1),e.addMany(l,8,0,8),e.addMany(l,3,3,3),e.add(127,3,0,3),e.addMany(l,4,3,4),e.add(127,4,0,4),e.addMany(l,6,3,6),e.addMany(l,5,3,5),e.add(127,5,0,5),e.addMany(l,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(l,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(l,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(l,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(l,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(l,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(l,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(si,0,2,0),e.add(si,8,5,8),e.add(si,6,0,6),e.add(si,11,0,11),e.add(si,13,13,13),e})(),$w=class extends De{constructor(e=Ww){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new sg,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Ke(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new zw),this._dcsParser=this._register(new Fw),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let l=0;l<e.intermediates.length;++l){let a=e.intermediates.charCodeAt(l);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=n,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let n=this._escHandlers[r];return n.push(t),{dispose:()=>{let l=n.indexOf(t);l!==-1&&n.splice(l,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let n=this._csiHandlers[r];return n.push(t),{dispose:()=>{let l=n.indexOf(t);l!==-1&&n.splice(l,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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(e,t,r,n,l){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=l}parse(e,t,r){let n=0,l=0,a=0,h;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,_=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&_>-1){for(;_>=0&&(h=d[_](this._params),h!==!0);_--)if(h instanceof Promise)return this._parseStack.handlerPos=_,h}this._parseStack.handlers=[];break;case 4:if(r===!1&&_>-1){for(;_>=0&&(h=d[_](),h!==!0);_--)if(h instanceof Promise)return this._parseStack.handlerPos=_,h}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(n!==24&&n!==26,r),h)return h;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],h=this._oscParser.end(n!==24&&n!==26,r),h)return h;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=a;d<t;++d){switch(n=e[d],l=this._transitions.table[this.currentState<<8|(n<160?n:si)],l>>4){case 2:for(let w=d+1;;++w){if(w>=t||(n=e[w])<32||n>126&&n<si){this._printHandler(e,d,w),d=w-1;break}if(++w>=t||(n=e[w])<32||n>126&&n<si){this._printHandler(e,d,w),d=w-1;break}if(++w>=t||(n=e[w])<32||n>126&&n<si){this._printHandler(e,d,w),d=w-1;break}if(++w>=t||(n=e[w])<32||n>126&&n<si){this._printHandler(e,d,w),d=w-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let _=this._csiHandlers[this._collect<<8|n],p=_?_.length-1:-1;for(;p>=0&&(h=_[p](this._params),h!==!0);p--)if(h instanceof Promise)return this._preserveStack(3,_,p,l,d),h;p<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++d<t&&(n=e[d])>47&&n<60);d--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let g=this._escHandlers[this._collect<<8|n],y=g?g.length-1:-1;for(;y>=0&&(h=g[y](),h!==!0);y--)if(h instanceof Promise)return this._preserveStack(4,g,y,l,d),h;y<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let w=d+1;;++w)if(w>=t||(n=e[w])===24||n===26||n===27||n>127&&n<si){this._dcsParser.put(e,d,w),d=w-1;break}break;case 14:if(h=this._dcsParser.unhook(n!==24&&n!==26),h)return this._preserveStack(6,[],0,l,d),h;n===27&&(l|=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 w=d+1;;w++)if(w>=t||(n=e[w])<32||n>127&&n<si){this._oscParser.put(e,d,w),d=w-1;break}break;case 6:if(h=this._oscParser.end(n!==24&&n!==26),h)return this._preserveStack(5,[],0,l,d),h;n===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=l&15}}},Uw=/^([\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})$/,Kw=/^[\da-f]+$/;function Qp(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=Uw.exec(t);if(r){let n=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/n*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/n*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/n*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),Kw.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,n=[0,0,0];for(let l=0;l<3;++l){let a=parseInt(t.slice(r*l,r*l+r),16);n[l]=r===1?a<<4:r===2?a:r===3?a>>4:a>>8}return n}}function Dc(e,t){let r=e.toString(16),n=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function Vw(e,t=16){let[r,n,l]=e;return`rgb:${Dc(r,t)}/${Dc(n,t)}/${Dc(l,t)}`}var qw={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ur=131072,Jp=10;function Zp(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var em=5e3,tm=0,Yw=class extends De{constructor(e,t,r,n,l,a,h,d,_=new $w){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=l,this._oscLinkService=a,this._coreMouseService=h,this._unicodeService=d,this._parser=_,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new fy,this._utf8Decoder=new py,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=rt.clone(),this._eraseAttrDataInternal=rt.clone(),this._onRequestBell=this._register(new ae),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ae),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ae),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ae),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ae),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ae),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ae),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ae),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ae),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ae),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ae),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ae),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 zh(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:g.toArray()})}),this._parser.setEscHandlerFallback(p=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(p)})}),this._parser.setExecuteHandlerFallback(p=>{this._logService.debug("Unknown EXECUTE code: ",{code:p})}),this._parser.setOscHandlerFallback((p,g,y)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:g,data:y})}),this._parser.setDcsHandlerFallback((p,g,y)=>{g==="HOOK"&&(y=y.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:g,payload:y})}),this._parser.setPrintHandler((p,g,y)=>this.print(p,g,y)),this._parser.registerCsiHandler({final:"@"},p=>this.insertChars(p)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},p=>this.scrollLeft(p)),this._parser.registerCsiHandler({final:"A"},p=>this.cursorUp(p)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},p=>this.scrollRight(p)),this._parser.registerCsiHandler({final:"B"},p=>this.cursorDown(p)),this._parser.registerCsiHandler({final:"C"},p=>this.cursorForward(p)),this._parser.registerCsiHandler({final:"D"},p=>this.cursorBackward(p)),this._parser.registerCsiHandler({final:"E"},p=>this.cursorNextLine(p)),this._parser.registerCsiHandler({final:"F"},p=>this.cursorPrecedingLine(p)),this._parser.registerCsiHandler({final:"G"},p=>this.cursorCharAbsolute(p)),this._parser.registerCsiHandler({final:"H"},p=>this.cursorPosition(p)),this._parser.registerCsiHandler({final:"I"},p=>this.cursorForwardTab(p)),this._parser.registerCsiHandler({final:"J"},p=>this.eraseInDisplay(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},p=>this.eraseInDisplay(p,!0)),this._parser.registerCsiHandler({final:"K"},p=>this.eraseInLine(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},p=>this.eraseInLine(p,!0)),this._parser.registerCsiHandler({final:"L"},p=>this.insertLines(p)),this._parser.registerCsiHandler({final:"M"},p=>this.deleteLines(p)),this._parser.registerCsiHandler({final:"P"},p=>this.deleteChars(p)),this._parser.registerCsiHandler({final:"S"},p=>this.scrollUp(p)),this._parser.registerCsiHandler({final:"T"},p=>this.scrollDown(p)),this._parser.registerCsiHandler({final:"X"},p=>this.eraseChars(p)),this._parser.registerCsiHandler({final:"Z"},p=>this.cursorBackwardTab(p)),this._parser.registerCsiHandler({final:"`"},p=>this.charPosAbsolute(p)),this._parser.registerCsiHandler({final:"a"},p=>this.hPositionRelative(p)),this._parser.registerCsiHandler({final:"b"},p=>this.repeatPrecedingCharacter(p)),this._parser.registerCsiHandler({final:"c"},p=>this.sendDeviceAttributesPrimary(p)),this._parser.registerCsiHandler({prefix:">",final:"c"},p=>this.sendDeviceAttributesSecondary(p)),this._parser.registerCsiHandler({final:"d"},p=>this.linePosAbsolute(p)),this._parser.registerCsiHandler({final:"e"},p=>this.vPositionRelative(p)),this._parser.registerCsiHandler({final:"f"},p=>this.hVPosition(p)),this._parser.registerCsiHandler({final:"g"},p=>this.tabClear(p)),this._parser.registerCsiHandler({final:"h"},p=>this.setMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"h"},p=>this.setModePrivate(p)),this._parser.registerCsiHandler({final:"l"},p=>this.resetMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"l"},p=>this.resetModePrivate(p)),this._parser.registerCsiHandler({final:"m"},p=>this.charAttributes(p)),this._parser.registerCsiHandler({final:"n"},p=>this.deviceStatus(p)),this._parser.registerCsiHandler({prefix:"?",final:"n"},p=>this.deviceStatusPrivate(p)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},p=>this.softReset(p)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},p=>this.setCursorStyle(p)),this._parser.registerCsiHandler({final:"r"},p=>this.setScrollRegion(p)),this._parser.registerCsiHandler({final:"s"},p=>this.saveCursor(p)),this._parser.registerCsiHandler({final:"t"},p=>this.windowOptions(p)),this._parser.registerCsiHandler({final:"u"},p=>this.restoreCursor(p)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},p=>this.insertColumns(p)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},p=>this.deleteColumns(p)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},p=>this.selectProtected(p)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},p=>this.requestMode(p,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},p=>this.requestMode(p,!1)),this._parser.setExecuteHandler(ie.BEL,()=>this.bell()),this._parser.setExecuteHandler(ie.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ie.BS,()=>this.backspace()),this._parser.setExecuteHandler(ie.HT,()=>this.tab()),this._parser.setExecuteHandler(ie.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ie.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(rl.IND,()=>this.index()),this._parser.setExecuteHandler(rl.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(rl.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Yt(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new Yt(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new Yt(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new Yt(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new Yt(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new Yt(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new Yt(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new Yt(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new Yt(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new Yt(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new Yt(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new Yt(p=>this.restoreCursorColor(p))),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(let p in ct)this._parser.registerEscHandler({intermediates:"(",final:p},()=>this.selectCharset("("+p)),this._parser.registerEscHandler({intermediates:")",final:p},()=>this.selectCharset(")"+p)),this._parser.registerEscHandler({intermediates:"*",final:p},()=>this.selectCharset("*"+p)),this._parser.registerEscHandler({intermediates:"+",final:p},()=>this.selectCharset("+"+p)),this._parser.registerEscHandler({intermediates:"-",final:p},()=>this.selectCharset("-"+p)),this._parser.registerEscHandler({intermediates:".",final:p},()=>this.selectCharset("."+p)),this._parser.registerEscHandler({intermediates:"/",final:p},()=>this.selectCharset("/"+p));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(p=>(this._logService.error("Parsing error: ",p),p)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Gp((p,g)=>this.requestStatusString(p,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),em))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${em} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,l=this._activeBuffer.y,a=0,h=this._parseStack.paused;if(h){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,l=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ur&&(a=this._parseStack.position+ur)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,p=>String.fromCharCode(p)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(p=>p.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ur&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ur))),h||this._dirtyRowTracker.clearRange(),e.length>ur)for(let p=a;p<e.length;p+=ur){let g=p+ur<e.length?p+ur:e.length,y=typeof e=="string"?this._stringDecoder.decode(e.substring(p,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,g),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,y))return this._preserveStack(n,l,y,p),this._logSlowResolvingAsync(r),r}else if(!h){let p=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,p))return this._preserveStack(n,l,p,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==n||this._activeBuffer.y!==l)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),_=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);_<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(_,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,r){let n,l,a=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,_=this._coreService.decPrivateModes.wraparound,p=this._coreService.modes.insertMode,g=this._curAttrData,y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&y.getWidth(this._activeBuffer.x-1)===2&&y.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let w=this._parser.precedingJoinState;for(let v=t;v<r;++v){if(n=e[v],n<127&&a){let W=a[String.fromCharCode(n)];W&&(n=W.charCodeAt(0))}let C=this._unicodeService.charProperties(n,w);l=Br.extractWidth(C);let b=Br.extractShouldJoin(C),E=b?Br.extractWidth(w):0;if(w=C,h&&this._onA11yChar.fire(fr(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+l-E>d){if(_){let W=y,B=this._activeBuffer.x-E;for(this._activeBuffer.x=E,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),y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&y instanceof vn&&y.copyCellsFrom(W,B,0,E,!1);B<d;)W.setCellFromCodepoint(B++,0,1,g)}else if(this._activeBuffer.x=d-1,l===2)continue}if(b&&this._activeBuffer.x){let W=y.getWidth(this._activeBuffer.x-1)?1:2;y.addCodepointToCell(this._activeBuffer.x-W,n,l);for(let B=l-E;--B>=0;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(p&&(y.insertCells(this._activeBuffer.x,l-E,this._activeBuffer.getNullCell(g)),y.getWidth(d-1)===2&&y.setCellFromCodepoint(d-1,0,1,g)),y.setCellFromCodepoint(this._activeBuffer.x++,n,l,g),l>0)for(;--l;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=w,this._activeBuffer.x<d&&r-t>0&&y.getWidth(this._activeBuffer.x)===0&&!y.hasContent(this._activeBuffer.x)&&y.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>Zp(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Gp(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Yt(t))}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 e;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&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,n=!1,l=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),l),n&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var n;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&n.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let l=this._activeBuffer.lines.length-this._bufferService.rows;l>0&&(this._activeBuffer.lines.trimStart(l),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-l,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-l,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,l=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(l-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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(e){let t=e.params[0]||1;for(;t--;)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(rt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let r=e.params[0]||1,n=Br.extractWidth(t),l=this._activeBuffer.x-n,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(l),h=new Uint32Array(a.length*r),d=0;for(let p=0;p<a.length;){let g=a.codePointAt(p)||0;h[d++]=g,p+=g>65535?2:1}let _=d;for(let p=1;p<r;++p)h.copyWithin(_,0,d),_+=d;return this.print(h,0,_),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ie.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ie.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ie.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ie.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ie.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Lr),this._charsetService.setgCharset(1,Lr),this._charsetService.setgCharset(2,Lr),this._charsetService.setgCharset(3,Lr);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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(b=>(b[b.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",b[b.SET=1]="SET",b[b.RESET=2]="RESET",b[b.PERMANENTLY_SET=3]="PERMANENTLY_SET",b[b.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let n=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:a}=this._coreMouseService,h=this._coreService,{buffers:d,cols:_}=this._bufferService,{active:p,alt:g}=d,y=this._optionsService.rawOptions,w=(b,E)=>(h.triggerDataEvent(`${ie.ESC}[${t?"":"?"}${b};${E}$y`),!0),v=b=>b?1:2,C=e.params[0];return t?C===2?w(C,4):C===4?w(C,v(h.modes.insertMode)):C===12?w(C,3):C===20?w(C,v(y.convertEol)):w(C,0):C===1?w(C,v(n.applicationCursorKeys)):C===3?w(C,y.windowOptions.setWinLines?_===80?2:_===132?1:0:0):C===6?w(C,v(n.origin)):C===7?w(C,v(n.wraparound)):C===8?w(C,3):C===9?w(C,v(l==="X10")):C===12?w(C,v(y.cursorBlink)):C===25?w(C,v(!h.isCursorHidden)):C===45?w(C,v(n.reverseWraparound)):C===66?w(C,v(n.applicationKeypad)):C===67?w(C,4):C===1e3?w(C,v(l==="VT200")):C===1002?w(C,v(l==="DRAG")):C===1003?w(C,v(l==="ANY")):C===1004?w(C,v(n.sendFocus)):C===1005?w(C,4):C===1006?w(C,v(a==="SGR")):C===1015?w(C,4):C===1016?w(C,v(a==="SGR_PIXELS")):C===1048?w(C,1):C===47||C===1047||C===1049?w(C,v(p===g)):C===2004?w(C,v(n.bracketedPasteMode)):C===2026?w(C,v(n.synchronizedOutput)):w(C,0)}_updateAttrColor(e,t,r,n,l){return t===2?(e|=50331648,e&=-16777216,e|=En.fromColorRGB([r,n,l])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let n=[0,0,-1,0,0,0],l=0,a=0;do{if(n[a+l]=e.params[t+a],e.hasSubParams(t+a)){let h=e.getSubParams(t+a),d=0;do n[1]===5&&(l=1),n[a+d+1+l]=h[d];while(++d<h.length&&d+a+1+l<n.length);break}if(n[1]===5&&a+l>=2||n[1]===2&&a+l>=5)break;n[1]&&(l=1)}while(++a+t<e.length&&a+l<n.length);for(let h=2;h<n.length;++h)n[h]===-1&&(n[h]=0);switch(n[0]){case 38:r.fg=this._updateAttrColor(r.fg,n[1],n[3],n[4],n[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,n[1],n[3],n[4],n[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,n[1],n[3],n[4],n[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=rt.fg,e.bg=rt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,n=this._curAttrData;for(let l=0;l<t;l++)r=e.params[l],r>=30&&r<=37?(n.fg&=-50331904,n.fg|=16777216|r-30):r>=40&&r<=47?(n.bg&=-50331904,n.bg|=16777216|r-40):r>=90&&r<=97?(n.fg&=-50331904,n.fg|=16777216|r-90|8):r>=100&&r<=107?(n.bg&=-50331904,n.bg|=16777216|r-100|8):r===0?this._processSGR0(n):r===1?n.fg|=134217728:r===3?n.bg|=67108864:r===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(l)?e.getSubParams(l)[0]:1,n)):r===5?n.fg|=536870912:r===7?n.fg|=67108864:r===8?n.fg|=1073741824:r===9?n.fg|=2147483648:r===2?n.bg|=134217728:r===21?this._processUnderline(2,n):r===22?(n.fg&=-134217729,n.bg&=-134217729):r===23?n.bg&=-67108865:r===24?(n.fg&=-268435457,this._processUnderline(0,n)):r===25?n.fg&=-536870913:r===27?n.fg&=-67108865:r===28?n.fg&=-1073741825:r===29?n.fg&=2147483647:r===39?(n.fg&=-67108864,n.fg|=rt.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=rt.bg&16777215):r===38||r===48||r===58?l+=this._extractColor(e,l,n):r===53?n.bg|=1073741824:r===55?n.bg&=-1073741825:r===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):r===100?(n.fg&=-67108864,n.fg|=rt.fg&16777215,n.bg&=-67108864,n.bg|=rt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ie.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ie.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ie.ESC}[?${t};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=rt.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(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Zp(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ie.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Jp&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Jp&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let n=r.shift(),l=r.shift();if(/^\d+$/.exec(n)){let a=parseInt(n);if(im(a))if(l==="?")t.push({type:0,index:a});else{let h=Qp(l);h&&t.push({type:1,index:a,color:h})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(r,n):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,l=r.findIndex(a=>a.startsWith("id="));return l!==-1&&(n=r[l].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let r=e.split(";");for(let n=0;n<r.length&&!(t>=this._specialColors.length);++n,++t)if(r[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let l=Qp(r[n]);l&&this._onColor.fire([{type:1,index:this._specialColors[t],color:l}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],r=e.split(";");for(let n=0;n<r.length;++n)if(/^\d+$/.exec(r[n])){let l=parseInt(r[n]);im(l)&&t.push({type:2,index:l})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){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,Lr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(qw[e[0]],ct[e[1]]||Lr),!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){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=rt.clone(),this._eraseAttrDataInternal=rt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new ni;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(r);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=h=>(this._coreService.triggerDataEvent(`${ie.ESC}${h}${ie.ESC}\\`),!0),n=this._bufferService.buffer,l=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[l.cursorStyle]-(l.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},zh=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(tm=e,e=t,t=tm),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};zh=Je([de(0,Pt)],zh);function im(e){return 0<=e&&e<256}var Xw=5e7,rm=12,Gw=50,Qw=class extends De{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ae),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Xw)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],l=this._action(n,t);if(l){let h=d=>performance.now()-r>=rm?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(r,d);l.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(h);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=rm)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Gw&&(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()}},Fh=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let d=t.addMarker(t.ybase+t.y),_={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(_,d)),this._dataByLinkId.set(_.id,_),_.id}let r=e,n=this._getEntryIdKey(r),l=this._entriesWithId.get(n);if(l)return this.addLineToLink(l.id,t.ybase+t.y),l.id;let a=t.addMarker(t.ybase+t.y),h={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(h,a)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);r.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(r,n))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Fh=Je([de(0,Pt)],Fh);var sm=!1,Jw=class extends De{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ms),this._onBinary=this._register(new ae),this.onBinary=this._onBinary.event,this._onData=this._register(new ae),this.onData=this._onData.event,this._onLineFeed=this._register(new ae),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ae),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ae),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ae),this._instantiationService=new Cw,this.optionsService=this._register(new Lw(e)),this._instantiationService.setService(Lt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Ah)),this._instantiationService.setService(Pt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Bh)),this._instantiationService.setService(b_,this._logService),this.coreService=this._register(this._instantiationService.createInstance(jh)),this._instantiationService.setService(Ir,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Oh)),this._instantiationService.setService(C_,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Br)),this._instantiationService.setService(vy,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Ow),this._instantiationService.setService(gy,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Fh),this._instantiationService.setService(x_,this._oscLinkService),this._inputHandler=this._register(new Yw(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ct.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ct.forward(this._bufferService.onResize,this._onResize)),this._register(Ct.forward(this.coreService.onData,this._onData)),this._register(Ct.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Qw((t,r)=>this._inputHandler.parse(t,r))),this._register(Ct.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ae),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.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(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!sm&&(this._logService.warn("writeSync is unreliable and will be removed soon."),sm=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,ig),t=Math.max(t,rg),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Xp.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Xp(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ke(()=>{for(let t of e)t.dispose()})}}},Zw={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:["'",'"']};function e1(e,t,r,n){var h;let l={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?l.key=ie.ESC+"OA":l.key=ie.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?l.key=ie.ESC+"OD":l.key=ie.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?l.key=ie.ESC+"OC":l.key=ie.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?l.key=ie.ESC+"OB":l.key=ie.ESC+"[B");break;case 8:l.key=e.ctrlKey?"\b":ie.DEL,e.altKey&&(l.key=ie.ESC+l.key);break;case 9:if(e.shiftKey){l.key=ie.ESC+"[Z";break}l.key=ie.HT,l.cancel=!0;break;case 13:l.key=e.altKey?ie.ESC+ie.CR:ie.CR,l.cancel=!0;break;case 27:l.key=ie.ESC,e.altKey&&(l.key=ie.ESC+ie.ESC),l.cancel=!0;break;case 37:if(e.metaKey)break;a?l.key=ie.ESC+"[1;"+(a+1)+"D":t?l.key=ie.ESC+"OD":l.key=ie.ESC+"[D";break;case 39:if(e.metaKey)break;a?l.key=ie.ESC+"[1;"+(a+1)+"C":t?l.key=ie.ESC+"OC":l.key=ie.ESC+"[C";break;case 38:if(e.metaKey)break;a?l.key=ie.ESC+"[1;"+(a+1)+"A":t?l.key=ie.ESC+"OA":l.key=ie.ESC+"[A";break;case 40:if(e.metaKey)break;a?l.key=ie.ESC+"[1;"+(a+1)+"B":t?l.key=ie.ESC+"OB":l.key=ie.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(l.key=ie.ESC+"[2~");break;case 46:a?l.key=ie.ESC+"[3;"+(a+1)+"~":l.key=ie.ESC+"[3~";break;case 36:a?l.key=ie.ESC+"[1;"+(a+1)+"H":t?l.key=ie.ESC+"OH":l.key=ie.ESC+"[H";break;case 35:a?l.key=ie.ESC+"[1;"+(a+1)+"F":t?l.key=ie.ESC+"OF":l.key=ie.ESC+"[F";break;case 33:e.shiftKey?l.type=2:e.ctrlKey?l.key=ie.ESC+"[5;"+(a+1)+"~":l.key=ie.ESC+"[5~";break;case 34:e.shiftKey?l.type=3:e.ctrlKey?l.key=ie.ESC+"[6;"+(a+1)+"~":l.key=ie.ESC+"[6~";break;case 112:a?l.key=ie.ESC+"[1;"+(a+1)+"P":l.key=ie.ESC+"OP";break;case 113:a?l.key=ie.ESC+"[1;"+(a+1)+"Q":l.key=ie.ESC+"OQ";break;case 114:a?l.key=ie.ESC+"[1;"+(a+1)+"R":l.key=ie.ESC+"OR";break;case 115:a?l.key=ie.ESC+"[1;"+(a+1)+"S":l.key=ie.ESC+"OS";break;case 116:a?l.key=ie.ESC+"[15;"+(a+1)+"~":l.key=ie.ESC+"[15~";break;case 117:a?l.key=ie.ESC+"[17;"+(a+1)+"~":l.key=ie.ESC+"[17~";break;case 118:a?l.key=ie.ESC+"[18;"+(a+1)+"~":l.key=ie.ESC+"[18~";break;case 119:a?l.key=ie.ESC+"[19;"+(a+1)+"~":l.key=ie.ESC+"[19~";break;case 120:a?l.key=ie.ESC+"[20;"+(a+1)+"~":l.key=ie.ESC+"[20~";break;case 121:a?l.key=ie.ESC+"[21;"+(a+1)+"~":l.key=ie.ESC+"[21~";break;case 122:a?l.key=ie.ESC+"[23;"+(a+1)+"~":l.key=ie.ESC+"[23~";break;case 123:a?l.key=ie.ESC+"[24;"+(a+1)+"~":l.key=ie.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?l.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?l.key=ie.NUL:e.keyCode>=51&&e.keyCode<=55?l.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?l.key=ie.DEL:e.keyCode===219?l.key=ie.ESC:e.keyCode===220?l.key=ie.FS:e.keyCode===221&&(l.key=ie.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let d=(h=Zw[e.keyCode])==null?void 0:h[e.shiftKey?1:0];if(d)l.key=ie.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let _=e.ctrlKey?e.keyCode-64:e.keyCode+32,p=String.fromCharCode(_);e.shiftKey&&(p=p.toUpperCase()),l.key=ie.ESC+p}else if(e.keyCode===32)l.key=ie.ESC+(e.ctrlKey?ie.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let _=e.code.slice(3,4);e.shiftKey||(_=_.toLowerCase()),l.key=ie.ESC+_,l.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(l.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?l.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(l.key=ie.US),e.key==="@"&&(l.key=ie.NUL));break}return l}var tt=0,t1=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new hl,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new hl,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((l,a)=>this._getKey(l)-this._getKey(a)),t=0,r=0,n=new Array(this._array.length+this._insertedValues.length);for(let l=0;l<n.length;l++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(n[l]=e[t],t++):n[l]=this._array[r++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(tt=this._search(t),tt===-1)||this._getKey(this._array[tt])!==t)return!1;do if(this._array[tt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(tt),!0;while(++tt<this._array.length&&this._getKey(this._array[tt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((l,a)=>l-a),t=0,r=new Array(this._array.length-e.length),n=0;for(let l=0;l<this._array.length;l++)e[t]===l?t++:r[n++]=this._array[l];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(tt=this._search(e),!(tt<0||tt>=this._array.length)&&this._getKey(this._array[tt])===e))do yield this._array[tt];while(++tt<this._array.length&&this._getKey(this._array[tt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(tt=this._search(e),!(tt<0||tt>=this._array.length)&&this._getKey(this._array[tt])===e))do t(this._array[tt]);while(++tt<this._array.length&&this._getKey(this._array[tt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let n=t+r>>1,l=this._getKey(this._array[n]);if(l>e)r=n-1;else if(l<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},Pc=0,nm=0,i1=class extends De{constructor(){super(),this._decorations=new t1(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ae),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ae),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ke(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new r1(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let n=0,l=0;for(let a of this._decorations.getKeyIterator(t))n=a.options.x??0,l=n+(a.options.width??1),e>=n&&e<l&&(!r||(a.options.layer??"bottom")===r)&&(yield a)}forEachDecorationAtCell(e,t,r,n){this._decorations.forEachByKey(t,l=>{Pc=l.options.x??0,nm=Pc+(l.options.width??1),e>=Pc&&e<nm&&(!r||(l.options.layer??"bottom")===r)&&n(l)})}},r1=class extends mr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ae),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ae),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Xe.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Xe.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},s1=1e3,n1=class{constructor(e,t=s1){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let l=n-this._lastRefreshMs,a=this._debounceThresholdMS-l;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},a)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},om=20,ul=class extends De{constructor(e,t,r,n){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let l=this._coreBrowserService.mainDocument;this._accessibilityContainer=l.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=l.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let a=0;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);if(this._topBoundaryFocusListener=a=>this._handleBoundaryFocus(a,0),this._bottomBoundaryFocusListener=a=>this._handleBoundaryFocus(a,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=l.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new n1(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(a=>this._handleResize(a.rows))),this._register(this._terminal.onRender(a=>this._refreshRows(a.start,a.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(a=>this._handleChar(a))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
64
|
+
`))),this._register(this._terminal.onA11yTab(a=>this._handleTab(a))),this._register(this._terminal.onKey(a=>this._handleKey(a.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ne(l,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ke(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<om+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
65
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===om+1&&(this._liveRegion.textContent+=oh.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,n=r.lines.length.toString();for(let l=e;l<=t;l++){let a=r.lines.get(r.ydisp+l),h=[],d=(a==null?void 0:a.translateToString(!0,void 0,void 0,h))||"",_=(r.ydisp+l+1).toString(),p=this._rowElements[l];p&&(d.length===0?(p.textContent=" ",this._rowColumns.set(p,[0,1])):(p.textContent=d,this._rowColumns.set(p,h)),p.setAttribute("aria-posinset",_),p.setAttribute("aria-setsize",n),this._alignRowWidth(p))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],l=r.getAttribute("aria-posinset"),a=t===0?"1":`${this._terminal.buffer.lines.length}`;if(l===a||e.relatedTarget!==n)return;let h,d;if(t===0?(h=r,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(h=this._rowElements.shift(),d=r,this._rowContainer.removeChild(h)),h.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let _=this._createAccessibilityTreeNode();this._rowElements.unshift(_),this._rowContainer.insertAdjacentElement("afterbegin",_)}else{let _=this._createAccessibilityTreeNode();this._rowElements.push(_),this._rowContainer.appendChild(_)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var d;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let n=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:n,offset:((d=n.textContent)==null?void 0:d.length)??0}),!this._rowContainer.contains(r.node))return;let l=({node:_,offset:p})=>{let g=_ instanceof Text?_.parentNode:_,y=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(y))return console.warn("row is invalid. Race condition?"),null;let w=this._rowColumns.get(g);if(!w)return console.warn("columns is null. Race condition?"),null;let v=p<w.length?w[p]:w.slice(-1)[0]+1;return v>=this._terminal.cols&&(++y,v=0),{row:y,column:v}},a=l(t),h=l(r);if(!(!a||!h)){if(a.row>h.row||a.row===h.row&&a.column>=h.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(h.row-a.row)*this._terminal.cols-a.column+h.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var l,a;e.style.transform="";let t=e.getBoundingClientRect().width,r=(a=(l=this._rowColumns.get(e))==null?void 0:l.slice(-1))==null?void 0:a[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};ul=Je([de(1,Zh),de(2,Hi),de(3,Wi)],ul);var Hh=class extends De{constructor(e,t,r,n,l){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=n,this._linkProviderService=l,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ae),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ae),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ke(()=>{var a;jr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(a=this._activeProviderReplies)==null||a.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ne(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ne(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ne(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ne(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let n=0;n<r.length;n++){let l=r[n];if(l.classList.contains("xterm"))break;if(l.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var n,l;(!this._activeProviderReplies||!t)&&((n=this._activeProviderReplies)==null||n.forEach(a=>{a==null||a.forEach(h=>{h.link.dispose&&h.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[a,h]of this._linkProviderService.linkProviders.entries())t?(l=this._activeProviderReplies)!=null&&l.get(a)&&(r=this._checkLinkProviderResult(a,e,r)):h.provideLinks(e.y,d=>{var p,g;if(this._isMouseOut)return;let _=d==null?void 0:d.map(y=>({link:y}));(p=this._activeProviderReplies)==null||p.set(a,_),r=this._checkLinkProviderResult(a,e,r),((g=this._activeProviderReplies)==null?void 0:g.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let n=0;n<t.size;n++){let l=t.get(n);if(l)for(let a=0;a<l.length;a++){let h=l[a],d=h.link.range.start.y<e?0:h.link.range.start.x,_=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let p=d;p<=_;p++){if(r.has(p)){l.splice(a--,1);break}r.add(p)}}}}_checkLinkProviderResult(e,t,r){var a;if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),l=!1;for(let h=0;h<e;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(l=!0);if(!l&&n){let h=n.find(d=>this._linkAtPosition(d.link,t));h&&(r=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let h=0;h<this._activeProviderReplies.size;h++){let d=(a=this._activeProviderReplies.get(h))==null?void 0:a.find(_=>this._linkAtPosition(_.link,t));if(d){r=!0,this._handleNewLink(d);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&o1(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,jr(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,n;return(n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.pointerCursor},set:r=>{var n;(n=this._currentLink)!=null&&n.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,n;return(n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline},set:r=>{var n,l,a;(n=this._currentLink)!=null&&n.state&&((a=(l=this._currentLink)==null?void 0:l.state)==null?void 0:a.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let n=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,l=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=l&&(this._clearCurrentLink(n,l),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,t,r){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,n=this._bufferService.buffer.ydisp,l=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(l)}_linkLeave(e,t,r){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,l=t.y*this._bufferService.cols+t.x;return r<=l&&l<=n}_positionFromMouseEvent(e,t,r){let n=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,n,l){return{x1:e,y1:t,x2:r,y2:n,cols:this._bufferService.cols,fg:l}}};Hh=Je([de(1,eu),de(2,Wi),de(3,Pt),de(4,E_)],Hh);function o1(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var l1=class extends Jw{constructor(e={}){super(e),this._linkifier=this._register(new ms),this.browser=K_,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ms),this._onCursorMove=this._register(new ae),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ae),this.onKey=this._onKey.event,this._onRender=this._register(new ae),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ae),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ae),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ae),this.onBell=this._onBell.event,this._onFocus=this._register(new ae),this._onBlur=this._register(new ae),this._onA11yCharEmitter=this._register(new ae),this._onA11yTabEmitter=this._register(new ae),this._onWillOpen=this._register(new ae),this._setup(),this._decorationService=this._instantiationService.createInstance(i1),this._instantiationService.setService(Nn,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(GS),this._instantiationService.setService(E_,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(ah)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Ct.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ct.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ct.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ct.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ke(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,n="";switch(t.index){case 256:r="foreground",n="10";break;case 257:r="background",n="11";break;case 258:r="cursor",n="12";break;default:r="ansi",n="4;"+t.index}switch(t.type){case 0:let l=$e.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${ie.ESC}]${n};${Vw(l)}${$_.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(a=>a.ansi[t.index]=st.toColor(...t.color));else{let a=r;this._themeService.modifyColors(h=>h[a]=st.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(ul,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ie.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ie.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,l=t.getWidth(r),a=this._renderService.dimensions.css.cell.width*l,h=this.buffer.y*this._renderService.dimensions.css.cell.height,d=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=h+"px",this.textarea.style.width=a+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ne(this.element,"copy",t=>{this.hasSelection()&&uy(t,this._selectionService)}));let e=t=>dy(t,this.textarea,this.coreService,this.optionsService);this._register(Ne(this.textarea,"paste",e)),this._register(Ne(this.element,"paste",e)),V_?this._register(Ne(this.element,"mousedown",t=>{t.button===2&&_p(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ne(this.element,"contextmenu",t=>{_p(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),au&&this._register(Ne(this.element,"auxclick",t=>{t.button===1&&g_(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ne(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ne(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ne(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ne(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ne(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ne(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ne(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var l;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((l=this.element)==null?void 0:l.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.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"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Ne(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",nh.get()),X_||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._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(YS,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Hi,this._coreBrowserService),this._register(Ne(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(Ne(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Mh,this._document,this._helperContainer),this._instantiationService.setService(yl,this._charSizeService),this._themeService=this._instantiationService.createInstance(Th),this._instantiationService.setService(_s,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(al),this._instantiationService.setService(k_,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ph,this.rows,this.screenElement)),this._instantiationService.setService(Wi,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Eh,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Dh),this._instantiationService.setService(eu,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(Hh,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(xh,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Lh,this.element,this.screenElement,n)),this._instantiationService.setService(Sy,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(Ct.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var a;this._selectionService.refresh(),(a=this._viewport)==null||a.queueSync()})),this._register(this._instantiationService.createInstance(kh,this.screenElement)),this._register(Ne(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),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(ul,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ll,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ll,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Rh,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(a){var p,g,y,w,v;let h=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!h)return!1;let d,_;switch(a.overrideType||a.type){case"mousemove":_=32,a.buttons===void 0?(d=3,a.button!==void 0&&(d=a.button<3?a.button:3)):d=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":_=0,d=a.button<3?a.button:3;break;case"mousedown":_=1,d=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let C=a.deltaY;if(C===0||e.coreMouseService.consumeWheelEvent(a,(w=(y=(g=(p=e._renderService)==null?void 0:p.dimensions)==null?void 0:g.device)==null?void 0:y.cell)==null?void 0:w.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return!1;_=C<0?0:1,d=4;break;default:return!1}return _===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:d,action:_,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},l={mouseup:a=>(r(a),a.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(a)),wheel:a=>(r(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&r(a)},mousemove:a=>{a.buttons||r(a)}};this._register(this.coreMouseService.onProtocolChange(a=>{a?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(a)),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()),a&8?n.mousemove||(t.addEventListener("mousemove",l.mousemove),n.mousemove=l.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),a&16?n.wheel||(t.addEventListener("wheel",l.wheel,{passive:!1}),n.wheel=l.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),a&2?n.mouseup||(n.mouseup=l.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),a&4?n.mousedrag||(n.mousedrag=l.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ne(t,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return r(a),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(a)})),this._register(Ne(t,"wheel",a=>{var h,d,_,p,g;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(a)===!1)return!1;if(!this.buffer.hasScrollback){if(a.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(a,(p=(_=(d=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:d.device)==null?void 0:_.cell)==null?void 0:p.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(a,!0);let y=ie.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(y,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?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(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){__(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}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 e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var r;(r=this._selectionService)==null||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=e1(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let n=this.rows-1;return this.scrollLines(r.type===2?-n:n),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===ie.ETX||r.key===ie.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(a1(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(rt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(ie.ESC+"[I"):this.coreService.triggerDataEvent(ie.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.ESC}[4;${r};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),l=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.ESC}[6;${l};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function a1(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var c1=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},h1=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new ni)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},lm=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new h1(t)}getNullCell(){return new ni}},u1=class extends De{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ae),this.onBufferChange=this._onBufferChange.event,this._normal=new lm(this._core.buffers.normal,"normal"),this._alternate=new lm(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)}},d1=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,n)=>t(r,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},f1=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},p1=["cols","rows"],wi=0,m1=class extends De{constructor(e){super(),this._core=this._register(new l1(e)),this._addonManager=this._register(new c1),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],r=(n,l)=>{this._checkReadonlyOptions(n),this._core.options[n]=l};for(let n in this._core.options){let l={get:t.bind(this,n),set:r.bind(this,n)};Object.defineProperty(this._publicOptions,n,l)}}_checkReadonlyOptions(e){if(p1.includes(e))throw new Error(`Option "${e}" 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 d1(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new f1(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 u1(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
66
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return nh.get()},set promptLabel(e){nh.set(e)},get tooMuchOutput(){return oh.get()},set tooMuchOutput(e){oh.set(e)}}}_verifyIntegers(...e){for(wi of e)if(wi===1/0||isNaN(wi)||wi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(wi of e)if(wi&&(wi===1/0||isNaN(wi)||wi%1!==0||wi<0))throw new Error("This API only accepts positive integers")}};/**
|
|
67
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
68
|
+
* @license MIT
|
|
69
|
+
*
|
|
70
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
71
|
+
* @license MIT
|
|
72
|
+
*
|
|
73
|
+
* Originally forked from (with the author's permission):
|
|
74
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
75
|
+
* http://bellard.org/jslinux/
|
|
76
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
77
|
+
*/var _1=2,g1=1,v1=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var y;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((y=this._terminal.options.overviewRuler)==null?void 0:y.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),l=Math.max(0,parseInt(r.getPropertyValue("width"))),a=window.getComputedStyle(this._terminal.element),h={top:parseInt(a.getPropertyValue("padding-top")),bottom:parseInt(a.getPropertyValue("padding-bottom")),right:parseInt(a.getPropertyValue("padding-right")),left:parseInt(a.getPropertyValue("padding-left"))},d=h.top+h.bottom,_=h.right+h.left,p=n-d,g=l-_-t;return{cols:Math.max(_1,Math.floor(g/e.css.cell.width)),rows:Math.max(g1,Math.floor(p/e.css.cell.height))}}};function y1(e,t){return e?`/api/route/${String(e).split("/").map(encodeURIComponent).join("/")}/_/ws?token=${encodeURIComponent(t||"")}`:"/ws"}function S1({session:e,node:t,token:r,cols:n,rows:l,readonly:a=!1,takeSize:h,focused:d,onData:_,onExit:p,onFiles:g,retryBaseMs:y=250}){const w=["localhost","127.0.0.1","::1","[::1]"].includes(location.hostname);if(location.protocol!=="https:"&&!w)throw new Error("nexuscrew: ws:// rifiutato su origine non-locale e non-TLS (apri via tunnel su localhost o servi in HTTPS)");const C=`${location.protocol==="https:"?"wss":"ws"}://${location.host}${y1(t,r)}`;let b=null,E=!1,W=!1,B=null,$=0,P=d;const J=()=>{if(E||W||B)return;const M=Math.min(5e3,Math.max(0,y)*2**Math.min($++,5));B=setTimeout(()=>{B=null,A()},M)},A=()=>{if(E||W)return;const M=new WebSocket(C);b=M,M.binaryType="arraybuffer",M.onopen=()=>{if(b!==M||E)return;$=0;const N={type:"attach",session:e,token:r,cols:n,rows:l,readonly:a};h!==void 0&&(N.takeSize=h),M.send(JSON.stringify(N)),P!==void 0&&M.send(JSON.stringify({type:"focus",on:!!P}))},M.onmessage=N=>{if(!(b!==M||E))if(typeof N.data=="string"){let j;try{j=JSON.parse(N.data)}catch{return}j.type==="exit"&&(W=!0,p&&p(j.code)),j.type==="files"&&g&&g(j)}else _&&_(new Uint8Array(N.data))},M.onerror=()=>{if(b===M)try{M.close()}catch{}},M.onclose=N=>{b!==M||E||W||[1e3,1002,4401,4404].includes(N==null?void 0:N.code)||J()}};return A(),{sendInput:M=>{!b||b.readyState!==1||b.send(typeof M=="string"?new TextEncoder().encode(M):M)},resize:(M,N)=>{n=M,l=N,(b==null?void 0:b.readyState)===1&&b.send(JSON.stringify({type:"resize",cols:M,rows:N}))},action:M=>{(b==null?void 0:b.readyState)===1&&b.send(JSON.stringify({type:"action",name:M}))},focus:M=>{P=M,(b==null?void 0:b.readyState)===1&&b.send(JSON.stringify({type:"focus",on:!!M}))},close:()=>{if(E=!0,B&&clearTimeout(B),B=null,b)try{b.close()}catch{}},get raw(){return b}}}async function am(e){const t=String(e||"");if(!t)return!1;try{if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")return await navigator.clipboard.writeText(t),!0}catch{}try{const r=document.createElement("textarea");r.value=t,r.readOnly=!0,r.style.position="fixed",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r),r.select();const n=document.execCommand&&document.execCommand("copy");if(r.remove(),n)return!0}catch{}return!1}function ng({session:e,node:t,token:r,readonly:n,takeSize:l,focused:a,sendRef:h,actionRef:d,ctrlRef:_,setCtrlArmed:p,onFiles:g,fontSize:y=13,selectionMode:w=!1,onSelectionModeChange:v}){const C=z.useRef(null),b=z.useRef(null),E=z.useRef(y);E.current=y;const W=z.useRef(a);W.current=a;const B=z.useRef(w);B.current=w;const[$,P]=z.useState(""),[J,A]=z.useState(""),M=async()=>{var I,U,H,O;const N=((U=(I=b.current)==null?void 0:I.term)==null?void 0:U.getSelection())||$,j=await am(N);A(x(j?"copied":"copy-manual")),j&&((O=(H=b.current)==null?void 0:H.term)==null||O.clearSelection(),v==null||v(!1)),setTimeout(()=>A(""),1800)};return z.useEffect(()=>{const N=b.current;N&&N.sock&&N.sock.focus&&N.sock.focus(!!a)},[a]),z.useEffect(()=>{const N=b.current;N&&(N.term.options.fontSize=y,N.fit.fit(),N.sock.resize(N.term.cols,N.term.rows))},[y]),z.useEffect(()=>{const N=new m1({cursorBlink:!0,fontSize:E.current,scrollback:1e3,theme:{background:"#0a0e0a"}}),j=new v1;N.loadAddon(j),N.open(C.current),j.fit();const I=new TextDecoder;let U;try{U=S1({session:e,node:t,token:r,readonly:n,takeSize:l,focused:W.current,onFiles:g,cols:N.cols,rows:N.rows,onData:ge=>N.write(I.decode(ge)),onExit:()=>N.write(`\r
|
|
78
|
+
\x1B[33m[sessione finita]\x1B[0m\r
|
|
79
|
+
`)})}catch(ge){return N.write(`\r
|
|
80
|
+
\x1B[31m${ge.message}\x1B[0m\r
|
|
81
|
+
`),()=>N.dispose()}b.current={term:N,fit:j,sock:U},h&&(h.current=ge=>U.sendInput(ge)),d&&(d.current=ge=>U.action(ge));const H=N.onData(ge=>{if(!n){if(_&&_.current&&ge.length===1){const Ae=ge.charCodeAt(0);let xe=Ae;Ae>=97&&Ae<=122?xe=Ae-96:Ae>=64&&Ae<=95?xe=Ae-64:Ae===32&&(xe=0),ge=String.fromCharCode(xe),_.current=!1,p&&p(!1)}U.sendInput(ge)}}),O=N.onSelectionChange(()=>P(N.getSelection()));N.attachCustomKeyEventHandler(ge=>(ge.ctrlKey||ge.metaKey)&&ge.key.toLowerCase()==="c"&&N.getSelection()?(ge.type==="keydown"&&am(N.getSelection()),!1):!0);const K=C.current,ee=24;let Z=null,L=null,D=0,te=null,X=null;const R=ge=>{const xe=(K.querySelector(".xterm-screen")||K).getBoundingClientRect(),Tt=Math.max(0,Math.min(N.cols-1,Math.floor((ge.clientX-xe.left)/Math.max(1,xe.width)*N.cols))),Ri=Math.max(0,Math.min(N.rows-1,Math.floor((ge.clientY-xe.top)/Math.max(1,xe.height)*N.rows)));return{col:Tt,row:N.buffer.active.viewportY+Ri}},Q=ge=>{if(ge.touches.length!==1){Z=null;return}if(B.current){ge.preventDefault(),ge.stopPropagation(),X=R(ge.touches[0]),N.clearSelection();return}Z=ge.touches[0].clientY,L=ge.touches[0].clientX,D=0,te=null},ce=ge=>{if(B.current&&X&&ge.touches.length===1){ge.preventDefault(),ge.stopPropagation();const xe=R(ge.touches[0]),Tt=X.row*N.cols+X.col,Ri=xe.row*N.cols+xe.col,$i=Tt<=Ri?X:xe;N.select($i.col,$i.row,Math.abs(Ri-Tt)+1);return}if(Z===null||ge.touches.length!==1)return;ge.preventDefault(),ge.stopPropagation();const Ae=ge.touches[0];if(te===null&&(Math.abs(Ae.clientY-Z)>8||Math.abs(Ae.clientX-L)>8)&&(te=Math.abs(Ae.clientY-Z)>Math.abs(Ae.clientX-L)),!!te){for(D+=Ae.clientY-Z,Z=Ae.clientY;D>=ee;)U.action("scroll-up"),D-=ee;for(;D<=-ee;)U.action("scroll-down"),D+=ee}},he=()=>{Z=null,X=null};let pe=0;const ve=ge=>{for(ge.preventDefault(),ge.stopPropagation(),pe+=ge.deltaY;pe<=-ee;)U.action("scroll-up"),pe+=ee;for(;pe>=ee;)U.action("scroll-down"),pe-=ee};K.addEventListener("touchstart",Q,{passive:!1}),K.addEventListener("touchmove",ce,{passive:!1,capture:!0}),K.addEventListener("touchend",he,{passive:!0}),K.addEventListener("wheel",ve,{passive:!1,capture:!0});const we=()=>{j.fit(),U.resize(N.cols,N.rows)};window.addEventListener("resize",we);const V=window.visualViewport;V&&(V.addEventListener("resize",we),V.addEventListener("scroll",we));let re=null,ke=0;return typeof ResizeObserver<"u"&&(re=new ResizeObserver(()=>{ke&&cancelAnimationFrame(ke),ke=requestAnimationFrame(we)}),re.observe(K)),()=>{b.current=null,H.dispose(),O.dispose(),K.removeEventListener("touchstart",Q),K.removeEventListener("touchmove",ce,{capture:!0}),K.removeEventListener("touchend",he),K.removeEventListener("wheel",ve,{capture:!0}),window.removeEventListener("resize",we),V&&(V.removeEventListener("resize",we),V.removeEventListener("scroll",we)),re&&re.disconnect(),ke&&cancelAnimationFrame(ke),U.close(),N.dispose()}},[e,t,r,n,l,h,d,_,p,g]),f.jsxs("div",{className:`nc-terminal${w?" selecting":""}`,children:[f.jsx("div",{className:"nc-terminal-host",ref:C}),($||w)&&f.jsxs("div",{className:"nc-selection-tools",children:[$?f.jsx("button",{type:"button",onClick:M,children:J||x("copy")}):f.jsx("span",{children:x("select-drag")}),f.jsx("button",{type:"button",onClick:()=>{var N,j;(j=(N=b.current)==null?void 0:N.term)==null||j.clearSelection(),P(""),v==null||v(!1)},children:x("cancel")}),J===x("copy-manual")&&f.jsx("textarea",{readOnly:!0,value:$,onFocus:N=>N.target.select()})]})]})}const cm="",Ht="\x1B",w1=[{label:"↑",seq:Ht+"[A"},{label:"↓",seq:Ht+"[B"},{label:"PGUP",seq:Ht+"[5~"},{label:"PGDN",seq:Ht+"[6~"}];function C1({send:e,action:t,ctrlArmed:r=!1,onCtrl:n,onKeyboard:l,selectionMode:a=!1,onSelectionMode:h}){const[d,_]=z.useState(!1),[p,g]=z.useState(!1),[y,w]=z.useState(!1),v=E=>{y?(e(Ht+E),w(!1)):e(E)},C=(E,W,B)=>f.jsx("button",{onMouseDown:$=>{$.preventDefault(),v(W),B&&B()},children:E},E),b=(E,W)=>f.jsx("button",{onMouseDown:B=>{B.preventDefault(),t(W),g(!1)},children:E},E);return d?f.jsxs("div",{className:"nc-keybar copy",children:[f.jsx("span",{className:"tag",children:"copy-mode"}),w1.map(E=>C(E.label,E.seq)),C("ESCI (q)","q",()=>_(!1))]}):f.jsxs("div",{className:"nc-keybar termux",children:[p&&f.jsxs("div",{className:"nc-keymenu",children:[b("←WIN","prev-window"),b("WIN→","next-window"),b("⬅PANE","pane-left"),b("PANE➡","pane-right"),C("SCROLL",cm+"[",()=>{_(!0),g(!1)}),f.jsx("button",{className:a?"armed":"",onMouseDown:E=>{E.preventDefault(),h==null||h(!a),g(!1)},children:"SELECT"}),C("⌃C","",()=>g(!1)),C("DETACH",cm+"d",()=>g(!1))]}),f.jsxs("div",{className:"row",children:[C("ESC",Ht),f.jsx("button",{className:p?"armed":"",onMouseDown:E=>{E.preventDefault(),g(W=>!W)},children:"☰"},"menu"),C("/","/"),C("—","-"),C("HOME",Ht+"[H"),C("↑",Ht+"[A"),C("END",Ht+"[F"),C("PGUP",Ht+"[5~")]}),f.jsxs("div",{className:"row",children:[C("⇥"," "),f.jsx("button",{onMouseDown:E=>{E.preventDefault(),l&&l()},children:"⌨"},"kbd"),f.jsx("button",{className:r?"armed":"",onMouseDown:E=>{E.preventDefault(),n&&n()},children:"CTRL"},"ctrl"),f.jsx("button",{className:y?"armed":"",onMouseDown:E=>{E.preventDefault(),w(W=>!W)},children:"ALT"},"alt"),C("←",Ht+"[D"),C("↓",Ht+"[B"),C("→",Ht+"[C"),C("PGDN",Ht+"[6~")]})]})}const b1=e=>e>1048576?`${(e/1048576).toFixed(1)}M`:e>1024?`${(e/1024).toFixed(0)}K`:`${e}B`;function og({session:e,node:t,token:r,filesEvent:n,onClose:l}){Wt();const a=t?`/api/route/${String(t).split("/").map(encodeURIComponent).join("/")}/_`:"/api",h=t?`${t}:${e}`:e,[d,_]=z.useState("outbox"),[p,g]=z.useState({inbox:[],outbox:[]}),[y,w]=z.useState(""),v=z.useRef(null);async function C(){try{const $=await(await gt(`${a}/files?session=${encodeURIComponent(e)}`,r)).json();if($.error){w($.error);return}g($);const P=$.outbox[0]?$.outbox[0].mtime:0;localStorage.setItem(Jm(h),String(P))}catch(B){w(String(B))}}z.useEffect(()=>{C()},[e,t]),z.useEffect(()=>{n&&n.session===e&&C()},[n]);async function b(B){for(const $ of B){w(`carico ${$.name}…`);const P=new FormData;P.append("session",e),P.append("file",$);try{const A=await(await gt(`${a}/files/upload`,r,{method:"POST",body:P})).json();w(A.error?`errore: ${A.error}`:"")}catch(J){w(String(J))}}C()}async function E(B){const $=await gt(`${a}/files/download?session=${encodeURIComponent(e)}&box=${d}&name=${encodeURIComponent(B)}`,r);if(!$.ok){w("errore download");return}const P=await $.blob(),J=URL.createObjectURL(P),A=document.createElement("a");A.href=J,A.download=B,A.click(),URL.revokeObjectURL(J)}async function W(B){await gt(`${a}/files?session=${encodeURIComponent(e)}&box=${d}&name=${encodeURIComponent(B)}`,r,{method:"DELETE"}),C()}return f.jsxs("div",{className:"nc-files",children:[f.jsxs("header",{children:[f.jsx("b",{children:t?`${t}:${e}`:e}),f.jsx("button",{onClick:l,title:x("close"),children:f.jsx(ze,{name:"x",size:20})})]}),f.jsxs("nav",{children:[f.jsx("button",{className:d==="outbox"?"on":"",onClick:()=>_("outbox"),children:"outbox"}),f.jsx("button",{className:d==="inbox"?"on":"",onClick:()=>_("inbox"),children:"inbox"}),f.jsxs("button",{className:"up",onClick:()=>v.current&&v.current.click(),children:[f.jsx(ze,{name:"upload",size:18})," ",x("upload")]}),f.jsx("input",{type:"file",multiple:!0,ref:v,style:{display:"none"},onChange:B=>{b(Array.from(B.target.files||[])),B.target.value=""}})]}),y&&f.jsx("div",{className:"nc-busy",children:y}),f.jsxs("ul",{children:[p[d].map(B=>f.jsxs("li",{children:[f.jsx("span",{className:"name",onClick:()=>E(B.name),children:B.name}),f.jsx("small",{children:b1(B.size)}),f.jsx("button",{onClick:()=>W(B.name),title:"elimina",children:f.jsx(ze,{name:"trash",size:18})})]},B.name)),p[d].length===0&&f.jsx("li",{className:"empty",children:x("empty-files")})]})]})}const x1="\r";function k1(e){let t=e.length;for(;t>0;){const r=e.charCodeAt(t-1);if(r===10||r===13)t-=1;else break}return e.slice(0,t)}function lg({send:e,token:t,session:r,node:n}){Wt();const l=n?`/api/route/${String(n).split("/").map(encodeURIComponent).join("/")}/_`:"/api",[a,h]=z.useState(""),[d,_]=z.useState(!1),[p,g]=z.useState(""),[y,w]=z.useState(!1),v=z.useRef(null),C=z.useRef(null),[b,E]=z.useState(!1),[W,B]=z.useState({left:0,bottom:0}),[$,P]=z.useState(!1),J=z.useRef(null),A=z.useRef(null),M=z.useRef(null),N=z.useRef(null),j=z.useRef(null),I=z.useRef(`nc-attach-${Math.random().toString(36).slice(2,8)}`);z.useEffect(()=>{let X=!1;if(n){w(!1);return}return gt(`${l}/voice/status`,t).then(R=>R.json()).then(R=>{X||w(!!R.serverSttConfigured)}).catch(()=>{X||w(!1)}),()=>{X=!0}},[t,l]);const H=!!(typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)||y);function O(){const X=k1(a);X&&(e(X),e(x1),h(""))}function K(){const X=J.current&&J.current.getBoundingClientRect();X&&B({left:Math.max(6,Math.min(X.left,window.innerWidth-186)),bottom:window.innerHeight-X.top+6}),E(!0)}function ee(X){E(!1),X&&J.current&&J.current.focus()}z.useEffect(()=>{if(!b)return;const X=Q=>{Q.key==="Escape"&&ee(!0)},R=Q=>{const ce=A.current&&A.current.contains(Q.target),he=J.current&&J.current.contains(Q.target);!ce&&!he&&ee(!1)};return document.addEventListener("keydown",X),document.addEventListener("pointerdown",R),()=>{document.removeEventListener("keydown",X),document.removeEventListener("pointerdown",R)}},[b]);function Z(X){ee(!1),X.current&&X.current.click()}async function L(X){if(!X.length||!r)return;P(!0),g("");const R=[];for(const Q of X)try{const ce=new FormData;ce.append("session",r),ce.append("paste","false"),ce.append("file",Q,Q.name);const pe=await(await gt(`${l}/files/upload`,t,{method:"POST",body:ce})).json();if(pe.error){g(pe.error);break}R.push(pe.path)}catch(ce){g(String(ce));break}R.length&&h(Q=>Q+(Q&&!Q.endsWith(" ")?" ":"")+R.join(" ")),P(!1)}function D(){v.current&&v.current.stop(),C.current&&C.current.stop(),_(!1)}async function te(){g("");const X=window.SpeechRecognition||window.webkitSpeechRecognition;if(X){const R=new X;R.lang="it-IT",R.continuous=!1,R.interimResults=!0;const Q=a?`${a} `:"";R.onresult=ce=>{const he=Array.from(ce.results).map(pe=>pe[0].transcript).join("");h(Q+he)},R.onend=()=>_(!1),R.onerror=ce=>{g(`voice: ${ce.error||"errore"}`),_(!1)},v.current=R,R.start(),_(!0);return}try{const R=await navigator.mediaDevices.getUserMedia({audio:!0}),Q=new MediaRecorder(R),ce=[];Q.ondataavailable=he=>ce.push(he.data),Q.onstop=async()=>{R.getTracks().forEach(he=>he.stop()),_(!1),g("trascrivo…");try{const he=new Blob(ce,{type:Q.mimeType||"audio/webm"}),ve=await(await gt(`${l}/voice/transcribe`,t,{method:"POST",headers:{"content-type":"application/octet-stream"},body:he})).json();ve.error?g(ve.error):(g(""),h(we=>we+(we?" ":"")+(ve.text||"")))}catch(he){g(String(he))}},C.current={stop:()=>Q.state!=="inactive"&&Q.stop()},Q.start(),_(!0)}catch{g("microfono non disponibile"),_(!1)}}return f.jsxs("div",{className:"nc-composer",children:[p&&f.jsx("div",{className:"nc-composer-err",children:p}),f.jsxs("div",{className:"nc-composer-row",children:[r&&f.jsx("button",{ref:J,className:$?"attach busy":"attach",disabled:$,onClick:()=>b?ee(!1):K(),title:x($?"attach-uploading":"attach"),"aria-label":x("attach"),"aria-haspopup":"menu","aria-expanded":b,"aria-controls":I.current,children:f.jsx(ze,{name:"attach",size:22})}),b&&f.jsxs("div",{ref:A,id:I.current,role:"menu",className:"nc-attach-menu",style:{left:W.left,bottom:W.bottom},children:[f.jsxs("button",{role:"menuitem",onClick:()=>Z(M),children:[f.jsx(ze,{name:"file",size:18})," ",x("attach-file")]}),f.jsxs("button",{role:"menuitem",onClick:()=>Z(N),children:[f.jsx(ze,{name:"camera",size:18})," ",x("attach-camera")]}),f.jsxs("button",{role:"menuitem",onClick:()=>Z(j),children:[f.jsx(ze,{name:"image",size:18})," ",x("attach-gallery")]})]}),f.jsx("input",{ref:M,type:"file",multiple:!0,hidden:!0,onChange:X=>{L(Array.from(X.target.files||[])),X.target.value=""}}),f.jsx("input",{ref:N,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:X=>{L(Array.from(X.target.files||[])),X.target.value=""}}),f.jsx("input",{ref:j,type:"file",accept:"image/*,video/*",multiple:!0,hidden:!0,onChange:X=>{L(Array.from(X.target.files||[])),X.target.value=""}}),f.jsx("textarea",{rows:2,value:a,placeholder:x("composer-placeholder"),onChange:X=>h(X.target.value)}),H&&f.jsx("button",{className:d?"mic on":"mic",onClick:d?D:te,title:x("voice"),children:f.jsx(ze,{name:"mic",size:22})}),f.jsx("button",{className:"go",onClick:O,title:x("send"),children:f.jsx(ze,{name:"enter",size:22})})]})]})}function Wh(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function hm(e){return String(e||"?").replace(/^[^a-zA-Z0-9]+/,"").charAt(0).toUpperCase()||"?"}const E1=180,N1=480;function um(e){return e.status==="down"?e.downSince?x("tunnel-down-since").replace("{t}",Wh(e.downSince)):x("tunnel-down"):e.status==="unreachable"?x("node-unreachable"):""}function R1({sessions:e=[],cells:t=[],activeSessions:r=[],nodeGroups:n=[],onPick:l,onAddTile:a,onPower:h,onKill:d,onNew:_,onSettings:p,width:g=240,collapsed:y=!1,onResize:w,onToggleCollapse:v}){const[C,b]=Wt(),[E,W]=z.useState(l_),B=L=>W(D=>a_(D,L)),$=new Set((t||[]).map(L=>L.tmuxSession)),P=new Map((e||[]).map(L=>[L.name,L])),J=(L,D)=>mn(E,L,D),A=ih,M=[...t||[]].sort((L,D)=>A(J(L.tmuxSession,(P.get(L.tmuxSession)||{}).activity),J(D.tmuxSession,(P.get(D.tmuxSession)||{}).activity))),N=(e||[]).filter(L=>!$.has(L.name)).sort((L,D)=>A(J(L.name,L.activity),J(D.name,D.activity))||L.name.localeCompare(D.name)),j=new Set(r||[]),[I,U]=z.useState(null),H=(L,D)=>{const te=L.currentTarget.getBoundingClientRect();U({text:D,y:te.top+te.height/2})},O=()=>U(null),K=z.useRef(null);z.useEffect(()=>()=>{K.current&&K.current()},[]);function ee(L){L.preventDefault(),L.stopPropagation();const D=L.clientX,te=g,X=Q=>{const ce=Math.max(E1,Math.min(N1,te+(Q.clientX-D)));w&&w(ce)},R=()=>{window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",R),window.removeEventListener("pointercancel",R),window.removeEventListener("blur",R),K.current=null};window.addEventListener("pointermove",X),window.addEventListener("pointerup",R),window.addEventListener("pointercancel",R),window.addEventListener("blur",R),K.current=R}const Z=y?{width:48,flex:"0 0 48px"}:{width:g,flex:`0 0 ${g}px`};return y?f.jsxs("aside",{className:"nc-sidebar mini",style:Z,children:[f.jsx("div",{className:"nc-side-head mini",children:f.jsx("button",{className:"nc-collapse-btn",onClick:v,title:x("expand"),children:"⟩"})}),f.jsxs("div",{className:"nc-side-group mini",children:[M.map(L=>{const D=L.degraded?"warn":L.tmux?"on":"",te=!!L.tmux;return f.jsx("button",{type:"button",className:`nc-mini-dot${j.has(L.tmuxSession)?" active":""}`,onMouseEnter:X=>H(X,L.cell),onMouseLeave:O,draggable:te,onDragStart:te?X=>X.dataTransfer.setData("text/nc-session",L.tmuxSession):void 0,onClick:te?()=>a&&a(L.tmuxSession):()=>h&&h(L),onDoubleClick:te?()=>l&&l(L.tmuxSession):void 0,children:f.jsx("span",{className:`nc-dot ${D}`})},L.cell)}),N.map(L=>f.jsx("button",{type:"button",className:`nc-mini-init${j.has(L.name)?" active":""}`,onMouseEnter:D=>H(D,L.name),onMouseLeave:O,draggable:!0,onDragStart:D=>D.dataTransfer.setData("text/nc-session",L.name),onClick:()=>a&&a(L.name),onDoubleClick:()=>l&&l(L.name),children:hm(L.name)},L.name)),(n||[]).flatMap(L=>L.status==="up"?L.sessions.map(D=>f.jsx("button",{type:"button",className:`nc-mini-init${j.has(D.key)?" active":""}`,onMouseEnter:te=>H(te,D.key),onMouseLeave:O,draggable:!0,onDragStart:te=>te.dataTransfer.setData("text/nc-session",D.key),onClick:()=>a&&a(D.key),onDoubleClick:()=>l&&l({session:D.name,node:D.node}),children:hm(D.name)},D.key)):[f.jsx("button",{type:"button",className:"nc-mini-dot",onMouseEnter:D=>H(D,`${L.label||(L.route||[L.name]).join(" › ")}: ${um(L)}`),onMouseLeave:O,children:f.jsx("span",{className:"nc-dot warn"})},`nodo-${(L.route||[L.name]).join("/")}`)])]}),f.jsx("button",{className:"nc-side-gear mini",onClick:p,title:x("settings"),onMouseEnter:L=>H(L,x("settings")),onMouseLeave:O,children:f.jsx(ze,{name:"gear",size:16})}),I&&f.jsx("div",{className:"nc-mini-tip",style:{top:I.y},children:I.text})]}):f.jsxs("aside",{className:"nc-sidebar",style:Z,children:[f.jsxs("div",{className:"nc-side-head",children:[f.jsx("button",{className:"nc-collapse-btn",onClick:v,title:x("collapse"),children:"⟨"}),f.jsx("span",{className:"nc-side-title",children:x("fleet")}),f.jsxs("button",{className:"nc-new-btn",onClick:_,title:x("new-session"),children:["+ ",x("new")]})]}),(t||[]).length>0&&f.jsx("div",{className:"nc-side-group",children:M.map(L=>{const D=L.degraded?"warn":L.tmux?"on":"",te=L.degraded?x("cell-degraded"):L.tmux?x("cell-on"):x("cell-off"),X=!!L.tmux;return f.jsxs("div",{className:`nc-cell${X?" live":""}${j.has(L.tmuxSession)?" active":""}`,title:te,draggable:X,onDragStart:X?R=>R.dataTransfer.setData("text/nc-session",L.tmuxSession):void 0,onClick:X?()=>a&&a(L.tmuxSession):void 0,onDoubleClick:X?()=>l&&l(L.tmuxSession):void 0,children:[f.jsx("span",{className:`nc-dot ${D}`}),f.jsxs("span",{className:"nc-cell-main",children:[f.jsx("b",{children:L.cell}),f.jsxs("small",{children:[L.engine,L.key?`·${L.key}`:""]})]}),f.jsx("button",{className:`nc-pin${E.includes(L.tmuxSession)?" on":""}`,title:x("pin"),onClick:R=>{R.stopPropagation(),B(L.tmuxSession)},children:E.includes(L.tmuxSession)?"★":"☆"}),f.jsx("button",{className:`nc-power${L.tmux?" on":""}${L.degraded?" warn":""}`,onClick:R=>{R.stopPropagation(),h&&h(L)},title:L.active?x("power-off"):x("power-on"),children:f.jsx(ze,{name:"power",size:14})})]},L.cell)})}),f.jsxs("button",{className:"nc-side-gear",onClick:p,title:x("settings"),children:[f.jsx(ze,{name:"gear",size:15})," ",x("settings")]}),f.jsx("div",{className:"nc-side-group-title",children:x("other-sessions")}),f.jsxs("div",{className:"nc-side-group",children:[N.map(L=>f.jsxs("div",{className:`nc-side-card${j.has(L.name)?" active":""}`,draggable:!0,onDragStart:D=>D.dataTransfer.setData("text/nc-session",L.name),onClick:()=>a&&a(L.name),onDoubleClick:()=>l&&l(L.name),children:[f.jsx("span",{className:L.attached?"nc-dot on":"nc-dot"}),f.jsxs("span",{className:"nc-card-main",children:[f.jsx("b",{children:L.name}),f.jsxs("small",{children:[L.preview?L.preview:L.cmd?L.cmd:x("windows").replace("{n}",String(L.windows||0)),L.outbox&&L.outbox.count>0?` · 📦${L.outbox.count}`:""]})]}),L.activity?f.jsx("span",{className:"nc-rel",children:Wh(L.activity)}):null,f.jsx("button",{className:`nc-pin${E.includes(L.name)?" on":""}`,title:x("pin"),onClick:D=>{D.stopPropagation(),B(L.name)},children:E.includes(L.name)?"★":"☆"}),f.jsx("button",{className:"nc-menu",title:x("terminate"),onClick:D=>{D.stopPropagation(),window.confirm(x("terminate-confirm").replace("{name}",L.name))&&d&&d(L.name)},children:"⋯"})]},L.name)),N.length===0&&f.jsx("div",{className:"nc-empty",children:x("no-sessions-short")})]}),(n||[]).map(L=>f.jsxs("div",{children:[f.jsxs("div",{className:"nc-side-group-title nc-node-title",children:[f.jsx("span",{className:`nc-dot ${L.status==="up"?"on":"warn"}`}),f.jsx("b",{children:L.label||L.name}),f.jsxs("small",{children:[" · ",L.status==="up"?x("node-sessions").replace("{n}",String(L.sessions.length)):um(L)]})]}),L.status==="up"&&f.jsxs("div",{className:"nc-side-group",children:[L.sessions.map(D=>f.jsxs("div",{className:`nc-side-card${j.has(D.key)?" active":""}`,draggable:!0,onDragStart:te=>te.dataTransfer.setData("text/nc-session",D.key),onClick:()=>a&&a(D.key),onDoubleClick:()=>l&&l({session:D.name,node:D.node}),children:[f.jsx("span",{className:D.attached?"nc-dot on":"nc-dot"}),f.jsxs("span",{className:"nc-card-main",children:[f.jsx("b",{children:D.name}),f.jsx("small",{children:D.preview?D.preview:D.cmd?D.cmd:x("windows").replace("{n}",String(D.windows||0))})]}),D.activity?f.jsx("span",{className:"nc-rel",children:Wh(D.activity)}):null,f.jsx("button",{className:"nc-menu",title:x("terminate"),onClick:te=>{te.stopPropagation(),window.confirm(x("terminate-confirm").replace("{name}",D.name))&&d&&d(D.name,L.route)},children:"⋯"})]},D.key)),L.sessions.length===0&&f.jsx("div",{className:"nc-empty",children:x("no-sessions-short")})]})]},`nodo-${(L.route||[L.name]).join("/")}`)),f.jsx("div",{className:"nc-side-lang",children:u_.map((L,D)=>f.jsxs("span",{children:[D>0&&" · ",f.jsx("button",{className:`nc-lang-btn${C===L?" on":""}`,onClick:()=>b(L),title:L,children:L.toUpperCase()})]},L))}),f.jsx("div",{className:"nc-side-resize",onPointerDown:ee,title:""})]})}const cu=9,dl=.2,M1=/^[a-z0-9-]{1,32}(?:\/[a-z0-9-]{1,32}){0,3}$/,$h=e=>M1.test(e)&&new Set(e.split("/")).size===e.split("/").length;function fl(e){if(typeof e=="string"&&e){const t=e.indexOf(":");if(t<0)return{session:e};const r=e.slice(0,t),n=e.slice(t+1);return!$h(r)||!n?null:{session:n,node:r}}return e&&typeof e=="object"&&typeof e.session=="string"&&e.session?e.node===void 0||e.node===null||e.node===""?{session:e.session}:typeof e.node=="string"&&$h(e.node)?{session:e.session,node:e.node}:null:null}function Ni(e){const t=fl(e);return t?t.node?`${t.node}:${t.session}`:t.session:""}const ag=9,cg=24,Cl=11,D1=e=>{const t=Number(e);return t>=ag&&t<=cg?t:Cl};function pl(){return{columns:[]}}function Fi(e){return e.columns.flatMap(t=>t.tiles.map(r=>Ni(r)))}const Dn=e=>({columns:e.columns.map(t=>({width:t.width,tiles:t.tiles.map(r=>({...r}))}))});function ml(e,t,r,n){const l=fl(t);if(!l||Fi(e).includes(Ni(l))||Fi(e).length>=cu)return e;const a=Dn(e),h={session:l.session,height:1,fontSize:Cl,...n||{}};if(l.node&&(h.node=l.node),r==="end")return a.columns.push({width:1,tiles:[h]}),a;if(r&&typeof r.col=="number"&&typeof r.row=="number"&&a.columns[r.col])return a.columns[r.col].tiles.splice(r.row,0,h),a;if(r&&typeof r.col=="number"){const d=Math.max(0,Math.min(a.columns.length,r.col));return a.columns.splice(d,0,{width:1,tiles:[h]}),a}return a.columns.push({width:1,tiles:[h]}),a}function hg(e,t){const r=Ni(t);if(!r||Fi(e).includes(r)||Fi(e).length>=cu)return e;const n=Fi(e).length+1,l=Math.ceil(Math.sqrt(n));if(e.columns.length<l)return ml(e,t,"end");let a=0;for(let h=1;h<e.columns.length;h+=1)e.columns[h].tiles.length<e.columns[a].tiles.length&&(a=h);return ml(e,t,{col:a,row:e.columns[a].tiles.length})}function _l(e,t){const r=Ni(t),n=Dn(e);for(const l of n.columns)l.tiles=l.tiles.filter(a=>Ni(a)!==r);return n.columns=n.columns.filter(l=>l.tiles.length>0),n}function P1(e,t,r){const n=Ni(t);if(!Fi(e).includes(n))return e;const l=e.columns.flatMap(a=>a.tiles).find(a=>Ni(a)===n);return ml(_l(e,n),n,r,{fontSize:l.fontSize})}function L1(e,t,r){const n=Dn(e);return n.columns[t]&&(n.columns[t].width=Math.max(dl,Number(r)||1)),n}function T1(e,t,r,n){const l=Dn(e),a=l.columns[t]&&l.columns[t].tiles[r];return a&&(a.height=Math.max(dl,Number(n)||1)),l}function B1(e,t,r,n){if(!(e.columns[t]&&e.columns[t].tiles[r]))return e;const a=Dn(e),h=a.columns[t].tiles[r],d=Number(h.fontSize)||Cl;return h.fontSize=Math.max(ag,Math.min(cg,d+(Number(n)||0))),a}function A1(e,t,r,n){const l=e.columns[t];if(!l||!l.tiles[r])return null;switch(n){case"left":return{col:t};case"right":return{col:t+1};case"top":return{col:t,row:r};case"bottom":return{col:t,row:r+1};default:return null}}function dm(e){for(const t of[.25,.5,.75])if(Math.abs(e-t)<=.03)return t;return e}function Tr(e){if(!e||!Array.isArray(e.columns))return pl();const t=e.columns.map(n=>({width:Math.max(dl,Number(n&&n.width)||1),tiles:(Array.isArray(n&&n.tiles)?n.tiles:[]).filter(l=>l&&typeof l.session=="string"&&l.session).filter(l=>l.node==null||typeof l.node=="string"&&$h(l.node)).map(l=>{const a={session:l.session,height:Math.max(dl,Number(l.height)||1),fontSize:D1(l.fontSize)};return l.node!=null&&(a.node=l.node),a})})).filter(n=>n.tiles.length>0),r=new Set;for(const n of t)n.tiles=n.tiles.filter(l=>!r.has(Ni(l))&&r.add(Ni(l))&&r.size<=cu);return{columns:t.filter(n=>n.tiles.length>0)}}function j1({session:e,node:t,token:r,readonly:n=!1,focused:l,onFocus:a,onClose:h,onOpenSingle:d,alive:_=!0,fontSize:p=Cl,onZoom:g,decks:y=[],currentDeck:w,onSendToDeck:v}){const C=z.useRef(()=>{}),b=z.useRef(()=>{}),E=z.useRef(!1),[W,B]=z.useState(!1),[$,P]=z.useState(!1),[J,A]=z.useState(!1),[M,N]=z.useState(null),j=t?`${t}:${e}`:e;return f.jsxs("div",{className:`nc-tile${l?" focused":""}`,onMouseDown:()=>a&&a(j),children:[f.jsxs("div",{className:"nc-tile-head",draggable:!0,onDragStart:I=>{I.dataTransfer.setData("text/nc-session",j),I.dataTransfer.effectAllowed="move"},children:[f.jsxs("button",{className:"nc-tile-name",onClick:()=>a&&a(j),children:[f.jsx("span",{className:_?"nc-dot on":"nc-dot"}),f.jsx("b",{children:e}),t&&f.jsxs("small",{className:"nc-tile-node",children:["@",t]})]}),f.jsxs("span",{className:"nc-tile-actions",children:[g&&f.jsx("button",{onClick:()=>g(-1),title:x("zoom-out"),children:f.jsx(ze,{name:"zoomOut",size:14})}),g&&f.jsx("button",{onClick:()=>g(1),title:x("zoom-in"),children:f.jsx(ze,{name:"zoomIn",size:14})}),v&&y.filter(I=>I!==w).length>0&&f.jsxs("select",{className:"nc-tile-deck",title:x("send-to-deck"),value:"",onMouseDown:I=>I.stopPropagation(),onChange:I=>{const U=I.target.value;U&&v(j,U),I.target.value=""},children:[f.jsx("option",{value:"",children:x("send-to-deck")}),y.filter(I=>I!==w).map(I=>f.jsx("option",{value:I,children:I},I))]}),f.jsx("button",{onClick:()=>P(I=>!I),title:"composer",children:"⌨"}),f.jsx("button",{onClick:()=>A(I=>!I),title:"file",children:"📁"}),d&&f.jsx("button",{onClick:()=>d({session:e,node:t}),title:"vista singola",children:"↗"}),h&&f.jsx("button",{className:"nc-tile-close",onClick:()=>h(j),title:"chiudi",children:"✕"})]})]}),f.jsxs("div",{className:"nc-tile-body",children:[f.jsx(ng,{session:e,node:t,token:r,readonly:n,takeSize:!1,focused:l,sendRef:C,actionRef:b,ctrlRef:E,setCtrlArmed:B,onFiles:N,fontSize:p}),J&&f.jsx("div",{className:"nc-tile-files",onMouseDown:I=>I.stopPropagation(),children:f.jsx(og,{session:e,node:t,token:r,filesEvent:M,onClose:()=>A(!1)})})]}),$&&f.jsx("div",{className:"nc-tile-composer",onMouseDown:I=>I.stopPropagation(),children:f.jsx(lg,{send:I=>C.current(I),token:r,session:e,node:t})})]})}const fm=.2,pm=.28;function O1(e,t,r){const n=(e-r.left)/(r.width||1),l=(t-r.top)/(r.height||1);return n<pm?"left":n>1-pm?"right":l<.5?"top":"bottom"}function I1({layout:e,onLayoutChange:t,token:r,readonly:n=!1,sessionsAlive:l,focusSession:a,onFocus:h,onOpenSingle:d,decks:_=[],currentDeck:p,onSendToDeck:g}){Wt();const[y,w]=z.useState(null),v=z.useRef(null),C=z.useRef([]),b=z.useRef(null);function E(j,I){const U=()=>{window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",U),window.removeEventListener("pointercancel",U),window.removeEventListener("blur",U),b.current=null};window.addEventListener("pointermove",j),window.addEventListener("pointerup",U),window.addEventListener("pointercancel",U),window.addEventListener("blur",U),b.current=U}z.useEffect(()=>()=>{b.current&&b.current()},[]),z.useEffect(()=>{const j=()=>w(null);return window.addEventListener("dragend",j),window.addEventListener("drop",j),()=>{window.removeEventListener("dragend",j),window.removeEventListener("drop",j)}},[]);const W=e.columns.length,B=j=>y&&y.col===j&&y.row===void 0,$=!!y&&y.col===W,P=(j,I)=>y&&y.col===j&&y.row===I&&y.quadrant?` drop-${y.quadrant}`:"";function J(j){j.preventDefault();const I=j.dataTransfer.getData("text/nc-session"),U=y;if(w(null),!I||!U)return;let H;if(U.quadrant){if(H=A1(e,U.col,U.row,U.quadrant),!H)return}else H={col:U.col};t(Fi(e).includes(I)?P1(e,I,H):ml(e,I,H))}function A(j,I){j.preventDefault(),j.stopPropagation();const U=j.clientX,H=e.columns[I].width,O=v.current&&v.current.clientWidth||1,K=e.columns[I+1];E(Z=>{let L=Math.max(fm,H+(Z.clientX-U)/O);if(K){const D=dm(L/(L+K.width));L=D/(1-D)*K.width}t(L1(e,I,L))})}function M(j,I,U){j.preventDefault(),j.stopPropagation();const H=j.clientY,O=e.columns[I].tiles[U].height,K=C.current[I],ee=K&&K.clientHeight||1,Z=e.columns[I].tiles[U+1];E(D=>{let te=Math.max(fm,O+(D.clientY-H)/ee);if(Z){const X=dm(te/(te+Z.height));te=X/(1-X)*Z.height}t(T1(e,I,U,te))})}function N(j){t(_l(e,j))}return f.jsxs("div",{className:"nc-grid",ref:v,onDragOver:j=>{j.preventDefault(),y&&y.col===W||w({col:W})},onDrop:J,onDragLeave:j=>{const I=j.relatedTarget;(!I||!(v.current&&v.current.contains(I)))&&w(null)},children:[e.columns.flatMap((j,I)=>{const U=[];return U.push(f.jsx("div",{className:`nc-col${B(I)?" drop-newcol":""}`,ref:H=>{C.current[I]=H},style:{flexGrow:j.width,flexBasis:0},onDragOver:H=>{H.preventDefault(),H.stopPropagation(),y&&y.col===I&&y.row===void 0||w({col:I})},children:j.tiles.flatMap((H,O)=>{const K=[],ee=Ni(H);return K.push(f.jsx("div",{className:`nc-tile-slot${P(I,O)}`,style:{flexGrow:H.height,flexBasis:0},onDragOver:Z=>{Z.preventDefault(),Z.stopPropagation();const L=O1(Z.clientX,Z.clientY,Z.currentTarget.getBoundingClientRect());y&&y.col===I&&y.row===O&&y.quadrant===L||w({col:I,row:O,quadrant:L})},children:f.jsx(j1,{session:H.session,node:H.node,token:r,readonly:n,focused:a===ee,onFocus:h,onClose:N,onOpenSingle:d,alive:!l||l.has(ee),fontSize:H.fontSize,onZoom:Z=>t(B1(e,I,O,Z)),decks:_,currentDeck:p,onSendToDeck:g})},ee)),O<j.tiles.length-1&&K.push(f.jsx("div",{className:"nc-divider-h",onPointerDown:Z=>M(Z,I,O)},`h${O}`)),K})},`c${I}`)),I<W-1&&U.push(f.jsx("div",{className:"nc-divider-v",onPointerDown:H=>A(H,I)},`v${I}`)),U}),$&&f.jsx("div",{className:"nc-drop-line-v nc-drop-line-end"}),W===0&&f.jsx("div",{className:"nc-grid-empty",children:x("grid-empty")})]})}const z1=/^[a-z0-9-]{1,32}$/,Xt="main",ug="nc_decks",F1=24;function H1(e){return typeof e!="string"?"":e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").slice(0,32).replace(/-+$/,"")}function hu(e){return typeof e=="string"&&z1.test(e)}function W1(e){const t=String(e||"").match(/^\/deck\/([^/]+)\/?$/);if(t){let r;try{r=decodeURIComponent(t[1])}catch{r=t[1]}return hu(r)?r:Xt}return Xt}function Go(e,t){const r=e===Xt?"/":`/deck/${encodeURIComponent(e)}`;return t?`${r}#token=${encodeURIComponent(t)}`:r}function dg(e){return e===Xt?"nc_grid_v1":`nc_grid_v1__${e}`}function fg(e){const t=[Xt];if(Array.isArray(e)){for(const r of e)if(hu(r)&&r!==Xt&&!t.includes(r)&&t.push(r),t.length>=F1)break}return t}function bl(){return typeof localStorage<"u"?localStorage:null}function $1(){const e=bl();if(!e)return[Xt];try{return fg(JSON.parse(e.getItem(ug)||"null"))}catch{return[Xt]}}function U1(e){const t=bl();if(t)try{t.setItem(ug,JSON.stringify(fg(e)))}catch{}}function Uh(e){const t=bl();if(!t)return null;try{return JSON.parse(t.getItem(dg(e))||"null")}catch{return null}}function K1(e,t){const r=bl();if(r)try{r.setItem(dg(e),JSON.stringify(t))}catch{}}function V1({decks:e=[],currentDeck:t=Xt,onCreate:r,onRename:n,onDelete:l,onOpenWindow:a,onNavigate:h,saveState:d="idle",error:_=""}){Wt();const[p,g]=z.useState(!1),[y,w]=z.useState(""),[v,C]=z.useState(!1),[b,E]=z.useState(""),[W,B]=z.useState(""),$=H1(y),P=hu($),J=async()=>{if(P){C(!0),E("");try{r&&await r($),w(""),g(!1)}catch(M){E(String(M.message||M))}C(!1)}},A=M=>{B(""),a&&a(M)||B(M)};return f.jsxs("div",{className:"nc-deckbar",children:[f.jsx("span",{className:"nc-deckbar-label",children:x("decks")}),f.jsx("div",{className:"nc-deck-chips",children:e.map(M=>f.jsxs("span",{className:`nc-deck-chip${M===t?" current":""}`,children:[f.jsxs("button",{className:"nc-deck-open",title:M===t?x("deck-current"):M,onClick:()=>M!==t&&h&&h(M),children:[M,M===t?" •":""]}),f.jsx("button",{className:"nc-deck-mini",title:x("open-deck-window"),onClick:()=>A(M),children:"↗"}),M!==Xt&&f.jsxs(f.Fragment,{children:[f.jsx("button",{className:"nc-deck-mini",title:x("rename-deck"),onClick:()=>{const j=((typeof window<"u"?window.prompt(x("rename-deck"),M):"")||"").trim();j&&j!==M&&n&&n(M,j).catch(I=>E(String(I.message||I)))},children:"✎"}),f.jsx("button",{className:"nc-deck-mini nc-deck-del",title:x("delete-deck"),onClick:()=>{(typeof window>"u"||window.confirm(x("delete-deck-confirm").replace("{name}",M)))&&l&&l(M).catch(N=>E(String(N.message||N)))},children:"✕"})]})]},M))}),p?f.jsxs("span",{className:"nc-deck-add",children:[f.jsx("input",{autoFocus:!0,className:P||!y?"":"invalid",placeholder:x("deck-name"),value:y,onChange:M=>w(M.target.value),onKeyDown:M=>{M.key==="Enter"&&J(),M.key==="Escape"&&(w(""),g(!1))}}),y&&P&&$!==y&&f.jsxs("span",{className:"nc-deck-slug",children:["→ ",$]}),f.jsx("button",{className:"nc-deck-ok",disabled:!P||v,onClick:J,children:x("create")}),f.jsx("button",{className:"nc-deck-cancel",onClick:()=>{w(""),g(!1)},children:x("cancel")})]}):f.jsxs("button",{className:"nc-deck-newbtn",title:x("new-deck"),onClick:()=>g(!0),children:["+ ",x("new-deck")]}),f.jsx("span",{className:`nc-deck-state ${d}`,title:x("deck-autosave"),children:x(d==="saving"?"saving":d==="saved"?"saved":"deck-autosave")}),(b||_)&&f.jsx("span",{className:"nc-deck-error",children:b||_}),W&&f.jsx("a",{className:"nc-deck-fallback",href:`/deck/${encodeURIComponent(W)}`,target:"_blank",rel:"noreferrer",children:x("popup-blocked")})]})}var fs={},Lc,mm;function q1(){return mm||(mm=1,Lc=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Lc}var Tc={},dr={},_m;function zr(){if(_m)return dr;_m=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return dr.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17},dr.getSymbolTotalCodewords=function(n){return t[n]},dr.getBCHDigit=function(r){let n=0;for(;r!==0;)n++,r>>>=1;return n},dr.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');e=n},dr.isKanjiModeEnabled=function(){return typeof e<"u"},dr.toSJIS=function(n){return e(n)},dr}var Bc={},gm;function uu(){return gm||(gm=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+r)}}e.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},e.from=function(n,l){if(e.isValid(n))return n;try{return t(n)}catch{return l}}})(Bc)),Bc}var Ac,vm;function Y1(){if(vm)return Ac;vm=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const r=Math.floor(t/8);return(this.buffer[r]>>>7-t%8&1)===1},put:function(t,r){for(let n=0;n<r;n++)this.putBit((t>>>r-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),t&&(this.buffer[r]|=128>>>this.length%8),this.length++}},Ac=e,Ac}var jc,ym;function X1(){if(ym)return jc;ym=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,r,n,l){const a=t*this.size+r;this.data[a]=n,l&&(this.reservedBit[a]=!0)},e.prototype.get=function(t,r){return this.data[t*this.size+r]},e.prototype.xor=function(t,r,n){this.data[t*this.size+r]^=n},e.prototype.isReserved=function(t,r){return this.reservedBit[t*this.size+r]},jc=e,jc}var Oc={},Sm;function G1(){return Sm||(Sm=1,(function(e){const t=zr().getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const l=Math.floor(n/7)+2,a=t(n),h=a===145?26:Math.ceil((a-13)/(2*l-2))*2,d=[a-7];for(let _=1;_<l-1;_++)d[_]=d[_-1]-h;return d.push(6),d.reverse()},e.getPositions=function(n){const l=[],a=e.getRowColCoords(n),h=a.length;for(let d=0;d<h;d++)for(let _=0;_<h;_++)d===0&&_===0||d===0&&_===h-1||d===h-1&&_===0||l.push([a[d],a[_]]);return l}})(Oc)),Oc}var Ic={},wm;function Q1(){if(wm)return Ic;wm=1;const e=zr().getSymbolSize,t=7;return Ic.getPositions=function(n){const l=e(n);return[[0,0],[l-t,0],[0,l-t]]},Ic}var zc={},Cm;function J1(){return Cm||(Cm=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(l){return l!=null&&l!==""&&!isNaN(l)&&l>=0&&l<=7},e.from=function(l){return e.isValid(l)?parseInt(l,10):void 0},e.getPenaltyN1=function(l){const a=l.size;let h=0,d=0,_=0,p=null,g=null;for(let y=0;y<a;y++){d=_=0,p=g=null;for(let w=0;w<a;w++){let v=l.get(y,w);v===p?d++:(d>=5&&(h+=t.N1+(d-5)),p=v,d=1),v=l.get(w,y),v===g?_++:(_>=5&&(h+=t.N1+(_-5)),g=v,_=1)}d>=5&&(h+=t.N1+(d-5)),_>=5&&(h+=t.N1+(_-5))}return h},e.getPenaltyN2=function(l){const a=l.size;let h=0;for(let d=0;d<a-1;d++)for(let _=0;_<a-1;_++){const p=l.get(d,_)+l.get(d,_+1)+l.get(d+1,_)+l.get(d+1,_+1);(p===4||p===0)&&h++}return h*t.N2},e.getPenaltyN3=function(l){const a=l.size;let h=0,d=0,_=0;for(let p=0;p<a;p++){d=_=0;for(let g=0;g<a;g++)d=d<<1&2047|l.get(p,g),g>=10&&(d===1488||d===93)&&h++,_=_<<1&2047|l.get(g,p),g>=10&&(_===1488||_===93)&&h++}return h*t.N3},e.getPenaltyN4=function(l){let a=0;const h=l.data.length;for(let _=0;_<h;_++)a+=l.data[_];return Math.abs(Math.ceil(a*100/h/5)-10)*t.N4};function r(n,l,a){switch(n){case e.Patterns.PATTERN000:return(l+a)%2===0;case e.Patterns.PATTERN001:return l%2===0;case e.Patterns.PATTERN010:return a%3===0;case e.Patterns.PATTERN011:return(l+a)%3===0;case e.Patterns.PATTERN100:return(Math.floor(l/2)+Math.floor(a/3))%2===0;case e.Patterns.PATTERN101:return l*a%2+l*a%3===0;case e.Patterns.PATTERN110:return(l*a%2+l*a%3)%2===0;case e.Patterns.PATTERN111:return(l*a%3+(l+a)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}e.applyMask=function(l,a){const h=a.size;for(let d=0;d<h;d++)for(let _=0;_<h;_++)a.isReserved(_,d)||a.xor(_,d,r(l,_,d))},e.getBestMask=function(l,a){const h=Object.keys(e.Patterns).length;let d=0,_=1/0;for(let p=0;p<h;p++){a(p),e.applyMask(p,l);const g=e.getPenaltyN1(l)+e.getPenaltyN2(l)+e.getPenaltyN3(l)+e.getPenaltyN4(l);e.applyMask(p,l),g<_&&(_=g,d=p)}return d}})(zc)),zc}var Qo={},bm;function pg(){if(bm)return Qo;bm=1;const e=uu(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Qo.getBlocksCount=function(l,a){switch(a){case e.L:return t[(l-1)*4+0];case e.M:return t[(l-1)*4+1];case e.Q:return t[(l-1)*4+2];case e.H:return t[(l-1)*4+3];default:return}},Qo.getTotalCodewordsCount=function(l,a){switch(a){case e.L:return r[(l-1)*4+0];case e.M:return r[(l-1)*4+1];case e.Q:return r[(l-1)*4+2];case e.H:return r[(l-1)*4+3];default:return}},Qo}var Fc={},pn={},xm;function Z1(){if(xm)return pn;xm=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let n=1;for(let l=0;l<255;l++)e[l]=n,t[n]=l,n<<=1,n&256&&(n^=285);for(let l=255;l<512;l++)e[l]=e[l-255]})(),pn.log=function(n){if(n<1)throw new Error("log("+n+")");return t[n]},pn.exp=function(n){return e[n]},pn.mul=function(n,l){return n===0||l===0?0:e[t[n]+t[l]]},pn}var km;function eC(){return km||(km=1,(function(e){const t=Z1();e.mul=function(n,l){const a=new Uint8Array(n.length+l.length-1);for(let h=0;h<n.length;h++)for(let d=0;d<l.length;d++)a[h+d]^=t.mul(n[h],l[d]);return a},e.mod=function(n,l){let a=new Uint8Array(n);for(;a.length-l.length>=0;){const h=a[0];for(let _=0;_<l.length;_++)a[_]^=t.mul(l[_],h);let d=0;for(;d<a.length&&a[d]===0;)d++;a=a.slice(d)}return a},e.generateECPolynomial=function(n){let l=new Uint8Array([1]);for(let a=0;a<n;a++)l=e.mul(l,new Uint8Array([1,t.exp(a)]));return l}})(Fc)),Fc}var Hc,Em;function tC(){if(Em)return Hc;Em=1;const e=eC();function t(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(n){this.degree=n,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");const l=new Uint8Array(n.length+this.degree);l.set(n);const a=e.mod(l,this.genPoly),h=this.degree-a.length;if(h>0){const d=new Uint8Array(this.degree);return d.set(a,h),d}return a},Hc=t,Hc}var Wc={},$c={},Uc={},Nm;function mg(){return Nm||(Nm=1,Uc.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Uc}var Ci={},Rm;function _g(){if(Rm)return Ci;Rm=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r
|
|
82
|
+
]))+`;Ci.KANJI=new RegExp(r,"g"),Ci.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Ci.BYTE=new RegExp(n,"g"),Ci.NUMERIC=new RegExp(e,"g"),Ci.ALPHANUMERIC=new RegExp(t,"g");const l=new RegExp("^"+r+"$"),a=new RegExp("^"+e+"$"),h=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Ci.testKanji=function(_){return l.test(_)},Ci.testNumeric=function(_){return a.test(_)},Ci.testAlphanumeric=function(_){return h.test(_)},Ci}var Mm;function Fr(){return Mm||(Mm=1,(function(e){const t=mg(),r=_g();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(a,h){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!t.isValid(h))throw new Error("Invalid version: "+h);return h>=1&&h<10?a.ccBits[0]:h<27?a.ccBits[1]:a.ccBits[2]},e.getBestModeForData=function(a){return r.testNumeric(a)?e.NUMERIC:r.testAlphanumeric(a)?e.ALPHANUMERIC:r.testKanji(a)?e.KANJI:e.BYTE},e.toString=function(a){if(a&&a.id)return a.id;throw new Error("Invalid mode")},e.isValid=function(a){return a&&a.bit&&a.ccBits};function n(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+l)}}e.from=function(a,h){if(e.isValid(a))return a;try{return n(a)}catch{return h}}})($c)),$c}var Dm;function iC(){return Dm||(Dm=1,(function(e){const t=zr(),r=pg(),n=uu(),l=Fr(),a=mg(),h=7973,d=t.getBCHDigit(h);function _(w,v,C){for(let b=1;b<=40;b++)if(v<=e.getCapacity(b,C,w))return b}function p(w,v){return l.getCharCountIndicator(w,v)+4}function g(w,v){let C=0;return w.forEach(function(b){const E=p(b.mode,v);C+=E+b.getBitsLength()}),C}function y(w,v){for(let C=1;C<=40;C++)if(g(w,C)<=e.getCapacity(C,v,l.MIXED))return C}e.from=function(v,C){return a.isValid(v)?parseInt(v,10):C},e.getCapacity=function(v,C,b){if(!a.isValid(v))throw new Error("Invalid QR Code version");typeof b>"u"&&(b=l.BYTE);const E=t.getSymbolTotalCodewords(v),W=r.getTotalCodewordsCount(v,C),B=(E-W)*8;if(b===l.MIXED)return B;const $=B-p(b,v);switch(b){case l.NUMERIC:return Math.floor($/10*3);case l.ALPHANUMERIC:return Math.floor($/11*2);case l.KANJI:return Math.floor($/13);case l.BYTE:default:return Math.floor($/8)}},e.getBestVersionForData=function(v,C){let b;const E=n.from(C,n.M);if(Array.isArray(v)){if(v.length>1)return y(v,E);if(v.length===0)return 1;b=v[0]}else b=v;return _(b.mode,b.getLength(),E)},e.getEncodedBits=function(v){if(!a.isValid(v)||v<7)throw new Error("Invalid QR Code version");let C=v<<12;for(;t.getBCHDigit(C)-d>=0;)C^=h<<t.getBCHDigit(C)-d;return v<<12|C}})(Wc)),Wc}var Kc={},Pm;function rC(){if(Pm)return Kc;Pm=1;const e=zr(),t=1335,r=21522,n=e.getBCHDigit(t);return Kc.getEncodedBits=function(a,h){const d=a.bit<<3|h;let _=d<<10;for(;e.getBCHDigit(_)-n>=0;)_^=t<<e.getBCHDigit(_)-n;return(d<<10|_)^r},Kc}var Vc={},qc,Lm;function sC(){if(Lm)return qc;Lm=1;const e=Fr();function t(r){this.mode=e.NUMERIC,this.data=r.toString()}return t.getBitsLength=function(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){let l,a,h;for(l=0;l+3<=this.data.length;l+=3)a=this.data.substr(l,3),h=parseInt(a,10),n.put(h,10);const d=this.data.length-l;d>0&&(a=this.data.substr(l),h=parseInt(a,10),n.put(h,d*3+1))},qc=t,qc}var Yc,Tm;function nC(){if(Tm)return Yc;Tm=1;const e=Fr(),t=["0","1","2","3","4","5","6","7","8","9","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"," ","$","%","*","+","-",".","/",":"];function r(n){this.mode=e.ALPHANUMERIC,this.data=n}return r.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(l){let a;for(a=0;a+2<=this.data.length;a+=2){let h=t.indexOf(this.data[a])*45;h+=t.indexOf(this.data[a+1]),l.put(h,11)}this.data.length%2&&l.put(t.indexOf(this.data[a]),6)},Yc=r,Yc}var Xc,Bm;function oC(){if(Bm)return Xc;Bm=1;const e=Fr();function t(r){this.mode=e.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return t.getBitsLength=function(n){return n*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){for(let n=0,l=this.data.length;n<l;n++)r.put(this.data[n],8)},Xc=t,Xc}var Gc,Am;function lC(){if(Am)return Gc;Am=1;const e=Fr(),t=zr();function r(n){this.mode=e.KANJI,this.data=n}return r.getBitsLength=function(l){return l*13},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(n){let l;for(l=0;l<this.data.length;l++){let a=t.toSJIS(this.data[l]);if(a>=33088&&a<=40956)a-=33088;else if(a>=57408&&a<=60351)a-=49472;else throw new Error("Invalid SJIS character: "+this.data[l]+`
|
|
83
|
+
Make sure your charset is UTF-8`);a=(a>>>8&255)*192+(a&255),n.put(a,13)}},Gc=r,Gc}var Qc={exports:{}},jm;function aC(){return jm||(jm=1,(function(e){var t={single_source_shortest_paths:function(r,n,l){var a={},h={};h[n]=0;var d=t.PriorityQueue.make();d.push(n,0);for(var _,p,g,y,w,v,C,b,E;!d.empty();){_=d.pop(),p=_.value,y=_.cost,w=r[p]||{};for(g in w)w.hasOwnProperty(g)&&(v=w[g],C=y+v,b=h[g],E=typeof h[g]>"u",(E||b>C)&&(h[g]=C,d.push(g,C),a[g]=p))}if(typeof l<"u"&&typeof h[l]>"u"){var W=["Could not find a path from ",n," to ",l,"."].join("");throw new Error(W)}return a},extract_shortest_path_from_predecessor_list:function(r,n){for(var l=[],a=n;a;)l.push(a),r[a],a=r[a];return l.reverse(),l},find_path:function(r,n,l){var a=t.single_source_shortest_paths(r,n,l);return t.extract_shortest_path_from_predecessor_list(a,l)},PriorityQueue:{make:function(r){var n=t.PriorityQueue,l={},a;r=r||{};for(a in n)n.hasOwnProperty(a)&&(l[a]=n[a]);return l.queue=[],l.sorter=r.sorter||n.default_sorter,l},default_sorter:function(r,n){return r.cost-n.cost},push:function(r,n){var l={value:r,cost:n};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Qc)),Qc.exports}var Om;function cC(){return Om||(Om=1,(function(e){const t=Fr(),r=sC(),n=nC(),l=oC(),a=lC(),h=_g(),d=zr(),_=aC();function p(W){return unescape(encodeURIComponent(W)).length}function g(W,B,$){const P=[];let J;for(;(J=W.exec($))!==null;)P.push({data:J[0],index:J.index,mode:B,length:J[0].length});return P}function y(W){const B=g(h.NUMERIC,t.NUMERIC,W),$=g(h.ALPHANUMERIC,t.ALPHANUMERIC,W);let P,J;return d.isKanjiModeEnabled()?(P=g(h.BYTE,t.BYTE,W),J=g(h.KANJI,t.KANJI,W)):(P=g(h.BYTE_KANJI,t.BYTE,W),J=[]),B.concat($,P,J).sort(function(M,N){return M.index-N.index}).map(function(M){return{data:M.data,mode:M.mode,length:M.length}})}function w(W,B){switch(B){case t.NUMERIC:return r.getBitsLength(W);case t.ALPHANUMERIC:return n.getBitsLength(W);case t.KANJI:return a.getBitsLength(W);case t.BYTE:return l.getBitsLength(W)}}function v(W){return W.reduce(function(B,$){const P=B.length-1>=0?B[B.length-1]:null;return P&&P.mode===$.mode?(B[B.length-1].data+=$.data,B):(B.push($),B)},[])}function C(W){const B=[];for(let $=0;$<W.length;$++){const P=W[$];switch(P.mode){case t.NUMERIC:B.push([P,{data:P.data,mode:t.ALPHANUMERIC,length:P.length},{data:P.data,mode:t.BYTE,length:P.length}]);break;case t.ALPHANUMERIC:B.push([P,{data:P.data,mode:t.BYTE,length:P.length}]);break;case t.KANJI:B.push([P,{data:P.data,mode:t.BYTE,length:p(P.data)}]);break;case t.BYTE:B.push([{data:P.data,mode:t.BYTE,length:p(P.data)}])}}return B}function b(W,B){const $={},P={start:{}};let J=["start"];for(let A=0;A<W.length;A++){const M=W[A],N=[];for(let j=0;j<M.length;j++){const I=M[j],U=""+A+j;N.push(U),$[U]={node:I,lastCount:0},P[U]={};for(let H=0;H<J.length;H++){const O=J[H];$[O]&&$[O].node.mode===I.mode?(P[O][U]=w($[O].lastCount+I.length,I.mode)-w($[O].lastCount,I.mode),$[O].lastCount+=I.length):($[O]&&($[O].lastCount=I.length),P[O][U]=w(I.length,I.mode)+4+t.getCharCountIndicator(I.mode,B))}}J=N}for(let A=0;A<J.length;A++)P[J[A]].end=0;return{map:P,table:$}}function E(W,B){let $;const P=t.getBestModeForData(W);if($=t.from(B,P),$!==t.BYTE&&$.bit<P.bit)throw new Error('"'+W+'" cannot be encoded with mode '+t.toString($)+`.
|
|
84
|
+
Suggested mode is: `+t.toString(P));switch($===t.KANJI&&!d.isKanjiModeEnabled()&&($=t.BYTE),$){case t.NUMERIC:return new r(W);case t.ALPHANUMERIC:return new n(W);case t.KANJI:return new a(W);case t.BYTE:return new l(W)}}e.fromArray=function(B){return B.reduce(function($,P){return typeof P=="string"?$.push(E(P,null)):P.data&&$.push(E(P.data,P.mode)),$},[])},e.fromString=function(B,$){const P=y(B,d.isKanjiModeEnabled()),J=C(P),A=b(J,$),M=_.find_path(A.map,"start","end"),N=[];for(let j=1;j<M.length-1;j++)N.push(A.table[M[j]].node);return e.fromArray(v(N))},e.rawSplit=function(B){return e.fromArray(y(B,d.isKanjiModeEnabled()))}})(Vc)),Vc}var Im;function hC(){if(Im)return Tc;Im=1;const e=zr(),t=uu(),r=Y1(),n=X1(),l=G1(),a=Q1(),h=J1(),d=pg(),_=tC(),p=iC(),g=rC(),y=Fr(),w=cC();function v(A,M){const N=A.size,j=a.getPositions(M);for(let I=0;I<j.length;I++){const U=j[I][0],H=j[I][1];for(let O=-1;O<=7;O++)if(!(U+O<=-1||N<=U+O))for(let K=-1;K<=7;K++)H+K<=-1||N<=H+K||(O>=0&&O<=6&&(K===0||K===6)||K>=0&&K<=6&&(O===0||O===6)||O>=2&&O<=4&&K>=2&&K<=4?A.set(U+O,H+K,!0,!0):A.set(U+O,H+K,!1,!0))}}function C(A){const M=A.size;for(let N=8;N<M-8;N++){const j=N%2===0;A.set(N,6,j,!0),A.set(6,N,j,!0)}}function b(A,M){const N=l.getPositions(M);for(let j=0;j<N.length;j++){const I=N[j][0],U=N[j][1];for(let H=-2;H<=2;H++)for(let O=-2;O<=2;O++)H===-2||H===2||O===-2||O===2||H===0&&O===0?A.set(I+H,U+O,!0,!0):A.set(I+H,U+O,!1,!0)}}function E(A,M){const N=A.size,j=p.getEncodedBits(M);let I,U,H;for(let O=0;O<18;O++)I=Math.floor(O/3),U=O%3+N-8-3,H=(j>>O&1)===1,A.set(I,U,H,!0),A.set(U,I,H,!0)}function W(A,M,N){const j=A.size,I=g.getEncodedBits(M,N);let U,H;for(U=0;U<15;U++)H=(I>>U&1)===1,U<6?A.set(U,8,H,!0):U<8?A.set(U+1,8,H,!0):A.set(j-15+U,8,H,!0),U<8?A.set(8,j-U-1,H,!0):U<9?A.set(8,15-U-1+1,H,!0):A.set(8,15-U-1,H,!0);A.set(j-8,8,1,!0)}function B(A,M){const N=A.size;let j=-1,I=N-1,U=7,H=0;for(let O=N-1;O>0;O-=2)for(O===6&&O--;;){for(let K=0;K<2;K++)if(!A.isReserved(I,O-K)){let ee=!1;H<M.length&&(ee=(M[H]>>>U&1)===1),A.set(I,O-K,ee),U--,U===-1&&(H++,U=7)}if(I+=j,I<0||N<=I){I-=j,j=-j;break}}}function $(A,M,N){const j=new r;N.forEach(function(K){j.put(K.mode.bit,4),j.put(K.getLength(),y.getCharCountIndicator(K.mode,A)),K.write(j)});const I=e.getSymbolTotalCodewords(A),U=d.getTotalCodewordsCount(A,M),H=(I-U)*8;for(j.getLengthInBits()+4<=H&&j.put(0,4);j.getLengthInBits()%8!==0;)j.putBit(0);const O=(H-j.getLengthInBits())/8;for(let K=0;K<O;K++)j.put(K%2?17:236,8);return P(j,A,M)}function P(A,M,N){const j=e.getSymbolTotalCodewords(M),I=d.getTotalCodewordsCount(M,N),U=j-I,H=d.getBlocksCount(M,N),O=j%H,K=H-O,ee=Math.floor(j/H),Z=Math.floor(U/H),L=Z+1,D=ee-Z,te=new _(D);let X=0;const R=new Array(H),Q=new Array(H);let ce=0;const he=new Uint8Array(A.buffer);for(let re=0;re<H;re++){const ke=re<K?Z:L;R[re]=he.slice(X,X+ke),Q[re]=te.encode(R[re]),X+=ke,ce=Math.max(ce,ke)}const pe=new Uint8Array(j);let ve=0,we,V;for(we=0;we<ce;we++)for(V=0;V<H;V++)we<R[V].length&&(pe[ve++]=R[V][we]);for(we=0;we<D;we++)for(V=0;V<H;V++)pe[ve++]=Q[V][we];return pe}function J(A,M,N,j){let I;if(Array.isArray(A))I=w.fromArray(A);else if(typeof A=="string"){let ee=M;if(!ee){const Z=w.rawSplit(A);ee=p.getBestVersionForData(Z,N)}I=w.fromString(A,ee||40)}else throw new Error("Invalid data");const U=p.getBestVersionForData(I,N);if(!U)throw new Error("The amount of data is too big to be stored in a QR Code");if(!M)M=U;else if(M<U)throw new Error(`
|
|
85
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
86
|
+
Minimum version required to store current data is: `+U+`.
|
|
87
|
+
`);const H=$(M,N,I),O=e.getSymbolSize(M),K=new n(O);return v(K,M),C(K),b(K,M),W(K,N,0),M>=7&&E(K,M),B(K,H),isNaN(j)&&(j=h.getBestMask(K,W.bind(null,K,N))),h.applyMask(j,K),W(K,N,j),{modules:K,version:M,errorCorrectionLevel:N,maskPattern:j,segments:I}}return Tc.create=function(M,N){if(typeof M>"u"||M==="")throw new Error("No input text");let j=t.M,I,U;return typeof N<"u"&&(j=t.from(N.errorCorrectionLevel,t.M),I=p.from(N.version),U=h.from(N.maskPattern),N.toSJISFunc&&e.setToSJISFunction(N.toSJISFunc)),J(M,I,j,U)},Tc}var Jc={},Zc={},zm;function gg(){return zm||(zm=1,(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(a){return[a,a]}))),n.length===6&&n.push("F","F");const l=parseInt(n.join(""),16);return{r:l>>24&255,g:l>>16&255,b:l>>8&255,a:l&255,hex:"#"+n.slice(0,6).join("")}}e.getOptions=function(n){n||(n={}),n.color||(n.color={});const l=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,a=n.width&&n.width>=21?n.width:void 0,h=n.scale||4;return{width:a,scale:a?4:h,margin:l,color:{dark:t(n.color.dark||"#000000ff"),light:t(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,l){return l.width&&l.width>=n+l.margin*2?l.width/(n+l.margin*2):l.scale},e.getImageWidth=function(n,l){const a=e.getScale(n,l);return Math.floor((n+l.margin*2)*a)},e.qrToImageData=function(n,l,a){const h=l.modules.size,d=l.modules.data,_=e.getScale(h,a),p=Math.floor((h+a.margin*2)*_),g=a.margin*_,y=[a.color.light,a.color.dark];for(let w=0;w<p;w++)for(let v=0;v<p;v++){let C=(w*p+v)*4,b=a.color.light;if(w>=g&&v>=g&&w<p-g&&v<p-g){const E=Math.floor((w-g)/_),W=Math.floor((v-g)/_);b=y[d[E*h+W]?1:0]}n[C++]=b.r,n[C++]=b.g,n[C++]=b.b,n[C]=b.a}}})(Zc)),Zc}var Fm;function uC(){return Fm||(Fm=1,(function(e){const t=gg();function r(l,a,h){l.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=h,a.width=h,a.style.height=h+"px",a.style.width=h+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(a,h,d){let _=d,p=h;typeof _>"u"&&(!h||!h.getContext)&&(_=h,h=void 0),h||(p=n()),_=t.getOptions(_);const g=t.getImageWidth(a.modules.size,_),y=p.getContext("2d"),w=y.createImageData(g,g);return t.qrToImageData(w.data,a,_),r(y,p,g),y.putImageData(w,0,0),p},e.renderToDataURL=function(a,h,d){let _=d;typeof _>"u"&&(!h||!h.getContext)&&(_=h,h=void 0),_||(_={});const p=e.render(a,h,_),g=_.type||"image/png",y=_.rendererOpts||{};return p.toDataURL(g,y.quality)}})(Jc)),Jc}var eh={},Hm;function dC(){if(Hm)return eh;Hm=1;const e=gg();function t(l,a){const h=l.a/255,d=a+'="'+l.hex+'"';return h<1?d+" "+a+'-opacity="'+h.toFixed(2).slice(1)+'"':d}function r(l,a,h){let d=l+a;return typeof h<"u"&&(d+=" "+h),d}function n(l,a,h){let d="",_=0,p=!1,g=0;for(let y=0;y<l.length;y++){const w=Math.floor(y%a),v=Math.floor(y/a);!w&&!p&&(p=!0),l[y]?(g++,y>0&&w>0&&l[y-1]||(d+=p?r("M",w+h,.5+v+h):r("m",_,0),_=0,p=!1),w+1<a&&l[y+1]||(d+=r("h",g),g=0)):_++}return d}return eh.render=function(a,h,d){const _=e.getOptions(h),p=a.modules.size,g=a.modules.data,y=p+_.margin*2,w=_.color.light.a?"<path "+t(_.color.light,"fill")+' d="M0 0h'+y+"v"+y+'H0z"/>':"",v="<path "+t(_.color.dark,"stroke")+' d="'+n(g,p,_.margin)+'"/>',C='viewBox="0 0 '+y+" "+y+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(_.width?'width="'+_.width+'" height="'+_.width+'" ':"")+C+' shape-rendering="crispEdges">'+w+v+`</svg>
|
|
88
|
+
`;return typeof d=="function"&&d(null,E),E},eh}var Wm;function fC(){if(Wm)return fs;Wm=1;const e=q1(),t=hC(),r=uC(),n=dC();function l(a,h,d,_,p){const g=[].slice.call(arguments,1),y=g.length,w=typeof g[y-1]=="function";if(!w&&!e())throw new Error("Callback required as last argument");if(w){if(y<2)throw new Error("Too few arguments provided");y===2?(p=d,d=h,h=_=void 0):y===3&&(h.getContext&&typeof p>"u"?(p=_,_=void 0):(p=_,_=d,d=h,h=void 0))}else{if(y<1)throw new Error("Too few arguments provided");return y===1?(d=h,h=_=void 0):y===2&&!h.getContext&&(_=d,d=h,h=void 0),new Promise(function(v,C){try{const b=t.create(d,_);v(a(b,h,_))}catch(b){C(b)}})}try{const v=t.create(d,_);p(null,a(v,h,_))}catch(v){p(v)}}return fs.create=t.create,fs.toCanvas=l.bind(null,r.render),fs.toDataURL=l.bind(null,r.renderToDataURL),fs.toString=l.bind(null,function(a,h,d){return n.render(a,d)}),fs}var pC=fC();const mC=Gh(pC),_C="modulepreload",gC=function(e){return"/"+e},$m={},vC=function(t,r,n){let l=Promise.resolve();if(r&&r.length>0){let h=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),_=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));l=h(r.map(p=>{if(p=gC(p),p in $m)return;$m[p]=!0;const g=p.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${y}`))return;const w=document.createElement("link");if(w.rel=g?"stylesheet":_C,g||(w.as="script"),w.crossOrigin="",w.href=p,_&&w.setAttribute("nonce",_),document.head.appendChild(w),g)return new Promise((v,C)=>{w.addEventListener("load",v),w.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function a(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return l.then(h=>{for(const d of h||[])d.status==="rejected"&&a(d.reason);return t().catch(a)})};class Le{constructor(t,r,n,l,a){this._legacyCanvasSize=Le.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=t,this.$canvas=document.createElement("canvas"),n&&typeof n=="object"?this._onDecode=r:(console.warn(n||l||a?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=r),r=typeof n=="object"?n:{},this._onDecodeError=r.onDecodeError||(typeof n=="function"?n:this._onDecodeError),this._calculateScanRegion=r.calculateScanRegion||(typeof l=="function"?l:this._calculateScanRegion),this._preferredCamera=r.preferredCamera||a||this._preferredCamera,this._legacyCanvasSize=typeof n=="number"?n:typeof l=="number"?l:this._legacyCanvasSize,this._maxScansPerSecond=r.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),t.disablePictureInPicture=!0,t.playsInline=!0,t.muted=!0;let h=!1;if(t.hidden&&(t.hidden=!1,h=!0),document.body.contains(t)||(document.body.appendChild(t),h=!0),n=t.parentElement,r.highlightScanRegion||r.highlightCodeOutline){if(l=!!r.overlay,this.$overlay=r.overlay||document.createElement("div"),a=this.$overlay.style,a.position="absolute",a.display="none",a.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!l&&r.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}n.insertBefore(this.$overlay,this.$video.nextSibling)}r.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(t),requestAnimationFrame(()=>{let d=window.getComputedStyle(t);d.display==="none"&&(t.style.setProperty("display","block","important"),h=!0),d.visibility!=="visible"&&(t.style.setProperty("visibility","visible","important"),h=!0),h&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),t.style.opacity="0",t.style.width="0",t.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),t.addEventListener("play",this._onPlay),t.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=Le.createQrEngine()}static set WORKER_PATH(t){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await Le.listCameras(!1)).length}catch{return!1}}static async listCameras(t=!1){if(!navigator.mediaDevices)return[];let r=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(l=>l.kind==="videoinput"),n;try{t&&(await r()).every(l=>!l.label)&&(n=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await r()).map((l,a)=>({id:l.deviceId,label:l.label||(a===0?"Default Camera":`Camera ${a+1}`)}))}finally{n&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),Le._stopVideoStream(n))}}async hasFlash(){let t;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;t=this.$video.srcObject}else t=(await this._getCameraStream()).stream;return"torch"in t.getVideoTracks()[0].getSettings()}catch{return!1}finally{t&&t!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),Le._stopVideoStream(t))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(t){throw this._flashOn=!1,t}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),Le._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:t,facingMode:r}=await this._getCameraStream();!this._active||this._paused?Le._stopVideoStream(t):(this._setVideoMirror(r),this.$video.srcObject=t,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(t){if(!this._paused)throw this._active=!1,t}}stop(){this.pause(),this._active=!1}async pause(t=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let r=()=>{this.$video.srcObject instanceof MediaStream&&(Le._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return t?(r(),!0):(await new Promise(n=>setTimeout(n,300)),this._paused?(r(),!0):!1)}async setCamera(t){t!==this._preferredCamera&&(this._preferredCamera=t,await this._restartVideoStream())}static async scanImage(t,r,n,l,a=!1,h=!1){let d,_=!1;r&&("scanRegion"in r||"qrEngine"in r||"canvas"in r||"disallowCanvasResizing"in r||"alsoTryWithoutScanRegion"in r||"returnDetailedScanResult"in r)?(d=r.scanRegion,n=r.qrEngine,l=r.canvas,a=r.disallowCanvasResizing||!1,h=r.alsoTryWithoutScanRegion||!1,_=!0):console.warn(r||n||l||a||h?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),r=!!n;try{let p,g;[n,p]=await Promise.all([n||Le.createQrEngine(),Le._loadImage(t)]),[l,g]=Le._drawToCanvas(p,d,l,a);let y;if(n instanceof Worker){let w=n;r||Le._postWorkerMessageSync(w,"inversionMode","both"),y=await new Promise((v,C)=>{let b,E,W,B=-1;E=P=>{P.data.id===B&&(w.removeEventListener("message",E),w.removeEventListener("error",W),clearTimeout(b),P.data.data!==null?v({data:P.data.data,cornerPoints:Le._convertPoints(P.data.cornerPoints,d)}):C(Le.NO_QR_CODE_FOUND))},W=P=>{w.removeEventListener("message",E),w.removeEventListener("error",W),clearTimeout(b),C("Scanner error: "+(P?P.message||P:"Unknown Error"))},w.addEventListener("message",E),w.addEventListener("error",W),b=setTimeout(()=>W("timeout"),1e4);let $=g.getImageData(0,0,l.width,l.height);B=Le._postWorkerMessageSync(w,"decode",$,[$.data.buffer])})}else y=await Promise.race([new Promise((w,v)=>window.setTimeout(()=>v("Scanner error: timeout"),1e4)),(async()=>{try{var[w]=await n.detect(l);if(!w)throw Le.NO_QR_CODE_FOUND;return{data:w.rawValue,cornerPoints:Le._convertPoints(w.cornerPoints,d)}}catch(v){if(w=v.message||v,/not implemented|service unavailable/.test(w))return Le._disableBarcodeDetector=!0,Le.scanImage(t,{scanRegion:d,canvas:l,disallowCanvasResizing:a,alsoTryWithoutScanRegion:h});throw`Scanner error: ${w}`}})()]);return _?y:y.data}catch(p){if(!d||!h)throw p;let g=await Le.scanImage(t,{qrEngine:n,canvas:l,disallowCanvasResizing:a});return _?g:g.data}finally{r||Le._postWorkerMessage(n,"close")}}setGrayscaleWeights(t,r,n,l=!0){Le._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:r,blue:n,useIntegerApproximation:l})}setInversionMode(t){Le._postWorkerMessage(this._qrEnginePromise,"inversionMode",t)}static async createQrEngine(t){if(t&&console.warn("Specifying a worker path is not required and not supported anymore."),t=()=>vC(()=>import("./qr-scanner-worker.min-D85Z9gVD.js"),[]).then(n=>n.createWorker()),!(!Le._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return t();let r=navigator.userAgentData;return r&&r.brands.some(({brand:n})=>/Chromium/i.test(n))&&/mac ?OS/i.test(r.platform)&&await r.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:n,platformVersion:l})=>/arm/i.test(n||"arm")&&13<=parseInt(l||"13")).catch(()=>!0)?t():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(t){let r=Math.round(.6666666666666666*Math.min(t.videoWidth,t.videoHeight));return{x:Math.round((t.videoWidth-r)/2),y:Math.round((t.videoHeight-r)/2),width:r,height:r,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var t=this.$video,r=t.videoWidth,n=t.videoHeight,l=t.offsetWidth,a=t.offsetHeight,h=t.offsetLeft,d=t.offsetTop,_=window.getComputedStyle(t),p=_.objectFit,g=r/n,y=l/a;switch(p){case"none":var w=r,v=n;break;case"fill":w=l,v=a;break;default:(p==="cover"?g>y:g<y)?(v=a,w=v*g):(w=l,v=w/g),p==="scale-down"&&(w=Math.min(w,r),v=Math.min(v,n))}var[C,b]=_.objectPosition.split(" ").map((W,B)=>{const $=parseFloat(W);return W.endsWith("%")?(B?a-v:l-w)*$/100:$});_=this._scanRegion.width||r,y=this._scanRegion.height||n,p=this._scanRegion.x||0;var E=this._scanRegion.y||0;g=this.$overlay.style,g.width=`${_/r*w}px`,g.height=`${y/n*v}px`,g.top=`${d+b+E/n*v}px`,n=/scaleX\(-1\)/.test(t.style.transform),g.left=`${h+(n?l-C-w:C)+(n?r-p-_:p)/r*w}px`,g.transform=t.style.transform}})}static _convertPoints(t,r){if(!r)return t;let n=r.x||0,l=r.y||0,a=r.width&&r.downScaledWidth?r.width/r.downScaledWidth:1;r=r.height&&r.downScaledHeight?r.height/r.downScaledHeight:1;for(let h of t)h.x=h.x*a+n,h.y=h.y*r+l;return t}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var t=Date.now()-this._lastScanTimestamp,r=1e3/this._maxScansPerSecond;t<r&&await new Promise(l=>setTimeout(l,r-t)),this._lastScanTimestamp=Date.now();try{var n=await Le.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(l){if(!this._active)return;this._onDecodeError(l)}!Le._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=Le.createQrEngine()),n?(this._onDecode?this._onDecode(n):this._legacyOnDecode&&this._legacyOnDecode(n.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",n.cornerPoints.map(({x:l,y:a})=>`${l},${a}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(t){t!==Le.NO_QR_CODE_FOUND&&console.log(t)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let t=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",r=[{width:{min:1024}},{width:{min:768}},{}],n=r.map(l=>Object.assign({},l,{[t]:{exact:this._preferredCamera}}));for(let l of[...n,...r])try{let a=await navigator.mediaDevices.getUserMedia({video:l,audio:!1}),h=this._getFacingMode(a)||(l.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:a,facingMode:h}}catch{}throw"Camera not found."}async _restartVideoStream(){let t=this._paused;await this.pause(!0)&&!t&&this._active&&await this.start()}static _stopVideoStream(t){for(let r of t.getTracks())r.stop(),t.removeTrack(r)}_setVideoMirror(t){this.$video.style.transform="scaleX("+(t==="user"?-1:1)+")"}_getFacingMode(t){return(t=t.getVideoTracks()[0])?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(t,r,n,l=!1){n=n||document.createElement("canvas");let a=r&&r.x?r.x:0,h=r&&r.y?r.y:0,d=r&&r.width?r.width:t.videoWidth||t.width,_=r&&r.height?r.height:t.videoHeight||t.height;return l||(l=r&&r.downScaledWidth?r.downScaledWidth:d,r=r&&r.downScaledHeight?r.downScaledHeight:_,n.width!==l&&(n.width=l),n.height!==r&&(n.height=r)),r=n.getContext("2d",{alpha:!1}),r.imageSmoothingEnabled=!1,r.drawImage(t,a,h,d,_,0,0,n.width,n.height),[n,r]}static async _loadImage(t){if(t instanceof Image)return await Le._awaitImageLoad(t),t;if(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGImageElement||"OffscreenCanvas"in window&&t instanceof OffscreenCanvas||"ImageBitmap"in window&&t instanceof ImageBitmap)return t;if(t instanceof File||t instanceof Blob||t instanceof URL||typeof t=="string"){let r=new Image;r.src=t instanceof File||t instanceof Blob?URL.createObjectURL(t):t.toString();try{return await Le._awaitImageLoad(r),r}finally{(t instanceof File||t instanceof Blob)&&URL.revokeObjectURL(r.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(t){t.complete&&t.naturalWidth!==0||await new Promise((r,n)=>{let l=a=>{t.removeEventListener("load",l),t.removeEventListener("error",l),a instanceof ErrorEvent?n("Image load error"):r()};t.addEventListener("load",l),t.addEventListener("error",l)})}static async _postWorkerMessage(t,r,n,l){return Le._postWorkerMessageSync(await t,r,n,l)}static _postWorkerMessageSync(t,r,n,l){if(!(t instanceof Worker))return-1;let a=Le._workerMessageId++;return t.postMessage({id:a,type:r,data:n},l),a}}Le.DEFAULT_CANVAS_SIZE=400;Le.NO_QR_CODE_FOUND="No QR code found";Le._disableBarcodeDetector=!1;Le._workerMessageId=0;function yC(e,t){if(!e||!t||t<e)return null;const r=Math.floor((t-e)/1e3);return r<60?"ora":r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}g`}function SC(e,t){const r=!!(e&&e.status==="up");return{up:r,label:r?"tunnel-up":"tunnel-down",since:r?yC(e.since,t):null}}function du(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&typeof Notification<"u"}function wC(e){const t="=".repeat((4-e.length%4)%4),r=(e+t).replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),l=new Uint8Array(n.length);for(let a=0;a<n.length;a+=1)l[a]=n.charCodeAt(a);return l}async function CC(){if(!du())return"unsupported";if(Notification.permission==="denied")return"denied";try{return await(await navigator.serviceWorker.ready).pushManager.getSubscription()?"subscribed":"idle"}catch{return"idle"}}async function bC(e){if(!du())throw new Error("push-unsupported");if(await Notification.requestPermission()!=="granted")throw new Error("push-denied");const r=await gt("/api/push/vapid",e),{publicKey:n}=await r.json();if(!n)throw new Error("vapid non disponibile");const a=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:wC(n)}),h=await gt("/api/push/subscribe",e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({subscription:a.toJSON()})});if(!h.ok){try{await a.unsubscribe()}catch{}const d=await h.json().catch(()=>({}));throw new Error(d.error||`HTTP ${h.status}`)}return!0}async function xC(e){if(!du())return!1;const r=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!r)return!1;const n=r.endpoint;try{await r.unsubscribe()}catch{}try{await gt("/api/push/subscribe",e,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:n})})}catch{}return!0}const kC=()=>({kind:"managed",id:"claude.native",label:"",client:"claude",provider:"native",credentialProfile:"",managedModel:"",permissionPolicy:"standard",displayName:"",protocol:"anthropic_messages",baseUrl:"",envKey:"",providerId:"nexuscrew-custom",command:"",argsText:"",rc:!0,promptMode:"send-keys",promptFlag:"",modelFlag:"",modelValue:"",envRows:[]}),EC=(e="")=>({id:"",cwd:"",engine:e,boot:!1,model:"",prompt:""}),Kh=(e,t)=>e.find(r=>r.client===t.client&&r.provider===t.provider&&(r.credentialProfile||"")===(t.credentialProfile||"")),NC=(e,t)=>{var r;return((r=Kh(e,t))==null?void 0:r.label)||`${t.client} · ${t.provider}`};function RC(e){var t,r,n,l,a,h,d,_,p,g,y,w,v;return{kind:e.managed?"managed":"custom",id:e.id,label:e.label||"",command:e.command||"",argsText:(e.args||[]).join(`
|
|
89
|
+
`),rc:!!e.rc,client:((t=e.managed)==null?void 0:t.client)||"claude",provider:((r=e.managed)==null?void 0:r.provider)||"native",credentialProfile:((n=e.managed)==null?void 0:n.credentialProfile)||"",managedModel:((l=e.managed)==null?void 0:l.model)||"",permissionPolicy:((a=e.managed)==null?void 0:a.permissionPolicy)||"standard",displayName:((h=e.managed)==null?void 0:h.displayName)||"",protocol:((d=e.managed)==null?void 0:d.protocol)||"",baseUrl:((_=e.managed)==null?void 0:_.baseUrl)||"",envKey:((p=e.managed)==null?void 0:p.envKey)||"",providerId:((g=e.managed)==null?void 0:g.providerId)||"nexuscrew-custom",modelOptions:e.availableModels||((y=e.managedInfo)==null?void 0:y.models)||[],promptMode:e.promptMode||"send-keys",promptFlag:e.promptFlag||"",modelFlag:((w=e.model)==null?void 0:w.flag)||"",modelValue:((v=e.model)==null?void 0:v.value)||"",envRows:(e.envKeys||[]).map(C=>({key:C,value:"",configured:!0,remove:!1}))}}function MC(e,t,r=[]){if(e.kind==="managed"){const l={client:e.client,provider:e.provider,model:e.managedModel||"",permissionPolicy:e.permissionPolicy||"standard"};return e.credentialProfile&&(l.credentialProfile=e.credentialProfile),e.provider==="custom"&&Object.assign(l,{displayName:e.displayName,protocol:e.protocol,baseUrl:e.baseUrl,envKey:e.envKey,providerId:e.providerId}),{...t?{id:e.id}:{},label:e.label||NC(r,e),rc:!!e.rc,managed:l}}const n={...t?{id:e.id}:{},label:e.label||e.id,rc:!!e.rc,command:e.command,args:e.argsText.split(`
|
|
90
|
+
`).filter(l=>l!==""),promptMode:e.promptMode};return e.modelFlag&&(n.model={flag:e.modelFlag,value:e.modelValue||""}),e.promptMode==="flag"&&(n.promptFlag=e.promptFlag),t&&(n.env=Object.fromEntries(e.envRows.filter(l=>!l.remove&&l.key).map(l=>[l.key,l.value]))),n}function DC({token:e,readonly:t}){const[r,n]=z.useState({engines:[],cells:[],managedCatalog:[]}),[l,a]=z.useState({available:!1,capabilities:[]}),[h,d]=z.useState(null),[_,p]=z.useState(null),[g,y]=z.useState(!1),[w,v]=z.useState(""),[C,b]=z.useState(""),E=z.useCallback(async()=>{try{const A=await gl(e);if(a(A),A.provider==="builtin"&&(A.capabilities||[]).includes("definitions")){const M=await L0(e),N=new Map((A.engines||[]).map(j=>[j.id,j]));M.engines=(M.engines||[]).map(j=>{var I;return{...j,availableModels:((I=N.get(j.id))==null?void 0:I.models)||[]}}),n(M)}}catch(A){v(String(A.message||A))}},[e]);z.useEffect(()=>{E();const A=setInterval(E,5e3);return()=>clearInterval(A)},[E]);const W=new Set((l.cells||[]).filter(A=>A.active).map(A=>A.cell)),B=l.provider==="builtin"&&(l.capabilities||[]).includes("edit"),$=async A=>{y(!0),v(""),b("");try{await A(),await E()}catch(M){v(String(M.message||M))}y(!1)},P=()=>$(async()=>{const A=h.mode==="new",M=MC(h.form,A,r.managedCatalog||[]);!A&&h.form.kind==="custom"&&!h.form.modelFlag&&(M.model=null),!A&&h.form.kind==="custom"&&h.form.promptMode!=="flag"&&(M.promptFlag=null);let N;if(A)N=await T0(e,M);else{const I=h.original,U=new Set(h.form.envRows.filter(K=>!K.remove).map(K=>K.key)),H=(I.envKeys||[]).filter(K=>!U.has(K)),O=Object.fromEntries(h.form.envRows.filter(K=>!K.remove&&K.key&&(!K.configured||K.value!=="")).map(K=>[K.key,K.value]));N=await B0(e,I.id,M,h.form.kind==="custom"?{set:O,remove:H}:void 0)}d(null),b(x("fleet-saved"));const j=(N==null?void 0:N.activeCells)||[];if(j.length&&window.confirm(x("fleet-restart-confirm").replace("{cells}",j.join(", "))))for(const I of j)await hp(e,I)}),J=()=>$(async()=>{const A=_.mode==="new",M=_.form,N={...A?{id:M.id}:{},cwd:M.cwd,engine:M.engine,boot:!!M.boot};A?(M.model&&(N.model=M.model),M.prompt&&(N.prompt=M.prompt)):(N.model=M.model||null,N.prompt=M.prompt||null);const j=A?await j0(e,N):await O0(e,_.original.id,N),I=A?M.id:_.original.id;p(null),b(x("fleet-saved")),!A&&(j!=null&&j.active)&&window.confirm(x("fleet-restart-confirm").replace("{cells}",I))&&await hp(e,I)});return B?f.jsxs("div",{className:"nc-set-tab nc-fleet-editor",children:[f.jsxs("div",{className:"nc-fleet-section-head",children:[f.jsx("b",{children:x("fleet-engines")}),f.jsxs("button",{className:"nc-btn primary",disabled:t||g,onClick:()=>d({mode:"new",form:kC()}),children:["+ ",x("add")]})]}),r.engines.map(A=>{var M,N;return f.jsxs("div",{className:"nc-fleet-item",children:[f.jsxs("span",{children:[f.jsx("b",{children:A.label}),f.jsx("small",{children:A.managed?`${A.id} · ${A.managed.client} / ${A.managed.provider} · ${(M=A.managedInfo)!=null&&M.configured?x("fleet-ready"):((N=A.managedInfo)==null?void 0:N.reason)||x("fleet-not-ready")}`:`${A.id} · ${A.command}`})]}),f.jsxs("span",{children:[f.jsx("button",{className:"nc-btn ghost",disabled:t||g,onClick:()=>d({mode:"edit",original:A,form:RC(A)}),children:x("edit")}),f.jsx("button",{className:"nc-btn danger",disabled:t||g,onClick:()=>$(async()=>{window.confirm(x("fleet-remove-engine").replace("{id}",A.id))&&await A0(e,A.id)}),children:"×"})]})]},A.id)}),h&&f.jsx(PC,{state:h,setState:d,busy:g,onSave:P,catalog:r.managedCatalog||[]}),f.jsxs("div",{className:"nc-fleet-section-head",children:[f.jsx("b",{children:x("fleet-cells")}),f.jsxs("button",{className:"nc-btn primary",disabled:t||g||!r.engines.length,onClick:()=>{var A;return p({mode:"new",form:EC((A=r.engines[0])==null?void 0:A.id)})},children:["+ ",x("add")]})]}),r.cells.map(A=>f.jsxs("div",{className:"nc-fleet-item",children:[f.jsxs("span",{children:[f.jsx("b",{children:A.id}),f.jsxs("small",{children:[A.engine," · ",A.cwd,W.has(A.id)?` · ${x("service-active")}`:""]})]}),f.jsxs("span",{children:[f.jsx("button",{className:"nc-btn ghost",disabled:t||g,onClick:()=>p({mode:"edit",original:A,form:{...A}}),children:x("edit")}),f.jsx("button",{className:"nc-btn danger",disabled:t||g,onClick:()=>$(async()=>{window.confirm(x("fleet-remove-cell").replace("{id}",A.id))&&await I0(e,A.id,!0)}),children:"×"})]})]},A.id)),_&&f.jsx(LC,{token:e,state:_,setState:p,engines:r.engines,busy:g,onSave:J}),C&&f.jsx("div",{className:"nc-set-note",children:C}),w&&f.jsx("div",{className:"nc-err",children:w})]}):f.jsx("div",{className:"nc-set-info",children:x("fleet-editor-unavailable")})}function PC({state:e,setState:t,busy:r,onSave:n,catalog:l}){var w;const a=e.form,h=v=>t({...e,form:{...a,...v}}),d=a.envRows||[],_=[...new Map(l.map(v=>[v.client,v.clientLabel||v.client])).entries()],p=l.filter(v=>v.client===a.client),g=Kh(l,a),y=v=>{v&&h({client:v.client,provider:v.provider,credentialProfile:v.credentialProfile||"",managedModel:v.model||"",protocol:v.protocol||"",permissionPolicy:"standard",rc:!!v.rc,displayName:v.custom?x("fleet-custom-provider-default"):"",baseUrl:v.custom?"":v.endpoint||"",envKey:"",providerId:"nexuscrew-custom",...e.mode==="new"?{id:v.id,label:""}:{}})};return f.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[f.jsx("b",{children:e.mode==="new"?x("fleet-new-engine"):`${x("edit")} ${a.id}`}),f.jsx("input",{value:a.id,disabled:e.mode!=="new",placeholder:"id",onChange:v=>h({id:v.target.value})}),f.jsx("input",{value:a.label,placeholder:x("label"),onChange:v=>h({label:v.target.value})}),f.jsxs("select",{value:a.kind,disabled:e.mode!=="new",onChange:v=>h({kind:v.target.value}),children:[f.jsx("option",{value:"managed",children:x("fleet-managed")}),f.jsx("option",{value:"custom",children:x("fleet-custom")})]}),a.kind==="managed"?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"nc-fleet-pair",children:[f.jsx("select",{value:a.client,disabled:e.mode!=="new",onChange:v=>y(l.find(C=>C.client===v.target.value&&C.default)||l.find(C=>C.client===v.target.value)),children:_.map(([v,C])=>f.jsx("option",{value:v,children:C},v))}),f.jsx("select",{value:((w=Kh(l,a))==null?void 0:w.id)||"",disabled:e.mode!=="new",onChange:v=>y(l.find(C=>C.id===v.target.value)),children:p.map(v=>f.jsx("option",{value:v.id,children:v.label},v.id))})]}),f.jsx("input",{value:a.managedModel,list:"nc-managed-models",placeholder:x(g!=null&&g.requiresModel?"fleet-model-required":"fleet-model-default"),onChange:v=>h({managedModel:v.target.value})}),f.jsx("datalist",{id:"nc-managed-models",children:[...(g==null?void 0:g.models)||[],...a.modelOptions||[]].filter((v,C,b)=>v&&b.indexOf(v)===C).map(v=>f.jsx("option",{value:v},v))}),g!=null&&g.supportsUnsafe?f.jsxs("select",{value:a.permissionPolicy,onChange:v=>h({permissionPolicy:v.target.value}),children:[f.jsx("option",{value:"standard",children:x("fleet-standard-permissions")}),f.jsx("option",{value:"unsafe",children:x("fleet-unsafe-permissions")})]}):f.jsx("small",{children:x("fleet-standard-permissions")}),(g==null?void 0:g.supportsUnsafe)&&a.permissionPolicy==="unsafe"&&f.jsx("small",{className:"nc-err",children:x("fleet-unsafe-warning")}),a.provider==="custom"&&f.jsxs(f.Fragment,{children:[f.jsx("input",{value:a.displayName,placeholder:x("fleet-provider-display"),onChange:v=>h({displayName:v.target.value})}),f.jsx("input",{value:a.baseUrl,placeholder:"https://api.example.com/v1",onChange:v=>h({baseUrl:v.target.value})}),((g==null?void 0:g.protocols)||[]).length>1&&f.jsx("select",{value:a.protocol,onChange:v=>h({protocol:v.target.value}),children:g.protocols.map(v=>f.jsx("option",{value:v,children:v},v))}),f.jsxs("div",{className:"nc-fleet-pair",children:[f.jsx("input",{value:a.envKey,placeholder:x("fleet-api-key-env"),onChange:v=>h({envKey:v.target.value})}),f.jsx("input",{value:a.providerId,placeholder:x("fleet-provider-id"),onChange:v=>h({providerId:v.target.value})})]}),f.jsxs("small",{children:[a.protocol," · ",x("fleet-custom-secret-help")]})]}),f.jsx("small",{children:x("fleet-managed-help")})]}):f.jsxs(f.Fragment,{children:[f.jsx("input",{value:a.command,placeholder:x("command-path"),onChange:v=>h({command:v.target.value})}),f.jsx("textarea",{value:a.argsText,placeholder:x("args-lines"),onChange:v=>h({argsText:v.target.value})}),f.jsxs("label",{className:"nc-check",children:[f.jsx("input",{type:"checkbox",checked:a.rc,onChange:v=>h({rc:v.target.checked})})," remote control"]}),f.jsxs("select",{value:a.promptMode,onChange:v=>h({promptMode:v.target.value}),children:[f.jsx("option",{value:"send-keys",children:"send-keys"}),f.jsx("option",{value:"flag",children:"flag"})]}),a.promptMode==="flag"&&f.jsx("input",{value:a.promptFlag,placeholder:"prompt flag",onChange:v=>h({promptFlag:v.target.value})}),f.jsxs("div",{className:"nc-fleet-pair",children:[f.jsx("input",{value:a.modelFlag,placeholder:"model flag",onChange:v=>h({modelFlag:v.target.value})}),f.jsx("input",{value:a.modelValue,placeholder:"model default",onChange:v=>h({modelValue:v.target.value})})]}),f.jsx("small",{children:x("env-write-only")}),d.map((v,C)=>f.jsxs("div",{className:"nc-fleet-env",children:[f.jsx("input",{value:v.key,disabled:v.configured,placeholder:"ENV_KEY",onChange:b=>{const E=d.slice();E[C]={...v,key:b.target.value},h({envRows:E})}}),f.jsx("input",{type:"password",value:v.value,placeholder:v.configured?"•••••• (unchanged)":"value",onChange:b=>{const E=d.slice();E[C]={...v,value:b.target.value},h({envRows:E})}}),f.jsx("button",{className:"nc-btn danger",onClick:()=>h({envRows:d.filter((b,E)=>E!==C)}),children:"×"})]},`${v.key}-${C}`)),f.jsx("button",{className:"nc-btn ghost",onClick:()=>h({envRows:[...d,{key:"",value:"",configured:!1}]}),children:"+ env"})]}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{className:"nc-btn ghost",onClick:()=>t(null),children:x("cancel")}),f.jsx("button",{className:"nc-btn primary",disabled:r||!a.id||a.kind==="custom"&&!a.command||a.kind==="managed"&&(g==null?void 0:g.requiresModel)&&!a.managedModel||a.kind==="managed"&&a.provider==="custom"&&(!a.displayName||!a.baseUrl||!a.envKey||!a.providerId),onClick:n,children:x("save")})]})]})}function LC({token:e,state:t,setState:r,engines:n,busy:l,onSave:a}){const[h,d]=z.useState(null),[_,p]=z.useState(""),g=t.form,y=b=>r({...t,form:{...g,...b}}),w=n.find(b=>b.id===g.engine),v=b=>{var W,B,$;const E=n.find(P=>P.id===b);y({engine:b,model:((W=g.models)==null?void 0:W[b])||((B=E==null?void 0:E.managed)==null?void 0:B.model)||(($=E==null?void 0:E.model)==null?void 0:$.value)||""})},C=async b=>{try{const E=await r_(e,b);d(E),y({cwd:E.path}),p("")}catch(E){p(String(E.message||E))}};return f.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[f.jsx("b",{children:t.mode==="new"?x("fleet-new-cell"):`${x("edit")} ${g.id}`}),f.jsx("input",{value:g.id,disabled:t.mode!=="new",placeholder:"id",onChange:b=>y({id:b.target.value})}),f.jsxs("div",{className:"nc-fleet-pair",children:[f.jsx("input",{value:g.cwd,placeholder:x("cwd"),onChange:b=>y({cwd:b.target.value})}),f.jsx("button",{className:"nc-btn ghost",onClick:()=>h?d(null):C(g.cwd),children:x("browse")})]}),h&&f.jsxs("div",{className:"nc-fs",children:[f.jsx("div",{className:"nc-fs-path",children:h.path}),f.jsxs("div",{className:"nc-fs-list",children:[h.parent&&f.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>C(h.parent),children:["↑ ",x("fs-parent")]}),(h.dirs||[]).map(b=>f.jsxs("button",{className:"nc-fs-item",onClick:()=>C(`${h.path.replace(/\/$/,"")}/${b}`),children:["📁 ",b]},b))]})]}),_&&f.jsx("div",{className:"nc-err",children:_}),f.jsx("select",{value:g.engine,onChange:b=>v(b.target.value),children:n.map(b=>f.jsx("option",{value:b.id,children:b.label},b.id))}),f.jsxs("label",{className:"nc-check",children:[f.jsx("input",{type:"checkbox",checked:!!g.boot,onChange:b=>y({boot:b.target.checked})})," boot"]}),f.jsx("input",{value:g.model||"",list:"nc-cell-models",placeholder:x("fleet-model-override"),onChange:b=>y({model:b.target.value})}),f.jsx("datalist",{id:"nc-cell-models",children:((w==null?void 0:w.availableModels)||[]).map(b=>f.jsx("option",{value:b},b))}),f.jsx("textarea",{value:g.prompt||"",placeholder:"prompt",onChange:b=>y({prompt:b.target.value})}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{className:"nc-btn ghost",onClick:()=>r(null),children:x("cancel")}),f.jsx("button",{className:"nc-btn primary",disabled:l||!g.id||!g.cwd||!g.engine,onClick:a,children:x("save")})]})]})}function TC({text:e}){const[t,r]=z.useState(!1),n=async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}};return f.jsxs("div",{className:"nc-set-copyline",children:[f.jsx("code",{children:e}),f.jsxs("button",{type:"button",className:"nc-btn ghost",onClick:n,children:[f.jsx(ze,{name:"copy",size:14})," ",x(t?"copied":"copy")]})]})}function BC({value:e}){const[t,r]=z.useState("");return z.useEffect(()=>{let n=!0;return mC.toDataURL(e,{margin:1,width:220}).then(l=>{n&&r(l)}).catch(()=>{}),()=>{n=!1}},[e]),t?f.jsx("img",{src:t,width:"220",height:"220",alt:"NexusCrew pairing QR"}):null}function AC({token:e,nodes:t,readonly:r,refresh:n}){const[l,a]=z.useState(null),[h,d]=z.useState(null),[_,p]=z.useState({}),[g,y]=z.useState({name:"",ssh:"",pairingUrl:""}),[w,v]=z.useState(null),C=Date.now(),b=async(B,$)=>{a(null),d(`${B}:${$}`);try{const P=await q0(e,B,$);$==="test"&&p(J=>({...J,[B]:P})),await n()}catch(P){a(`${B}: ${String(P.message||P)}`)}d(null)},E=async B=>{if(window.confirm(x("node-remove-confirm").replace("{name}",B))){a(null),d(`${B}:remove`);try{await V0(e,B),await n()}catch($){a(`${B}: ${String($.message||$)}`)}d(null)}},W=async()=>{if(a(null),!g.name||!g.ssh||!g.pairingUrl)return a(x("pairing-required"));d("add");try{await n_(e,g),y({name:"",ssh:"",pairingUrl:""}),await n()}catch(B){a(String(B.message||B))}d(null)};return f.jsxs("div",{className:"nc-set-tab",children:[(t||[]).length===0&&f.jsx("div",{className:"nc-empty",children:x("no-nodes")}),(t||[]).map(B=>{const $=SC(B.tunnel,C),P=_[B.name];return f.jsxs("div",{className:"nc-set-node",children:[f.jsxs("div",{className:"nc-set-node-head",children:[f.jsx("span",{className:`nc-dot ${$.up?"on":""}`}),f.jsx("b",{children:B.name}),f.jsxs("small",{children:[B.ssh,B.sshPort?`:${B.sshPort}`:""," · :",B.localPort,"→:",B.remotePort]}),f.jsxs("span",{className:`nc-set-tunnel${$.up?" up":""}`,children:[x($.label),$.since?` · ${$.since}`:""]}),f.jsxs("select",{value:B.visibility||"network",disabled:r||!!h,onChange:async J=>{d(`${B.name}:visibility`);try{await up(e,B.name,J.target.value),await n()}catch(A){a(String(A.message||A))}d(null)},children:[f.jsx("option",{value:"network",children:x("visibility-network")}),f.jsx("option",{value:"relay-only",children:x("visibility-relay")}),f.jsx("option",{value:"selected",children:x("visibility-selected")})]})]}),B.visibility==="selected"&&f.jsx("div",{className:"nc-set-row",children:(t||[]).filter(J=>J.name!==B.name&&J.nodeId).map(J=>{const A=(B.selected||[]).includes(J.nodeId);return f.jsxs("label",{className:"nc-check",children:[f.jsx("input",{type:"checkbox",checked:A,disabled:r||!!h,onChange:async M=>{const N=M.target.checked?[...B.selected||[],J.nodeId]:(B.selected||[]).filter(j=>j!==J.nodeId);d(`${B.name}:visibility`);try{await up(e,B.name,"selected",N),await n()}catch(j){a(String(j.message||j))}d(null)}})," ",J.name]},J.nodeId)})}),f.jsxs("div",{className:"nc-set-node-actions",children:[f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!h,onClick:()=>b(B.name,"test"),children:x("node-test")}),$.up?f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!h,onClick:()=>b(B.name,"down"),children:x("tunnel-stop")}):f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!h,onClick:()=>b(B.name,"up"),children:x("tunnel-start")}),f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!h,onClick:()=>b(B.name,"restart"),children:x("tunnel-restart")}),f.jsx("button",{type:"button",className:"nc-btn danger",disabled:r||!!h,title:x(r?"settings-readonly":"terminate"),onClick:()=>E(B.name),children:f.jsx(ze,{name:"trash",size:14})})]}),P&&f.jsxs("div",{className:`nc-set-test${P.ok?" ok":" ko"}`,children:[P.result,P.detail?` — ${P.detail}`:""]})]},B.name)}),f.jsxs("div",{className:"nc-set-form",children:[f.jsx("div",{className:"nc-sheet-label",children:x("node-add")}),f.jsxs("label",{className:"nc-field",children:[x("node-name-label"),f.jsx("input",{placeholder:x("node-name-ph"),value:g.name,disabled:r,onChange:B=>y({...g,name:B.target.value})})]}),f.jsxs("label",{className:"nc-field",children:[x("node-ssh-label"),f.jsx("input",{placeholder:"my-relay",value:g.ssh,disabled:r,onChange:B=>y({...g,ssh:B.target.value})})]}),f.jsxs("label",{className:"nc-field",children:[x("pairing-link"),f.jsx("input",{placeholder:"http://127.0.0.1:…/#pair=…",value:g.pairingUrl,disabled:r,onChange:B=>y({...g,pairingUrl:B.target.value})}),f.jsx("input",{id:"nc-pair-scan",type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:async B=>{const $=B.target.files&&B.target.files[0];if($){try{const P=await Le.scanImage($);y(J=>({...J,pairingUrl:P}))}catch{a(x("pairing-qr-invalid"))}B.target.value=""}}}),f.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{var B;return(B=document.getElementById("nc-pair-scan"))==null?void 0:B.click()},children:x("scan-qr")})]}),f.jsx("div",{className:"nc-sheet-actions",children:f.jsx("button",{type:"button",className:"nc-btn primary",disabled:r||h==="add",title:r?x("settings-readonly"):"",onClick:W,children:x("add")})})]}),f.jsxs("div",{className:"nc-set-form",children:[f.jsx("div",{className:"nc-sheet-label",children:x("invite-node")}),f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||!!h,onClick:async()=>{d("invite");try{v(await K0(e))}catch(B){a(String(B.message||B))}d(null)},children:x("create-pairing-link")}),w&&f.jsxs(f.Fragment,{children:[f.jsx(BC,{value:w.pairingUrl}),f.jsx(TC,{text:w.pairingUrl})]})]}),l&&f.jsx("div",{className:"nc-err",children:l})]})}function jC({token:e,readonly:t}){const[r,n]=z.useState("idle"),[l,a]=z.useState(!1),[h,d]=z.useState(null);z.useEffect(()=>{let p=!1;return CC().then(g=>{p||n(g)}),()=>{p=!0}},[]);const _=async()=>{d(null),a(!0);try{r==="subscribed"?(await xC(e),n("idle")):(await bC(e),n("subscribed"))}catch(p){const g=String(p.message||p);g==="push-denied"?(n("denied"),d(x("push-denied"))):g==="push-unsupported"?(n("unsupported"),d(x("push-unsupported"))):d(g)}a(!1)};return r==="unsupported"?f.jsx("div",{className:"nc-set-info",children:x("push-unsupported")}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"nc-set-row",children:[f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||l||r==="denied",title:t?x("settings-readonly"):"",onClick:_,children:x(r==="subscribed"?"push-disable":"push-enable")}),f.jsx("span",{className:"nc-set-info",children:x(r==="subscribed"?"push-on":r==="denied"?"push-denied":"push-off")})]}),h&&f.jsx("div",{className:"nc-err",children:h})]})}function OC({token:e,settings:t,readonly:r}){const[n,l]=z.useState(null),[a,h]=z.useState(null),[d,_]=z.useState(!1),[p,g]=z.useState(!1),y=async()=>{l(null),h(null),g(!0);try{const C=await U0(e);h(C.note||"ok"),_(!1)}catch(C){l(String(C.message||C))}g(!1)},w=async()=>{l(null),h(null),g(!0);try{const C=await Y0(e);h(`${C.note||"ok"}${C.target?` (${C.target})`:""}`)}catch(C){l(String(C.message||C))}g(!1)},v=t&&t.service;return f.jsxs("div",{className:"nc-set-tab",children:[t&&f.jsxs("div",{className:"nc-set-info",children:["v",t.version," · ",t.platform," · :",t.port,f.jsx("br",{}),v&&v.installed?x("service-installed"):x("service-missing"),v&&v.installed?` · ${v.active?x("service-active"):x("service-inactive")}`:""]}),f.jsxs("div",{className:"nc-set-row",children:[f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||p,title:r?x("settings-readonly"):"",onClick:()=>{l(null),h(null),_(!0)},children:x("token-rotate")}),f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||p,title:r?x("settings-readonly"):"",onClick:w,children:x("service-regenerate")})]}),f.jsx(jC,{token:e,readonly:r}),d&&f.jsxs("div",{className:"nc-set-confirm",children:[f.jsx("div",{children:x("token-rotate-explain")}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:p,onClick:()=>_(!1),children:x("cancel")}),f.jsx("button",{type:"button",className:"nc-btn primary",disabled:p,onClick:y,children:x("confirm")})]})]}),a&&f.jsx("div",{className:"nc-set-note",children:a}),n&&f.jsx("div",{className:"nc-err",children:n})]})}function IC({token:e,onClose:t}){Wt();const[r,n]=z.useState("nodes"),[l,a]=z.useState(null),[h,d]=z.useState([]),[_,p]=z.useState(!1),[g,y]=z.useState(null),w=z.useCallback(async()=>{try{const v=await s_(e);a(v),y(null)}catch(v){y(String(v.message||v))}try{const v=await z0(e);d(v.nodes||[])}catch(v){y(String(v.message||v))}},[e]);return z.useEffect(()=>{w();const v=setInterval(w,5e3);return()=>clearInterval(v)},[w]),z.useEffect(()=>{let v=!1;return gt("/api/config",e).then(C=>C.json()).then(C=>{v||p(!!C.readonlyDefault)}).catch(()=>{}),()=>{v=!0}},[e]),f.jsx("div",{className:"nc-set-overlay",onClick:t,children:f.jsxs("div",{className:"nc-set-panel",onClick:v=>v.stopPropagation(),children:[f.jsxs("div",{className:"nc-set-head",children:[f.jsx(ze,{name:"gear",size:18}),f.jsx("b",{children:x("settings")}),f.jsx("button",{type:"button",className:"nc-set-close",onClick:t,title:x("close"),children:f.jsx(ze,{name:"x",size:18})})]}),_&&f.jsx("div",{className:"nc-set-readonly",children:x("settings-readonly")}),g&&f.jsx("div",{className:"nc-err",children:g}),f.jsx("div",{className:"nc-set-tabs",children:["nodes","fleet","system"].map(v=>f.jsx("button",{type:"button",className:`nc-set-tabbtn${r===v?" on":""}`,onClick:()=>n(v),children:x(`tab-${v}`)},v))}),f.jsxs("div",{className:"nc-set-body",children:[r==="nodes"&&f.jsx(AC,{token:e,nodes:h,readonly:_,refresh:w}),r==="fleet"&&f.jsx(DC,{token:e,readonly:_}),r==="system"&&f.jsx(OC,{token:e,settings:l,readonly:_})]})]})})}function zC({token:e,onDone:t}){Wt();const[r,n]=z.useState("welcome"),[l,a]=z.useState({name:"",ssh:"",pairingUrl:""}),[h,d]=z.useState(!1),[_,p]=z.useState(null),g=async()=>{d(!0),p(null);try{await $0(e,{wizardDone:!0}),t()}catch(w){p(String(w.message||w)),d(!1)}},y=async()=>{if(!l.name||!l.ssh||!l.pairingUrl)return p(x("pairing-required"));d(!0),p(null);try{await n_(e,l),n("done")}catch(w){p(String(w.message||w))}d(!1)};return f.jsx("div",{className:"nc-wiz-overlay",children:f.jsxs("div",{className:"nc-wiz",children:[f.jsxs("div",{className:"nc-wiz-head",children:[f.jsx("b",{children:x("wizard-title")}),f.jsx("small",{children:x("hydra-simple")})]}),r==="welcome"&&f.jsxs("div",{className:"nc-wiz-body",children:[f.jsx("div",{className:"nc-wiz-done",children:x("local-ready")}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{className:"nc-btn ghost",disabled:h,onClick:g,children:x("local-only")}),f.jsx("button",{className:"nc-btn primary",disabled:h,onClick:()=>n("pair"),children:x("add-node")})]})]}),r==="pair"&&f.jsxs("div",{className:"nc-wiz-body",children:[f.jsxs("label",{className:"nc-field",children:[x("node-name-label"),f.jsx("input",{value:l.name,onChange:w=>a({...l,name:w.target.value}),placeholder:"relay"})]}),f.jsxs("label",{className:"nc-field",children:[x("node-ssh-label"),f.jsx("input",{value:l.ssh,onChange:w=>a({...l,ssh:w.target.value}),placeholder:"my-relay"})]}),f.jsxs("label",{className:"nc-field",children:[x("pairing-link"),f.jsx("input",{value:l.pairingUrl,onChange:w=>a({...l,pairingUrl:w.target.value}),placeholder:"http://127.0.0.1:…/#pair=…"})]}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{className:"nc-btn ghost",disabled:h,onClick:()=>n("welcome"),children:x("back")}),f.jsx("button",{className:"nc-btn primary",disabled:h,onClick:y,children:x("connect")})]})]}),r==="done"&&f.jsxs("div",{className:"nc-wiz-body",children:[f.jsx("div",{className:"nc-wiz-done",children:x("node-connected")}),f.jsx("div",{className:"nc-sheet-actions",children:f.jsx("button",{className:"nc-btn primary",disabled:h,onClick:g,children:x("finish")})})]}),_&&f.jsx("div",{className:"nc-err",children:_})]})})}function FC(e,t){if(typeof EventSource>"u"||!e)return()=>{};const r=new EventSource(`/api/events?token=${encodeURIComponent(e)}`);return r.onmessage=n=>{try{const l=JSON.parse(n.data);l&&typeof l=="object"&&typeof l.type=="string"&&t(l)}catch{}},()=>{try{r.close()}catch{}}}const HC=6e3,WC=12e3;function $C({n:e,onClose:t}){return f.jsxs("div",{className:`nc-ntf-toast${e.urgency==="high"?" high":""}`,role:"status","aria-live":"polite",children:[f.jsxs("div",{className:"nc-ntf-toast-txt",children:[f.jsx("b",{children:e.title}),e.body&&f.jsx("small",{children:e.body}),e.session&&f.jsx("span",{className:"nc-ntf-from",children:e.session})]}),f.jsx("button",{type:"button",className:"nc-ntf-x",onClick:t,title:x("close"),children:f.jsx(ze,{name:"x",size:14})})]})}function UC({ask:e,token:t,onAnswered:r}){const[n,l]=z.useState(""),[a,h]=z.useState(!1),[d,_]=z.useState(null),p=async g=>{const y=String(g||"").trim();if(!(!y||a)){_(null),h(!0);try{await G0(t,e.id,y),r(e.id)}catch(w){_(String(w.message||w))}h(!1)}};return f.jsxs("div",{className:"nc-ask-card",children:[f.jsxs("div",{className:"nc-ask-head",children:[f.jsx("span",{className:"nc-ntf-from",children:e.session}),f.jsxs("code",{className:"nc-ask-id",children:["#",e.id]})]}),f.jsx("div",{className:"nc-ask-q",children:e.question}),Array.isArray(e.options)&&e.options.length>0&&f.jsx("div",{className:"nc-ask-opts",children:e.options.map(g=>f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:a,onClick:()=>p(g),children:g},g))}),f.jsxs("div",{className:"nc-ask-reply",children:[f.jsx("textarea",{rows:2,placeholder:x("ask-reply-ph"),value:n,disabled:a,onChange:g=>l(g.target.value)}),f.jsx("button",{type:"button",className:"nc-btn primary",disabled:a||!n.trim(),onClick:()=>p(n),children:x("send")})]}),d&&f.jsx("div",{className:"nc-err",children:d})]})}function KC({token:e}){Wt();const[t,r]=z.useState([]),[n,l]=z.useState([]),[a,h]=z.useState(()=>{try{return/(?:^|[#&])ask=/.test(location.hash)}catch{return!1}}),d=z.useRef(0),_=z.useCallback(y=>{r(w=>w.filter(v=>v.key!==y))},[]),p=z.useCallback(y=>{const w=`t${d.current+=1}`;r(v=>[...v.slice(-3),{...y,key:w}]),setTimeout(()=>_(w),y.urgency==="high"?WC:HC)},[_]);z.useEffect(()=>{if(!e)return;let y=!1;X0(e).then(v=>{y||l(v.asks||[])}).catch(()=>{});const w=FC(e,v=>{v.type==="notify"?p(v):v.type==="ask"&&v.ask&&v.ask.id?l(C=>C.some(b=>b.id===v.ask.id)?C:[...C,v.ask]):v.type==="ask-answered"&&v.id&&l(C=>C.filter(b=>b.id!==v.id))});return()=>{y=!0,w()}},[e,p]);const g=y=>l(w=>w.filter(v=>v.id!==y));return f.jsxs(f.Fragment,{children:[t.length>0&&f.jsx("div",{className:"nc-ntf-toasts",children:t.map(y=>f.jsx($C,{n:y,onClose:()=>_(y.key)},y.key))}),n.length>0&&!a&&f.jsxs("button",{type:"button",className:"nc-ask-badge",onClick:()=>h(!0),title:x("asks-title"),children:["? ",f.jsx("span",{className:"nc-ask-count",children:n.length})]}),n.length>0&&a&&f.jsxs("div",{className:"nc-ask-panel",children:[f.jsxs("div",{className:"nc-ask-panel-head",children:[f.jsx("b",{children:x("asks-title")}),f.jsx("span",{className:"nc-ask-count",children:n.length}),f.jsx("button",{type:"button",className:"nc-ntf-x",onClick:()=>h(!1),title:x("close"),children:f.jsx(ze,{name:"x",size:16})})]}),f.jsx("div",{className:"nc-ask-panel-body",children:n.map(y=>f.jsx(UC,{ask:y,token:e,onAnswered:g},y.id))})]})]})}const th=e=>Fi(Tr(e)).length===0;function VC(e,t,r,n){const[l,a]=z.useState([]),[h,d]=z.useState(!1),[_,p]=z.useState("idle"),[g,y]=z.useState(""),w=z.useRef([]),v=z.useRef(r),C=z.useRef(!1),b=z.useRef(!0);v.current=r,w.current=l;const E=z.useCallback((M,N=!0)=>{w.current=M,a(M);const j=M.find(I=>I.name===t);N&&j&&(b.current=!0,n(Tr(j.layout)),K1(t,j.layout)),U1(M.map(I=>I.name))},[t,n]),W=z.useCallback(async()=>{let M=await vc(e);const N=M.decks.find(j=>j.name==="main");if(M.decks.length===1&&N&&N.revision===0&&th(N.layout)){const j=$1(),I=Tr(Uh("main")||pl());if(!th(I)){const U=await Wo(e,"main",I,0);M.decks[0]=U}for(const U of j.filter(H=>H!=="main"))try{let H=await dp(e,U);const O=Tr(Uh(U)||pl());th(O)||(H=await Wo(e,U,O,H.revision)),M.decks.push(H)}catch{}M=await vc(e)}E(M.decks,!0),d(!0),y("")},[e,E]);z.useEffect(()=>{e&&W().catch(M=>y(String(M.message||M)))},[W,e]);const B=z.useCallback(async()=>{if(!h)return;const M=w.current.find(N=>N.name===t);if(!M)return y(`deck inesistente: ${t}`);p("saving");try{const N=await Wo(e,t,Tr(v.current),M.revision);E(w.current.map(j=>j.name===t?N:j),!1),C.current=!1,p("saved"),y(""),setTimeout(()=>p("idle"),1500)}catch(N){p("error"),y(String(N.message||N)),N.status===409&&N.data&&N.data.current&&E(w.current.map(j=>j.name===t?N.data.current:j),!1)}},[h,t,e,E]);z.useEffect(()=>{if(!h)return;if(b.current){b.current=!1;return}C.current=!0,p("saving");const M=setTimeout(B,650);return()=>clearTimeout(M)},[r,h,B]),z.useEffect(()=>{if(!h)return;const M=setInterval(async()=>{try{const N=await vc(e),j=w.current.find(H=>H.name===t),I=N.decks.find(H=>H.name===t),U=I&&(!j||I.revision>j.revision);E(N.decks,U&&!C.current)}catch{}},5e3);return()=>clearInterval(M)},[h,e,t,E]);const $=async M=>{const N=await dp(e,M);return E([...w.current,N],!1),N},P=async(M,N)=>{const j=w.current.find(U=>U.name===M);if(!j)throw new Error("deck inesistente");const I=await Q0(e,M,N,j.revision);return E(w.current.map(U=>U.name===M?I:U),!1),I},J=async M=>{const N=w.current.find(j=>j.name===M);if(!N)throw new Error("deck inesistente");await J0(e,M,N.revision),E(w.current.filter(j=>j.name!==M),!1)},A=async(M,N)=>{const j=w.current.find(U=>U.name===M);if(!j)throw new Error("deck inesistente");const I=await Wo(e,M,hg(Tr(j.layout),N),j.revision);return E(w.current.map(U=>U.name===M?I:U),!1),I};return{decks:l.map(M=>M.name),records:l,ready:h,saveState:_,error:g,setError:y,saveNow:B,add:$,rename:P,remove:J,addTileTo:A}}const qC="/sw.js",Vh="nc-sw-update";let qh=null,Yh=!1,Xh=null,vg=Object.freeze({needed:!1,kind:null,version:""}),yg=!1;function Sg(){typeof window<"u"&&window.dispatchEvent(new Event(Vh))}function wg(){const e=Xh||(Yh?{kind:"reload",version:""}:null);vg=Object.freeze({needed:!!e,kind:(e==null?void 0:e.kind)||null,version:(e==null?void 0:e.version)||""})}function Um(){return vg}function YC(e){return typeof window>"u"?()=>{}:(window.addEventListener(Vh,e),()=>window.removeEventListener(Vh,e))}function fu(e){Yh!==e&&(Yh=e,wg(),Sg())}function XC(e,t,r){let n=null;e&&t&&e!==t?n={kind:"install",version:e}:t&&r&&t!==r&&(n={kind:"reload",version:t});const l=JSON.stringify(n)===JSON.stringify(Xh);Xh=n,wg(),l||Sg()}function GC(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&fu(!0)})}function QC(){typeof navigator>"u"||!("serviceWorker"in navigator)||(navigator.serviceWorker.addEventListener("controllerchange",()=>{yg&&location.reload()}),navigator.serviceWorker.register(qC).then(e=>{qh=e,e.waiting&&fu(!0),e.addEventListener("updatefound",()=>{const t=e.installing;t&&GC(t)}),setInterval(()=>{e.update().catch(()=>{})},3600*1e3)}).catch(()=>{}))}function JC(){yg=!0,fu(!1);const e=qh&&qh.waiting;e?(e.postMessage({type:"SKIP_WAITING"}),setTimeout(()=>location.reload(),4e3)):location.reload()}const Cg=9,bg=24,xg="nc_side_w",Km="nc_side_min",ZC=240,Vm="(min-width:1024px) and (pointer:fine)";function eb(){const e=Number(localStorage.getItem(xg));return e>=180&&e<=480?e:ZC}function tb(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=Cg&&e<=bg?e:13}function ib(){const t=location.hash.replace(/^#/,"").match(/(?:^|&)token=([^&]+)/);if(t){const r=decodeURIComponent(t[1]);try{history.replaceState(null,"",location.pathname+location.search)}catch{}try{localStorage.setItem("nc_token",r)}catch{}return r}return sessionStorage.getItem("nc_token")||localStorage.getItem("nc_token")||""}function rb(e){try{return Tr(Uh(e))}catch{return pl()}}function qm(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function sb(){const[e,t]=z.useState(()=>window.matchMedia(Vm).matches);return z.useEffect(()=>{const r=window.matchMedia(Vm),n=l=>t(l.matches);return r.addEventListener("change",n),()=>r.removeEventListener("change",n)},[]),e}function Ym({session:e,node:t,token:r,readonly:n=!1,onBack:l}){Wt();const[a,h]=z.useState(!1),[d,_]=z.useState(()=>window.matchMedia("(pointer: coarse)").matches),[p,g]=z.useState(null),[y,w]=z.useState(tb),[v,C]=z.useState(""),b=N=>w(j=>{const I=Math.max(Cg,Math.min(bg,j+N));return localStorage.setItem("nc_fontsize",String(I)),I}),E=z.useRef(()=>{}),W=z.useRef(()=>{}),B=z.useRef(!1),[$,P]=z.useState(!1),[J,A]=z.useState(!1),M=()=>{B.current=!B.current,P(B.current)};return z.useEffect(()=>{let N=!0;const j=t?`/api/route/${t.split("/").map(encodeURIComponent).join("/")}/_`:"/api";async function I(){let H=null,O=null;try{const Z=await(await gt(`${j}/sessions`,r)).json();Array.isArray(Z.sessions)&&(H=Z.sessions.find(L=>L.name===e))}catch{}if(!t)try{const ee=await gl(r);ee.available&&Array.isArray(ee.cells)&&(O=ee.cells.find(Z=>Z.tmuxSession===e))}catch{}if(!N)return;let K="";O?K=`${O.engine}${O.key?`·${O.key}`:""}`:H&&(K=H.attached?`attached · ${qm(H.activity)}`:H.activity?qm(H.activity):""),C(K)}I();const U=setInterval(I,4e3);return()=>{N=!1,clearInterval(U)}},[e,t,r]),f.jsxs("div",{className:"nc-app",children:[f.jsxs("header",{className:"nc-bar nc-bar-single",children:[f.jsxs("button",{onClick:l,title:x("sessions"),children:[f.jsx(ze,{name:"chevronLeft",size:18}),f.jsx("span",{className:"nc-bar-label",children:x("sessions")})]}),f.jsxs("span",{className:"nc-bar-center",children:[f.jsx("b",{children:t?`${t}:${e}`:e}),v&&f.jsx("small",{className:"nc-bar-sub",children:v})]}),f.jsxs("span",{className:"nc-bar-right",children:[f.jsx("button",{onClick:()=>b(-1),title:x("zoom-out"),children:f.jsx(ze,{name:"zoomOut",size:18})}),f.jsx("button",{onClick:()=>b(1),title:x("zoom-in"),children:f.jsx(ze,{name:"zoomIn",size:18})}),f.jsx("button",{onClick:()=>_(N=>!N),title:x("composer"),children:f.jsx(ze,{name:"keyboard",size:20})}),f.jsx("button",{onClick:()=>h(N=>!N),title:x("files"),children:f.jsx(ze,{name:"folder",size:20})})]})]}),f.jsx("div",{className:"nc-termwrap",children:f.jsx(ng,{session:e,node:t,token:r,readonly:n,takeSize:!0,sendRef:E,actionRef:W,ctrlRef:B,setCtrlArmed:P,onFiles:g,fontSize:y,selectionMode:J,onSelectionModeChange:A})}),f.jsx(C1,{onKeyboard:()=>_(N=>!N),send:N=>E.current(N),action:N=>W.current(N),ctrlArmed:$,onCtrl:M,selectionMode:J,onSelectionMode:A}),d&&f.jsx(lg,{send:N=>E.current(N),token:r,session:e,node:t}),a&&f.jsx(og,{session:e,node:t,token:r,filesEvent:p,onClose:()=>h(!1)})]})}function nb(){Wt();const[e,t]=z.useState(ib()),[r,n]=z.useState(!1),l=sb(),[a]=z.useState(()=>W1(typeof location<"u"?location.pathname:"/")),h=a===Xt,[d,_]=z.useState(null),p=ue=>_(fl(ue)),[g,y]=z.useState([]),[w,v]=z.useState([]),[C,b]=z.useState([]),[E,W]=z.useState(()=>rb(a)),B=VC(e,a,E,W),$=B.decks.length?B.decks:[Xt],[P,J]=z.useState(null),[A,M]=z.useState(null),N=ue=>M(fl(ue)),j=p_(e,l),[I,U]=z.useState(null),[H,O]=z.useState(!1),[K,ee]=z.useState(["shell","claude","codex-vl","pi"]),[Z,L]=z.useState(eb),[D,te]=z.useState(!h),[X,R]=z.useState(()=>h?localStorage.getItem(Km)==="1":!0),[Q,ce]=z.useState(!1),[he,pe]=z.useState(!1),[ve,we]=z.useState(!1);z.useEffect(()=>{try{localStorage.setItem(xg,String(Z))}catch{}},[Z]),z.useEffect(()=>{try{localStorage.setItem(Km,X?"1":"")}catch{}},[X]),z.useEffect(()=>{if(!e)return;let ue=!1;return Promise.all([s_(e),gt("/api/config",e).then(Re=>Re.json())]).then(([Re,Mi])=>{ue||(we(!!Mi.readonlyDefault),Re.firstRun===!0&&!Mi.readonlyDefault&&pe(!0))}).catch(()=>{}),()=>{ue=!0}},[e]);const V=z.useCallback(async()=>{try{const Re=await(await gt("/api/sessions",e)).json();Re.error||y(Re.sessions||[])}catch{}try{const ue=await gl(e);v(ue.available?ue.cells||[]:[]),b(ue.available?ue.engines||[]:[])}catch{v([]),b([])}},[e]);z.useEffect(()=>{if(!l)return;V();const ue=setInterval(V,4e3);return()=>clearInterval(ue)},[l,V]),z.useEffect(()=>{let ue=!1;return gt("/api/config",e).then(Re=>Re.json()).then(Re=>{!ue&&Array.isArray(Re.presets)&&Re.presets.length&&ee(Re.presets),ue||XC(Re.version,Re.uiVersion,"0.8.2")}).catch(()=>{}),()=>{ue=!0}},[e]);const re=new Set([...g.map(ue=>ue.name),...j.flatMap(ue=>ue.sessions.map(Re=>Re.key))]),ke=Fi(E),ge=ue=>W(Re=>hg(Re,ue)),Ae=async(ue,Re=[])=>{try{await i_(e,ue,Re)}catch{return}const Mi=Re.length?`${Re.join("/")}:${ue}`:ue;W(ws=>_l(ws,Mi)),V()},xe=async ue=>{if(!I)return;const{cell:Re}=I;ue.action==="up"?await Zm(e,{cell:Re,engine:ue.engine,model:ue.model||"",boot:!!ue.boot}):await e_(e,{cell:Re,boot:!!ue.boot}),V()},Tt=async(ue,Re=[])=>{await t_(e,ue,Re),V()},Ri=ue=>{try{const Re=window.open(Go(ue,e),"_blank");return Re&&(Re.opener=null),!!Re}catch{return!1}},$i=ue=>location.assign(Go(ue,e)),vs=async ue=>{await B.add(ue),$i(ue)},Pn=async(ue,Re)=>{await B.rename(ue,Re),ue===a&&location.assign(Go(Re,e))},ys=async ue=>{await B.remove(ue),ue===a&&location.assign(Go(Xt,e))},_r=async(ue,Re)=>{!Re||Re===a||(await B.addTileTo(Re,ue),W(Mi=>_l(Mi,ue)))};if(!e)return f.jsxs("div",{className:"nc-auth",children:[f.jsx("p",{children:x("auth-prompt")}),f.jsx("input",{onChange:ue=>t(ue.target.value.trim()),placeholder:"token"}),f.jsxs("label",{children:[f.jsx("input",{type:"checkbox",checked:r,onChange:ue=>n(ue.target.checked)})," ",x("remember-device")]}),f.jsx("button",{onClick:()=>{(r?localStorage:sessionStorage).setItem("nc_token",e)},children:"ok"})]});const pi=f.jsxs(f.Fragment,{children:[Q&&f.jsx(IC,{token:e,onClose:()=>ce(!1)}),he&&f.jsx(zC,{token:e,onDone:()=>pe(!1)}),f.jsx(KC,{token:e})]});if(!l)return d?f.jsxs(f.Fragment,{children:[f.jsx(Ym,{session:d.session,node:d.node,token:e,readonly:ve,onBack:()=>_(null)}),pi]}):f.jsxs(f.Fragment,{children:[f.jsx(oy,{onPick:p,token:e,onSettings:()=>ce(!0)}),pi]});const Ss=h||!D;return f.jsxs("div",{className:"nc-workspace",children:[!h&&f.jsx("button",{className:"nc-side-show",title:x("toggle-sidebar"),onClick:()=>te(ue=>!ue),children:"☰"}),Ss&&f.jsx(R1,{sessions:g,cells:w,activeSessions:ke,nodeGroups:j,onPick:N,onAddTile:ge,onPower:U,onKill:Ae,onNew:()=>O(!0),onSettings:()=>ce(!0),width:Z,collapsed:X,onResize:L,onToggleCollapse:()=>R(ue=>!ue)}),f.jsxs("div",{className:"nc-workspace-main",children:[f.jsx(V1,{decks:$,currentDeck:a,onCreate:vs,onRename:Pn,onDelete:ys,onOpenWindow:Ri,onNavigate:$i,saveState:B.saveState,error:B.error}),f.jsx(I1,{layout:E,onLayoutChange:W,token:e,readonly:ve,sessionsAlive:re,focusSession:P,onFocus:J,onOpenSingle:N,decks:$,currentDeck:a,onSendToDeck:_r})]}),A&&f.jsx("div",{className:"nc-single-overlay",children:f.jsx(Ym,{session:A.session,node:A.node,token:e,readonly:ve,onBack:()=>M(null)})}),I&&f.jsx(d_,{cell:I,engines:C,onConfirm:xe,onClose:()=>U(null)}),H&&f.jsx(f_,{presets:K,targets:j.filter(ue=>ue.status==="up").map(ue=>({route:ue.route,label:ue.label||ue.name})),token:e,onCreate:Tt,onClose:()=>O(!1)}),pi]})}function ob(){Wt();const e=z.useSyncExternalStore(YC,Um,Um);if(!e.needed)return null;const t=e.kind==="install"?x("install-version-mismatch").replace("{v}",e.version):x("update-available").replace("{v}",e.version).replace(" "," ").trim();return f.jsxs("div",{className:"nc-update",role:"status","aria-live":"polite",children:[f.jsx("span",{className:"nc-update-msg",children:t}),e.kind==="reload"&&f.jsx("button",{className:"nc-update-btn",onClick:JC,children:x("reload")})]})}QC();P0.createRoot(document.getElementById("root")).render(f.jsxs(x0.StrictMode,{children:[f.jsx(nb,{}),f.jsx(ob,{})]}));
|