@mmmbuto/nexuscrew 0.8.40 → 0.8.42

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.
@@ -0,0 +1,93 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();function Th(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Du={exports:{}},yo={},Mu={exports:{}},nt={};/**
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 Vm;function Wb(){if(Vm)return nt;Vm=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),x=Symbol.iterator;function w(T){return T===null||typeof T!="object"?null:(T=x&&T[x]||T["@@iterator"],typeof T=="function"?T:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,b={};function C(T,U,Z){this.props=T,this.context=U,this.refs=b,this.updater=Z||S}C.prototype.isReactComponent={},C.prototype.setState=function(T,U){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,U,"setState")},C.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function R(){}R.prototype=C.prototype;function k(T,U,Z){this.props=T,this.context=U,this.refs=b,this.updater=Z||S}var F=k.prototype=new R;F.constructor=k,y(F,C.prototype),F.isPureReactComponent=!0;var B=Array.isArray,V=Object.prototype.hasOwnProperty,G={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function te(T,U,Z){var ae,he={},pe=null,Q=null;if(U!=null)for(ae in U.ref!==void 0&&(Q=U.ref),U.key!==void 0&&(pe=""+U.key),U)V.call(U,ae)&&!z.hasOwnProperty(ae)&&(he[ae]=U[ae]);var ne=arguments.length-2;if(ne===1)he.children=Z;else if(1<ne){for(var fe=Array(ne),Se=0;Se<ne;Se++)fe[Se]=arguments[Se+2];he.children=fe}if(T&&T.defaultProps)for(ae in ne=T.defaultProps,ne)he[ae]===void 0&&(he[ae]=ne[ae]);return{$$typeof:e,type:T,key:pe,ref:Q,props:he,_owner:G.current}}function H(T,U){return{$$typeof:e,type:T.type,key:U,ref:T.ref,props:T.props,_owner:T._owner}}function X(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function A(T){var U={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(Z){return U[Z]})}var M=/\/+/g;function E(T,U){return typeof T=="object"&&T!==null&&T.key!=null?A(""+T.key):U.toString(36)}function D(T,U,Z,ae,he){var pe=typeof T;(pe==="undefined"||pe==="boolean")&&(T=null);var Q=!1;if(T===null)Q=!0;else switch(pe){case"string":case"number":Q=!0;break;case"object":switch(T.$$typeof){case e:case t:Q=!0}}if(Q)return Q=T,he=he(Q),T=ae===""?"."+E(Q,0):ae,B(he)?(Z="",T!=null&&(Z=T.replace(M,"$&/")+"/"),D(he,U,Z,"",function(Se){return Se})):he!=null&&(X(he)&&(he=H(he,Z+(!he.key||Q&&Q.key===he.key?"":(""+he.key).replace(M,"$&/")+"/")+T)),U.push(he)),1;if(Q=0,ae=ae===""?".":ae+":",B(T))for(var ne=0;ne<T.length;ne++){pe=T[ne];var fe=ae+E(pe,ne);Q+=D(pe,U,Z,fe,he)}else if(fe=w(T),typeof fe=="function")for(T=fe.call(T),ne=0;!(pe=T.next()).done;)pe=pe.value,fe=ae+E(pe,ne++),Q+=D(pe,U,Z,fe,he);else if(pe==="object")throw U=String(T),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.");return Q}function O(T,U,Z){if(T==null)return T;var ae=[],he=0;return D(T,ae,"","",function(pe){return U.call(Z,pe,he++)}),ae}function P(T){if(T._status===-1){var U=T._result;U=U(),U.then(function(Z){(T._status===0||T._status===-1)&&(T._status=1,T._result=Z)},function(Z){(T._status===0||T._status===-1)&&(T._status=2,T._result=Z)}),T._status===-1&&(T._status=0,T._result=U)}if(T._status===1)return T._result.default;throw T._result}var $={current:null},L={transition:null},q={ReactCurrentDispatcher:$,ReactCurrentBatchConfig:L,ReactCurrentOwner:G};function I(){throw Error("act(...) is not supported in production builds of React.")}return nt.Children={map:O,forEach:function(T,U,Z){O(T,function(){U.apply(this,arguments)},Z)},count:function(T){var U=0;return O(T,function(){U++}),U},toArray:function(T){return O(T,function(U){return U})||[]},only:function(T){if(!X(T))throw Error("React.Children.only expected to receive a single React element child.");return T}},nt.Component=C,nt.Fragment=n,nt.Profiler=o,nt.PureComponent=k,nt.StrictMode=r,nt.Suspense=f,nt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=q,nt.act=I,nt.cloneElement=function(T,U,Z){if(T==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+T+".");var ae=y({},T.props),he=T.key,pe=T.ref,Q=T._owner;if(U!=null){if(U.ref!==void 0&&(pe=U.ref,Q=G.current),U.key!==void 0&&(he=""+U.key),T.type&&T.type.defaultProps)var ne=T.type.defaultProps;for(fe in U)V.call(U,fe)&&!z.hasOwnProperty(fe)&&(ae[fe]=U[fe]===void 0&&ne!==void 0?ne[fe]:U[fe])}var fe=arguments.length-2;if(fe===1)ae.children=Z;else if(1<fe){ne=Array(fe);for(var Se=0;Se<fe;Se++)ne[Se]=arguments[Se+2];ae.children=ne}return{$$typeof:e,type:T.type,key:he,ref:pe,props:ae,_owner:Q}},nt.createContext=function(T){return T={$$typeof:u,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},T.Provider={$$typeof:a,_context:T},T.Consumer=T},nt.createElement=te,nt.createFactory=function(T){var U=te.bind(null,T);return U.type=T,U},nt.createRef=function(){return{current:null}},nt.forwardRef=function(T){return{$$typeof:h,render:T}},nt.isValidElement=X,nt.lazy=function(T){return{$$typeof:v,_payload:{_status:-1,_result:T},_init:P}},nt.memo=function(T,U){return{$$typeof:p,type:T,compare:U===void 0?null:U}},nt.startTransition=function(T){var U=L.transition;L.transition={};try{T()}finally{L.transition=U}},nt.unstable_act=I,nt.useCallback=function(T,U){return $.current.useCallback(T,U)},nt.useContext=function(T){return $.current.useContext(T)},nt.useDebugValue=function(){},nt.useDeferredValue=function(T){return $.current.useDeferredValue(T)},nt.useEffect=function(T,U){return $.current.useEffect(T,U)},nt.useId=function(){return $.current.useId()},nt.useImperativeHandle=function(T,U,Z){return $.current.useImperativeHandle(T,U,Z)},nt.useInsertionEffect=function(T,U){return $.current.useInsertionEffect(T,U)},nt.useLayoutEffect=function(T,U){return $.current.useLayoutEffect(T,U)},nt.useMemo=function(T,U){return $.current.useMemo(T,U)},nt.useReducer=function(T,U,Z){return $.current.useReducer(T,U,Z)},nt.useRef=function(T){return $.current.useRef(T)},nt.useState=function(T){return $.current.useState(T)},nt.useSyncExternalStore=function(T,U,Z){return $.current.useSyncExternalStore(T,U,Z)},nt.useTransition=function(){return $.current.useTransition()},nt.version="18.3.1",nt}var Ym;function Dh(){return Ym||(Ym=1,Mu.exports=Wb()),Mu.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 Gm;function Ub(){if(Gm)return yo;Gm=1;var e=Dh(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(h,f,p){var v,x={},w=null,S=null;p!==void 0&&(w=""+p),f.key!==void 0&&(w=""+f.key),f.ref!==void 0&&(S=f.ref);for(v in f)r.call(f,v)&&!a.hasOwnProperty(v)&&(x[v]=f[v]);if(h&&h.defaultProps)for(v in f=h.defaultProps,f)x[v]===void 0&&(x[v]=f[v]);return{$$typeof:t,type:h,key:w,ref:S,props:x,_owner:o.current}}return yo.Fragment=n,yo.jsx=u,yo.jsxs=u,yo}var Xm;function Kb(){return Xm||(Xm=1,Du.exports=Ub()),Du.exports}var c=Kb(),N=Dh();const qb=Th(N);var tl={},Au={exports:{}},Pn={},Iu={exports:{}},Bu={};/**
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 Jm;function Vb(){return Jm||(Jm=1,(function(e){function t(L,q){var I=L.length;L.push(q);e:for(;0<I;){var T=I-1>>>1,U=L[T];if(0<o(U,q))L[T]=q,L[I]=U,I=T;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var q=L[0],I=L.pop();if(I!==q){L[0]=I;e:for(var T=0,U=L.length,Z=U>>>1;T<Z;){var ae=2*(T+1)-1,he=L[ae],pe=ae+1,Q=L[pe];if(0>o(he,I))pe<U&&0>o(Q,he)?(L[T]=Q,L[pe]=I,T=pe):(L[T]=he,L[ae]=I,T=ae);else if(pe<U&&0>o(Q,I))L[T]=Q,L[pe]=I,T=pe;else break e}}return q}function o(L,q){var I=L.sortIndex-q.sortIndex;return I!==0?I:L.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var f=[],p=[],v=1,x=null,w=3,S=!1,y=!1,b=!1,C=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function F(L){for(var q=n(p);q!==null;){if(q.callback===null)r(p);else if(q.startTime<=L)r(p),q.sortIndex=q.expirationTime,t(f,q);else break;q=n(p)}}function B(L){if(b=!1,F(L),!y)if(n(f)!==null)y=!0,P(V);else{var q=n(p);q!==null&&$(B,q.startTime-L)}}function V(L,q){y=!1,b&&(b=!1,R(te),te=-1),S=!0;var I=w;try{for(F(q),x=n(f);x!==null&&(!(x.expirationTime>q)||L&&!A());){var T=x.callback;if(typeof T=="function"){x.callback=null,w=x.priorityLevel;var U=T(x.expirationTime<=q);q=e.unstable_now(),typeof U=="function"?x.callback=U:x===n(f)&&r(f),F(q)}else r(f);x=n(f)}if(x!==null)var Z=!0;else{var ae=n(p);ae!==null&&$(B,ae.startTime-q),Z=!1}return Z}finally{x=null,w=I,S=!1}}var G=!1,z=null,te=-1,H=5,X=-1;function A(){return!(e.unstable_now()-X<H)}function M(){if(z!==null){var L=e.unstable_now();X=L;var q=!0;try{q=z(!0,L)}finally{q?E():(G=!1,z=null)}}else G=!1}var E;if(typeof k=="function")E=function(){k(M)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,O=D.port2;D.port1.onmessage=M,E=function(){O.postMessage(null)}}else E=function(){C(M,0)};function P(L){z=L,G||(G=!0,E())}function $(L,q){te=C(function(){L(e.unstable_now())},q)}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(L){L.callback=null},e.unstable_continueExecution=function(){y||S||(y=!0,P(V))},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(L){switch(w){case 1:case 2:case 3:var q=3;break;default:q=w}var I=w;w=q;try{return L()}finally{w=I}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(L,q){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var I=w;w=L;try{return q()}finally{w=I}},e.unstable_scheduleCallback=function(L,q,I){var T=e.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?T+I:T):I=T,L){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=I+U,L={id:v++,callback:q,priorityLevel:L,startTime:I,expirationTime:U,sortIndex:-1},I>T?(L.sortIndex=I,t(p,L),n(f)===null&&L===n(p)&&(b?(R(te),te=-1):b=!0,$(B,I-T))):(L.sortIndex=U,t(f,L),y||S||(y=!0,P(V))),L},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(L){var q=w;return function(){var I=w;w=q;try{return L.apply(this,arguments)}finally{w=I}}}})(Bu)),Bu}var Qm;function Yb(){return Qm||(Qm=1,Iu.exports=Vb()),Iu.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 Zm;function Gb(){if(Zm)return Pn;Zm=1;var e=Dh(),t=Yb();function n(i){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+i,l=1;l<arguments.length;l++)s+="&args[]="+encodeURIComponent(arguments[l]);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 r=new Set,o={};function a(i,s){u(i,s),u(i+"Capture",s)}function u(i,s){for(o[i]=s,i=0;i<s.length;i++)r.add(s[i])}var h=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=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]*$/,v={},x={};function w(i){return f.call(x,i)?!0:f.call(v,i)?!1:p.test(i)?x[i]=!0:(v[i]=!0,!1)}function S(i,s,l,d){if(l!==null&&l.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return d?!1:l!==null?!l.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function y(i,s,l,d){if(s===null||typeof s>"u"||S(i,s,l,d))return!0;if(d)return!1;if(l!==null)switch(l.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,l,d,m,_,j){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=d,this.attributeNamespace=m,this.mustUseProperty=l,this.propertyName=i,this.type=s,this.sanitizeURL=_,this.removeEmptyString=j}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){C[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];C[s]=new b(s,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){C[i]=new b(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){C[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){C[i]=new b(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){C[i]=new b(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){C[i]=new b(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){C[i]=new b(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){C[i]=new b(i,5,!1,i.toLowerCase(),null,!1,!1)});var R=/[\-:]([a-z])/g;function k(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(R,k);C[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(R,k);C[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(R,k);C[s]=new b(s,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){C[i]=new b(i,1,!1,i.toLowerCase(),null,!1,!1)}),C.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){C[i]=new b(i,1,!1,i.toLowerCase(),null,!0,!0)});function F(i,s,l,d){var m=C.hasOwnProperty(s)?C[s]:null;(m!==null?m.type!==0:d||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(y(s,l,m,d)&&(l=null),d||m===null?w(s)&&(l===null?i.removeAttribute(s):i.setAttribute(s,""+l)):m.mustUseProperty?i[m.propertyName]=l===null?m.type===3?!1:"":l:(s=m.attributeName,d=m.attributeNamespace,l===null?i.removeAttribute(s):(m=m.type,l=m===3||m===4&&l===!0?"":""+l,d?i.setAttributeNS(d,s,l):i.setAttribute(s,l))))}var B=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,V=Symbol.for("react.element"),G=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),te=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),X=Symbol.for("react.provider"),A=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),$=Symbol.for("react.offscreen"),L=Symbol.iterator;function q(i){return i===null||typeof i!="object"?null:(i=L&&i[L]||i["@@iterator"],typeof i=="function"?i:null)}var I=Object.assign,T;function U(i){if(T===void 0)try{throw Error()}catch(l){var s=l.stack.trim().match(/\n( *(at )?)/);T=s&&s[1]||""}return`
34
+ `+T+i}var Z=!1;function ae(i,s){if(!i||Z)return"";Z=!0;var l=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(ce){var d=ce}Reflect.construct(i,[],s)}else{try{s.call()}catch(ce){d=ce}i.call(s.prototype)}else{try{throw Error()}catch(ce){d=ce}i()}}catch(ce){if(ce&&d&&typeof ce.stack=="string"){for(var m=ce.stack.split(`
35
+ `),_=d.stack.split(`
36
+ `),j=m.length-1,K=_.length-1;1<=j&&0<=K&&m[j]!==_[K];)K--;for(;1<=j&&0<=K;j--,K--)if(m[j]!==_[K]){if(j!==1||K!==1)do if(j--,K--,0>K||m[j]!==_[K]){var J=`
37
+ `+m[j].replace(" at new "," at ");return i.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",i.displayName)),J}while(1<=j&&0<=K);break}}}finally{Z=!1,Error.prepareStackTrace=l}return(i=i?i.displayName||i.name:"")?U(i):""}function he(i){switch(i.tag){case 5:return U(i.type);case 16:return U("Lazy");case 13:return U("Suspense");case 19:return U("SuspenseList");case 0:case 2:case 15:return i=ae(i.type,!1),i;case 11:return i=ae(i.type.render,!1),i;case 1:return i=ae(i.type,!0),i;default:return""}}function pe(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 z:return"Fragment";case G:return"Portal";case H:return"Profiler";case te:return"StrictMode";case E:return"Suspense";case D:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case A:return(i.displayName||"Context")+".Consumer";case X:return(i._context.displayName||"Context")+".Provider";case M:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case O:return s=i.displayName||null,s!==null?s:pe(i.type)||"Memo";case P:s=i._payload,i=i._init;try{return pe(i(s))}catch{}}return null}function Q(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 pe(s);case 8:return s===te?"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 ne(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function fe(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Se(i){var s=fe(i)?"checked":"value",l=Object.getOwnPropertyDescriptor(i.constructor.prototype,s),d=""+i[s];if(!i.hasOwnProperty(s)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var m=l.get,_=l.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return m.call(this)},set:function(j){d=""+j,_.call(this,j)}}),Object.defineProperty(i,s,{enumerable:l.enumerable}),{getValue:function(){return d},setValue:function(j){d=""+j},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function Ze(i){i._valueTracker||(i._valueTracker=Se(i))}function $e(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var l=s.getValue(),d="";return i&&(d=fe(i)?i.checked?"true":"false":i.value),i=d,i!==l?(s.setValue(i),!0):!1}function He(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 vt(i,s){var l=s.checked;return I({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??i._wrapperState.initialChecked})}function Xe(i,s){var l=s.defaultValue==null?"":s.defaultValue,d=s.checked!=null?s.checked:s.defaultChecked;l=ne(s.value!=null?s.value:l),i._wrapperState={initialChecked:d,initialValue:l,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function St(i,s){s=s.checked,s!=null&&F(i,"checked",s,!1)}function Et(i,s){St(i,s);var l=ne(s.value),d=s.type;if(l!=null)d==="number"?(l===0&&i.value===""||i.value!=l)&&(i.value=""+l):i.value!==""+l&&(i.value=""+l);else if(d==="submit"||d==="reset"){i.removeAttribute("value");return}s.hasOwnProperty("value")?ct(i,s.type,l):s.hasOwnProperty("defaultValue")&&ct(i,s.type,ne(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(i.defaultChecked=!!s.defaultChecked)}function rt(i,s,l){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var d=s.type;if(!(d!=="submit"&&d!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+i._wrapperState.initialValue,l||s===i.value||(i.value=s),i.defaultValue=s}l=i.name,l!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,l!==""&&(i.name=l)}function ct(i,s,l){(s!=="number"||He(i.ownerDocument)!==i)&&(l==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+l&&(i.defaultValue=""+l))}var ot=Array.isArray;function ut(i,s,l,d){if(i=i.options,s){s={};for(var m=0;m<l.length;m++)s["$"+l[m]]=!0;for(l=0;l<i.length;l++)m=s.hasOwnProperty("$"+i[l].value),i[l].selected!==m&&(i[l].selected=m),m&&d&&(i[l].defaultSelected=!0)}else{for(l=""+ne(l),s=null,m=0;m<i.length;m++){if(i[m].value===l){i[m].selected=!0,d&&(i[m].defaultSelected=!0);return}s!==null||i[m].disabled||(s=i[m])}s!==null&&(s.selected=!0)}}function dt(i,s){if(s.dangerouslySetInnerHTML!=null)throw Error(n(91));return I({},s,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function le(i,s){var l=s.value;if(l==null){if(l=s.children,s=s.defaultValue,l!=null){if(s!=null)throw Error(n(92));if(ot(l)){if(1<l.length)throw Error(n(93));l=l[0]}s=l}s==null&&(s=""),l=s}i._wrapperState={initialValue:ne(l)}}function xe(i,s){var l=ne(s.value),d=ne(s.defaultValue);l!=null&&(l=""+l,l!==i.value&&(i.value=l),s.defaultValue==null&&i.defaultValue!==l&&(i.defaultValue=l)),d!=null&&(i.defaultValue=""+d)}function ze(i){var s=i.textContent;s===i._wrapperState.initialValue&&s!==""&&s!==null&&(i.value=s)}function Ie(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 ue(i,s){return i==null||i==="http://www.w3.org/1999/xhtml"?Ie(s):i==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var Y,ie=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,l,d,m){MSApp.execUnsafeLocalFunction(function(){return i(s,l,d,m)})}:i})(function(i,s){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=s;else{for(Y=Y||document.createElement("div"),Y.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Y.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;s.firstChild;)i.appendChild(s.firstChild)}});function W(i,s){if(s){var l=i.firstChild;if(l&&l===i.lastChild&&l.nodeType===3){l.nodeValue=s;return}}i.textContent=s}var se={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},ve=["Webkit","ms","Moz","O"];Object.keys(se).forEach(function(i){ve.forEach(function(s){s=s+i.charAt(0).toUpperCase()+i.substring(1),se[s]=se[i]})});function ke(i,s,l){return s==null||typeof s=="boolean"||s===""?"":l||typeof s!="number"||s===0||se.hasOwnProperty(i)&&se[i]?(""+s).trim():s+"px"}function Re(i,s){i=i.style;for(var l in s)if(s.hasOwnProperty(l)){var d=l.indexOf("--")===0,m=ke(l,s[l],d);l==="float"&&(l="cssFloat"),d?i.setProperty(l,m):i[l]=m}}var we=I({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 je(i,s){if(s){if(we[i]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(n(137,i));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(n(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(n(61))}if(s.style!=null&&typeof s.style!="object")throw Error(n(62))}}function st(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 It=null;function Oe(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var _n=null,bt=null,Ye=null;function Gt(i){if(i=io(i)){if(typeof _n!="function")throw Error(n(280));var s=i.stateNode;s&&(s=ga(s),_n(i.stateNode,i.type,s))}}function Hn(i){bt?Ye?Ye.push(i):Ye=[i]:bt=i}function li(){if(bt){var i=bt,s=Ye;if(Ye=bt=null,Gt(i),s)for(i=0;i<s.length;i++)Gt(s[i])}}function de(i,s){return i(s)}function Ne(){}var Ke=!1;function Nt(i,s,l){if(Ke)return i(s,l);Ke=!0;try{return de(i,s,l)}finally{Ke=!1,(bt!==null||Ye!==null)&&(Ne(),li())}}function pt(i,s){var l=i.stateNode;if(l===null)return null;var d=ga(l);if(d===null)return null;l=d[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":(d=!d.disabled)||(i=i.type,d=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!d;break e;default:i=!1}if(i)return null;if(l&&typeof l!="function")throw Error(n(231,s,typeof l));return l}var Wn=!1;if(h)try{var hn={};Object.defineProperty(hn,"passive",{get:function(){Wn=!0}}),window.addEventListener("test",hn,hn),window.removeEventListener("test",hn,hn)}catch{Wn=!1}function Or(i,s,l,d,m,_,j,K,J){var ce=Array.prototype.slice.call(arguments,3);try{s.apply(l,ce)}catch(ye){this.onError(ye)}}var Ii=!1,Xt=null,_s=!1,Bi=null,ys={onError:function(i){Ii=!0,Xt=i}};function Go(i,s,l,d,m,_,j,K,J){Ii=!1,Xt=null,Or.apply(ys,arguments)}function me(i,s,l,d,m,_,j,K,J){if(Go.apply(this,arguments),Ii){if(Ii){var ce=Xt;Ii=!1,Xt=null}else throw Error(n(198));_s||(_s=!0,Bi=ce)}}function Fe(i){var s=i,l=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(l=s.return),i=s.return;while(i)}return s.tag===3?l:null}function Ge(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 Je(i){if(Fe(i)!==i)throw Error(n(188))}function xt(i){var s=i.alternate;if(!s){if(s=Fe(i),s===null)throw Error(n(188));return s!==i?null:i}for(var l=i,d=s;;){var m=l.return;if(m===null)break;var _=m.alternate;if(_===null){if(d=m.return,d!==null){l=d;continue}break}if(m.child===_.child){for(_=m.child;_;){if(_===l)return Je(m),i;if(_===d)return Je(m),s;_=_.sibling}throw Error(n(188))}if(l.return!==d.return)l=m,d=_;else{for(var j=!1,K=m.child;K;){if(K===l){j=!0,l=m,d=_;break}if(K===d){j=!0,d=m,l=_;break}K=K.sibling}if(!j){for(K=_.child;K;){if(K===l){j=!0,l=_,d=m;break}if(K===d){j=!0,d=_,l=m;break}K=K.sibling}if(!j)throw Error(n(189))}}if(l.alternate!==d)throw Error(n(190))}if(l.tag!==3)throw Error(n(188));return l.stateNode.current===l?i:s}function Rt(i){return i=xt(i),i!==null?an(i):null}function an(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var s=an(i);if(s!==null)return s;i=i.sibling}return null}var Oi=t.unstable_scheduleCallback,Ys=t.unstable_cancelCallback,eS=t.unstable_shouldYield,tS=t.unstable_requestPaint,Bt=t.unstable_now,nS=t.unstable_getCurrentPriorityLevel,Zl=t.unstable_ImmediatePriority,bf=t.unstable_UserBlockingPriority,Xo=t.unstable_NormalPriority,iS=t.unstable_LowPriority,xf=t.unstable_IdlePriority,Jo=null,ci=null;function sS(i){if(ci&&typeof ci.onCommitFiberRoot=="function")try{ci.onCommitFiberRoot(Jo,i,void 0,(i.current.flags&128)===128)}catch{}}var ei=Math.clz32?Math.clz32:aS,rS=Math.log,oS=Math.LN2;function aS(i){return i>>>=0,i===0?32:31-(rS(i)/oS|0)|0}var Qo=64,Zo=4194304;function zr(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 ea(i,s){var l=i.pendingLanes;if(l===0)return 0;var d=0,m=i.suspendedLanes,_=i.pingedLanes,j=l&268435455;if(j!==0){var K=j&~m;K!==0?d=zr(K):(_&=j,_!==0&&(d=zr(_)))}else j=l&~m,j!==0?d=zr(j):_!==0&&(d=zr(_));if(d===0)return 0;if(s!==0&&s!==d&&(s&m)===0&&(m=d&-d,_=s&-s,m>=_||m===16&&(_&4194240)!==0))return s;if((d&4)!==0&&(d|=l&16),s=i.entangledLanes,s!==0)for(i=i.entanglements,s&=d;0<s;)l=31-ei(s),m=1<<l,d|=i[l],s&=~m;return d}function lS(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 cS(i,s){for(var l=i.suspendedLanes,d=i.pingedLanes,m=i.expirationTimes,_=i.pendingLanes;0<_;){var j=31-ei(_),K=1<<j,J=m[j];J===-1?((K&l)===0||(K&d)!==0)&&(m[j]=lS(K,s)):J<=s&&(i.expiredLanes|=K),_&=~K}}function ec(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function kf(){var i=Qo;return Qo<<=1,(Qo&4194240)===0&&(Qo=64),i}function tc(i){for(var s=[],l=0;31>l;l++)s.push(i);return s}function Fr(i,s,l){i.pendingLanes|=s,s!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,s=31-ei(s),i[s]=l}function uS(i,s){var l=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 d=i.eventTimes;for(i=i.expirationTimes;0<l;){var m=31-ei(l),_=1<<m;s[m]=0,d[m]=-1,i[m]=-1,l&=~_}}function nc(i,s){var l=i.entangledLanes|=s;for(i=i.entanglements;l;){var d=31-ei(l),m=1<<d;m&s|i[d]&s&&(i[d]|=s),l&=~m}}var ht=0;function Cf(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var Ef,ic,Nf,Rf,jf,sc=!1,ta=[],zi=null,Fi=null,$i=null,$r=new Map,Hr=new Map,Hi=[],dS="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 Pf(i,s){switch(i){case"focusin":case"focusout":zi=null;break;case"dragenter":case"dragleave":Fi=null;break;case"mouseover":case"mouseout":$i=null;break;case"pointerover":case"pointerout":$r.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hr.delete(s.pointerId)}}function Wr(i,s,l,d,m,_){return i===null||i.nativeEvent!==_?(i={blockedOn:s,domEventName:l,eventSystemFlags:d,nativeEvent:_,targetContainers:[m]},s!==null&&(s=io(s),s!==null&&ic(s)),i):(i.eventSystemFlags|=d,s=i.targetContainers,m!==null&&s.indexOf(m)===-1&&s.push(m),i)}function hS(i,s,l,d,m){switch(s){case"focusin":return zi=Wr(zi,i,s,l,d,m),!0;case"dragenter":return Fi=Wr(Fi,i,s,l,d,m),!0;case"mouseover":return $i=Wr($i,i,s,l,d,m),!0;case"pointerover":var _=m.pointerId;return $r.set(_,Wr($r.get(_)||null,i,s,l,d,m)),!0;case"gotpointercapture":return _=m.pointerId,Hr.set(_,Wr(Hr.get(_)||null,i,s,l,d,m)),!0}return!1}function Lf(i){var s=ws(i.target);if(s!==null){var l=Fe(s);if(l!==null){if(s=l.tag,s===13){if(s=Ge(l),s!==null){i.blockedOn=s,jf(i.priority,function(){Nf(l)});return}}else if(s===3&&l.stateNode.current.memoizedState.isDehydrated){i.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}i.blockedOn=null}function na(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var l=oc(i.domEventName,i.eventSystemFlags,s[0],i.nativeEvent);if(l===null){l=i.nativeEvent;var d=new l.constructor(l.type,l);It=d,l.target.dispatchEvent(d),It=null}else return s=io(l),s!==null&&ic(s),i.blockedOn=l,!1;s.shift()}return!0}function Tf(i,s,l){na(i)&&l.delete(s)}function fS(){sc=!1,zi!==null&&na(zi)&&(zi=null),Fi!==null&&na(Fi)&&(Fi=null),$i!==null&&na($i)&&($i=null),$r.forEach(Tf),Hr.forEach(Tf)}function Ur(i,s){i.blockedOn===s&&(i.blockedOn=null,sc||(sc=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,fS)))}function Kr(i){function s(m){return Ur(m,i)}if(0<ta.length){Ur(ta[0],i);for(var l=1;l<ta.length;l++){var d=ta[l];d.blockedOn===i&&(d.blockedOn=null)}}for(zi!==null&&Ur(zi,i),Fi!==null&&Ur(Fi,i),$i!==null&&Ur($i,i),$r.forEach(s),Hr.forEach(s),l=0;l<Hi.length;l++)d=Hi[l],d.blockedOn===i&&(d.blockedOn=null);for(;0<Hi.length&&(l=Hi[0],l.blockedOn===null);)Lf(l),l.blockedOn===null&&Hi.shift()}var Gs=B.ReactCurrentBatchConfig,ia=!0;function pS(i,s,l,d){var m=ht,_=Gs.transition;Gs.transition=null;try{ht=1,rc(i,s,l,d)}finally{ht=m,Gs.transition=_}}function mS(i,s,l,d){var m=ht,_=Gs.transition;Gs.transition=null;try{ht=4,rc(i,s,l,d)}finally{ht=m,Gs.transition=_}}function rc(i,s,l,d){if(ia){var m=oc(i,s,l,d);if(m===null)xc(i,s,d,sa,l),Pf(i,d);else if(hS(m,i,s,l,d))d.stopPropagation();else if(Pf(i,d),s&4&&-1<dS.indexOf(i)){for(;m!==null;){var _=io(m);if(_!==null&&Ef(_),_=oc(i,s,l,d),_===null&&xc(i,s,d,sa,l),_===m)break;m=_}m!==null&&d.stopPropagation()}else xc(i,s,d,null,l)}}var sa=null;function oc(i,s,l,d){if(sa=null,i=Oe(d),i=ws(i),i!==null)if(s=Fe(i),s===null)i=null;else if(l=s.tag,l===13){if(i=Ge(s),i!==null)return i;i=null}else if(l===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null);return sa=i,null}function Df(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(nS()){case Zl:return 1;case bf:return 4;case Xo:case iS:return 16;case xf:return 536870912;default:return 16}default:return 16}}var Wi=null,ac=null,ra=null;function Mf(){if(ra)return ra;var i,s=ac,l=s.length,d,m="value"in Wi?Wi.value:Wi.textContent,_=m.length;for(i=0;i<l&&s[i]===m[i];i++);var j=l-i;for(d=1;d<=j&&s[l-d]===m[_-d];d++);return ra=m.slice(i,1<d?1-d:void 0)}function oa(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 aa(){return!0}function Af(){return!1}function Tn(i){function s(l,d,m,_,j){this._reactName=l,this._targetInst=m,this.type=d,this.nativeEvent=_,this.target=j,this.currentTarget=null;for(var K in i)i.hasOwnProperty(K)&&(l=i[K],this[K]=l?l(_):_[K]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?aa:Af,this.isPropagationStopped=Af,this}return I(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=aa)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=aa)},persist:function(){},isPersistent:aa}),s}var Xs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lc=Tn(Xs),qr=I({},Xs,{view:0,detail:0}),gS=Tn(qr),cc,uc,Vr,la=I({},qr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hc,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!==Vr&&(Vr&&i.type==="mousemove"?(cc=i.screenX-Vr.screenX,uc=i.screenY-Vr.screenY):uc=cc=0,Vr=i),cc)},movementY:function(i){return"movementY"in i?i.movementY:uc}}),If=Tn(la),vS=I({},la,{dataTransfer:0}),_S=Tn(vS),yS=I({},qr,{relatedTarget:0}),dc=Tn(yS),wS=I({},Xs,{animationName:0,elapsedTime:0,pseudoElement:0}),SS=Tn(wS),bS=I({},Xs,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),xS=Tn(bS),kS=I({},Xs,{data:0}),Bf=Tn(kS),CS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ES={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"},NS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function RS(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=NS[i])?!!s[i]:!1}function hc(){return RS}var jS=I({},qr,{key:function(i){if(i.key){var s=CS[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=oa(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?ES[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hc,charCode:function(i){return i.type==="keypress"?oa(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?oa(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),PS=Tn(jS),LS=I({},la,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Of=Tn(LS),TS=I({},qr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hc}),DS=Tn(TS),MS=I({},Xs,{propertyName:0,elapsedTime:0,pseudoElement:0}),AS=Tn(MS),IS=I({},la,{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}),BS=Tn(IS),OS=[9,13,27,32],fc=h&&"CompositionEvent"in window,Yr=null;h&&"documentMode"in document&&(Yr=document.documentMode);var zS=h&&"TextEvent"in window&&!Yr,zf=h&&(!fc||Yr&&8<Yr&&11>=Yr),Ff=" ",$f=!1;function Hf(i,s){switch(i){case"keyup":return OS.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wf(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Js=!1;function FS(i,s){switch(i){case"compositionend":return Wf(s);case"keypress":return s.which!==32?null:($f=!0,Ff);case"textInput":return i=s.data,i===Ff&&$f?null:i;default:return null}}function $S(i,s){if(Js)return i==="compositionend"||!fc&&Hf(i,s)?(i=Mf(),ra=ac=Wi=null,Js=!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 zf&&s.locale!=="ko"?null:s.data;default:return null}}var HS={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 Uf(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!HS[i.type]:s==="textarea"}function Kf(i,s,l,d){Hn(d),s=fa(s,"onChange"),0<s.length&&(l=new lc("onChange","change",null,l,d),i.push({event:l,listeners:s}))}var Gr=null,Xr=null;function WS(i){cp(i,0)}function ca(i){var s=nr(i);if($e(s))return i}function US(i,s){if(i==="change")return s}var qf=!1;if(h){var pc;if(h){var mc="oninput"in document;if(!mc){var Vf=document.createElement("div");Vf.setAttribute("oninput","return;"),mc=typeof Vf.oninput=="function"}pc=mc}else pc=!1;qf=pc&&(!document.documentMode||9<document.documentMode)}function Yf(){Gr&&(Gr.detachEvent("onpropertychange",Gf),Xr=Gr=null)}function Gf(i){if(i.propertyName==="value"&&ca(Xr)){var s=[];Kf(s,Xr,i,Oe(i)),Nt(WS,s)}}function KS(i,s,l){i==="focusin"?(Yf(),Gr=s,Xr=l,Gr.attachEvent("onpropertychange",Gf)):i==="focusout"&&Yf()}function qS(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return ca(Xr)}function VS(i,s){if(i==="click")return ca(s)}function YS(i,s){if(i==="input"||i==="change")return ca(s)}function GS(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var ti=typeof Object.is=="function"?Object.is:GS;function Jr(i,s){if(ti(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var l=Object.keys(i),d=Object.keys(s);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var m=l[d];if(!f.call(s,m)||!ti(i[m],s[m]))return!1}return!0}function Xf(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Jf(i,s){var l=Xf(i);i=0;for(var d;l;){if(l.nodeType===3){if(d=i+l.textContent.length,i<=s&&d>=s)return{node:l,offset:s-i};i=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Xf(l)}}function Qf(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?Qf(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function Zf(){for(var i=window,s=He();s instanceof i.HTMLIFrameElement;){try{var l=typeof s.contentWindow.location.href=="string"}catch{l=!1}if(l)i=s.contentWindow;else break;s=He(i.document)}return s}function gc(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 XS(i){var s=Zf(),l=i.focusedElem,d=i.selectionRange;if(s!==l&&l&&l.ownerDocument&&Qf(l.ownerDocument.documentElement,l)){if(d!==null&&gc(l)){if(s=d.start,i=d.end,i===void 0&&(i=s),"selectionStart"in l)l.selectionStart=s,l.selectionEnd=Math.min(i,l.value.length);else if(i=(s=l.ownerDocument||document)&&s.defaultView||window,i.getSelection){i=i.getSelection();var m=l.textContent.length,_=Math.min(d.start,m);d=d.end===void 0?_:Math.min(d.end,m),!i.extend&&_>d&&(m=d,d=_,_=m),m=Jf(l,_);var j=Jf(l,d);m&&j&&(i.rangeCount!==1||i.anchorNode!==m.node||i.anchorOffset!==m.offset||i.focusNode!==j.node||i.focusOffset!==j.offset)&&(s=s.createRange(),s.setStart(m.node,m.offset),i.removeAllRanges(),_>d?(i.addRange(s),i.extend(j.node,j.offset)):(s.setEnd(j.node,j.offset),i.addRange(s)))}}for(s=[],i=l;i=i.parentNode;)i.nodeType===1&&s.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<s.length;l++)i=s[l],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var JS=h&&"documentMode"in document&&11>=document.documentMode,Qs=null,vc=null,Qr=null,_c=!1;function ep(i,s,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;_c||Qs==null||Qs!==He(d)||(d=Qs,"selectionStart"in d&&gc(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Qr&&Jr(Qr,d)||(Qr=d,d=fa(vc,"onSelect"),0<d.length&&(s=new lc("onSelect","select",null,s,l),i.push({event:s,listeners:d}),s.target=Qs)))}function ua(i,s){var l={};return l[i.toLowerCase()]=s.toLowerCase(),l["Webkit"+i]="webkit"+s,l["Moz"+i]="moz"+s,l}var Zs={animationend:ua("Animation","AnimationEnd"),animationiteration:ua("Animation","AnimationIteration"),animationstart:ua("Animation","AnimationStart"),transitionend:ua("Transition","TransitionEnd")},yc={},tp={};h&&(tp=document.createElement("div").style,"AnimationEvent"in window||(delete Zs.animationend.animation,delete Zs.animationiteration.animation,delete Zs.animationstart.animation),"TransitionEvent"in window||delete Zs.transitionend.transition);function da(i){if(yc[i])return yc[i];if(!Zs[i])return i;var s=Zs[i],l;for(l in s)if(s.hasOwnProperty(l)&&l in tp)return yc[i]=s[l];return i}var np=da("animationend"),ip=da("animationiteration"),sp=da("animationstart"),rp=da("transitionend"),op=new Map,ap="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 Ui(i,s){op.set(i,s),a(s,[i])}for(var wc=0;wc<ap.length;wc++){var Sc=ap[wc],QS=Sc.toLowerCase(),ZS=Sc[0].toUpperCase()+Sc.slice(1);Ui(QS,"on"+ZS)}Ui(np,"onAnimationEnd"),Ui(ip,"onAnimationIteration"),Ui(sp,"onAnimationStart"),Ui("dblclick","onDoubleClick"),Ui("focusin","onFocus"),Ui("focusout","onBlur"),Ui(rp,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("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 Zr="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(" "),eb=new Set("cancel close invalid load scroll toggle".split(" ").concat(Zr));function lp(i,s,l){var d=i.type||"unknown-event";i.currentTarget=l,me(d,s,void 0,i),i.currentTarget=null}function cp(i,s){s=(s&4)!==0;for(var l=0;l<i.length;l++){var d=i[l],m=d.event;d=d.listeners;e:{var _=void 0;if(s)for(var j=d.length-1;0<=j;j--){var K=d[j],J=K.instance,ce=K.currentTarget;if(K=K.listener,J!==_&&m.isPropagationStopped())break e;lp(m,K,ce),_=J}else for(j=0;j<d.length;j++){if(K=d[j],J=K.instance,ce=K.currentTarget,K=K.listener,J!==_&&m.isPropagationStopped())break e;lp(m,K,ce),_=J}}}if(_s)throw i=Bi,_s=!1,Bi=null,i}function _t(i,s){var l=s[jc];l===void 0&&(l=s[jc]=new Set);var d=i+"__bubble";l.has(d)||(up(s,i,2,!1),l.add(d))}function bc(i,s,l){var d=0;s&&(d|=4),up(l,i,d,s)}var ha="_reactListening"+Math.random().toString(36).slice(2);function eo(i){if(!i[ha]){i[ha]=!0,r.forEach(function(l){l!=="selectionchange"&&(eb.has(l)||bc(l,!1,i),bc(l,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[ha]||(s[ha]=!0,bc("selectionchange",!1,s))}}function up(i,s,l,d){switch(Df(s)){case 1:var m=pS;break;case 4:m=mS;break;default:m=rc}l=m.bind(null,s,l,i),m=void 0,!Wn||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(m=!0),d?m!==void 0?i.addEventListener(s,l,{capture:!0,passive:m}):i.addEventListener(s,l,!0):m!==void 0?i.addEventListener(s,l,{passive:m}):i.addEventListener(s,l,!1)}function xc(i,s,l,d,m){var _=d;if((s&1)===0&&(s&2)===0&&d!==null)e:for(;;){if(d===null)return;var j=d.tag;if(j===3||j===4){var K=d.stateNode.containerInfo;if(K===m||K.nodeType===8&&K.parentNode===m)break;if(j===4)for(j=d.return;j!==null;){var J=j.tag;if((J===3||J===4)&&(J=j.stateNode.containerInfo,J===m||J.nodeType===8&&J.parentNode===m))return;j=j.return}for(;K!==null;){if(j=ws(K),j===null)return;if(J=j.tag,J===5||J===6){d=_=j;continue e}K=K.parentNode}}d=d.return}Nt(function(){var ce=_,ye=Oe(l),be=[];e:{var _e=op.get(i);if(_e!==void 0){var Le=lc,De=i;switch(i){case"keypress":if(oa(l)===0)break e;case"keydown":case"keyup":Le=PS;break;case"focusin":De="focus",Le=dc;break;case"focusout":De="blur",Le=dc;break;case"beforeblur":case"afterblur":Le=dc;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Le=If;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Le=_S;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Le=DS;break;case np:case ip:case sp:Le=SS;break;case rp:Le=AS;break;case"scroll":Le=gS;break;case"wheel":Le=BS;break;case"copy":case"cut":case"paste":Le=xS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Le=Of}var Me=(s&4)!==0,Ot=!Me&&i==="scroll",re=Me?_e!==null?_e+"Capture":null:_e;Me=[];for(var ee=ce,oe;ee!==null;){oe=ee;var Ce=oe.stateNode;if(oe.tag===5&&Ce!==null&&(oe=Ce,re!==null&&(Ce=pt(ee,re),Ce!=null&&Me.push(to(ee,Ce,oe)))),Ot)break;ee=ee.return}0<Me.length&&(_e=new Le(_e,De,null,l,ye),be.push({event:_e,listeners:Me}))}}if((s&7)===0){e:{if(_e=i==="mouseover"||i==="pointerover",Le=i==="mouseout"||i==="pointerout",_e&&l!==It&&(De=l.relatedTarget||l.fromElement)&&(ws(De)||De[ki]))break e;if((Le||_e)&&(_e=ye.window===ye?ye:(_e=ye.ownerDocument)?_e.defaultView||_e.parentWindow:window,Le?(De=l.relatedTarget||l.toElement,Le=ce,De=De?ws(De):null,De!==null&&(Ot=Fe(De),De!==Ot||De.tag!==5&&De.tag!==6)&&(De=null)):(Le=null,De=ce),Le!==De)){if(Me=If,Ce="onMouseLeave",re="onMouseEnter",ee="mouse",(i==="pointerout"||i==="pointerover")&&(Me=Of,Ce="onPointerLeave",re="onPointerEnter",ee="pointer"),Ot=Le==null?_e:nr(Le),oe=De==null?_e:nr(De),_e=new Me(Ce,ee+"leave",Le,l,ye),_e.target=Ot,_e.relatedTarget=oe,Ce=null,ws(ye)===ce&&(Me=new Me(re,ee+"enter",De,l,ye),Me.target=oe,Me.relatedTarget=Ot,Ce=Me),Ot=Ce,Le&&De)t:{for(Me=Le,re=De,ee=0,oe=Me;oe;oe=er(oe))ee++;for(oe=0,Ce=re;Ce;Ce=er(Ce))oe++;for(;0<ee-oe;)Me=er(Me),ee--;for(;0<oe-ee;)re=er(re),oe--;for(;ee--;){if(Me===re||re!==null&&Me===re.alternate)break t;Me=er(Me),re=er(re)}Me=null}else Me=null;Le!==null&&dp(be,_e,Le,Me,!1),De!==null&&Ot!==null&&dp(be,Ot,De,Me,!0)}}e:{if(_e=ce?nr(ce):window,Le=_e.nodeName&&_e.nodeName.toLowerCase(),Le==="select"||Le==="input"&&_e.type==="file")var Be=US;else if(Uf(_e))if(qf)Be=YS;else{Be=qS;var We=KS}else(Le=_e.nodeName)&&Le.toLowerCase()==="input"&&(_e.type==="checkbox"||_e.type==="radio")&&(Be=VS);if(Be&&(Be=Be(i,ce))){Kf(be,Be,l,ye);break e}We&&We(i,_e,ce),i==="focusout"&&(We=_e._wrapperState)&&We.controlled&&_e.type==="number"&&ct(_e,"number",_e.value)}switch(We=ce?nr(ce):window,i){case"focusin":(Uf(We)||We.contentEditable==="true")&&(Qs=We,vc=ce,Qr=null);break;case"focusout":Qr=vc=Qs=null;break;case"mousedown":_c=!0;break;case"contextmenu":case"mouseup":case"dragend":_c=!1,ep(be,l,ye);break;case"selectionchange":if(JS)break;case"keydown":case"keyup":ep(be,l,ye)}var Ue;if(fc)e:{switch(i){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else Js?Hf(i,l)&&(qe="onCompositionEnd"):i==="keydown"&&l.keyCode===229&&(qe="onCompositionStart");qe&&(zf&&l.locale!=="ko"&&(Js||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&Js&&(Ue=Mf()):(Wi=ye,ac="value"in Wi?Wi.value:Wi.textContent,Js=!0)),We=fa(ce,qe),0<We.length&&(qe=new Bf(qe,i,null,l,ye),be.push({event:qe,listeners:We}),Ue?qe.data=Ue:(Ue=Wf(l),Ue!==null&&(qe.data=Ue)))),(Ue=zS?FS(i,l):$S(i,l))&&(ce=fa(ce,"onBeforeInput"),0<ce.length&&(ye=new Bf("onBeforeInput","beforeinput",null,l,ye),be.push({event:ye,listeners:ce}),ye.data=Ue))}cp(be,s)})}function to(i,s,l){return{instance:i,listener:s,currentTarget:l}}function fa(i,s){for(var l=s+"Capture",d=[];i!==null;){var m=i,_=m.stateNode;m.tag===5&&_!==null&&(m=_,_=pt(i,l),_!=null&&d.unshift(to(i,_,m)),_=pt(i,s),_!=null&&d.push(to(i,_,m))),i=i.return}return d}function er(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function dp(i,s,l,d,m){for(var _=s._reactName,j=[];l!==null&&l!==d;){var K=l,J=K.alternate,ce=K.stateNode;if(J!==null&&J===d)break;K.tag===5&&ce!==null&&(K=ce,m?(J=pt(l,_),J!=null&&j.unshift(to(l,J,K))):m||(J=pt(l,_),J!=null&&j.push(to(l,J,K)))),l=l.return}j.length!==0&&i.push({event:s,listeners:j})}var tb=/\r\n?/g,nb=/\u0000|\uFFFD/g;function hp(i){return(typeof i=="string"?i:""+i).replace(tb,`
38
+ `).replace(nb,"")}function pa(i,s,l){if(s=hp(s),hp(i)!==s&&l)throw Error(n(425))}function ma(){}var kc=null,Cc=null;function Ec(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 Nc=typeof setTimeout=="function"?setTimeout:void 0,ib=typeof clearTimeout=="function"?clearTimeout:void 0,fp=typeof Promise=="function"?Promise:void 0,sb=typeof queueMicrotask=="function"?queueMicrotask:typeof fp<"u"?function(i){return fp.resolve(null).then(i).catch(rb)}:Nc;function rb(i){setTimeout(function(){throw i})}function Rc(i,s){var l=s,d=0;do{var m=l.nextSibling;if(i.removeChild(l),m&&m.nodeType===8)if(l=m.data,l==="/$"){if(d===0){i.removeChild(m),Kr(s);return}d--}else l!=="$"&&l!=="$?"&&l!=="$!"||d++;l=m}while(l);Kr(s)}function Ki(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 pp(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var l=i.data;if(l==="$"||l==="$!"||l==="$?"){if(s===0)return i;s--}else l==="/$"&&s++}i=i.previousSibling}return null}var tr=Math.random().toString(36).slice(2),ui="__reactFiber$"+tr,no="__reactProps$"+tr,ki="__reactContainer$"+tr,jc="__reactEvents$"+tr,ob="__reactListeners$"+tr,ab="__reactHandles$"+tr;function ws(i){var s=i[ui];if(s)return s;for(var l=i.parentNode;l;){if(s=l[ki]||l[ui]){if(l=s.alternate,s.child!==null||l!==null&&l.child!==null)for(i=pp(i);i!==null;){if(l=i[ui])return l;i=pp(i)}return s}i=l,l=i.parentNode}return null}function io(i){return i=i[ui]||i[ki],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function nr(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(n(33))}function ga(i){return i[no]||null}var Pc=[],ir=-1;function qi(i){return{current:i}}function yt(i){0>ir||(i.current=Pc[ir],Pc[ir]=null,ir--)}function mt(i,s){ir++,Pc[ir]=i.current,i.current=s}var Vi={},fn=qi(Vi),Cn=qi(!1),Ss=Vi;function sr(i,s){var l=i.type.contextTypes;if(!l)return Vi;var d=i.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===s)return d.__reactInternalMemoizedMaskedChildContext;var m={},_;for(_ in l)m[_]=s[_];return d&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=s,i.__reactInternalMemoizedMaskedChildContext=m),m}function En(i){return i=i.childContextTypes,i!=null}function va(){yt(Cn),yt(fn)}function mp(i,s,l){if(fn.current!==Vi)throw Error(n(168));mt(fn,s),mt(Cn,l)}function gp(i,s,l){var d=i.stateNode;if(s=s.childContextTypes,typeof d.getChildContext!="function")return l;d=d.getChildContext();for(var m in d)if(!(m in s))throw Error(n(108,Q(i)||"Unknown",m));return I({},l,d)}function _a(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Vi,Ss=fn.current,mt(fn,i),mt(Cn,Cn.current),!0}function vp(i,s,l){var d=i.stateNode;if(!d)throw Error(n(169));l?(i=gp(i,s,Ss),d.__reactInternalMemoizedMergedChildContext=i,yt(Cn),yt(fn),mt(fn,i)):yt(Cn),mt(Cn,l)}var Ci=null,ya=!1,Lc=!1;function _p(i){Ci===null?Ci=[i]:Ci.push(i)}function lb(i){ya=!0,_p(i)}function Yi(){if(!Lc&&Ci!==null){Lc=!0;var i=0,s=ht;try{var l=Ci;for(ht=1;i<l.length;i++){var d=l[i];do d=d(!0);while(d!==null)}Ci=null,ya=!1}catch(m){throw Ci!==null&&(Ci=Ci.slice(i+1)),Oi(Zl,Yi),m}finally{ht=s,Lc=!1}}return null}var rr=[],or=0,wa=null,Sa=0,Un=[],Kn=0,bs=null,Ei=1,Ni="";function xs(i,s){rr[or++]=Sa,rr[or++]=wa,wa=i,Sa=s}function yp(i,s,l){Un[Kn++]=Ei,Un[Kn++]=Ni,Un[Kn++]=bs,bs=i;var d=Ei;i=Ni;var m=32-ei(d)-1;d&=~(1<<m),l+=1;var _=32-ei(s)+m;if(30<_){var j=m-m%5;_=(d&(1<<j)-1).toString(32),d>>=j,m-=j,Ei=1<<32-ei(s)+m|l<<m|d,Ni=_+i}else Ei=1<<_|l<<m|d,Ni=i}function Tc(i){i.return!==null&&(xs(i,1),yp(i,1,0))}function Dc(i){for(;i===wa;)wa=rr[--or],rr[or]=null,Sa=rr[--or],rr[or]=null;for(;i===bs;)bs=Un[--Kn],Un[Kn]=null,Ni=Un[--Kn],Un[Kn]=null,Ei=Un[--Kn],Un[Kn]=null}var Dn=null,Mn=null,kt=!1,ni=null;function wp(i,s){var l=Gn(5,null,null,0);l.elementType="DELETED",l.stateNode=s,l.return=i,s=i.deletions,s===null?(i.deletions=[l],i.flags|=16):s.push(l)}function Sp(i,s){switch(i.tag){case 5:var l=i.type;return s=s.nodeType!==1||l.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(i.stateNode=s,Dn=i,Mn=Ki(s.firstChild),!0):!1;case 6:return s=i.pendingProps===""||s.nodeType!==3?null:s,s!==null?(i.stateNode=s,Dn=i,Mn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(l=bs!==null?{id:Ei,overflow:Ni}:null,i.memoizedState={dehydrated:s,treeContext:l,retryLane:1073741824},l=Gn(18,null,null,0),l.stateNode=s,l.return=i,i.child=l,Dn=i,Mn=null,!0):!1;default:return!1}}function Mc(i){return(i.mode&1)!==0&&(i.flags&128)===0}function Ac(i){if(kt){var s=Mn;if(s){var l=s;if(!Sp(i,s)){if(Mc(i))throw Error(n(418));s=Ki(l.nextSibling);var d=Dn;s&&Sp(i,s)?wp(d,l):(i.flags=i.flags&-4097|2,kt=!1,Dn=i)}}else{if(Mc(i))throw Error(n(418));i.flags=i.flags&-4097|2,kt=!1,Dn=i}}}function bp(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;Dn=i}function ba(i){if(i!==Dn)return!1;if(!kt)return bp(i),kt=!0,!1;var s;if((s=i.tag!==3)&&!(s=i.tag!==5)&&(s=i.type,s=s!=="head"&&s!=="body"&&!Ec(i.type,i.memoizedProps)),s&&(s=Mn)){if(Mc(i))throw xp(),Error(n(418));for(;s;)wp(i,s),s=Ki(s.nextSibling)}if(bp(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));e:{for(i=i.nextSibling,s=0;i;){if(i.nodeType===8){var l=i.data;if(l==="/$"){if(s===0){Mn=Ki(i.nextSibling);break e}s--}else l!=="$"&&l!=="$!"&&l!=="$?"||s++}i=i.nextSibling}Mn=null}}else Mn=Dn?Ki(i.stateNode.nextSibling):null;return!0}function xp(){for(var i=Mn;i;)i=Ki(i.nextSibling)}function ar(){Mn=Dn=null,kt=!1}function Ic(i){ni===null?ni=[i]:ni.push(i)}var cb=B.ReactCurrentBatchConfig;function so(i,s,l){if(i=l.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(n(309));var d=l.stateNode}if(!d)throw Error(n(147,i));var m=d,_=""+i;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===_?s.ref:(s=function(j){var K=m.refs;j===null?delete K[_]:K[_]=j},s._stringRef=_,s)}if(typeof i!="string")throw Error(n(284));if(!l._owner)throw Error(n(290,i))}return i}function xa(i,s){throw i=Object.prototype.toString.call(s),Error(n(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i))}function kp(i){var s=i._init;return s(i._payload)}function Cp(i){function s(re,ee){if(i){var oe=re.deletions;oe===null?(re.deletions=[ee],re.flags|=16):oe.push(ee)}}function l(re,ee){if(!i)return null;for(;ee!==null;)s(re,ee),ee=ee.sibling;return null}function d(re,ee){for(re=new Map;ee!==null;)ee.key!==null?re.set(ee.key,ee):re.set(ee.index,ee),ee=ee.sibling;return re}function m(re,ee){return re=ns(re,ee),re.index=0,re.sibling=null,re}function _(re,ee,oe){return re.index=oe,i?(oe=re.alternate,oe!==null?(oe=oe.index,oe<ee?(re.flags|=2,ee):oe):(re.flags|=2,ee)):(re.flags|=1048576,ee)}function j(re){return i&&re.alternate===null&&(re.flags|=2),re}function K(re,ee,oe,Ce){return ee===null||ee.tag!==6?(ee=Nu(oe,re.mode,Ce),ee.return=re,ee):(ee=m(ee,oe),ee.return=re,ee)}function J(re,ee,oe,Ce){var Be=oe.type;return Be===z?ye(re,ee,oe.props.children,Ce,oe.key):ee!==null&&(ee.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===P&&kp(Be)===ee.type)?(Ce=m(ee,oe.props),Ce.ref=so(re,ee,oe),Ce.return=re,Ce):(Ce=Va(oe.type,oe.key,oe.props,null,re.mode,Ce),Ce.ref=so(re,ee,oe),Ce.return=re,Ce)}function ce(re,ee,oe,Ce){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==oe.containerInfo||ee.stateNode.implementation!==oe.implementation?(ee=Ru(oe,re.mode,Ce),ee.return=re,ee):(ee=m(ee,oe.children||[]),ee.return=re,ee)}function ye(re,ee,oe,Ce,Be){return ee===null||ee.tag!==7?(ee=Ls(oe,re.mode,Ce,Be),ee.return=re,ee):(ee=m(ee,oe),ee.return=re,ee)}function be(re,ee,oe){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=Nu(""+ee,re.mode,oe),ee.return=re,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case V:return oe=Va(ee.type,ee.key,ee.props,null,re.mode,oe),oe.ref=so(re,null,ee),oe.return=re,oe;case G:return ee=Ru(ee,re.mode,oe),ee.return=re,ee;case P:var Ce=ee._init;return be(re,Ce(ee._payload),oe)}if(ot(ee)||q(ee))return ee=Ls(ee,re.mode,oe,null),ee.return=re,ee;xa(re,ee)}return null}function _e(re,ee,oe,Ce){var Be=ee!==null?ee.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return Be!==null?null:K(re,ee,""+oe,Ce);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case V:return oe.key===Be?J(re,ee,oe,Ce):null;case G:return oe.key===Be?ce(re,ee,oe,Ce):null;case P:return Be=oe._init,_e(re,ee,Be(oe._payload),Ce)}if(ot(oe)||q(oe))return Be!==null?null:ye(re,ee,oe,Ce,null);xa(re,oe)}return null}function Le(re,ee,oe,Ce,Be){if(typeof Ce=="string"&&Ce!==""||typeof Ce=="number")return re=re.get(oe)||null,K(ee,re,""+Ce,Be);if(typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case V:return re=re.get(Ce.key===null?oe:Ce.key)||null,J(ee,re,Ce,Be);case G:return re=re.get(Ce.key===null?oe:Ce.key)||null,ce(ee,re,Ce,Be);case P:var We=Ce._init;return Le(re,ee,oe,We(Ce._payload),Be)}if(ot(Ce)||q(Ce))return re=re.get(oe)||null,ye(ee,re,Ce,Be,null);xa(ee,Ce)}return null}function De(re,ee,oe,Ce){for(var Be=null,We=null,Ue=ee,qe=ee=0,Zt=null;Ue!==null&&qe<oe.length;qe++){Ue.index>qe?(Zt=Ue,Ue=null):Zt=Ue.sibling;var lt=_e(re,Ue,oe[qe],Ce);if(lt===null){Ue===null&&(Ue=Zt);break}i&&Ue&&lt.alternate===null&&s(re,Ue),ee=_(lt,ee,qe),We===null?Be=lt:We.sibling=lt,We=lt,Ue=Zt}if(qe===oe.length)return l(re,Ue),kt&&xs(re,qe),Be;if(Ue===null){for(;qe<oe.length;qe++)Ue=be(re,oe[qe],Ce),Ue!==null&&(ee=_(Ue,ee,qe),We===null?Be=Ue:We.sibling=Ue,We=Ue);return kt&&xs(re,qe),Be}for(Ue=d(re,Ue);qe<oe.length;qe++)Zt=Le(Ue,re,qe,oe[qe],Ce),Zt!==null&&(i&&Zt.alternate!==null&&Ue.delete(Zt.key===null?qe:Zt.key),ee=_(Zt,ee,qe),We===null?Be=Zt:We.sibling=Zt,We=Zt);return i&&Ue.forEach(function(is){return s(re,is)}),kt&&xs(re,qe),Be}function Me(re,ee,oe,Ce){var Be=q(oe);if(typeof Be!="function")throw Error(n(150));if(oe=Be.call(oe),oe==null)throw Error(n(151));for(var We=Be=null,Ue=ee,qe=ee=0,Zt=null,lt=oe.next();Ue!==null&&!lt.done;qe++,lt=oe.next()){Ue.index>qe?(Zt=Ue,Ue=null):Zt=Ue.sibling;var is=_e(re,Ue,lt.value,Ce);if(is===null){Ue===null&&(Ue=Zt);break}i&&Ue&&is.alternate===null&&s(re,Ue),ee=_(is,ee,qe),We===null?Be=is:We.sibling=is,We=is,Ue=Zt}if(lt.done)return l(re,Ue),kt&&xs(re,qe),Be;if(Ue===null){for(;!lt.done;qe++,lt=oe.next())lt=be(re,lt.value,Ce),lt!==null&&(ee=_(lt,ee,qe),We===null?Be=lt:We.sibling=lt,We=lt);return kt&&xs(re,qe),Be}for(Ue=d(re,Ue);!lt.done;qe++,lt=oe.next())lt=Le(Ue,re,qe,lt.value,Ce),lt!==null&&(i&&lt.alternate!==null&&Ue.delete(lt.key===null?qe:lt.key),ee=_(lt,ee,qe),We===null?Be=lt:We.sibling=lt,We=lt);return i&&Ue.forEach(function(Hb){return s(re,Hb)}),kt&&xs(re,qe),Be}function Ot(re,ee,oe,Ce){if(typeof oe=="object"&&oe!==null&&oe.type===z&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case V:e:{for(var Be=oe.key,We=ee;We!==null;){if(We.key===Be){if(Be=oe.type,Be===z){if(We.tag===7){l(re,We.sibling),ee=m(We,oe.props.children),ee.return=re,re=ee;break e}}else if(We.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===P&&kp(Be)===We.type){l(re,We.sibling),ee=m(We,oe.props),ee.ref=so(re,We,oe),ee.return=re,re=ee;break e}l(re,We);break}else s(re,We);We=We.sibling}oe.type===z?(ee=Ls(oe.props.children,re.mode,Ce,oe.key),ee.return=re,re=ee):(Ce=Va(oe.type,oe.key,oe.props,null,re.mode,Ce),Ce.ref=so(re,ee,oe),Ce.return=re,re=Ce)}return j(re);case G:e:{for(We=oe.key;ee!==null;){if(ee.key===We)if(ee.tag===4&&ee.stateNode.containerInfo===oe.containerInfo&&ee.stateNode.implementation===oe.implementation){l(re,ee.sibling),ee=m(ee,oe.children||[]),ee.return=re,re=ee;break e}else{l(re,ee);break}else s(re,ee);ee=ee.sibling}ee=Ru(oe,re.mode,Ce),ee.return=re,re=ee}return j(re);case P:return We=oe._init,Ot(re,ee,We(oe._payload),Ce)}if(ot(oe))return De(re,ee,oe,Ce);if(q(oe))return Me(re,ee,oe,Ce);xa(re,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,ee!==null&&ee.tag===6?(l(re,ee.sibling),ee=m(ee,oe),ee.return=re,re=ee):(l(re,ee),ee=Nu(oe,re.mode,Ce),ee.return=re,re=ee),j(re)):l(re,ee)}return Ot}var lr=Cp(!0),Ep=Cp(!1),ka=qi(null),Ca=null,cr=null,Bc=null;function Oc(){Bc=cr=Ca=null}function zc(i){var s=ka.current;yt(ka),i._currentValue=s}function Fc(i,s,l){for(;i!==null;){var d=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),i===l)break;i=i.return}}function ur(i,s){Ca=i,Bc=cr=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&s)!==0&&(Nn=!0),i.firstContext=null)}function qn(i){var s=i._currentValue;if(Bc!==i)if(i={context:i,memoizedValue:s,next:null},cr===null){if(Ca===null)throw Error(n(308));cr=i,Ca.dependencies={lanes:0,firstContext:i}}else cr=cr.next=i;return s}var ks=null;function $c(i){ks===null?ks=[i]:ks.push(i)}function Np(i,s,l,d){var m=s.interleaved;return m===null?(l.next=l,$c(s)):(l.next=m.next,m.next=l),s.interleaved=l,Ri(i,d)}function Ri(i,s){i.lanes|=s;var l=i.alternate;for(l!==null&&(l.lanes|=s),l=i,i=i.return;i!==null;)i.childLanes|=s,l=i.alternate,l!==null&&(l.childLanes|=s),l=i,i=i.return;return l.tag===3?l.stateNode:null}var Gi=!1;function Hc(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Rp(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 ji(i,s){return{eventTime:i,lane:s,tag:0,payload:null,callback:null,next:null}}function Xi(i,s,l){var d=i.updateQueue;if(d===null)return null;if(d=d.shared,(at&2)!==0){var m=d.pending;return m===null?s.next=s:(s.next=m.next,m.next=s),d.pending=s,Ri(i,l)}return m=d.interleaved,m===null?(s.next=s,$c(d)):(s.next=m.next,m.next=s),d.interleaved=s,Ri(i,l)}function Ea(i,s,l){if(s=s.updateQueue,s!==null&&(s=s.shared,(l&4194240)!==0)){var d=s.lanes;d&=i.pendingLanes,l|=d,s.lanes=l,nc(i,l)}}function jp(i,s){var l=i.updateQueue,d=i.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var m=null,_=null;if(l=l.firstBaseUpdate,l!==null){do{var j={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};_===null?m=_=j:_=_.next=j,l=l.next}while(l!==null);_===null?m=_=s:_=_.next=s}else m=_=s;l={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:_,shared:d.shared,effects:d.effects},i.updateQueue=l;return}i=l.lastBaseUpdate,i===null?l.firstBaseUpdate=s:i.next=s,l.lastBaseUpdate=s}function Na(i,s,l,d){var m=i.updateQueue;Gi=!1;var _=m.firstBaseUpdate,j=m.lastBaseUpdate,K=m.shared.pending;if(K!==null){m.shared.pending=null;var J=K,ce=J.next;J.next=null,j===null?_=ce:j.next=ce,j=J;var ye=i.alternate;ye!==null&&(ye=ye.updateQueue,K=ye.lastBaseUpdate,K!==j&&(K===null?ye.firstBaseUpdate=ce:K.next=ce,ye.lastBaseUpdate=J))}if(_!==null){var be=m.baseState;j=0,ye=ce=J=null,K=_;do{var _e=K.lane,Le=K.eventTime;if((d&_e)===_e){ye!==null&&(ye=ye.next={eventTime:Le,lane:0,tag:K.tag,payload:K.payload,callback:K.callback,next:null});e:{var De=i,Me=K;switch(_e=s,Le=l,Me.tag){case 1:if(De=Me.payload,typeof De=="function"){be=De.call(Le,be,_e);break e}be=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Me.payload,_e=typeof De=="function"?De.call(Le,be,_e):De,_e==null)break e;be=I({},be,_e);break e;case 2:Gi=!0}}K.callback!==null&&K.lane!==0&&(i.flags|=64,_e=m.effects,_e===null?m.effects=[K]:_e.push(K))}else Le={eventTime:Le,lane:_e,tag:K.tag,payload:K.payload,callback:K.callback,next:null},ye===null?(ce=ye=Le,J=be):ye=ye.next=Le,j|=_e;if(K=K.next,K===null){if(K=m.shared.pending,K===null)break;_e=K,K=_e.next,_e.next=null,m.lastBaseUpdate=_e,m.shared.pending=null}}while(!0);if(ye===null&&(J=be),m.baseState=J,m.firstBaseUpdate=ce,m.lastBaseUpdate=ye,s=m.shared.interleaved,s!==null){m=s;do j|=m.lane,m=m.next;while(m!==s)}else _===null&&(m.shared.lanes=0);Ns|=j,i.lanes=j,i.memoizedState=be}}function Pp(i,s,l){if(i=s.effects,s.effects=null,i!==null)for(s=0;s<i.length;s++){var d=i[s],m=d.callback;if(m!==null){if(d.callback=null,d=l,typeof m!="function")throw Error(n(191,m));m.call(d)}}}var ro={},di=qi(ro),oo=qi(ro),ao=qi(ro);function Cs(i){if(i===ro)throw Error(n(174));return i}function Wc(i,s){switch(mt(ao,s),mt(oo,i),mt(di,ro),i=s.nodeType,i){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:ue(null,"");break;default:i=i===8?s.parentNode:s,s=i.namespaceURI||null,i=i.tagName,s=ue(s,i)}yt(di),mt(di,s)}function dr(){yt(di),yt(oo),yt(ao)}function Lp(i){Cs(ao.current);var s=Cs(di.current),l=ue(s,i.type);s!==l&&(mt(oo,i),mt(di,l))}function Uc(i){oo.current===i&&(yt(di),yt(oo))}var jt=qi(0);function Ra(i){for(var s=i;s!==null;){if(s.tag===13){var l=s.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||l.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 Kc=[];function qc(){for(var i=0;i<Kc.length;i++)Kc[i]._workInProgressVersionPrimary=null;Kc.length=0}var ja=B.ReactCurrentDispatcher,Vc=B.ReactCurrentBatchConfig,Es=0,Pt=null,Wt=null,Jt=null,Pa=!1,lo=!1,co=0,ub=0;function pn(){throw Error(n(321))}function Yc(i,s){if(s===null)return!1;for(var l=0;l<s.length&&l<i.length;l++)if(!ti(i[l],s[l]))return!1;return!0}function Gc(i,s,l,d,m,_){if(Es=_,Pt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,ja.current=i===null||i.memoizedState===null?pb:mb,i=l(d,m),lo){_=0;do{if(lo=!1,co=0,25<=_)throw Error(n(301));_+=1,Jt=Wt=null,s.updateQueue=null,ja.current=gb,i=l(d,m)}while(lo)}if(ja.current=Da,s=Wt!==null&&Wt.next!==null,Es=0,Jt=Wt=Pt=null,Pa=!1,s)throw Error(n(300));return i}function Xc(){var i=co!==0;return co=0,i}function hi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?Pt.memoizedState=Jt=i:Jt=Jt.next=i,Jt}function Vn(){if(Wt===null){var i=Pt.alternate;i=i!==null?i.memoizedState:null}else i=Wt.next;var s=Jt===null?Pt.memoizedState:Jt.next;if(s!==null)Jt=s,Wt=i;else{if(i===null)throw Error(n(310));Wt=i,i={memoizedState:Wt.memoizedState,baseState:Wt.baseState,baseQueue:Wt.baseQueue,queue:Wt.queue,next:null},Jt===null?Pt.memoizedState=Jt=i:Jt=Jt.next=i}return Jt}function uo(i,s){return typeof s=="function"?s(i):s}function Jc(i){var s=Vn(),l=s.queue;if(l===null)throw Error(n(311));l.lastRenderedReducer=i;var d=Wt,m=d.baseQueue,_=l.pending;if(_!==null){if(m!==null){var j=m.next;m.next=_.next,_.next=j}d.baseQueue=m=_,l.pending=null}if(m!==null){_=m.next,d=d.baseState;var K=j=null,J=null,ce=_;do{var ye=ce.lane;if((Es&ye)===ye)J!==null&&(J=J.next={lane:0,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),d=ce.hasEagerState?ce.eagerState:i(d,ce.action);else{var be={lane:ye,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null};J===null?(K=J=be,j=d):J=J.next=be,Pt.lanes|=ye,Ns|=ye}ce=ce.next}while(ce!==null&&ce!==_);J===null?j=d:J.next=K,ti(d,s.memoizedState)||(Nn=!0),s.memoizedState=d,s.baseState=j,s.baseQueue=J,l.lastRenderedState=d}if(i=l.interleaved,i!==null){m=i;do _=m.lane,Pt.lanes|=_,Ns|=_,m=m.next;while(m!==i)}else m===null&&(l.lanes=0);return[s.memoizedState,l.dispatch]}function Qc(i){var s=Vn(),l=s.queue;if(l===null)throw Error(n(311));l.lastRenderedReducer=i;var d=l.dispatch,m=l.pending,_=s.memoizedState;if(m!==null){l.pending=null;var j=m=m.next;do _=i(_,j.action),j=j.next;while(j!==m);ti(_,s.memoizedState)||(Nn=!0),s.memoizedState=_,s.baseQueue===null&&(s.baseState=_),l.lastRenderedState=_}return[_,d]}function Tp(){}function Dp(i,s){var l=Pt,d=Vn(),m=s(),_=!ti(d.memoizedState,m);if(_&&(d.memoizedState=m,Nn=!0),d=d.queue,Zc(Ip.bind(null,l,d,i),[i]),d.getSnapshot!==s||_||Jt!==null&&Jt.memoizedState.tag&1){if(l.flags|=2048,ho(9,Ap.bind(null,l,d,m,s),void 0,null),Qt===null)throw Error(n(349));(Es&30)!==0||Mp(l,s,m)}return m}function Mp(i,s,l){i.flags|=16384,i={getSnapshot:s,value:l},s=Pt.updateQueue,s===null?(s={lastEffect:null,stores:null},Pt.updateQueue=s,s.stores=[i]):(l=s.stores,l===null?s.stores=[i]:l.push(i))}function Ap(i,s,l,d){s.value=l,s.getSnapshot=d,Bp(s)&&Op(i)}function Ip(i,s,l){return l(function(){Bp(s)&&Op(i)})}function Bp(i){var s=i.getSnapshot;i=i.value;try{var l=s();return!ti(i,l)}catch{return!0}}function Op(i){var s=Ri(i,1);s!==null&&oi(s,i,1,-1)}function zp(i){var s=hi();return typeof i=="function"&&(i=i()),s.memoizedState=s.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:uo,lastRenderedState:i},s.queue=i,i=i.dispatch=fb.bind(null,Pt,i),[s.memoizedState,i]}function ho(i,s,l,d){return i={tag:i,create:s,destroy:l,deps:d,next:null},s=Pt.updateQueue,s===null?(s={lastEffect:null,stores:null},Pt.updateQueue=s,s.lastEffect=i.next=i):(l=s.lastEffect,l===null?s.lastEffect=i.next=i:(d=l.next,l.next=i,i.next=d,s.lastEffect=i)),i}function Fp(){return Vn().memoizedState}function La(i,s,l,d){var m=hi();Pt.flags|=i,m.memoizedState=ho(1|s,l,void 0,d===void 0?null:d)}function Ta(i,s,l,d){var m=Vn();d=d===void 0?null:d;var _=void 0;if(Wt!==null){var j=Wt.memoizedState;if(_=j.destroy,d!==null&&Yc(d,j.deps)){m.memoizedState=ho(s,l,_,d);return}}Pt.flags|=i,m.memoizedState=ho(1|s,l,_,d)}function $p(i,s){return La(8390656,8,i,s)}function Zc(i,s){return Ta(2048,8,i,s)}function Hp(i,s){return Ta(4,2,i,s)}function Wp(i,s){return Ta(4,4,i,s)}function Up(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 Kp(i,s,l){return l=l!=null?l.concat([i]):null,Ta(4,4,Up.bind(null,s,i),l)}function eu(){}function qp(i,s){var l=Vn();s=s===void 0?null:s;var d=l.memoizedState;return d!==null&&s!==null&&Yc(s,d[1])?d[0]:(l.memoizedState=[i,s],i)}function Vp(i,s){var l=Vn();s=s===void 0?null:s;var d=l.memoizedState;return d!==null&&s!==null&&Yc(s,d[1])?d[0]:(i=i(),l.memoizedState=[i,s],i)}function Yp(i,s,l){return(Es&21)===0?(i.baseState&&(i.baseState=!1,Nn=!0),i.memoizedState=l):(ti(l,s)||(l=kf(),Pt.lanes|=l,Ns|=l,i.baseState=!0),s)}function db(i,s){var l=ht;ht=l!==0&&4>l?l:4,i(!0);var d=Vc.transition;Vc.transition={};try{i(!1),s()}finally{ht=l,Vc.transition=d}}function Gp(){return Vn().memoizedState}function hb(i,s,l){var d=es(i);if(l={lane:d,action:l,hasEagerState:!1,eagerState:null,next:null},Xp(i))Jp(s,l);else if(l=Np(i,s,l,d),l!==null){var m=wn();oi(l,i,d,m),Qp(l,s,d)}}function fb(i,s,l){var d=es(i),m={lane:d,action:l,hasEagerState:!1,eagerState:null,next:null};if(Xp(i))Jp(s,m);else{var _=i.alternate;if(i.lanes===0&&(_===null||_.lanes===0)&&(_=s.lastRenderedReducer,_!==null))try{var j=s.lastRenderedState,K=_(j,l);if(m.hasEagerState=!0,m.eagerState=K,ti(K,j)){var J=s.interleaved;J===null?(m.next=m,$c(s)):(m.next=J.next,J.next=m),s.interleaved=m;return}}catch{}finally{}l=Np(i,s,m,d),l!==null&&(m=wn(),oi(l,i,d,m),Qp(l,s,d))}}function Xp(i){var s=i.alternate;return i===Pt||s!==null&&s===Pt}function Jp(i,s){lo=Pa=!0;var l=i.pending;l===null?s.next=s:(s.next=l.next,l.next=s),i.pending=s}function Qp(i,s,l){if((l&4194240)!==0){var d=s.lanes;d&=i.pendingLanes,l|=d,s.lanes=l,nc(i,l)}}var Da={readContext:qn,useCallback:pn,useContext:pn,useEffect:pn,useImperativeHandle:pn,useInsertionEffect:pn,useLayoutEffect:pn,useMemo:pn,useReducer:pn,useRef:pn,useState:pn,useDebugValue:pn,useDeferredValue:pn,useTransition:pn,useMutableSource:pn,useSyncExternalStore:pn,useId:pn,unstable_isNewReconciler:!1},pb={readContext:qn,useCallback:function(i,s){return hi().memoizedState=[i,s===void 0?null:s],i},useContext:qn,useEffect:$p,useImperativeHandle:function(i,s,l){return l=l!=null?l.concat([i]):null,La(4194308,4,Up.bind(null,s,i),l)},useLayoutEffect:function(i,s){return La(4194308,4,i,s)},useInsertionEffect:function(i,s){return La(4,2,i,s)},useMemo:function(i,s){var l=hi();return s=s===void 0?null:s,i=i(),l.memoizedState=[i,s],i},useReducer:function(i,s,l){var d=hi();return s=l!==void 0?l(s):s,d.memoizedState=d.baseState=s,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:s},d.queue=i,i=i.dispatch=hb.bind(null,Pt,i),[d.memoizedState,i]},useRef:function(i){var s=hi();return i={current:i},s.memoizedState=i},useState:zp,useDebugValue:eu,useDeferredValue:function(i){return hi().memoizedState=i},useTransition:function(){var i=zp(!1),s=i[0];return i=db.bind(null,i[1]),hi().memoizedState=i,[s,i]},useMutableSource:function(){},useSyncExternalStore:function(i,s,l){var d=Pt,m=hi();if(kt){if(l===void 0)throw Error(n(407));l=l()}else{if(l=s(),Qt===null)throw Error(n(349));(Es&30)!==0||Mp(d,s,l)}m.memoizedState=l;var _={value:l,getSnapshot:s};return m.queue=_,$p(Ip.bind(null,d,_,i),[i]),d.flags|=2048,ho(9,Ap.bind(null,d,_,l,s),void 0,null),l},useId:function(){var i=hi(),s=Qt.identifierPrefix;if(kt){var l=Ni,d=Ei;l=(d&~(1<<32-ei(d)-1)).toString(32)+l,s=":"+s+"R"+l,l=co++,0<l&&(s+="H"+l.toString(32)),s+=":"}else l=ub++,s=":"+s+"r"+l.toString(32)+":";return i.memoizedState=s},unstable_isNewReconciler:!1},mb={readContext:qn,useCallback:qp,useContext:qn,useEffect:Zc,useImperativeHandle:Kp,useInsertionEffect:Hp,useLayoutEffect:Wp,useMemo:Vp,useReducer:Jc,useRef:Fp,useState:function(){return Jc(uo)},useDebugValue:eu,useDeferredValue:function(i){var s=Vn();return Yp(s,Wt.memoizedState,i)},useTransition:function(){var i=Jc(uo)[0],s=Vn().memoizedState;return[i,s]},useMutableSource:Tp,useSyncExternalStore:Dp,useId:Gp,unstable_isNewReconciler:!1},gb={readContext:qn,useCallback:qp,useContext:qn,useEffect:Zc,useImperativeHandle:Kp,useInsertionEffect:Hp,useLayoutEffect:Wp,useMemo:Vp,useReducer:Qc,useRef:Fp,useState:function(){return Qc(uo)},useDebugValue:eu,useDeferredValue:function(i){var s=Vn();return Wt===null?s.memoizedState=i:Yp(s,Wt.memoizedState,i)},useTransition:function(){var i=Qc(uo)[0],s=Vn().memoizedState;return[i,s]},useMutableSource:Tp,useSyncExternalStore:Dp,useId:Gp,unstable_isNewReconciler:!1};function ii(i,s){if(i&&i.defaultProps){s=I({},s),i=i.defaultProps;for(var l in i)s[l]===void 0&&(s[l]=i[l]);return s}return s}function tu(i,s,l,d){s=i.memoizedState,l=l(d,s),l=l==null?s:I({},s,l),i.memoizedState=l,i.lanes===0&&(i.updateQueue.baseState=l)}var Ma={isMounted:function(i){return(i=i._reactInternals)?Fe(i)===i:!1},enqueueSetState:function(i,s,l){i=i._reactInternals;var d=wn(),m=es(i),_=ji(d,m);_.payload=s,l!=null&&(_.callback=l),s=Xi(i,_,m),s!==null&&(oi(s,i,m,d),Ea(s,i,m))},enqueueReplaceState:function(i,s,l){i=i._reactInternals;var d=wn(),m=es(i),_=ji(d,m);_.tag=1,_.payload=s,l!=null&&(_.callback=l),s=Xi(i,_,m),s!==null&&(oi(s,i,m,d),Ea(s,i,m))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var l=wn(),d=es(i),m=ji(l,d);m.tag=2,s!=null&&(m.callback=s),s=Xi(i,m,d),s!==null&&(oi(s,i,d,l),Ea(s,i,d))}};function Zp(i,s,l,d,m,_,j){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(d,_,j):s.prototype&&s.prototype.isPureReactComponent?!Jr(l,d)||!Jr(m,_):!0}function em(i,s,l){var d=!1,m=Vi,_=s.contextType;return typeof _=="object"&&_!==null?_=qn(_):(m=En(s)?Ss:fn.current,d=s.contextTypes,_=(d=d!=null)?sr(i,m):Vi),s=new s(l,_),i.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Ma,i.stateNode=s,s._reactInternals=i,d&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=m,i.__reactInternalMemoizedMaskedChildContext=_),s}function tm(i,s,l,d){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(l,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(l,d),s.state!==i&&Ma.enqueueReplaceState(s,s.state,null)}function nu(i,s,l,d){var m=i.stateNode;m.props=l,m.state=i.memoizedState,m.refs={},Hc(i);var _=s.contextType;typeof _=="object"&&_!==null?m.context=qn(_):(_=En(s)?Ss:fn.current,m.context=sr(i,_)),m.state=i.memoizedState,_=s.getDerivedStateFromProps,typeof _=="function"&&(tu(i,s,_,l),m.state=i.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(s=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),s!==m.state&&Ma.enqueueReplaceState(m,m.state,null),Na(i,l,m,d),m.state=i.memoizedState),typeof m.componentDidMount=="function"&&(i.flags|=4194308)}function hr(i,s){try{var l="",d=s;do l+=he(d),d=d.return;while(d);var m=l}catch(_){m=`
39
+ Error generating stack: `+_.message+`
40
+ `+_.stack}return{value:i,source:s,stack:m,digest:null}}function iu(i,s,l){return{value:i,source:null,stack:l??null,digest:s??null}}function su(i,s){try{console.error(s.value)}catch(l){setTimeout(function(){throw l})}}var vb=typeof WeakMap=="function"?WeakMap:Map;function nm(i,s,l){l=ji(-1,l),l.tag=3,l.payload={element:null};var d=s.value;return l.callback=function(){$a||($a=!0,yu=d),su(i,s)},l}function im(i,s,l){l=ji(-1,l),l.tag=3;var d=i.type.getDerivedStateFromError;if(typeof d=="function"){var m=s.value;l.payload=function(){return d(m)},l.callback=function(){su(i,s)}}var _=i.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(l.callback=function(){su(i,s),typeof d!="function"&&(Qi===null?Qi=new Set([this]):Qi.add(this));var j=s.stack;this.componentDidCatch(s.value,{componentStack:j!==null?j:""})}),l}function sm(i,s,l){var d=i.pingCache;if(d===null){d=i.pingCache=new vb;var m=new Set;d.set(s,m)}else m=d.get(s),m===void 0&&(m=new Set,d.set(s,m));m.has(l)||(m.add(l),i=Lb.bind(null,i,s,l),s.then(i,i))}function rm(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 om(i,s,l,d,m){return(i.mode&1)===0?(i===s?i.flags|=65536:(i.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(s=ji(-1,1),s.tag=2,Xi(l,s,1))),l.lanes|=1),i):(i.flags|=65536,i.lanes=m,i)}var _b=B.ReactCurrentOwner,Nn=!1;function yn(i,s,l,d){s.child=i===null?Ep(s,null,l,d):lr(s,i.child,l,d)}function am(i,s,l,d,m){l=l.render;var _=s.ref;return ur(s,m),d=Gc(i,s,l,d,_,m),l=Xc(),i!==null&&!Nn?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~m,Pi(i,s,m)):(kt&&l&&Tc(s),s.flags|=1,yn(i,s,d,m),s.child)}function lm(i,s,l,d,m){if(i===null){var _=l.type;return typeof _=="function"&&!Eu(_)&&_.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(s.tag=15,s.type=_,cm(i,s,_,d,m)):(i=Va(l.type,null,d,s,s.mode,m),i.ref=s.ref,i.return=s,s.child=i)}if(_=i.child,(i.lanes&m)===0){var j=_.memoizedProps;if(l=l.compare,l=l!==null?l:Jr,l(j,d)&&i.ref===s.ref)return Pi(i,s,m)}return s.flags|=1,i=ns(_,d),i.ref=s.ref,i.return=s,s.child=i}function cm(i,s,l,d,m){if(i!==null){var _=i.memoizedProps;if(Jr(_,d)&&i.ref===s.ref)if(Nn=!1,s.pendingProps=d=_,(i.lanes&m)!==0)(i.flags&131072)!==0&&(Nn=!0);else return s.lanes=i.lanes,Pi(i,s,m)}return ru(i,s,l,d,m)}function um(i,s,l){var d=s.pendingProps,m=d.children,_=i!==null?i.memoizedState:null;if(d.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},mt(pr,An),An|=l;else{if((l&1073741824)===0)return i=_!==null?_.baseLanes|l:l,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:i,cachePool:null,transitions:null},s.updateQueue=null,mt(pr,An),An|=i,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},d=_!==null?_.baseLanes:l,mt(pr,An),An|=d}else _!==null?(d=_.baseLanes|l,s.memoizedState=null):d=l,mt(pr,An),An|=d;return yn(i,s,m,l),s.child}function dm(i,s){var l=s.ref;(i===null&&l!==null||i!==null&&i.ref!==l)&&(s.flags|=512,s.flags|=2097152)}function ru(i,s,l,d,m){var _=En(l)?Ss:fn.current;return _=sr(s,_),ur(s,m),l=Gc(i,s,l,d,_,m),d=Xc(),i!==null&&!Nn?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~m,Pi(i,s,m)):(kt&&d&&Tc(s),s.flags|=1,yn(i,s,l,m),s.child)}function hm(i,s,l,d,m){if(En(l)){var _=!0;_a(s)}else _=!1;if(ur(s,m),s.stateNode===null)Ia(i,s),em(s,l,d),nu(s,l,d,m),d=!0;else if(i===null){var j=s.stateNode,K=s.memoizedProps;j.props=K;var J=j.context,ce=l.contextType;typeof ce=="object"&&ce!==null?ce=qn(ce):(ce=En(l)?Ss:fn.current,ce=sr(s,ce));var ye=l.getDerivedStateFromProps,be=typeof ye=="function"||typeof j.getSnapshotBeforeUpdate=="function";be||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(K!==d||J!==ce)&&tm(s,j,d,ce),Gi=!1;var _e=s.memoizedState;j.state=_e,Na(s,d,j,m),J=s.memoizedState,K!==d||_e!==J||Cn.current||Gi?(typeof ye=="function"&&(tu(s,l,ye,d),J=s.memoizedState),(K=Gi||Zp(s,l,K,d,_e,J,ce))?(be||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(s.flags|=4194308)):(typeof j.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=J),j.props=d,j.state=J,j.context=ce,d=K):(typeof j.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{j=s.stateNode,Rp(i,s),K=s.memoizedProps,ce=s.type===s.elementType?K:ii(s.type,K),j.props=ce,be=s.pendingProps,_e=j.context,J=l.contextType,typeof J=="object"&&J!==null?J=qn(J):(J=En(l)?Ss:fn.current,J=sr(s,J));var Le=l.getDerivedStateFromProps;(ye=typeof Le=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(K!==be||_e!==J)&&tm(s,j,d,J),Gi=!1,_e=s.memoizedState,j.state=_e,Na(s,d,j,m);var De=s.memoizedState;K!==be||_e!==De||Cn.current||Gi?(typeof Le=="function"&&(tu(s,l,Le,d),De=s.memoizedState),(ce=Gi||Zp(s,l,ce,d,_e,De,J)||!1)?(ye||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(d,De,J),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(d,De,J)),typeof j.componentDidUpdate=="function"&&(s.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof j.componentDidUpdate!="function"||K===i.memoizedProps&&_e===i.memoizedState||(s.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||K===i.memoizedProps&&_e===i.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=De),j.props=d,j.state=De,j.context=J,d=ce):(typeof j.componentDidUpdate!="function"||K===i.memoizedProps&&_e===i.memoizedState||(s.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||K===i.memoizedProps&&_e===i.memoizedState||(s.flags|=1024),d=!1)}return ou(i,s,l,d,_,m)}function ou(i,s,l,d,m,_){dm(i,s);var j=(s.flags&128)!==0;if(!d&&!j)return m&&vp(s,l,!1),Pi(i,s,_);d=s.stateNode,_b.current=s;var K=j&&typeof l.getDerivedStateFromError!="function"?null:d.render();return s.flags|=1,i!==null&&j?(s.child=lr(s,i.child,null,_),s.child=lr(s,null,K,_)):yn(i,s,K,_),s.memoizedState=d.state,m&&vp(s,l,!0),s.child}function fm(i){var s=i.stateNode;s.pendingContext?mp(i,s.pendingContext,s.pendingContext!==s.context):s.context&&mp(i,s.context,!1),Wc(i,s.containerInfo)}function pm(i,s,l,d,m){return ar(),Ic(m),s.flags|=256,yn(i,s,l,d),s.child}var au={dehydrated:null,treeContext:null,retryLane:0};function lu(i){return{baseLanes:i,cachePool:null,transitions:null}}function mm(i,s,l){var d=s.pendingProps,m=jt.current,_=!1,j=(s.flags&128)!==0,K;if((K=j)||(K=i!==null&&i.memoizedState===null?!1:(m&2)!==0),K?(_=!0,s.flags&=-129):(i===null||i.memoizedState!==null)&&(m|=1),mt(jt,m&1),i===null)return Ac(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):(j=d.children,i=d.fallback,_?(d=s.mode,_=s.child,j={mode:"hidden",children:j},(d&1)===0&&_!==null?(_.childLanes=0,_.pendingProps=j):_=Ya(j,d,0,null),i=Ls(i,d,l,null),_.return=s,i.return=s,_.sibling=i,s.child=_,s.child.memoizedState=lu(l),s.memoizedState=au,i):cu(s,j));if(m=i.memoizedState,m!==null&&(K=m.dehydrated,K!==null))return yb(i,s,j,d,K,m,l);if(_){_=d.fallback,j=s.mode,m=i.child,K=m.sibling;var J={mode:"hidden",children:d.children};return(j&1)===0&&s.child!==m?(d=s.child,d.childLanes=0,d.pendingProps=J,s.deletions=null):(d=ns(m,J),d.subtreeFlags=m.subtreeFlags&14680064),K!==null?_=ns(K,_):(_=Ls(_,j,l,null),_.flags|=2),_.return=s,d.return=s,d.sibling=_,s.child=d,d=_,_=s.child,j=i.child.memoizedState,j=j===null?lu(l):{baseLanes:j.baseLanes|l,cachePool:null,transitions:j.transitions},_.memoizedState=j,_.childLanes=i.childLanes&~l,s.memoizedState=au,d}return _=i.child,i=_.sibling,d=ns(_,{mode:"visible",children:d.children}),(s.mode&1)===0&&(d.lanes=l),d.return=s,d.sibling=null,i!==null&&(l=s.deletions,l===null?(s.deletions=[i],s.flags|=16):l.push(i)),s.child=d,s.memoizedState=null,d}function cu(i,s){return s=Ya({mode:"visible",children:s},i.mode,0,null),s.return=i,i.child=s}function Aa(i,s,l,d){return d!==null&&Ic(d),lr(s,i.child,null,l),i=cu(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function yb(i,s,l,d,m,_,j){if(l)return s.flags&256?(s.flags&=-257,d=iu(Error(n(422))),Aa(i,s,j,d)):s.memoizedState!==null?(s.child=i.child,s.flags|=128,null):(_=d.fallback,m=s.mode,d=Ya({mode:"visible",children:d.children},m,0,null),_=Ls(_,m,j,null),_.flags|=2,d.return=s,_.return=s,d.sibling=_,s.child=d,(s.mode&1)!==0&&lr(s,i.child,null,j),s.child.memoizedState=lu(j),s.memoizedState=au,_);if((s.mode&1)===0)return Aa(i,s,j,null);if(m.data==="$!"){if(d=m.nextSibling&&m.nextSibling.dataset,d)var K=d.dgst;return d=K,_=Error(n(419)),d=iu(_,d,void 0),Aa(i,s,j,d)}if(K=(j&i.childLanes)!==0,Nn||K){if(d=Qt,d!==null){switch(j&-j){case 4:m=2;break;case 16:m=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:m=32;break;case 536870912:m=268435456;break;default:m=0}m=(m&(d.suspendedLanes|j))!==0?0:m,m!==0&&m!==_.retryLane&&(_.retryLane=m,Ri(i,m),oi(d,i,m,-1))}return Cu(),d=iu(Error(n(421))),Aa(i,s,j,d)}return m.data==="$?"?(s.flags|=128,s.child=i.child,s=Tb.bind(null,i),m._reactRetry=s,null):(i=_.treeContext,Mn=Ki(m.nextSibling),Dn=s,kt=!0,ni=null,i!==null&&(Un[Kn++]=Ei,Un[Kn++]=Ni,Un[Kn++]=bs,Ei=i.id,Ni=i.overflow,bs=s),s=cu(s,d.children),s.flags|=4096,s)}function gm(i,s,l){i.lanes|=s;var d=i.alternate;d!==null&&(d.lanes|=s),Fc(i.return,s,l)}function uu(i,s,l,d,m){var _=i.memoizedState;_===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:m}:(_.isBackwards=s,_.rendering=null,_.renderingStartTime=0,_.last=d,_.tail=l,_.tailMode=m)}function vm(i,s,l){var d=s.pendingProps,m=d.revealOrder,_=d.tail;if(yn(i,s,d.children,l),d=jt.current,(d&2)!==0)d=d&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&&gm(i,l,s);else if(i.tag===19)gm(i,l,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}d&=1}if(mt(jt,d),(s.mode&1)===0)s.memoizedState=null;else switch(m){case"forwards":for(l=s.child,m=null;l!==null;)i=l.alternate,i!==null&&Ra(i)===null&&(m=l),l=l.sibling;l=m,l===null?(m=s.child,s.child=null):(m=l.sibling,l.sibling=null),uu(s,!1,m,l,_);break;case"backwards":for(l=null,m=s.child,s.child=null;m!==null;){if(i=m.alternate,i!==null&&Ra(i)===null){s.child=m;break}i=m.sibling,m.sibling=l,l=m,m=i}uu(s,!0,l,null,_);break;case"together":uu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Ia(i,s){(s.mode&1)===0&&i!==null&&(i.alternate=null,s.alternate=null,s.flags|=2)}function Pi(i,s,l){if(i!==null&&(s.dependencies=i.dependencies),Ns|=s.lanes,(l&s.childLanes)===0)return null;if(i!==null&&s.child!==i.child)throw Error(n(153));if(s.child!==null){for(i=s.child,l=ns(i,i.pendingProps),s.child=l,l.return=s;i.sibling!==null;)i=i.sibling,l=l.sibling=ns(i,i.pendingProps),l.return=s;l.sibling=null}return s.child}function wb(i,s,l){switch(s.tag){case 3:fm(s),ar();break;case 5:Lp(s);break;case 1:En(s.type)&&_a(s);break;case 4:Wc(s,s.stateNode.containerInfo);break;case 10:var d=s.type._context,m=s.memoizedProps.value;mt(ka,d._currentValue),d._currentValue=m;break;case 13:if(d=s.memoizedState,d!==null)return d.dehydrated!==null?(mt(jt,jt.current&1),s.flags|=128,null):(l&s.child.childLanes)!==0?mm(i,s,l):(mt(jt,jt.current&1),i=Pi(i,s,l),i!==null?i.sibling:null);mt(jt,jt.current&1);break;case 19:if(d=(l&s.childLanes)!==0,(i.flags&128)!==0){if(d)return vm(i,s,l);s.flags|=128}if(m=s.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),mt(jt,jt.current),d)break;return null;case 22:case 23:return s.lanes=0,um(i,s,l)}return Pi(i,s,l)}var _m,du,ym,wm;_m=function(i,s){for(var l=s.child;l!==null;){if(l.tag===5||l.tag===6)i.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},du=function(){},ym=function(i,s,l,d){var m=i.memoizedProps;if(m!==d){i=s.stateNode,Cs(di.current);var _=null;switch(l){case"input":m=vt(i,m),d=vt(i,d),_=[];break;case"select":m=I({},m,{value:void 0}),d=I({},d,{value:void 0}),_=[];break;case"textarea":m=dt(i,m),d=dt(i,d),_=[];break;default:typeof m.onClick!="function"&&typeof d.onClick=="function"&&(i.onclick=ma)}je(l,d);var j;l=null;for(ce in m)if(!d.hasOwnProperty(ce)&&m.hasOwnProperty(ce)&&m[ce]!=null)if(ce==="style"){var K=m[ce];for(j in K)K.hasOwnProperty(j)&&(l||(l={}),l[j]="")}else ce!=="dangerouslySetInnerHTML"&&ce!=="children"&&ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&ce!=="autoFocus"&&(o.hasOwnProperty(ce)?_||(_=[]):(_=_||[]).push(ce,null));for(ce in d){var J=d[ce];if(K=m!=null?m[ce]:void 0,d.hasOwnProperty(ce)&&J!==K&&(J!=null||K!=null))if(ce==="style")if(K){for(j in K)!K.hasOwnProperty(j)||J&&J.hasOwnProperty(j)||(l||(l={}),l[j]="");for(j in J)J.hasOwnProperty(j)&&K[j]!==J[j]&&(l||(l={}),l[j]=J[j])}else l||(_||(_=[]),_.push(ce,l)),l=J;else ce==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,K=K?K.__html:void 0,J!=null&&K!==J&&(_=_||[]).push(ce,J)):ce==="children"?typeof J!="string"&&typeof J!="number"||(_=_||[]).push(ce,""+J):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(o.hasOwnProperty(ce)?(J!=null&&ce==="onScroll"&&_t("scroll",i),_||K===J||(_=[])):(_=_||[]).push(ce,J))}l&&(_=_||[]).push("style",l);var ce=_;(s.updateQueue=ce)&&(s.flags|=4)}},wm=function(i,s,l,d){l!==d&&(s.flags|=4)};function fo(i,s){if(!kt)switch(i.tailMode){case"hidden":s=i.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?i.tail=null:l.sibling=null;break;case"collapsed":l=i.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:d.sibling=null}}function mn(i){var s=i.alternate!==null&&i.alternate.child===i.child,l=0,d=0;if(s)for(var m=i.child;m!==null;)l|=m.lanes|m.childLanes,d|=m.subtreeFlags&14680064,d|=m.flags&14680064,m.return=i,m=m.sibling;else for(m=i.child;m!==null;)l|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=i,m=m.sibling;return i.subtreeFlags|=d,i.childLanes=l,s}function Sb(i,s,l){var d=s.pendingProps;switch(Dc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mn(s),null;case 1:return En(s.type)&&va(),mn(s),null;case 3:return d=s.stateNode,dr(),yt(Cn),yt(fn),qc(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(i===null||i.child===null)&&(ba(s)?s.flags|=4:i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,ni!==null&&(bu(ni),ni=null))),du(i,s),mn(s),null;case 5:Uc(s);var m=Cs(ao.current);if(l=s.type,i!==null&&s.stateNode!=null)ym(i,s,l,d,m),i.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!d){if(s.stateNode===null)throw Error(n(166));return mn(s),null}if(i=Cs(di.current),ba(s)){d=s.stateNode,l=s.type;var _=s.memoizedProps;switch(d[ui]=s,d[no]=_,i=(s.mode&1)!==0,l){case"dialog":_t("cancel",d),_t("close",d);break;case"iframe":case"object":case"embed":_t("load",d);break;case"video":case"audio":for(m=0;m<Zr.length;m++)_t(Zr[m],d);break;case"source":_t("error",d);break;case"img":case"image":case"link":_t("error",d),_t("load",d);break;case"details":_t("toggle",d);break;case"input":Xe(d,_),_t("invalid",d);break;case"select":d._wrapperState={wasMultiple:!!_.multiple},_t("invalid",d);break;case"textarea":le(d,_),_t("invalid",d)}je(l,_),m=null;for(var j in _)if(_.hasOwnProperty(j)){var K=_[j];j==="children"?typeof K=="string"?d.textContent!==K&&(_.suppressHydrationWarning!==!0&&pa(d.textContent,K,i),m=["children",K]):typeof K=="number"&&d.textContent!==""+K&&(_.suppressHydrationWarning!==!0&&pa(d.textContent,K,i),m=["children",""+K]):o.hasOwnProperty(j)&&K!=null&&j==="onScroll"&&_t("scroll",d)}switch(l){case"input":Ze(d),rt(d,_,!0);break;case"textarea":Ze(d),ze(d);break;case"select":case"option":break;default:typeof _.onClick=="function"&&(d.onclick=ma)}d=m,s.updateQueue=d,d!==null&&(s.flags|=4)}else{j=m.nodeType===9?m:m.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=Ie(l)),i==="http://www.w3.org/1999/xhtml"?l==="script"?(i=j.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof d.is=="string"?i=j.createElement(l,{is:d.is}):(i=j.createElement(l),l==="select"&&(j=i,d.multiple?j.multiple=!0:d.size&&(j.size=d.size))):i=j.createElementNS(i,l),i[ui]=s,i[no]=d,_m(i,s,!1,!1),s.stateNode=i;e:{switch(j=st(l,d),l){case"dialog":_t("cancel",i),_t("close",i),m=d;break;case"iframe":case"object":case"embed":_t("load",i),m=d;break;case"video":case"audio":for(m=0;m<Zr.length;m++)_t(Zr[m],i);m=d;break;case"source":_t("error",i),m=d;break;case"img":case"image":case"link":_t("error",i),_t("load",i),m=d;break;case"details":_t("toggle",i),m=d;break;case"input":Xe(i,d),m=vt(i,d),_t("invalid",i);break;case"option":m=d;break;case"select":i._wrapperState={wasMultiple:!!d.multiple},m=I({},d,{value:void 0}),_t("invalid",i);break;case"textarea":le(i,d),m=dt(i,d),_t("invalid",i);break;default:m=d}je(l,m),K=m;for(_ in K)if(K.hasOwnProperty(_)){var J=K[_];_==="style"?Re(i,J):_==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,J!=null&&ie(i,J)):_==="children"?typeof J=="string"?(l!=="textarea"||J!=="")&&W(i,J):typeof J=="number"&&W(i,""+J):_!=="suppressContentEditableWarning"&&_!=="suppressHydrationWarning"&&_!=="autoFocus"&&(o.hasOwnProperty(_)?J!=null&&_==="onScroll"&&_t("scroll",i):J!=null&&F(i,_,J,j))}switch(l){case"input":Ze(i),rt(i,d,!1);break;case"textarea":Ze(i),ze(i);break;case"option":d.value!=null&&i.setAttribute("value",""+ne(d.value));break;case"select":i.multiple=!!d.multiple,_=d.value,_!=null?ut(i,!!d.multiple,_,!1):d.defaultValue!=null&&ut(i,!!d.multiple,d.defaultValue,!0);break;default:typeof m.onClick=="function"&&(i.onclick=ma)}switch(l){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}}d&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return mn(s),null;case 6:if(i&&s.stateNode!=null)wm(i,s,i.memoizedProps,d);else{if(typeof d!="string"&&s.stateNode===null)throw Error(n(166));if(l=Cs(ao.current),Cs(di.current),ba(s)){if(d=s.stateNode,l=s.memoizedProps,d[ui]=s,(_=d.nodeValue!==l)&&(i=Dn,i!==null))switch(i.tag){case 3:pa(d.nodeValue,l,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&pa(d.nodeValue,l,(i.mode&1)!==0)}_&&(s.flags|=4)}else d=(l.nodeType===9?l:l.ownerDocument).createTextNode(d),d[ui]=s,s.stateNode=d}return mn(s),null;case 13:if(yt(jt),d=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(kt&&Mn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)xp(),ar(),s.flags|=98560,_=!1;else if(_=ba(s),d!==null&&d.dehydrated!==null){if(i===null){if(!_)throw Error(n(318));if(_=s.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(n(317));_[ui]=s}else ar(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;mn(s),_=!1}else ni!==null&&(bu(ni),ni=null),_=!0;if(!_)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=l,s):(d=d!==null,d!==(i!==null&&i.memoizedState!==null)&&d&&(s.child.flags|=8192,(s.mode&1)!==0&&(i===null||(jt.current&1)!==0?Ut===0&&(Ut=3):Cu())),s.updateQueue!==null&&(s.flags|=4),mn(s),null);case 4:return dr(),du(i,s),i===null&&eo(s.stateNode.containerInfo),mn(s),null;case 10:return zc(s.type._context),mn(s),null;case 17:return En(s.type)&&va(),mn(s),null;case 19:if(yt(jt),_=s.memoizedState,_===null)return mn(s),null;if(d=(s.flags&128)!==0,j=_.rendering,j===null)if(d)fo(_,!1);else{if(Ut!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(j=Ra(i),j!==null){for(s.flags|=128,fo(_,!1),d=j.updateQueue,d!==null&&(s.updateQueue=d,s.flags|=4),s.subtreeFlags=0,d=l,l=s.child;l!==null;)_=l,i=d,_.flags&=14680066,j=_.alternate,j===null?(_.childLanes=0,_.lanes=i,_.child=null,_.subtreeFlags=0,_.memoizedProps=null,_.memoizedState=null,_.updateQueue=null,_.dependencies=null,_.stateNode=null):(_.childLanes=j.childLanes,_.lanes=j.lanes,_.child=j.child,_.subtreeFlags=0,_.deletions=null,_.memoizedProps=j.memoizedProps,_.memoizedState=j.memoizedState,_.updateQueue=j.updateQueue,_.type=j.type,i=j.dependencies,_.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),l=l.sibling;return mt(jt,jt.current&1|2),s.child}i=i.sibling}_.tail!==null&&Bt()>mr&&(s.flags|=128,d=!0,fo(_,!1),s.lanes=4194304)}else{if(!d)if(i=Ra(j),i!==null){if(s.flags|=128,d=!0,l=i.updateQueue,l!==null&&(s.updateQueue=l,s.flags|=4),fo(_,!0),_.tail===null&&_.tailMode==="hidden"&&!j.alternate&&!kt)return mn(s),null}else 2*Bt()-_.renderingStartTime>mr&&l!==1073741824&&(s.flags|=128,d=!0,fo(_,!1),s.lanes=4194304);_.isBackwards?(j.sibling=s.child,s.child=j):(l=_.last,l!==null?l.sibling=j:s.child=j,_.last=j)}return _.tail!==null?(s=_.tail,_.rendering=s,_.tail=s.sibling,_.renderingStartTime=Bt(),s.sibling=null,l=jt.current,mt(jt,d?l&1|2:l&1),s):(mn(s),null);case 22:case 23:return ku(),d=s.memoizedState!==null,i!==null&&i.memoizedState!==null!==d&&(s.flags|=8192),d&&(s.mode&1)!==0?(An&1073741824)!==0&&(mn(s),s.subtreeFlags&6&&(s.flags|=8192)):mn(s),null;case 24:return null;case 25:return null}throw Error(n(156,s.tag))}function bb(i,s){switch(Dc(s),s.tag){case 1:return En(s.type)&&va(),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return dr(),yt(Cn),yt(fn),qc(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 5:return Uc(s),null;case 13:if(yt(jt),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(n(340));ar()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return yt(jt),null;case 4:return dr(),null;case 10:return zc(s.type._context),null;case 22:case 23:return ku(),null;case 24:return null;default:return null}}var Ba=!1,gn=!1,xb=typeof WeakSet=="function"?WeakSet:Set,Te=null;function fr(i,s){var l=i.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(d){Dt(i,s,d)}else l.current=null}function hu(i,s,l){try{l()}catch(d){Dt(i,s,d)}}var Sm=!1;function kb(i,s){if(kc=ia,i=Zf(),gc(i)){if("selectionStart"in i)var l={start:i.selectionStart,end:i.selectionEnd};else e:{l=(l=i.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var m=d.anchorOffset,_=d.focusNode;d=d.focusOffset;try{l.nodeType,_.nodeType}catch{l=null;break e}var j=0,K=-1,J=-1,ce=0,ye=0,be=i,_e=null;t:for(;;){for(var Le;be!==l||m!==0&&be.nodeType!==3||(K=j+m),be!==_||d!==0&&be.nodeType!==3||(J=j+d),be.nodeType===3&&(j+=be.nodeValue.length),(Le=be.firstChild)!==null;)_e=be,be=Le;for(;;){if(be===i)break t;if(_e===l&&++ce===m&&(K=j),_e===_&&++ye===d&&(J=j),(Le=be.nextSibling)!==null)break;be=_e,_e=be.parentNode}be=Le}l=K===-1||J===-1?null:{start:K,end:J}}else l=null}l=l||{start:0,end:0}}else l=null;for(Cc={focusedElem:i,selectionRange:l},ia=!1,Te=s;Te!==null;)if(s=Te,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,Te=i;else for(;Te!==null;){s=Te;try{var De=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(De!==null){var Me=De.memoizedProps,Ot=De.memoizedState,re=s.stateNode,ee=re.getSnapshotBeforeUpdate(s.elementType===s.type?Me:ii(s.type,Me),Ot);re.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var oe=s.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ce){Dt(s,s.return,Ce)}if(i=s.sibling,i!==null){i.return=s.return,Te=i;break}Te=s.return}return De=Sm,Sm=!1,De}function po(i,s,l){var d=s.updateQueue;if(d=d!==null?d.lastEffect:null,d!==null){var m=d=d.next;do{if((m.tag&i)===i){var _=m.destroy;m.destroy=void 0,_!==void 0&&hu(s,l,_)}m=m.next}while(m!==d)}}function Oa(i,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&i)===i){var d=l.create;l.destroy=d()}l=l.next}while(l!==s)}}function fu(i){var s=i.ref;if(s!==null){var l=i.stateNode;switch(i.tag){case 5:i=l;break;default:i=l}typeof s=="function"?s(i):s.current=i}}function bm(i){var s=i.alternate;s!==null&&(i.alternate=null,bm(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&(delete s[ui],delete s[no],delete s[jc],delete s[ob],delete s[ab])),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 xm(i){return i.tag===5||i.tag===3||i.tag===4}function km(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||xm(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 pu(i,s,l){var d=i.tag;if(d===5||d===6)i=i.stateNode,s?l.nodeType===8?l.parentNode.insertBefore(i,s):l.insertBefore(i,s):(l.nodeType===8?(s=l.parentNode,s.insertBefore(i,l)):(s=l,s.appendChild(i)),l=l._reactRootContainer,l!=null||s.onclick!==null||(s.onclick=ma));else if(d!==4&&(i=i.child,i!==null))for(pu(i,s,l),i=i.sibling;i!==null;)pu(i,s,l),i=i.sibling}function mu(i,s,l){var d=i.tag;if(d===5||d===6)i=i.stateNode,s?l.insertBefore(i,s):l.appendChild(i);else if(d!==4&&(i=i.child,i!==null))for(mu(i,s,l),i=i.sibling;i!==null;)mu(i,s,l),i=i.sibling}var ln=null,si=!1;function Ji(i,s,l){for(l=l.child;l!==null;)Cm(i,s,l),l=l.sibling}function Cm(i,s,l){if(ci&&typeof ci.onCommitFiberUnmount=="function")try{ci.onCommitFiberUnmount(Jo,l)}catch{}switch(l.tag){case 5:gn||fr(l,s);case 6:var d=ln,m=si;ln=null,Ji(i,s,l),ln=d,si=m,ln!==null&&(si?(i=ln,l=l.stateNode,i.nodeType===8?i.parentNode.removeChild(l):i.removeChild(l)):ln.removeChild(l.stateNode));break;case 18:ln!==null&&(si?(i=ln,l=l.stateNode,i.nodeType===8?Rc(i.parentNode,l):i.nodeType===1&&Rc(i,l),Kr(i)):Rc(ln,l.stateNode));break;case 4:d=ln,m=si,ln=l.stateNode.containerInfo,si=!0,Ji(i,s,l),ln=d,si=m;break;case 0:case 11:case 14:case 15:if(!gn&&(d=l.updateQueue,d!==null&&(d=d.lastEffect,d!==null))){m=d=d.next;do{var _=m,j=_.destroy;_=_.tag,j!==void 0&&((_&2)!==0||(_&4)!==0)&&hu(l,s,j),m=m.next}while(m!==d)}Ji(i,s,l);break;case 1:if(!gn&&(fr(l,s),d=l.stateNode,typeof d.componentWillUnmount=="function"))try{d.props=l.memoizedProps,d.state=l.memoizedState,d.componentWillUnmount()}catch(K){Dt(l,s,K)}Ji(i,s,l);break;case 21:Ji(i,s,l);break;case 22:l.mode&1?(gn=(d=gn)||l.memoizedState!==null,Ji(i,s,l),gn=d):Ji(i,s,l);break;default:Ji(i,s,l)}}function Em(i){var s=i.updateQueue;if(s!==null){i.updateQueue=null;var l=i.stateNode;l===null&&(l=i.stateNode=new xb),s.forEach(function(d){var m=Db.bind(null,i,d);l.has(d)||(l.add(d),d.then(m,m))})}}function ri(i,s){var l=s.deletions;if(l!==null)for(var d=0;d<l.length;d++){var m=l[d];try{var _=i,j=s,K=j;e:for(;K!==null;){switch(K.tag){case 5:ln=K.stateNode,si=!1;break e;case 3:ln=K.stateNode.containerInfo,si=!0;break e;case 4:ln=K.stateNode.containerInfo,si=!0;break e}K=K.return}if(ln===null)throw Error(n(160));Cm(_,j,m),ln=null,si=!1;var J=m.alternate;J!==null&&(J.return=null),m.return=null}catch(ce){Dt(m,s,ce)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Nm(s,i),s=s.sibling}function Nm(i,s){var l=i.alternate,d=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(ri(s,i),fi(i),d&4){try{po(3,i,i.return),Oa(3,i)}catch(Me){Dt(i,i.return,Me)}try{po(5,i,i.return)}catch(Me){Dt(i,i.return,Me)}}break;case 1:ri(s,i),fi(i),d&512&&l!==null&&fr(l,l.return);break;case 5:if(ri(s,i),fi(i),d&512&&l!==null&&fr(l,l.return),i.flags&32){var m=i.stateNode;try{W(m,"")}catch(Me){Dt(i,i.return,Me)}}if(d&4&&(m=i.stateNode,m!=null)){var _=i.memoizedProps,j=l!==null?l.memoizedProps:_,K=i.type,J=i.updateQueue;if(i.updateQueue=null,J!==null)try{K==="input"&&_.type==="radio"&&_.name!=null&&St(m,_),st(K,j);var ce=st(K,_);for(j=0;j<J.length;j+=2){var ye=J[j],be=J[j+1];ye==="style"?Re(m,be):ye==="dangerouslySetInnerHTML"?ie(m,be):ye==="children"?W(m,be):F(m,ye,be,ce)}switch(K){case"input":Et(m,_);break;case"textarea":xe(m,_);break;case"select":var _e=m._wrapperState.wasMultiple;m._wrapperState.wasMultiple=!!_.multiple;var Le=_.value;Le!=null?ut(m,!!_.multiple,Le,!1):_e!==!!_.multiple&&(_.defaultValue!=null?ut(m,!!_.multiple,_.defaultValue,!0):ut(m,!!_.multiple,_.multiple?[]:"",!1))}m[no]=_}catch(Me){Dt(i,i.return,Me)}}break;case 6:if(ri(s,i),fi(i),d&4){if(i.stateNode===null)throw Error(n(162));m=i.stateNode,_=i.memoizedProps;try{m.nodeValue=_}catch(Me){Dt(i,i.return,Me)}}break;case 3:if(ri(s,i),fi(i),d&4&&l!==null&&l.memoizedState.isDehydrated)try{Kr(s.containerInfo)}catch(Me){Dt(i,i.return,Me)}break;case 4:ri(s,i),fi(i);break;case 13:ri(s,i),fi(i),m=i.child,m.flags&8192&&(_=m.memoizedState!==null,m.stateNode.isHidden=_,!_||m.alternate!==null&&m.alternate.memoizedState!==null||(_u=Bt())),d&4&&Em(i);break;case 22:if(ye=l!==null&&l.memoizedState!==null,i.mode&1?(gn=(ce=gn)||ye,ri(s,i),gn=ce):ri(s,i),fi(i),d&8192){if(ce=i.memoizedState!==null,(i.stateNode.isHidden=ce)&&!ye&&(i.mode&1)!==0)for(Te=i,ye=i.child;ye!==null;){for(be=Te=ye;Te!==null;){switch(_e=Te,Le=_e.child,_e.tag){case 0:case 11:case 14:case 15:po(4,_e,_e.return);break;case 1:fr(_e,_e.return);var De=_e.stateNode;if(typeof De.componentWillUnmount=="function"){d=_e,l=_e.return;try{s=d,De.props=s.memoizedProps,De.state=s.memoizedState,De.componentWillUnmount()}catch(Me){Dt(d,l,Me)}}break;case 5:fr(_e,_e.return);break;case 22:if(_e.memoizedState!==null){Pm(be);continue}}Le!==null?(Le.return=_e,Te=Le):Pm(be)}ye=ye.sibling}e:for(ye=null,be=i;;){if(be.tag===5){if(ye===null){ye=be;try{m=be.stateNode,ce?(_=m.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none"):(K=be.stateNode,J=be.memoizedProps.style,j=J!=null&&J.hasOwnProperty("display")?J.display:null,K.style.display=ke("display",j))}catch(Me){Dt(i,i.return,Me)}}}else if(be.tag===6){if(ye===null)try{be.stateNode.nodeValue=ce?"":be.memoizedProps}catch(Me){Dt(i,i.return,Me)}}else if((be.tag!==22&&be.tag!==23||be.memoizedState===null||be===i)&&be.child!==null){be.child.return=be,be=be.child;continue}if(be===i)break e;for(;be.sibling===null;){if(be.return===null||be.return===i)break e;ye===be&&(ye=null),be=be.return}ye===be&&(ye=null),be.sibling.return=be.return,be=be.sibling}}break;case 19:ri(s,i),fi(i),d&4&&Em(i);break;case 21:break;default:ri(s,i),fi(i)}}function fi(i){var s=i.flags;if(s&2){try{e:{for(var l=i.return;l!==null;){if(xm(l)){var d=l;break e}l=l.return}throw Error(n(160))}switch(d.tag){case 5:var m=d.stateNode;d.flags&32&&(W(m,""),d.flags&=-33);var _=km(i);mu(i,_,m);break;case 3:case 4:var j=d.stateNode.containerInfo,K=km(i);pu(i,K,j);break;default:throw Error(n(161))}}catch(J){Dt(i,i.return,J)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function Cb(i,s,l){Te=i,Rm(i)}function Rm(i,s,l){for(var d=(i.mode&1)!==0;Te!==null;){var m=Te,_=m.child;if(m.tag===22&&d){var j=m.memoizedState!==null||Ba;if(!j){var K=m.alternate,J=K!==null&&K.memoizedState!==null||gn;K=Ba;var ce=gn;if(Ba=j,(gn=J)&&!ce)for(Te=m;Te!==null;)j=Te,J=j.child,j.tag===22&&j.memoizedState!==null?Lm(m):J!==null?(J.return=j,Te=J):Lm(m);for(;_!==null;)Te=_,Rm(_),_=_.sibling;Te=m,Ba=K,gn=ce}jm(i)}else(m.subtreeFlags&8772)!==0&&_!==null?(_.return=m,Te=_):jm(i)}}function jm(i){for(;Te!==null;){var s=Te;if((s.flags&8772)!==0){var l=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:gn||Oa(5,s);break;case 1:var d=s.stateNode;if(s.flags&4&&!gn)if(l===null)d.componentDidMount();else{var m=s.elementType===s.type?l.memoizedProps:ii(s.type,l.memoizedProps);d.componentDidUpdate(m,l.memoizedState,d.__reactInternalSnapshotBeforeUpdate)}var _=s.updateQueue;_!==null&&Pp(s,_,d);break;case 3:var j=s.updateQueue;if(j!==null){if(l=null,s.child!==null)switch(s.child.tag){case 5:l=s.child.stateNode;break;case 1:l=s.child.stateNode}Pp(s,j,l)}break;case 5:var K=s.stateNode;if(l===null&&s.flags&4){l=K;var J=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":J.autoFocus&&l.focus();break;case"img":J.src&&(l.src=J.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var ce=s.alternate;if(ce!==null){var ye=ce.memoizedState;if(ye!==null){var be=ye.dehydrated;be!==null&&Kr(be)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}gn||s.flags&512&&fu(s)}catch(_e){Dt(s,s.return,_e)}}if(s===i){Te=null;break}if(l=s.sibling,l!==null){l.return=s.return,Te=l;break}Te=s.return}}function Pm(i){for(;Te!==null;){var s=Te;if(s===i){Te=null;break}var l=s.sibling;if(l!==null){l.return=s.return,Te=l;break}Te=s.return}}function Lm(i){for(;Te!==null;){var s=Te;try{switch(s.tag){case 0:case 11:case 15:var l=s.return;try{Oa(4,s)}catch(J){Dt(s,l,J)}break;case 1:var d=s.stateNode;if(typeof d.componentDidMount=="function"){var m=s.return;try{d.componentDidMount()}catch(J){Dt(s,m,J)}}var _=s.return;try{fu(s)}catch(J){Dt(s,_,J)}break;case 5:var j=s.return;try{fu(s)}catch(J){Dt(s,j,J)}}}catch(J){Dt(s,s.return,J)}if(s===i){Te=null;break}var K=s.sibling;if(K!==null){K.return=s.return,Te=K;break}Te=s.return}}var Eb=Math.ceil,za=B.ReactCurrentDispatcher,gu=B.ReactCurrentOwner,Yn=B.ReactCurrentBatchConfig,at=0,Qt=null,Ft=null,cn=0,An=0,pr=qi(0),Ut=0,mo=null,Ns=0,Fa=0,vu=0,go=null,Rn=null,_u=0,mr=1/0,Li=null,$a=!1,yu=null,Qi=null,Ha=!1,Zi=null,Wa=0,vo=0,wu=null,Ua=-1,Ka=0;function wn(){return(at&6)!==0?Bt():Ua!==-1?Ua:Ua=Bt()}function es(i){return(i.mode&1)===0?1:(at&2)!==0&&cn!==0?cn&-cn:cb.transition!==null?(Ka===0&&(Ka=kf()),Ka):(i=ht,i!==0||(i=window.event,i=i===void 0?16:Df(i.type)),i)}function oi(i,s,l,d){if(50<vo)throw vo=0,wu=null,Error(n(185));Fr(i,l,d),((at&2)===0||i!==Qt)&&(i===Qt&&((at&2)===0&&(Fa|=l),Ut===4&&ts(i,cn)),jn(i,d),l===1&&at===0&&(s.mode&1)===0&&(mr=Bt()+500,ya&&Yi()))}function jn(i,s){var l=i.callbackNode;cS(i,s);var d=ea(i,i===Qt?cn:0);if(d===0)l!==null&&Ys(l),i.callbackNode=null,i.callbackPriority=0;else if(s=d&-d,i.callbackPriority!==s){if(l!=null&&Ys(l),s===1)i.tag===0?lb(Dm.bind(null,i)):_p(Dm.bind(null,i)),sb(function(){(at&6)===0&&Yi()}),l=null;else{switch(Cf(d)){case 1:l=Zl;break;case 4:l=bf;break;case 16:l=Xo;break;case 536870912:l=xf;break;default:l=Xo}l=$m(l,Tm.bind(null,i))}i.callbackPriority=s,i.callbackNode=l}}function Tm(i,s){if(Ua=-1,Ka=0,(at&6)!==0)throw Error(n(327));var l=i.callbackNode;if(gr()&&i.callbackNode!==l)return null;var d=ea(i,i===Qt?cn:0);if(d===0)return null;if((d&30)!==0||(d&i.expiredLanes)!==0||s)s=qa(i,d);else{s=d;var m=at;at|=2;var _=Am();(Qt!==i||cn!==s)&&(Li=null,mr=Bt()+500,js(i,s));do try{jb();break}catch(K){Mm(i,K)}while(!0);Oc(),za.current=_,at=m,Ft!==null?s=0:(Qt=null,cn=0,s=Ut)}if(s!==0){if(s===2&&(m=ec(i),m!==0&&(d=m,s=Su(i,m))),s===1)throw l=mo,js(i,0),ts(i,d),jn(i,Bt()),l;if(s===6)ts(i,d);else{if(m=i.current.alternate,(d&30)===0&&!Nb(m)&&(s=qa(i,d),s===2&&(_=ec(i),_!==0&&(d=_,s=Su(i,_))),s===1))throw l=mo,js(i,0),ts(i,d),jn(i,Bt()),l;switch(i.finishedWork=m,i.finishedLanes=d,s){case 0:case 1:throw Error(n(345));case 2:Ps(i,Rn,Li);break;case 3:if(ts(i,d),(d&130023424)===d&&(s=_u+500-Bt(),10<s)){if(ea(i,0)!==0)break;if(m=i.suspendedLanes,(m&d)!==d){wn(),i.pingedLanes|=i.suspendedLanes&m;break}i.timeoutHandle=Nc(Ps.bind(null,i,Rn,Li),s);break}Ps(i,Rn,Li);break;case 4:if(ts(i,d),(d&4194240)===d)break;for(s=i.eventTimes,m=-1;0<d;){var j=31-ei(d);_=1<<j,j=s[j],j>m&&(m=j),d&=~_}if(d=m,d=Bt()-d,d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3e3>d?3e3:4320>d?4320:1960*Eb(d/1960))-d,10<d){i.timeoutHandle=Nc(Ps.bind(null,i,Rn,Li),d);break}Ps(i,Rn,Li);break;case 5:Ps(i,Rn,Li);break;default:throw Error(n(329))}}}return jn(i,Bt()),i.callbackNode===l?Tm.bind(null,i):null}function Su(i,s){var l=go;return i.current.memoizedState.isDehydrated&&(js(i,s).flags|=256),i=qa(i,s),i!==2&&(s=Rn,Rn=l,s!==null&&bu(s)),i}function bu(i){Rn===null?Rn=i:Rn.push.apply(Rn,i)}function Nb(i){for(var s=i;;){if(s.flags&16384){var l=s.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var d=0;d<l.length;d++){var m=l[d],_=m.getSnapshot;m=m.value;try{if(!ti(_(),m))return!1}catch{return!1}}}if(l=s.child,s.subtreeFlags&16384&&l!==null)l.return=s,s=l;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 ts(i,s){for(s&=~vu,s&=~Fa,i.suspendedLanes|=s,i.pingedLanes&=~s,i=i.expirationTimes;0<s;){var l=31-ei(s),d=1<<l;i[l]=-1,s&=~d}}function Dm(i){if((at&6)!==0)throw Error(n(327));gr();var s=ea(i,0);if((s&1)===0)return jn(i,Bt()),null;var l=qa(i,s);if(i.tag!==0&&l===2){var d=ec(i);d!==0&&(s=d,l=Su(i,d))}if(l===1)throw l=mo,js(i,0),ts(i,s),jn(i,Bt()),l;if(l===6)throw Error(n(345));return i.finishedWork=i.current.alternate,i.finishedLanes=s,Ps(i,Rn,Li),jn(i,Bt()),null}function xu(i,s){var l=at;at|=1;try{return i(s)}finally{at=l,at===0&&(mr=Bt()+500,ya&&Yi())}}function Rs(i){Zi!==null&&Zi.tag===0&&(at&6)===0&&gr();var s=at;at|=1;var l=Yn.transition,d=ht;try{if(Yn.transition=null,ht=1,i)return i()}finally{ht=d,Yn.transition=l,at=s,(at&6)===0&&Yi()}}function ku(){An=pr.current,yt(pr)}function js(i,s){i.finishedWork=null,i.finishedLanes=0;var l=i.timeoutHandle;if(l!==-1&&(i.timeoutHandle=-1,ib(l)),Ft!==null)for(l=Ft.return;l!==null;){var d=l;switch(Dc(d),d.tag){case 1:d=d.type.childContextTypes,d!=null&&va();break;case 3:dr(),yt(Cn),yt(fn),qc();break;case 5:Uc(d);break;case 4:dr();break;case 13:yt(jt);break;case 19:yt(jt);break;case 10:zc(d.type._context);break;case 22:case 23:ku()}l=l.return}if(Qt=i,Ft=i=ns(i.current,null),cn=An=s,Ut=0,mo=null,vu=Fa=Ns=0,Rn=go=null,ks!==null){for(s=0;s<ks.length;s++)if(l=ks[s],d=l.interleaved,d!==null){l.interleaved=null;var m=d.next,_=l.pending;if(_!==null){var j=_.next;_.next=m,d.next=j}l.pending=d}ks=null}return i}function Mm(i,s){do{var l=Ft;try{if(Oc(),ja.current=Da,Pa){for(var d=Pt.memoizedState;d!==null;){var m=d.queue;m!==null&&(m.pending=null),d=d.next}Pa=!1}if(Es=0,Jt=Wt=Pt=null,lo=!1,co=0,gu.current=null,l===null||l.return===null){Ut=1,mo=s,Ft=null;break}e:{var _=i,j=l.return,K=l,J=s;if(s=cn,K.flags|=32768,J!==null&&typeof J=="object"&&typeof J.then=="function"){var ce=J,ye=K,be=ye.tag;if((ye.mode&1)===0&&(be===0||be===11||be===15)){var _e=ye.alternate;_e?(ye.updateQueue=_e.updateQueue,ye.memoizedState=_e.memoizedState,ye.lanes=_e.lanes):(ye.updateQueue=null,ye.memoizedState=null)}var Le=rm(j);if(Le!==null){Le.flags&=-257,om(Le,j,K,_,s),Le.mode&1&&sm(_,ce,s),s=Le,J=ce;var De=s.updateQueue;if(De===null){var Me=new Set;Me.add(J),s.updateQueue=Me}else De.add(J);break e}else{if((s&1)===0){sm(_,ce,s),Cu();break e}J=Error(n(426))}}else if(kt&&K.mode&1){var Ot=rm(j);if(Ot!==null){(Ot.flags&65536)===0&&(Ot.flags|=256),om(Ot,j,K,_,s),Ic(hr(J,K));break e}}_=J=hr(J,K),Ut!==4&&(Ut=2),go===null?go=[_]:go.push(_),_=j;do{switch(_.tag){case 3:_.flags|=65536,s&=-s,_.lanes|=s;var re=nm(_,J,s);jp(_,re);break e;case 1:K=J;var ee=_.type,oe=_.stateNode;if((_.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(Qi===null||!Qi.has(oe)))){_.flags|=65536,s&=-s,_.lanes|=s;var Ce=im(_,K,s);jp(_,Ce);break e}}_=_.return}while(_!==null)}Bm(l)}catch(Be){s=Be,Ft===l&&l!==null&&(Ft=l=l.return);continue}break}while(!0)}function Am(){var i=za.current;return za.current=Da,i===null?Da:i}function Cu(){(Ut===0||Ut===3||Ut===2)&&(Ut=4),Qt===null||(Ns&268435455)===0&&(Fa&268435455)===0||ts(Qt,cn)}function qa(i,s){var l=at;at|=2;var d=Am();(Qt!==i||cn!==s)&&(Li=null,js(i,s));do try{Rb();break}catch(m){Mm(i,m)}while(!0);if(Oc(),at=l,za.current=d,Ft!==null)throw Error(n(261));return Qt=null,cn=0,Ut}function Rb(){for(;Ft!==null;)Im(Ft)}function jb(){for(;Ft!==null&&!eS();)Im(Ft)}function Im(i){var s=Fm(i.alternate,i,An);i.memoizedProps=i.pendingProps,s===null?Bm(i):Ft=s,gu.current=null}function Bm(i){var s=i;do{var l=s.alternate;if(i=s.return,(s.flags&32768)===0){if(l=Sb(l,s,An),l!==null){Ft=l;return}}else{if(l=bb(l,s),l!==null){l.flags&=32767,Ft=l;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{Ut=6,Ft=null;return}}if(s=s.sibling,s!==null){Ft=s;return}Ft=s=i}while(s!==null);Ut===0&&(Ut=5)}function Ps(i,s,l){var d=ht,m=Yn.transition;try{Yn.transition=null,ht=1,Pb(i,s,l,d)}finally{Yn.transition=m,ht=d}return null}function Pb(i,s,l,d){do gr();while(Zi!==null);if((at&6)!==0)throw Error(n(327));l=i.finishedWork;var m=i.finishedLanes;if(l===null)return null;if(i.finishedWork=null,i.finishedLanes=0,l===i.current)throw Error(n(177));i.callbackNode=null,i.callbackPriority=0;var _=l.lanes|l.childLanes;if(uS(i,_),i===Qt&&(Ft=Qt=null,cn=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Ha||(Ha=!0,$m(Xo,function(){return gr(),null})),_=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||_){_=Yn.transition,Yn.transition=null;var j=ht;ht=1;var K=at;at|=4,gu.current=null,kb(i,l),Nm(l,i),XS(Cc),ia=!!kc,Cc=kc=null,i.current=l,Cb(l),tS(),at=K,ht=j,Yn.transition=_}else i.current=l;if(Ha&&(Ha=!1,Zi=i,Wa=m),_=i.pendingLanes,_===0&&(Qi=null),sS(l.stateNode),jn(i,Bt()),s!==null)for(d=i.onRecoverableError,l=0;l<s.length;l++)m=s[l],d(m.value,{componentStack:m.stack,digest:m.digest});if($a)throw $a=!1,i=yu,yu=null,i;return(Wa&1)!==0&&i.tag!==0&&gr(),_=i.pendingLanes,(_&1)!==0?i===wu?vo++:(vo=0,wu=i):vo=0,Yi(),null}function gr(){if(Zi!==null){var i=Cf(Wa),s=Yn.transition,l=ht;try{if(Yn.transition=null,ht=16>i?16:i,Zi===null)var d=!1;else{if(i=Zi,Zi=null,Wa=0,(at&6)!==0)throw Error(n(331));var m=at;for(at|=4,Te=i.current;Te!==null;){var _=Te,j=_.child;if((Te.flags&16)!==0){var K=_.deletions;if(K!==null){for(var J=0;J<K.length;J++){var ce=K[J];for(Te=ce;Te!==null;){var ye=Te;switch(ye.tag){case 0:case 11:case 15:po(8,ye,_)}var be=ye.child;if(be!==null)be.return=ye,Te=be;else for(;Te!==null;){ye=Te;var _e=ye.sibling,Le=ye.return;if(bm(ye),ye===ce){Te=null;break}if(_e!==null){_e.return=Le,Te=_e;break}Te=Le}}}var De=_.alternate;if(De!==null){var Me=De.child;if(Me!==null){De.child=null;do{var Ot=Me.sibling;Me.sibling=null,Me=Ot}while(Me!==null)}}Te=_}}if((_.subtreeFlags&2064)!==0&&j!==null)j.return=_,Te=j;else e:for(;Te!==null;){if(_=Te,(_.flags&2048)!==0)switch(_.tag){case 0:case 11:case 15:po(9,_,_.return)}var re=_.sibling;if(re!==null){re.return=_.return,Te=re;break e}Te=_.return}}var ee=i.current;for(Te=ee;Te!==null;){j=Te;var oe=j.child;if((j.subtreeFlags&2064)!==0&&oe!==null)oe.return=j,Te=oe;else e:for(j=ee;Te!==null;){if(K=Te,(K.flags&2048)!==0)try{switch(K.tag){case 0:case 11:case 15:Oa(9,K)}}catch(Be){Dt(K,K.return,Be)}if(K===j){Te=null;break e}var Ce=K.sibling;if(Ce!==null){Ce.return=K.return,Te=Ce;break e}Te=K.return}}if(at=m,Yi(),ci&&typeof ci.onPostCommitFiberRoot=="function")try{ci.onPostCommitFiberRoot(Jo,i)}catch{}d=!0}return d}finally{ht=l,Yn.transition=s}}return!1}function Om(i,s,l){s=hr(l,s),s=nm(i,s,1),i=Xi(i,s,1),s=wn(),i!==null&&(Fr(i,1,s),jn(i,s))}function Dt(i,s,l){if(i.tag===3)Om(i,i,l);else for(;s!==null;){if(s.tag===3){Om(s,i,l);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Qi===null||!Qi.has(d))){i=hr(l,i),i=im(s,i,1),s=Xi(s,i,1),i=wn(),s!==null&&(Fr(s,1,i),jn(s,i));break}}s=s.return}}function Lb(i,s,l){var d=i.pingCache;d!==null&&d.delete(s),s=wn(),i.pingedLanes|=i.suspendedLanes&l,Qt===i&&(cn&l)===l&&(Ut===4||Ut===3&&(cn&130023424)===cn&&500>Bt()-_u?js(i,0):vu|=l),jn(i,s)}function zm(i,s){s===0&&((i.mode&1)===0?s=1:(s=Zo,Zo<<=1,(Zo&130023424)===0&&(Zo=4194304)));var l=wn();i=Ri(i,s),i!==null&&(Fr(i,s,l),jn(i,l))}function Tb(i){var s=i.memoizedState,l=0;s!==null&&(l=s.retryLane),zm(i,l)}function Db(i,s){var l=0;switch(i.tag){case 13:var d=i.stateNode,m=i.memoizedState;m!==null&&(l=m.retryLane);break;case 19:d=i.stateNode;break;default:throw Error(n(314))}d!==null&&d.delete(s),zm(i,l)}var Fm;Fm=function(i,s,l){if(i!==null)if(i.memoizedProps!==s.pendingProps||Cn.current)Nn=!0;else{if((i.lanes&l)===0&&(s.flags&128)===0)return Nn=!1,wb(i,s,l);Nn=(i.flags&131072)!==0}else Nn=!1,kt&&(s.flags&1048576)!==0&&yp(s,Sa,s.index);switch(s.lanes=0,s.tag){case 2:var d=s.type;Ia(i,s),i=s.pendingProps;var m=sr(s,fn.current);ur(s,l),m=Gc(null,s,d,i,m,l);var _=Xc();return s.flags|=1,typeof m=="object"&&m!==null&&typeof m.render=="function"&&m.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,En(d)?(_=!0,_a(s)):_=!1,s.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,Hc(s),m.updater=Ma,s.stateNode=m,m._reactInternals=s,nu(s,d,i,l),s=ou(null,s,d,!0,_,l)):(s.tag=0,kt&&_&&Tc(s),yn(null,s,m,l),s=s.child),s;case 16:d=s.elementType;e:{switch(Ia(i,s),i=s.pendingProps,m=d._init,d=m(d._payload),s.type=d,m=s.tag=Ab(d),i=ii(d,i),m){case 0:s=ru(null,s,d,i,l);break e;case 1:s=hm(null,s,d,i,l);break e;case 11:s=am(null,s,d,i,l);break e;case 14:s=lm(null,s,d,ii(d.type,i),l);break e}throw Error(n(306,d,""))}return s;case 0:return d=s.type,m=s.pendingProps,m=s.elementType===d?m:ii(d,m),ru(i,s,d,m,l);case 1:return d=s.type,m=s.pendingProps,m=s.elementType===d?m:ii(d,m),hm(i,s,d,m,l);case 3:e:{if(fm(s),i===null)throw Error(n(387));d=s.pendingProps,_=s.memoizedState,m=_.element,Rp(i,s),Na(s,d,null,l);var j=s.memoizedState;if(d=j.element,_.isDehydrated)if(_={element:d,isDehydrated:!1,cache:j.cache,pendingSuspenseBoundaries:j.pendingSuspenseBoundaries,transitions:j.transitions},s.updateQueue.baseState=_,s.memoizedState=_,s.flags&256){m=hr(Error(n(423)),s),s=pm(i,s,d,l,m);break e}else if(d!==m){m=hr(Error(n(424)),s),s=pm(i,s,d,l,m);break e}else for(Mn=Ki(s.stateNode.containerInfo.firstChild),Dn=s,kt=!0,ni=null,l=Ep(s,null,d,l),s.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(ar(),d===m){s=Pi(i,s,l);break e}yn(i,s,d,l)}s=s.child}return s;case 5:return Lp(s),i===null&&Ac(s),d=s.type,m=s.pendingProps,_=i!==null?i.memoizedProps:null,j=m.children,Ec(d,m)?j=null:_!==null&&Ec(d,_)&&(s.flags|=32),dm(i,s),yn(i,s,j,l),s.child;case 6:return i===null&&Ac(s),null;case 13:return mm(i,s,l);case 4:return Wc(s,s.stateNode.containerInfo),d=s.pendingProps,i===null?s.child=lr(s,null,d,l):yn(i,s,d,l),s.child;case 11:return d=s.type,m=s.pendingProps,m=s.elementType===d?m:ii(d,m),am(i,s,d,m,l);case 7:return yn(i,s,s.pendingProps,l),s.child;case 8:return yn(i,s,s.pendingProps.children,l),s.child;case 12:return yn(i,s,s.pendingProps.children,l),s.child;case 10:e:{if(d=s.type._context,m=s.pendingProps,_=s.memoizedProps,j=m.value,mt(ka,d._currentValue),d._currentValue=j,_!==null)if(ti(_.value,j)){if(_.children===m.children&&!Cn.current){s=Pi(i,s,l);break e}}else for(_=s.child,_!==null&&(_.return=s);_!==null;){var K=_.dependencies;if(K!==null){j=_.child;for(var J=K.firstContext;J!==null;){if(J.context===d){if(_.tag===1){J=ji(-1,l&-l),J.tag=2;var ce=_.updateQueue;if(ce!==null){ce=ce.shared;var ye=ce.pending;ye===null?J.next=J:(J.next=ye.next,ye.next=J),ce.pending=J}}_.lanes|=l,J=_.alternate,J!==null&&(J.lanes|=l),Fc(_.return,l,s),K.lanes|=l;break}J=J.next}}else if(_.tag===10)j=_.type===s.type?null:_.child;else if(_.tag===18){if(j=_.return,j===null)throw Error(n(341));j.lanes|=l,K=j.alternate,K!==null&&(K.lanes|=l),Fc(j,l,s),j=_.sibling}else j=_.child;if(j!==null)j.return=_;else for(j=_;j!==null;){if(j===s){j=null;break}if(_=j.sibling,_!==null){_.return=j.return,j=_;break}j=j.return}_=j}yn(i,s,m.children,l),s=s.child}return s;case 9:return m=s.type,d=s.pendingProps.children,ur(s,l),m=qn(m),d=d(m),s.flags|=1,yn(i,s,d,l),s.child;case 14:return d=s.type,m=ii(d,s.pendingProps),m=ii(d.type,m),lm(i,s,d,m,l);case 15:return cm(i,s,s.type,s.pendingProps,l);case 17:return d=s.type,m=s.pendingProps,m=s.elementType===d?m:ii(d,m),Ia(i,s),s.tag=1,En(d)?(i=!0,_a(s)):i=!1,ur(s,l),em(s,d,m),nu(s,d,m,l),ou(null,s,d,!0,i,l);case 19:return vm(i,s,l);case 22:return um(i,s,l)}throw Error(n(156,s.tag))};function $m(i,s){return Oi(i,s)}function Mb(i,s,l,d){this.tag=i,this.key=l,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=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gn(i,s,l,d){return new Mb(i,s,l,d)}function Eu(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Ab(i){if(typeof i=="function")return Eu(i)?1:0;if(i!=null){if(i=i.$$typeof,i===M)return 11;if(i===O)return 14}return 2}function ns(i,s){var l=i.alternate;return l===null?(l=Gn(i.tag,s,i.key,i.mode),l.elementType=i.elementType,l.type=i.type,l.stateNode=i.stateNode,l.alternate=i,i.alternate=l):(l.pendingProps=s,l.type=i.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=i.flags&14680064,l.childLanes=i.childLanes,l.lanes=i.lanes,l.child=i.child,l.memoizedProps=i.memoizedProps,l.memoizedState=i.memoizedState,l.updateQueue=i.updateQueue,s=i.dependencies,l.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},l.sibling=i.sibling,l.index=i.index,l.ref=i.ref,l}function Va(i,s,l,d,m,_){var j=2;if(d=i,typeof i=="function")Eu(i)&&(j=1);else if(typeof i=="string")j=5;else e:switch(i){case z:return Ls(l.children,m,_,s);case te:j=8,m|=8;break;case H:return i=Gn(12,l,s,m|2),i.elementType=H,i.lanes=_,i;case E:return i=Gn(13,l,s,m),i.elementType=E,i.lanes=_,i;case D:return i=Gn(19,l,s,m),i.elementType=D,i.lanes=_,i;case $:return Ya(l,m,_,s);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case X:j=10;break e;case A:j=9;break e;case M:j=11;break e;case O:j=14;break e;case P:j=16,d=null;break e}throw Error(n(130,i==null?i:typeof i,""))}return s=Gn(j,l,s,m),s.elementType=i,s.type=d,s.lanes=_,s}function Ls(i,s,l,d){return i=Gn(7,i,d,s),i.lanes=l,i}function Ya(i,s,l,d){return i=Gn(22,i,d,s),i.elementType=$,i.lanes=l,i.stateNode={isHidden:!1},i}function Nu(i,s,l){return i=Gn(6,i,null,s),i.lanes=l,i}function Ru(i,s,l){return s=Gn(4,i.children!==null?i.children:[],i.key,s),s.lanes=l,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}function Ib(i,s,l,d,m){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=tc(0),this.expirationTimes=tc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tc(0),this.identifierPrefix=d,this.onRecoverableError=m,this.mutableSourceEagerHydrationData=null}function ju(i,s,l,d,m,_,j,K,J){return i=new Ib(i,s,l,K,J),s===1?(s=1,_===!0&&(s|=8)):s=0,_=Gn(3,null,null,s),i.current=_,_.stateNode=i,_.memoizedState={element:d,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hc(_),i}function Bb(i,s,l){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:G,key:d==null?null:""+d,children:i,containerInfo:s,implementation:l}}function Hm(i){if(!i)return Vi;i=i._reactInternals;e:{if(Fe(i)!==i||i.tag!==1)throw Error(n(170));var s=i;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(En(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(n(171))}if(i.tag===1){var l=i.type;if(En(l))return gp(i,l,s)}return s}function Wm(i,s,l,d,m,_,j,K,J){return i=ju(l,d,!0,i,m,_,j,K,J),i.context=Hm(null),l=i.current,d=wn(),m=es(l),_=ji(d,m),_.callback=s??null,Xi(l,_,m),i.current.lanes=m,Fr(i,m,d),jn(i,d),i}function Ga(i,s,l,d){var m=s.current,_=wn(),j=es(m);return l=Hm(l),s.context===null?s.context=l:s.pendingContext=l,s=ji(_,j),s.payload={element:i},d=d===void 0?null:d,d!==null&&(s.callback=d),i=Xi(m,s,j),i!==null&&(oi(i,m,j,_),Ea(i,m,j)),j}function Xa(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 Um(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var l=i.retryLane;i.retryLane=l!==0&&l<s?l:s}}function Pu(i,s){Um(i,s),(i=i.alternate)&&Um(i,s)}function Ob(){return null}var Km=typeof reportError=="function"?reportError:function(i){console.error(i)};function Lu(i){this._internalRoot=i}Ja.prototype.render=Lu.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(n(409));Ga(i,s,null,null)},Ja.prototype.unmount=Lu.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Rs(function(){Ga(null,i,null,null)}),s[ki]=null}};function Ja(i){this._internalRoot=i}Ja.prototype.unstable_scheduleHydration=function(i){if(i){var s=Rf();i={blockedOn:null,target:i,priority:s};for(var l=0;l<Hi.length&&s!==0&&s<Hi[l].priority;l++);Hi.splice(l,0,i),l===0&&Lf(i)}};function Tu(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Qa(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function qm(){}function zb(i,s,l,d,m){if(m){if(typeof d=="function"){var _=d;d=function(){var ce=Xa(j);_.call(ce)}}var j=Wm(s,d,i,0,null,!1,!1,"",qm);return i._reactRootContainer=j,i[ki]=j.current,eo(i.nodeType===8?i.parentNode:i),Rs(),j}for(;m=i.lastChild;)i.removeChild(m);if(typeof d=="function"){var K=d;d=function(){var ce=Xa(J);K.call(ce)}}var J=ju(i,0,!1,null,null,!1,!1,"",qm);return i._reactRootContainer=J,i[ki]=J.current,eo(i.nodeType===8?i.parentNode:i),Rs(function(){Ga(s,J,l,d)}),J}function Za(i,s,l,d,m){var _=l._reactRootContainer;if(_){var j=_;if(typeof m=="function"){var K=m;m=function(){var J=Xa(j);K.call(J)}}Ga(s,j,i,m)}else j=zb(l,s,i,m,d);return Xa(j)}Ef=function(i){switch(i.tag){case 3:var s=i.stateNode;if(s.current.memoizedState.isDehydrated){var l=zr(s.pendingLanes);l!==0&&(nc(s,l|1),jn(s,Bt()),(at&6)===0&&(mr=Bt()+500,Yi()))}break;case 13:Rs(function(){var d=Ri(i,1);if(d!==null){var m=wn();oi(d,i,1,m)}}),Pu(i,1)}},ic=function(i){if(i.tag===13){var s=Ri(i,134217728);if(s!==null){var l=wn();oi(s,i,134217728,l)}Pu(i,134217728)}},Nf=function(i){if(i.tag===13){var s=es(i),l=Ri(i,s);if(l!==null){var d=wn();oi(l,i,s,d)}Pu(i,s)}},Rf=function(){return ht},jf=function(i,s){var l=ht;try{return ht=i,s()}finally{ht=l}},_n=function(i,s,l){switch(s){case"input":if(Et(i,l),s=l.name,l.type==="radio"&&s!=null){for(l=i;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<l.length;s++){var d=l[s];if(d!==i&&d.form===i.form){var m=ga(d);if(!m)throw Error(n(90));$e(d),Et(d,m)}}}break;case"textarea":xe(i,l);break;case"select":s=l.value,s!=null&&ut(i,!!l.multiple,s,!1)}},de=xu,Ne=Rs;var Fb={usingClientEntryPoint:!1,Events:[io,nr,ga,Hn,li,xu]},_o={findFiberByHostInstance:ws,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$b={bundleType:_o.bundleType,version:_o.version,rendererPackageName:_o.rendererPackageName,rendererConfig:_o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:B.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Rt(i),i===null?null:i.stateNode},findFiberByHostInstance:_o.findFiberByHostInstance||Ob,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 el=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!el.isDisabled&&el.supportsFiber)try{Jo=el.inject($b),ci=el}catch{}}return Pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Fb,Pn.createPortal=function(i,s){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Tu(s))throw Error(n(200));return Bb(i,s,null,l)},Pn.createRoot=function(i,s){if(!Tu(i))throw Error(n(299));var l=!1,d="",m=Km;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onRecoverableError!==void 0&&(m=s.onRecoverableError)),s=ju(i,1,!1,null,null,l,!1,d,m),i[ki]=s.current,eo(i.nodeType===8?i.parentNode:i),new Lu(s)},Pn.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(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=Rt(s),i=i===null?null:i.stateNode,i},Pn.flushSync=function(i){return Rs(i)},Pn.hydrate=function(i,s,l){if(!Qa(s))throw Error(n(200));return Za(null,i,s,!0,l)},Pn.hydrateRoot=function(i,s,l){if(!Tu(i))throw Error(n(405));var d=l!=null&&l.hydratedSources||null,m=!1,_="",j=Km;if(l!=null&&(l.unstable_strictMode===!0&&(m=!0),l.identifierPrefix!==void 0&&(_=l.identifierPrefix),l.onRecoverableError!==void 0&&(j=l.onRecoverableError)),s=Wm(s,null,i,1,l??null,m,!1,_,j),i[ki]=s.current,eo(i),d)for(i=0;i<d.length;i++)l=d[i],m=l._getVersion,m=m(l._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[l,m]:s.mutableSourceEagerHydrationData.push(l,m);return new Ja(s)},Pn.render=function(i,s,l){if(!Qa(s))throw Error(n(200));return Za(null,i,s,!1,l)},Pn.unmountComponentAtNode=function(i){if(!Qa(i))throw Error(n(40));return i._reactRootContainer?(Rs(function(){Za(null,null,i,!1,function(){i._reactRootContainer=null,i[ki]=null})}),!0):!1},Pn.unstable_batchedUpdates=xu,Pn.unstable_renderSubtreeIntoContainer=function(i,s,l,d){if(!Qa(l))throw Error(n(200));if(i==null||i._reactInternals===void 0)throw Error(n(38));return Za(i,s,l,!1,d)},Pn.version="18.3.1-next-f1338f8080-20240426",Pn}var eg;function Xb(){if(eg)return Au.exports;eg=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(),Au.exports=Gb(),Au.exports}var tg;function Jb(){if(tg)return tl;tg=1;var e=Xb();return tl.createRoot=e.createRoot,tl.hydrateRoot=e.hydrateRoot,tl}var Qb=Jb();const Zb=Th(Qb);function Vt(e,t,n={}){return fetch(e,{...n,headers:{...n.headers||{},Authorization:`Bearer ${t}`}})}const D_=e=>`nc_seen_${e}`;async function Ae(e,t,n={}){const r=await Vt(e,t,{method:n.method||"GET",headers:{"content-type":"application/json"},body:n.body?JSON.stringify(n.body):void 0}),o=await r.json().catch(()=>({}));if(!r.ok){const a=new Error(o.error||`HTTP ${r.status}`);throw a.status=r.status,a.data=o,a}return o}const bn=e=>Array.isArray(e)&&e.length?`/api/route/${e.map(encodeURIComponent).join("/")}/_`:"/api",rn=(e,t)=>`${bn(e)}/fleet/${t}`,vs=(e,t)=>Ae(rn(t,"status"),e),Mh=(e,t,n)=>Ae(rn(n,"up"),e,{method:"POST",body:t}),kl=(e,t,n)=>Ae(rn(n,"down"),e,{method:"POST",body:t}),M_=(e,t,n)=>Ae(rn(n,"boot"),e,{method:"POST",body:t}),jo=(e,t,n)=>Ae(rn(n,"restart"),e,{method:"POST",body:{cell:t}}),Ah=(e,t)=>Ae(rn(t,"definitions"),e),e0=(e,t)=>Ae(rn(t,"credentials/status"),e),ng=(e,t,n,r)=>Ae(rn(r,"credentials/set"),e,{method:"POST",body:{envKey:t,value:n}}),t0=(e,t,n)=>Ae(rn(n,"credentials/remove"),e,{method:"POST",body:{envKey:t}}),n0=(e,t,n)=>Ae(rn(n,"define-engine"),e,{method:"POST",body:{def:t}}),i0=(e,t,n,r,o)=>Ae(rn(o,"edit-engine"),e,{method:"POST",body:{id:t,patch:n,envChanges:r}}),s0=(e,t,n)=>Ae(rn(n,"remove-engine"),e,{method:"POST",body:{id:t}}),r0=(e,t,n)=>Ae(rn(n,"define-cell"),e,{method:"POST",body:{def:t}}),A_=(e,t,n,r)=>Ae(rn(r,"edit-cell"),e,{method:"POST",body:{id:t,patch:n}}),I_=(e,t,n=!1,r)=>Ae(rn(r,"remove-cell"),e,{method:"POST",body:{id:t,stop:n}}),o0=(e,t,n)=>Ae(rn(n,"import-cell"),e,{method:"POST",body:t}),a0=(e,t,n)=>Ae(rn(n,"restore-cells"),e,{method:"POST",body:{cells:t}}),l0=(e,t,n,r)=>Ae(rn(r,"restore-engines"),e,{method:"POST",body:{engines:t,overwrite:!!n}}),Ih=(e,t,n)=>Ae(`${bn(n)}/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),B_=(e,t,n,r)=>Ae(`${bn(r)}/sessions/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{technical:!!n}}),Bh=(e,t,n)=>Ae(`${bn(n)}/fs/dirs${t?`?path=${encodeURIComponent(t)}`:""}`,e),O_=e=>Ae("/api/settings",e),c0=e=>Ae("/api/nodes",e),u0=e=>Ae("/api/peers",e),d0=e=>Ae("/api/topology",e),z_=(e,t)=>Ae(`${bn(t)}/sessions`,e),Oh=(e,t)=>Ae(`${bn(t)}/config`,e),ig=(e,t)=>Ae(`${bn(t)}/topology`,e),jd=(e,t)=>Ae("/api/settings/config",e,{method:"POST",body:t}),h0=e=>Ae("/api/settings/token/rotate",e,{method:"POST"}),f0=(e,t)=>Ae("/api/settings/nodes/pair",e,{method:"POST",body:t}),sg=(e,t,n=[])=>Ae(`${bn(n)}/settings/peering/invite`,e,{method:"POST",body:t||{}}),F_=(e,t,n)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/label`,e,{method:"PATCH",body:{label:n}}),p0=e=>Ae("/api/settings/node-aliases",e),m0=(e,t,n)=>Ae(`/api/settings/node-aliases/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{alias:n}}),rg=(e,t)=>Ae(`/api/settings/node-aliases/${encodeURIComponent(t)}`,e,{method:"DELETE"}),g0=(e,t,n)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"PATCH",body:n}),v0=(e,t)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"DELETE"}),zh=(e,t,n)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/${n}`,e,{method:"POST"}),_0=(e,t,n)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/share`,e,{method:"PATCH",body:{shared:n}}),og=(e,t,n,r=[])=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{visibility:n,selected:r}}),y0=e=>Ae("/api/settings/audio",e),w0=(e,t)=>Ae("/api/settings/audio/consent",e,{method:"PATCH",body:{consent:t}}),S0=e=>Ae("/api/settings/audio/test",e,{method:"POST",body:{}}),b0=e=>Ae("/api/settings/audio/stop",e,{method:"POST",body:{}}),x0=e=>Ae("/api/settings/audio/groups",e),k0=(e,t,n)=>Ae(`/api/settings/audio/groups/${encodeURIComponent(t)}`,e,{method:"PUT",body:n}),C0=(e,t)=>Ae(`/api/settings/audio/groups/${encodeURIComponent(t)}`,e,{method:"DELETE"}),E0=e=>Ae("/api/settings/service/regenerate",e,{method:"POST"}),N0=e=>Ae("/api/settings/update/check",e,{method:"POST"}),R0=e=>Ae("/api/settings/update/apply",e,{method:"POST"}),$l=(e,t)=>`${bn(e)}/diagnostics/${t}`,j0=(e,t=[])=>Ae($l(t,"status"),e),P0=(e,{after:t=0,limit:n=200}={},r=[])=>Ae(`${$l(r,"logs")}?after=${encodeURIComponent(t)}&limit=${encodeURIComponent(n)}`,e),ag=(e,t,n,r=[])=>Ae($l(r,"verbose"),e,{method:"PATCH",body:{enabled:t,durationSeconds:n}}),L0=(e,t=[])=>Ae($l(t,"logs"),e,{method:"DELETE"}),T0=(e,t=!0)=>Ae(`/api/asks${t?"?open=1":""}`,e),D0=(e,t,n)=>Ae(`/api/asks/${encodeURIComponent(t)}/answer`,e,{method:"POST",body:{text:n}}),nl=(e,t=[])=>Ae(`${bn(t)}/decks`,e),lg=(e,t,n=[])=>Ae(`${bn(n)}/decks`,e,{method:"POST",body:{name:t}}),il=(e,t,n,r,o=[])=>Ae(`${bn(o)}/decks/${encodeURIComponent(t)}`,e,{method:"PUT",body:{layout:n,expectedRevision:r}}),M0=(e,t,n,r,o=[])=>Ae(`${bn(o)}/decks/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{name:n,expectedRevision:r}}),A0=(e,t,n,r=[])=>Ae(`${bn(r)}/decks/${encodeURIComponent(t)}`,e,{method:"DELETE",body:{expectedRevision:n}}),I0={power:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M12 3v8"}),c.jsx("path",{d:"M6.6 6.6a8 8 0 1 0 10.8 0"})]}),folder:c.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:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),c.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),c.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),c.jsx("path",{d:"M12 18v3"})]}),enter:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),c.jsx("polyline",{points:"9 9 5 13 9 17"})]}),send:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M22 2 15 22 11 13 2 9Z"}),c.jsx("path",{d:"M22 2 11 13"})]}),trash:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M4 7h16"}),c.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),c.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),c.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:c.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),c.jsx("polyline",{points:"21 3 21 8 16 8"})]}),boot:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3",y:"4",width:"18",height:"13",rx:"2"}),c.jsx("path",{d:"M8 21h8M12 17v4M12 12V7"}),c.jsx("polyline",{points:"9 10 12 7 15 10"})]}),upload:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M12 16V5"}),c.jsx("polyline",{points:"8 9 12 5 16 9"}),c.jsx("path",{d:"M5 20h14"})]}),chevronLeft:c.jsx("polyline",{points:"14 6 8 12 14 18"}),chevronUp:c.jsx("polyline",{points:"6 14 12 8 18 14"}),chevronDown:c.jsx("polyline",{points:"6 10 12 16 18 10"}),history:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),c.jsx("polyline",{points:"3 3 3 8 8 8"}),c.jsx("path",{d:"M12 7v5l3 2"})]}),attach:c.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:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),c.jsx("polyline",{points:"14 2 14 8 20 8"})]}),camera:c.jsxs(c.Fragment,{children:[c.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"}),c.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),image:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),c.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),c.jsx("path",{d:"M21 15l-5-5L5 21"})]}),zoomIn:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"11",cy:"11",r:"7"}),c.jsx("path",{d:"M21 21l-4.35-4.35"}),c.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"11",cy:"11",r:"7"}),c.jsx("path",{d:"M21 21l-4.35-4.35"}),c.jsx("path",{d:"M8 11h6"})]}),gear:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"12",cy:"12",r:"3"}),c.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:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),c.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})};function it({name:e,size:t=20}){return c.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:I0[e]||null})}const B0=["all","pinned","active","off","technical"],$_="nc_sidebar_views_v1",H_="nc_sidebar_order_v1";function W_(e){return B0.includes(e)?e:"all"}function O0(e,t=[],n="all"){const r=W_(n);return r==="technical"?e.technical===!0:e.technical===!0?!1:r==="pinned"?t.includes(e.key):r==="active"?!!e.live:r==="off"?!e.live:!0}function z0(e,t,n=[],r=[]){const o=n.indexOf(e.key),a=n.indexOf(t.key),u=o===-1?Number.MAX_SAFE_INTEGER:o,h=a===-1?Number.MAX_SAFE_INTEGER:a,f=r.indexOf(e.key),p=r.indexOf(t.key),v=f===-1?Number.MAX_SAFE_INTEGER:f,x=p===-1?Number.MAX_SAFE_INTEGER:p;return u-h||v-x||+!!t.live-+!!e.live||+!!t.fresh-+!!e.fresh||Number(t.activity||0)-Number(e.activity||0)||String(e.label||"").localeCompare(String(t.label||""))||String(e.key||"").localeCompare(String(t.key||""))}function F0(e=globalThis.localStorage){try{const t=JSON.parse(e.getItem(H_));if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t).slice(0,64)){if(typeof r!="string"||!r||r.length>160||!Array.isArray(o))continue;const a=[...new Set(o.filter(u=>typeof u=="string"&&u&&u.length<=256))].slice(0,128);a.length&&(n[r]=a)}return n}catch{return{}}}function fs(e,t){return Array.isArray(e==null?void 0:e[t])?e[t]:[]}function $0(e,t=globalThis.localStorage){try{t.setItem(H_,JSON.stringify(e))}catch{}return e}function H0(e,t,n,r,o=[]){if(typeof t!="string"||!t||n===r)return e;const a=[...new Set(o.filter(w=>typeof w=="string"&&w))];if(!a.includes(n)||!a.includes(r))return e;const u=fs(e,t).filter(w=>a.includes(w)),h=[...u,...a.filter(w=>!u.includes(w))],f=h.indexOf(n),p=h.indexOf(r);h.splice(f,1);const v=h.indexOf(r),x=f<p?v+1:v;return h.splice(x,0,n),{...e,[t]:h}}function W0(e=globalThis.localStorage){try{const t=JSON.parse(e.getItem($_));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function cg(e,t){var n,r;return{open:((n=e==null?void 0:e[t])==null?void 0:n.open)!==!1,filter:W_((r=e==null?void 0:e[t])==null?void 0:r.filter)}}function U0(e,t=globalThis.localStorage){try{t.setItem($_,JSON.stringify(e))}catch{}return e}function ug(e,t=""){const n=String(t||"").trim().toLocaleLowerCase();return n?[e.label,e.key,e.searchText].filter(Boolean).join(" ").toLocaleLowerCase().includes(n):!0}function Fs(e=[],t=[],n="all",r=[]){return[...e].filter(o=>O0(o,t,n)).sort((o,a)=>z0(o,a,t,r))}const Fh=["it","en","es"];function K0(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return Fh.includes(t)?t:"en"}catch{return"en"}}const gl=K0(),U_="nc_lang",Pd="nc-lang";function K_(){return typeof localStorage<"u"?localStorage:null}const sl={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","grid-full":"il deck può mostrare al massimo 9 sessioni",pin:"fissa in cima",reorder:"riordina","reorder-help":"trascina la maniglia; frecce su/giu da tastiera","rename-node":"rinomina nodo","rename-node-prompt":"Nuovo nome del nodo in NexusCrew","rename-node-invalid":"Nome non valido: massimo 64 caratteri, senza a capo.","reorder-deck-help":"trascina il deck; frecce sinistra/destra da tastiera",sessions:"sessioni","new-session":"nuova sessione",new:"nuova",fleet:"Flotta","fleet-tmux":"flotta tmux","other-sessions":"Altre sessioni","view-all":"tutte","view-pinned":"fissate","view-active":"attive","view-off":"spente","view-technical":"tecniche","mark-technical":"nascondi come sessione tecnica","mark-normal":"mostra come sessione normale","position-local":"Locale",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-working":"al lavoro","cell-idle":"in attesa","cell-degraded":"degradata: unit attiva, tmux morto","power-on":"accendi","power-off":"spegni","boot-enable":"attiva al boot","boot-disable":"disattiva al boot","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","power-config-in-settings":"Engine, provider, profilo, modello e permessi si modificano in Impostazioni → Flotta.","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…","composer-history-tools":"cronologia e dimensione input","composer-history":"cronologia della cella","composer-history-empty":"nessun input inviato","composer-history-clear":"cancella cronologia di questa cella","composer-expand":"espandi input","composer-collapse":"riduci input","composer-clear-data":"cancella bozze e cronologia","composer-clear-data-help":"Rimuove da questo browser tutte le bozze e la cronologia input delle celle.","composer-clear-confirm":"Cancellare tutte le bozze e la cronologia input salvate in questo browser?","composer-clear-done":"Bozze e cronologia cancellate.","composer-clear-failed":"Impossibile cancellare i dati del composer in questo browser.",attach:"allega","attach-file":"File","attach-camera":"Fotocamera","attach-gallery":"Galleria","attach-uploading":"carico…","attach-upload-progress":"allegato {n}/{total}…","attach-uploaded":"{n} allegati caricati",voice:"voice",send:"invia","composer-send-failed":"connessione non pronta — testo conservato, riprova",close:"chiudi","lang-label":"lingua",decks:"deck","new-deck":"nuovo deck","deck-name":"nome deck","open-deck-window":"apri in una nuova finestra","detach-deck":"stacca in una nuova finestra","deck-current":"questo deck (finestra corrente)","deck-owner-unavailable":"nodo owner non condiviso o non raggiungibile","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","expand-owner":"espandi i deck di {owner}","collapse-owner":"comprimi i deck di {owner}","owner-deck-count-one":"{count} deck","owner-deck-count-many":"{count} deck","dot-working":"in uso (finestra attiva)","dot-on":"aperta in background","dot-neutral":"non aperta","dot-warn":"nodo offline","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","pairing-connect-help":"Per collegare un nodo servono: nome, Host SSH già funzionante e link/QR creato sull’altra installazione NexusCrew.","pairing-localhost-hint":"127.0.0.1 nel link è corretto: non aprirlo qui. NexusCrew usa invito e porta attraverso l’Host SSH.","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","tab-audio":"audio","system-general":"generale","system-diagnostics":"diagnostica","system-this-node":"questo nodo","system-updates":"aggiornamenti","system-security":"sicurezza","system-local-data":"dati locali del browser","system-terminal":"terminale","alternate-screen":"schermo alternato","alternate-screen-help":"Mantiene il comportamento tmux standard per le nuove sessioni NexusCrew; il trascinamento nel terminale web non scorre i TUI a schermo intero. Non modifica le celle già attive.","tab-input":"input","tab-diagnostics":"diagnostica","input-settings-local":"Preferenze locali di questo browser. Si applicano subito a vista singola e deck, senza modificare il nodo remoto.","terminal-keyboard-gesture":"Apertura tastiera virtuale dal terminale","terminal-keyboard-double-tap":"Doppio tap (predefinito)","terminal-keyboard-single-tap":"Tap singolo","terminal-keyboard-never":"Mai dal terminale","terminal-keyboard-gesture-help":"Il tastierino e STT seguono i controlli separati sotto. Mouse e tastiera fisica restano utilizzabili.","keybar-ime-lock":"Tastierino: mantieni chiusa la tastiera virtuale","keybar-ime-lock-help":"ESC, frecce, PgUp/PgDn, Enter e menu inviano direttamente al PTY senza dare focus a un campo di testo.","voice-ime-lock":"Microfono STT: mantieni chiusa la tastiera virtuale","voice-ime-lock-help":"Il tap sul microfono avvia o ferma la voce senza focalizzare il composer.","keybar-enter-show":"Mostra Enter verticale nel tastierino","keybar-enter-show-help":"Enter resta a destra di PgUp/PgDn ed è alto quanto entrambe le righe.","keybar-layout":"Layout tastierino","keybar-layout-full":"Esteso (predefinito)","keybar-layout-compact":"Compatto","keybar-layout-help":"Compatto: una riga con expand ⊞ per accedere al set completo senza cambiare la preferenza.","input-settings-reset":"ripristina predefiniti input","diagnostics-local":"Questo nodo","diagnostics-target":"Nodo da diagnosticare","diagnostics-verbose":"Log verbosi temporanei","diagnostics-duration":"Durata verbose","diagnostics-expires":"Verbose attivo fino alle {time}","diagnostics-off":"Verbose spento; warning ed errori operativi restano disponibili.","diagnostics-level":"Livello","diagnostics-all-levels":"tutti i livelli","diagnostics-component":"componente","diagnostics-pause":"pausa","diagnostics-autoscroll":"scorrimento automatico","diagnostics-log":"Log diagnostico sanitizzato","diagnostics-empty":"Nessun evento diagnostico.","diagnostics-export":"esporta JSON","diagnostics-export-failed":"Esportazione non disponibile in questo browser.","diagnostics-clear":"svuota","diagnostics-clear-confirm":"Svuotare il buffer diagnostico di questo nodo?","diagnostics-unsupported":"Questo peer è offline o non supporta la diagnostica strutturata.","fleet-editor-loading":"Caricamento dell'editor Fleet…","fleet-editor-load-error":"Impossibile caricare l'editor Fleet.","fleet-editor-unavailable":"Editor Fleet non disponibile in questa posizione.","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-shell-engine-help":"Shell locale risolta sul dispositivo al momento dell’avvio; nessun percorso viene salvato nel backup.","fleet-shell-command-placeholder":"comando opzionale, es. npm test","fleet-shell-command-help":"Esecuzione tramite shell login interattiva (-lic), con PATH e alias utente. La cella si ferma quando il comando termina; gli errori immediati vengono segnalati.","fleet-shell-command-metachar":"Pipe, redirect, variabili e altri metacaratteri vengono interpretati dalla shell del dispositivo.","fleet-shell-interactive":"Vuoto: apre una shell interattiva locale e mantiene la cella attiva.","fleet-shell-launch-help":"Il comando Shell si configura nella cella da Impostazioni → Flotta.","fleet-credential-title":"API key su questo dispositivo","fleet-credential-help":"La key resta solo sul nodo selezionato, non viene mostrata, esportata o condivisa con la rete.","fleet-credential-set":"imposta key","fleet-credential-change":"cambia key","fleet-credential-forget":"dimentica","fleet-credential-saved":"Key salvata localmente.","fleet-credential-removed":"Key locale rimossa.","fleet-credential-remove-confirm":"Rimuovere la key locale {key}?","fleet-credential-source-environment":"ambiente","fleet-credential-source-local":"store locale","fleet-credential-source-compatibility":"config compatibile","fleet-credential-source-missing":"mancante","fleet-credential-source-policy":"origine credenziale","fleet-credential-source-policy-auto":"auto (precedenza legacy)","fleet-credential-source-policy-nexuscrew-store":"solo store NexusCrew","fleet-credential-source-policy-environment":"solo ambiente","fleet-key-section":"KEY","fleet-key-variable":"Variabile","fleet-key-value":"Valore per {key}","fleet-key-used-by":"Usata da: {engines}","fleet-key-used-by-none":"Non ancora usata da engine configurati su questo nodo.","fleet-key-shared-impact":"Sostituire o rimuovere {key} interessa tutti gli engine elencati: {engines}.","fleet-key-enter":"inserisci la key","fleet-key-blank-keeps":"vuoto = mantieni la fonte attuale","fleet-key-reveal":"mostra","fleet-key-hide":"nascondi","fleet-key-local-help":"Il valore resta write-only sul nodo selezionato e non entra in engine, backup o federazione.","fleet-key-create-missing":"Crea esplicitamente l’engine senza key (resterà “key richiesta”).","fleet-key-partial-create":"Engine creato; la key non è stata salvata. Puoi riprovare senza creare duplicati.","fleet-key-partial-edit":"Engine aggiornato; la key non è stata salvata. Le modifiche all’engine restano applicate.","fleet-provider-notice-claude-openrouter":"Claude Code è ottimizzato per modelli Anthropic: altri provider potrebbero non funzionare correttamente. Fast mode richiede il provider Anthropic first-party.","fleet-provider-notice-codex-openrouter":"OpenRouter Responses è beta e stateless; Codex-VL non usa fallback Chat Completions.","fleet-provider-notice-claude-kimi-code":"Kimi Code usa una configurazione Claude isolata con onboarding e fast mode dedicati; la configurazione Claude nativa non viene modificata.","fleet-provider-notice-alibaba-token-plan":"Token Plan Personal usa solo ALIBABA_CODE_API_KEY dal credential layer locale; qwen3.8-max-preview è il modello predefinito e non viene usato alcun fallback OpenAI/PAYG.","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","fleet-backup":"backup / ripristino","fleet-backup-help":"Esporta o ripristina selettivamente engine, celle e system prompt. Token, API key e segreti provider non entrano mai nel file.","fleet-backup-export":"esporta","fleet-backup-import":"importa","fleet-backup-download":"scarica backup","fleet-backup-restore":"ripristina selezionate","fleet-backup-import-help":"Scegli un backup JSON, controlla le celle e seleziona l’engine di destinazione prima del ripristino.","fleet-backup-overwrite":"sovrascrive la cella esistente","fleet-backup-new":"nuova cella","fleet-backup-engine-missing":"scegli un engine disponibile","fleet-backup-restore-unavailable":"Il nodo selezionato supporta solo l’esportazione; aggiornalo per ripristinare backup.","fleet-backup-restored":"{n} celle ripristinate","fleet-backup-confirm-overwrite":"Sovrascrivere queste celle? {cells}","fleet-backup-needs-restart":"riavvio necessario: {cells}","fleet-backup-empty":"nessuna cella da esportare","fleet-backup-select-one":"seleziona almeno una cella","fleet-backup-too-large":"backup troppo grande (massimo 1 MB)","fleet-backup-invalid-json":"il file non contiene JSON valido","fleet-backup-invalid-format":"formato o versione del backup non supportati","fleet-backup-invalid-cell":"il backup contiene una cella non valida","fleet-backup-duplicate-cell":"il backup contiene ID cella duplicati","fleet-backup-invalid-engine":"il backup contiene un engine non valido","fleet-backup-duplicate-engine":"il backup contiene ID engine duplicati","fleet-backup-confirm-engine-overwrite":"Sovrascrivere questi engine? I valori ambiente già configurati sul target restano invariati. {engines}","fleet-backup-env-names":"nomi ambiente","fleet-backup-env-values-required":"i valori ambiente vanno configurati sul dispositivo","fleet-system-prompt":"system prompt",characters:"caratteri","select-all":"seleziona tutte","select-none":"nessuna",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.',"fleet-cwd-needs-repair":"cartella da riparare","fleet-cwd-repair":"ripara","fleet-cwd-repair-title":"Ripara cartella cella {id}","fleet-cwd-repair-help":"La cartella attuale non è portabile su questo dispositivo: appartiene a un altro dispositivo o non esiste sotto la home. Scegli una cartella home-relative (~) sul dispositivo target; il backend ricalcolerà il percorso assoluto.","fleet-cwd-repair-no-source-path":"Il percorso originale non viene mostrato: è specifico del dispositivo di origine.","fleet-cwd-repair-placeholder":"es. Dev","fleet-cwd-repair-preview":"Nuova cartella: {path}","fleet-cwd-repair-browse":"sfoglia sotto ~","fleet-cwd-repair-fs-empty":"nessuna sottocartella","fleet-cwd-repair-use-current":"usa questa cartella","fleet-cwd-repair-invalid":'percorso non valido: niente assoluto, "..", barra rovesciata o lettera disco',"fleet-cwd-repair-confirm":"Impostare la cartella della cella {id} su {path}? Verrà ricalcolata sul dispositivo target.","fleet-cwd-repair-unportable":"Il percorso scelto non è portabile su questo dispositivo: deve esistere sotto la home.","fleet-cwd-repair-suggestion":"Suggerimento dal dispositivo:","fleet-cwd-repair-use-suggestion":"usa {path}","fleet-cwd-repaired":"Cartella della cella riparata.","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)","published-port":"porta pubblicata (opzionale)","no-nodes":"nessun nodo remoto configurato","node-add":"collega installazione NexusCrew","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","pair-ssh-local-label":"Host o alias SSH su questo dispositivo","node-ssh-local-help":"Puoi sostituire l’indirizzo del link con lo stesso alias che funziona usando ssh su questo dispositivo. Alias, agent e chiavi restano locali e non viaggiano nel link.","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-remove-warning":"Elimina associazione, credenziali e tunnel locale. Non spegne il dispositivo remoto.","peer-inventory-title":"Nodi collegati al hub","peer-group-hubs":"Hub diretti","peer-group-clients":"Client collegati","peer-group-routed":"Nodi raggiungibili tramite la rete","peer-routed":"instradato","peer-routed-stale":"instradato, non raggiungibile","peer-visibility":"Visibilità nella rete","node-test":"test","tunnel-start":"avvia tunnel","tunnel-stop":"ferma tunnel","tunnel-restart":"riavvia tunnel","share-node":"Condividi questo nodo","share-local-heading":"Condivisione di questo dispositivo","share-local-hub":"Hub di condivisione","share-local-through":"Condividi {device} tramite {hub}","share-local-active":"Condiviso e raggiungibile dalla rete collegata all’hub.","share-local-pending":"Condivisione richiesta, ma il tunnel è giù: questo dispositivo non è ancora raggiungibile.","share-local-private":"Privato: solo questo dispositivo può usare il collegamento all’hub.","share-local-private-down":"Privato, ma il collegamento all’hub è giù. Riconnetti per applicare e verificare la modalità privata.","share-local-reconnect":"Riconnetti e riconcilia","share-off-hub-reconcile-pending":"Stato privato salvato; la revoca sull’hub è ancora in attesa.","share-off-local-reconcile-pending":"Revoca confermata dall’hub; il tunnel locale deve ancora riconciliarsi.","share-node-off-desc":"Privato: resta collegato al nodo hub, ma gli altri client non possono raggiungerlo.","share-node-on-desc":"Condiviso: il nodo hub può mostrarlo e smistare celle e deck autorizzati.","peer-shared":"Nodo client condiviso nella rete Hydra","peer-private":"Nodo client privato: collegato, non pubblicato nella rete Hydra","node-connected-client":"client collegato","transport-used":"in uso","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 show token`. La sessione corrente verrà invalidata.","service-regenerate":"rigenera service","npm-auto-update":"aggiornamenti automatici da npm","npm-auto-update-help":"Controlla periodicamente latest e installa solo versioni più recenti. Mai downgrade.","npm-update-current":"installata","npm-update-latest":"npm latest","npm-update-check":"controlla ora","npm-update-install":"aggiorna ora","npm-update-restarting":"Aggiornamento avviato; NexusCrew si riaprirà dopo il riavvio del servizio.","npm-update-idle":"aggiornato","npm-update-checking":"controllo in corso","npm-update-available":"aggiornamento disponibile","npm-update-installing":"installazione in corso","npm-update-installed":"installato, riavvio in corso","npm-update-error":"controllo fallito","npm-update-unsupported":"disponibile solo con installazione npm globale","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-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-local-name":"nome locale non valido: usa uno slug univoco, non “localhost”","err-ssh":"ssh non valido (atteso user@host o alias)","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)","node-sessions":"{n} sessioni","tunnel-down-since":"tunnel giù da {t}","node-unreachable":"nodo non raggiungibile","node-passive":"client offline · stato normale","node-offline":"nodo offline","node-offline-seen":"offline · visto {t} fa","node-needs-repair":"legacy · ripeti il pairing","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","notification-speech-enable":"leggi le notifiche ad alta voce","notification-speech-help":"Usa la voce del browser solo per nuove notifiche mentre questa PWA è visibile e in primo piano. Con l’app chiusa resta la notifica di sistema.","notification-speech-test":"prova voce","notification-speech-testing":"prova in corso…","notification-speech-preview":"NexusCrew. Notifiche vocali attive.","notification-speech-preview-ok":"Prova vocale completata.","notification-speech-preview-failed":"Il browser non ha avviato la prova vocale. Interagisci con la pagina e riprova.","notification-speech-needs-test":"Per questa sessione dell’app, premi “prova voce” prima di ricevere annunci vocali.","notification-speech-unsupported":"Sintesi vocale non supportata in questo browser.","audio-title":"Audio nativo del nodo","audio-help":"Consenso e controlli valgono solo per questo dispositivo. Share e visibilità non autorizzano suoni.","audio-consent":"consenti TTS su questo nodo","audio-consent-help":"Permette a celle autorizzate, locali o remote, di consegnare un comando vocale. Puoi revocarlo in ogni momento.","audio-capability":"Capability locale","audio-loading":"leggo lo stato audio locale…","audio-adapter":"adapter","audio-adapter-none":"nessuno","audio-installed":"installato","audio-installed-yes":"sì","audio-installed-no":"no","audio-liveness":"disponibilità","audio-liveness-ready":"pronto ad accettare","audio-liveness-unavailable":"non disponibile","audio-languages":"lingue dichiarate","audio-limits":"limiti","audio-test":"prova audio locale","audio-testing":"prova in corso…","audio-stop":"ferma audio locale","audio-stopping":"stop in corso…","audio-test-needs-consent":"Attiva il consenso locale prima di provare la voce.","audio-unavailable":"Nessun adapter TTS nativo disponibile su questo nodo.","audio-test-accepted":"Il nodo ha accettato la prova. Non dimostra che qualcuno l’abbia udita.","audio-test-refused":"Il nodo ha rifiutato la prova.","audio-test-unknown":"Esito della prova sconosciuto: il nodo non può confermare l’avvio.","audio-stop-stopped":"Audio locale fermato.","audio-stop-idle":"Nessun enunciato locale da fermare.","audio-groups-title":"Gruppi audio condivisi","audio-groups-help":"Decide su quali dispositivi si sente la voce quando una cella parla. Il gruppo è una preferenza locale di consegna, non un consenso. Ogni nodo conserva consenso, ACL, disponibilità e Stop locale.","audio-groups-empty":"Nessun gruppo: la voce esce solo su questo nodo.","audio-group-name":"nome gruppo","audio-group-mode":"modalità consegna","audio-group-primary":"primo disponibile (in ordine)","audio-group-fanout":"tutti i nodi elencati","audio-group-targets":"nodi target esatti","audio-group-local":"questo nodo","audio-group-unavailable-target":"non rilevato ora","audio-group-no-targets":"Nessun nodo con instanceId disponibile. Il gruppo non può usare nomi, wildcard o “tutti”.","audio-group-new":"nuovo gruppo","audio-group-edit":"modifica","audio-group-delete":"elimina","audio-group-save":"salva gruppo","audio-group-cancel":"annulla","audio-group-invalid":"Il gruppo richiede un nome valido e almeno un nodeId esatto.","audio-group-save-failed":"Salvataggio gruppo audio non riuscito.","node-display-label":"Nome (etichetta)","routed-node-aliases":"Alias nodi instradati","routed-node-aliases-help":"Visibili solo su questo dispositivo; route e nome remoto non cambiano.","node-local-alias":"Alias su questo dispositivo","alias-on-device":"Alias su questo dispositivo","reset-alias":"Ripristina nome remoto","node-slug-hint":"routing su slug: {slug}","device-name-label":"Nome dispositivo","device-name-hint":"come ti vedono i peer (modificabile)","local-route-name-label":"Nome locale / route","local-route-name-hint":"handle tecnico stabile: label leggibile + suffisso del nodeId; modificabile prima della connessione","err-label":"etichetta non valida (max 64 char, niente a capo)","fleet-inventory":"Celle e sessioni","fleet-inventory-help":"tutte le posizioni (Locale + route Hydra)","fleet-manage-location":"Gestisci posizione","fleet-network-overview":"Panoramica rete","fleet-manage-help":"crea e configura celle nella posizione selezionata","fleet-overview-help":"stato operativo di tutte le posizioni, senza duplicare l’editor","fleet-inventory-empty":"nessuna cella o sessione","fleet-not-available":"fleet non disponibile su questa posizione",start:"avvia",stop:"ferma",restart:"riavvia",delete:"elimina","copy-manual":"copia non riuscita — seleziona e Cmd+C, o copia a mano","copy-empty":"niente selezione: trascina con Shift per selezionare","save-and-start":"salva e avvia",permissions:"Permessi","power-on-hint":"Spegni la cella; puoi anche toglierla dal boot.","launch-engine-help":"Provider, credenziali e nuovi engine si creano in Impostazioni → Flotta. Modello e permessi sono per questa cella.","launch-unavailable-hint":"Configurazione engine non disponibile su questo nodo.","import-as-cell":"Importa come cella","import-help":"Riconcilia una sessione tmux esistente in una cella gestita. Scegli un engine già dichiarato: nessun engine viene inventato.","import-engine-required":"scegli un engine (obbligatorio)","test-and-connect":"testa e collega","pairing-v2-hint":"Incolla o scansiona UN solo link: precompila nome, Host SSH ed etichetta quando il link li include (v2).","invite-v2-hint":"Crea un invito monouso completo. Se sei già collegato a un hub, viene usato automaticamente; altrimenti serve solo il suo indirizzo SSH raggiungibile.","invite-network-hint":"Crea un invito per la rete a cui sei già collegato. Il nuovo dispositivo entrerà attraverso l’hub, non si collegherà direttamente a questo dispositivo.","invite-network-label":"Rete di destinazione","invite-network-via":"Hub","invite-network-route":"Un solo collegamento verso l’hub; nodi, celle e deck vengono smistati internamente.","invite-endpoint-label":"Indirizzo SSH di questo hub visto dagli altri dispositivi","invite-endpoint-auto":"Endpoint già configurato","invite-endpoint-needed":"Inserisci user@host o un alias SSH condiviso. Non è 127.0.0.1 e non è l’URL HTTP NexusCrew.","invite-ssh-hint":"Il target SSH con cui L’ALTRO dispositivo raggiunge QUESTA installazione (user@host o alias). Obbligatorio: viene incluso nel link.","invite-next-steps":"copia questo link, apri NexusCrew sull’altro dispositivo e incollalo in Impostazioni → Nodi (o scansiona il QR): al resto pensa NexusCrew","pair-card-title":"collega con un solo link","pair-card-help":"Incolla il link di pairing generato sull’altro dispositivo (o scansiona il suo QR): NexusCrew decodifica, prova la connessione SSH e collega da solo.","pair-paste-ph":"incolla qui il link di pairing","pair-paste-btn":"incolla","pair-advanced":"avanzate / modifica","pair-progress":"collegamento in corso: SSH → invito → conferma → verifica…","pair-retry":"riprova","pair-invalid-link":"questo non è un link di pairing valido","pair-invalid-hint":"serve il link completo (http://…#pair=…) generato dall’altro NexusCrew: non aprirlo, incollalo qui","pair-missing-ssh":"il link non include il target SSH (formato v1): indica in “avanzate” come questo dispositivo raggiunge l’altro via SSH — non viene mai inventato","pair-missing-name":"manca il nome del nodo: completalo in “avanzate”","pair-clipboard-denied":"lettura degli appunti non consentita: incolla manualmente nel campo","pair-clipboard-empty":"appunti vuoti: copia prima il link di pairing","pair-stage-validation":"dati non validi","pair-stage-conflict":"nome già in uso","pair-stage-ssh-start":"avvio del tunnel SSH fallito","pair-stage-ssh-ready":"peer non raggiungibile via SSH","pair-stage-join":"scambio dell’invito fallito","pair-stage-tunnel-final":"tunnel negoziato fallito","pair-stage-confirm":"conferma del pairing fallita","pair-stage-health":"verifica finale della federazione fallita","pair-stage-internal":"errore interno","pair-stage-generic":"connessione fallita","qr-no-camera":"nessuna camera disponibile su questo dispositivo: usa una foto del QR","qr-permission":"permesso camera negato: consentilo nel browser o usa una foto del QR","qr-unsupported":"scanner live non supportato qui: carica una foto del QR","qr-upload":"usa una foto"},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","grid-full":"a deck can show at most 9 sessions",pin:"pin to top",reorder:"reorder","reorder-help":"drag the handle; keyboard up/down arrows","rename-node":"rename node","rename-node-prompt":"New node name in NexusCrew","rename-node-invalid":"Invalid name: maximum 64 characters, no line breaks.","reorder-deck-help":"drag the deck; keyboard left/right arrows",sessions:"sessions","new-session":"new session",new:"new",fleet:"Fleet","fleet-tmux":"tmux fleet","other-sessions":"Other sessions","view-all":"all","view-pinned":"pinned","view-active":"active","view-off":"off","view-technical":"technical","mark-technical":"hide as technical session","mark-normal":"show as normal session","position-local":"Local",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-working":"working","cell-idle":"idle","cell-degraded":"degraded: unit active, tmux dead","power-on":"power on","power-off":"power off","boot-enable":"enable at boot","boot-disable":"disable at boot","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","power-config-in-settings":"Edit engine, provider, profile, model and permissions in Settings → Fleet.","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…","composer-history-tools":"input history and size","composer-history":"cell history","composer-history-empty":"no submitted input","composer-history-clear":"clear this cell history","composer-expand":"expand input","composer-collapse":"collapse input","composer-clear-data":"clear drafts and history","composer-clear-data-help":"Removes every saved cell draft and input-history entry from this browser.","composer-clear-confirm":"Clear every saved draft and input-history entry from this browser?","composer-clear-done":"Drafts and history cleared.","composer-clear-failed":"Could not clear composer data in this browser.",attach:"attach","attach-file":"File","attach-camera":"Camera","attach-gallery":"Gallery","attach-uploading":"uploading…","attach-upload-progress":"attachment {n}/{total}…","attach-uploaded":"{n} attachments uploaded",voice:"voice",send:"send","composer-send-failed":"connection not ready — text kept, try again",close:"close","lang-label":"language",decks:"decks","new-deck":"new deck","deck-name":"deck name","open-deck-window":"open in a new window","detach-deck":"detach into a new window","deck-current":"this deck (current window)","deck-owner-unavailable":"owner node is not shared or reachable","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","expand-owner":"expand {owner} decks","collapse-owner":"collapse {owner} decks","owner-deck-count-one":"{count} deck","owner-deck-count-many":"{count} decks","dot-working":"in use (active window)","dot-on":"open in background","dot-neutral":"not open","dot-warn":"owner offline","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","pairing-connect-help":"Connecting a node requires a name, a working SSH Host, and a link/QR created by the other NexusCrew installation.","pairing-localhost-hint":"127.0.0.1 in the link is correct: do not open it here. NexusCrew carries the invite and port through the SSH Host.","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","tab-audio":"audio","system-general":"general","system-diagnostics":"diagnostics","system-this-node":"this node","system-updates":"updates","system-security":"security","system-local-data":"local browser data","system-terminal":"terminal","alternate-screen":"alternate screen","alternate-screen-help":"Keeps standard tmux behavior for new NexusCrew sessions; dragging in the web terminal does not scroll full-screen TUIs. It does not change cells already running.","tab-input":"input","tab-diagnostics":"diagnostics","input-settings-local":"Local preferences for this browser. They apply immediately to single view and decks without changing the remote node.","terminal-keyboard-gesture":"Open the virtual keyboard from the terminal","terminal-keyboard-double-tap":"Double tap (default)","terminal-keyboard-single-tap":"Single tap","terminal-keyboard-never":"Never from terminal","terminal-keyboard-gesture-help":"The keypad and STT use the separate controls below. Mouse and physical keyboard remain available.","keybar-ime-lock":"Keypad: keep the virtual keyboard closed","keybar-ime-lock-help":"ESC, arrows, PgUp/PgDn, Enter and menu send directly to the PTY without focusing a text field.","voice-ime-lock":"STT microphone: keep the virtual keyboard closed","voice-ime-lock-help":"Tapping the microphone starts or stops voice without focusing the composer.","keybar-enter-show":"Show the tall Enter keypad key","keybar-enter-show-help":"Enter stays to the right of PgUp/PgDn and spans both rows.","keybar-layout":"Keypad layout","keybar-layout-full":"Full (default)","keybar-layout-compact":"Compact","keybar-layout-help":"Compact: one row with an expand toggle that reaches the full key set without changing the preference.","input-settings-reset":"restore input defaults","diagnostics-local":"This node","diagnostics-target":"Node to diagnose","diagnostics-verbose":"Temporary verbose logs","diagnostics-duration":"Verbose duration","diagnostics-expires":"Verbose enabled until {time}","diagnostics-off":"Verbose is off; operational warnings and errors remain available.","diagnostics-level":"Level","diagnostics-all-levels":"all levels","diagnostics-component":"component","diagnostics-pause":"pause","diagnostics-autoscroll":"autoscroll","diagnostics-log":"Sanitized diagnostic log","diagnostics-empty":"No diagnostic events.","diagnostics-export":"export JSON","diagnostics-export-failed":"Export is not available in this browser.","diagnostics-clear":"clear","diagnostics-clear-confirm":"Clear this node diagnostic buffer?","diagnostics-unsupported":"This peer is offline or does not support structured diagnostics.","fleet-editor-loading":"Loading the Fleet editor…","fleet-editor-load-error":"Unable to load the Fleet editor.","fleet-editor-unavailable":"The Fleet editor is unavailable at this location.","fleet-managed":"managed by NexusCrew","fleet-custom":"custom command","fleet-managed-help":"Client, provider and launch are managed internally; secrets are never displayed.","fleet-shell-engine-help":"The local shell is resolved on the device at launch time; no executable path is stored in backups.","fleet-shell-command-placeholder":"optional command, e.g. npm test","fleet-shell-command-help":"Runs through an interactive login shell (-lic), with the user PATH and aliases. The cell stops when the command finishes; immediate failures are reported.","fleet-shell-command-metachar":"Pipes, redirects, variables, and other metacharacters are interpreted by the device shell.","fleet-shell-interactive":"Empty: opens a local interactive shell and keeps the cell active.","fleet-shell-launch-help":"Configure the Shell command on the cell in Settings → Fleet.","fleet-credential-title":"API key on this device","fleet-credential-help":"The key stays only on the selected node and is never displayed, exported or shared with the network.","fleet-credential-set":"set key","fleet-credential-change":"change key","fleet-credential-forget":"forget","fleet-credential-saved":"Key saved locally.","fleet-credential-removed":"Local key removed.","fleet-credential-remove-confirm":"Remove the local {key} key?","fleet-credential-source-environment":"environment","fleet-credential-source-local":"local store","fleet-credential-source-compatibility":"compatible config","fleet-credential-source-missing":"missing","fleet-credential-source-policy":"credential source","fleet-credential-source-policy-auto":"auto (legacy precedence)","fleet-credential-source-policy-nexuscrew-store":"NexusCrew store only","fleet-credential-source-policy-environment":"environment only","fleet-key-section":"KEY","fleet-key-variable":"Variable","fleet-key-value":"Value for {key}","fleet-key-used-by":"Used by: {engines}","fleet-key-used-by-none":"Not yet used by configured engines on this node.","fleet-key-shared-impact":"Replacing or removing {key} affects every listed engine: {engines}.","fleet-key-enter":"enter the key","fleet-key-blank-keeps":"blank = keep the current source","fleet-key-reveal":"reveal","fleet-key-hide":"hide","fleet-key-local-help":"The value stays write-only on the selected node and never enters engines, backups or federation.","fleet-key-create-missing":"Explicitly create the engine without a key (it will remain “key required”).","fleet-key-partial-create":"Engine created; the key was not saved. Retry without creating a duplicate.","fleet-key-partial-edit":"Engine updated; the key was not saved. The engine changes remain applied.","fleet-provider-notice-claude-openrouter":"Claude Code is optimized for Anthropic models; other providers may not work correctly. Fast mode requires the first-party Anthropic provider.","fleet-provider-notice-codex-openrouter":"OpenRouter Responses is beta and stateless; Codex-VL has no Chat Completions fallback.","fleet-provider-notice-claude-kimi-code":"Kimi Code uses isolated Claude configuration with dedicated onboarding and fast-mode flags; native Claude configuration is not modified.","fleet-provider-notice-alibaba-token-plan":"Token Plan Personal uses only ALIBABA_CODE_API_KEY from the local credential layer; qwen3.8-max-preview is the default and no OpenAI/PAYG fallback is used.","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","fleet-backup":"backup / restore","fleet-backup-help":"Selectively export or restore engines, cells, and system prompts. Tokens, API keys, and provider secrets never enter the file.","fleet-backup-export":"export","fleet-backup-import":"import","fleet-backup-download":"download backup","fleet-backup-restore":"restore selected","fleet-backup-import-help":"Choose a JSON backup, review the cells and select a destination engine before restoring.","fleet-backup-overwrite":"overwrites existing cell","fleet-backup-new":"new cell","fleet-backup-engine-missing":"choose an available engine","fleet-backup-restore-unavailable":"The selected node supports export only; update it to restore backups.","fleet-backup-restored":"{n} cells restored","fleet-backup-confirm-overwrite":"Overwrite these cells? {cells}","fleet-backup-needs-restart":"restart required: {cells}","fleet-backup-empty":"no cells to export","fleet-backup-select-one":"select at least one cell","fleet-backup-too-large":"backup is too large (1 MB maximum)","fleet-backup-invalid-json":"the file does not contain valid JSON","fleet-backup-invalid-format":"unsupported backup format or version","fleet-backup-invalid-cell":"the backup contains an invalid cell","fleet-backup-duplicate-cell":"the backup contains duplicate cell IDs","fleet-backup-invalid-engine":"the backup contains an invalid engine","fleet-backup-duplicate-engine":"the backup contains duplicate engine IDs","fleet-backup-confirm-engine-overwrite":"Overwrite these engines? Environment values already configured on the target stay unchanged. {engines}","fleet-backup-env-names":"environment names","fleet-backup-env-values-required":"environment values must be configured on this device","fleet-system-prompt":"system prompt",characters:"characters","select-all":"select all","select-none":"select none",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.',"fleet-cwd-needs-repair":"folder needs repair","fleet-cwd-repair":"repair","fleet-cwd-repair-title":"Repair cell folder {id}","fleet-cwd-repair-help":"The current folder is not portable on this device: it belongs to another device or does not exist under the home directory. Choose a home-relative (~) folder on the target device; the backend will recompute the absolute path.","fleet-cwd-repair-no-source-path":"The original path is not shown: it is specific to the source device.","fleet-cwd-repair-placeholder":"e.g. Dev","fleet-cwd-repair-preview":"New folder: {path}","fleet-cwd-repair-browse":"browse under ~","fleet-cwd-repair-fs-empty":"no subfolders","fleet-cwd-repair-use-current":"use this folder","fleet-cwd-repair-invalid":'invalid path: no absolute path, "..", backslash or drive letter',"fleet-cwd-repair-confirm":"Set the folder of cell {id} to {path}? It will be recomputed on the target device.","fleet-cwd-repair-unportable":"The chosen path is not portable on this device: it must exist under the home directory.","fleet-cwd-repair-suggestion":"Suggestion from device:","fleet-cwd-repair-use-suggestion":"use {path}","fleet-cwd-repaired":"Cell folder repaired.","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)","published-port":"published port (optional)","no-nodes":"no remote nodes configured","node-add":"connect a NexusCrew installation","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","pair-ssh-local-label":"SSH host or alias on this device","node-ssh-local-help":"You may replace the link address with the same alias that works with ssh on this device. Aliases, agents and private keys stay local and are never carried in the link.","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-remove-warning":"Deletes the pairing, credentials and local tunnel. It does not power off the remote device.","peer-inventory-title":"Nodes connected to the hub","peer-group-hubs":"Direct hubs","peer-group-clients":"Connected clients","peer-group-routed":"Nodes reachable through the network","peer-routed":"routed","peer-routed-stale":"routed, unreachable","peer-visibility":"Network visibility","node-test":"test","tunnel-start":"start tunnel","tunnel-stop":"stop tunnel","tunnel-restart":"restart tunnel","share-node":"Share this node","share-local-heading":"Share this device","share-local-hub":"Sharing hub","share-local-through":"Share {device} through {hub}","share-local-active":"Shared and reachable by the network connected to the hub.","share-local-pending":"Sharing is requested, but the tunnel is down: this device is not reachable yet.","share-local-private":"Private: only this device can use its hub connection.","share-local-private-down":"Private, but the hub connection is down. Reconnect to apply and verify private mode.","share-local-reconnect":"Reconnect and reconcile","share-off-hub-reconcile-pending":"Private state saved; hub revocation is still pending.","share-off-local-reconcile-pending":"Hub revocation confirmed; the local tunnel still needs reconciliation.","share-node-off-desc":"Private: it stays connected to the hub, but other clients cannot reach it.","share-node-on-desc":"Shared: the hub may advertise it and route authorized cells and decks.","peer-shared":"Client node shared on the Hydra network","peer-private":"Private client node: connected, not published on Hydra","node-connected-client":"connected client","transport-used":"in use","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 show token`. The current session will be invalidated.","service-regenerate":"regenerate service","npm-auto-update":"automatic updates from npm","npm-auto-update-help":"Periodically checks latest and installs only newer versions. Never downgrades.","npm-update-current":"installed","npm-update-latest":"npm latest","npm-update-check":"check now","npm-update-install":"update now","npm-update-restarting":"Update started; NexusCrew will return after the service restarts.","npm-update-idle":"up to date","npm-update-checking":"checking","npm-update-available":"update available","npm-update-installing":"installing","npm-update-installed":"installed, restarting","npm-update-error":"check failed","npm-update-unsupported":"available only for global npm installations","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-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-local-name":"invalid local name: use a unique slug, not “localhost”","err-ssh":"invalid ssh (expected user@host or alias)","err-port":"invalid port (1–65535)","err-ssh-port":"invalid SSH port (1–65535)","err-node-port":"invalid NexusCrew port (1–65535)","node-sessions":"{n} sessions","tunnel-down-since":"tunnel down for {t}","node-unreachable":"node unreachable","node-passive":"client offline · expected","node-offline":"node offline","node-offline-seen":"offline · seen {t} ago","node-needs-repair":"legacy · pair again","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","notification-speech-enable":"read notifications aloud","notification-speech-help":"Uses the browser voice only for new notifications while this PWA is visible and in the foreground. When the app is closed, the system notification remains available.","notification-speech-test":"test voice","notification-speech-testing":"testing voice…","notification-speech-preview":"NexusCrew. Spoken notifications are active.","notification-speech-preview-ok":"Voice test completed.","notification-speech-preview-failed":"The browser did not start the voice test. Interact with the page and try again.","notification-speech-needs-test":"For this app session, select “test voice” before spoken alerts can play.","notification-speech-unsupported":"Speech synthesis is not supported in this browser.","audio-title":"Native node audio","audio-help":"Consent and controls apply only to this device. Share and visibility do not authorize sounds.","audio-consent":"allow TTS on this node","audio-consent-help":"Allows authorized local or remote cells to deliver a voice command. You can revoke it at any time.","audio-capability":"Local capability","audio-loading":"reading local audio state…","audio-adapter":"adapter","audio-adapter-none":"none","audio-installed":"installed","audio-installed-yes":"yes","audio-installed-no":"no","audio-liveness":"availability","audio-liveness-ready":"ready to accept","audio-liveness-unavailable":"unavailable","audio-languages":"declared languages","audio-limits":"limits","audio-test":"test local audio","audio-testing":"testing audio…","audio-stop":"stop local audio","audio-stopping":"stopping audio…","audio-test-needs-consent":"Enable local consent before testing the voice.","audio-unavailable":"No native TTS adapter is available on this node.","audio-test-accepted":"The node accepted the test. It does not prove that anyone heard it.","audio-test-refused":"The node refused the test.","audio-test-unknown":"Test outcome unknown: the node could not confirm startup.","audio-stop-stopped":"Local audio stopped.","audio-stop-idle":"No local utterance to stop.","audio-groups-title":"Shared audio groups","audio-groups-help":"Chooses which devices play the voice when a cell speaks. A group is a local delivery preference, not consent. Each node keeps its own consent, ACL, availability and local Stop.","audio-groups-empty":"No group: voice plays only on this node.","audio-group-name":"group name","audio-group-mode":"delivery mode","audio-group-primary":"first available (in order)","audio-group-fanout":"all listed nodes","audio-group-targets":"exact target nodes","audio-group-local":"this node","audio-group-unavailable-target":"not currently discovered","audio-group-no-targets":"No node with an available instanceId. A group cannot use names, wildcards, or “all”.","audio-group-new":"new group","audio-group-edit":"edit","audio-group-delete":"delete","audio-group-save":"save group","audio-group-cancel":"cancel","audio-group-invalid":"A group needs a valid name and at least one exact nodeId.","audio-group-save-failed":"Could not save audio group.","node-display-label":"Name (label)","routed-node-aliases":"Routed node aliases","routed-node-aliases-help":"Visible only on this device; the route and remote name do not change.","node-local-alias":"Alias on this device","alias-on-device":"Alias on this device","reset-alias":"Reset remote name","node-slug-hint":"routing on slug: {slug}","device-name-label":"Device name","device-name-hint":"how peers see you (editable)","local-route-name-label":"Local / route name","local-route-name-hint":"stable technical handle: readable label + nodeId suffix; editable before connecting","err-label":"invalid label (max 64 chars, no line breaks)","fleet-inventory":"Cells and sessions","fleet-inventory-help":"all positions (Local + Hydra routes)","fleet-manage-location":"Manage location","fleet-network-overview":"Network overview","fleet-manage-help":"create and configure cells at the selected location","fleet-overview-help":"operational state of every location, separate from the editor","fleet-inventory-empty":"no cells or sessions","fleet-not-available":"fleet not available on this position",start:"start",stop:"stop",restart:"restart",delete:"delete","copy-manual":"copy failed — select and press Cmd+C, or copy manually","copy-empty":"nothing selected: drag with Shift to select","save-and-start":"save and start",permissions:"Permissions","power-on-hint":"Stop the cell; you can also remove it from boot.","launch-engine-help":"Providers, credentials and new engines are created in Settings → Fleet. Model and permissions are per cell.","launch-unavailable-hint":"Engine configuration is unavailable on this node.","import-as-cell":"Import as cell","import-help":"Reconcile an existing tmux session into a managed cell. Pick an already-declared engine: no engine is invented.","import-engine-required":"pick an engine (required)","test-and-connect":"test and connect","pairing-v2-hint":"Paste or scan ONE link: it prefills name, SSH host and label when the link carries them (v2).","invite-v2-hint":"Create one complete one-time invitation. If this device already joined a hub, that hub is used automatically; otherwise only its reachable SSH address is required.","invite-network-hint":"Create an invitation for the network you already joined. The new device enters through the hub instead of connecting directly to this device.","invite-network-label":"Destination network","invite-network-via":"Hub","invite-network-route":"One connection to the hub; nodes, cells and decks are routed internally.","invite-endpoint-label":"This hub’s SSH address as seen by other devices","invite-endpoint-auto":"Configured endpoint","invite-endpoint-needed":"Enter user@host or a shared SSH alias. This is not 127.0.0.1 and not the NexusCrew HTTP URL.","invite-ssh-hint":"The SSH target the OTHER device uses to reach THIS installation (user@host or alias). Required: it is included in the link.","invite-next-steps":"copy this link, open NexusCrew on the other device and paste it in Settings → Nodes (or scan the QR): NexusCrew does the rest","pair-card-title":"connect with one link","pair-card-help":"Paste the pairing link generated on the other device (or scan its QR): NexusCrew decodes it, tests the SSH connection and connects on its own.","pair-paste-ph":"paste the pairing link here","pair-paste-btn":"paste","pair-advanced":"advanced / edit","pair-progress":"connecting: SSH → invite → confirm → verify…","pair-retry":"retry","pair-invalid-link":"this is not a valid pairing link","pair-invalid-hint":"you need the full link (http://…#pair=…) generated by the other NexusCrew: don’t open it, paste it here","pair-missing-ssh":"the link carries no SSH target (v1 format): set in “advanced” how this device reaches the other one over SSH — it is never invented","pair-missing-name":"the node name is missing: fill it in “advanced”","pair-clipboard-denied":"clipboard read not allowed: paste manually into the field","pair-clipboard-empty":"clipboard is empty: copy the pairing link first","pair-stage-validation":"invalid data","pair-stage-conflict":"name already in use","pair-stage-ssh-start":"SSH tunnel start failed","pair-stage-ssh-ready":"peer unreachable over SSH","pair-stage-join":"invite exchange failed","pair-stage-tunnel-final":"negotiated tunnel failed","pair-stage-confirm":"pairing confirmation failed","pair-stage-health":"final federation check failed","pair-stage-internal":"internal error","pair-stage-generic":"connection failed","qr-no-camera":"no camera available on this device: use a photo of the QR","qr-permission":"camera permission denied: allow it in the browser or use a photo of the QR","qr-unsupported":"live scanner not supported here: upload a photo of the QR","qr-upload":"use a photo"},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","grid-full":"un deck puede mostrar como máximo 9 sesiones",pin:"fijar arriba",reorder:"reordenar","reorder-help":"arrastra el control; flechas arriba/abajo","rename-node":"renombrar nodo","rename-node-prompt":"Nuevo nombre del nodo en NexusCrew","rename-node-invalid":"Nombre no válido: máximo 64 caracteres, sin saltos de línea.","reorder-deck-help":"arrastra el deck; flechas izquierda/derecha",sessions:"sesiones","new-session":"nueva sesión",new:"nueva",fleet:"Flota","fleet-tmux":"flota tmux","other-sessions":"Otras sesiones","view-all":"todas","view-pinned":"fijadas","view-active":"activas","view-off":"apagadas","view-technical":"técnicas","mark-technical":"ocultar como sesión técnica","mark-normal":"mostrar como sesión normal","position-local":"Local",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-working":"trabajando","cell-idle":"en espera","cell-degraded":"degradada: unit activa, tmux muerto","power-on":"encender","power-off":"apagar","boot-enable":"activar al iniciar","boot-disable":"desactivar al iniciar","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","power-config-in-settings":"Modifica motor, proveedor, perfil, modelo y permisos en Ajustes → Flota.","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…","composer-history-tools":"historial y tamaño de entrada","composer-history":"historial de la celda","composer-history-empty":"ninguna entrada enviada","composer-history-clear":"borrar historial de esta celda","composer-expand":"ampliar entrada","composer-collapse":"reducir entrada","composer-clear-data":"borrar borradores e historial","composer-clear-data-help":"Elimina de este navegador todos los borradores y el historial de entrada de las celdas.","composer-clear-confirm":"¿Borrar todos los borradores y el historial de entrada guardados en este navegador?","composer-clear-done":"Borradores e historial eliminados.","composer-clear-failed":"No se pudieron borrar los datos del composer en este navegador.",attach:"adjuntar","attach-file":"Archivo","attach-camera":"Cámara","attach-gallery":"Galería","attach-uploading":"subiendo…","attach-upload-progress":"adjunto {n}/{total}…","attach-uploaded":"{n} adjuntos subidos",voice:"voz",send:"enviar","composer-send-failed":"conexión no disponible — texto conservado, inténtalo de nuevo",close:"cerrar","lang-label":"idioma",decks:"decks","new-deck":"nuevo deck","deck-name":"nombre del deck","open-deck-window":"abrir en una ventana nueva","detach-deck":"separar en una ventana nueva","deck-current":"este deck (ventana actual)","deck-owner-unavailable":"el nodo propietario no está compartido o accesible","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í","expand-owner":"expandir decks de {owner}","collapse-owner":"comprimir decks de {owner}","owner-deck-count-one":"{count} deck","owner-deck-count-many":"{count} decks","dot-working":"en uso (ventana activa)","dot-on":"abierta en segundo plano","dot-neutral":"no abierta","dot-warn":"nodo sin conexión","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","pairing-connect-help":"Para conectar un nodo necesitas un nombre, un Host SSH funcional y el enlace/QR creado por la otra instalación NexusCrew.","pairing-localhost-hint":"127.0.0.1 en el enlace es correcto: no lo abras aquí. NexusCrew usa la invitación y el puerto mediante el Host SSH.","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","tab-audio":"audio","system-general":"general","system-diagnostics":"diagnóstico","system-this-node":"este nodo","system-updates":"actualizaciones","system-security":"seguridad","system-local-data":"datos locales del navegador","system-terminal":"terminal","alternate-screen":"pantalla alternativa","alternate-screen-help":"Mantiene el comportamiento estándar de tmux para las nuevas sesiones NexusCrew; arrastrar en el terminal web no desplaza los TUI a pantalla completa. No modifica las celdas ya activas.","tab-input":"entrada","tab-diagnostics":"diagnóstico","input-settings-local":"Preferencias locales de este navegador. Se aplican de inmediato a la vista única y a los decks sin cambiar el nodo remoto.","terminal-keyboard-gesture":"Abrir el teclado virtual desde el terminal","terminal-keyboard-double-tap":"Doble toque (predeterminado)","terminal-keyboard-single-tap":"Toque único","terminal-keyboard-never":"Nunca desde el terminal","terminal-keyboard-gesture-help":"El teclado auxiliar y STT usan los controles separados de abajo. El ratón y el teclado físico siguen disponibles.","keybar-ime-lock":"Teclado auxiliar: mantener cerrado el teclado virtual","keybar-ime-lock-help":"ESC, flechas, PgUp/PgDn, Enter y menú envían directamente al PTY sin enfocar un campo de texto.","voice-ime-lock":"Micrófono STT: mantener cerrado el teclado virtual","voice-ime-lock-help":"Tocar el micrófono inicia o detiene la voz sin enfocar el compositor.","keybar-enter-show":"Mostrar Enter vertical en el teclado auxiliar","keybar-enter-show-help":"Enter queda a la derecha de PgUp/PgDn y ocupa las dos filas.","keybar-layout":"Distribución del teclado auxiliar","keybar-layout-full":"Completo (predeterminado)","keybar-layout-compact":"Compacto","keybar-layout-help":"Compacto: una fila con un botón expandir que alcanza el conjunto completo sin cambiar la preferencia.","input-settings-reset":"restaurar valores de entrada","diagnostics-local":"Este nodo","diagnostics-target":"Nodo a diagnosticar","diagnostics-verbose":"Logs detallados temporales","diagnostics-duration":"Duración detallada","diagnostics-expires":"Log detallado activo hasta las {time}","diagnostics-off":"El log detallado está apagado; los avisos y errores operativos siguen disponibles.","diagnostics-level":"Nivel","diagnostics-all-levels":"todos los niveles","diagnostics-component":"componente","diagnostics-pause":"pausa","diagnostics-autoscroll":"desplazamiento automático","diagnostics-log":"Log de diagnóstico sanitizado","diagnostics-empty":"No hay eventos de diagnóstico.","diagnostics-export":"exportar JSON","diagnostics-export-failed":"La exportación no está disponible en este navegador.","diagnostics-clear":"vaciar","diagnostics-clear-confirm":"¿Vaciar el búfer de diagnóstico de este nodo?","diagnostics-unsupported":"Este par está desconectado o no admite diagnósticos estructurados.","fleet-editor-loading":"Cargando el editor de Fleet…","fleet-editor-load-error":"No se puede cargar el editor de Fleet.","fleet-editor-unavailable":"El editor de Fleet no está disponible en esta ubicación.","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-shell-engine-help":"La shell local se resuelve en el dispositivo al iniciar; no se guarda ninguna ruta ejecutable en las copias.","fleet-shell-command-placeholder":"comando opcional, p. ej. npm test","fleet-shell-command-help":"Se ejecuta mediante una shell de inicio interactiva (-lic), con PATH y alias del usuario. La celda se detiene al terminar; los fallos inmediatos se notifican.","fleet-shell-command-metachar":"Pipes, redirecciones, variables y otros metacaracteres son interpretados por la shell del dispositivo.","fleet-shell-interactive":"Vacío: abre una shell local interactiva y mantiene la celda activa.","fleet-shell-launch-help":"Configura el comando Shell de la celda en Ajustes → Flota.","fleet-credential-title":"Clave API en este dispositivo","fleet-credential-help":"La clave permanece solo en el nodo seleccionado y nunca se muestra, exporta ni comparte con la red.","fleet-credential-set":"poner clave","fleet-credential-change":"cambiar clave","fleet-credential-forget":"olvidar","fleet-credential-saved":"Clave guardada localmente.","fleet-credential-removed":"Clave local eliminada.","fleet-credential-remove-confirm":"¿Eliminar la clave local {key}?","fleet-credential-source-environment":"entorno","fleet-credential-source-local":"almacén local","fleet-credential-source-compatibility":"config compatible","fleet-credential-source-missing":"ausente","fleet-credential-source-policy":"origen de credencial","fleet-credential-source-policy-auto":"auto (precedencia legacy)","fleet-credential-source-policy-nexuscrew-store":"solo almacén NexusCrew","fleet-credential-source-policy-environment":"solo entorno","fleet-key-section":"KEY","fleet-key-variable":"Variable","fleet-key-value":"Valor para {key}","fleet-key-used-by":"Usada por: {engines}","fleet-key-used-by-none":"Aún no la usa ningún motor configurado en este nodo.","fleet-key-shared-impact":"Sustituir o eliminar {key} afecta a todos los motores listados: {engines}.","fleet-key-enter":"introduce la clave","fleet-key-blank-keeps":"vacío = mantener la fuente actual","fleet-key-reveal":"mostrar","fleet-key-hide":"ocultar","fleet-key-local-help":"El valor permanece write-only en el nodo seleccionado y nunca entra en motores, copias ni federación.","fleet-key-create-missing":"Crear explícitamente el motor sin clave (seguirá como “clave requerida”).","fleet-key-partial-create":"Motor creado; la clave no se guardó. Puedes reintentar sin crear un duplicado.","fleet-key-partial-edit":"Motor actualizado; la clave no se guardó. Los cambios del motor siguen aplicados.","fleet-provider-notice-claude-openrouter":"Claude Code está optimizado para modelos Anthropic; otros proveedores podrían no funcionar correctamente. Fast mode requiere el proveedor Anthropic first-party.","fleet-provider-notice-codex-openrouter":"OpenRouter Responses es beta y stateless; Codex-VL no usa fallback de Chat Completions.","fleet-provider-notice-claude-kimi-code":"Kimi Code usa una configuración Claude aislada con onboarding y fast mode dedicados; la configuración Claude nativa no se modifica.","fleet-provider-notice-alibaba-token-plan":"Token Plan Personal usa solo ALIBABA_CODE_API_KEY de la capa local de credenciales; qwen3.8-max-preview es el modelo predeterminado y no se usa fallback OpenAI/PAYG.","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","fleet-backup":"copia / restauración","fleet-backup-help":"Exporta o restaura selectivamente motores, celdas y system prompts. Tokens, claves API y secretos del proveedor nunca entran en el archivo.","fleet-backup-export":"exportar","fleet-backup-import":"importar","fleet-backup-download":"descargar copia","fleet-backup-restore":"restaurar seleccionadas","fleet-backup-import-help":"Elige una copia JSON, revisa las celdas y selecciona un motor de destino antes de restaurar.","fleet-backup-overwrite":"sobrescribe la celda existente","fleet-backup-new":"celda nueva","fleet-backup-engine-missing":"elige un motor disponible","fleet-backup-restore-unavailable":"El nodo seleccionado solo admite exportación; actualízalo para restaurar copias.","fleet-backup-restored":"{n} celdas restauradas","fleet-backup-confirm-overwrite":"¿Sobrescribir estas celdas? {cells}","fleet-backup-needs-restart":"reinicio necesario: {cells}","fleet-backup-empty":"no hay celdas para exportar","fleet-backup-select-one":"selecciona al menos una celda","fleet-backup-too-large":"copia demasiado grande (máximo 1 MB)","fleet-backup-invalid-json":"el archivo no contiene JSON válido","fleet-backup-invalid-format":"formato o versión de copia no compatible","fleet-backup-invalid-cell":"la copia contiene una celda no válida","fleet-backup-duplicate-cell":"la copia contiene IDs de celda duplicados","fleet-backup-invalid-engine":"la copia contiene un motor no válido","fleet-backup-duplicate-engine":"la copia contiene IDs de motor duplicados","fleet-backup-confirm-engine-overwrite":"¿Sobrescribir estos motores? Los valores de entorno ya configurados en el destino no cambian. {engines}","fleet-backup-env-names":"nombres de entorno","fleet-backup-env-values-required":"los valores de entorno deben configurarse en este dispositivo","fleet-system-prompt":"system prompt",characters:"caracteres","select-all":"seleccionar todas","select-none":"ninguna",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.',"fleet-cwd-needs-repair":"carpeta a reparar","fleet-cwd-repair":"reparar","fleet-cwd-repair-title":"Reparar carpeta de celda {id}","fleet-cwd-repair-help":"La carpeta actual no es portátil en este dispositivo: pertenece a otro dispositivo o no existe bajo el directorio home. Elige una carpeta relativa a home (~) en el dispositivo destino; el backend recalculará la ruta absoluta.","fleet-cwd-repair-no-source-path":"La ruta original no se muestra: es específica del dispositivo de origen.","fleet-cwd-repair-placeholder":"p. ej. Dev","fleet-cwd-repair-preview":"Nueva carpeta: {path}","fleet-cwd-repair-browse":"examinar bajo ~","fleet-cwd-repair-fs-empty":"sin subcarpetas","fleet-cwd-repair-use-current":"usar esta carpeta","fleet-cwd-repair-invalid":'ruta no válida: nada de ruta absoluta, "..", barra invertida ni letra de unidad',"fleet-cwd-repair-confirm":"¿Establecer la carpeta de la celda {id} a {path}? Se recalculará en el dispositivo destino.","fleet-cwd-repair-unportable":"La ruta elegida no es portátil en este dispositivo: debe existir bajo el directorio home.","fleet-cwd-repair-suggestion":"Sugerencia del dispositivo:","fleet-cwd-repair-use-suggestion":"usar {path}","fleet-cwd-repaired":"Carpeta de la celda reparada.","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)","published-port":"puerto publicado (opcional)","no-nodes":"sin nodos remotos configurados","node-add":"conectar una instalación NexusCrew","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","pair-ssh-local-label":"Host o alias SSH en este dispositivo","node-ssh-local-help":"Puedes sustituir la dirección del enlace por el mismo alias que funciona con ssh en este dispositivo. Los alias, agentes y claves permanecen locales y nunca viajan en el enlace.","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-remove-warning":"Elimina el emparejamiento, las credenciales y el túnel local. No apaga el dispositivo remoto.","peer-inventory-title":"Nodos conectados al hub","peer-group-hubs":"Hubs directos","peer-group-clients":"Clientes conectados","peer-group-routed":"Nodos accesibles a través de la red","peer-routed":"enrutado","peer-routed-stale":"enrutado, no accesible","peer-visibility":"Visibilidad en la red","node-test":"test","tunnel-start":"iniciar túnel","tunnel-stop":"detener túnel","tunnel-restart":"reiniciar túnel","share-node":"Compartir este nodo","share-local-heading":"Compartir este dispositivo","share-local-hub":"Hub para compartir","share-local-through":"Compartir {device} mediante {hub}","share-local-active":"Compartido y accesible para la red conectada al hub.","share-local-pending":"Se solicitó compartir, pero el túnel está caído: este dispositivo aún no es accesible.","share-local-private":"Privado: solo este dispositivo puede usar la conexión al hub.","share-local-private-down":"Privado, pero la conexión al hub está caída. Reconecta para aplicar y verificar el modo privado.","share-local-reconnect":"Reconectar y reconciliar","share-off-hub-reconcile-pending":"Estado privado guardado; la revocación en el hub sigue pendiente.","share-off-local-reconcile-pending":"Revocación confirmada por el hub; el túnel local aún debe reconciliarse.","share-node-off-desc":"Privado: sigue conectado al hub, pero otros clientes no pueden alcanzarlo.","share-node-on-desc":"Compartido: el hub puede anunciarlo y enrutar celdas y decks autorizados.","peer-shared":"Nodo cliente compartido en la red Hydra","peer-private":"Nodo cliente privado: conectado, no publicado en Hydra","node-connected-client":"cliente conectado","transport-used":"en uso","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 show token`. La sesión actual quedará invalidada.","service-regenerate":"regenerar service","npm-auto-update":"actualizaciones automáticas desde npm","npm-auto-update-help":"Comprueba latest periódicamente e instala solo versiones más recientes. Nunca baja de versión.","npm-update-current":"instalada","npm-update-latest":"npm latest","npm-update-check":"comprobar ahora","npm-update-install":"actualizar ahora","npm-update-restarting":"Actualización iniciada; NexusCrew volverá después de reiniciar el servicio.","npm-update-idle":"actualizado","npm-update-checking":"comprobando","npm-update-available":"actualización disponible","npm-update-installing":"instalando","npm-update-installed":"instalada, reiniciando","npm-update-error":"comprobación fallida","npm-update-unsupported":"disponible solo con instalación npm global","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-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-local-name":"nombre local inválido: usa un slug único, no “localhost”","err-ssh":"ssh inválido (se espera user@host o alias)","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)","node-sessions":"{n} sesiones","tunnel-down-since":"túnel caído desde hace {t}","node-unreachable":"nodo inalcanzable","node-passive":"cliente desconectado · estado normal","node-offline":"nodo desconectado","node-offline-seen":"sin conexión · visto hace {t}","node-needs-repair":"legacy · vuelve a enlazar","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","notification-speech-enable":"leer las notificaciones en voz alta","notification-speech-help":"Usa la voz del navegador solo para notificaciones nuevas mientras esta PWA está visible y en primer plano. Con la aplicación cerrada permanece la notificación del sistema.","notification-speech-test":"probar voz","notification-speech-testing":"probando voz…","notification-speech-preview":"NexusCrew. Las notificaciones por voz están activas.","notification-speech-preview-ok":"Prueba de voz completada.","notification-speech-preview-failed":"El navegador no inició la prueba de voz. Interactúa con la página y vuelve a intentarlo.","notification-speech-needs-test":"Para esta sesión de la aplicación, pulsa “probar voz” antes de recibir avisos hablados.","notification-speech-unsupported":"La síntesis de voz no está disponible en este navegador.","audio-title":"Audio nativo del nodo","audio-help":"El consentimiento y los controles valen solo para este dispositivo. Compartir y visibilidad no autorizan sonidos.","audio-consent":"permitir TTS en este nodo","audio-consent-help":"Permite que celdas autorizadas, locales o remotas, entreguen un comando de voz. Puedes revocarlo en cualquier momento.","audio-capability":"Capacidad local","audio-loading":"leyendo el estado de audio local…","audio-adapter":"adaptador","audio-adapter-none":"ninguno","audio-installed":"instalado","audio-installed-yes":"sí","audio-installed-no":"no","audio-liveness":"disponibilidad","audio-liveness-ready":"listo para aceptar","audio-liveness-unavailable":"no disponible","audio-languages":"idiomas declarados","audio-limits":"límites","audio-test":"probar audio local","audio-testing":"probando audio…","audio-stop":"detener audio local","audio-stopping":"deteniendo audio…","audio-test-needs-consent":"Activa el consentimiento local antes de probar la voz.","audio-unavailable":"No hay un adaptador TTS nativo disponible en este nodo.","audio-test-accepted":"El nodo aceptó la prueba. No demuestra que alguien la haya oído.","audio-test-refused":"El nodo rechazó la prueba.","audio-test-unknown":"Resultado de prueba desconocido: el nodo no pudo confirmar el inicio.","audio-stop-stopped":"Audio local detenido.","audio-stop-idle":"No hay enunciado local que detener.","audio-groups-title":"Grupos de audio compartido","audio-groups-help":"Decide en qué dispositivos se oye la voz cuando habla una celda. Un grupo es una preferencia local de entrega, no un consentimiento. Cada nodo conserva su consentimiento, ACL, disponibilidad y Stop local.","audio-groups-empty":"Sin grupos: la voz sale solo por este nodo.","audio-group-name":"nombre del grupo","audio-group-mode":"modo de entrega","audio-group-primary":"primero disponible (en orden)","audio-group-fanout":"todos los nodos enumerados","audio-group-targets":"nodos destino exactos","audio-group-local":"este nodo","audio-group-unavailable-target":"no detectado ahora","audio-group-no-targets":"No hay ningún nodo con instanceId disponible. Un grupo no puede usar nombres, comodines ni “todos”.","audio-group-new":"nuevo grupo","audio-group-edit":"editar","audio-group-delete":"eliminar","audio-group-save":"guardar grupo","audio-group-cancel":"cancelar","audio-group-invalid":"El grupo necesita un nombre válido y al menos un nodeId exacto.","audio-group-save-failed":"No se pudo guardar el grupo de audio.","node-display-label":"Nombre (etiqueta)","routed-node-aliases":"Alias de nodos enrutados","routed-node-aliases-help":"Visibles solo en este dispositivo; la ruta y el nombre remoto no cambian.","node-local-alias":"Alias en este dispositivo","alias-on-device":"Alias en este dispositivo","reset-alias":"Restablecer nombre remoto","node-slug-hint":"enrutado por slug: {slug}","device-name-label":"Nombre del dispositivo","device-name-hint":"cómo te ven los pares (editable)","local-route-name-label":"Nombre local / ruta","local-route-name-hint":"identificador técnico estable: etiqueta legible + sufijo del nodeId; editable antes de conectar","err-label":"etiqueta no válida (máx 64 caracteres, sin saltos de línea)","fleet-inventory":"Celdas y sesiones","fleet-inventory-help":"todas las posiciones (Local + rutas Hydra)","fleet-manage-location":"Gestionar ubicación","fleet-network-overview":"Vista de red","fleet-manage-help":"crea y configura celdas en la ubicación seleccionada","fleet-overview-help":"estado operativo de todas las ubicaciones, separado del editor","fleet-inventory-empty":"sin celdas ni sesiones","fleet-not-available":"fleet no disponible en esta posición",start:"iniciar",stop:"detener",restart:"reiniciar",delete:"eliminar","copy-manual":"copia fallida — selecciona y pulsa Cmd+C, o copia a mano","copy-empty":"nada seleccionado: arrastra con Shift para seleccionar","save-and-start":"guardar e iniciar",permissions:"Permisos","power-on-hint":"Detén la celda; también puedes quitarla del boot.","launch-engine-help":"Proveedores, credenciales y nuevos motores se crean en Ajustes → Flota. Modelo y permisos son por celda.","launch-unavailable-hint":"La configuración del motor no está disponible en este nodo.","import-as-cell":"Importar como celda","import-help":"Reconcilia una sesión tmux existente en una celda gestionada. Elige un motor ya declarado: no se inventa ninguno.","import-engine-required":"elige un motor (obligatorio)","test-and-connect":"probar y conectar","pairing-v2-hint":"Pega o escanea UN solo enlace: rellena nombre, Host SSH y etiqueta cuando los incluye (v2).","invite-v2-hint":"Crea una invitación completa de un solo uso. Si este dispositivo ya está unido a un hub, se usa automáticamente; si no, solo hace falta su dirección SSH alcanzable.","invite-network-hint":"Crea una invitación para la red a la que ya estás conectado. El nuevo dispositivo entra por el hub y no se conecta directamente a este dispositivo.","invite-network-label":"Red de destino","invite-network-via":"Hub","invite-network-route":"Una sola conexión al hub; nodos, celdas y decks se enrutan internamente.","invite-endpoint-label":"Dirección SSH de este hub vista por los otros dispositivos","invite-endpoint-auto":"Endpoint ya configurado","invite-endpoint-needed":"Introduce usuario@host o un alias SSH compartido. No es 127.0.0.1 ni la URL HTTP de NexusCrew.","invite-ssh-hint":"El destino SSH con el que el OTRO dispositivo alcanza ESTA instalación (usuario@host o alias). Obligatorio: se incluye en el enlace.","invite-next-steps":"copia este enlace, abre NexusCrew en el otro dispositivo y pégalo en Ajustes → Nodos (o escanea el QR): NexusCrew hace el resto","pair-card-title":"conectar con un solo enlace","pair-card-help":"Pega el enlace de emparejamiento generado en el otro dispositivo (o escanea su QR): NexusCrew lo decodifica, prueba la conexión SSH y conecta solo.","pair-paste-ph":"pega aquí el enlace de emparejamiento","pair-paste-btn":"pegar","pair-advanced":"avanzado / editar","pair-progress":"conectando: SSH → invitación → confirmación → verificación…","pair-retry":"reintentar","pair-invalid-link":"esto no es un enlace de emparejamiento válido","pair-invalid-hint":"se necesita el enlace completo (http://…#pair=…) generado por el otro NexusCrew: no lo abras, pégalo aquí","pair-missing-ssh":"el enlace no incluye el destino SSH (formato v1): indica en “avanzado” cómo este dispositivo alcanza al otro por SSH — nunca se inventa","pair-missing-name":"falta el nombre del nodo: complétalo en “avanzado”","pair-clipboard-denied":"lectura del portapapeles no permitida: pega manualmente en el campo","pair-clipboard-empty":"portapapeles vacío: copia primero el enlace","pair-stage-validation":"datos no válidos","pair-stage-conflict":"nombre ya en uso","pair-stage-ssh-start":"fallo al iniciar el túnel SSH","pair-stage-ssh-ready":"peer inaccesible por SSH","pair-stage-join":"intercambio de invitación fallido","pair-stage-tunnel-final":"túnel negociado fallido","pair-stage-confirm":"confirmación de emparejamiento fallida","pair-stage-health":"verificación final de la federación fallida","pair-stage-internal":"error interno","pair-stage-generic":"conexión fallida","qr-no-camera":"no hay cámara disponible en este dispositivo: usa una foto del QR","qr-permission":"permiso de cámara denegado: permítelo en el navegador o usa una foto del QR","qr-unsupported":"escáner en vivo no soportado aquí: sube una foto del QR","qr-upload":"usar una foto"}};function Cl(){const e=K_(),t=e?e.getItem(U_):null;return Fh.includes(t)?t:gl}function q0(e){const t=K_();if(t)try{t.setItem(U_,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(Pd))}function g(e){const t=Cl(),n=sl[t]||sl[gl];return Object.prototype.hasOwnProperty.call(n,e)?n[e]:Object.prototype.hasOwnProperty.call(sl[gl],e)?sl[gl][e]:e}function V0(e){return typeof window>"u"?()=>{}:(window.addEventListener(Pd,e),()=>window.removeEventListener(Pd,e))}const q_=Fh;function $n(){return[N.useSyncExternalStore(V0,Cl,Cl),q0]}function El({cell:e,token:t,route:n=[],onConfirm:r,onClose:o}){var P,$;$n();const a=!!(e&&e.active),u=Array.isArray(n)?n.join("/"):"",[h,f]=N.useState([]),[p,v]=N.useState(!1);N.useEffect(()=>{let L=!0;return(async()=>{if(t)try{const q=await vs(t,u?u.split("/"):[]);if(!L)return;if(v(q.provider==="builtin"&&(q.capabilities||[]).includes("edit")),q.provider==="builtin"&&(q.capabilities||[]).includes("definitions")){const I=await Ah(t,u?u.split("/"):[]);if(!L)return;const T=new Map((q.engines||[]).map(U=>[U.id,U]));f((I.engines||[]).map(U=>{var Z,ae,he,pe,Q,ne,fe;return{id:U.id,label:U.label||U.id,client:((Z=U.managed)==null?void 0:Z.client)||"",models:[...new Set([...((ae=T.get(U.id))==null?void 0:ae.models)||[],...((he=U.managedInfo)==null?void 0:he.models)||[]])].filter(Boolean),defaultModel:((pe=U.managed)==null?void 0:pe.model)||((Q=U.managedInfo)==null?void 0:Q.defaultModel)||"",policyDefault:((ne=U.managed)==null?void 0:ne.permissionPolicy)||((fe=U.managed)!=null&&fe.client&&U.managed.client==="claude"?"unsafe":"standard")}}))}}catch{}})(),()=>{L=!1}},[t,u]);const x=(e==null?void 0:e.engine)||((P=h[0])==null?void 0:P.id)||"",w=L=>(e==null?void 0:e.models)&&e.models[L]||"",S=L=>{const q=(e==null?void 0:e.permissionPolicies)&&e.permissionPolicies[L];if(q==="standard"||q==="unsafe")return q;const I=h.find(T=>T.id===L);return I?I.policyDefault:"standard"},[y,b]=N.useState(x),[C,R]=N.useState((e==null?void 0:e.model)||""),k=(e==null?void 0:e.permissionPolicy)==="standard"||(e==null?void 0:e.permissionPolicy)==="unsafe"?e.permissionPolicy:(($=e==null?void 0:e.permissionPolicies)==null?void 0:$[e==null?void 0:e.engine])||"",[F,B]=N.useState(k),[V,G]=N.useState((e==null?void 0:e.boot)??!0),[z,te]=N.useState(!1),[H,X]=N.useState(null);N.useEffect(()=>{h.length&&(b(L=>L||x),R(L=>L||w((e==null?void 0:e.engine)||x)||""),B(L=>L==="standard"||L==="unsafe"?L:S((e==null?void 0:e.engine)||x)))},[h.length]);const A=N.useMemo(()=>h.find(L=>L.id===y)||null,[h,y]),M=!!(A&&["claude","codex","codex-vl","agy"].includes(A.client)),E=(A==null?void 0:A.client)==="shell";function D(L){b(L);const q=h.find(I=>I.id===L);R(w(L)||(q==null?void 0:q.defaultModel)||""),B(S(L))}async function O(L){L.preventDefault(),te(!0),X(null);try{if(a)await r({action:"down",boot:V});else{const q=F==="standard"||F==="unsafe"?F:(A==null?void 0:A.policyDefault)||"standard";await r({action:"up",...p?{engine:y,model:C||"",...M?{permissionPolicy:q}:(A==null?void 0:A.client)==="pi"?{permissionPolicy:"standard"}:{}}:{},boot:V})}o()}catch(q){X(String(q&&q.message||q)),te(!1)}}return c.jsx("div",{className:"nc-sheet-overlay nc-launch-overlay",onClick:o,children:c.jsxs("form",{className:"nc-sheet nc-power-sheet nc-launch-sheet",onClick:L=>L.stopPropagation(),onSubmit:O,children:[c.jsxs("div",{className:"nc-sheet-head",children:[c.jsx("b",{children:e==null?void 0:e.cell}),c.jsx("span",{className:"nc-sheet-state",children:g(a?"state-on":"state-off")})]}),a?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nc-power-config",children:[c.jsx("span",{children:g("engine")}),c.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&c.jsxs("small",{children:[g("model"),": ",e.model]}),c.jsx("small",{children:g("power-on-hint")})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:V,onChange:L=>G(L.target.checked)}),g("remove-boot")]})]}):c.jsxs(c.Fragment,{children:[p&&h.length>0?c.jsxs("div",{className:"nc-launch-fields",children:[c.jsxs("label",{className:"nc-field",children:[g("engine"),c.jsx("select",{value:y,onChange:L=>D(L.target.value),children:h.map(L=>c.jsx("option",{value:L.id,children:L.label},L.id))})]}),!E&&c.jsxs("label",{className:"nc-field",children:[g("model"),c.jsx("input",{value:C,list:"nc-launch-models",placeholder:g("model-default"),onChange:L=>R(L.target.value)}),c.jsx("datalist",{id:"nc-launch-models",children:((A==null?void 0:A.models)||[]).map(L=>c.jsx("option",{value:L},L))})]}),M?c.jsxs("label",{className:"nc-field",children:[g("permissions"),c.jsxs("select",{value:F,onChange:L=>B(L.target.value),children:[c.jsx("option",{value:"standard",children:g("fleet-standard-permissions")}),c.jsx("option",{value:"unsafe",children:g("fleet-unsafe-permissions")})]})]}):c.jsx("small",{className:"nc-note",children:g("fleet-standard-permissions")}),M&&F==="unsafe"&&c.jsx("small",{className:"nc-err",children:g("fleet-unsafe-warning")}),c.jsx("small",{className:"nc-note",children:g(E?"fleet-shell-launch-help":"launch-engine-help")})]}):c.jsxs("div",{className:"nc-power-config",children:[c.jsx("span",{children:g("engine")}),c.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&c.jsxs("small",{children:[g("model"),": ",e.model]}),c.jsx("small",{children:g("launch-unavailable-hint")})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:V,onChange:L=>G(L.target.checked)}),g("boot-persist")]})]}),H&&c.jsx("div",{className:"nc-err",children:H}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:o,disabled:z,children:g("cancel")}),c.jsx("button",{type:"submit",className:"nc-btn primary",disabled:z,children:g(a?"power-off":"save-and-start")})]})]})})}const dg=/^[a-z0-9-]{1,32}$/;function Nl(e,t){const n=Array.isArray(e)?e:[];return n.length?`${n.map(encodeURIComponent).join("/")}:${t}`:String(t)}function Y0(e,t,n){const r={};for(const o of Array.isArray(t)?t:[]){const a=Array.isArray(o==null?void 0:o.route)?o.route:typeof(o==null?void 0:o.name)=="string"?[o.name]:[];if(!a.length)continue;const u=a.join("/"),h=o.status==="up"||o.tunnel&&o.tunnel.status==="up",f=o.status==="passive"||o.tunnel&&o.tunnel.status==="passive";!h&&!f&&(r[u]=e&&e[u]||n)}return r}function hg(e,t,n){return!e||!Array.isArray(e.cells)?[]:e.cells.map(r=>({...r,route:t,key:`${n}:${r.tmuxSession||r.cell}`}))}function fg({nodes:e,topology:t,remote:n,down:r,fleet:o,aliases:a}={}){var p,v,x,w;const u=[],h=new Set,f=new Set;for(const S of Array.isArray(e)?e:[]){if(!S||typeof S.name!="string"||!dg.test(S.name)||S.direction==="inbound"&&S.shared!==!0)continue;const y=[S.name],b=S.name;h.add(b);const C=((p=S.tunnel)==null?void 0:p.status)||"unknown",R=C==="up",k={name:S.name,label:S.label||S.name,originalLabel:S.label||S.name,alias:null,route:y,direct:!0,instanceId:S.nodeId||null,shared:S.shared===!0,tunnelStatus:C,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:S.health||null,direction:S.direction||"outbound",roles:S.roles||null,rolesKnown:S.rolesKnown===!0};if(S.nodeId&&f.add(S.nodeId),!S.nodeId&&S.paired===!1){u.push({...k,status:"needs-repair",downSince:r&&r[b]||null});continue}if(((v=S.health)==null?void 0:v.auth)==="failed"||C==="degraded"&&((x=S.health)==null?void 0:x.status)==="degraded"){u.push({...k,status:"needs-repair",downSince:r&&r[b]||null});continue}if(C==="passive"||((w=S.health)==null?void 0:w.status)==="passive"){u.push({...k,status:"passive",downSince:null});continue}if(!R){u.push({...k,status:"down",downSince:r&&r[b]||null});continue}const F=n&&(n[b]||n[S.name])||null,B=o&&(o[b]||o[S.name]),V=!!(F&&!F.error&&Array.isArray(F.sessions)),G=!!(B&&B.available===!0&&Array.isArray(B.cells));if(!V&&!G){u.push({...k,status:"unreachable"});continue}const z=(V?F.sessions:[]).filter(X=>X&&typeof X.name=="string"&&X.name).map(X=>({...X,node:b,route:y,key:`${b}:${X.name}`})),te=hg(B,y,b),H=new Set(te.map(X=>X.tmuxSession).filter(Boolean));u.push({...k,status:"up",sessions:z,cells:te,unmanaged:z.filter(X=>!H.has(X.name)),fleetAvailable:!!(B&&B.available),capabilities:B&&B.capabilities||[],engines:B&&B.engines||[],fleetProvider:B&&B.provider||null,sessionsAvailable:V,inventoryPartial:!V})}for(const S of Array.isArray(t)?t:[]){if(!S||!Array.isArray(S.route)||S.route.length<1||S.route.some(H=>!dg.test(H)))continue;const y=S.route.join("/");if(h.has(y)||S.instanceId&&f.has(S.instanceId))continue;S.instanceId&&f.add(S.instanceId);const b=S.label||S.route.join(" › "),C=S.instanceId&&a&&typeof a[S.instanceId]=="string"?a[S.instanceId]:null,R={name:S.name,label:C||b,originalLabel:b,alias:C,route:[...S.route],direct:!1,instanceId:S.instanceId||null,shared:!0,tunnelStatus:null,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:S.health||null,lastSeen:S.lastSeen||null};if(S.stale){u.push({...R,status:"offline",downSince:r&&r[y]||S.lastSeen||null});continue}const k=n&&n[y]||null,F=o&&o[y],B=!!(k&&!k.error&&Array.isArray(k.sessions)),V=!!(F&&F.available===!0&&Array.isArray(F.cells));if(!B&&!V){u.push({...R,status:"unreachable",downSince:r&&r[y]||null});continue}const G=(B?k.sessions:[]).filter(H=>H&&typeof H.name=="string"&&H.name).map(H=>({...H,node:y,route:S.route,key:`${y}:${H.name}`})),z=hg(F,S.route,y),te=new Set(z.map(H=>H.tmuxSession).filter(Boolean));u.push({...R,status:"up",sessions:G,cells:z,unmanaged:G.filter(H=>!te.has(H.name)),fleetAvailable:!!(F&&F.available),capabilities:F&&F.capabilities||[],engines:F&&F.engines||[],fleetProvider:F&&F.provider||null,lastSeen:S.lastSeen||null,sessionsAvailable:B,inventoryPartial:!B})}return u.sort((S,y)=>S.label.localeCompare(y.label))}const G0=4e3;function $h(e,t=!0,n=0){const[r,o]=N.useState([]),a=N.useRef({});return N.useEffect(()=>{if(!t||!e){o([]);return}let u=!0;async function h(){var R;let p=[],v=[],x={};if(await Promise.all([c0(e).then(k=>{p=Array.isArray(k.nodes)?k.nodes:[]}).catch(()=>{}),d0(e).then(k=>{v=Array.isArray(k.nodes)?k.nodes:[]}).catch(()=>{}),p0(e).then(k=>{x=k&&typeof k.aliasesByInstanceId=="object"?k.aliasesByInstanceId:{}}).catch(()=>{})]),!u)return;const w={},S={},y=new Set(p.map(k=>k.name)),b=[];for(const k of p)((R=k.tunnel)==null?void 0:R.status)==="up"&&(k.nodeId||k.paired!==!1)&&(k.direction!=="inbound"||k.shared===!0)&&b.push([k.name]);for(const k of v)!k.stale&&Array.isArray(k.route)&&!(k.route.length===1&&y.has(k.route[0]))&&b.push(k.route);if(await Promise.all(b.map(async k=>{const F=k.join("/");try{w[F]=await z_(e,k)}catch{w[F]={error:"unreachable"}}try{S[F]=await vs(e,k)}catch{S[F]={available:!1}}})),!u)return;const C=fg({nodes:p,topology:v,remote:w,fleet:S,aliases:x,down:a.current});a.current=Y0(a.current,C,Math.floor(Date.now()/1e3)),o(fg({nodes:p,topology:v,remote:w,fleet:S,aliases:x,down:a.current}))}h();const f=setInterval(h,G0);return()=>{u=!1,clearInterval(f)}},[e,t,n]),r}const pg=52,mg=14;function us({position:e,itemKey:t,label:n,onMove:r,onStep:o,canMove:a=()=>!0,scope:u="roster"}){const h=N.useRef(null),f=N.useRef(0),[p,v]=N.useState(!1),x=()=>{var R,k,F,B;const C=h.current;(k=(R=C==null?void 0:C.over)==null?void 0:R.classList)==null||k.remove("nc-roster-over"),(B=(F=C==null?void 0:C.source)==null?void 0:F.classList)==null||B.remove("nc-roster-dragging"),f.current&&cancelAnimationFrame(f.current),f.current=0},w=(C=!1)=>{const R=h.current;if(!R)return;const k=R.target;x(),h.current=null,v(!1);try{R.handle.releasePointerCapture(R.pointerId)}catch{}C&&k&&k!==t&&a(t,k)&&r(t,k)},S=(C,R)=>{var te,H,X,A,M,E,D,O,P;const k=h.current;if(!k)return;k.x=C,k.y=R;const F=u==="node"?"[data-node-order-key]":"[data-roster-key][data-position]",B=(H=(te=document.elementFromPoint(C,R))==null?void 0:te.closest)==null?void 0:H.call(te,F),V=u==="node"?(X=B==null?void 0:B.dataset)==null?void 0:X.nodeOrderKey:(A=B==null?void 0:B.dataset)==null?void 0:A.rosterKey,z=(u==="node"||((M=B==null?void 0:B.dataset)==null?void 0:M.position)===e)&&V&&V!==t&&a(t,V);k.over!==(z?B:null)&&((D=(E=k.over)==null?void 0:E.classList)==null||D.remove("nc-roster-over"),k.over=z?B:null,(P=(O=k.over)==null?void 0:O.classList)==null||P.add("nc-roster-over")),k.target=z?V:null},y=()=>{const C=h.current;if(!C){f.current=0;return}const R=C.container;if(R){const k=R.getBoundingClientRect(),F=C.y<k.top+pg?-mg:C.y>k.bottom-pg?mg:0;F&&(R.scrollTop+=F,S(C.x,C.y))}f.current=requestAnimationFrame(y)};N.useEffect(()=>{const C=k=>{k.key==="Escape"&&h.current&&(k.preventDefault(),w(!1))},R=()=>w(!1);return window.addEventListener("keydown",C),window.addEventListener("blur",R),()=>{window.removeEventListener("keydown",C),window.removeEventListener("blur",R),x(),h.current=null}},[t,e,u]);const b=C=>{var B;if(C.pointerType==="mouse"&&C.button!==0)return;C.preventDefault(),C.stopPropagation(),C.currentTarget.focus({preventScroll:!0});const R=u==="node"?"[data-node-order-key]":"[data-roster-key][data-position]",k=C.currentTarget.closest(R),F=C.currentTarget.closest(".nc-side-scroll, .nc-home-scroll");h.current={pointerId:C.pointerId,handle:C.currentTarget,source:k,container:F,target:null,over:null,x:C.clientX,y:C.clientY},(B=k==null?void 0:k.classList)==null||B.add("nc-roster-dragging");try{C.currentTarget.setPointerCapture(C.pointerId)}catch{}v(!0),f.current=requestAnimationFrame(y)};return c.jsx("button",{type:"button",className:`nc-roster-handle${p?" active":""}`,"aria-label":`${g("reorder")} ${n}`,"aria-keyshortcuts":"ArrowUp ArrowDown",title:g("reorder-help"),onClick:C=>{C.preventDefault(),C.stopPropagation()},onDragStart:C=>C.preventDefault(),onKeyDown:C=>{C.key!=="ArrowUp"&&C.key!=="ArrowDown"||(C.preventDefault(),C.stopPropagation(),o(C.key==="ArrowUp"?-1:1))},onPointerDown:b,onPointerMove:C=>{!h.current||C.pointerId!==h.current.pointerId||(C.preventDefault(),C.stopPropagation(),S(C.clientX,C.clientY))},onPointerUp:C=>{!h.current||C.pointerId!==h.current.pointerId||(C.preventDefault(),C.stopPropagation(),w(!0))},onPointerCancel:()=>w(!1),onLostPointerCapture:()=>{h.current&&w(!1)},children:"↕"})}const Hh="nc_pins";function X0(){try{const e=JSON.parse(localStorage.getItem(Hh));return Array.isArray(e)?e:[]}catch{return[]}}function J0(e,t){const n=e.includes(t)?e.filter(r=>r!==t):[...e,t];try{localStorage.setItem(Hh,JSON.stringify(n))}catch{}return n}function Q0(e,t,n){if(!e.includes(t)||!e.includes(n)||t===n)return e;const r=[...e],o=r.indexOf(t),a=r.indexOf(n);r.splice(o,1);const u=r.indexOf(n);r.splice(o<a?u+1:u,0,t);try{localStorage.setItem(Hh,JSON.stringify(r))}catch{}return r}function Z0(e,t,n){const r=e.indexOf(t);return[r===-1?1e9:r,-(n||0)]}function e1(e,t){return e[0]-t[0]||e[1]-t[1]}function V_(){const[e,t]=N.useState(X0),[n,r]=N.useState(W0),[o,a]=N.useState(F0),u=w=>t(S=>J0(S,w)),h=w=>cg(n,w),f=(w,S)=>r(y=>{const b={...y,[w]:{...cg(y,w),...S}};return U0(b)}),p=(w,S)=>e.includes(w)===e.includes(S);function v(w,S,y,b){const C=e.includes(S),R=e.includes(y);if(C===R){if(C){t(k=>Q0(k,S,y));return}a(k=>{var V;const F=((V=b.find(G=>G.key===S))==null?void 0:V.technical)===!0,B=Fs(b,e,F?"technical":"all",fs(k,w)).map(G=>G.key);return $0(H0(k,w,S,y,B))})}}function x(w,S,y,b){var V;const C=((V=b.find(G=>G.key===S))==null?void 0:V.technical)===!0,R=e.includes(S),k=Fs(b,e,C?"technical":"all",fs(o,w)).map(G=>G.key).filter(G=>e.includes(G)===R),F=k.indexOf(S),B=k[F+y];F>=0&&B&&v(w,S,B,b)}return{pins:e,views:n,orders:o,togglePin:u,viewFor:h,updateView:f,canMoveRoster:p,moveRoster:v,stepRoster:x}}const Y_="nc_node_order_v1",t1=/^[a-f0-9]{16,64}$/;function Os(e){if(t1.test(String((e==null?void 0:e.instanceId)||"")))return`id:${e.instanceId}`;const t=Array.isArray(e==null?void 0:e.route)?e.route.filter(n=>typeof n=="string"&&n):[];return t.length?`route:${t.map(encodeURIComponent).join("/")}`:typeof(e==null?void 0:e.name)=="string"&&e.name?`name:${encodeURIComponent(e.name)}`:""}function gg(e=globalThis.localStorage){try{const t=JSON.parse(e.getItem(Y_));return Array.isArray(t)?[...new Set(t.filter(n=>typeof n=="string"&&n&&n.length<=192))].slice(0,128):[]}catch{return[]}}function n1(e,t=globalThis.localStorage){try{t.setItem(Y_,JSON.stringify(e))}catch{}return e}function vg(e=[],t=[]){const n=new Map(t.map((r,o)=>[r,o]));return e.map((r,o)=>({group:r,index:o})).sort((r,o)=>{const a=n.has(Os(r.group))?n.get(Os(r.group)):Number.MAX_SAFE_INTEGER,u=n.has(Os(o.group))?n.get(Os(o.group)):Number.MAX_SAFE_INTEGER;return a-u||r.index-o.index}).map(({group:r})=>r)}function i1(e,t,n,r=[]){if(!t||!n||t===n)return e;const o=r.map(Os).filter(Boolean);if(!o.includes(t)||!o.includes(n))return e;const a=[...e.filter(p=>o.includes(p)),...o.filter(p=>!e.includes(p))],u=a.indexOf(t),h=a.indexOf(n);a.splice(u,1);const f=a.indexOf(n);return a.splice(u<h?f+1:f,0,t),a}const Ld="nexuscrew-node-preferences";function s1(){try{window.dispatchEvent(new Event(Ld))}catch{}}function G_(){const[e,t]=N.useState(gg);N.useEffect(()=>{const a=()=>t(gg());return window.addEventListener("storage",a),window.addEventListener(Ld,a),()=>{window.removeEventListener("storage",a),window.removeEventListener(Ld,a)}},[]);const n=a=>vg(a,e),r=(a,u,h)=>t(f=>{const p=i1(f,a,u,h);return n1(p),s1(),p});return{order:e,groupsFor:n,moveNode:r,stepNode:(a,u,h)=>{const f=vg(h,e).map(Os),p=f.indexOf(a),v=f[p+u];p>=0&&v&&r(a,v,h)},nodeKey:Os}}function Nr(e,t=Math.floor(Date.now()/1e3)){if(!e)return"";const n=t-e;return n<0||n<60?"ora":n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:`${Math.floor(n/86400)}g`}function xr(e){return e.status==="passive"?g("node-passive"):e.status==="down"?e.downSince?g("tunnel-down-since").replace("{t}",Nr(e.downSince)):g("tunnel-down"):e.status==="unreachable"?g("node-unreachable"):e.status==="offline"?e.lastSeen?g("node-offline-seen").replace("{t}",Nr(e.lastSeen)):g("node-offline"):e.status==="needs-repair"?g("node-needs-repair"):""}function X_(e,{passive:t=null}={}){return e?e.status==="passive"?t:e.status==="healthy"?"on":"warn":null}function Rl(e){return e&&(e.detail||e.status)||""}function jl(e,t,n=globalThis.localStorage){if(!(e!=null&&e.outbox)||e.outbox.count<1)return!1;const r=Number(n.getItem(D_(t))||0);return e.outbox.latest>r}function Wh(e,t={}){const n=e||{};if(!n.tmux){const r=`${n.engine||""}${n.key?`·${n.key}`:""}`,o=[r,n.model&&n.model!==r?n.model:""].filter(Boolean).join(" · ");return{working:!1,subtitle:String(o||g("cell-off")).trim()}}if(t.working===!0){const r=g("cell-working"),o=String(t.status||"").trim();return{working:!0,subtitle:!o||/^working(?:\.{3}|…)?$/i.test(o)?r:`${r} · ${o}`}}return t.working===!1?{working:!1,subtitle:g("cell-idle")}:{working:!1,subtitle:String(t.preview||n.preview||g("cell-on")).trim()}}function J_(e,t){return[...new Set([e.engine,e.model,e.key,t.preview,e.preview,t.status].filter(Boolean).map(String))].join(" ")}function Q_(e,t,n,r=globalThis.localStorage){return[...(Array.isArray(e)?e:[]).map(o=>{const a=n.get(o.tmuxSession)||{},u=Nl([],o.tmuxSession),h=Wh(o,a);return{type:"cell",value:o,key:u,label:o.cell,live:!!o.tmux,fresh:jl(a,u,r),activity:a.activity||0,working:h.working,subtitle:h.subtitle,searchText:J_(o,a)}}),...(Array.isArray(t)?t:[]).map(o=>{const a=Nl([],o.name);return{type:"session",value:o,key:a,label:o.name,live:!0,technical:o.technical===!0,fresh:jl(o,a,r),activity:o.activity||0,searchText:`${o.preview||""} ${o.cmd||""}`}})]}function Td(e,t=globalThis.localStorage){const n=e||{},r=Array.isArray(n.route)?n.route:[],o=new Map((n.sessions||[]).map(u=>[u.name,u])),a=[...(n.cells||[]).map(u=>{const h=o.get(u.tmuxSession)||{},f=Nl(r,u.tmuxSession||u.cell),p=Wh(u,h);return{type:"cell",value:u,key:f,label:u.cell,live:!!u.tmux,fresh:jl(h,f,t),activity:h.activity||u.activity||0,working:p.working,subtitle:p.subtitle,searchText:J_(u,h)}}),...(n.unmanaged||[]).map(u=>{const h=Nl(r,u.name);return{type:"session",value:u,key:h,label:u.name,live:!0,technical:u.technical===!0,fresh:jl(u,h,t),activity:u.activity||0,searchText:`${u.preview||""} ${u.cmd||""}`}})];return{route:r,rawItems:a}}const Uh=9,Pl=.2,r1=/^[a-z0-9-]{1,32}(?:\/[a-z0-9-]{1,32}){0,3}$/,Rr=/^[a-f0-9]{16,64}$/,Dd=e=>r1.test(e)&&new Set(e.split("/")).size===e.split("/").length;function gs(e){if(typeof e=="string"&&e){const t=e.indexOf(":");if(t<0)return{session:e};const n=e.slice(0,t),r=e.slice(t+1);return!Dd(n)||!r?null:{session:r,node:n}}if(e&&typeof e=="object"&&typeof e.session=="string"&&e.session){const t=e.ownerId===void 0?void 0:typeof e.ownerId=="string"&&Rr.test(e.ownerId)?e.ownerId:null;return t===null?null:e.node===void 0||e.node===null||e.node===""?{session:e.session,...t?{ownerId:t}:{}}:typeof e.node=="string"&&Dd(e.node)?{session:e.session,node:e.node,...t?{ownerId:t}:{}}:null}return null}function On(e){const t=gs(e);return t?t.node?`${t.node}:${t.session}`:t.session:""}const Z_=9,ey=24,Ho=11,o1=e=>{const t=Number(e);return t>=Z_&&t<=ey?t:Ho};function kr(){return{columns:[]}}function wi(e){return e.columns.flatMap(t=>t.tiles.map(n=>On(n)))}function a1(e){const t=[],n=Math.max(0,...e.columns.map(r=>r.tiles.length));for(let r=0;r<n;r+=1)for(const o of e.columns)o.tiles[r]&&t.push(On(o.tiles[r]));return t}const Dr=e=>({columns:e.columns.map(t=>({width:t.width,tiles:t.tiles.map(n=>({...n}))}))});function Kh(e,t,n,r){const o=gs(t);if(!o||wi(e).includes(On(o))||wi(e).length>=Uh)return e;const a=Dr(e),u={session:o.session,height:1,fontSize:Ho,...r||{}};if(o.node&&(u.node=o.node),o.ownerId&&(u.ownerId=o.ownerId),n==="end")return a.columns.push({width:1,tiles:[u]}),a;if(n&&typeof n.col=="number"&&typeof n.row=="number"&&a.columns[n.col])return a.columns[n.col].tiles.splice(n.row,0,u),a;if(n&&typeof n.col=="number"){const h=Math.max(0,Math.min(a.columns.length,n.col));return a.columns.splice(h,0,{width:1,tiles:[u]}),a}return a.columns.push({width:1,tiles:[u]}),a}function ty(e,t){const n=On(t);if(!n||wi(e).includes(n)||wi(e).length>=Uh)return e;const r=wi(e).length+1,o=Math.ceil(Math.sqrt(r));if(e.columns.length>=o){let v=0;for(let x=1;x<e.columns.length;x+=1)e.columns[x].tiles.length<e.columns[v].tiles.length&&(v=x);return Kh(e,t,{col:v,row:e.columns[v].tiles.length})}const a=[...a1(e),n],u=new Map(e.columns.flatMap(v=>v.tiles.map(x=>[On(x),x]))),h=gs(t),f=e.columns.length?e.columns.reduce((v,x)=>v+(Number(x.width)||1),0)/e.columns.length:1,p=Array.from({length:o},(v,x)=>{var w;return{width:((w=e.columns[x])==null?void 0:w.width)||f,tiles:[]}});return a.forEach((v,x)=>{const w=gs(v);if(!w)return;const S=u.get(v)||(v===n?h:{})||{},y={session:w.session,height:S.height||1,fontSize:S.fontSize||Ho};w.node&&(y.node=w.node),S.ownerId&&(y.ownerId=S.ownerId),S.unavailable===!0&&(y.unavailable=!0),p[x%o].tiles.push(y)}),{columns:p.filter(v=>v.tiles.length)}}function Ll(e,t){const n=On(t),r=Dr(e);for(const o of r.columns)o.tiles=o.tiles.filter(a=>On(a)!==n);return r.columns=r.columns.filter(o=>o.tiles.length>0),r}function l1(e,t,n){const r=On(t);if(!wi(e).includes(r))return e;const o=e.columns.flatMap(a=>a.tiles).find(a=>On(a)===r);return Kh(Ll(e,r),r,n,{fontSize:o.fontSize,height:o.height,...o.ownerId?{ownerId:o.ownerId}:{},...o.unavailable===!0?{unavailable:!0}:{}})}function c1(e,t){if(!(t instanceof Map)||t.size===0)return e;let n=!1;const r=Dr(e);for(const o of r.columns)for(const a of o.tiles){const u=t.get(On(a));if(!u)continue;const h=gs(u);h&&(a.session=h.session,h.node?a.node=h.node:delete a.node,h.ownerId&&(a.ownerId=h.ownerId),n=!0)}return n?$s(r):e}function u1(e,t,n){const r=Dr(e);return r.columns[t]&&(r.columns[t].width=Math.max(Pl,Number(n)||1)),r}function d1(e,t,n,r){const o=Dr(e),a=o.columns[t]&&o.columns[t].tiles[n];return a&&(a.height=Math.max(Pl,Number(r)||1)),o}function h1(e,t,n,r){if(!(e.columns[t]&&e.columns[t].tiles[n]))return e;const a=Dr(e),u=a.columns[t].tiles[n],h=Number(u.fontSize)||Ho;return u.fontSize=Math.max(Z_,Math.min(ey,h+(Number(r)||0))),a}function f1(e,t,n,r){const o=e.columns[t];if(!o||!o.tiles[n])return null;switch(r){case"left":return{col:t};case"right":return{col:t+1};case"top":return{col:t,row:n};case"bottom":return{col:t,row:n+1};default:return null}}function _g(e){for(const t of[.25,.5,.75])if(Math.abs(e-t)<=.03)return t;return e}function $s(e){if(!e||!Array.isArray(e.columns))return kr();const t=e.columns.map(r=>({width:Math.max(Pl,Number(r&&r.width)||1),tiles:(Array.isArray(r&&r.tiles)?r.tiles:[]).filter(o=>o&&typeof o.session=="string"&&o.session).filter(o=>o.node==null||typeof o.node=="string"&&Dd(o.node)).filter(o=>o.ownerId==null||typeof o.ownerId=="string"&&Rr.test(o.ownerId)).map(o=>{const a={session:o.session,height:Math.max(Pl,Number(o.height)||1),fontSize:o1(o.fontSize)};return o.node!=null&&(a.node=o.node),o.ownerId!=null&&(a.ownerId=o.ownerId),o.unavailable===!0&&(a.unavailable=!0),a})})).filter(r=>r.tiles.length>0),n=new Set;for(const r of t)r.tiles=r.tiles.filter(o=>!n.has(On(o))&&n.add(On(o))&&n.size<=Uh);return{columns:t.filter(r=>r.tiles.length>0)}}const ny=/^[a-z0-9-]{1,32}$/,p1=/^[A-Za-z0-9._-]{1,32}$/,m1=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/,g1=320;function Md(e){return typeof e=="string"&&ny.test(e)}const v1=64;function jr(e){if(typeof e!="string")return!1;const t=e.trim();return t.length>0&&t.length<=v1&&!/[\x00-\x1f\x7f]/.test(t)}function ps(e){return String(e??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32).replace(/-+$/g,"")||"node"}function iy(e){if(typeof e!="string"||!e||e.length>g1||e.startsWith("-")||/[\0-\x20\x7f]/.test(e))return!1;if(!e.includes("@"))return/^[A-Za-z0-9][A-Za-z0-9._:-]{0,254}$/.test(e);const t=e.indexOf("@");return t<=0||t!==e.lastIndexOf("@")?!1:p1.test(e.slice(0,t))&&m1.test(e.slice(t+1))}function yg(e){if(e===""||e===null||e===void 0)return null;const t=String(e).trim();if(!/^[0-9]{1,5}$/.test(t))return;const n=Number(t);return Number.isInteger(n)&&n>=1&&n<=65535?n:void 0}function wg({name:e,ssh:t,sshPort:n,remotePort:r}={}){const o=typeof e=="string"?e.trim():e,a=typeof t=="string"?t.trim():t;if(!Md(o))return{ok:!1,error:"err-node-name"};if(!iy(a))return{ok:!1,error:"err-ssh"};const u=yg(n);if(u===void 0)return{ok:!1,error:"err-ssh-port"};const h=yg(r);if(h===void 0)return{ok:!1,error:"err-node-port"};const f={name:o,ssh:a};return u!==null&&(f.sshPort=u),h!==null&&(f.remotePort=h),{ok:!0,value:f}}function _1(e,t){if(!e||!t||t<e)return null;const n=Math.floor((t-e)/1e3);return n<60?"ora":n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:`${Math.floor(n/86400)}g`}function Sg(e,t){const n=!!(e&&e.status==="up"),r=!!(e&&e.status==="passive");return{up:n,...r?{passive:!0}:{},label:n?"tunnel-up":r?"node-passive":"tunnel-down",since:n?_1(e.since,t):null}}const y1=new Set(["v","instanceId","port","label","invite"]),w1=new Set(["v","instanceId","port","label","invite","name","ssh","sshPort"]);function S1(e){const t=String(e).replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),r=typeof atob=="function"?atob(n):Buffer.from(n,"base64").toString("binary"),o=Uint8Array.from(r,a=>a.charCodeAt(0));return typeof TextDecoder<"u"?new TextDecoder().decode(o):Buffer.from(o).toString("utf8")}function b1(e){let t="";try{const u=new URL(String(e));t=new URLSearchParams(u.hash.replace(/^#/,"")).get("pair")||""}catch{return{ok:!1}}if(!t)return{ok:!1};let n;try{n=JSON.parse(S1(t))}catch{return{ok:!1}}if(!n||typeof n!="object"||Array.isArray(n))return{ok:!1};const r=n.v===1?y1:n.v===2?w1:null;if(!r)return{ok:!1};for(const u of Object.keys(n))if(!r.has(u))return{ok:!1};if(!/^[a-f0-9]{16,64}$/.test(String(n.instanceId)))return{ok:!1};const o=Number(n.port);if(!Number.isInteger(o)||o<1||o>65535)return{ok:!1};if(typeof n.label!="string")return{ok:!1};if(typeof n.invite!="string"||!n.invite)return{ok:!1};const a={ok:!0,version:n.v,label:n.label,invite:n.invite,instanceId:n.instanceId,port:o};if(n.v===2){if(n.name!==void 0){if(typeof n.name!="string"||!ny.test(n.name))return{ok:!1};a.name=n.name}if(n.ssh!==void 0){if(!iy(n.ssh))return{ok:!1};a.ssh=String(n.ssh).trim()}if(n.sshPort!==void 0){const u=Number(n.sshPort);if(!Number.isInteger(u)||u<1||u>65535)return{ok:!1};a.sshPort=u}}return a}function x1(e,t,n=new Set){if(!t||!t.ok)return e;const r={...e},o=(a,u)=>{u==null||u===""||n.has(a)||(r[a]=u)};return o("label",t.label),t.version===2&&(o("name",t.name||(t.ssh?ps(t.label):"")),o("ssh",t.ssh),t.sshPort!==void 0&&o("sshPort",String(t.sshPort))),r}let Ad={sessions:[],cells:[],nodeGroups:[],localNodeId:""};function bg(){return Ad}function sy(e={}){return Ad={sessions:Array.isArray(e.sessions)?e.sessions:[],cells:Array.isArray(e.cells)?e.cells:[],nodeGroups:Array.isArray(e.nodeGroups)?e.nodeGroups:[],localNodeId:typeof e.localNodeId=="string"?e.localNodeId:""},Ad}const vr=(e,t=[])=>`${t.length?t.join("/"):"local"}:${e}`;function k1({onPick:e,token:t,onSettings:n}){const[r,o]=$n(),a=$h(t),[u,h]=N.useState(null),[f,p]=N.useState(null),[v,x]=N.useState(""),[w,S]=N.useState(""),[y,b]=N.useState({bind:"127.0.0.1",port:""}),[C,R]=N.useState(""),[k,F]=N.useState([]),[B,V]=N.useState([]),[G,z]=N.useState({}),[te,H]=N.useState(new Set),[X,A]=N.useState(null),[M,E]=N.useState(null),{pins:D,orders:O,togglePin:P,viewFor:$,updateView:L,canMoveRoster:q,moveRoster:I,stepRoster:T}=V_(),{groupsFor:U,moveNode:Z,stepNode:ae,nodeKey:he}=G_(),pe=U(a);N.useEffect(()=>{sy({sessions:u||[],cells:k,nodeGroups:a,localNodeId:C})},[u,k,a,C]),N.useEffect(()=>{const W=new Map;for(const se of k)W.set(vr(se.cell),!!se.boot);for(const se of a){const ve=se.route||[se.name];for(const ke of se.cells||[])W.set(vr(ke.cell,ve),!!ke.boot)}z(se=>{let ve=!1;const ke={...se};for(const[Re,we]of Object.entries(se))W.has(Re)&&W.get(Re)===we&&(delete ke[Re],ve=!0);return ve?ke:se})},[k,a]);async function Q(){try{const se=await(await Vt("/api/sessions",t)).json();se.error?(p(se.error),h([])):(p(null),h(se.sessions||[]))}catch(W){p(String(W)),h([])}try{const W=await vs(t);F(W.available?W.cells||[]:[]),V(W.available?W.capabilities||[]:[])}catch{F([]),V([])}}N.useEffect(()=>{Q(),Vt("/api/config",t).then(se=>se.json()).then(se=>{S(se.version||""),b({bind:se.bind||"127.0.0.1",port:se.port||""}),R(Rr.test(String(se.instanceId||""))?se.instanceId:"")}).catch(()=>{});const W=setInterval(Q,4e3);return()=>clearInterval(W)},[]);async function ne(){if(!y.port)return;const W=`http://${y.bind}:${y.port}/#token=${t}`;try{await navigator.clipboard.writeText(W)}catch{}}function fe(W,se,ve){const ke=vr(W,se);z(Re=>({...Re,[ke]:!!ve}))}function Se(W,se=[]){const ve=vr(W.cell,se);return Object.prototype.hasOwnProperty.call(G,ve)?G[ve]:!!W.boot}async function Ze(W,se,ve=[]){W.stopPropagation();const ke=vr(se.cell,ve),Re=!Se(se,ve);fe(se.cell,ve,Re),H(we=>new Set(we).add(ke));try{await M_(t,{cell:se.cell,enabled:Re},ve),ve.length||F(we=>we.map(je=>je.cell===se.cell?{...je,boot:Re}:je))}catch(we){z(je=>{const st={...je};return delete st[ke],st}),p(String((we==null?void 0:we.message)||we))}finally{H(we=>{const je=new Set(we);return je.delete(ke),je})}}async function $e(W){if(!X)return;const{cell:se}=X,ve=Array.isArray(X.route)?X.route:[];W.action==="up"?(await Mh(t,{cell:se,boot:!!W.boot,...W.engine?{engine:W.engine}:{},...W.model!==void 0?{model:W.model}:{},...W.permissionPolicy?{permissionPolicy:W.permissionPolicy}:{}},ve),fe(se,ve,!!W.boot)):(await kl(t,{cell:se,boot:!!W.boot},ve),W.boot&&fe(se,ve,!1)),Q()}async function He(W,se=[]){try{await Ih(t,W,se)}catch{return}Q()}async function vt(W,se,ve=[]){try{await B_(t,W,se,ve)}catch{return}Q()}async function Xe(W){if(!(!(W!=null&&W.direct)||M)){E(W.name);try{await zh(t,W.name,W.tunnelStatus==="up"?"down":"up")}catch{}E(null)}}async function St(W){if(!(W!=null&&W.direct))return;const se=window.prompt(g("rename-node-prompt"),W.label||W.name);if(se===null)return;const ve=String(se).trim();if(!jr(ve)){window.alert(g("rename-node-invalid"));return}try{await F_(t,W.name,ve)}catch(ke){window.alert(String((ke==null?void 0:ke.message)||ke))}}const Et=N.useMemo(()=>new Map((u||[]).map(W=>[W.name,W])),[u]),rt=N.useMemo(()=>new Set(k.map(W=>W.tmuxSession)),[k]),ct=N.useMemo(()=>(u||[]).filter(W=>!rt.has(W.name)),[u,rt]),ot=N.useMemo(()=>Q_(k,ct,Et),[k,ct,Et]),ut=$("local"),dt=N.useMemo(()=>Fs(ot,D,ut.filter,fs(O,"local")).filter(W=>ug(W,v)),[ot,D,ut.filter,v,O]),le=pe.reduce((W,se)=>W+(se.cells||[]).length+(se.unmanaged||[]).filter(ve=>!ve.technical).length,0),xe=Fs(ot,D,"all",fs(O,"local")).length+le,ze=ot.filter(W=>W.live).length+pe.reduce((W,se)=>W+Td(se).rawItems.filter(ve=>ve.live).length,0),Ie=(u||[]).filter(W=>W.attached).length+pe.reduce((W,se)=>W+(se.sessions||[]).filter(ve=>ve.attached).length,0),ue=Math.min(Ie,ze),Y=y.port?`${y.bind}:${y.port}`:y.bind;function ie(W,se=null,ve=ot){var _n,bt;const ke=Array.isArray(se==null?void 0:se.route)?se.route:[],Re=ke.join("/"),we=Re||"local",je=ke.length?se==null?void 0:se.instanceId:C,st=(Ye,Gt)=>e({session:Ye,...Re?{node:Re}:{},...Rr.test(String(je||""))?{ownerId:je}:{},...typeof Gt=="string"&&Gt?{cellName:Gt}:{}}),It=q;if(W.type==="cell"){const Ye=W.value,Gt=ke.length?((se==null?void 0:se.sessions)||[]).find(pt=>pt.name===Ye.tmuxSession):Et.get(Ye.tmuxSession),Hn=Ye.degraded?g("cell-degraded"):W.working?W.subtitle:Ye.tmux?g("cell-idle"):g("cell-off"),li=ke.length===0||((se==null?void 0:se.capabilities)||[]).includes(Ye.active?"down":"up"),de=ke.length===0?B.includes("boot"):((se==null?void 0:se.capabilities)||[]).includes("boot"),Ne=Se(Ye,ke),Ke=vr(Ye.cell,ke),Nt=`${g(Ne?"boot-disable":"boot-enable")} ${Ye.cell}`;return c.jsxs("div",{className:"nc-mcard","data-roster-key":W.key,"data-position":we,children:[c.jsx(us,{position:we,itemKey:W.key,label:Ye.cell,canMove:It,onMove:(pt,Wn)=>I(we,pt,Wn,ve),onStep:pt=>T(we,W.key,pt,ve)}),c.jsxs("button",{className:"nc-mcard-main",onClick:()=>Ye.tmux&&st(Ye.tmuxSession,Ye.cell),title:Hn,"aria-label":`${Ye.cell}, ${Hn}`,children:[c.jsx("span",{className:`dot ${Ye.degraded?"warn":Ye.tmux?`on${W.working?" working":""}`:""}`}),c.jsxs("span",{className:"nc-mcard-text",children:[c.jsx("b",{children:Ye.cell}),c.jsx("small",{title:W.subtitle,children:W.subtitle})]})]}),W.activity?c.jsx("span",{className:"nc-rel",children:Nr(W.activity)}):null,W.fresh&&((_n=Gt==null?void 0:Gt.outbox)==null?void 0:_n.count)>0&&c.jsx("span",{className:"nc-badge",title:g("new-files-outbox"),children:Gt.outbox.count}),c.jsx("button",{className:`nc-act pin${D.includes(W.key)?" on":""}`,"aria-label":`${g("pin")} ${Ye.cell}`,title:g("pin"),onClick:()=>P(W.key),children:D.includes(W.key)?"★":"☆"}),de&&c.jsx("button",{className:`nc-act boot${Ne?" on":""}`,disabled:te.has(Ke),onClick:pt=>Ze(pt,Ye,ke),title:Nt,"aria-label":Nt,children:c.jsx(it,{name:"boot",size:16})}),li&&c.jsx("button",{className:`nc-act power${Ye.tmux?" on":""}${Ye.degraded?" warn":""}`,onClick:()=>A(ke.length?{...Ye,boot:Ne,route:ke,availableEngines:(se==null?void 0:se.engines)||[]}:{...Ye,boot:Ne}),title:Ye.active?g("power-off"):g("power-on"),"aria-label":`${Ye.active?g("power-off"):g("power-on")} ${Ye.cell}`,children:c.jsx(it,{name:"power",size:16})})]},W.key)}const Oe=W.value;return c.jsxs("div",{className:"nc-mcard","data-roster-key":W.key,"data-position":we,children:[c.jsx(us,{position:we,itemKey:W.key,label:Oe.name,canMove:It,onMove:(Ye,Gt)=>I(we,Ye,Gt,ve),onStep:Ye=>T(we,W.key,Ye,ve)}),c.jsxs("button",{className:"nc-mcard-main",onClick:()=>st(Oe.name),children:[c.jsx("span",{className:Oe.attached?"dot on":"dot"}),c.jsxs("span",{className:"nc-mcard-text",children:[c.jsx("b",{children:Oe.name}),c.jsx("small",{children:Oe.preview?Oe.preview:Oe.cmd?Oe.cmd:g("windows").replace("{n}",String(Oe.windows||0))})]})]}),W.activity?c.jsx("span",{className:"nc-rel",children:Nr(W.activity)}):null,W.fresh&&((bt=Oe.outbox)==null?void 0:bt.count)>0&&c.jsx("span",{className:"nc-badge",title:g("new-files-outbox"),children:Oe.outbox.count}),c.jsx("button",{className:`nc-act pin${D.includes(W.key)?" on":""}`,"aria-label":`${g("pin")} ${Oe.name}`,title:g("pin"),onClick:()=>P(W.key),children:D.includes(W.key)?"★":"☆"}),c.jsx("button",{className:`nc-act technical${Oe.technical?" on":""}`,title:Oe.technical?g("mark-normal"):g("mark-technical"),"aria-label":`${Oe.technical?g("mark-normal"):g("mark-technical")} ${Oe.name}`,onClick:()=>vt(Oe.name,!Oe.technical,ke),children:"T"}),c.jsx("button",{className:"nc-menu",title:g("terminate"),"aria-label":`${g("terminate")} ${Oe.name}`,onClick:()=>{window.confirm(g("terminate-confirm").replace("{name}",Oe.name))&&He(Oe.name,ke)},children:"⋯"})]},W.key)}return c.jsxs("div",{className:"nc-home",children:[c.jsxs("header",{className:"nc-home-head",children:[c.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",c.jsx("span",{className:"nc-cursor"})]}),c.jsxs("div",{className:"nc-home-sub",children:[g("fleet-tmux")," · ",ze," ",g("sessions"),ue>0&&` · ${ue} attached`]}),c.jsxs("span",{className:"nc-head-actions",children:[c.jsx("button",{className:"nc-refresh",onClick:()=>n("nodes",!1),title:g("settings"),children:c.jsx(it,{name:"gear",size:18})}),c.jsx("button",{className:"nc-refresh",onClick:Q,title:g("refresh"),children:c.jsx(it,{name:"refresh",size:18})})]})]}),c.jsxs("main",{className:"nc-home-scroll",children:[xe>8&&c.jsx("input",{className:"nc-filter",type:"search",placeholder:g("filter-placeholder"),"aria-label":g("filter-placeholder"),value:v,onChange:W=>x(W.target.value)}),f&&c.jsx("div",{className:"nc-err",children:f}),c.jsxs("section",{className:"nc-group","data-position":"local",children:[c.jsx(xg,{label:g("position-local"),count:dt.length,state:ut,dotClass:"on",onToggle:()=>L("local",{open:!ut.open}),onFilter:W=>L("local",{filter:W})}),ut.open&&dt.map(W=>ie(W,null,ot)),ut.open&&u===null&&c.jsx("div",{className:"nc-empty",children:g("loading-fleet")}),ut.open&&u!==null&&dt.length===0&&!f&&c.jsx("div",{className:"nc-empty",children:v?g("no-match").replace("{q}",v):g("no-sessions-short")})]}),pe.map(W=>{const ve=X_(W.health,{passive:"warn"})||(W.status==="up"?"on":W.status==="passive"?"":"warn"),ke=W.health?Rl(W.health):W.status==="up"?"":xr(W),we=(W.route||[W.name]).join("/"),je=$(we),{rawItems:st}=Td(W),It=Fs(st,D,je.filter,fs(O,we)).filter(bt=>ug(bt,v)),Oe=W.direct&&W.health&&W.health.managed!==!1?c.jsx("button",{type:"button",className:`nc-act power${W.tunnelStatus==="up"?" on":""}`,disabled:M===W.name,title:W.tunnelStatus==="up"?g("power-off"):g("power-on"),"aria-label":`${W.tunnelStatus==="up"?g("power-off"):g("power-on")} ${W.label||W.name}`,onClick:()=>Xe(W),children:c.jsx(it,{name:"power",size:15})}):null,_n=c.jsxs("span",{className:"nc-node-actions",children:[c.jsx(us,{scope:"node",position:"nodes",itemKey:he(W),label:W.label||W.name,onMove:(bt,Ye)=>Z(bt,Ye,a),onStep:bt=>ae(he(W),bt,a)}),W.direct&&c.jsx("button",{type:"button",className:"nc-node-rename",title:g("rename-node"),"aria-label":`${g("rename-node")} ${W.label||W.name}`,onClick:()=>St(W),children:"✎"}),Oe]});return c.jsxs("section",{className:"nc-group nc-node-order-wrap","data-position":we,"data-node-order-key":he(W),children:[c.jsx(xg,{label:W.label||W.name,count:It.length,state:je,dotClass:ve,dotTitle:ke,detail:W.status==="up"?"":W.health&&Rl(W.health)||xr(W),onToggle:()=>L(we,{open:!je.open}),onFilter:bt=>L(we,{filter:bt}),onRename:W.direct?()=>St(W):null,action:_n}),W.status==="up"&&je.open&&It.map(bt=>ie(bt,W,st)),W.status==="up"&&je.open&&It.length===0&&c.jsx("div",{className:"nc-empty",children:v?g("no-match").replace("{q}",v):g("no-sessions-short")})]},`nodo-${we}`)}),c.jsxs("footer",{className:"nc-home-foot",onClick:ne,title:g("copy-url"),children:[c.jsxs("span",{className:"nc-home-meta",children:[w&&c.jsxs("span",{className:"nc-home-version",children:["v",w]}),c.jsxs("span",{className:"nc-home-endpoint",children:[Y," · ",g("ssh-only")]})]}),c.jsx("span",{className:"nc-lang",onClick:W=>W.stopPropagation(),children:q_.map((W,se)=>c.jsxs("span",{children:[se>0&&" · ",c.jsx("button",{className:`nc-lang-btn${r===W?" on":""}`,onClick:()=>o(W),title:W,children:W.toUpperCase()})]},W))})]})]}),c.jsx("button",{className:"nc-fab",onClick:()=>n("fleet",!0),title:g("fleet-new-cell"),"aria-label":g("fleet-new-cell"),children:"+"}),X&&c.jsx(El,{cell:X,token:t,route:Array.isArray(X.route)?X.route:[],onConfirm:$e,onClose:()=>A(null)})]})}function xg({label:e,count:t,state:n,dotClass:r="",dotTitle:o="",detail:a="",onToggle:u,onFilter:h,onRename:f=null,action:p=null}){return c.jsxs("div",{className:"nc-mobile-position-head",onContextMenu:f?v=>{v.preventDefault(),f()}:void 0,children:[c.jsxs("button",{type:"button",className:"nc-mobile-position-toggle",onClick:u,"aria-expanded":n.open,"aria-label":`${e} · ${g("node-sessions").replace("{n}",String(t))}`,children:[c.jsx("span",{className:"nc-mobile-chevron","aria-hidden":"true",children:n.open?"⌄":"›"}),c.jsx("span",{className:`dot ${r}`,title:o}),c.jsxs("span",{className:"nc-mobile-position-copy",children:[c.jsx("b",{children:e}),c.jsx("small",{children:a||g("node-sessions").replace("{n}",String(t))})]})]}),c.jsxs("select",{className:"nc-mobile-position-filter",value:n.filter,"aria-label":`${e} · ${g("filter-placeholder")}`,title:g(`view-${n.filter}`),onChange:v=>h(v.target.value),children:[c.jsx("option",{value:"all",children:g("view-all")}),c.jsx("option",{value:"pinned",children:g("view-pinned")}),c.jsx("option",{value:"active",children:g("view-active")}),c.jsx("option",{value:"off",children:g("view-off")}),c.jsx("option",{value:"technical",children:g("view-technical")})]}),p]})}/**
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 ry=Object.defineProperty,C1=Object.getOwnPropertyDescriptor,E1=(e,t)=>{for(var n in t)ry(e,n,{get:t[n],enumerable:!0})},At=(e,t,n,r)=>{for(var o=r>1?void 0:r?C1(t,n):t,a=e.length-1,u;a>=0;a--)(u=e[a])&&(o=(r?u(t,n,o):u(o))||o);return r&&o&&ry(t,n,o),o},Pe=(e,t)=>(n,r)=>t(n,r,e),kg="Terminal input",Id={get:()=>kg,set:e=>kg=e},Cg="Too much output to announce, navigate to rows manually to read",Bd={get:()=>Cg,set:e=>Cg=e};function N1(e){return e.replace(/\r?\n/g,"\r")}function R1(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function j1(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function P1(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");oy(o,t,n,r)}}function oy(e,t,n,r){e=N1(e),e=R1(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function ay(e,t,n){let r=n.getBoundingClientRect(),o=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${o}px`,t.style.top=`${a}px`,t.style.zIndex="1000",t.focus()}function Eg(e,t,n,r,o){ay(e,t,n),o&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function ls(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Hl(e,t=0,n=e.length){let r="";for(let o=t;o<n;++o){let a=e[o];a>65535?(a-=65536,r+=String.fromCharCode((a>>10)+55296)+String.fromCharCode(a%1024+56320)):r+=String.fromCharCode(a)}return r}var L1=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,o=0;if(this._interim){let a=e.charCodeAt(o++);56320<=a&&a<=57343?t[r++]=(this._interim-55296)*1024+a-56320+65536:(t[r++]=this._interim,t[r++]=a),this._interim=0}for(let a=o;a<n;++a){let u=e.charCodeAt(a);if(55296<=u&&u<=56319){if(++a>=n)return this._interim=u,r;let h=e.charCodeAt(a);56320<=h&&h<=57343?t[r++]=(u-55296)*1024+h-56320+65536:(t[r++]=u,t[r++]=h);continue}u!==65279&&(t[r++]=u)}return r}},T1=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,o,a,u,h,f=0,p=0;if(this.interim[0]){let w=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let y=0,b;for(;(b=this.interim[++y]&63)&&y<4;)S<<=6,S|=b;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,R=C-y;for(;p<R;){if(p>=n)return 0;if(b=e[p++],(b&192)!==128){p--,w=!0;break}else this.interim[y++]=b,S<<=6,S|=b&63}w||(C===2?S<128?p--:t[r++]=S:C===3?S<2048||S>=55296&&S<=57343||S===65279||(t[r++]=S):S<65536||S>1114111||(t[r++]=S)),this.interim.fill(0)}let v=n-4,x=p;for(;x<n;){for(;x<v&&!((o=e[x])&128)&&!((a=e[x+1])&128)&&!((u=e[x+2])&128)&&!((h=e[x+3])&128);)t[r++]=o,t[r++]=a,t[r++]=u,t[r++]=h,x+=4;if(o=e[x++],o<128)t[r++]=o;else if((o&224)===192){if(x>=n)return this.interim[0]=o,r;if(a=e[x++],(a&192)!==128){x--;continue}if(f=(o&31)<<6|a&63,f<128){x--;continue}t[r++]=f}else if((o&240)===224){if(x>=n)return this.interim[0]=o,r;if(a=e[x++],(a&192)!==128){x--;continue}if(x>=n)return this.interim[0]=o,this.interim[1]=a,r;if(u=e[x++],(u&192)!==128){x--;continue}if(f=(o&15)<<12|(a&63)<<6|u&63,f<2048||f>=55296&&f<=57343||f===65279)continue;t[r++]=f}else if((o&248)===240){if(x>=n)return this.interim[0]=o,r;if(a=e[x++],(a&192)!==128){x--;continue}if(x>=n)return this.interim[0]=o,this.interim[1]=a,r;if(u=e[x++],(u&192)!==128){x--;continue}if(x>=n)return this.interim[0]=o,this.interim[1]=a,this.interim[2]=u,r;if(h=e[x++],(h&192)!==128){x--;continue}if(f=(o&7)<<18|(a&63)<<12|(u&63)<<6|h&63,f<65536||f>1114111)continue;t[r++]=f}}return r}},ly="",hs=" ",Wo=class cy{constructor(){this.fg=0,this.bg=0,this.extended=new Tl}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 cy;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}},Tl=class uy{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}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 uy(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Zn=class dy extends Wo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Tl,this.combinedData=""}static fromCharData(t){let n=new dy;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ls(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 n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(r-55296)*1024+o-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ng="di$target",Od="di$dependencies",Ou=new Map;function D1(e){return e[Od]||[]}function on(e){if(Ou.has(e))return Ou.get(e);let t=function(n,r,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");M1(t,n,o)};return t._id=e,Ou.set(e,t),t}function M1(e,t,n){t[Ng]===t?t[Od].push({id:e,index:n}):(t[Od]=[{id:e,index:n}],t[Ng]=t)}var xn=on("BufferService"),hy=on("CoreMouseService"),Ks=on("CoreService"),A1=on("CharsetService"),qh=on("InstantiationService"),fy=on("LogService"),kn=on("OptionsService"),py=on("OscLinkService"),I1=on("UnicodeService"),Uo=on("DecorationService"),zd=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var v;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],o=this._optionsService.rawOptions.linkHandler,a=new Zn,u=n.getTrimmedLength(),h=-1,f=-1,p=!1;for(let x=0;x<u;x++)if(!(f===-1&&!n.hasContent(x))){if(n.loadCell(x,a),a.hasExtendedAttrs()&&a.extended.urlId)if(f===-1){f=x,h=a.extended.urlId;continue}else p=a.extended.urlId!==h;else f!==-1&&(p=!0);if(p||f!==-1&&x===u-1){let w=(v=this._oscLinkService.getLinkData(h))==null?void 0:v.uri;if(w){let S={start:{x:f+1,y:e},end:{x:x+(!p&&x===u-1?1:0),y:e}},y=!1;if(!(o!=null&&o.allowNonHttpProtocols))try{let b=new URL(w);["http:","https:"].includes(b.protocol)||(y=!0)}catch{y=!0}y||r.push({text:w,range:S,activate:(b,C)=>o?o.activate(b,C,S):B1(b,C),hover:(b,C)=>{var R;return(R=o==null?void 0:o.hover)==null?void 0:R.call(o,b,C,S)},leave:(b,C)=>{var R;return(R=o==null?void 0:o.leave)==null?void 0:R.call(o,b,C,S)}})}p=!1,a.hasExtendedAttrs()&&a.extended.urlId?(f=x,h=a.extended.urlId):(f=-1,h=-1)}}t(r)}};zd=At([Pe(0,xn),Pe(1,kn),Pe(2,py)],zd);function B1(e,t){if(confirm(`Do you want to navigate to ${t}?
52
+
53
+ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Wl=on("CharSizeService"),Mi=on("CoreBrowserService"),Vh=on("MouseService"),Ai=on("RenderService"),O1=on("SelectionService"),my=on("CharacterJoinerService"),Mr=on("ThemeService"),gy=on("LinkProviderService"),z1=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Rg.isErrorNoTelemetry(e)?new Rg(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)}},F1=new z1;function vl(e){$1(e)||F1.onUnexpectedError(e)}var Fd="Canceled";function $1(e){return e instanceof H1?!0:e instanceof Error&&e.name===Fd&&e.message===Fd}var H1=class extends Error{constructor(){super(Fd),this.name=this.message}};function W1(e){return new Error(`Illegal argument: ${e}`)}var Rg=class $d extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof $d)return t;let n=new $d;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Hd=class vy extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,vy.prototype)}};function In(e,t=0){return e[e.length-(1+t)]}var U1;(e=>{function t(a){return a<0}e.isLessThan=t;function n(a){return a<=0}e.isLessThanOrEqual=n;function r(a){return a>0}e.isGreaterThan=r;function o(a){return a===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(U1||(U1={}));function K1(e,t){let n=this,r=!1,o;return function(){return r||(r=!0,t||(o=e.apply(n,arguments))),o}}var _y;(e=>{function t(B){return B&&typeof B=="object"&&typeof B[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*o(B){yield B}e.single=o;function a(B){return t(B)?B:o(B)}e.wrap=a;function u(B){return B||n}e.from=u;function*h(B){for(let V=B.length-1;V>=0;V--)yield B[V]}e.reverse=h;function f(B){return!B||B[Symbol.iterator]().next().done===!0}e.isEmpty=f;function p(B){return B[Symbol.iterator]().next().value}e.first=p;function v(B,V){let G=0;for(let z of B)if(V(z,G++))return!0;return!1}e.some=v;function x(B,V){for(let G of B)if(V(G))return G}e.find=x;function*w(B,V){for(let G of B)V(G)&&(yield G)}e.filter=w;function*S(B,V){let G=0;for(let z of B)yield V(z,G++)}e.map=S;function*y(B,V){let G=0;for(let z of B)yield*V(z,G++)}e.flatMap=y;function*b(...B){for(let V of B)yield*V}e.concat=b;function C(B,V,G){let z=G;for(let te of B)z=V(z,te);return z}e.reduce=C;function*R(B,V,G=B.length){for(V<0&&(V+=B.length),G<0?G+=B.length:G>B.length&&(G=B.length);V<G;V++)yield B[V]}e.slice=R;function k(B,V=Number.POSITIVE_INFINITY){let G=[];if(V===0)return[G,B];let z=B[Symbol.iterator]();for(let te=0;te<V;te++){let H=z.next();if(H.done)return[G,e.empty()];G.push(H.value)}return[G,{[Symbol.iterator](){return z}}]}e.consume=k;async function F(B){let V=[];for await(let G of B)V.push(G);return Promise.resolve(V)}e.asyncToArray=F})(_y||(_y={}));function Ws(e){if(_y.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}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 q1(...e){return Ct(()=>Ws(e))}function Ct(e){return{dispose:K1(()=>{e()})}}var yy=class wy{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{Ws(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?wy.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)}};yy.DISABLE_DISPOSED_WARNING=!1;var ms=yy,tt=class{constructor(){this._store=new ms,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)}};tt.None=Object.freeze({dispose(){}});var Pr=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}},Di=typeof window=="object"?window:globalThis,Wd=class Ud{constructor(t){this.element=t,this.next=Ud.Undefined,this.prev=Ud.Undefined}};Wd.Undefined=new Wd(void 0);var Lt=Wd,jg=class{constructor(){this._first=Lt.Undefined,this._last=Lt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Lt.Undefined}clear(){let e=this._first;for(;e!==Lt.Undefined;){let t=e.next;e.prev=Lt.Undefined,e.next=Lt.Undefined,e=t}this._first=Lt.Undefined,this._last=Lt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Lt(e);if(this._first===Lt.Undefined)this._first=n,this._last=n;else if(t){let o=this._last;this._last=n,n.prev=o,o.next=n}else{let o=this._first;this._first=n,n.next=o,o.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Lt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Lt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Lt.Undefined&&e.next!==Lt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Lt.Undefined&&e.next===Lt.Undefined?(this._first=Lt.Undefined,this._last=Lt.Undefined):e.next===Lt.Undefined?(this._last=this._last.prev,this._last.next=Lt.Undefined):e.prev===Lt.Undefined&&(this._first=this._first.next,this._first.prev=Lt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Lt.Undefined;)yield e.element,e=e.next}},V1=globalThis.performance&&typeof globalThis.performance.now=="function",Y1=class Sy{static create(t){return new Sy(t)}constructor(t){this._now=V1&&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}},dn;(e=>{e.None=()=>tt.None;function t(M,E){return x(M,()=>{},0,void 0,!0,void 0,E)}e.defer=t;function n(M){return(E,D=null,O)=>{let P=!1,$;return $=M(L=>{if(!P)return $?$.dispose():P=!0,E.call(D,L)},null,O),P&&$.dispose(),$}}e.once=n;function r(M,E,D){return p((O,P=null,$)=>M(L=>O.call(P,E(L)),null,$),D)}e.map=r;function o(M,E,D){return p((O,P=null,$)=>M(L=>{E(L),O.call(P,L)},null,$),D)}e.forEach=o;function a(M,E,D){return p((O,P=null,$)=>M(L=>E(L)&&O.call(P,L),null,$),D)}e.filter=a;function u(M){return M}e.signal=u;function h(...M){return(E,D=null,O)=>{let P=q1(...M.map($=>$(L=>E.call(D,L))));return v(P,O)}}e.any=h;function f(M,E,D,O){let P=D;return r(M,$=>(P=E(P,$),P),O)}e.reduce=f;function p(M,E){let D,O={onWillAddFirstListener(){D=M(P.fire,P)},onDidRemoveLastListener(){D==null||D.dispose()}},P=new Ee(O);return E==null||E.add(P),P.event}function v(M,E){return E instanceof Array?E.push(M):E&&E.add(M),M}function x(M,E,D=100,O=!1,P=!1,$,L){let q,I,T,U=0,Z,ae={leakWarningThreshold:$,onWillAddFirstListener(){q=M(pe=>{U++,I=E(I,pe),O&&!T&&(he.fire(I),I=void 0),Z=()=>{let Q=I;I=void 0,T=void 0,(!O||U>1)&&he.fire(Q),U=0},typeof D=="number"?(clearTimeout(T),T=setTimeout(Z,D)):T===void 0&&(T=0,queueMicrotask(Z))})},onWillRemoveListener(){P&&U>0&&(Z==null||Z())},onDidRemoveLastListener(){Z=void 0,q.dispose()}},he=new Ee(ae);return L==null||L.add(he),he.event}e.debounce=x;function w(M,E=0,D){return e.debounce(M,(O,P)=>O?(O.push(P),O):[P],E,void 0,!0,void 0,D)}e.accumulate=w;function S(M,E=(O,P)=>O===P,D){let O=!0,P;return a(M,$=>{let L=O||!E($,P);return O=!1,P=$,L},D)}e.latch=S;function y(M,E,D){return[e.filter(M,E,D),e.filter(M,O=>!E(O),D)]}e.split=y;function b(M,E=!1,D=[],O){let P=D.slice(),$=M(I=>{P?P.push(I):q.fire(I)});O&&O.add($);let L=()=>{P==null||P.forEach(I=>q.fire(I)),P=null},q=new Ee({onWillAddFirstListener(){$||($=M(I=>q.fire(I)),O&&O.add($))},onDidAddFirstListener(){P&&(E?setTimeout(L):L())},onDidRemoveLastListener(){$&&$.dispose(),$=null}});return O&&O.add(q),q.event}e.buffer=b;function C(M,E){return(D,O,P)=>{let $=E(new k);return M(function(L){let q=$.evaluate(L);q!==R&&D.call(O,q)},void 0,P)}}e.chain=C;let R=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(E){return this.steps.push(E),this}forEach(E){return this.steps.push(D=>(E(D),D)),this}filter(E){return this.steps.push(D=>E(D)?D:R),this}reduce(E,D){let O=D;return this.steps.push(P=>(O=E(O,P),O)),this}latch(E=(D,O)=>D===O){let D=!0,O;return this.steps.push(P=>{let $=D||!E(P,O);return D=!1,O=P,$?P:R}),this}evaluate(E){for(let D of this.steps)if(E=D(E),E===R)break;return E}}function F(M,E,D=O=>O){let O=(...q)=>L.fire(D(...q)),P=()=>M.on(E,O),$=()=>M.removeListener(E,O),L=new Ee({onWillAddFirstListener:P,onDidRemoveLastListener:$});return L.event}e.fromNodeEventEmitter=F;function B(M,E,D=O=>O){let O=(...q)=>L.fire(D(...q)),P=()=>M.addEventListener(E,O),$=()=>M.removeEventListener(E,O),L=new Ee({onWillAddFirstListener:P,onDidRemoveLastListener:$});return L.event}e.fromDOMEventEmitter=B;function V(M){return new Promise(E=>n(M)(E))}e.toPromise=V;function G(M){let E=new Ee;return M.then(D=>{E.fire(D)},()=>{E.fire(void 0)}).finally(()=>{E.dispose()}),E.event}e.fromPromise=G;function z(M,E){return M(D=>E.fire(D))}e.forward=z;function te(M,E,D){return E(D),M(O=>E(O))}e.runAndSubscribe=te;class H{constructor(E,D){this._observable=E,this._counter=0,this._hasChanged=!1;let O={onWillAddFirstListener:()=>{E.addObserver(this)},onDidRemoveLastListener:()=>{E.removeObserver(this)}};this.emitter=new Ee(O),D&&D.add(this.emitter)}beginUpdate(E){this._counter++}handlePossibleChange(E){}handleChange(E,D){this._hasChanged=!0}endUpdate(E){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function X(M,E){return new H(M,E).emitter.event}e.fromObservable=X;function A(M){return(E,D,O)=>{let P=0,$=!1,L={beginUpdate(){P++},endUpdate(){P--,P===0&&(M.reportChanges(),$&&($=!1,E.call(D)))},handlePossibleChange(){},handleChange(){$=!0}};M.addObserver(L),M.reportChanges();let q={dispose(){M.removeObserver(L)}};return O instanceof ms?O.add(q):Array.isArray(O)&&O.push(q),q}}e.fromObservableLight=A})(dn||(dn={}));var Kd=class qd{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${qd._idPool++}`,qd.all.add(this)}start(t){this._stopWatch=new Y1,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}}};Kd.all=new Set,Kd._idPool=0;var G1=Kd,X1=-1,by=class xy{constructor(t,n,r=(xy._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[a,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(a);let f=new Z1(h,a);this._errorHandler(f)}return()=>{let a=this._stacks.get(t.value)||0;this._stacks.set(t.value,a-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,o]of this._stacks)(!t||n<o)&&(t=[r,o],n=o);return t}};by._idPool=1;var J1=by,Q1=class ky{constructor(t){this.value=t}static create(){let t=new Error;return new ky(t.stack??"")}print(){console.warn(this.value.split(`
58
+ `).slice(2).join(`
59
+ `))}},Z1=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},ex=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},tx=0,zu=class{constructor(e){this.value=e,this.id=tx++}},nx=2,ix,Ee=class{constructor(e){var t,n,r,o;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new J1((e==null?void 0:e.onListenerError)??vl,((n=this._options)==null?void 0:n.leakWarningThreshold)??X1):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new G1(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var e,t,n,r;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),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var u,h,f,p,v;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let x=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(x);let w=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],S=new ex(`${x}. HINT: Stack shows most frequent listener (${w[1]}-times)`,w[0]);return(((u=this._options)==null?void 0:u.onListenerError)||vl)(S),tt.None}if(this._disposed)return tt.None;t&&(e=e.bind(t));let r=new zu(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Q1.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof zu?(this._deliveryQueue??(this._deliveryQueue=new sx),this._listeners=[this._listeners,r]):this._listeners.push(r):((f=(h=this._options)==null?void 0:h.onWillAddFirstListener)==null||f.call(h,this),this._listeners=r,(v=(p=this._options)==null?void 0:p.onDidAddFirstListener)==null||v.call(p,this)),this._size++;let a=Ct(()=>{o==null||o(),this._removeListener(r)});return n instanceof ms?n.add(a):Array.isArray(n)&&n.push(a),a}),this._event}_removeListener(e){var o,a,u,h;if((a=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||a.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(h=(u=this._options)==null?void 0:u.onDidRemoveLastListener)==null||h.call(u,this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-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[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*nx<=t.length){let f=0;for(let p=0;p<t.length;p++)t[p]?t[f++]=t[p]:r&&(this._deliveryQueue.end--,f<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=f}}_deliver(e,t){var r;if(!e)return;let n=((r=this._options)==null?void 0:r.onListenerError)||vl;if(!n){e.value(t);return}try{e.value(t)}catch(o){n(o)}}_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,n,r,o;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof zu)this._deliver(this._listeners,e);else{let a=this._deliveryQueue;a.enqueue(this,e,this._listeners.length),this._deliverQueue(a)}(o=this._perfMon)==null||o.stop()}hasListeners(){return this._size>0}},sx=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Vd=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Ee,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Ee,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Vd.INSTANCE=new Vd;var Yh=Vd;function rx(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Yh.INSTANCE.onDidChangeZoomLevel;function ox(e){return Yh.INSTANCE.getZoomFactor(e)}Yh.INSTANCE.onDidChangeFullscreen;var Ar=typeof navigator=="object"?navigator.userAgent:"",Yd=Ar.indexOf("Firefox")>=0,ax=Ar.indexOf("AppleWebKit")>=0,Gh=Ar.indexOf("Chrome")>=0,lx=!Gh&&Ar.indexOf("Safari")>=0;Ar.indexOf("Electron/")>=0;Ar.indexOf("Android")>=0;var Fu=!1;if(typeof Di.matchMedia=="function"){let e=Di.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Di.matchMedia("(display-mode: fullscreen)");Fu=e.matches,rx(Di,e,({matches:n})=>{Fu&&t.matches||(Fu=n)})}var br="en",Gd=!1,Xd=!1,_l=!1,Cy=!1,rl,yl=br,Pg=br,cx,ai,Hs=globalThis,un,P_;typeof Hs.vscode<"u"&&typeof Hs.vscode.process<"u"?un=Hs.vscode.process:typeof process<"u"&&typeof((P_=process==null?void 0:process.versions)==null?void 0:P_.node)=="string"&&(un=process);var L_,ux=typeof((L_=un==null?void 0:un.versions)==null?void 0:L_.electron)=="string",dx=ux&&(un==null?void 0:un.type)==="renderer",T_;if(typeof un=="object"){Gd=un.platform==="win32",Xd=un.platform==="darwin",_l=un.platform==="linux",_l&&un.env.SNAP&&un.env.SNAP_REVISION,un.env.CI||un.env.BUILD_ARTIFACTSTAGINGDIRECTORY,rl=br,yl=br;let e=un.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);rl=t.userLocale,Pg=t.osLocale,yl=t.resolvedLanguage||br,cx=(T_=t.languagePack)==null?void 0:T_.translationsConfigFile}catch{}Cy=!0}else typeof navigator=="object"&&!dx?(ai=navigator.userAgent,Gd=ai.indexOf("Windows")>=0,Xd=ai.indexOf("Macintosh")>=0,(ai.indexOf("Macintosh")>=0||ai.indexOf("iPad")>=0||ai.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_l=ai.indexOf("Linux")>=0,(ai==null?void 0:ai.indexOf("Mobi"))>=0,yl=globalThis._VSCODE_NLS_LANGUAGE||br,rl=navigator.language.toLowerCase(),Pg=rl):console.error("Unable to resolve platform.");var Ey=Gd,Si=Xd,hx=_l,Lg=Cy,xi=ai,ss=yl,fx;(e=>{function t(){return ss}e.value=t;function n(){return ss.length===2?ss==="en":ss.length>=3?ss[0]==="e"&&ss[1]==="n"&&ss[2]==="-":!1}e.isDefaultVariant=n;function r(){return ss==="en"}e.isDefault=r})(fx||(fx={}));var px=typeof Hs.postMessage=="function"&&!Hs.importScripts;(()=>{if(px){let e=[];Hs.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,o=e.length;r<o;r++){let a=e[r];if(a.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),a.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Hs.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var mx=!!(xi&&xi.indexOf("Chrome")>=0);xi&&xi.indexOf("Firefox")>=0;!mx&&xi&&xi.indexOf("Safari")>=0;xi&&xi.indexOf("Edg/")>=0;xi&&xi.indexOf("Android")>=0;var _r=typeof navigator=="object"?navigator:{};Lg||document.queryCommandSupported&&document.queryCommandSupported("copy")||_r&&_r.clipboard&&_r.clipboard.writeText,Lg||_r&&_r.clipboard&&_r.clipboard.readText;var Xh=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}},$u=new Xh,Tg=new Xh,Dg=new Xh,gx=new Array(230),Ny;(e=>{function t(h){return $u.keyCodeToStr(h)}e.toString=t;function n(h){return $u.strToKeyCode(h)}e.fromString=n;function r(h){return Tg.keyCodeToStr(h)}e.toUserSettingsUS=r;function o(h){return Dg.keyCodeToStr(h)}e.toUserSettingsGeneral=o;function a(h){return Tg.strToKeyCode(h)||Dg.strToKeyCode(h)}e.fromUserSettings=a;function u(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return $u.keyCodeToStr(h)}e.toElectronAccelerator=u})(Ny||(Ny={}));var vx=class Ry{constructor(t,n,r,o,a){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=o,this.keyCode=a}equals(t){return t instanceof Ry&&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",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${t}${n}${r}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new _x([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},_x=class{constructor(e){if(e.length===0)throw W1("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;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 yx(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return Ny.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Yd)switch(t){case 59:return 85;case 60:if(hx)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Si)return 57;break}else if(ax&&(Si&&t===93||!Si&&t===92))return 57;return gx[t]||0}var wx=Si?256:2048,Sx=512,bx=1024,xx=Si?2048:256,Mg=class{constructor(e){var n;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=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=yx(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|=wx),this.altKey&&(t|=Sx),this.shiftKey&&(t|=bx),this.metaKey&&(t|=xx),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new vx(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Ag=new WeakMap;function kx(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var Cx=class{static getSameOriginWindowChain(e){let t=Ag.get(e);if(!t){t=[],Ag.set(e,t);let n=e,r;do r=kx(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,o=this.getSameOriginWindowChain(e);for(let a of o){let u=a.window.deref();if(n+=(u==null?void 0:u.scrollY)??0,r+=(u==null?void 0:u.scrollX)??0,u===t||!a.iframeElement)break;let h=a.iframeElement.getBoundingClientRect();n+=h.top,r+=h.left}return{top:n,left:r}}},ol=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 n=Cx.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Ig=class{constructor(e,t=0,n=0){var o;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(Gh){let a=navigator.userAgent.match(/Chrome\/(\d+)/);r=(a?parseInt(a[1]):123)<=122}if(e){let a=e,u=e,h=((o=e.view)==null?void 0:o.devicePixelRatio)||1;if(typeof a.wheelDeltaY<"u")r?this.deltaY=a.wheelDeltaY/(120*h):this.deltaY=a.wheelDeltaY/120;else if(typeof u.VERTICAL_AXIS<"u"&&u.axis===u.VERTICAL_AXIS)this.deltaY=-u.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?Yd&&!Si?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")lx&&Ey?this.deltaX=-(a.wheelDeltaX/120):r?this.deltaX=a.wheelDeltaX/(120*h):this.deltaX=a.wheelDeltaX/120;else if(typeof u.HORIZONTAL_AXIS<"u"&&u.axis===u.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?Yd&&!Si?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},jy=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Ex;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof Nx?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:dn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:jy})})(Ex||(Ex={}));var Nx=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?jy:(this._emitter||(this._emitter=new Ee),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Jh=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 Hd("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Hd("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Rx=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,n=globalThis){if(this.isDisposed)throw new Hd("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Ct(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},jx;(e=>{async function t(r){let o,a=await Promise.all(r.map(u=>u.then(h=>h,h=>{o||(o=h)})));if(typeof o<"u")throw o;return a}e.settled=t;function n(r){return new Promise(async(o,a)=>{try{await r(o,a)}catch(u){a(u)}})}e.withAsyncBody=n})(jx||(jx={}));var Bg=class Jn{static fromArray(t){return new Jn(n=>{n.emitMany(t)})}static fromPromise(t){return new Jn(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Jn(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Jn(async n=>{await Promise.all(t.map(async r=>{for await(let o of r)n.emitOne(o)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Ee,queueMicrotask(async()=>{let r={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(r)),this.resolve()}catch(o){this.reject(o)}finally{r.emitOne=void 0,r.emitMany=void 0,r.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 dn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new Jn(async r=>{for await(let o of t)r.emitOne(n(o))})}map(t){return Jn.map(this,t)}static filter(t,n){return new Jn(async r=>{for await(let o of t)n(o)&&r.emitOne(o)})}filter(t){return Jn.filter(this,t)}static coalesce(t){return Jn.filter(t,n=>!!n)}coalesce(){return Jn.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Jn.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())}};Bg.EMPTY=Bg.fromArray([]);var{getWindow:yi,getWindowId:Px,onDidRegisterWindow:Lx}=(function(){let e=new Map,t={window:Di,disposables:new ms};e.set(Di.vscodeWindowId,t);let n=new Ee,r=new Ee,o=new Ee;function a(u,h){return(typeof u=="number"?e.get(u):void 0)??(h?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:r.event,registerWindow(u){if(e.has(u.vscodeWindowId))return tt.None;let h=new ms,f={window:u,disposables:h.add(new ms)};return e.set(u.vscodeWindowId,f),h.add(Ct(()=>{e.delete(u.vscodeWindowId),r.fire(u)})),h.add(Ve(u,en.BEFORE_UNLOAD,()=>{o.fire(u)})),n.fire(f),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:a,getWindow(u){var p;let h=u;if((p=h==null?void 0:h.ownerDocument)!=null&&p.defaultView)return h.ownerDocument.defaultView.window;let f=u;return f!=null&&f.view?f.view.window:Di},getDocument(u){return yi(u).document}}})(),Tx=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!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 Ve(e,t,n,r){return new Tx(e,t,n,r)}var Og=function(e,t,n,r){return Ve(e,t,n,r)},Qh,Dx=class extends Rx{constructor(e){super(),this.defaultTarget=e&&yi(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},zg=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){vl(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,o=a=>{n.set(a,!1);let u=e.get(a)??[];for(t.set(a,u),e.set(a,[]),r.set(a,!0);u.length>0;)u.sort(zg.sort),u.shift().execute();r.set(a,!1)};Qh=(a,u,h=0)=>{let f=Px(a),p=new zg(u,h),v=e.get(f);return v||(v=[],e.set(f,v)),v.push(p),n.get(f)||(n.set(f,!0),a.requestAnimationFrame(()=>o(f))),p}})();function Mx(e){let t=e.getBoundingClientRect(),n=yi(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var en={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"},Ax=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 n=Ln(t);this._maxWidth!==n&&(this._maxWidth=n,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let n=Ln(t);this._width!==n&&(this._width=n,this.domNode.style.width=this._width)}setHeight(t){let n=Ln(t);this._height!==n&&(this._height=n,this.domNode.style.height=this._height)}setTop(t){let n=Ln(t);this._top!==n&&(this._top=n,this.domNode.style.top=this._top)}setLeft(t){let n=Ln(t);this._left!==n&&(this._left=n,this.domNode.style.left=this._left)}setBottom(t){let n=Ln(t);this._bottom!==n&&(this._bottom=n,this.domNode.style.bottom=this._bottom)}setRight(t){let n=Ln(t);this._right!==n&&(this._right=n,this.domNode.style.right=this._right)}setPaddingTop(t){let n=Ln(t);this._paddingTop!==n&&(this._paddingTop=n,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let n=Ln(t);this._paddingLeft!==n&&(this._paddingLeft=n,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let n=Ln(t);this._paddingBottom!==n&&(this._paddingBottom=n,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let n=Ln(t);this._paddingRight!==n&&(this._paddingRight=n,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 n=Ln(t);this._fontSize!==n&&(this._fontSize=n,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 n=Ln(t);this._lineHeight!==n&&(this._lineHeight=n,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let n=Ln(t);this._letterSpacing!==n&&(this._letterSpacing=n,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,n){this.domNode.classList.toggle(t,n),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,n){this.domNode.setAttribute(t,n)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function Ln(e){return typeof e=="number"?`${e}px`:e}function Ao(e){return new Ax(e)}var Py=class{constructor(){this._hooks=new ms,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 n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=o;let a=e;try{e.setPointerCapture(t),this._hooks.add(Ct(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=yi(e)}this._hooks.add(Ve(a,en.POINTER_MOVE,u=>{if(u.buttons!==n){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(Ve(a,en.POINTER_UP,u=>this.stopMonitoring(!0)))}};function Ix(e,t,n){let r=null,o=null;if(typeof n.value=="function"?(r="value",o=n.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",o=n.get),!o)throw new Error("not supported");let a=`$memoize$${t}`;n[r]=function(...u){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,u)}),this[a]}}var vi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(vi||(vi={}));var Po=class vn extends tt{constructor(){super(),this.dispatched=!1,this.targets=new jg,this.ignoreTargets=new jg,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(dn.runAndSubscribe(Lx,({window:t,disposables:n})=>{n.add(Ve(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(Ve(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(Ve(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Di,disposables:this._store}))}static addTarget(t){if(!vn.isTouchDevice())return tt.None;vn.INSTANCE||(vn.INSTANCE=new vn);let n=vn.INSTANCE.targets.push(t);return Ct(n)}static ignoreTarget(t){if(!vn.isTouchDevice())return tt.None;vn.INSTANCE||(vn.INSTANCE=new vn);let n=vn.INSTANCE.ignoreTargets.push(t);return Ct(n)}static isTouchDevice(){return"ontouchstart"in Di||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,o=t.targetTouches.length;r<o;r++){let a=t.targetTouches.item(r);this.activeTouches[a.identifier]={id:a.identifier,initialTarget:a.target,initialTimeStamp:n,initialPageX:a.pageX,initialPageY:a.pageY,rollingTimestamps:[n],rollingPageX:[a.pageX],rollingPageY:[a.pageY]};let u=this.newGestureEvent(vi.Start,a.target);u.pageX=a.pageX,u.pageY=a.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),o=Object.keys(this.activeTouches).length;for(let a=0,u=n.changedTouches.length;a<u;a++){let h=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let f=this.activeTouches[h.identifier],p=Date.now()-f.initialTimeStamp;if(p<vn.HOLD_DELAY&&Math.abs(f.initialPageX-In(f.rollingPageX))<30&&Math.abs(f.initialPageY-In(f.rollingPageY))<30){let v=this.newGestureEvent(vi.Tap,f.initialTarget);v.pageX=In(f.rollingPageX),v.pageY=In(f.rollingPageY),this.dispatchEvent(v)}else if(p>=vn.HOLD_DELAY&&Math.abs(f.initialPageX-In(f.rollingPageX))<30&&Math.abs(f.initialPageY-In(f.rollingPageY))<30){let v=this.newGestureEvent(vi.Contextmenu,f.initialTarget);v.pageX=In(f.rollingPageX),v.pageY=In(f.rollingPageY),this.dispatchEvent(v)}else if(o===1){let v=In(f.rollingPageX),x=In(f.rollingPageY),w=In(f.rollingTimestamps)-f.rollingTimestamps[0],S=v-f.rollingPageX[0],y=x-f.rollingPageY[0],b=[...this.targets].filter(C=>f.initialTarget instanceof Node&&C.contains(f.initialTarget));this.inertia(t,b,r,Math.abs(S)/w,S>0?1:-1,v,Math.abs(y)/w,y>0?1:-1,x)}this.dispatchEvent(this.newGestureEvent(vi.End,f.initialTarget)),delete this.activeTouches[h.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===vi.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>vn.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===vi.Change||t.type===vi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let o=0,a=t.initialTarget;for(;a&&a!==r;)o++,a=a.parentElement;n.push([o,r])}n.sort((r,o)=>r[0]-o[0]);for(let[r,o]of n)o.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,o,a,u,h,f,p){this.handle=Qh(t,()=>{let v=Date.now(),x=v-r,w=0,S=0,y=!0;o+=vn.SCROLL_FRICTION*x,h+=vn.SCROLL_FRICTION*x,o>0&&(y=!1,w=a*o*x),h>0&&(y=!1,S=f*h*x);let b=this.newGestureEvent(vi.Change);b.translationX=w,b.translationY=S,n.forEach(C=>C.dispatchEvent(b)),y||this.inertia(t,n,v,o,a,u+w,h,f,p+S)})}onTouchMove(t){let n=Date.now();for(let r=0,o=t.changedTouches.length;r<o;r++){let a=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("end of an UNKNOWN touch",a);continue}let u=this.activeTouches[a.identifier],h=this.newGestureEvent(vi.Change,u.initialTarget);h.translationX=a.pageX-In(u.rollingPageX),h.translationY=a.pageY-In(u.rollingPageY),h.pageX=a.pageX,h.pageY=a.pageY,this.dispatchEvent(h),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(a.pageX),u.rollingPageY.push(a.pageY),u.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Po.SCROLL_FRICTION=-.005,Po.HOLD_DELAY=700,Po.CLEAR_TAP_COUNT_TIME=400,At([Ix],Po,"isTouchDevice",1);var Bx=Po,Zh=class extends tt{onclick(e,t){this._register(Ve(e,en.CLICK,n=>t(new ol(yi(e),n))))}onmousedown(e,t){this._register(Ve(e,en.MOUSE_DOWN,n=>t(new ol(yi(e),n))))}onmouseover(e,t){this._register(Ve(e,en.MOUSE_OVER,n=>t(new ol(yi(e),n))))}onmouseleave(e,t){this._register(Ve(e,en.MOUSE_LEAVE,n=>t(new ol(yi(e),n))))}onkeydown(e,t){this._register(Ve(e,en.KEY_DOWN,n=>t(new Mg(n))))}onkeyup(e,t){this._register(Ve(e,en.KEY_UP,n=>t(new Mg(n))))}oninput(e,t){this._register(Ve(e,en.INPUT,t))}onblur(e,t){this._register(Ve(e,en.BLUR,t))}onfocus(e,t){this._register(Ve(e,en.FOCUS,t))}onchange(e,t){this._register(Ve(e,en.CHANGE,t))}ignoreGesture(e){return Bx.ignoreTarget(e)}},Fg=11,Ox=class extends Zh{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=Fg+"px",this.domNode.style.height=Fg+"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 Py),this._register(Og(this.bgDomNode,en.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Og(this.domNode,en.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Dx),this._pointerdownScheduleRepeatTimer=this._register(new Jh)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,yi(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},zx=class Jd{constructor(t,n,r,o,a,u,h){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,o=o|0,a=a|0,u=u|0,h=h|0),this.rawScrollLeft=o,this.rawScrollTop=h,n<0&&(n=0),o+n>r&&(o=r-n),o<0&&(o=0),a<0&&(a=0),h+a>u&&(h=u-a),h<0&&(h=0),this.width=n,this.scrollWidth=r,this.scrollLeft=o,this.height=a,this.scrollHeight=u,this.scrollTop=h}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,n){return new Jd(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Jd(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,n){let r=this.width!==t.width,o=this.scrollWidth!==t.scrollWidth,a=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,h=this.scrollHeight!==t.scrollHeight,f=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,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:r,scrollWidthChanged:o,scrollLeftChanged:a,heightChanged:u,scrollHeightChanged:h,scrollTopChanged:f}}},Fx=class extends tt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Ee),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new zx(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 r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.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 n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new Hg(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=Hg.start(this._state,n,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 n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},$g=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Hu(e,t){let n=t-e;return function(r){return e+n*Wx(r)}}function $x(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Hg=class Qd{constructor(t,n,r,o){this.from=t,this.to=n,this.duration=o,this.startTime=r,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,n,r){if(Math.abs(t-n)>2.5*r){let o,a;return t<n?(o=t+.75*r,a=n-.75*r):(o=t-.75*r,a=n+.75*r),$x(Hu(t,o),Hu(a,n),.33)}return Hu(t,n)}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 n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),o=this.scrollTop(n);return new $g(r,o,!1)}return new $g(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return Qd.start(t,n,r)}static start(t,n,r){r=r+10;let o=Date.now()-10;return new Qd(t,n,o,r)}};function Hx(e){return Math.pow(e,3)}function Wx(e){return 1-Hx(1-e)}var Ux=class extends tt{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Jh)}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":"")))}},Kx=140,Ly=class extends Zh{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 Ux(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Py),this._shouldRender=!0,this.domNode=Ao(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(Ve(this.domNode.domNode,en.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Ox(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Ao(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ve(this.slider.domNode,en.POINTER_DOWN,o=>{o.button===0&&(o.preventDefault(),this._sliderPointerDown(o))})),this.onclick(this.slider.domNode,o=>{o.leftButton&&o.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,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);n<=o&&o<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let o=Mx(this.domNode.domNode);t=e.pageX-o.left,n=e.pageY-o.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>{let a=this._sliderOrthogonalPointerPosition(o),u=Math.abs(a-n);if(Ey&&u>Kx){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let h=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(h))},()=>{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()}},Ty=class Zd{constructor(t,n,r,o,a,u){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=o,this._scrollSize=a,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Zd(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,o,a){let u=Math.max(0,r-t),h=Math.max(0,u-2*n),f=o>0&&o>r;if(!f)return{computedAvailableSize:Math.round(u),computedIsNeeded:f,computedSliderSize:Math.round(h),computedSliderRatio:0,computedSliderPosition:0};let p=Math.round(Math.max(20,Math.floor(r*h/o))),v=(h-p)/(o-r),x=a*v;return{computedAvailableSize:Math.round(u),computedIsNeeded:f,computedSliderSize:Math.round(p),computedSliderRatio:v,computedSliderPosition:Math.round(x)}}_refreshComputedValues(){let t=Zd._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 n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},qx=class extends Ly{constructor(e,t,n){let r=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Ty(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,o.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}},Vx=class extends Ly{constructor(e,t,n){let r=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Ty(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,o.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}},Yx=500,Wg=50,Gx=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},eh=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,n=0,r=1,o=this._rear;do{let a=o===this._front?t:Math.pow(2,-r);if(t-=a,n+=this._memory[o].score*a,o===this._front)break;o=(this._capacity+o-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(Gh){let n=yi(t.browserEvent),r=ox(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let o=null,a=new Gx(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=a,this._front=0,this._rear=0):(o=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,o)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let o=Math.abs(t.deltaX),a=Math.abs(t.deltaY),u=Math.abs(n.deltaX),h=Math.abs(n.deltaY),f=Math.max(Math.min(o,u),1),p=Math.max(Math.min(a,h),1),v=Math.max(o,u),x=Math.max(a,h);v%f===0&&x%p===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};eh.INSTANCE=new eh;var Xx=eh,Jx=class extends Zh{constructor(e,t,n){super(),this._onScroll=this._register(new Ee),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Ee),this.onWillScroll=this._onWillScroll.event,this._options=Zx(t),this._scrollable=n,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let r={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Vx(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new qx(this._scrollable,this._options,r)),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=Ao(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ao(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ao(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,o=>this._onMouseOver(o)),this.onmouseleave(this._listenOnDomNode,o=>this._onMouseLeave(o)),this._hideTimeout=this._register(new Jh),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ws(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,Si&&(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 Ig(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ws(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new Ig(n))};this._mouseWheelToDispose.push(Ve(this._listenOnDomNode,en.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var o;if((o=e.browserEvent)!=null&&o.defaultPrevented)return;let t=Xx.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,u=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&u+a===0?u=a=0:Math.abs(a)>=Math.abs(u)?u=0:a=0),this._options.flipAxes&&([a,u]=[u,a]);let h=!Si&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||h)&&!u&&(u=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(u=u*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let f=this._scrollable.getFutureScrollPosition(),p={};if(a){let v=Wg*a,x=f.scrollTop-(v<0?Math.floor(v):Math.ceil(v));this._verticalScrollbar.writeScrollPosition(p,x)}if(u){let v=Wg*u,x=f.scrollLeft-(v<0?Math.floor(v):Math.ceil(v));this._horizontalScrollbar.writeScrollPosition(p,x)}p=this._scrollable.validateScrollPosition(p),(f.scrollLeft!==p.scrollLeft||f.scrollTop!==p.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(p):this._scrollable.setScrollPositionNow(p),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(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,n=e.scrollLeft>0,r=n?" left":"",o=t?" top":"",a=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${o}${r}`)}}_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(),Yx)}},Qx=class extends Jx{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Zx(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,Si&&(t.className+=" mac"),t}var th=class extends tt{constructor(e,t,n,r,o,a,u,h){super(),this._bufferService=n,this._optionsService=u,this._renderService=h,this._onRequestScrollLines=this._register(new Ee),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new Fx({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>Qh(r.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Qx(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},f)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(p=>{this._scrollableElement.updateOptions({handleMouseWheel:!(p&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(dn.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ct(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ct(()=>this._styleElement.remove())),this._register(dn.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),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};th=At([Pe(2,xn),Pe(3,Mi),Pe(4,hy),Pe(5,Mr),Pe(6,kn),Pe(7,Ai)],th);var nh=class extends tt{constructor(e,t,n,r,o){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=o,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(Ct(()=>{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 r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.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 n=e.options.x??0;return n&&n>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 n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*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()}};nh=At([Pe(1,xn),Pe(2,Mi),Pe(3,Uo),Pe(4,Ai)],nh);var ek=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,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},pi={full:0,left:0,center:0,right:0},rs={full:0,left:0,center:0,right:0},wo={full:0,left:0,center:0,right:0},Dl=class extends tt{constructor(e,t,n,r,o,a,u,h){var p;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=o,this._optionsService=a,this._themeService=u,this._coreBrowserService=h,this._colorZoneStore=new ek,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(Ct(()=>{var v;return(v=this._canvas)==null?void 0:v.remove()}));let f=this._canvas.getContext("2d");if(f)this._ctx=f;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);rs.full=this._canvas.width,rs.left=e,rs.center=t,rs.right=e,this._refreshDrawHeightConstants(),wo.full=1,wo.left=1,wo.center=1+rs.left,wo.right=1+rs.left+rs.center}_refreshDrawHeightConstants(){pi.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);pi.left=t,pi.center=t,pi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pi.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(wo[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-pi[e.position||"full"]/2),rs[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+pi[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}))}};Dl=At([Pe(2,xn),Pe(3,Uo),Pe(4,Ai),Pe(5,kn),Pe(6,Mr),Pe(7,Mi)],Dl);var ge;(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=""))(ge||(ge={}));var wl;(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="Ÿ"))(wl||(wl={}));var Dy;(e=>e.ST=`${ge.ESC}\\`)(Dy||(Dy={}));var ih=class{constructor(e,t,n,r,o,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=o,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 n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!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,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ge.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),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=r+"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)}}};ih=At([Pe(2,xn),Pe(3,kn),Pe(4,Ks),Pe(5,Ai)],ih);var tn=0,nn=0,sn=0,Mt=0,Ug={css:"#00000000",rgba:0},Ht;(e=>{function t(o,a,u,h){return h!==void 0?`#${Ts(o)}${Ts(a)}${Ts(u)}${Ts(h)}`:`#${Ts(o)}${Ts(a)}${Ts(u)}`}e.toCss=t;function n(o,a,u,h=255){return(o<<24|a<<16|u<<8|h)>>>0}e.toRgba=n;function r(o,a,u,h){return{css:e.toCss(o,a,u,h),rgba:e.toRgba(o,a,u,h)}}e.toColor=r})(Ht||(Ht={}));var wt;(e=>{function t(f,p){if(Mt=(p.rgba&255)/255,Mt===1)return{css:p.css,rgba:p.rgba};let v=p.rgba>>24&255,x=p.rgba>>16&255,w=p.rgba>>8&255,S=f.rgba>>24&255,y=f.rgba>>16&255,b=f.rgba>>8&255;tn=S+Math.round((v-S)*Mt),nn=y+Math.round((x-y)*Mt),sn=b+Math.round((w-b)*Mt);let C=Ht.toCss(tn,nn,sn),R=Ht.toRgba(tn,nn,sn);return{css:C,rgba:R}}e.blend=t;function n(f){return(f.rgba&255)===255}e.isOpaque=n;function r(f,p,v){let x=Sl.ensureContrastRatio(f.rgba,p.rgba,v);if(x)return Ht.toColor(x>>24&255,x>>16&255,x>>8&255)}e.ensureContrastRatio=r;function o(f){let p=(f.rgba|255)>>>0;return[tn,nn,sn]=Sl.toChannels(p),{css:Ht.toCss(tn,nn,sn),rgba:p}}e.opaque=o;function a(f,p){return Mt=Math.round(p*255),[tn,nn,sn]=Sl.toChannels(f.rgba),{css:Ht.toCss(tn,nn,sn,Mt),rgba:Ht.toRgba(tn,nn,sn,Mt)}}e.opacity=a;function u(f,p){return Mt=f.rgba&255,a(f,Mt*p/255)}e.multiplyOpacity=u;function h(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=h})(wt||(wt={}));var Tt;(e=>{let t,n;try{let o=document.createElement("canvas");o.width=1,o.height=1;let a=o.getContext("2d",{willReadFrequently:!0});a&&(t=a,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return tn=parseInt(o.slice(1,2).repeat(2),16),nn=parseInt(o.slice(2,3).repeat(2),16),sn=parseInt(o.slice(3,4).repeat(2),16),Ht.toColor(tn,nn,sn);case 5:return tn=parseInt(o.slice(1,2).repeat(2),16),nn=parseInt(o.slice(2,3).repeat(2),16),sn=parseInt(o.slice(3,4).repeat(2),16),Mt=parseInt(o.slice(4,5).repeat(2),16),Ht.toColor(tn,nn,sn,Mt);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let a=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return tn=parseInt(a[1]),nn=parseInt(a[2]),sn=parseInt(a[3]),Mt=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),Ht.toColor(tn,nn,sn,Mt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[tn,nn,sn,Mt]=t.getImageData(0,0,1,1).data,Mt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ht.toRgba(tn,nn,sn,Mt),css:o}}e.toColor=r})(Tt||(Tt={}));var Sn;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,o,a){let u=r/255,h=o/255,f=a/255,p=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),v=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),x=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return p*.2126+v*.7152+x*.0722}e.relativeLuminance2=n})(Sn||(Sn={}));var Sl;(e=>{function t(u,h){if(Mt=(h&255)/255,Mt===1)return h;let f=h>>24&255,p=h>>16&255,v=h>>8&255,x=u>>24&255,w=u>>16&255,S=u>>8&255;return tn=x+Math.round((f-x)*Mt),nn=w+Math.round((p-w)*Mt),sn=S+Math.round((v-S)*Mt),Ht.toRgba(tn,nn,sn)}e.blend=t;function n(u,h,f){let p=Sn.relativeLuminance(u>>8),v=Sn.relativeLuminance(h>>8);if(Ti(p,v)<f){if(v<p){let S=r(u,h,f),y=Ti(p,Sn.relativeLuminance(S>>8));if(y<f){let b=o(u,h,f),C=Ti(p,Sn.relativeLuminance(b>>8));return y>C?S:b}return S}let x=o(u,h,f),w=Ti(p,Sn.relativeLuminance(x>>8));if(w<f){let S=r(u,h,f),y=Ti(p,Sn.relativeLuminance(S>>8));return w>y?x:S}return x}}e.ensureContrastRatio=n;function r(u,h,f){let p=u>>24&255,v=u>>16&255,x=u>>8&255,w=h>>24&255,S=h>>16&255,y=h>>8&255,b=Ti(Sn.relativeLuminance2(w,S,y),Sn.relativeLuminance2(p,v,x));for(;b<f&&(w>0||S>0||y>0);)w-=Math.max(0,Math.ceil(w*.1)),S-=Math.max(0,Math.ceil(S*.1)),y-=Math.max(0,Math.ceil(y*.1)),b=Ti(Sn.relativeLuminance2(w,S,y),Sn.relativeLuminance2(p,v,x));return(w<<24|S<<16|y<<8|255)>>>0}e.reduceLuminance=r;function o(u,h,f){let p=u>>24&255,v=u>>16&255,x=u>>8&255,w=h>>24&255,S=h>>16&255,y=h>>8&255,b=Ti(Sn.relativeLuminance2(w,S,y),Sn.relativeLuminance2(p,v,x));for(;b<f&&(w<255||S<255||y<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Ti(Sn.relativeLuminance2(w,S,y),Sn.relativeLuminance2(p,v,x));return(w<<24|S<<16|y<<8|255)>>>0}e.increaseLuminance=o;function a(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=a})(Sl||(Sl={}));function Ts(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ti(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var tk=class extends Wo{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}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()]}},Ml=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Zn}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 n=[],r=t.translateToString(!0),o=0,a=0,u=0,h=t.getFg(0),f=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!==h||this._workCell.bg!==f){if(p-o>1){let v=this._getJoinedRanges(r,u,a,t,o);for(let x=0;x<v.length;x++)n.push(v[x])}o=p,u=a,h=this._workCell.fg,f=this._workCell.bg}a+=this._workCell.getChars().length||hs.length}if(this._bufferService.cols-o>1){let p=this._getJoinedRanges(r,u,a,t,o);for(let v=0;v<p.length;v++)n.push(p[v])}return n}_getJoinedRanges(e,t,n,r,o){let a=e.substring(t,n),u=[];try{u=this._characterJoiners[0].handler(a)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let f=this._characterJoiners[h].handler(a);for(let p=0;p<f.length;p++)Ml._mergeRanges(u,f[p])}catch(f){console.error(f)}return this._stringRangesToCellRanges(u,r,o),u}_stringRangesToCellRanges(e,t,n){let r=0,o=!1,a=0,u=e[r];if(u){for(let h=n;h<this._bufferService.cols;h++){let f=t.getWidth(h),p=t.getString(h).length||hs.length;if(f!==0){if(!o&&u[0]<=a&&(u[0]=h,o=!0),u[1]<=a){if(u[1]=h,u=e[++r],!u)break;u[0]<=a?(u[0]=h,o=!0):o=!1}a+=p}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(n){if(t[1]<=o[0])return e[r-1][1]=t[1],e;if(t[1]<=o[1])return e[r-1][1]=Math.max(t[1],o[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=o[0])return e.splice(r,0,t),e;if(t[1]<=o[1])return o[0]=Math.min(t[0],o[0]),e;t[0]<o[1]&&(o[0]=Math.min(t[0],o[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Ml=At([Pe(0,xn)],Ml);function nk(e){return 57508<=e&&e<=57558}function ik(e){return 9472<=e&&e<=9631}function sk(e){return nk(e)||ik(e)}function rk(){return{css:{canvas:al(),cell:al()},device:{canvas:al(),cell:al(),char:{width:0,height:0,left:0,top:0}}}}function al(){return{width:0,height:0}}var sh=class{constructor(e,t,n,r,o,a,u){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=o,this._decorationService=a,this._themeService=u,this._workCell=new Zn,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,o,a,u,h,f,p,v){let x=[],w=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,y=e.getNoBgTrimmedLength();n&&y<a+1&&(y=a+1);let b,C=0,R="",k=0,F=0,B=0,V=0,G=!1,z=0,te=!1,H=0,X=0,A=[],M=p!==-1&&v!==-1;for(let E=0;E<y;E++){e.loadCell(E,this._workCell);let D=this._workCell.getWidth();if(D===0)continue;let O=!1,P=E>=X,$=E,L=this._workCell;if(w.length>0&&E===w[0][0]&&P){let He=w.shift(),vt=this._isCellInSelection(He[0],t);for(k=He[0]+1;k<He[1];k++)P&&(P=vt===this._isCellInSelection(k,t));P&&(P=!n||a<He[0]||a>=He[1]),P?(O=!0,L=new tk(this._workCell,e.translateToString(!0,He[0],He[1]),He[1]-He[0]),$=He[1]-1,D=L.getWidth()):X=He[1]}let q=this._isCellInSelection(E,t),I=n&&E===a,T=M&&E>=p&&E<=v,U=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,He=>{U=!0});let Z=L.getChars()||hs;if(Z===" "&&(L.isUnderline()||L.isOverline())&&(Z=" "),H=D*h-f.get(Z,L.isBold(),L.isItalic()),!b)b=this._document.createElement("span");else if(C&&(q&&te||!q&&!te&&L.bg===F)&&(q&&te&&S.selectionForeground||L.fg===B)&&L.extended.ext===V&&T===G&&H===z&&!I&&!O&&!U&&P){L.isInvisible()?R+=hs:R+=Z,C++;continue}else C&&(b.textContent=R),b=this._document.createElement("span"),C=0,R="";if(F=L.bg,B=L.fg,V=L.extended.ext,G=T,z=H,te=q,O&&a>=E&&a<=$&&(a=E),!this._coreService.isCursorHidden&&I&&this._coreService.isCursorInitialized){if(A.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&A.push("xterm-cursor-blink"),A.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":A.push("xterm-cursor-outline");break;case"block":A.push("xterm-cursor-block");break;case"bar":A.push("xterm-cursor-bar");break;case"underline":A.push("xterm-cursor-underline");break}}if(L.isBold()&&A.push("xterm-bold"),L.isItalic()&&A.push("xterm-italic"),L.isDim()&&A.push("xterm-dim"),L.isInvisible()?R=hs:R=L.getChars()||hs,L.isUnderline()&&(A.push(`xterm-underline-${L.extended.underlineStyle}`),R===" "&&(R=" "),!L.isUnderlineColorDefault()))if(L.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${Wo.toColorRGB(L.getUnderlineColor()).join(",")})`;else{let He=L.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&L.isBold()&&He<8&&(He+=8),b.style.textDecorationColor=S.ansi[He].css}L.isOverline()&&(A.push("xterm-overline"),R===" "&&(R=" ")),L.isStrikethrough()&&A.push("xterm-strikethrough"),T&&(b.style.textDecoration="underline");let ae=L.getFgColor(),he=L.getFgColorMode(),pe=L.getBgColor(),Q=L.getBgColorMode(),ne=!!L.isInverse();if(ne){let He=ae;ae=pe,pe=He;let vt=he;he=Q,Q=vt}let fe,Se,Ze=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,He=>{He.options.layer!=="top"&&Ze||(He.backgroundColorRGB&&(Q=50331648,pe=He.backgroundColorRGB.rgba>>8&16777215,fe=He.backgroundColorRGB),He.foregroundColorRGB&&(he=50331648,ae=He.foregroundColorRGB.rgba>>8&16777215,Se=He.foregroundColorRGB),Ze=He.options.layer==="top")}),!Ze&&q&&(fe=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,pe=fe.rgba>>8&16777215,Q=50331648,Ze=!0,S.selectionForeground&&(he=50331648,ae=S.selectionForeground.rgba>>8&16777215,Se=S.selectionForeground)),Ze&&A.push("xterm-decoration-top");let $e;switch(Q){case 16777216:case 33554432:$e=S.ansi[pe],A.push(`xterm-bg-${pe}`);break;case 50331648:$e=Ht.toColor(pe>>16,pe>>8&255,pe&255),this._addStyle(b,`background-color:#${Kg((pe>>>0).toString(16),"0",6)}`);break;case 0:default:ne?($e=S.foreground,A.push("xterm-bg-257")):$e=S.background}switch(fe||L.isDim()&&(fe=wt.multiplyOpacity($e,.5)),he){case 16777216:case 33554432:L.isBold()&&ae<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ae+=8),this._applyMinimumContrast(b,$e,S.ansi[ae],L,fe,void 0)||A.push(`xterm-fg-${ae}`);break;case 50331648:let He=Ht.toColor(ae>>16&255,ae>>8&255,ae&255);this._applyMinimumContrast(b,$e,He,L,fe,Se)||this._addStyle(b,`color:#${Kg(ae.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(b,$e,S.foreground,L,fe,Se)||ne&&A.push("xterm-fg-257")}A.length&&(b.className=A.join(" "),A.length=0),!I&&!O&&!U&&P?C++:b.textContent=R,H!==this.defaultSpacing&&(b.style.letterSpacing=`${H}px`),x.push(b),E=$}return b&&C&&(b.textContent=R),x}_applyMinimumContrast(e,t,n,r,o,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||sk(r.getCode()))return!1;let u=this._getContrastCache(r),h;if(!o&&!a&&(h=u.getColor(t.rgba,n.rgba)),h===void 0){let f=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);h=wt.ensureContrastRatio(o||t,a||n,f),u.setColor((o||t).rgba,(a||n).rgba,h??null)}return h?(this._addStyle(e,`color:${h.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 n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};sh=At([Pe(1,my),Pe(2,kn),Pe(3,Mi),Pe(4,Ks),Pe(5,Uo),Pe(6,Mr)],sh);function Kg(e,t,n){for(;e.length<n;)e=t+e;return e}var ok=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 n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.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=[n,r,o,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(o),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,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let u=this._measure(e,0);return u>0&&(this._flat[r]=u),u}let o=e;t&&(o+="B"),n&&(o+="I");let a=this._holey.get(o);if(a===void 0){let u=0;t&&(u|=1),n&&(u|=2),a=this._measure(e,u),a>0&&this._holey.set(o,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},ak=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,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let o=e.buffers.active.ydisp,a=t[1]-o,u=n[1]-o,h=Math.max(a,0),f=Math.min(u,e.rows-1);if(h>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=u,this.viewportCappedStartRow=h,this.viewportCappedEndRow=f,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function lk(){return new ak}var Wu="xterm-dom-renderer-owner-",Xn="xterm-rows",ll="xterm-fg-",qg="xterm-bg-",So="xterm-focus",cl="xterm-selection",ck=1,rh=class extends tt{constructor(e,t,n,r,o,a,u,h,f,p,v,x,w,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=o,this._helperContainer=a,this._linkifier2=u,this._charSizeService=f,this._optionsService=p,this._bufferService=v,this._coreService=x,this._coreBrowserService=w,this._themeService=S,this._terminalClass=ck++,this._rowElements=[],this._selectionRenderModel=lk(),this.onRequestRedraw=this._register(new Ee).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Xn),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(cl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=rk(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(y=>this._injectCss(y))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(sh,document),this._element.classList.add(Wu+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(y=>this._handleLinkHover(y))),this._register(this._linkifier2.onHideLinkUnderline(y=>this._handleLinkLeave(y))),this._register(Ct(()=>{this._element.classList.remove(Wu+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new ok(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 n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Xn} 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} .${Xn} { 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} .${Xn} .xterm-dim { color: ${wt.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 n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Xn}.${So} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Xn}.${So} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Xn}.${So} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${Xn} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Xn} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Xn} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Xn} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Xn} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${cl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${cl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${cl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,u]of e.ansi.entries())t+=`${this._terminalSelector} .${ll}${a} { color: ${u.css}; }${this._terminalSelector} .${ll}${a}.xterm-dim { color: ${wt.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${qg}${a} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${ll}257 { color: ${wt.opaque(e.background).css}; }${this._terminalSelector} .${ll}257.xterm-dim { color: ${wt.multiplyOpacity(wt.opaque(e.background),.5).css}; }${this._terminalSelector} .${qg}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 n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(So),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(So),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(n){let f=e[0]>t[0];h.appendChild(this._createSelectionElement(a,f?t[0]:e[0],f?e[0]:t[0],u-a+1))}else{let f=r===a?e[0]:0,p=a===o?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(a,f,p));let v=u-a-1;if(h.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,v)),a!==u){let x=o===u?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(u,0,x))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,t,n,r=1){let o=this._document.createElement("div"),a=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(n-t);return a+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-a),o.style.height=`${r*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${a}px`,o.style.width=`${u}px`,o}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 n=this._bufferService.buffer,r=n.ybase+n.y,o=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=e;f<=t;f++){let p=f+n.ydisp,v=this._rowElements[f],x=n.lines.get(p);if(!v||!x)break;v.replaceChildren(...this._rowFactory.createRow(x,p,p===r,u,h,o,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Wu}${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,n,r,o,a){n<0&&(e=0),r<0&&(t=0);let u=this._bufferService.rows-1;n=Math.max(Math.min(n,u),0),r=Math.max(Math.min(r,u),0),o=Math.min(o,this._bufferService.cols);let h=this._bufferService.buffer,f=h.ybase+h.y,p=Math.min(h.x,o-1),v=this._optionsService.rawOptions.cursorBlink,x=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=n;S<=r;++S){let y=S+h.ydisp,b=this._rowElements[S],C=h.lines.get(y);if(!b||!C)break;b.replaceChildren(...this._rowFactory.createRow(C,y,y===f,x,w,p,v,this.dimensions.css.cell.width,this._widthCache,a?S===n?e:0:-1,a?(S===r?t:o)-1:-1))}}};rh=At([Pe(7,qh),Pe(8,Wl),Pe(9,kn),Pe(10,xn),Pe(11,Ks),Pe(12,Mi),Pe(13,Mr)],rh);var oh=class extends tt{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Ee),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new dk(this._optionsService))}catch{this._measureStrategy=this._register(new uk(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())}};oh=At([Pe(2,kn)],oh);var My=class extends tt{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)}},uk=class extends My{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},dk=class extends My{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}},hk=class extends tt{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new fk(this._window)),this._onDprChange=this._register(new Ee),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Ee),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(dn.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ve(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ve(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}},fk=class extends tt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Pr),this._onDprChange=this._register(new Ee),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ct(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ve(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)}},pk=class extends tt{constructor(){super(),this.linkProviders=[],this._register(Ct(()=>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 ef(e,t,n){let r=n.getBoundingClientRect(),o=e.getComputedStyle(n),a=parseInt(o.getPropertyValue("padding-left")),u=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-r.left-a,t.clientY-r.top-u]}function mk(e,t,n,r,o,a,u,h,f){if(!a)return;let p=ef(e,t,n);if(p)return p[0]=Math.ceil((p[0]+(f?u/2:0))/u),p[1]=Math.ceil(p[1]/h),p[0]=Math.min(Math.max(p[0],1),r+(f?1:0)),p[1]=Math.min(Math.max(p[1],1),o),p}var ah=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,o){return mk(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,t){let n=ef(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};ah=At([Pe(0,Ai),Pe(1,Wl)],ah);var gk=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,n){this._rowCount=n,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=[]}},Ay={};E1(Ay,{getSafariVersion:()=>_k,isChromeOS:()=>zy,isFirefox:()=>Iy,isIpad:()=>yk,isIphone:()=>wk,isLegacyEdge:()=>vk,isLinux:()=>tf,isMac:()=>Al,isNode:()=>Ul,isSafari:()=>By,isWindows:()=>Oy});var Ul=typeof process<"u"&&"title"in process,Ko=Ul?"node":navigator.userAgent,qo=Ul?"node":navigator.platform,Iy=Ko.includes("Firefox"),vk=Ko.includes("Edge"),By=/^((?!chrome|android).)*safari/i.test(Ko);function _k(){if(!By)return 0;let e=Ko.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Al=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(qo),yk=qo==="iPad",wk=qo==="iPhone",Oy=["Windows","Win16","Win32","WinCE"].includes(qo),tf=qo.indexOf("Linux")>=0,zy=/\bCrOS\b/.test(Ko),Fy=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,n=0,r=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),o=e.timeRemaining(),n*1.5>o){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=o}this.clear()}},Sk=class extends Fy{_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())}}},bk=class extends Fy{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Il=!Ul&&"requestIdleCallback"in window?bk:Sk,xk=class{constructor(){this._queue=new Il}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},lh=class extends tt{constructor(e,t,n,r,o,a,u,h,f){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=o,this._coreBrowserService=h,this._renderer=this._register(new Pr),this._pausedResizeTask=new xk,this._observerDisposable=this._register(new Pr),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 Ee),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Ee),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Ee),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Ee),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new gk((p,v)=>this._renderRows(p,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new kk(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ct(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.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(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(f.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 n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Ct(()=>n.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,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(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 n;return(n=this._renderer.value)==null?void 0:n.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,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};lh=At([Pe(2,kn),Pe(3,Wl),Pe(4,Ks),Pe(5,Uo),Pe(6,xn),Pe(7,Mi),Pe(8,Mr)],lh);var kk=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,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 Ck(e,t,n,r){let o=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return Rk(o,a,e,t,n,r)+Kl(a,t,n,r)+jk(o,a,e,t,n,r);let u;if(a===t)return u=o>e?"D":"C",Oo(Math.abs(o-e),Bo(u,r));u=a>t?"D":"C";let h=Math.abs(a-t),f=Nk(a>t?e:o,n)+(h-1)*n.cols+1+Ek(a>t?o:e);return Oo(f,Bo(u,r))}function Ek(e,t){return e-1}function Nk(e,t){return t.cols-e}function Rk(e,t,n,r,o,a){return Kl(t,r,o,a).length===0?"":Oo(Hy(e,t,e,t-Us(t,o),!1,o).length,Bo("D",a))}function Kl(e,t,n,r){let o=e-Us(e,n),a=t-Us(t,n),u=Math.abs(o-a)-Pk(e,t,n);return Oo(u,Bo($y(e,t),r))}function jk(e,t,n,r,o,a){let u;Kl(t,r,o,a).length>0?u=r-Us(r,o):u=t;let h=r,f=Lk(e,t,n,r,o,a);return Oo(Hy(e,u,n,h,f==="C",o).length,Bo(f,a))}function Pk(e,t,n){var u;let r=0,o=e-Us(e,n),a=t-Us(t,n);for(let h=0;h<Math.abs(o-a);h++){let f=$y(e,t)==="A"?-1:1;(u=n.buffer.lines.get(o+f*h))!=null&&u.isWrapped&&r++}return r}function Us(e,t){let n=0,r=t.buffer.lines.get(e),o=r==null?void 0:r.isWrapped;for(;o&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),o=r==null?void 0:r.isWrapped;return n}function Lk(e,t,n,r,o,a){let u;return Kl(n,r,o,a).length>0?u=r-Us(r,o):u=t,e<n&&u<=r||e>=n&&u<r?"C":"D"}function $y(e,t){return e>t?"A":"B"}function Hy(e,t,n,r,o,a){let u=e,h=t,f="";for(;(u!==n||h!==r)&&h>=0&&h<a.buffer.lines.length;)u+=o?1:-1,o&&u>a.cols-1?(f+=a.buffer.translateBufferLineToString(h,!1,e,u),u=0,e=0,h++):!o&&u<0&&(f+=a.buffer.translateBufferLineToString(h,!1,0,e+1),u=a.cols-1,e=u,h--);return f+a.buffer.translateBufferLineToString(h,!1,e,u)}function Bo(e,t){let n=t?"O":"[";return ge.ESC+n+e}function Oo(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var Tk=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 Vg(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 Uu=50,Dk=15,Mk=50,Ak=500,Ik=" ",Bk=new RegExp(Ik,"g"),ch=class extends tt{constructor(e,t,n,r,o,a,u,h,f){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=o,this._mouseService=a,this._optionsService=u,this._renderService=h,this._coreBrowserService=f,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Zn,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Ee),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Ee),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Ee),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Ee),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 Tk(this._bufferService),this._activeSelectionMode=0,this._register(Ct(()=>{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 n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let o=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let u=e[1];u<=t[1];u++){let h=n.translateBufferLineToString(u,!0,o,a);r.push(h)}}else{let o=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],o));for(let a=e[1]+1;a<=t[1]-1;a++){let u=n.lines.get(a),h=n.translateBufferLineToString(a,!0);u!=null&&u.isWrapped?r[r.length-1]+=h:r.push(h)}if(e[1]!==t[1]){let a=n.lines.get(t[1]),u=n.translateBufferLineToString(t[1],!0,0,t[0]);a&&a.isWrapped?r[r.length-1]+=u:r.push(u)}}return r.map(o=>o.replace(Bk," ")).join(Oy?`\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())),tf&&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),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var o,a;let n=(a=(o=this._linkifier.currentLink)==null?void 0:o.link)==null?void 0:a.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Vg(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,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=ef(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Uu),Uu),t/=Uu,t/Math.abs(t)+Math.round(t*(Dk-1)))}shouldForceSelection(e){return Al?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(),Mk)}_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&&!(Al&&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 n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.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<Ak&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=Ck(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);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,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let o=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:o>1&&t!==r&&(n+=o-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,a=o.lines.get(e[1]);if(!a)return;let u=o.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(a,e[0]),f=h,p=e[0]-h,v=0,x=0,w=0,S=0;if(u.charAt(h)===" "){for(;h>0&&u.charAt(h-1)===" ";)h--;for(;f<u.length&&u.charAt(f+1)===" ";)f++}else{let C=e[0],R=e[0];a.getWidth(C)===0&&(v++,C--),a.getWidth(R)===2&&(x++,R++);let k=a.getString(R).length;for(k>1&&(S+=k-1,f+=k-1);C>0&&h>0&&!this._isCharWordSeparator(a.loadCell(C-1,this._workCell));){a.loadCell(C-1,this._workCell);let F=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,C--):F>1&&(w+=F-1,h-=F-1),h--,C--}for(;R<a.length&&f+1<u.length&&!this._isCharWordSeparator(a.loadCell(R+1,this._workCell));){a.loadCell(R+1,this._workCell);let F=this._workCell.getChars().length;this._workCell.getWidth()===2?(x++,R++):F>1&&(S+=F-1,f+=F-1),f++,R++}}f++;let y=h+p-v+w,b=Math.min(this._bufferService.cols,f-h+v+x-w-S);if(!(!t&&u.slice(h,f).trim()==="")){if(n&&y===0&&a.getCodePoint(0)!==32){let C=o.lines.get(e[1]-1);if(C&&a.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let R=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(R){let k=this._bufferService.cols-R.start;y-=k,b+=k}}}if(r&&y+b===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let C=o.lines.get(e[1]+1);if(C!=null&&C.isWrapped&&C.getCodePoint(0)!==32){let R=this._getWordAt([0,e[1]+1],!1,!1,!0);R&&(b+=R.length)}}return{start:y,length:b}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={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=Vg(n,this._bufferService.cols)}};ch=At([Pe(3,xn),Pe(4,Ks),Pe(5,Vh),Pe(6,kn),Pe(7,Ai),Pe(8,Mi)],ch);var Yg=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Gg=class{constructor(){this._color=new Yg,this._css=new Yg}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Kt=Object.freeze((()=>{let e=[Tt.toColor("#2e3436"),Tt.toColor("#cc0000"),Tt.toColor("#4e9a06"),Tt.toColor("#c4a000"),Tt.toColor("#3465a4"),Tt.toColor("#75507b"),Tt.toColor("#06989a"),Tt.toColor("#d3d7cf"),Tt.toColor("#555753"),Tt.toColor("#ef2929"),Tt.toColor("#8ae234"),Tt.toColor("#fce94f"),Tt.toColor("#729fcf"),Tt.toColor("#ad7fa8"),Tt.toColor("#34e2e2"),Tt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],o=t[n/6%6|0],a=t[n%6];e.push({css:Ht.toCss(r,o,a),rgba:Ht.toRgba(r,o,a)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Ht.toCss(r,r,r),rgba:Ht.toRgba(r,r,r)})}return e})()),As=Tt.toColor("#ffffff"),Lo=Tt.toColor("#000000"),Xg=Tt.toColor("#ffffff"),Jg=Lo,bo={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Ok=As,uh=class extends tt{constructor(e){super(),this._optionsService=e,this._contrastCache=new Gg,this._halfContrastCache=new Gg,this._onChangeColors=this._register(new Ee),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:As,background:Lo,cursor:Xg,cursorAccent:Jg,selectionForeground:void 0,selectionBackgroundTransparent:bo,selectionBackgroundOpaque:wt.blend(Lo,bo),selectionInactiveBackgroundTransparent:bo,selectionInactiveBackgroundOpaque:wt.blend(Lo,bo),scrollbarSliderBackground:wt.opacity(As,.2),scrollbarSliderHoverBackground:wt.opacity(As,.4),scrollbarSliderActiveBackground:wt.opacity(As,.5),overviewRulerBorder:As,ansi:Kt.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=ft(e.foreground,As),t.background=ft(e.background,Lo),t.cursor=wt.blend(t.background,ft(e.cursor,Xg)),t.cursorAccent=wt.blend(t.background,ft(e.cursorAccent,Jg)),t.selectionBackgroundTransparent=ft(e.selectionBackground,bo),t.selectionBackgroundOpaque=wt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ft(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=wt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ft(e.selectionForeground,Ug):void 0,t.selectionForeground===Ug&&(t.selectionForeground=void 0),wt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=wt.opacity(t.selectionBackgroundTransparent,.3)),wt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=wt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ft(e.scrollbarSliderBackground,wt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ft(e.scrollbarSliderHoverBackground,wt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ft(e.scrollbarSliderActiveBackground,wt.opacity(t.foreground,.5)),t.overviewRulerBorder=ft(e.overviewRulerBorder,Ok),t.ansi=Kt.slice(),t.ansi[0]=ft(e.black,Kt[0]),t.ansi[1]=ft(e.red,Kt[1]),t.ansi[2]=ft(e.green,Kt[2]),t.ansi[3]=ft(e.yellow,Kt[3]),t.ansi[4]=ft(e.blue,Kt[4]),t.ansi[5]=ft(e.magenta,Kt[5]),t.ansi[6]=ft(e.cyan,Kt[6]),t.ansi[7]=ft(e.white,Kt[7]),t.ansi[8]=ft(e.brightBlack,Kt[8]),t.ansi[9]=ft(e.brightRed,Kt[9]),t.ansi[10]=ft(e.brightGreen,Kt[10]),t.ansi[11]=ft(e.brightYellow,Kt[11]),t.ansi[12]=ft(e.brightBlue,Kt[12]),t.ansi[13]=ft(e.brightMagenta,Kt[13]),t.ansi[14]=ft(e.brightCyan,Kt[14]),t.ansi[15]=ft(e.brightWhite,Kt[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=ft(e.extendedAnsi[r],Kt[r+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()}}};uh=At([Pe(0,kn)],uh);function ft(e,t){if(e!==void 0)try{return Tt.toColor(e)}catch{}return t}var zk=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Fk=class{constructor(){this._services=new zk,this._services.set(qh,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=D1(e).sort((a,u)=>a.index-u.index),r=[];for(let a of n){let u=this._services.get(a.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);r.push(u)}let o=n.length>0?n[0].index:t.length;if(t.length!==o)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},$k={trace:0,debug:1,info:2,warn:3,error:4,off:5},Hk="xterm.js: ",dh=class extends tt{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=$k[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":Hk)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};dh=At([Pe(0,kn)],dh);var Qg=class extends tt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Ee),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Ee),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Ee),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 n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];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,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let o=t-1;o>=0;o--)this.set(e+o+n,this.get(e+o));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},et=3,$t=Object.freeze(new Wo),ul=0,Ku=2,To=class Wy{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*et);let o=n||Zn.fromCharData([0,ly,1,0]);for(let a=0;a<t;++a)this.setCell(a,o);this.length=t}get(t){let n=this._data[t*et+0],r=n&2097151;return[this._data[t*et+1],n&2097152?this._combined[t]:r?ls(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*et+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*et+0]=t|2097152|n[2]<<22):this._data[t*et+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*et+0]>>22}hasWidth(t){return this._data[t*et+0]&12582912}getFg(t){return this._data[t*et+1]}getBg(t){return this._data[t*et+2]}hasContent(t){return this._data[t*et+0]&4194303}getCodePoint(t){let n=this._data[t*et+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*et+0]&2097152}getString(t){let n=this._data[t*et+0];return n&2097152?this._combined[t]:n&2097151?ls(n&2097151):""}isProtected(t){return this._data[t*et+2]&536870912}loadCell(t,n){return ul=t*et,n.content=this._data[ul+0],n.fg=this._data[ul+1],n.bg=this._data[ul+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*et+0]=n.content,this._data[t*et+1]=n.fg,this._data[t*et+2]=n.bg}setCellFromCodepoint(t,n,r,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*et+0]=n|r<<22,this._data[t*et+1]=o.fg,this._data[t*et+2]=o.bg}addCodepointToCell(t,n,r){let o=this._data[t*et+0];o&2097152?this._combined[t]+=ls(n):o&2097151?(this._combined[t]=ls(o&2097151)+ls(n),o&=-2097152,o|=2097152):o=n|1<<22,r&&(o&=-12582913,o|=r<<22),this._data[t*et+0]=o}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let o=new Zn;for(let a=this.length-t-n-1;a>=0;--a)this.setCell(t+n+a,this.loadCell(t+a,o));for(let a=0;a<n;++a)this.setCell(t+a,r)}else for(let o=t;o<this.length;++o)this.setCell(o,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let o=new Zn;for(let a=0;a<this.length-t-n;++a)this.setCell(t+a,this.loadCell(t+n+a,o));for(let a=this.length-n;a<this.length;++a)this.setCell(a,r)}else for(let o=t;o<this.length;++o)this.setCell(o,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,o=!1){if(o){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*Ku<this._data.buffer.byteLength;let r=t*et;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let o=new Uint32Array(r);o.set(this._data),this._data=o}for(let o=this.length;o<t;++o)this.setCell(o,n)}else{this._data=this._data.subarray(0,r);let o=Object.keys(this._combined);for(let u=0;u<o.length;u++){let h=parseInt(o[u],10);h>=t&&delete this._combined[h]}let a=Object.keys(this._extendedAttrs);for(let u=0;u<a.length;u++){let h=parseInt(a[u],10);h>=t&&delete this._extendedAttrs[h]}}return this.length=t,r*4*Ku<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Ku<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,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 n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new Wy(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*et+0]&4194303)return t+(this._data[t*et+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*et+0]&4194303||this._data[t*et+2]&50331648)return t+(this._data[t*et+0]>>22);return 0}copyCellsFrom(t,n,r,o,a){let u=t._data;if(a)for(let f=o-1;f>=0;f--){for(let p=0;p<et;p++)this._data[(r+f)*et+p]=u[(n+f)*et+p];u[(n+f)*et+2]&268435456&&(this._extendedAttrs[r+f]=t._extendedAttrs[n+f])}else for(let f=0;f<o;f++){for(let p=0;p<et;p++)this._data[(r+f)*et+p]=u[(n+f)*et+p];u[(n+f)*et+2]&268435456&&(this._extendedAttrs[r+f]=t._extendedAttrs[n+f])}let h=Object.keys(t._combined);for(let f=0;f<h.length;f++){let p=parseInt(h[f],10);p>=n&&(this._combined[p-n+r]=t._combined[p])}}translateToString(t,n,r,o){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),o&&(o.length=0);let a="";for(;n<r;){let u=this._data[n*et+0],h=u&2097151,f=u&2097152?this._combined[n]:h?ls(h):hs;if(a+=f,o)for(let p=0;p<f.length;++p)o.push(n);n+=u>>22||1}return o&&o.push(n),a}};function Wk(e,t,n,r,o,a){let u=[];for(let h=0;h<e.length-1;h++){let f=h,p=e.get(++f);if(!p.isWrapped)continue;let v=[e.get(h)];for(;f<e.length&&p.isWrapped;)v.push(p),p=e.get(++f);if(!a&&r>=h&&r<f){h+=v.length-1;continue}let x=0,w=zo(v,x,t),S=1,y=0;for(;S<v.length;){let C=zo(v,S,t),R=C-y,k=n-w,F=Math.min(R,k);v[x].copyCellsFrom(v[S],y,w,F,!1),w+=F,w===n&&(x++,w=0),y+=F,y===C&&(S++,y=0),w===0&&x!==0&&v[x-1].getWidth(n-1)===2&&(v[x].copyCellsFrom(v[x-1],n-1,w++,1,!1),v[x-1].setCell(n-1,o))}v[x].replaceCells(w,n,o);let b=0;for(let C=v.length-1;C>0&&(C>x||v[C].getTrimmedLength()===0);C--)b++;b>0&&(u.push(h+v.length-b),u.push(b)),h+=v.length-1}return u}function Uk(e,t){let n=[],r=0,o=t[r],a=0;for(let u=0;u<e.length;u++)if(o===u){let h=t[++r];e.onDeleteEmitter.fire({index:u-a,amount:h}),u+=h-1,a+=h,o=t[++r]}else n.push(u);return{layout:n,countRemoved:a}}function Kk(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function qk(e,t,n){let r=[],o=e.map((f,p)=>zo(e,p,t)).reduce((f,p)=>f+p),a=0,u=0,h=0;for(;h<o;){if(o-h<n){r.push(o-h);break}a+=n;let f=zo(e,u,t);a>f&&(a-=f,u++);let p=e[u].getWidth(a-1)===2;p&&a--;let v=p?n-1:n;r.push(v),h+=v}return r}function zo(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,o=e[t+1].getWidth(0)===2;return r&&o?n-1:n}var Uy=class Ky{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Ky._nextId++,this._onDispose=this.register(new Ee),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ws(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Uy._nextId=1;var Vk=Uy,Yt={},Is=Yt.B;Yt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Yt.A={"#":"£"};Yt.B=void 0;Yt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Yt.C=Yt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Yt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Yt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Yt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Yt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Yt.E=Yt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Yt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Yt.H=Yt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Yt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Zg=4294967295,ev=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=$t.clone(),this.savedCharset=Is,this.markers=[],this._nullCell=Zn.fromCharData([0,ly,1,0]),this._whitespaceCell=Zn.fromCharData([0,hs,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Il,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Qg(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 Tl),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 Tl),this._whitespaceCell}getBlankLine(e,t){return new To(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>Zg?Zg:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=$t);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 Qg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell($t),r=0,o=this._getCorrectBufferLength(t);if(o>this.lines.maxLength&&(this.lines.maxLength=o),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)r+=+this.lines.get(u).resize(e,n);let a=0;if(this._rows<t)for(let u=this._rows;u<t;u++)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 To(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new To(e,n)));else for(let u=this._rows;u>t;u--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(o<this.lines.maxLength){let u=this.lines.length-o;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=o}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++)r+=+this.lines.get(a).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.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 n=this._optionsService.rawOptions.reflowCursorLine,r=Wk(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell($t),n);if(r.length>0){let o=Uk(this.lines,r);Kk(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell($t),o=n;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new To(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell($t),o=[],a=0;for(let u=this.lines.length-1;u>=0;u--){let h=this.lines.get(u);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;let f=[h];for(;h.isWrapped&&u>0;)h=this.lines.get(--u),f.unshift(h);if(!n){let F=this.ybase+this.y;if(F>=u&&F<u+f.length)continue}let p=f[f.length-1].getTrimmedLength(),v=qk(f,this._cols,e),x=v.length-f.length,w;this.ybase===0&&this.y!==this.lines.length-1?w=Math.max(0,this.y-this.lines.maxLength+x):w=Math.max(0,this.lines.length-this.lines.maxLength+x);let S=[];for(let F=0;F<x;F++){let B=this.getBlankLine($t,!0);S.push(B)}S.length>0&&(o.push({start:u+f.length+a,newLines:S}),a+=S.length),f.push(...S);let y=v.length-1,b=v[y];b===0&&(y--,b=v[y]);let C=f.length-x-1,R=p;for(;C>=0;){let F=Math.min(R,b);if(f[y]===void 0)break;if(f[y].copyCellsFrom(f[C],R-F,b-F,F,!0),b-=F,b===0&&(y--,b=v[y]),R-=F,R===0){C--;let B=Math.max(C,0);R=zo(f,B,this._cols)}}for(let F=0;F<f.length;F++)v[F]<e&&f[F].setCell(v[F],r);let k=x-w;for(;k-- >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+x,this.ybase+t-1)}if(o.length>0){let u=[],h=[];for(let b=0;b<this.lines.length;b++)h.push(this.lines.get(b));let f=this.lines.length,p=f-1,v=0,x=o[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let w=0;for(let b=Math.min(this.lines.maxLength-1,f+a-1);b>=0;b--)if(x&&x.start>p+w){for(let C=x.newLines.length-1;C>=0;C--)this.lines.set(b--,x.newLines[C]);b++,u.push({index:p+1,amount:x.newLines.length}),w+=x.newLines.length,x=o[++v]}else this.lines.set(b,h[p--]);let S=0;for(let b=u.length-1;b>=0;b--)u[b].index+=S,this.lines.onInsertEmitter.fire(u[b]),S+=u[b].amount;let y=Math.max(0,f+a-this.lines.maxLength);y>0&&this.lines.onTrimEmitter.fire(y)}}translateBufferLineToString(e,t,n=0,r){let o=this.lines.get(e);return o?o.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}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 Vk(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Yk=class extends tt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Ee),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 ev(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new ev(!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)}},qy=2,Vy=1,hh=class extends tt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Ee),this.onResize=this._onResize.event,this._onScroll=this._register(new Ee),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,qy),this.rows=Math.max(e.rawOptions.rows||0,Vy),this.buffers=this._register(new Yk(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let o=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let u=n.lines.isFull;a===n.lines.length-1?u?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),u?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let u=a-o+1;n.lines.shiftElements(o+1,u-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};hh=At([Pe(0,kn)],hh);var yr={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:Al,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Gk=["normal","bold","100","200","300","400","500","600","700","800","900"],Xk=class extends tt{constructor(e){super(),this._onOptionChange=this._register(new Ee),this.onOptionChange=this._onOptionChange.event;let t={...yr};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ct(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in yr))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in yr))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=yr[e]),!Jk(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=yr[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=Gk.includes(t)?t:yr[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 Jk(e){return e==="block"||e==="underline"||e==="bar"}function Do(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Do(e[r],t-1);return n}var tv=Object.freeze({insertMode:!1}),nv=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),fh=class extends tt{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Ee),this.onData=this._onData.event,this._onUserInput=this._register(new Ee),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Ee),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Ee),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Do(tv),this.decPrivateModes=Do(nv)}reset(){this.modes=Do(tv),this.decPrivateModes=Do(nv)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.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))}};fh=At([Pe(0,xn),Pe(1,fy),Pe(2,kn)],fh);var iv={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 qu(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Vu=String.fromCharCode,sv={DEFAULT:e=>{let t=[qu(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Vu(t[0])}${Vu(t[1])}${Vu(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${qu(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${qu(e,!0)};${e.x};${e.y}${t}`}},ph=class extends tt{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Ee),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(iv))this.addProtocol(r,iv[r]);for(let r of Object.keys(sv))this.addEncoding(r,sv[r]);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,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=r+0,Math.abs(e.deltaY)<50&&(o*=.3),this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_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,n){if(n){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)}};ph=At([Pe(0,xn),Pe(1,Ks),Pe(2,kn)],ph);var Yu=[[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]],Qk=[[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]],qt;function Zk(e,t){let n=0,r=t.length-1,o;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(o=n+r>>1,e>t[o][1])n=o+1;else if(e<t[o][0])r=o-1;else return!0;return!1}var eC=class{constructor(){if(this.version="6",!qt){qt=new Uint8Array(65536),qt.fill(1),qt[0]=0,qt.fill(0,1,32),qt.fill(0,127,160),qt.fill(2,4352,4448),qt[9001]=2,qt[9002]=2,qt.fill(2,11904,42192),qt[12351]=1,qt.fill(2,44032,55204),qt.fill(2,63744,64256),qt.fill(2,65040,65050),qt.fill(2,65072,65136),qt.fill(2,65280,65377),qt.fill(2,65504,65511);for(let e=0;e<Yu.length;++e)qt.fill(0,Yu[e][0],Yu[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?qt[e]:Zk(e,Qk)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let o=zs.extractWidth(t);o===0?r=!1:o>n&&(n=o)}return zs.createPropertyValue(0,n,r)}},zs=class bl{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Ee,this.onChange=this._onChange.event;let t=new eC;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,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?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 n=0,r=0,o=t.length;for(let a=0;a<o;++a){let u=t.charCodeAt(a);if(55296<=u&&u<=56319){if(++a>=o)return n+this.wcwidth(u);let p=t.charCodeAt(a);56320<=p&&p<=57343?u=(u-55296)*1024+p-56320+65536:n+=this.wcwidth(p)}let h=this.charProperties(u,r),f=bl.extractWidth(h);bl.extractShouldJoin(h)&&(f-=bl.extractWidth(r)),n+=f,r=h}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},tC=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 rv(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var xo=2147483647,nC=256,Yy=class mh{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>nC)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new mh;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let o=t[r];if(Array.isArray(o))for(let a=0;a<o.length;++a)n.addSubParam(o[a]);else n.addParam(o)}return n}clone(){let t=new mh(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 n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,o))}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>xo?xo: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>xo?xo:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-r>0&&(t[n]=this._subParams.slice(r,o))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,o=r[n-1];r[n-1]=~o?Math.min(o*10+t,xo):t}},ko=[],iC=class{constructor(){this._state=0,this._active=ko,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 n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=ko}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=ko,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ko,!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,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Hl(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}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 n=!1,r=this._active.length-1,o=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=ko,this._id=-1,this._state=0}}},Bn=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Hl(e,t,n),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(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},Co=[],sC=class{constructor(){this._handlers=Object.create(null),this._active=Co,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Co}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=Co,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Co,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Hl(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,o=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Co,this._ident=0}},Mo=new Yy;Mo.addParam(0);var ov=class{constructor(e){this._handler=e,this._data="",this._params=Mo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Mo,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Hl(e,t,n),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(n=>(this._params=Mo,this._data="",this._hitLimit=!1,n));return this._params=Mo,this._data="",this._hitLimit=!1,t}},rC=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let o=0;o<e.length;o++)this.table[t<<8|e[o]]=n<<4|r}},Qn=160,oC=(function(){let e=new rC(4095),t=Array.apply(null,Array(256)).map((h,f)=>f),n=(h,f)=>t.slice(h,f),r=n(32,127),o=n(0,24);o.push(25),o.push.apply(o,n(28,32));let a=n(0,14),u;e.setDefault(1,0),e.addMany(r,0,2,0);for(u in a)e.addMany([24,26,153,154],u,3,0),e.addMany(n(128,144),u,3,0),e.addMany(n(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(o,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Qn,0,2,0),e.add(Qn,8,5,8),e.add(Qn,6,0,6),e.add(Qn,11,0,11),e.add(Qn,13,13,13),e})(),aC=class extends tt{constructor(e=oC){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 Yy,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},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(Ct(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new iC),this._dcsParser=this._register(new sC),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>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 o=0;o<e.intermediates.length;++o){let a=e.intermediates.charCodeAt(o);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}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 n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let o=r.indexOf(t);o!==-1&&r.splice(o,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 n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let o=r.indexOf(t);o!==-1&&r.splice(o,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,n,r,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=o}parse(e,t,n){let r=0,o=0,a=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,f=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&f>-1){for(;f>=0&&(u=h[f](this._params),u!==!0);f--)if(u instanceof Promise)return this._parseStack.handlerPos=f,u}this._parseStack.handlers=[];break;case 4:if(n===!1&&f>-1){for(;f>=0&&(u=h[f](),u!==!0);f--)if(u instanceof Promise)return this._parseStack.handlerPos=f,u}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(r!==24&&r!==26,n),u)return u;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],u=this._oscParser.end(r!==24&&r!==26,n),u)return u;r===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 h=a;h<t;++h){switch(r=e[h],o=this._transitions.table[this.currentState<<8|(r<160?r:Qn)],o>>4){case 2:for(let w=h+1;;++w){if(w>=t||(r=e[w])<32||r>126&&r<Qn){this._printHandler(e,h,w),h=w-1;break}if(++w>=t||(r=e[w])<32||r>126&&r<Qn){this._printHandler(e,h,w),h=w-1;break}if(++w>=t||(r=e[w])<32||r>126&&r<Qn){this._printHandler(e,h,w),h=w-1;break}if(++w>=t||(r=e[w])<32||r>126&&r<Qn){this._printHandler(e,h,w),h=w-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let f=this._csiHandlers[this._collect<<8|r],p=f?f.length-1:-1;for(;p>=0&&(u=f[p](this._params),u!==!0);p--)if(u instanceof Promise)return this._preserveStack(3,f,p,o,h),u;p<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++h<t&&(r=e[h])>47&&r<60);h--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let v=this._escHandlers[this._collect<<8|r],x=v?v.length-1:-1;for(;x>=0&&(u=v[x](),u!==!0);x--)if(u instanceof Promise)return this._preserveStack(4,v,x,o,h),u;x<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let w=h+1;;++w)if(w>=t||(r=e[w])===24||r===26||r===27||r>127&&r<Qn){this._dcsParser.put(e,h,w),h=w-1;break}break;case 14:if(u=this._dcsParser.unhook(r!==24&&r!==26),u)return this._preserveStack(6,[],0,o,h),u;r===27&&(o|=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=h+1;;w++)if(w>=t||(r=e[w])<32||r>127&&r<Qn){this._oscParser.put(e,h,w),h=w-1;break}break;case 6:if(u=this._oscParser.end(r!==24&&r!==26),u)return this._preserveStack(5,[],0,o,h),u;r===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},lC=/^([\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})$/,cC=/^[\da-f]+$/;function av(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=lC.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),cC.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let o=0;o<3;++o){let a=parseInt(t.slice(n*o,n*o+n),16);r[o]=n===1?a<<4:n===2?a:n===3?a>>4:a>>8}return r}}function Gu(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function uC(e,t=16){let[n,r,o]=e;return`rgb:${Gu(n,t)}/${Gu(r,t)}/${Gu(o,t)}`}var dC={"(":0,")":1,"*":2,"+":3,"-":1,".":2},os=131072,lv=10;function cv(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 uv=5e3,dv=0,hC=class extends tt{constructor(e,t,n,r,o,a,u,h,f=new aC){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=o,this._oscLinkService=a,this._coreMouseService=u,this._unicodeService=h,this._parser=f,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new L1,this._utf8Decoder=new T1,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=$t.clone(),this._eraseAttrDataInternal=$t.clone(),this._onRequestBell=this._register(new Ee),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Ee),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Ee),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Ee),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Ee),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Ee),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Ee),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Ee),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Ee),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Ee),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Ee),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Ee),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Ee),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 gh(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:v.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,v,x)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:v,data:x})}),this._parser.setDcsHandlerFallback((p,v,x)=>{v==="HOOK"&&(x=x.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:v,payload:x})}),this._parser.setPrintHandler((p,v,x)=>this.print(p,v,x)),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(ge.BEL,()=>this.bell()),this._parser.setExecuteHandler(ge.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ge.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ge.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ge.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ge.BS,()=>this.backspace()),this._parser.setExecuteHandler(ge.HT,()=>this.tab()),this._parser.setExecuteHandler(ge.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ge.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(wl.IND,()=>this.index()),this._parser.setExecuteHandler(wl.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(wl.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Bn(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new Bn(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new Bn(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new Bn(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new Bn(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new Bn(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new Bn(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new Bn(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new Bn(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new Bn(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new Bn(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new Bn(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 Yt)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 ov((p,v)=>this.requestStatusString(p,v)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),uv))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${uv} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,o=this._activeBuffer.y,a=0,u=this._parseStack.paused;if(u){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>os&&(a=this._parseStack.position+os)}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<os&&(this._parseBuffer=new Uint32Array(Math.min(e.length,os))),u||this._dirtyRowTracker.clearRange(),e.length>os)for(let p=a;p<e.length;p+=os){let v=p+os<e.length?p+os:e.length,x=typeof e=="string"?this._stringDecoder.decode(e.substring(p,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,v),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,x))return this._preserveStack(r,o,x,p),this._logSlowResolvingAsync(n),n}else if(!u){let p=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,p))return this._preserveStack(r,o,p,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let h=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),f=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);f<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(f,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(e,t,n){let r,o,a=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,f=this._coreService.decPrivateModes.wraparound,p=this._coreService.modes.insertMode,v=this._curAttrData,x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&x.getWidth(this._activeBuffer.x-1)===2&&x.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let w=this._parser.precedingJoinState;for(let S=t;S<n;++S){if(r=e[S],r<127&&a){let R=a[String.fromCharCode(r)];R&&(r=R.charCodeAt(0))}let y=this._unicodeService.charProperties(r,w);o=zs.extractWidth(y);let b=zs.extractShouldJoin(y),C=b?zs.extractWidth(w):0;if(w=y,u&&this._onA11yChar.fire(ls(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-C>h){if(f){let R=x,k=this._activeBuffer.x-C;for(this._activeBuffer.x=C,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),x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&x instanceof To&&x.copyCellsFrom(R,k,0,C,!1);k<h;)R.setCellFromCodepoint(k++,0,1,v)}else if(this._activeBuffer.x=h-1,o===2)continue}if(b&&this._activeBuffer.x){let R=x.getWidth(this._activeBuffer.x-1)?1:2;x.addCodepointToCell(this._activeBuffer.x-R,r,o);for(let k=o-C;--k>=0;)x.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(p&&(x.insertCells(this._activeBuffer.x,o-C,this._activeBuffer.getNullCell(v)),x.getWidth(h-1)===2&&x.setCellFromCodepoint(h-1,0,1,v)),x.setCellFromCodepoint(this._activeBuffer.x++,r,o,v),o>0)for(;--o;)x.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=w,this._activeBuffer.x<h&&n-t>0&&x.getWidth(this._activeBuffer.x)===0&&!x.hasContent(this._activeBuffer.x)&&x.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>cv(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new ov(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Bn(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,n,r=!1,o=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),o),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let o=this._activeBuffer.lines.length-this._bufferService.rows;o>0&&(this._activeBuffer.lines.trimStart(o),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-o,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-o,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 n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(o-1,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}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 n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,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}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($t));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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=e.params[0]||1,r=zs.extractWidth(t),o=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),u=new Uint32Array(a.length*n),h=0;for(let p=0;p<a.length;){let v=a.codePointAt(p)||0;u[h++]=v,p+=v>65535?2:1}let f=h;for(let p=1;p<n;++p)u.copyWithin(f,0,h),f+=h;return this.print(u,0,f),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ge.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ge.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ge.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ge.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ge.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,Is),this._charsetService.setgCharset(1,Is),this._charsetService.setgCharset(2,Is),this._charsetService.setgCharset(3,Is);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||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:a}=this._coreMouseService,u=this._coreService,{buffers:h,cols:f}=this._bufferService,{active:p,alt:v}=h,x=this._optionsService.rawOptions,w=(b,C)=>(u.triggerDataEvent(`${ge.ESC}[${t?"":"?"}${b};${C}$y`),!0),S=b=>b?1:2,y=e.params[0];return t?y===2?w(y,4):y===4?w(y,S(u.modes.insertMode)):y===12?w(y,3):y===20?w(y,S(x.convertEol)):w(y,0):y===1?w(y,S(r.applicationCursorKeys)):y===3?w(y,x.windowOptions.setWinLines?f===80?2:f===132?1:0:0):y===6?w(y,S(r.origin)):y===7?w(y,S(r.wraparound)):y===8?w(y,3):y===9?w(y,S(o==="X10")):y===12?w(y,S(x.cursorBlink)):y===25?w(y,S(!u.isCursorHidden)):y===45?w(y,S(r.reverseWraparound)):y===66?w(y,S(r.applicationKeypad)):y===67?w(y,4):y===1e3?w(y,S(o==="VT200")):y===1002?w(y,S(o==="DRAG")):y===1003?w(y,S(o==="ANY")):y===1004?w(y,S(r.sendFocus)):y===1005?w(y,4):y===1006?w(y,S(a==="SGR")):y===1015?w(y,4):y===1016?w(y,S(a==="SGR_PIXELS")):y===1048?w(y,1):y===47||y===1047||y===1049?w(y,S(p===v)):y===2004?w(y,S(r.bracketedPasteMode)):y===2026?w(y,S(r.synchronizedOutput)):w(y,0)}_updateAttrColor(e,t,n,r,o){return t===2?(e|=50331648,e&=-16777216,e|=Wo.fromColorRGB([n,r,o])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],o=0,a=0;do{if(r[a+o]=e.params[t+a],e.hasSubParams(t+a)){let u=e.getSubParams(t+a),h=0;do r[1]===5&&(o=1),r[a+h+1+o]=u[h];while(++h<u.length&&h+a+1+o<r.length);break}if(r[1]===5&&a+o>=2||r[1]===2&&a+o>=5)break;r[1]&&(o=1)}while(++a+t<e.length&&a+o<r.length);for(let u=2;u<r.length;++u)r[u]===-1&&(r[u]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[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=$t.fg,e.bg=$t.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,n,r=this._curAttrData;for(let o=0;o<t;o++)n=e.params[o],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=$t.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=$t.bg&16777215):n===38||n===48||n===58?o+=this._extractColor(e,o,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=$t.fg&16777215,r.bg&=-67108864,r.bg|=$t.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ge.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ge.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ge.ESC}[?${t};${n}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=$t.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 n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!cv(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(`${ge.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>lv&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>lv&&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=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),o=n.shift();if(/^\d+$/.exec(r)){let a=parseInt(r);if(hv(a))if(o==="?")t.push({type:0,index:a});else{let u=av(o);u&&t.push({type:1,index:a,color:u})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,o=n.findIndex(a=>a.startsWith("id="));return o!==-1&&(r=n[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,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 n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let o=av(n[r]);o&&this._onColor.fire([{type:1,index:this._specialColors[t],color:o}])}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=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let o=parseInt(n[r]);hv(o)&&t.push({type:2,index:o})}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,Is),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(dC[e[0]],Yt[e[1]]||Is),!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=$t.clone(),this._eraseAttrDataInternal=$t.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 Zn;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 n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=u=>(this._coreService.triggerDataEvent(`${ge.ESC}${u}${ge.ESC}\\`),!0),r=this._bufferService.buffer,o=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},gh=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&&(dv=e,e=t,t=dv),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};gh=At([Pe(0,xn)],gh);function hv(e){return 0<=e&&e<256}var fC=5e7,fv=12,pC=50,mC=class extends tt{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 Ee),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 n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>fC)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 n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],o=this._action(r,t);if(o){let u=h=>performance.now()-n>=fv?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(n,h);o.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(u);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=fv)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>pC&&(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()}},vh=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 h=t.addMarker(t.ybase+t.y),f={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(f,h)),this._dataByLinkId.set(f.id,f),f.id}let n=e,r=this._getEntryIdKey(n),o=this._entriesWithId.get(r);if(o)return this.addLineToLink(o.id,t.ybase+t.y),o.id;let a=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(u,a)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}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 n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};vh=At([Pe(0,xn)],vh);var pv=!1,gC=class extends tt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Pr),this._onBinary=this._register(new Ee),this.onBinary=this._onBinary.event,this._onData=this._register(new Ee),this.onData=this._onData.event,this._onLineFeed=this._register(new Ee),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Ee),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Ee),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Ee),this._instantiationService=new Fk,this.optionsService=this._register(new Xk(e)),this._instantiationService.setService(kn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(hh)),this._instantiationService.setService(xn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(dh)),this._instantiationService.setService(fy,this._logService),this.coreService=this._register(this._instantiationService.createInstance(fh)),this._instantiationService.setService(Ks,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(ph)),this._instantiationService.setService(hy,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(zs)),this._instantiationService.setService(I1,this.unicodeService),this._charsetService=this._instantiationService.createInstance(tC),this._instantiationService.setService(A1,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(vh),this._instantiationService.setService(py,this._oscLinkService),this._inputHandler=this._register(new hC(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(dn.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(dn.forward(this._bufferService.onResize,this._onResize)),this._register(dn.forward(this.coreService.onData,this._onData)),this._register(dn.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 mC((t,n)=>this._inputHandler.parse(t,n))),this._register(dn.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Ee),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&&!pv&&(this._logService.warn("writeSync is unreliable and will be removed soon."),pv=!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,qy),t=Math.max(t,Vy),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(rv.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(rv(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ct(()=>{for(let t of e)t.dispose()})}}},vC={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 _C(e,t,n,r){var u;let o={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?o.key=ge.ESC+"OA":o.key=ge.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=ge.ESC+"OD":o.key=ge.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=ge.ESC+"OC":o.key=ge.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=ge.ESC+"OB":o.key=ge.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":ge.DEL,e.altKey&&(o.key=ge.ESC+o.key);break;case 9:if(e.shiftKey){o.key=ge.ESC+"[Z";break}o.key=ge.HT,o.cancel=!0;break;case 13:o.key=e.altKey?ge.ESC+ge.CR:ge.CR,o.cancel=!0;break;case 27:o.key=ge.ESC,e.altKey&&(o.key=ge.ESC+ge.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;a?o.key=ge.ESC+"[1;"+(a+1)+"D":t?o.key=ge.ESC+"OD":o.key=ge.ESC+"[D";break;case 39:if(e.metaKey)break;a?o.key=ge.ESC+"[1;"+(a+1)+"C":t?o.key=ge.ESC+"OC":o.key=ge.ESC+"[C";break;case 38:if(e.metaKey)break;a?o.key=ge.ESC+"[1;"+(a+1)+"A":t?o.key=ge.ESC+"OA":o.key=ge.ESC+"[A";break;case 40:if(e.metaKey)break;a?o.key=ge.ESC+"[1;"+(a+1)+"B":t?o.key=ge.ESC+"OB":o.key=ge.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=ge.ESC+"[2~");break;case 46:a?o.key=ge.ESC+"[3;"+(a+1)+"~":o.key=ge.ESC+"[3~";break;case 36:a?o.key=ge.ESC+"[1;"+(a+1)+"H":t?o.key=ge.ESC+"OH":o.key=ge.ESC+"[H";break;case 35:a?o.key=ge.ESC+"[1;"+(a+1)+"F":t?o.key=ge.ESC+"OF":o.key=ge.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=ge.ESC+"[5;"+(a+1)+"~":o.key=ge.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=ge.ESC+"[6;"+(a+1)+"~":o.key=ge.ESC+"[6~";break;case 112:a?o.key=ge.ESC+"[1;"+(a+1)+"P":o.key=ge.ESC+"OP";break;case 113:a?o.key=ge.ESC+"[1;"+(a+1)+"Q":o.key=ge.ESC+"OQ";break;case 114:a?o.key=ge.ESC+"[1;"+(a+1)+"R":o.key=ge.ESC+"OR";break;case 115:a?o.key=ge.ESC+"[1;"+(a+1)+"S":o.key=ge.ESC+"OS";break;case 116:a?o.key=ge.ESC+"[15;"+(a+1)+"~":o.key=ge.ESC+"[15~";break;case 117:a?o.key=ge.ESC+"[17;"+(a+1)+"~":o.key=ge.ESC+"[17~";break;case 118:a?o.key=ge.ESC+"[18;"+(a+1)+"~":o.key=ge.ESC+"[18~";break;case 119:a?o.key=ge.ESC+"[19;"+(a+1)+"~":o.key=ge.ESC+"[19~";break;case 120:a?o.key=ge.ESC+"[20;"+(a+1)+"~":o.key=ge.ESC+"[20~";break;case 121:a?o.key=ge.ESC+"[21;"+(a+1)+"~":o.key=ge.ESC+"[21~";break;case 122:a?o.key=ge.ESC+"[23;"+(a+1)+"~":o.key=ge.ESC+"[23~";break;case 123:a?o.key=ge.ESC+"[24;"+(a+1)+"~":o.key=ge.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=ge.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=ge.DEL:e.keyCode===219?o.key=ge.ESC:e.keyCode===220?o.key=ge.FS:e.keyCode===221&&(o.key=ge.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let h=(u=vC[e.keyCode])==null?void 0:u[e.shiftKey?1:0];if(h)o.key=ge.ESC+h;else if(e.keyCode>=65&&e.keyCode<=90){let f=e.ctrlKey?e.keyCode-64:e.keyCode+32,p=String.fromCharCode(f);e.shiftKey&&(p=p.toUpperCase()),o.key=ge.ESC+p}else if(e.keyCode===32)o.key=ge.ESC+(e.ctrlKey?ge.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let f=e.code.slice(3,4);e.shiftKey||(f=f.toLowerCase()),o.key=ge.ESC+f,o.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(o.key=ge.US),e.key==="@"&&(o.key=ge.NUL));break}return o}var zt=0,yC=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Il,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Il,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((o,a)=>this._getKey(o)-this._getKey(a)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<r.length;o++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[o]=e[t],t++):r[o]=this._array[n++];this._array=r,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||(zt=this._search(t),zt===-1)||this._getKey(this._array[zt])!==t)return!1;do if(this._array[zt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(zt),!0;while(++zt<this._array.length&&this._getKey(this._array[zt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,a)=>o-a),t=0,n=new Array(this._array.length-e.length),r=0;for(let o=0;o<this._array.length;o++)e[t]===o?t++:n[r++]=this._array[o];this._array=n,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&&(zt=this._search(e),!(zt<0||zt>=this._array.length)&&this._getKey(this._array[zt])===e))do yield this._array[zt];while(++zt<this._array.length&&this._getKey(this._array[zt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(zt=this._search(e),!(zt<0||zt>=this._array.length)&&this._getKey(this._array[zt])===e))do t(this._array[zt]);while(++zt<this._array.length&&this._getKey(this._array[zt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,o=this._getKey(this._array[r]);if(o>e)n=r-1;else if(o<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Xu=0,mv=0,wC=class extends tt{constructor(){super(),this._decorations=new yC(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new Ee),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Ee),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ct(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new SC(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.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,n){let r=0,o=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,o=r+(a.options.width??1),e>=r&&e<o&&(!n||(a.options.layer??"bottom")===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,o=>{Xu=o.options.x??0,mv=Xu+(o.options.width??1),e>=Xu&&e<mv&&(!n||(o.options.layer??"bottom")===n)&&r(o)})}},SC=class extends ms{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Ee),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Ee),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=Tt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Tt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},bC=1e3,xC=class{constructor(e,t=bC){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,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 r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let o=r-this._lastRefreshMs,a=this._debounceThresholdMS-o;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)}},gv=20,Bl=class extends tt{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.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=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new xC(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(Ve(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ct(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<gv+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
65
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===gv+1&&(this._liveRegion.textContent+=Bd.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 n=this._terminal.buffer,r=n.lines.length.toString();for(let o=e;o<=t;o++){let a=n.lines.get(n.ydisp+o),u=[],h=(a==null?void 0:a.translateToString(!0,void 0,void 0,u))||"",f=(n.ydisp+o+1).toString(),p=this._rowElements[o];p&&(h.length===0?(p.textContent=" ",this._rowColumns.set(p,[0,1])):(p.textContent=h,this._rowColumns.set(p,u)),p.setAttribute("aria-posinset",f),p.setAttribute("aria-setsize",r),this._alignRowWidth(p))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],o=n.getAttribute("aria-posinset"),a=t===0?"1":`${this._terminal.buffer.lines.length}`;if(o===a||e.relatedTarget!==r)return;let u,h;if(t===0?(u=n,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(u=this._rowElements.shift(),h=n,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}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 h;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},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,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 r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((h=r.textContent)==null?void 0:h.length)??0}),!this._rowContainer.contains(n.node))return;let o=({node:f,offset:p})=>{let v=f instanceof Text?f.parentNode:f,x=parseInt(v==null?void 0:v.getAttribute("aria-posinset"),10)-1;if(isNaN(x))return console.warn("row is invalid. Race condition?"),null;let w=this._rowColumns.get(v);if(!w)return console.warn("columns is null. Race condition?"),null;let S=p<w.length?w[p]:w.slice(-1)[0]+1;return S>=this._terminal.cols&&(++x,S=0),{row:x,column:S}},a=o(t),u=o(n);if(!(!a||!u)){if(a.row>u.row||a.row===u.row&&a.column>=u.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(u.row-a.row)*this._terminal.cols-a.column+u.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 o,a;e.style.transform="";let t=e.getBoundingClientRect().width,n=(a=(o=this._rowColumns.get(e))==null?void 0:o.slice(-1))==null?void 0:a[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Bl=At([Pe(1,qh),Pe(2,Mi),Pe(3,Ai)],Bl);var _h=class extends tt{constructor(e,t,n,r,o){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Ee),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Ee),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ct(()=>{var a;Ws(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(Ve(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ve(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ve(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ve(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 n=e.composedPath();for(let r=0;r<n.length;r++){let o=n[r];if(o.classList.contains("xterm"))break;if(o.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 r,o;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(a=>{a==null||a.forEach(u=>{u.link.dispose&&u.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[a,u]of this._linkProviderService.linkProviders.entries())t?(o=this._activeProviderReplies)!=null&&o.get(a)&&(n=this._checkLinkProviderResult(a,e,n)):u.provideLinks(e.y,h=>{var p,v;if(this._isMouseOut)return;let f=h==null?void 0:h.map(x=>({link:x}));(p=this._activeProviderReplies)==null||p.set(a,f),n=this._checkLinkProviderResult(a,e,n),((v=this._activeProviderReplies)==null?void 0:v.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let o=t.get(r);if(o)for(let a=0;a<o.length;a++){let u=o[a],h=u.link.range.start.y<e?0:u.link.range.start.x,f=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let p=h;p<=f;p++){if(n.has(p)){o.splice(a--,1);break}n.add(p)}}}}_checkLinkProviderResult(e,t,n){var a;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),o=!1;for(let u=0;u<e;u++)(!this._activeProviderReplies.has(u)||this._activeProviderReplies.get(u))&&(o=!0);if(!o&&r){let u=r.find(h=>this._linkAtPosition(h.link,t));u&&(n=!0,this._handleNewLink(u))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let u=0;u<this._activeProviderReplies.size;u++){let h=(a=this._activeProviderReplies.get(u))==null?void 0:a.find(f=>this._linkAtPosition(f.link,t));if(h){n=!0,this._handleNewLink(h);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&kC(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,Ws(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 n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,o,a;(r=this._currentLink)!=null&&r.state&&((a=(o=this._currentLink)==null?void 0:o.state)==null?void 0:a.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(r,o),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.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(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.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(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,o=t.y*this._bufferService.cols+t.x;return n<=o&&o<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,o){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:o}}};_h=At([Pe(1,Vh),Pe(2,Ai),Pe(3,xn),Pe(4,gy)],_h);function kC(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 CC=class extends gC{constructor(e={}){super(e),this._linkifier=this._register(new Pr),this.browser=Ay,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Pr),this._onCursorMove=this._register(new Ee),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Ee),this.onKey=this._onKey.event,this._onRender=this._register(new Ee),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Ee),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Ee),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Ee),this.onBell=this._onBell.event,this._onFocus=this._register(new Ee),this._onBlur=this._register(new Ee),this._onA11yCharEmitter=this._register(new Ee),this._onA11yTabEmitter=this._register(new Ee),this._onWillOpen=this._register(new Ee),this._setup(),this._decorationService=this._instantiationService.createInstance(wC),this._instantiationService.setService(Uo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(pk),this._instantiationService.setService(gy,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(zd)),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(dn.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(dn.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(dn.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(dn.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ct(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.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 n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let o=wt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ge.ESC}]${r};${uC(o)}${Dy.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(a=>a.ansi[t.index]=Ht.toColor(...t.color));else{let a=n;this._themeService.modifyColors(u=>u[a]=Ht.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(Bl,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ge.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(ge.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 n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,o=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*o,u=this.buffer.y*this._renderService.dimensions.css.cell.height,h=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=u+"px",this.textarea.style.width=a+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ve(this.element,"copy",t=>{this.hasSelection()&&j1(t,this._selectionService)}));let e=t=>P1(t,this.textarea,this.coreService,this.optionsService);this._register(Ve(this.textarea,"paste",e)),this._register(Ve(this.element,"paste",e)),Iy?this._register(Ve(this.element,"mousedown",t=>{t.button===2&&Eg(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ve(this.element,"contextmenu",t=>{Eg(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),tf&&this._register(Ve(this.element,"auxclick",t=>{t.button===1&&ay(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ve(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ve(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ve(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ve(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ve(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ve(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ve(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var o;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"),((o=this.element)==null?void 0:o.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(Ve(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 n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Id.get()),zy||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",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(hk,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Mi,this._coreBrowserService),this._register(Ve(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(Ve(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(oh,this._document,this._helperContainer),this._instantiationService.setService(Wl,this._charSizeService),this._themeService=this._instantiationService.createInstance(uh),this._instantiationService.setService(Mr,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ml),this._instantiationService.setService(my,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(lh,this.rows,this.screenElement)),this._instantiationService.setService(Ai,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(ih,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ah),this._instantiationService.setService(Vh,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(_h,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(th,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(ch,this.element,this.screenElement,r)),this._instantiationService.setService(O1,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(dn.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var a;this._selectionService.refresh(),(a=this._viewport)==null||a.queueSync()})),this._register(this._instantiationService.createInstance(nh,this.screenElement)),this._register(Ve(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(Bl,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Dl,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Dl,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 n(a){var p,v,x,w,S;let u=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!u)return!1;let h,f;switch(a.overrideType||a.type){case"mousemove":f=32,a.buttons===void 0?(h=3,a.button!==void 0&&(h=a.button<3?a.button:3)):h=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":f=0,h=a.button<3?a.button:3;break;case"mousedown":f=1,h=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let y=a.deltaY;if(y===0||e.coreMouseService.consumeWheelEvent(a,(w=(x=(v=(p=e._renderService)==null?void 0:p.dimensions)==null?void 0:v.device)==null?void 0:x.cell)==null?void 0:w.height,(S=e._coreBrowserService)==null?void 0:S.dpr)===0)return!1;f=y<0?0:1,h=4;break;default:return!1}return f===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:h,action:f,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:a=>(n(a),a.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(a)),wheel:a=>(n(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&n(a)},mousemove:a=>{a.buttons||n(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?r.mousemove||(t.addEventListener("mousemove",o.mousemove),r.mousemove=o.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),a&16?r.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),r.wheel=o.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),a&2?r.mouseup||(r.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),a&4?r.mousedrag||(r.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ve(t,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return n(a),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(a)})),this._register(Ve(t,"wheel",a=>{var u,h,f,p,v;if(!r.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=(f=(h=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:h.device)==null?void 0:f.cell)==null?void 0:p.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return this.cancel(a,!0);let x=ge.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(x,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.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){oy(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,n){this._selectionService.setSelection(e,t,n)}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 n;(n=this._selectionService)==null||n.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 n=_C(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.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((n.key===ge.ETX||n.key===ge.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=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"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(EC(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 n;(n=this._charSizeService)==null||n.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($t));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(ge.ESC+"[I"):this.coreService.triggerDataEvent(ge.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ge.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ge.ESC}[6;${o};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function EC(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var NC=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;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)}},RC=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 Zn)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},vv=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 RC(t)}getNullCell(){return new Zn}},jC=class extends tt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Ee),this.onBufferChange=this._onBufferChange.event,this._normal=new vv(this._core.buffers.normal,"normal"),this._alternate=new vv(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)}},PC=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.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)}},LC=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}},TC=["cols","rows"],mi=0,DC=class extends tt{constructor(e){super(),this._core=this._register(new CC(e)),this._addonManager=this._register(new NC),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,o)=>{this._checkReadonlyOptions(r),this._core.options[r]=o};for(let r in this._core.options){let o={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,o)}}_checkReadonlyOptions(e){if(TC.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 PC(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new LC(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 jC(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,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}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 Id.get()},set promptLabel(e){Id.set(e)},get tooMuchOutput(){return Bd.get()},set tooMuchOutput(e){Bd.set(e)}}}_verifyIntegers(...e){for(mi of e)if(mi===1/0||isNaN(mi)||mi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(mi of e)if(mi&&(mi===1/0||isNaN(mi)||mi%1!==0||mi<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 MC=2,AC=1,IC=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 x;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:((x=this._terminal.options.overviewRuler)==null?void 0:x.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),o=Math.max(0,parseInt(n.getPropertyValue("width"))),a=window.getComputedStyle(this._terminal.element),u={top:parseInt(a.getPropertyValue("padding-top")),bottom:parseInt(a.getPropertyValue("padding-bottom")),right:parseInt(a.getPropertyValue("padding-right")),left:parseInt(a.getPropertyValue("padding-left"))},h=u.top+u.bottom,f=u.right+u.left,p=r-h,v=o-f-t;return{cols:Math.max(MC,Math.floor(v/e.css.cell.width)),rows:Math.max(AC,Math.floor(p/e.css.cell.height))}}};function BC(e,t){return e?`/api/route/${String(e).split("/").map(encodeURIComponent).join("/")}/_/ws?token=${encodeURIComponent(t||"")}`:"/ws"}function OC({session:e,node:t,token:n,cols:r,rows:o,readonly:a=!1,takeSize:u,focused:h,onData:f,onExit:p,onFiles:v,retryBaseMs:x=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 y=`${location.protocol==="https:"?"wss":"ws"}://${location.host}${BC(t,n)}`;let b=null,C=!1,R=!1,k=null,F=0,B=h;const V=()=>{if(C||R||k)return;const z=Math.min(5e3,Math.max(0,x)*2**Math.min(F++,5));k=setTimeout(()=>{k=null,G()},z)},G=()=>{if(C||R)return;const z=new WebSocket(y);b=z,z.binaryType="arraybuffer",z.onopen=()=>{if(b!==z||C)return;F=0;const te={type:"attach",session:e,token:n,cols:r,rows:o,readonly:a};u!==void 0&&(te.takeSize=u),z.send(JSON.stringify(te)),B!==void 0&&z.send(JSON.stringify({type:"focus",on:!!B}))},z.onmessage=te=>{if(!(b!==z||C))if(typeof te.data=="string"){let H;try{H=JSON.parse(te.data)}catch{return}H.type==="exit"&&(R=!0,p&&p(H.code)),H.type==="files"&&v&&v(H)}else f&&f(new Uint8Array(te.data))},z.onerror=()=>{if(b===z)try{z.close()}catch{}},z.onclose=te=>{b!==z||C||R||[1e3,1002,4401,4404].includes(te==null?void 0:te.code)||V()}};return G(),{sendInput:z=>{if(!b||b.readyState!==1)return!1;try{return b.send(typeof z=="string"?new TextEncoder().encode(z):z),!0}catch{try{b.close()}catch{}return!1}},isReady:()=>!!b&&b.readyState===1,resize:(z,te)=>{r=z,o=te,(b==null?void 0:b.readyState)===1&&b.send(JSON.stringify({type:"resize",cols:z,rows:te}))},action:z=>{(b==null?void 0:b.readyState)===1&&b.send(JSON.stringify({type:"action",name:z}))},focus:z=>{B=z,(b==null?void 0:b.readyState)===1&&b.send(JSON.stringify({type:"focus",on:!!z}))},close:()=>{if(C=!0,k&&clearTimeout(k),k=null,b)try{b.close()}catch{}},get raw(){return b}}}async function _v(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 n=document.createElement("textarea");n.value=t,n.readOnly=!0,n.style.position="fixed",n.style.opacity="0",n.style.pointerEvents="none",document.body.appendChild(n),n.select();const r=document.execCommand&&document.execCommand("copy");if(n.remove(),r)return!0}catch{}return!1}const zC="\r";function FC(e){const t=String(e||"");let n=t.length;for(;n>0;){const r=t.charCodeAt(n-1);if(r===10||r===13)n-=1;else break}return t.slice(0,n)}function $C({isReady:e,paste:t,send:n}){return r=>{if(!r||!e())return!1;try{return t(r)===!1||!e()?!1:n(zC)!==!1}catch{return!1}}}function HC(e){return!e||typeof e!="object"?!1:!!e.shiftKey}function WC(e){return!e||typeof e!="object"||String(e.key||"").toLowerCase()!=="c"?!1:!!(e.metaKey||e.ctrlKey&&e.shiftKey)}const UC=450,yv=8;function KC(e,t,n,r){return Math.abs(Number(n)-Number(e))>yv||Math.abs(Number(r)-Number(t))>yv}const qC=new Map([["image/png","png"],["image/jpeg","jpg"],["image/gif","gif"],["image/webp","webp"],["application/pdf","pdf"],["text/plain","txt"]]);function Ju(e){return e?e.files&&e.files.length>0||Array.from(e.items||[]).some(t=>t&&t.kind==="file")?!0:Array.from(e.types||[]).includes("Files"):!1}function wv(e){if(!e)return[];const t=Array.from(e.files||[]).filter(Boolean);return t.length?t:Array.from(e.items||[]).filter(n=>n&&n.kind==="file"&&typeof n.getAsFile=="function").map(n=>n.getAsFile()).filter(Boolean)}function VC(e,t=0,n=Date.now()){const r=String((e==null?void 0:e.name)||"").trim();if(r)return r;const o=qC.get(String((e==null?void 0:e.type)||"").toLowerCase())||"bin";return`clipboard-${n}-${t+1}.${o}`}async function Gy({files:e,token:t,session:n,node:r="",paste:o=!0,fetchImpl:a=Vt,onProgress:u=()=>{},now:h=Date.now()}={}){const f=Array.from(e||[]).filter(Boolean),p=[],v=[];if(!n||!f.length)return{paths:p,errors:v};const x=bn(r?String(r).split("/"):[]);for(let w=0;w<f.length;w+=1){const S=f[w],y=VC(S,w,h);u({index:w,total:f.length,name:y,state:"uploading"});try{const b=new FormData;b.append("session",n),b.append("paste",o?"true":"false"),b.append("file",S,y);const C=await a(`${x}/files/upload`,t,{method:"POST",body:b}),R=await C.json().catch(()=>({}));if(!C.ok||R.error)throw new Error(R.error||`HTTP ${C.status}`);p.push(R.path),u({index:w,total:f.length,name:y,state:"done",path:R.path})}catch(b){const C=String((b==null?void 0:b.message)||b);v.push({name:y,message:C}),u({index:w,total:f.length,name:y,state:"error",error:C})}}return{paths:p,errors:v}}const YC=420,GC=32;function XC(e){if(!e||typeof e!="object")return!1;const t=String(e.tagName||"").toLowerCase();return t==="textarea"||t==="input"||e.isContentEditable===!0}function yh({documentRef:e,navigatorRef:t}={}){const n=e||(typeof document<"u"?document:null),r=t||(typeof navigator<"u"?navigator:null);let o=!1;try{r!=null&&r.virtualKeyboard&&typeof r.virtualKeyboard.hide=="function"&&(r.virtualKeyboard.hide(),o=!0)}catch{}const a=n&&n.activeElement;let u=!1;if(XC(a)&&typeof a.blur=="function")try{a.blur(),u=!0}catch{}return{blurred:u,apiRequested:o}}function Xy(e,t,n=!1){const r=e&&e.textarea;if(!r)return null;const a=t==="single-tap"||t==="double-tap"&&n?"text":"none";return r.inputMode=a,r.setAttribute("inputmode",a),a}function JC(e,t){if(!e||!e.textarea)return!1;Xy(e,"double-tap",!0);try{e.focus()}catch{return!1}const n=typeof navigator<"u"?navigator:null;try{n!=null&&n.virtualKeyboard&&typeof n.virtualKeyboard.show=="function"&&n.virtualKeyboard.show()}catch{}return!0}function QC(e,t,n){return e==="never"?{open:!1,next:null}:e==="single-tap"?{open:!0,next:null}:!n||!Number.isFinite(n.at)||!Number.isFinite(n.x)||!Number.isFinite(n.y)?{open:!1,next:null}:t&&n.at>=t.at&&n.at-t.at<=YC&&Math.hypot(n.x-t.x,n.y-t.y)<=GC?{open:!0,next:null}:{open:!1,next:n}}const ZC=24,Sv=80,Jy=8,eE="\x1B[5~",tE="\x1B[6~";function nE({alternateScreen:e=!1,readonly:t=!1}={}){return e&&!t?"page":"scroll"}function iE(e,t){return e==="page"?Number.isFinite(t)&&t>0?Math.max(Sv,t):Sv:Number.isFinite(t)&&t>0?t:ZC}function sE({mode:e="scroll",accumulated:t=0,threshold:n=0}={}){const r=iE(e,n);if(!Number.isFinite(t))return{mode:e,up:0,down:0,remainder:0};const o=Math.abs(t);if(o<r)return{mode:e,up:0,down:0,remainder:t};const a=Math.floor(o/r),u=Math.min(a,Jy),h=(t>=0?1:-1)*(o%r);return{mode:e,up:t>0?u:0,down:t<0?u:0,remainder:h}}function rE(e){const t=[],n=r=>Math.min(Jy,Number.isFinite(r)?Math.max(0,Math.floor(r)):0);for(let r=0;r<n(e.up);r+=1)t.push(e.mode==="page"?{kind:"input",seq:eE}:{kind:"action",name:"scroll-up"});for(let r=0;r<n(e.down);r+=1)t.push(e.mode==="page"?{kind:"input",seq:tE}:{kind:"action",name:"scroll-down"});return t}function Qy({session:e,node:t,token:n,readonly:r,takeSize:o,focused:a,sendRef:u,composerRef:h,actionRef:f,ctrlRef:p,setCtrlArmed:v,onFiles:x,fontSize:w=13,selectionMode:S=!1,onSelectionModeChange:y,keyboardGesture:b="double-tap"}){const C=N.useRef(null),R=N.useRef(null),k=N.useRef(w);k.current=w;const F=N.useRef(a);F.current=a;const B=N.useRef(S);B.current=S;const V=N.useRef(b);V.current=b;const[G,z]=N.useState(""),[te,H]=N.useState(""),[X,A]=N.useState(null),[M,E]=N.useState(null),D=async()=>{var L,q,I,T;const P=((q=(L=R.current)==null?void 0:L.term)==null?void 0:q.getSelection())||G;if(!P){H(g("copy-empty")),setTimeout(()=>H(""),1500);return}const $=await _v(P);H(g($?"copied":"copy-manual")),$&&((T=(I=R.current)==null?void 0:I.term)==null||T.clearSelection(),y==null||y(!1)),setTimeout(()=>H(""),1800)},O=N.useRef(D);return O.current=D,N.useEffect(()=>{const P=R.current;P&&P.sock&&P.sock.focus&&P.sock.focus(!!a)},[a]),N.useEffect(()=>{const P=R.current;P&&(P.term.options.fontSize=w,P.fit.fit(),P.sock.resize(P.term.cols,P.term.rows))},[w]),N.useEffect(()=>{var P,$;($=(P=R.current)==null?void 0:P.setKeyboardGesture)==null||$.call(P,b)},[b]),N.useEffect(()=>{var Go;const P=new DC({cursorBlink:!0,fontSize:k.current,scrollback:1e3,theme:{background:"#0a0e0a"}}),$=new IC;P.loadAddon($),P.open(C.current),$.fit();const L=new TextDecoder;let q=V.current==="single-tap",I=null;const T=()=>{q=V.current==="single-tap",Xy(P,V.current,q)},U=me=>{V.current=me,I=null,T()},Z=()=>V.current==="never"?!1:(q=!0,JC(P));T();const ae=P.textarea,he=()=>{V.current==="double-tap"&&T()};ae==null||ae.addEventListener("blur",he);let pe;try{pe=OC({session:e,node:t,token:n,readonly:r,takeSize:o,focused:F.current,onFiles:x,cols:P.cols,rows:P.rows,onData:me=>P.write(L.decode(me)),onExit:()=>P.write(`\r
78
+ \x1B[33m[sessione finita]\x1B[0m\r
79
+ `)})}catch(me){return P.write(`\r
80
+ \x1B[31m${me.message}\x1B[0m\r
81
+ `),()=>P.dispose()}R.current={term:P,fit:$,sock:pe,setKeyboardGesture:U};let Q=null;const ne=P.onData(me=>{if(r){Q&&(Q.ok=!1);return}if(!Q&&p&&p.current&&me.length===1){const Ge=me.charCodeAt(0);let Je=Ge;Ge>=97&&Ge<=122?Je=Ge-96:Ge>=64&&Ge<=95?Je=Ge-64:Ge===32&&(Je=0),me=String.fromCharCode(Je),p.current=!1,v&&v(!1)}const Fe=pe.sendInput(me);Q&&(Q.seen=!0,Q.ok=Q.ok&&Fe)});u&&(u.current=me=>pe.sendInput(me)),f&&(f.current=me=>pe.action(me)),h&&(h.current=$C({isReady:()=>!r&&pe.isReady(),paste:me=>{const Fe={seen:!1,ok:!0};Q=Fe;try{P.paste(me)}catch{Fe.ok=!1}finally{Q=null}return Fe.seen&&Fe.ok},send:me=>pe.sendInput(me)}));const fe=P.onSelectionChange(()=>z(P.getSelection()));P.attachCustomKeyEventHandler(me=>(me.ctrlKey||me.metaKey)&&me.key.toLowerCase()==="c"&&P.getSelection()?(me.type==="keydown"&&_v(P.getSelection()),!1):!0);const Se=C.current;let Ze=!1;const $e=async me=>{if(!me.length||Ze)return;if(r){A({error:g("settings-readonly")});return}Ze=!0,A({current:0,total:me.length,name:""});const Fe=await Gy({files:me,token:n,session:e,node:t,paste:!0,onProgress:({index:Ge,total:Je,name:xt,state:Rt,error:an})=>A({current:Ge+1,total:Je,name:xt,...Rt==="error"?{error:an}:{}})});Ze=!1,Fe.errors.length?A({error:Fe.errors.map(Ge=>`${Ge.name}: ${Ge.message}`).join(" · ")}):(A({done:!0,total:Fe.paths.length}),setTimeout(()=>A(null),1600))},He=me=>{const Fe=me.clipboardData;if(!Ju(Fe))return;const Ge=wv(Fe);Ge.length&&(me.preventDefault(),me.stopPropagation(),$e(Ge))},vt=me=>{Ju(me.dataTransfer)&&(me.preventDefault(),me.stopPropagation())},Xe=me=>{Ju(me.dataTransfer)&&(me.preventDefault(),me.stopPropagation(),$e(wv(me.dataTransfer)))};Se.addEventListener("paste",He,!0),Se.addEventListener("dragenter",vt,!0),Se.addEventListener("dragover",vt,!0),Se.addEventListener("drop",Xe,!0);const St=24,Et=(me,Fe={mode:null,remainder:0},Ge=null)=>{const Je=C.current,xt=Je?Je.getBoundingClientRect().height:St,Rt=Ge||nE({alternateScreen:P.buffer.active.type==="alternate",readonly:r}),an=Fe.mode===Rt?Fe.remainder+me:me,Oi=sE({mode:Rt,accumulated:an,threshold:Rt==="page"?xt:St});for(const Ys of rE(Oi))Ys.kind==="input"?pe.sendInput(Ys.seq):pe.action(Ys.name);return{mode:Rt,remainder:Oi.remainder}};let rt=null,ct=null,ot=null,ut=null,dt=!1,le=!1,xe={mode:null,remainder:0},ze=null,Ie=null,ue=null,Y=!1,ie=0;const W=()=>{ue&&clearTimeout(ue),ue=null},se=(me,Fe)=>{const Je=(Se.querySelector(".xterm-screen")||Se).getBoundingClientRect(),xt=Math.max(0,Math.min(P.cols-1,Math.floor((me-Je.left)/Math.max(1,Je.width)*P.cols))),Rt=Math.max(0,Math.min(P.rows-1,Math.floor((Fe-Je.top)/Math.max(1,Je.height)*P.rows)));return{col:xt,row:P.buffer.active.viewportY+Rt}},ve=me=>se(me.clientX,me.clientY),ke=2,Re=me=>{const Ge=(Se.querySelector(".xterm-screen")||Se).getBoundingClientRect();return Math.max(0,Math.min(P.rows-1,Math.floor((me-Ge.top)/Math.max(1,Ge.height)*P.rows)))<ke?ke:-ke},we=(me,Fe)=>{const xt=(Se.querySelector(".xterm-screen")||Se).getBoundingClientRect().height/Math.max(1,P.rows);return se(me.clientX,me.clientY+Fe*xt)},je=me=>{const Ge=(Se.querySelector(".xterm-screen")||Se).getBoundingClientRect(),Je=Se.getBoundingClientRect(),xt=Ge.width/Math.max(1,P.cols),Rt=Ge.height/Math.max(1,P.rows),an=Number(P.buffer.active.viewportY)||0,Oi=Math.max(0,Math.min(P.rows-1,me.row-an));E({left:`${Ge.left-Je.left+me.col*xt}px`,top:`${Ge.top-Je.top+Oi*Rt}px`,width:`${xt}px`,height:`${Rt}px`})},st=me=>{if(W(),Y=!1,dt=!1,le||me.touches.length!==1){le=!0,dt=!0,I=null,E(null),ie=0,rt=null,ct=null,ot=null,ut=null;return}if(B.current){me.preventDefault(),me.stopPropagation(),Ie=ve(me.touches[0]),P.clearSelection();return}rt=me.touches[0].clientY,ct=me.touches[0].clientX,ot=ct,ut=rt,xe={mode:null,remainder:0},ze=null;const Fe={x:ct,y:rt};ue=setTimeout(()=>{var an;ue=null,Y=!0,dt=!0,I=null,B.current=!0,y==null||y(!0),Ie=se(Fe.x,Fe.y),ie=Re(Fe.y);const Ge=we({clientX:Fe.x,clientY:Fe.y},ie);P.clearSelection();const Je=Ie.row*P.cols+Ie.col,xt=Ge.row*P.cols+Ge.col,Rt=Je<=xt?Ie:Ge;P.select(Rt.col,Rt.row,Math.abs(xt-Je)+1),je(Ge);try{(an=navigator.vibrate)==null||an.call(navigator,10)}catch{}rt=null,ct=null,ze=null,xe={mode:null,remainder:0}},UC)},It=me=>{if(Y&&Ie&&me.touches.length===1){me.preventDefault(),me.stopPropagation();const Je=we(me.touches[0],ie),xt=Ie.row*P.cols+Ie.col,Rt=Je.row*P.cols+Je.col,an=xt<=Rt?Ie:Je;P.select(an.col,an.row,Math.abs(Rt-xt)+1),je(Je);return}if(B.current&&Ie&&me.touches.length===1){me.preventDefault(),me.stopPropagation();const Je=ve(me.touches[0]),xt=Ie.row*P.cols+Ie.col,Rt=Je.row*P.cols+Je.col,an=xt<=Rt?Ie:Je;P.select(an.col,an.row,Math.abs(Rt-xt)+1);return}if(rt===null||me.touches.length!==1)return;me.preventDefault(),me.stopPropagation();const Fe=me.touches[0];if(KC(ot,ut,Fe.clientX,Fe.clientY)&&(dt=!0,I=null,ue&&W()),ze===null&&(Math.abs(Fe.clientY-rt)>8||Math.abs(Fe.clientX-ct)>8)&&(ze=Math.abs(Fe.clientY-rt)>Math.abs(Fe.clientX-ct)),!ze)return;const Ge=Fe.clientY-rt;rt=Fe.clientY,xe=Et(Ge,xe,"scroll")},Oe=()=>{W(),rt=null,ct=null,ot=null,ut=null,Ie=null,Y=!1,dt=!1,le=!1,ie=0,E(null),xe={mode:null,remainder:0}},_n=me=>{if(le){I=null,W(),(!me.touches||me.touches.length===0)&&Oe();return}const Fe=me.changedTouches&&me.changedTouches[0];if(!dt&&!Y&&!B.current&&Fe){const Ge={at:Date.now(),x:Fe.clientX,y:Fe.clientY},Je=QC(V.current,I,Ge);I=Je.next,Je.open&&Z()}Oe()},bt=()=>{I=null,Oe()};let Ye={mode:null,remainder:0};const Gt=me=>{me.preventDefault(),me.stopPropagation(),Ye=Et(-me.deltaY,Ye,"scroll")};Se.addEventListener("touchstart",st,{passive:!1}),Se.addEventListener("touchmove",It,{passive:!1,capture:!0}),Se.addEventListener("touchend",_n,{passive:!0}),Se.addEventListener("touchcancel",bt,{passive:!0});const Hn=()=>{!B.current&&V.current==="double-tap"&&Z()};Se.addEventListener("dblclick",Hn);const li=me=>{(B.current||Y)&&(me.preventDefault(),me.stopPropagation())};Se.addEventListener("contextmenu",li,!0),Se.addEventListener("wheel",Gt,{passive:!1,capture:!0});let de=null;const Ne=me=>{HC(me)&&(me.preventDefault(),me.stopPropagation(),de=se(me.clientX,me.clientY),P.clearSelection())},Ke=me=>{if(!de)return;me.preventDefault(),me.stopPropagation();const Fe=se(me.clientX,me.clientY),Ge=de.row*P.cols+de.col,Je=Fe.row*P.cols+Fe.col,xt=Ge<=Je?de:Fe;P.select(xt.col,xt.row,Math.abs(Je-Ge)+1)},Nt=me=>{de&&(me.stopPropagation(),de=null)};Se.addEventListener("mousedown",Ne,!0),Se.addEventListener("mousemove",Ke,!0),Se.addEventListener("mouseup",Nt,!0);const pt=me=>{!WC(me)||!(R.current&&R.current.term&&R.current.term.getSelection())||(me.preventDefault(),me.stopPropagation(),O.current&&O.current())};Se.addEventListener("keydown",pt,!0);const Wn=()=>{$.fit(),pe.resize(P.cols,P.rows)};window.addEventListener("resize",Wn);const hn=window.visualViewport;let Or=hn&&Number(hn.height);const Ii=()=>{const me=hn&&Number(hn.height);q&&V.current==="double-tap"&&Number.isFinite(Or)&&Number.isFinite(me)&&me>Or+80&&T(),Or=me,Wn()};hn&&(hn.addEventListener("resize",Ii),hn.addEventListener("scroll",Wn));const Xt=typeof navigator<"u"?navigator.virtualKeyboard:null,_s=()=>{var me;q&&V.current==="double-tap"&&Number(((me=Xt==null?void 0:Xt.boundingRect)==null?void 0:me.height)||0)===0&&T()};(Go=Xt==null?void 0:Xt.addEventListener)==null||Go.call(Xt,"geometrychange",_s);let Bi=null,ys=0;return typeof ResizeObserver<"u"&&(Bi=new ResizeObserver(()=>{ys&&cancelAnimationFrame(ys),ys=requestAnimationFrame(Wn)}),Bi.observe(Se)),()=>{var me;R.current=null,u&&(u.current=()=>!1),h&&(h.current=()=>!1),f&&(f.current=()=>!1),ne.dispose(),fe.dispose(),Se.removeEventListener("touchstart",st),Se.removeEventListener("touchmove",It,{capture:!0}),Se.removeEventListener("touchend",_n),Se.removeEventListener("touchcancel",bt),Se.removeEventListener("dblclick",Hn),Se.removeEventListener("contextmenu",li,!0),W(),Se.removeEventListener("wheel",Gt,{capture:!0}),Se.removeEventListener("mousedown",Ne,!0),Se.removeEventListener("mousemove",Ke,!0),Se.removeEventListener("mouseup",Nt,!0),Se.removeEventListener("keydown",pt,!0),Se.removeEventListener("paste",He,!0),Se.removeEventListener("dragenter",vt,!0),Se.removeEventListener("dragover",vt,!0),Se.removeEventListener("drop",Xe,!0),window.removeEventListener("resize",Wn),hn&&(hn.removeEventListener("resize",Ii),hn.removeEventListener("scroll",Wn)),(me=Xt==null?void 0:Xt.removeEventListener)==null||me.call(Xt,"geometrychange",_s),ae==null||ae.removeEventListener("blur",he),Bi&&Bi.disconnect(),ys&&cancelAnimationFrame(ys),pe.close(),P.dispose()}},[e,t,n,r,o,u,h,f,p,v,x]),c.jsxs("div",{className:`nc-terminal${S?" selecting":""}`,children:[c.jsx("div",{className:"nc-terminal-host",ref:C}),M&&c.jsx("div",{className:"nc-touch-selection-caret",style:M,"aria-hidden":"true"}),X&&c.jsx("div",{className:`nc-upload-state${X.error?" error":""}`,role:"status",children:X.error?X.error:X.done?g("attach-uploaded").replace("{n}",String(X.total||0)):g("attach-upload-progress").replace("{n}",String(X.current||0)).replace("{total}",String(X.total||0))}),(G||S)&&c.jsxs("div",{className:"nc-selection-tools",children:[G?c.jsx("button",{type:"button",onClick:D,children:te||g("copy")}):c.jsx("span",{children:g("select-drag")}),c.jsx("button",{type:"button",onClick:()=>{var P,$;($=(P=R.current)==null?void 0:P.term)==null||$.clearSelection(),z(""),y==null||y(!1)},children:g("cancel")}),te===g("copy-manual")&&c.jsx("textarea",{readOnly:!0,value:G,onFocus:P=>P.target.select()})]})]})}const bv="",gt="\x1B",oE=[{label:"↑",seq:gt+"[A"},{label:"↓",seq:gt+"[B"},{label:"PGUP",seq:gt+"[5~"},{label:"PGDN",seq:gt+"[6~"}],aE=new Set([gt+"[A",gt+"[B",gt+"[C",gt+"[D",gt+"[5~",gt+"[6~"]),lE=350,cE=55;function uE({send:e,action:t,ctrlArmed:n=!1,onCtrl:r,onKeyboard:o,selectionMode:a=!1,onSelectionMode:u,onCellSwitcher:h,cellSwitcherOpen:f=!1,keepKeyboardClosed:p=!0,showEnter:v=!0,keybarLayout:x="full"}){const[w,S]=N.useState(!1),[y,b]=N.useState(!1),[C,R]=N.useState(!1),[k,F]=N.useState(!1),B=x==="compact"&&!k,V=N.useRef({delay:null,interval:null}),G=N.useRef(()=>{}),z=()=>{const q=V.current;q.delay!==null&&clearTimeout(q.delay),q.interval!==null&&clearInterval(q.interval),q.delay=null,q.interval=null};G.current=z,N.useEffect(()=>{const q=()=>{document.visibilityState==="hidden"&&G.current()},I=()=>G.current();return window.addEventListener("blur",I),document.addEventListener("visibilitychange",q),()=>{window.removeEventListener("blur",I),document.removeEventListener("visibilitychange",q),G.current()}},[]),N.useEffect(()=>{x!=="compact"&&F(!1)},[x]);const te=q=>{C?(e(gt+q),R(!1)):e(q)},H=q=>{p&&yh(),q()},X=q=>({onPointerDown:I=>{I.preventDefault(),H(q)},onClick:I=>{I.detail===0&&H(q)}}),A=q=>({onPointerDown:I=>{I.preventDefault(),z(),H(q),!C&&(V.current.delay=setTimeout(()=>{V.current.delay=null,q(),V.current.interval=setInterval(q,cE)},lE))},onPointerUp:z,onPointerLeave:z,onPointerCancel:z,onLostPointerCapture:z,onTouchCancel:z,onClick:I=>{I.detail===0&&H(q)}}),M=(q,I,T)=>c.jsx("button",{type:"button",...aE.has(I)&&!T?A(()=>te(I)):X(()=>{te(I),T&&T()}),children:q},q),E=(q,I)=>c.jsx("button",{type:"button",...X(()=>{t(I),b(!1)}),children:q},q),D=h?c.jsx("button",{type:"button","aria-label":g("fleet-cells"),title:g("fleet-cells"),"aria-expanded":f,...X(h),children:"◫"},"cells"):c.jsx("button",{type:"button",...X(()=>{o&&o()}),children:"⌨"},"kbd"),O=v&&c.jsx("button",{type:"button",className:"nc-enter-key","aria-label":"ENTER",title:"ENTER",...X(()=>te("\r")),children:c.jsx(it,{name:"enter",size:24})}),P=y&&c.jsxs("div",{className:"nc-keymenu",children:[E("←WIN","prev-window"),E("WIN→","next-window"),E("⬅PANE","pane-left"),E("PANE➡","pane-right"),M("SCROLL",bv+"[",()=>{S(!0),b(!1)}),c.jsx("button",{type:"button",className:a?"armed":"",...X(()=>{u==null||u(!a),b(!1)}),children:"SELECT"}),M("⌃C","",()=>b(!1)),M("DETACH",bv+"d",()=>b(!1))]});if(w)return c.jsxs("div",{className:"nc-keybar copy",children:[c.jsx("span",{className:"tag",children:"copy-mode"}),oE.map(q=>M(q.label,q.seq)),M("ESCI (q)","q",()=>S(!1))]});if(B)return c.jsxs("div",{className:"nc-keybar termux",children:[P,c.jsxs("div",{className:`nc-keygrid compact${v?"":" no-enter"}`,children:[c.jsx("div",{className:"nc-keyrows",children:c.jsxs("div",{className:"row",children:[c.jsx("button",{type:"button","aria-label":"expand keybar",title:"expand",...X(()=>F(!0)),children:c.jsx(it,{name:"chevronUp",size:20})},"expand"),D,c.jsx("button",{type:"button",className:y?"armed":"",...X(()=>b(q=>!q)),children:"☰"},"menu"),M("↑",gt+"[A"),M("↓",gt+"[B"),M("←",gt+"[D"),M("→",gt+"[C"),M("PGUP",gt+"[5~"),M("PGDN",gt+"[6~")]})}),O]})]});const $=x==="compact"&&k,L=$&&c.jsx("button",{type:"button",className:"nc-retract-key","aria-label":"retract keybar",title:"retract",...X(()=>F(!1)),children:c.jsx(it,{name:"chevronDown",size:20})});return c.jsxs("div",{className:`nc-keybar termux${$?" expanded":""}`,children:[P,c.jsxs("div",{className:`nc-keygrid${v?"":" no-enter"}${$?" expanded":""}`,children:[L,c.jsxs("div",{className:"nc-keyrows",children:[c.jsxs("div",{className:"row",children:[M("ESC",gt),c.jsx("button",{type:"button",className:y?"armed":"",...X(()=>b(q=>!q)),children:"☰"},"menu"),M("/","/"),M("—","-"),M("HOME",gt+"[H"),M("↑",gt+"[A"),M("END",gt+"[F"),M("PGUP",gt+"[5~")]}),c.jsxs("div",{className:"row",children:[M("⇥"," "),D,c.jsx("button",{type:"button",className:n?"armed":"",...X(()=>{r&&r()}),children:"CTRL"},"ctrl"),c.jsx("button",{type:"button",className:C?"armed":"",...X(()=>R(q=>!q)),children:"ALT"},"alt"),M("←",gt+"[D"),M("↓",gt+"[B"),M("→",gt+"[C"),M("PGDN",gt+"[6~")]})]}),O]})]})}const dE=e=>e>1048576?`${(e/1048576).toFixed(1)}M`:e>1024?`${(e/1024).toFixed(0)}K`:`${e}B`;function Zy({session:e,node:t,token:n,filesEvent:r,onClose:o}){$n();const a=t?`/api/route/${String(t).split("/").map(encodeURIComponent).join("/")}/_`:"/api",u=t?`${t}:${e}`:e,[h,f]=N.useState("outbox"),[p,v]=N.useState({inbox:[],outbox:[]}),[x,w]=N.useState(""),S=N.useRef(null);async function y(){try{const F=await(await Vt(`${a}/files?session=${encodeURIComponent(e)}`,n)).json();if(F.error){w(F.error);return}v(F);const B=F.outbox[0]?F.outbox[0].mtime:0;localStorage.setItem(D_(u),String(B))}catch(k){w(String(k))}}N.useEffect(()=>{y()},[e,t]),N.useEffect(()=>{r&&r.session===e&&y()},[r]);async function b(k){for(const F of k){w(`carico ${F.name}…`);const B=new FormData;B.append("session",e),B.append("file",F);try{const G=await(await Vt(`${a}/files/upload`,n,{method:"POST",body:B})).json();w(G.error?`errore: ${G.error}`:"")}catch(V){w(String(V))}}y()}async function C(k){const F=await Vt(`${a}/files/download?session=${encodeURIComponent(e)}&box=${h}&name=${encodeURIComponent(k)}`,n);if(!F.ok){w("errore download");return}const B=await F.blob(),V=URL.createObjectURL(B),G=document.createElement("a");G.href=V,G.download=k,G.click(),URL.revokeObjectURL(V)}async function R(k){await Vt(`${a}/files?session=${encodeURIComponent(e)}&box=${h}&name=${encodeURIComponent(k)}`,n,{method:"DELETE"}),y()}return c.jsxs("div",{className:"nc-files",children:[c.jsxs("header",{children:[c.jsx("b",{children:t?`${t}:${e}`:e}),c.jsx("button",{onClick:o,title:g("close"),children:c.jsx(it,{name:"x",size:20})})]}),c.jsxs("nav",{children:[c.jsx("button",{className:h==="outbox"?"on":"",onClick:()=>f("outbox"),children:"outbox"}),c.jsx("button",{className:h==="inbox"?"on":"",onClick:()=>f("inbox"),children:"inbox"}),c.jsxs("button",{className:"up",onClick:()=>S.current&&S.current.click(),children:[c.jsx(it,{name:"upload",size:18})," ",g("upload")]}),c.jsx("input",{type:"file",multiple:!0,ref:S,style:{display:"none"},onChange:k=>{b(Array.from(k.target.files||[])),k.target.value=""}})]}),x&&c.jsx("div",{className:"nc-busy",children:x}),c.jsxs("ul",{children:[p[h].map(k=>c.jsxs("li",{children:[c.jsx("span",{className:"name",onClick:()=>C(k.name),children:k.name}),c.jsx("small",{children:dE(k.size)}),c.jsx("button",{onClick:()=>R(k.name),title:"elimina",children:c.jsx(it,{name:"trash",size:18})})]},k.name)),p[h].length===0&&c.jsx("li",{className:"empty",children:g("empty-files")})]})]})}const ql="nc_composer_v1",wh="nc-composer-reset",hE=50,ew=256*1024,tw=512*1024,fE=768*1024,xv=2*1024*1024,nw=720*60*60*1e3,Sh=1;function iw(e){const t=Number(e);return Number.isFinite(t)&&t>0?t:0}function nf(e){if(e!==void 0)return e;try{return typeof localStorage<"u"?localStorage:null}catch{return null}}function Ol(){return{version:Sh,cells:{}}}function sw(e){const t=[];for(const r of Array.isArray(e)?e:[]){const o=typeof r=="string"?r:r&&r.text,a=iw(typeof r=="string"?0:r&&r.at);if(!(typeof o!="string"||!o||o.length>ew)&&!(t.length&&t[t.length-1].text===o)&&(t.push({text:o,at:a}),t.length>=hE))break}let n=0;return t.filter(r=>n+r.text.length>fE?!1:(n+=r.text.length,!0))}function zl(e){if(!e||typeof e!="object")return null;const t=typeof e.draft=="string"&&e.draft.length<=tw?e.draft:"",n=sw(e.history),r=iw(e.updatedAt),o=e.expanded===!0;return!t&&!n.length&&!o?null:{draft:t,history:n,expanded:o,updatedAt:r}}function pE(e){let t;try{t=typeof e=="string"?JSON.parse(e):e}catch{return Ol()}if(!t||typeof t!="object"||t.version!==Sh||!t.cells||typeof t.cells!="object")return Ol();const n=Object.create(null);for(const[r,o]of Object.entries(t.cells)){if(!r||typeof r!="string"||r.length>512||r==="__proto__"||r==="constructor"||r==="prototype")continue;const a=zl(o);a&&(n[r]=a)}return{version:Sh,cells:n}}function rw(e){const t=nf(e);if(!t)return Ol();try{return pE(t.getItem(ql))}catch{return Ol()}}function kv(e){try{return JSON.stringify(e).length}catch{return 1/0}}function mE(e,t,n){for(const[r,o]of Object.entries(e.cells))r!==n&&o.updatedAt>0&&t-o.updatedAt>nw&&delete e.cells[r]}function ow(e,t){return Object.entries(e.cells).filter(([n])=>n!==t).sort((n,r)=>n[1].updatedAt-r[1].updatedAt).map(([n])=>n)}function gE(e,t){for(;kv(e)>xv;){const n=Object.entries(e.cells).filter(([,r])=>r.history.length).sort((r,o)=>r[1].updatedAt-o[1].updatedAt);if(!n.length)break;n[0][1].history.pop()}for(const n of ow(e,t)){if(kv(e)<=xv)break;delete e.cells[n]}}function aw(e,t,n){const r=nf(e);if(!r)return!1;gE(t,n);const o=()=>(r.setItem(ql,JSON.stringify(t)),!0);try{return o()}catch{for(const u of ow(t,n)){delete t.cells[u];try{return o()}catch{}}return!1}}function Vo(e,t,n,r){const o=rw(t);mE(o,n,e);const a=zl(o.cells[e])||{draft:"",history:[],expanded:!1,updatedAt:0},u=r({...a,history:[...a.history]}),h=zl(u);return h?o.cells[e]={...h,updatedAt:n}:delete o.cells[e],{ok:aw(t,o,e),cell:o.cells[e]||{draft:"",history:[],expanded:!1,updatedAt:n}}}function vE({ownerId:e,node:t,session:n}){const r=String(n||"");if(!r)return"";const o=Rr.test(String(e||""))?String(e):t?`route:${String(t)}`:"local";return`${encodeURIComponent(o)}:${encodeURIComponent(r)}`}function Eo(e,t,n=Date.now()){if(!e)return{draft:"",history:[],expanded:!1,updatedAt:0};const r=rw(t),o=zl(r.cells[e]);return!o||o.updatedAt>0&&n-o.updatedAt>nw?(r.cells[e]&&(delete r.cells[e],aw(t,r,"")),{draft:"",history:[],expanded:!1,updatedAt:0}):{...o,history:[...o.history]}}function Cv(e,t,n,r=Date.now()){const o=String(t||"");return!e||o.length>tw?!1:Vo(e,n,r,a=>({...a,draft:o})).ok}function Ev(e,t,n=Date.now()){return e?Vo(e,t,n,r=>({...r,draft:""})).ok:!1}function _E(e,t,n,r=Date.now()){return e?Vo(e,n,r,o=>({...o,expanded:!!t})).ok:!1}function yE(e,t,n,r=Date.now()){const o=String(t||"");return!e||!o||o.length>ew?!1:Vo(e,n,r,a=>{const u=a.history.filter(h=>h.text!==o);return u.unshift({text:o,at:r}),{...a,history:sw(u)}}).ok}function wE(e,t,n=Date.now()){return e?Vo(e,t,n,r=>({...r,history:[]})).ok:!1}function SE(e){const t=nf(e);if(!t)return!1;try{return t.removeItem(ql),!0}catch{return!1}}const bE=300;function xE(){try{return typeof localStorage<"u"?localStorage:null}catch{return null}}function kE({ownerId:e,node:t,session:n,storage:r=xE()}){const o=N.useMemo(()=>vE({ownerId:e,node:t,session:n}),[e,t,n]),a=N.useMemo(()=>Eo(o,r),[]),[u,h]=N.useState(a.draft),[f,p]=N.useState(a.expanded),[v,x]=N.useState(a.history),[w,S]=N.useState(-1),y=N.useRef(o),b=N.useRef(a.draft),C=N.useRef(null),R=N.useRef(a.updatedAt||0),k=N.useRef(a.draft),F=N.useCallback(()=>{C.current&&clearTimeout(C.current),C.current=null},[]),B=N.useCallback(()=>{F(),Cv(y.current,b.current,r)},[F,r]),V=N.useCallback(()=>{F(),C.current=setTimeout(()=>{C.current=null,Cv(y.current,b.current,r)},bE)},[F,r]),G=N.useCallback(D=>{const O=String(typeof D=="function"?D(b.current):D||"");b.current=O,R.current=Date.now(),k.current=O,S(-1),h(O),V()},[V]),z=N.useCallback((D,O)=>{F(),b.current=D,R.current=Date.now(),h(D),S(O),V()},[F,V]),te=N.useCallback(()=>{if(!v.length)return!1;const D=Math.min(w+1,v.length-1);return w<0&&(k.current=b.current),z(v[D].text,D),!0},[z,v,w]),H=N.useCallback(()=>{if(w<0)return!1;const D=w-1;return z(D<0?k.current:v[D].text,D),!0},[z,v,w]),X=N.useCallback(D=>{k.current=b.current;const O=v.findIndex(P=>P.text===D);z(String(D||""),O)},[z,v]),A=N.useCallback(()=>{p(D=>{const O=!D;return _E(y.current,O,r),O})},[r]),M=N.useCallback((D,O,P)=>{if(!D)return;if(yE(D,P,r),!(y.current===D)){Eo(D,r).draft===O&&Ev(D,r);return}x(Eo(D,r).history),k.current="",S(-1),b.current===O?(F(),b.current="",R.current=Date.now(),h(""),Ev(D,r)):V()},[F,V,r]),E=N.useCallback(()=>{wE(y.current,r),x([]),S(-1),k.current=b.current},[r]);return N.useEffect(()=>{if(y.current===o)return;B(),y.current=o;const D=Eo(o,r);b.current=D.draft,R.current=D.updatedAt||0,k.current=D.draft,h(D.draft),p(D.expanded),x(D.history),S(-1)},[o,B,r]),N.useEffect(()=>{const D=()=>B(),O=()=>{document.visibilityState==="hidden"&&B()};return window.addEventListener("pagehide",D),document.addEventListener("visibilitychange",O),()=>{window.removeEventListener("pagehide",D),document.removeEventListener("visibilitychange",O),B()}},[B]),N.useEffect(()=>{const D=()=>{F(),b.current="",R.current=0,k.current="",h(""),p(!1),x([]),S(-1)},O=$=>{if($.key!==ql)return;if($.newValue==null){D();return}const L=Eo(y.current,r);L.updatedAt<R.current||(F(),b.current=L.draft,R.current=L.updatedAt,k.current=L.draft,h(L.draft),p(L.expanded),x(L.history),S(-1))},P=()=>D();return window.addEventListener("storage",O),window.addEventListener(wh,P),()=>{window.removeEventListener("storage",O),window.removeEventListener(wh,P)}},[F,r]),{cellKey:o,text:u,setText:G,expanded:f,toggleExpanded:A,history:v,historyCursor:w,recallPrevious:te,recallNext:H,selectHistory:X,confirmSubmitted:M,clearHistory:E,flush:B}}function lw({submitText:e,token:t,session:n,node:r,ownerId:o,keepKeyboardClosedOnVoice:a=!0}){$n();const u=r?`/api/route/${String(r).split("/").map(encodeURIComponent).join("/")}/_`:"/api",{cellKey:h,text:f,setText:p,expanded:v,toggleExpanded:x,history:w,historyCursor:S,recallPrevious:y,recallNext:b,selectHistory:C,confirmSubmitted:R,clearHistory:k,flush:F}=kE({ownerId:o,node:r,session:n}),[B,V]=N.useState(!1),[G,z]=N.useState(""),[te,H]=N.useState(!1),X=N.useRef(null),A=N.useRef(null),M=N.useRef(null),[E,D]=N.useState(!1),[O,P]=N.useState({left:0,bottom:0}),[$,L]=N.useState(!1),[q,I]=N.useState(!1),T=N.useRef(null),U=N.useRef(null),Z=N.useRef(null),ae=N.useRef(null),he=N.useRef(null),pe=N.useRef(null),Q=N.useRef(null),ne=N.useRef(!1),[fe,Se]=N.useState(!1),[Ze,$e]=N.useState({left:0,bottom:0,width:320}),He=N.useRef(`nc-attach-${Math.random().toString(36).slice(2,8)}`);N.useEffect(()=>{let ue=!1;if(r){H(!1);return}return Vt(`${u}/voice/status`,t).then(Y=>Y.json()).then(Y=>{ue||H(!!Y.serverSttConfigured)}).catch(()=>{ue||H(!1)}),()=>{ue=!0}},[t,u]);const Xe=!!(typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)||te);async function St(){const ue=M.current&&typeof M.current.value=="string"?M.current.value:f;yh(),ue!==f&&p(ue);const Y=ue,ie=FC(Y);if(!ie||q)return;I(!0),z("");let W=!1;try{W=!!await e(ie)}catch{W=!1}W?R(h,Y,ie):z(g("composer-send-failed")),I(!1)}function Et(){const ue=T.current&&T.current.getBoundingClientRect();ue&&P({left:Math.max(6,Math.min(ue.left,window.innerWidth-186)),bottom:window.innerHeight-ue.top+6}),D(!0)}function rt(ue){D(!1),ue&&T.current&&T.current.focus()}function ct(){const ue=Z.current&&Z.current.getBoundingClientRect();if(ue){const Y=Math.max(220,Math.min(360,window.innerWidth-12));$e({left:Math.max(6,Math.min(ue.right-Y,window.innerWidth-Y-6)),bottom:window.innerHeight-ue.top+6,width:Y})}Se(!0)}function ot(ue){Se(!1),ue&&Z.current&&Z.current.focus()}N.useEffect(()=>{if(!E)return;const ue=ie=>{ie.key==="Escape"&&rt(!0)},Y=ie=>{const W=U.current&&U.current.contains(ie.target),se=T.current&&T.current.contains(ie.target);!W&&!se&&rt(!1)};return document.addEventListener("keydown",ue),document.addEventListener("pointerdown",Y),()=>{document.removeEventListener("keydown",ue),document.removeEventListener("pointerdown",Y)}},[E]),N.useEffect(()=>{if(!fe)return;const ue=ie=>{ie.key==="Escape"&&ot(!0)},Y=ie=>{const W=ae.current&&ae.current.contains(ie.target),se=Z.current&&Z.current.contains(ie.target);!W&&!se&&ot(!1)};return document.addEventListener("keydown",ue),document.addEventListener("pointerdown",Y),()=>{document.removeEventListener("keydown",ue),document.removeEventListener("pointerdown",Y)}},[fe]);function ut(ue){if(!(ue.isComposing||ne.current||ue.altKey||ue.ctrlKey||ue.metaKey)){if(ue.key==="ArrowUp"&&ue.currentTarget.selectionStart===0&&ue.currentTarget.selectionEnd===0){y()&&ue.preventDefault();return}ue.key==="ArrowDown"&&S>=0&&ue.currentTarget.selectionStart===f.length&&ue.currentTarget.selectionEnd===f.length&&b()&&ue.preventDefault()}}function dt(ue){rt(!1),ue.current&&ue.current.click()}async function le(ue){if(!ue.length||!n)return;L(!0),z("");const{paths:Y,errors:ie}=await Gy({files:ue,token:t,session:n,node:r,paste:!1});ie.length&&z(ie.map(W=>`${W.name}: ${W.message}`).join(" · ")),Y.length&&p(W=>W+(W&&!W.endsWith(" ")?" ":"")+Y.join(" ")),L(!1)}function xe(){X.current&&X.current.stop(),A.current&&A.current.stop(),V(!1)}async function ze(){z("");const ue=window.SpeechRecognition||window.webkitSpeechRecognition;if(ue){const Y=new ue;Y.lang="it-IT",Y.continuous=!1,Y.interimResults=!0;const ie=f?`${f} `:"";Y.onresult=W=>{const se=Array.from(W.results).map(ve=>ve[0].transcript).join("");p(ie+se)},Y.onend=()=>V(!1),Y.onerror=W=>{z(`voice: ${W.error||"errore"}`),V(!1)},X.current=Y,Y.start(),V(!0);return}try{const Y=await navigator.mediaDevices.getUserMedia({audio:!0}),ie=new MediaRecorder(Y),W=[];ie.ondataavailable=se=>W.push(se.data),ie.onstop=async()=>{Y.getTracks().forEach(se=>se.stop()),V(!1),z("trascrivo…");try{const se=new Blob(W,{type:ie.mimeType||"audio/webm"}),ke=await(await Vt(`${u}/voice/transcribe`,t,{method:"POST",headers:{"content-type":"application/octet-stream"},body:se})).json();ke.error?z(ke.error):(z(""),p(Re=>Re+(Re?" ":"")+(ke.text||"")))}catch(se){z(String(se))}},A.current={stop:()=>ie.state!=="inactive"&&ie.stop()},ie.start(),V(!0)}catch{z("microfono non disponibile"),V(!1)}}function Ie(){a&&yh(),B?xe():ze()}return c.jsxs("div",{className:"nc-composer",children:[G&&c.jsx("div",{className:"nc-composer-err",children:G}),c.jsxs("div",{className:"nc-composer-row",children:[n&&c.jsx("button",{ref:T,className:$?"attach busy":"attach",disabled:$,onClick:()=>E?rt(!1):Et(),title:g($?"attach-uploading":"attach"),"aria-label":g("attach"),"aria-haspopup":"menu","aria-expanded":E,"aria-controls":He.current,children:c.jsx(it,{name:"attach",size:22})}),E&&c.jsxs("div",{ref:U,id:He.current,role:"menu",className:"nc-attach-menu",style:{left:O.left,bottom:O.bottom},children:[c.jsxs("button",{role:"menuitem",onClick:()=>dt(he),children:[c.jsx(it,{name:"file",size:18})," ",g("attach-file")]}),c.jsxs("button",{role:"menuitem",onClick:()=>dt(pe),children:[c.jsx(it,{name:"camera",size:18})," ",g("attach-camera")]}),c.jsxs("button",{role:"menuitem",onClick:()=>dt(Q),children:[c.jsx(it,{name:"image",size:18})," ",g("attach-gallery")]})]}),c.jsx("button",{ref:Z,type:"button",className:"history",onPointerDown:ue=>ue.preventDefault(),onClick:()=>fe?ot(!1):ct(),title:g("composer-history-tools"),"aria-label":g("composer-history-tools"),"aria-haspopup":"menu","aria-expanded":fe,children:c.jsx(it,{name:"history",size:21})}),fe&&c.jsxs("div",{ref:ae,role:"menu",className:"nc-composer-history-menu",style:{left:Ze.left,bottom:Ze.bottom,width:Ze.width},children:[c.jsxs("button",{role:"menuitem",className:"nc-composer-history-action",onPointerDown:ue=>ue.preventDefault(),onClick:()=>{x(),ot(!1)},children:[c.jsx(it,{name:v?"chevronDown":"chevronUp",size:18}),g(v?"composer-collapse":"composer-expand")]}),c.jsx("div",{className:"nc-composer-history-title",children:g("composer-history")}),w.length===0&&c.jsx("div",{className:"nc-composer-history-empty",children:g("composer-history-empty")}),w.map((ue,Y)=>c.jsxs("button",{type:"button",role:"menuitem",className:"nc-composer-history-entry",onPointerDown:ie=>ie.preventDefault(),onClick:()=>{C(ue.text),ot(!1)},children:[c.jsx("span",{children:ue.text.replace(/\s+/g," ").slice(0,180)}),ue.at>0&&c.jsx("small",{children:new Date(ue.at).toLocaleString()})]},`${ue.at}:${Y}`)),w.length>0&&c.jsx("button",{type:"button",role:"menuitem",className:"nc-composer-history-clear",onPointerDown:ue=>ue.preventDefault(),onClick:()=>{k(),ot(!1)},children:g("composer-history-clear")})]}),c.jsx("input",{ref:he,type:"file",multiple:!0,hidden:!0,onChange:ue=>{le(Array.from(ue.target.files||[])),ue.target.value=""}}),c.jsx("input",{ref:pe,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:ue=>{le(Array.from(ue.target.files||[])),ue.target.value=""}}),c.jsx("input",{ref:Q,type:"file",accept:"image/*,video/*",multiple:!0,hidden:!0,onChange:ue=>{le(Array.from(ue.target.files||[])),ue.target.value=""}}),c.jsx("textarea",{ref:M,className:v?"expanded":"",rows:v?8:2,value:f,placeholder:g("composer-placeholder"),onChange:ue=>p(ue.target.value),onKeyDown:ut,onCompositionStart:()=>{ne.current=!0},onCompositionEnd:()=>{ne.current=!1},onBlur:F}),Xe&&c.jsx("button",{type:"button",className:B?"mic on":"mic",title:g("voice"),"aria-label":g("voice"),onPointerDown:ue=>{ue.preventDefault(),Ie()},onClick:ue=>{ue.detail===0&&Ie()},children:c.jsx(it,{name:"mic",size:22})}),c.jsx("button",{type:"button",className:"go",disabled:q,onPointerDown:ue=>ue.preventDefault(),onClick:St,title:g("send"),children:c.jsx(it,{name:"enter",size:22})})]})]})}function Nv(e){return String(e||"?").replace(/^[^a-zA-Z0-9]+/,"").charAt(0).toUpperCase()||"?"}const CE=180,EE=480,wr=(e,t=[])=>`${t.length?t.join("/"):"local"}:${e}`;function NE({sessions:e=[],cells:t=[],activeSessions:n=[],nodeGroups:r=[],onPick:o,onAddTile:a,onPower:u,onBoot:h,onNodePower:f,onKill:p,onVisibility:v,onNew:x,onNodeRename:w,onSettings:S,onBootError:y,localNodeId:b,fleetCapabilities:C=[],bootSettlement:R=null,onBootSettlementApplied:k,width:F=240,collapsed:B=!1,onResize:V,onToggleCollapse:G}){const[z,te]=$n(),{pins:H,orders:X,togglePin:A,viewFor:M,updateView:E,canMoveRoster:D,moveRoster:O,stepRoster:P}=V_(),{groupsFor:$,moveNode:L,stepNode:q,nodeKey:I}=G_(),T=new Set((t||[]).map(Y=>Y.tmuxSession)),U=new Map((e||[]).map(Y=>[Y.name,Y])),Z=(Y,ie)=>Z0(H,Y,ie),ae=e1,he=[...t||[]].sort((Y,ie)=>ae(Z(Y.tmuxSession,(U.get(Y.tmuxSession)||{}).activity),Z(ie.tmuxSession,(U.get(ie.tmuxSession)||{}).activity))),pe=(e||[]).filter(Y=>!T.has(Y.name)).sort((Y,ie)=>ae(Z(Y.name,Y.activity),Z(ie.name,ie.activity))||Y.name.localeCompare(ie.name)),Q=new Set(n||[]),ne=Q_(he,pe,U),fe=Fs(ne,H,M("local").filter,fs(X,"local")),Ze=$(r||[]).map(Y=>{const ie=(Y.route||[Y.name]).join("/"),W=M(ie),{rawItems:se}=Td(Y),ve=Fs(se,H,W.filter,fs(X,ie));return{g:Y,nodeRoute:ie,groupView:W,rawItems:se,items:ve}}),$e=(Y,ie,W)=>o&&o({session:Y,...ie?{node:ie}:{},...Rr.test(String(W||""))?{ownerId:W}:{}}),He=async Y=>{if(!(Y!=null&&Y.direct)||!w)return;const ie=window.prompt(g("rename-node-prompt"),Y.label||Y.name);if(ie!==null)try{await w(Y,ie)||window.alert(g("rename-node-invalid"))}catch(W){window.alert(String((W==null?void 0:W.message)||W))}},[vt,Xe]=N.useState({}),[St,Et]=N.useState(new Set);N.useEffect(()=>{const Y=new Map;for(const ie of t||[])Y.set(wr(ie.cell),!!ie.boot);for(const ie of r||[]){const W=ie.route||[ie.name];for(const se of ie.cells||[])Y.set(wr(se.cell,W),!!se.boot)}Xe(ie=>{let W=!1;const se={...ie};for(const[ve,ke]of Object.entries(ie))Y.has(ve)&&Y.get(ve)===ke&&(delete se[ve],W=!0);return W?se:ie})},[t,r]),N.useEffect(()=>{if(!(R!=null&&R.cell))return;const Y=Array.isArray(R.route)?R.route:[],ie=wr(R.cell,Y);Xe(W=>({...W,[ie]:!!R.enabled})),k&&k(R.id)},[R,k]);const rt=(Y,ie=[])=>{const W=wr(Y.cell,ie);return Object.prototype.hasOwnProperty.call(vt,W)?vt[W]:!!Y.boot},ct=async(Y,ie,W=[])=>{if(Y.stopPropagation(),!h)return;const se=wr(ie.cell,W),ve=!rt(ie,W);Xe(ke=>({...ke,[se]:ve})),Et(ke=>new Set(ke).add(se));try{await h(ie.cell,ve,W)}catch(ke){Xe(Re=>{const we={...Re};return delete we[se],we}),y&&y(ke)}finally{Et(ke=>{const Re=new Set(ke);return Re.delete(se),Re})}},ot=(Y,ie=[])=>{const W=wr(Y.cell,ie),se=rt(Y,ie),ve=`${g(se?"boot-disable":"boot-enable")} ${Y.cell}`;return c.jsx("button",{className:`nc-boot${se?" on":""}`,disabled:St.has(W),onClick:ke=>ct(ke,Y,ie),title:ve,"aria-label":ve,children:c.jsx(it,{name:"boot",size:14})})},[ut,dt]=N.useState(null),le=(Y,ie)=>{const W=Y.currentTarget.getBoundingClientRect();dt({text:ie,y:W.top+W.height/2})},xe=()=>dt(null),ze=N.useRef(null);N.useEffect(()=>()=>{ze.current&&ze.current()},[]);function Ie(Y){Y.preventDefault(),Y.stopPropagation();const ie=Y.clientX,W=F,se=ke=>{const Re=Math.max(CE,Math.min(EE,W+(ke.clientX-ie)));V&&V(Re)},ve=()=>{window.removeEventListener("pointermove",se),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve),window.removeEventListener("blur",ve),ze.current=null};window.addEventListener("pointermove",se),window.addEventListener("pointerup",ve),window.addEventListener("pointercancel",ve),window.addEventListener("blur",ve),ze.current=ve}const ue=B?{width:48,flex:"0 0 48px"}:{width:F,flex:`0 0 ${F}px`};return B?c.jsxs("aside",{className:"nc-sidebar mini",style:ue,children:[c.jsx("div",{className:"nc-side-head mini",children:c.jsx("button",{className:"nc-collapse-btn",onClick:G,title:g("expand"),children:"⟩"})}),c.jsx("button",{className:"nc-side-gear mini",onClick:()=>S&&S("nodes",!1),title:g("settings"),onMouseEnter:Y=>le(Y,g("settings")),onMouseLeave:xe,children:c.jsx(it,{name:"gear",size:16})}),c.jsx("div",{className:"nc-side-scroll mini",children:c.jsxs("div",{className:"nc-side-group mini",children:[M("local").open&&fe.map(Y=>Y.type==="cell"?(()=>{const ie=Y.value,W=ie.degraded?"warn":ie.tmux?"on":"",se=!!ie.tmux;return c.jsx("button",{type:"button",className:`nc-mini-dot${Q.has(ie.tmuxSession)?" active":""}`,onMouseEnter:ve=>le(ve,`${ie.cell}: ${Y.subtitle}`),onMouseLeave:xe,draggable:se,onDragStart:se?ve=>ve.dataTransfer.setData("text/nc-session",ie.tmuxSession):void 0,onClick:se?()=>a&&a(ie.tmuxSession):()=>u&&u(ie),onDoubleClick:se?()=>$e(ie.tmuxSession,"",b):void 0,children:c.jsx("span",{className:`nc-dot ${W}${Y.working?" working":""}`})},Y.key)})():(()=>{const ie=Y.value;return c.jsx("button",{type:"button",className:`nc-mini-init${Q.has(ie.name)?" active":""}`,onMouseEnter:W=>le(W,ie.name),onMouseLeave:xe,draggable:!0,onDragStart:W=>W.dataTransfer.setData("text/nc-session",ie.name),onClick:()=>a&&a(ie.name),onDoubleClick:()=>$e(ie.name,"",b),children:Nv(ie.name)},Y.key)})()),Ze.flatMap(({g:Y,nodeRoute:ie,groupView:W,items:se})=>Y.status==="up"?W.open?se.map(ve=>ve.type==="cell"?(()=>{const ke=ve.value,Re=!!ke.tmux;return c.jsx("button",{type:"button",className:`nc-mini-dot${Q.has(ve.key)?" active":""}`,onMouseEnter:we=>le(we,`${Y.label||ie}: ${ke.cell} · ${ve.subtitle}`),onMouseLeave:xe,draggable:Re,onDragStart:Re?we=>we.dataTransfer.setData("text/nc-session",ve.key):void 0,onClick:Re?()=>a&&a(ve.key):()=>u&&u({...ke,route:Y.route,availableEngines:Y.engines||[]}),onDoubleClick:Re?()=>$e(ke.tmuxSession,ie,Y.instanceId):void 0,children:c.jsx("span",{className:`nc-dot ${ke.degraded?"warn":Re?`on${ve.working?" working":""}`:""}`})},ve.key)})():(()=>{const ke=ve.value;return c.jsx("button",{type:"button",className:`nc-mini-init${Q.has(ve.key)?" active":""}`,onMouseEnter:Re=>le(Re,`${Y.label||ie}: ${ke.name}`),onMouseLeave:xe,draggable:!0,onDragStart:Re=>Re.dataTransfer.setData("text/nc-session",ve.key),onClick:()=>a&&a(ve.key),onDoubleClick:()=>$e(ke.name,ie,Y.instanceId),children:Nv(ke.name)},ve.key)})()):[]:[c.jsx("button",{type:"button",className:"nc-mini-dot",onMouseEnter:ve=>le(ve,`${Y.label||(Y.route||[Y.name]).join(" › ")}: ${xr(Y)}`),onMouseLeave:xe,children:c.jsx("span",{className:`nc-dot${Y.status==="passive"?"":" warn"}`})},`nodo-${(Y.route||[Y.name]).join("/")}`)])]})}),ut&&c.jsx("div",{className:"nc-mini-tip",style:{top:ut.y},children:ut.text})]}):c.jsxs("aside",{className:"nc-sidebar",style:ue,children:[c.jsxs("div",{className:"nc-side-head",children:[c.jsx("button",{className:"nc-collapse-btn",onClick:G,title:g("collapse"),children:"⟨"}),c.jsx("span",{className:"nc-side-title",children:g("fleet")}),c.jsxs("button",{className:"nc-new-btn",onClick:x,title:g("fleet-new-cell"),children:["+ ",g("new")]})]}),c.jsxs("button",{className:"nc-side-gear",onClick:()=>S&&S("nodes",!1),title:g("settings"),children:[c.jsx(it,{name:"gear",size:15})," ",g("settings")]}),c.jsxs("div",{className:"nc-side-scroll",children:[c.jsx(RE,{label:g("position-local"),count:fe.length,state:M("local"),onToggle:()=>E("local",{open:!M("local").open}),onFilter:Y=>E("local",{filter:Y})}),M("local").open&&c.jsxs("div",{className:"nc-side-group",children:[fe.map(Y=>Y.type==="cell"?(()=>{const ie=Y.value,W=ie.degraded?"warn":ie.tmux?"on":"",se=ie.degraded?g("cell-degraded"):Y.working?Y.subtitle:ie.tmux?g("cell-idle"):g("cell-off"),ve=!!ie.tmux;return c.jsxs("div",{"data-roster-key":Y.key,"data-position":"local",className:`nc-cell${ve?" live":""}${Q.has(ie.tmuxSession)?" active":""}`,title:`${ie.cell} · ${Y.subtitle}${se===Y.subtitle?"":` · ${se}`}`,"aria-label":`${ie.cell}, ${Y.subtitle}${se===Y.subtitle?"":`, ${se}`}`,draggable:ve,onDragStart:ve?ke=>ke.dataTransfer.setData("text/nc-session",ie.tmuxSession):void 0,onClick:ve?()=>a&&a(ie.tmuxSession):void 0,onDoubleClick:ve?()=>$e(ie.tmuxSession,"",b):void 0,children:[c.jsx(us,{position:"local",itemKey:Y.key,label:ie.cell,canMove:D,onMove:(ke,Re)=>O("local",ke,Re,ne),onStep:ke=>P("local",Y.key,ke,ne)}),c.jsx("span",{className:`nc-dot ${W}${Y.working?" working":""}`}),c.jsxs("span",{className:"nc-cell-main",children:[c.jsx("b",{title:ie.cell,children:ie.cell}),c.jsx("small",{title:Y.subtitle,children:Y.subtitle})]}),c.jsx("button",{className:`nc-pin${H.includes(Y.key)?" on":""}`,title:g("pin"),onClick:ke=>{ke.stopPropagation(),A(Y.key)},children:H.includes(Y.key)?"★":"☆"}),h&&C.includes("boot")&&ot(ie),c.jsx("button",{className:`nc-power${ie.tmux?" on":""}${ie.degraded?" warn":""}`,onClick:ke=>{ke.stopPropagation(),u&&u({...ie,boot:rt(ie)})},title:ie.active?g("power-off"):g("power-on"),children:c.jsx(it,{name:"power",size:14})})]},Y.key)})():(()=>{var W;const ie=Y.value;return c.jsxs("div",{"data-roster-key":Y.key,"data-position":"local",className:`nc-side-card${Q.has(ie.name)?" active":""}`,draggable:!0,onDragStart:se=>se.dataTransfer.setData("text/nc-session",ie.name),onClick:()=>a&&a(ie.name),onDoubleClick:()=>$e(ie.name,"",b),children:[c.jsx(us,{position:"local",itemKey:Y.key,label:ie.name,canMove:D,onMove:(se,ve)=>O("local",se,ve,ne),onStep:se=>P("local",Y.key,se,ne)}),c.jsx("span",{className:ie.attached?"nc-dot on":"nc-dot"}),c.jsxs("span",{className:"nc-card-main",children:[c.jsx("b",{children:ie.name}),c.jsxs("small",{children:[ie.preview||ie.cmd||g("windows").replace("{n}",String(ie.windows||0)),((W=ie.outbox)==null?void 0:W.count)>0?` · 📦${ie.outbox.count}`:""]})]}),ie.activity?c.jsx("span",{className:"nc-rel",children:Nr(ie.activity)}):null,c.jsx("button",{className:`nc-pin${H.includes(Y.key)?" on":""}`,title:g("pin"),onClick:se=>{se.stopPropagation(),A(Y.key)},children:H.includes(Y.key)?"★":"☆"}),c.jsx("button",{className:`nc-technical${ie.technical?" on":""}`,title:ie.technical?g("mark-normal"):g("mark-technical"),"aria-label":`${ie.technical?g("mark-normal"):g("mark-technical")} ${ie.name}`,onClick:se=>{se.stopPropagation(),v&&v(ie.name,!ie.technical,[])},children:"T"}),c.jsx("button",{className:"nc-menu",title:g("terminate"),onClick:se=>{se.stopPropagation(),window.confirm(g("terminate-confirm").replace("{name}",ie.name))&&p&&p(ie.name)},children:"⋯"})]},Y.key)})()),fe.length===0&&c.jsx("div",{className:"nc-empty",children:g("no-sessions-short")})]}),Ze.map(({g:Y,nodeRoute:ie,groupView:W,rawItems:se,items:ve})=>{const Re=X_(Y.health)||(Y.status==="up"?"on":Y.status==="passive"?"":"warn");return c.jsxs("div",{className:"nc-node-order-wrap","data-node-order-key":I(Y),children:[c.jsxs("div",{className:"nc-side-group-title nc-node-title",role:"button",tabIndex:0,onContextMenu:Y.direct&&w?we=>{we.preventDefault(),He(Y)}:void 0,onClick:()=>E(ie,{open:!W.open}),onKeyDown:we=>{(we.key==="Enter"||we.key===" ")&&(we.preventDefault(),E(ie,{open:!W.open}))},children:[c.jsx(us,{scope:"node",position:"nodes",itemKey:I(Y),label:Y.label||Y.name,onMove:(we,je)=>L(we,je,r||[]),onStep:we=>q(I(Y),we,r||[])}),c.jsx("span",{className:"nc-node-chevron",children:W.open?"⌄":"›"}),c.jsx("span",{className:`nc-dot ${Re}`,title:Y.health?Rl(Y.health):""}),c.jsx("b",{children:Y.label||Y.name}),c.jsxs("small",{children:[" · ",Y.status==="up"?g("node-sessions").replace("{n}",String(ve.length)):Y.health&&Rl(Y.health)||xr(Y)]}),c.jsxs("select",{className:"nc-node-filter",value:W.filter,title:g(`view-${W.filter}`),onClick:we=>we.stopPropagation(),onChange:we=>E(ie,{filter:we.target.value}),children:[c.jsx("option",{value:"all",children:g("view-all")}),c.jsx("option",{value:"pinned",children:g("view-pinned")}),c.jsx("option",{value:"active",children:g("view-active")}),c.jsx("option",{value:"off",children:g("view-off")}),c.jsx("option",{value:"technical",children:g("view-technical")})]}),Y.direct&&w&&c.jsx("button",{type:"button",className:"nc-node-rename",title:g("rename-node"),"aria-label":`${g("rename-node")} ${Y.label||Y.name}`,onClick:we=>{we.stopPropagation(),He(Y)},children:"✎"}),Y.direct&&Y.health&&Y.health.managed!==!1&&c.jsx("button",{type:"button",className:`nc-power${Y.tunnelStatus==="up"?" on":""}`,title:Y.tunnelStatus==="up"?g("power-off"):g("power-on"),onClick:we=>{we.stopPropagation(),f&&f(Y)},children:c.jsx(it,{name:"power",size:14})})]}),Y.status==="up"&&W.open&&c.jsxs("div",{className:"nc-side-group",children:[ve.map(we=>we.type==="cell"?(()=>{const je=we.value,st=!!je.tmux,It=je.degraded?"warn":je.tmux?"on":"";return c.jsxs("div",{"data-roster-key":we.key,"data-position":ie,className:`nc-side-card nc-cell${st?" live":""}${Q.has(je.key)?" active":""}`,title:we.working?we.subtitle:je.tmux?g("cell-idle"):g("cell-off"),draggable:st,onDragStart:st?Oe=>Oe.dataTransfer.setData("text/nc-session",je.key):void 0,onClick:st?()=>a&&a(je.key):void 0,onDoubleClick:st?()=>$e(je.tmuxSession,ie,Y.instanceId):void 0,children:[c.jsx(us,{position:ie,itemKey:we.key,label:je.cell,canMove:D,onMove:(Oe,_n)=>O(ie,Oe,_n,se),onStep:Oe=>P(ie,we.key,Oe,se)}),c.jsx("span",{className:`nc-dot ${It}${we.working?" working":""}`}),c.jsxs("span",{className:"nc-card-main",children:[c.jsx("b",{children:je.cell}),c.jsx("small",{title:we.subtitle,children:we.subtitle})]}),c.jsx("button",{className:`nc-pin${H.includes(we.key)?" on":""}`,title:g("pin"),onClick:Oe=>{Oe.stopPropagation(),A(we.key)},children:H.includes(we.key)?"★":"☆"}),h&&(Y.capabilities||[]).includes("boot")&&ot(je,Y.route||[]),(Y.capabilities||[]).includes(je.active?"down":"up")&&c.jsx("button",{className:`nc-power${je.active?" on":""}${je.degraded?" warn":""}`,onClick:Oe=>{Oe.stopPropagation(),u&&u({...je,boot:rt(je,Y.route||[]),route:Y.route,availableEngines:Y.engines||[]})},title:je.active?g("power-off"):g("power-on"),children:c.jsx(it,{name:"power",size:14})})]},we.key)})():(()=>{const je=we.value;return c.jsxs("div",{"data-roster-key":we.key,"data-position":ie,className:`nc-side-card${Q.has(je.key)?" active":""}`,draggable:!0,onDragStart:st=>st.dataTransfer.setData("text/nc-session",je.key),onClick:()=>a&&a(je.key),onDoubleClick:()=>$e(je.name,je.node||ie,Y.instanceId),children:[c.jsx(us,{position:ie,itemKey:we.key,label:je.name,canMove:D,onMove:(st,It)=>O(ie,st,It,se),onStep:st=>P(ie,we.key,st,se)}),c.jsx("span",{className:je.attached?"nc-dot on":"nc-dot"}),c.jsxs("span",{className:"nc-card-main",children:[c.jsx("b",{children:je.name}),c.jsx("small",{children:je.preview?je.preview:je.cmd?je.cmd:g("windows").replace("{n}",String(je.windows||0))})]}),je.activity?c.jsx("span",{className:"nc-rel",children:Nr(je.activity)}):null,c.jsx("button",{className:`nc-pin${H.includes(we.key)?" on":""}`,title:g("pin"),onClick:st=>{st.stopPropagation(),A(we.key)},children:H.includes(we.key)?"★":"☆"}),c.jsx("button",{className:`nc-technical${je.technical?" on":""}`,title:je.technical?g("mark-normal"):g("mark-technical"),"aria-label":`${je.technical?g("mark-normal"):g("mark-technical")} ${je.name}`,onClick:st=>{st.stopPropagation(),v&&v(je.name,!je.technical,Y.route||[])},children:"T"}),c.jsx("button",{className:"nc-menu",title:g("terminate"),onClick:st=>{st.stopPropagation(),window.confirm(g("terminate-confirm").replace("{name}",je.name))&&p&&p(je.name,Y.route)},children:"⋯"})]},we.key)})()),ve.length===0&&c.jsx("div",{className:"nc-empty",children:g("no-sessions-short")})]})]},`nodo-${(Y.route||[Y.name]).join("/")}`)})]}),c.jsx("div",{className:"nc-side-lang",children:q_.map((Y,ie)=>c.jsxs("span",{children:[ie>0&&" · ",c.jsx("button",{className:`nc-lang-btn${z===Y?" on":""}`,onClick:()=>te(Y),title:Y,children:Y.toUpperCase()})]},Y))}),c.jsx("div",{className:"nc-side-resize",onPointerDown:Ie,title:""})]})}function RE({label:e,count:t,state:n,onToggle:r,onFilter:o}){return c.jsxs("div",{className:"nc-side-group-title nc-node-title",role:"button",tabIndex:0,onClick:r,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),r())},children:[c.jsx("span",{className:"nc-node-chevron",children:n.open?"⌄":"›"}),c.jsx("span",{className:"nc-dot on"}),c.jsx("b",{children:e}),c.jsxs("small",{children:[" · ",g("node-sessions").replace("{n}",String(t))]}),c.jsxs("select",{className:"nc-node-filter",value:n.filter,title:g(`view-${n.filter}`),onClick:a=>a.stopPropagation(),onChange:a=>o(a.target.value),children:[c.jsx("option",{value:"all",children:g("view-all")}),c.jsx("option",{value:"pinned",children:g("view-pinned")}),c.jsx("option",{value:"active",children:g("view-active")}),c.jsx("option",{value:"off",children:g("view-off")}),c.jsx("option",{value:"technical",children:g("view-technical")})]})]})}function jE(e,t,n){return!e&&t?n+1:n}const sf="nc_input_preferences_v1",Qu="nc-input-preferences",cw=Object.freeze(["double-tap","single-tap","never"]),uw=Object.freeze(["full","compact"]),ds=Object.freeze({terminalKeyboardGesture:"double-tap",keybarKeepsKeyboardClosed:!0,voiceKeepsKeyboardClosed:!0,showKeybarEnter:!0,keybarLayout:"full"});function rf(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{};return{terminalKeyboardGesture:cw.includes(t.terminalKeyboardGesture)?t.terminalKeyboardGesture:ds.terminalKeyboardGesture,keybarKeepsKeyboardClosed:typeof t.keybarKeepsKeyboardClosed=="boolean"?t.keybarKeepsKeyboardClosed:ds.keybarKeepsKeyboardClosed,voiceKeepsKeyboardClosed:typeof t.voiceKeepsKeyboardClosed=="boolean"?t.voiceKeepsKeyboardClosed:ds.voiceKeepsKeyboardClosed,showKeybarEnter:typeof t.showKeybarEnter=="boolean"?t.showKeybarEnter:ds.showKeybarEnter,keybarLayout:uw.includes(t.keybarLayout)?t.keybarLayout:ds.keybarLayout}}function dw(){try{return typeof localStorage<"u"?localStorage:null}catch{return null}}function Rv(e=dw()){if(!e)return{...ds};try{return rf(JSON.parse(e.getItem(sf)||"null"))}catch{return{...ds}}}function PE(e,t=dw()){const n=rf(e);if(t)try{t.setItem(sf,JSON.stringify(n))}catch{}return n}function of(){const[e,t]=N.useState(Rv);N.useEffect(()=>{const r=o=>{if((o==null?void 0:o.type)==="storage"&&o.key!==sf&&o.key!==null)return;const a=o!=null&&o.detail?rf(o.detail):Rv();t(a)};return window.addEventListener(Qu,r),window.addEventListener("storage",r),()=>{window.removeEventListener(Qu,r),window.removeEventListener("storage",r)}},[]);const n=N.useCallback(r=>{t(o=>{const a=PE({...o,...r||{}});return window.dispatchEvent(new CustomEvent(Qu,{detail:a})),a})},[]);return[e,n]}function LE({session:e,node:t,ownerId:n,cellName:r,token:o,readonly:a=!1,focused:u,onFocus:h,onClose:f,onOpenSingle:p,alive:v=!0,available:x=!0,fontSize:w=Ho,onZoom:S,decks:y=[],currentDeck:b,onSendToDeck:C}){const[R]=of(),k=r||e,F=N.useRef(()=>{}),B=N.useRef(()=>!1),V=N.useRef(()=>{}),G=N.useRef(!1),[z,te]=N.useState(!1),[H,X]=N.useState(!1),[A,M]=N.useState(!1),[E,D]=N.useState(null),[O,P]=N.useState(0),$=N.useRef(v),L=t?`${t}:${e}`:e,q=y.filter(I=>I.id!==b&&I.available!==!1);return N.useEffect(()=>{const I=$.current;!I&&v&&P(T=>jE(I,v,T)),$.current=v},[v]),c.jsxs("div",{className:`nc-tile${u?" focused":""}`,onMouseDown:()=>h&&h(L),children:[c.jsxs("div",{className:"nc-tile-head",draggable:!0,onDragStart:I=>{I.dataTransfer.setData("text/nc-session",L),I.dataTransfer.effectAllowed="move"},children:[c.jsxs("button",{className:"nc-tile-name",onClick:()=>h&&h(L),title:t?`${k} · ${t}`:k,children:[c.jsx("span",{className:v?"nc-dot on":"nc-dot"}),c.jsx("b",{children:k})]}),c.jsxs("span",{className:"nc-tile-actions",children:[S&&c.jsx("button",{onClick:()=>S(-1),title:g("zoom-out"),children:c.jsx(it,{name:"zoomOut",size:14})}),S&&c.jsx("button",{onClick:()=>S(1),title:g("zoom-in"),children:c.jsx(it,{name:"zoomIn",size:14})}),C&&q.length>0&&c.jsxs("select",{className:"nc-tile-deck",title:g("send-to-deck"),value:"",onMouseDown:I=>I.stopPropagation(),onChange:I=>{const T=I.target.value;T&&C(L,T),I.target.value=""},children:[c.jsx("option",{value:"",children:g("send-to-deck")}),q.map(I=>c.jsxs("option",{value:I.id,children:[I.ownerLabel," · ",I.name]},I.id))]}),c.jsx("button",{onClick:()=>X(I=>!I),title:"composer",children:"⌨"}),c.jsx("button",{onClick:()=>M(I=>!I),title:"file",children:"📁"}),p&&c.jsx("button",{onClick:()=>p({session:e,node:t,ownerId:n}),title:"vista singola",children:"↗"}),f&&c.jsx("button",{className:"nc-tile-close",onClick:()=>f(L),title:"chiudi",children:"✕"})]})]}),c.jsxs("div",{className:"nc-tile-body",children:[x?c.jsx(Qy,{session:e,node:t,token:o,readonly:a,takeSize:!1,focused:u,sendRef:F,composerRef:B,actionRef:V,ctrlRef:G,setCtrlArmed:te,onFiles:D,fontSize:w,keyboardGesture:R.terminalKeyboardGesture},`${L}:${O}`):c.jsx("div",{className:"nc-tile-unavailable",children:g("deck-owner-unavailable")}),x&&A&&c.jsx("div",{className:"nc-tile-files",onMouseDown:I=>I.stopPropagation(),children:c.jsx(Zy,{session:e,node:t,token:o,filesEvent:E,onClose:()=>M(!1)})})]}),x&&H&&c.jsx("div",{className:"nc-tile-composer",onMouseDown:I=>I.stopPropagation(),children:c.jsx(lw,{submitText:I=>B.current(I),token:o,session:e,node:t,ownerId:n,keepKeyboardClosedOnVoice:R.voiceKeepsKeyboardClosed})})]})}function TE({session:e,node:t,ownerId:n,cells:r,nodeGroups:o}={}){const a=typeof e=="string"?e:"";if(!a)return null;if(t){const h=Array.isArray(o)?o:[];for(const f of h){if(!f||(Array.isArray(f.route)?f.route:[]).join("/")!==t||n&&f.instanceId&&String(n)!==String(f.instanceId))continue;const v=(Array.isArray(f.cells)?f.cells:[]).find(x=>x&&x.tmuxSession===a);if(v)return v}return null}return(Array.isArray(r)?r:[]).find(h=>h&&h.tmuxSession===a)||null}function af({session:e,cell:t,node:n,ownerId:r,cells:o,nodeGroups:a}={}){const u=typeof e=="string"?e:"";if(t&&typeof t.cell=="string"&&t.cell)return t.cell;const h=TE({session:u,node:n,ownerId:r,cells:o,nodeGroups:a});return h&&h.cell?h.cell:u}const jv=.2,Pv=.28,hw=(e,t)=>Array.from((e==null?void 0:e.types)||[]).includes(t),Zu=e=>hw(e,"text/nc-session"),Lv=e=>{var t;return hw(e,"Files")||(((t=e==null?void 0:e.files)==null?void 0:t.length)||0)>0};function DE(e,t,n){const r=(e-n.left)/(n.width||1),o=(t-n.top)/(n.height||1);return r<Pv?"left":r>1-Pv?"right":o<.5?"top":"bottom"}function ME({layout:e,onLayoutChange:t,token:n,readonly:r=!1,sessionsAlive:o,focusSession:a,onFocus:u,onOpenSingle:h,decks:f=[],currentDeck:p,onSendToDeck:v,cells:x=[],nodeGroups:w=[]}){$n();const[S,y]=N.useState(null),b=N.useRef(null),C=N.useRef([]),R=N.useRef(null);function k(A,M){const E=()=>{window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E),window.removeEventListener("blur",E),R.current=null};window.addEventListener("pointermove",A),window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),window.addEventListener("blur",E),R.current=E}N.useEffect(()=>()=>{R.current&&R.current()},[]),N.useEffect(()=>{const A=()=>y(null);return window.addEventListener("dragend",A),window.addEventListener("drop",A),()=>{window.removeEventListener("dragend",A),window.removeEventListener("drop",A)}},[]);const F=e.columns.length,B=A=>S&&S.col===A&&S.row===void 0,V=!!S&&S.col===F,G=(A,M)=>S&&S.col===A&&S.row===M&&S.quadrant?` drop-${S.quadrant}`:"";function z(A){if(A.preventDefault(),Lv(A.dataTransfer)){y(null);return}const M=A.dataTransfer.getData("text/nc-session"),E=S;if(y(null),!M||!E)return;let D;if(E.quadrant){if(D=f1(e,E.col,E.row,E.quadrant),!D)return}else D={col:E.col};t(wi(e).includes(M)?l1(e,M,D):Kh(e,M,D))}function te(A,M){A.preventDefault(),A.stopPropagation();const E=A.clientX,D=e.columns[M].width,O=b.current&&b.current.clientWidth||1,P=e.columns[M+1];k(L=>{let q=Math.max(jv,D+(L.clientX-E)/O);if(P){const I=_g(q/(q+P.width));q=I/(1-I)*P.width}t(u1(e,M,q))})}function H(A,M,E){A.preventDefault(),A.stopPropagation();const D=A.clientY,O=e.columns[M].tiles[E].height,P=C.current[M],$=P&&P.clientHeight||1,L=e.columns[M].tiles[E+1];k(I=>{let T=Math.max(jv,O+(I.clientY-D)/$);if(L){const U=_g(T/(T+L.height));T=U/(1-U)*L.height}t(d1(e,M,E,T))})}function X(A){t(Ll(e,A))}return c.jsxs("div",{className:"nc-grid",ref:b,onDragOver:A=>{if(Lv(A.dataTransfer)){A.preventDefault(),y(null);return}Zu(A.dataTransfer)&&(A.preventDefault(),S&&S.col===F||y({col:F}))},onDrop:z,onDragLeave:A=>{const M=A.relatedTarget;(!M||!(b.current&&b.current.contains(M)))&&y(null)},children:[e.columns.flatMap((A,M)=>{const E=[];return E.push(c.jsx("div",{className:`nc-col${B(M)?" drop-newcol":""}`,ref:D=>{C.current[M]=D},style:{flexGrow:A.width,flexBasis:0},onDragOver:D=>{Zu(D.dataTransfer)&&(D.preventDefault(),D.stopPropagation(),S&&S.col===M&&S.row===void 0||y({col:M}))},children:A.tiles.flatMap((D,O)=>{const P=[],$=On(D),L=af({session:D.session,node:D.node,ownerId:D.ownerId,cells:x,nodeGroups:w});return P.push(c.jsx("div",{className:`nc-tile-slot${G(M,O)}`,style:{flexGrow:D.height,flexBasis:0},onDragOver:q=>{if(!Zu(q.dataTransfer))return;q.preventDefault(),q.stopPropagation();const I=DE(q.clientX,q.clientY,q.currentTarget.getBoundingClientRect());S&&S.col===M&&S.row===O&&S.quadrant===I||y({col:M,row:O,quadrant:I})},children:c.jsx(LE,{session:D.session,node:D.node,ownerId:D.ownerId,cellName:L,token:n,readonly:r,focused:a===$,onFocus:u,onClose:X,onOpenSingle:h,available:D.unavailable!==!0,alive:D.unavailable!==!0&&(!o||o.has($)),fontSize:D.fontSize,onZoom:q=>t(h1(e,M,O,q)),decks:f,currentDeck:p,onSendToDeck:v})},$)),O<A.tiles.length-1&&P.push(c.jsx("div",{className:"nc-divider-h",onPointerDown:q=>H(q,M,O)},`h${O}`)),P})},`c${M}`)),M<F-1&&E.push(c.jsx("div",{className:"nc-divider-v",onPointerDown:D=>te(D,M)},`v${M}`)),E}),V&&c.jsx("div",{className:"nc-drop-line-v nc-drop-line-end"}),F===0&&c.jsx("div",{className:"nc-grid-empty",children:g("grid-empty")})]})}const _i="local",zn=/^[a-f0-9]{16,64}$/;function Cr(e,t){return`${e&&zn.test(e)?e:_i}:${t}`}function Vl(e){const t=String(e||""),n=t.indexOf(":");if(n<1)return null;const r=t.slice(0,n),o=t.slice(n+1);return r!==_i&&!zn.test(r)||!/^[a-z0-9-]{1,32}$/.test(o)?null:{ownerId:r===_i?null:r,name:o}}function Yl(e){return Array.isArray(e)&&e.length?e.join("/"):""}function lf(e){return{columns:$s(e).columns.map(t=>({width:t.width,tiles:t.tiles.map(n=>({...n}))}))}}function AE(e){const t=new Map;for(const n of Array.isArray(e)?e:[])n&&zn.test(String(n.instanceId||""))&&Array.isArray(n.route)&&t.set(Yl(n.route),n.instanceId);return t}function IE(e){const t=new Map;for(const n of Array.isArray(e)?e:[])n&&zn.test(String(n.instanceId||""))&&Array.isArray(n.route)&&t.set(n.instanceId,[...n.route]);return t}function bh(e,t,n=[]){const r=lf(e),o=AE(n);for(const a of r.columns)for(const u of a.tiles)u.ownerId||(!u.node&&zn.test(String(t||""))?u.ownerId=t:u.node&&o.has(u.node)&&(u.ownerId=o.get(u.node)));return r}function xh(e,t,n=[]){const r=lf(e),o=new Map;for(const a of n)a&&zn.test(String(a.instanceId||""))&&Array.isArray(a.route)&&o.set(a.instanceId,[...a.route]);for(const a of r.columns)for(const u of a.tiles)u.ownerId&&(u.ownerId===t?(delete u.node,delete u.unavailable):o.has(u.ownerId)?(u.node=Yl(o.get(u.ownerId)),delete u.unavailable):u.unavailable=!0);return r}function Tv(e,t,n=[]){const r=lf(e),o=IE(n);for(const a of r.columns)for(const u of a.tiles)delete u.unavailable,u.ownerId&&(u.ownerId===t?delete u.node:o.has(u.ownerId)&&(u.node=Yl(o.get(u.ownerId))));return r}function fw(e,t,n=[]){const r=gs(e);if(!r)return null;if(r.ownerId)return r;if(!r.node)return{...r,...zn.test(String(t||""))?{ownerId:t}:{}};const o=n.find(a=>Yl(a&&a.route)===r.node);return{...r,...o&&zn.test(String(o.instanceId||""))?{ownerId:o.instanceId}:{}}}const BE=/^[a-z0-9-]{1,32}$/,Fn="main",pw="nc_decks",mw="nc_deck_order_v1",gw=24;function Dv(e){return typeof e!="string"?"":e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").slice(0,32).replace(/-+$/,"")}function Lr(e){return typeof e=="string"&&BE.test(e)}function OE(e){const t=String(e||"").match(/^\/deck\/([^/]+)\/?$/);if(t){let n;try{n=decodeURIComponent(t[1])}catch{n=t[1]}return Lr(n)?n:Fn}return Fn}function zE(e){const t=String(e||"").match(/^\/deck\/([^/]+)\/([^/]+)\/?$/);if(t){let r,o;try{r=decodeURIComponent(t[1]),o=decodeURIComponent(t[2])}catch{return{id:Cr(null,Fn),ownerId:null,name:Fn}}if(zn.test(r)&&Lr(o))return{id:Cr(r,o),ownerId:r,name:o}}const n=OE(e);return{id:Cr(null,n),ownerId:null,name:n}}function ed(e,t){const n=typeof e=="object"&&e?{ownerId:e.ownerId||null,name:e.name}:Vl(e)||{ownerId:null,name:e},r=Lr(n.name)?n.name:Fn,o=n.ownerId?`/deck/${encodeURIComponent(n.ownerId)}/${encodeURIComponent(r)}`:r===Fn?"/":`/deck/${encodeURIComponent(r)}`;return t?`${o}#token=${encodeURIComponent(t)}`:o}function vw(e){return e===Fn?"nc_grid_v1":`nc_grid_v1__${e}`}function _w(e){const t=[Fn];if(Array.isArray(e)){for(const n of e)if(Lr(n)&&n!==Fn&&!t.includes(n)&&t.push(n),t.length>=gw)break}return t}function Ir(){return typeof localStorage<"u"?localStorage:null}function FE(){const e=Ir();if(!e)return[Fn];try{return _w(JSON.parse(e.getItem(pw)||"null"))}catch{return[Fn]}}function $E(e){const t=Ir();if(t)try{t.setItem(pw,JSON.stringify(_w(e)))}catch{}}function Yo(e){return e==="local"||zn.test(String(e||""))}function Gl(e,t){const n=Vl(e);return!!n&&(n.ownerId||"local")===t}function bi(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e).slice(0,64)){if(!Yo(n)||!Array.isArray(r))continue;const o=[...new Set(r.filter(a=>typeof a=="string"&&a.length<=100&&Gl(a,n)))].slice(0,gw);o.length&&(t[n]=o)}return t}function dl(e=Ir()){if(!e)return{};try{return bi(JSON.parse(e.getItem(mw)||"null"))}catch{return{}}}function td(e,t=Ir()){const n=bi(e);if(t)try{t.setItem(mw,JSON.stringify(n))}catch{}return n}function Xl(e,t){return Array.isArray(e==null?void 0:e[t])?e[t]:[]}function HE(e,t,n,r,o=[]){if(!Yo(t)||n===r)return bi(e);const a=[...new Set(o.filter(x=>Gl(x,t)))];if(!a.includes(n)||!a.includes(r))return bi(e);const u=Xl(e,t).filter(x=>a.includes(x)),h=[...u,...a.filter(x=>!u.includes(x))],f=h.indexOf(n),p=h.indexOf(r);h.splice(f,1);const v=h.indexOf(r);return h.splice(f<p?v+1:v,0,n),bi({...e,[t]:h})}function WE(e,t,n,r){if(!Yo(t)||!Gl(r,t))return bi(e);const o=Xl(e,t);return o.includes(n)?bi({...e,[t]:o.map(a=>a===n?r:a)}):bi(e)}function UE(e,t,n){return Yo(t)?bi({...e,[t]:Xl(e,t).filter(r=>r!==n)}):bi(e)}function Mv(e,t={}){const n=new Map;for(const o of Array.isArray(e)?e:[]){const a=o!=null&&o.local?"local":String((o==null?void 0:o.ownerId)||"");!Yo(a)||!Gl(o==null?void 0:o.id,a)||(n.has(a)||n.set(a,[]),n.get(a).push(o))}const r=[];for(const[,o]of n){const a=o[0].local?"local":o[0].ownerId,u=Xl(t,a),h=new Map(u.map((f,p)=>[f,p]));o.sort((f,p)=>{const v=h.has(f.id)?h.get(f.id):Number.MAX_SAFE_INTEGER,x=h.has(p.id)?h.get(p.id):Number.MAX_SAFE_INTEGER;return v-x}),r.push(...o)}return r}function kh(e){const t=Ir();if(!t)return null;try{return JSON.parse(t.getItem(vw(e))||"null")}catch{return null}}function KE(e,t){const n=Ir();if(n)try{n.setItem(vw(e),JSON.stringify(t))}catch{}}const cf="nc_deckbar_collapsed_v1",yw=64;function uf(e){return e===_i||zn.test(String(e||""))}function df(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};let n=0;for(const[r,o]of Object.entries(e)){if(n>=yw)break;if(uf(r)){if(o===!0)t[r]=!0;else if(o===!1)t[r]=!1;else continue;n+=1}}return t}function ww(e,t){return uf(t)&&Object.prototype.hasOwnProperty.call(e||{},t)?e[t]===!0:!0}function qE(e,t){const n=df(e);return uf(t)&&(!Object.prototype.hasOwnProperty.call(n,t)&&Object.keys(n).length>=yw&&delete n[Object.keys(n)[0]],n[t]=!ww(n,t)),n}function Sw(){return typeof localStorage<"u"?localStorage:null}function Av(e=Sw()){if(!e)return{};try{return df(JSON.parse(e.getItem(cf)||"null"))}catch{return{}}}function VE(e,t=Sw()){const n=df(e);if(t)try{t.setItem(cf,JSON.stringify(n))}catch{}return n}function YE(){const[e,t]=N.useState(Av);N.useEffect(()=>{const o=a=>{(a.key===cf||a.key===null)&&t(Av())};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[]);const n=N.useCallback(o=>ww(e,o),[e]),r=N.useCallback(o=>{t(a=>VE(qE(a,o)))},[]);return{collapsed:e,isCollapsed:n,toggle:r}}const hf="nc_deck_presence_v1",Iv=3e4,GE=18e4,bw=1e4,xw=32,XE=/^[A-Za-z0-9_-]{1,64}$/,JE=new Set([...Object.getOwnPropertyNames(Object.prototype),"prototype"]),Bv="working",QE="on",ZE="neutral",e2="warn";function ff(e){return typeof e=="string"&&XE.test(e)&&!JE.has(e)}function kw(e){return typeof e=="string"&&Vl(e)!==null}function pf(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function Tr(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};let n=0;for(const[r,o]of Object.entries(e)){if(n>=xw)break;ff(r)&&(!o||typeof o!="object"||kw(o.deckId)&&pf(o.ts)&&(t[r]={deckId:o.deckId,ts:o.ts,focus:o.focus===!0,visible:o.visible===!0},n+=1))}return t}function Cw(e,t){const n=Tr(e);if(!pf(t))return n;const r={};for(const[o,a]of Object.entries(n)){const u=a.visible?Iv:GE,h=t-u;a.ts>=h&&a.ts<=t+Iv&&(r[o]=a)}return r}function Ov(e,t,n,r){if(!ff(t)||!pf(r))return Tr(e);const o=Cw(e,r);if(!kw(n==null?void 0:n.deckId))return o;if(!Object.prototype.hasOwnProperty.call(o,t)&&Object.keys(o).length>=xw){let a="",u=1/0;for(const[h,f]of Object.entries(o))f.ts<u&&(a=h,u=f.ts);a&&delete o[a]}return o[t]={deckId:n.deckId,ts:r,focus:(n==null?void 0:n.focus)===!0,visible:(n==null?void 0:n.visible)===!0},Tr(o)}function t2(e,t){const n=Tr(e);if(!ff(t))return n;const r={...n};return delete r[t],r}function n2(e,t){const n=Cw(e,t),r={};for(const o of Object.values(n)){const a=o.focus&&o.visible?Bv:QE;r[o.deckId]!==Bv&&(r[o.deckId]=a)}return r}function Ew(){return typeof localStorage<"u"?localStorage:null}function hl(e=Ew()){if(!e)return{};try{return Tr(JSON.parse(e.getItem(hf)||"null"))}catch{return{}}}function nd(e,t=Ew()){const n=Tr(e);if(t)try{t.setItem(hf,JSON.stringify(n))}catch{}return n}const i2=Math.min(bw,5e3);function s2(){var e,t;try{const n=(t=(e=globalThis.crypto)==null?void 0:e.randomUUID)==null?void 0:t.call(e);if(n)return`w${n.replaceAll("-","")}`}catch{}return`w${Date.now().toString(36)}${Math.random().toString(36).slice(2,14)}`}const r2=s2();function zv(){const e=typeof document<"u"&&typeof document.hasFocus=="function"?document.hasFocus():!0,t=typeof document<"u"&&typeof document.visibilityState=="string"?document.visibilityState!=="hidden":!0;return{focus:e,visible:t}}function o2(e,t=!0){const r=N.useRef(r2).current,o=N.useRef(e);o.current=e;const[a,u]=N.useState(()=>({map:{},now:Date.now()})),h=N.useCallback(()=>{u({map:hl(),now:Date.now()})},[]);N.useEffect(()=>{if(!t)return;const v=()=>{const C=Date.now(),R=Ov(hl(),r,{deckId:o.current,...zv()},C);return nd(R),{map:R,now:C}},x=()=>u(v());x();const w=setInterval(v,bw),S=setInterval(h,i2),y=x,b=C=>{(C.key===hf||C.key===null)&&h()};return window.addEventListener("focus",y),window.addEventListener("blur",y),typeof document<"u"&&document.addEventListener("visibilitychange",y),window.addEventListener("storage",b),()=>{clearInterval(w),clearInterval(S),window.removeEventListener("focus",y),window.removeEventListener("blur",y),typeof document<"u"&&document.removeEventListener("visibilitychange",y),window.removeEventListener("storage",b);try{nd(t2(hl(),r))}catch{}}},[t,r,h]),N.useEffect(()=>{if(!t)return;const v=Date.now(),x=Ov(hl(),r,{deckId:e,...zv()},v);nd(x),u({map:x,now:v})},[e,t,r]);const f=N.useMemo(()=>t?n2(a.map,a.now):{},[t,a]);return{dotFor:N.useCallback((v,x=!1)=>t?x?e2:f[v]||ZE:null,[f,t]),windowId:r}}const Fv=52,$v=18;function a2({ownerKey:e,deckId:t,label:n,onMove:r,onStep:o}){const a=N.useRef(null),u=N.useRef(0),[h,f]=N.useState(!1),p=()=>{var b,C,R,k;const y=a.current;(C=(b=y==null?void 0:y.over)==null?void 0:b.classList)==null||C.remove("nc-deck-over"),(k=(R=y==null?void 0:y.source)==null?void 0:R.classList)==null||k.remove("nc-deck-dragging"),u.current&&cancelAnimationFrame(u.current),u.current=0},v=(y=!1)=>{const b=a.current;if(!b)return;const C=b.target;p(),a.current=null,f(!1);try{b.handle.releasePointerCapture(b.pointerId)}catch{}y&&C&&C!==t&&r(t,C)},x=(y,b)=>{var B,V,G,z,te,H,X,A;const C=a.current;if(!C)return;C.x=y,C.y=b;const R=(V=(B=document.elementFromPoint(y,b))==null?void 0:B.closest)==null?void 0:V.call(B,"[data-deck-id][data-owner-key]"),k=(G=R==null?void 0:R.dataset)==null?void 0:G.deckId,F=((z=R==null?void 0:R.dataset)==null?void 0:z.ownerKey)===e&&k&&k!==t;C.over!==(F?R:null)&&((H=(te=C.over)==null?void 0:te.classList)==null||H.remove("nc-deck-over"),C.over=F?R:null,(A=(X=C.over)==null?void 0:X.classList)==null||A.add("nc-deck-over")),C.target=F?k:null},w=()=>{var C,R;const y=a.current;if(!y){u.current=0;return}const b=(R=(C=y.container)==null?void 0:C.getBoundingClientRect)==null?void 0:R.call(C);if(b){const k=y.x<b.left+Fv?-$v:y.x>b.right-Fv?$v:0;k&&(y.container.scrollLeft+=k,x(y.x,y.y))}u.current=requestAnimationFrame(w)};N.useEffect(()=>{const y=C=>{C.key==="Escape"&&a.current&&(C.preventDefault(),v(!1))},b=()=>v(!1);return window.addEventListener("keydown",y),window.addEventListener("blur",b),()=>{window.removeEventListener("keydown",y),window.removeEventListener("blur",b),p(),a.current=null}},[t,e]);const S=y=>{var R;if(y.pointerType==="mouse"&&y.button!==0)return;y.preventDefault(),y.stopPropagation(),y.currentTarget.focus({preventScroll:!0});const b=y.currentTarget.closest("[data-deck-id][data-owner-key]"),C=y.currentTarget.closest(".nc-deckbar");a.current={pointerId:y.pointerId,handle:y.currentTarget,source:b,container:C,target:null,over:null,x:y.clientX,y:y.clientY},(R=b==null?void 0:b.classList)==null||R.add("nc-deck-dragging");try{y.currentTarget.setPointerCapture(y.pointerId)}catch{}f(!0),u.current=requestAnimationFrame(w)};return c.jsx("button",{type:"button",className:`nc-deck-handle${h?" active":""}`,"aria-label":`${g("reorder")} ${n}`,"aria-keyshortcuts":"ArrowLeft ArrowRight",title:g("reorder-deck-help"),onClick:y=>{y.preventDefault(),y.stopPropagation()},onDragStart:y=>y.preventDefault(),onKeyDown:y=>{y.key!=="ArrowLeft"&&y.key!=="ArrowRight"||(y.preventDefault(),y.stopPropagation(),o(y.key==="ArrowLeft"?-1:1))},onPointerDown:S,onPointerMove:y=>{!a.current||y.pointerId!==a.current.pointerId||(y.preventDefault(),y.stopPropagation(),x(y.clientX,y.clientY))},onPointerUp:y=>{!a.current||y.pointerId!==a.current.pointerId||(y.preventDefault(),y.stopPropagation(),v(!0))},onPointerCancel:()=>v(!1),onLostPointerCapture:()=>{a.current&&v(!1)},children:"↔"})}function l2({decks:e=[],currentDeck:t="local:main",onCreate:n,onRename:r,onDelete:o,onReorder:a,onOpenWindow:u,onNavigate:h,saveState:f="idle",error:p="",sidebarVisible:v,onToggleSidebar:x}){$n();const{isCollapsed:w,toggle:S}=YE(),{dotFor:y}=o2(t),[b,C]=N.useState(null),[R,k]=N.useState(""),[F,B]=N.useState(!1),[V,G]=N.useState(""),[z,te]=N.useState(""),H=Dv(R),X=Lr(H),A=[];for(const P of e){const $=P.local?"local":P.ownerId;let L=A.find(q=>q.key===$);L||(L={key:$,label:P.ownerLabel||(P.local?"Local":$),local:!!P.local,decks:[]},A.push(L)),L.decks.push(P)}const M=async()=>{if(X){B(!0),G("");try{n&&await n(H,b),k(""),C(null)}catch(P){G(String(P.message||P))}B(!1)}},E=P=>{te(""),u&&u(P.id)||te(P.id)},D=async P=>{if(!(P.id===t||!h||F||P.available===!1)){B(!0),G("");try{await h(P.id)}catch($){G(String(($==null?void 0:$.message)||$))}B(!1)}},O=(P,$,L)=>{const q=P.decks.findIndex(T=>T.id===$.id),I=P.decks[q+L];q>=0&&I&&a&&!F&&a($.id,I.id)};return c.jsxs("div",{className:"nc-deckbar",children:[x&&c.jsx("button",{className:"nc-deck-sidebar-toggle",title:g("toggle-sidebar"),onClick:x,children:v?"◀":"☰"}),c.jsx("span",{className:"nc-deckbar-label",children:g("decks")}),c.jsx("div",{className:"nc-deck-chips",children:A.map(P=>{const $=w(P.key),L=`nc-deck-content-${P.key}`,q=P.local?"Local":P.label,I=P.decks.some(Z=>Z.id===t),T=(P.decks.find(Z=>Z.id===t)||{}).name,U=g(P.decks.length===1?"owner-deck-count-one":"owner-deck-count-many").replace("{count}",P.decks.length);return c.jsxs("span",{className:`nc-deck-owner-group${$?" collapsed":""}`,"data-owner-key":P.key,"data-collapsed":$?"1":"0",children:[c.jsxs("button",{type:"button",className:"nc-deck-owner-toggle","aria-expanded":!$,"aria-controls":L,title:g($?"expand-owner":"collapse-owner").replace("{owner}",q),onClick:()=>{!$&&b===P.key&&(k(""),C(null)),S(P.key)},children:[c.jsx("span",{className:"nc-deck-owner-caret","aria-hidden":"true",children:$?"▸":"▾"}),c.jsx("span",{className:"nc-deck-owner",children:q})]}),$&&c.jsxs("span",{className:"nc-deck-summary",title:U,children:[c.jsx("span",{className:"nc-deck-summary-count",children:P.decks.length}),I&&c.jsxs("span",{className:"nc-deck-summary-current",children:["• ",T]})]}),c.jsxs("span",{id:L,className:"nc-deck-owner-content",hidden:$,children:[P.decks.map(Z=>{const ae=y(Z.id,Z.available===!1);return c.jsxs("span",{"data-deck-id":Z.id,"data-owner-key":P.key,className:`nc-deck-chip${Z.id===t?" current":""}${Z.available===!1?" offline":""}`,children:[ae&&c.jsx(c2,{state:ae}),c.jsx(a2,{ownerKey:P.key,deckId:Z.id,label:`${P.label} · ${Z.name}`,onMove:(he,pe)=>{a&&!F&&a(he,pe)},onStep:he=>O(P,Z,he)}),c.jsxs("button",{className:"nc-deck-open",title:Z.available===!1?`${Z.ownerLabel} offline`:Z.id===t?g("deck-current"):`${Z.ownerLabel} · ${Z.name}`,disabled:F||Z.available===!1,onClick:()=>D(Z),children:[Z.name,Z.id===t?" •":""]}),c.jsx("button",{className:"nc-deck-mini",disabled:Z.available===!1,title:g("detach-deck"),onClick:()=>E(Z),children:"↗"}),Z.name!==Fn&&c.jsxs(c.Fragment,{children:[c.jsx("button",{className:"nc-deck-mini",disabled:Z.available===!1,title:g("rename-deck"),onClick:()=>{const he=(typeof window<"u"?window.prompt(g("rename-deck"),Z.name):"")||"",pe=Dv(he);Lr(pe)&&pe!==Z.name&&r&&r(Z.id,pe).catch(Q=>G(String(Q.message||Q)))},children:"✎"}),c.jsx("button",{className:"nc-deck-mini nc-deck-del",disabled:Z.available===!1,title:g("delete-deck"),onClick:()=>{(typeof window>"u"||window.confirm(g("delete-deck-confirm").replace("{name}",`${Z.ownerLabel} · ${Z.name}`)))&&o&&o(Z.id).catch(he=>G(String(he.message||he)))},children:"✕"})]})]},Z.id)}),b===P.key?c.jsxs("span",{className:"nc-deck-add",children:[c.jsx("input",{autoFocus:!0,className:X||!R?"":"invalid",placeholder:g("deck-name"),value:R,onChange:Z=>k(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&M(),Z.key==="Escape"&&(k(""),C(null))}}),R&&X&&H!==R&&c.jsxs("span",{className:"nc-deck-slug",children:["→ ",H]}),c.jsx("button",{className:"nc-deck-ok",disabled:!X||F,onClick:M,children:g("create")}),c.jsx("button",{className:"nc-deck-cancel",onClick:()=>{k(""),C(null)},children:g("cancel")})]}):c.jsxs("button",{className:"nc-deck-newbtn",disabled:F||P.decks.every(Z=>Z.available===!1),title:`${g("new-deck")} · ${P.label}`,onClick:()=>{k(""),C(P.key)},children:["+ ",g("new")]})]})]},P.key)})}),c.jsx("span",{className:`nc-deck-state ${f}`,title:g("deck-autosave"),children:g(f==="saving"?"saving":f==="saved"?"saved":"deck-autosave")}),(V||p)&&c.jsx("span",{className:"nc-deck-error",children:V||p}),z&&c.jsx("button",{className:"nc-deck-fallback",onClick:()=>u&&u(z),children:g("popup-blocked")})]})}function c2({state:e}){if(!e)return null;const t=g(`dot-${e}`);return c.jsx("span",{className:`nc-deck-dot ${e}`,role:"img","aria-label":t,title:t})}var Sr={},id,Hv;function u2(){return Hv||(Hv=1,id=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),id}var sd={},as={},Wv;function qs(){if(Wv)return as;Wv=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 as.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},as.getSymbolTotalCodewords=function(r){return t[r]},as.getBCHDigit=function(n){let r=0;for(;n!==0;)r++,n>>>=1;return r},as.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');e=r},as.isKanjiModeEnabled=function(){return typeof e<"u"},as.toSJIS=function(r){return e(r)},as}var rd={},Uv;function mf(){return Uv||(Uv=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.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: "+n)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,o){if(e.isValid(r))return r;try{return t(r)}catch{return o}}})(rd)),rd}var od,Kv;function d2(){if(Kv)return od;Kv=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let r=0;r<n;r++)this.putBit((t>>>n-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},od=e,od}var ad,qv;function h2(){if(qv)return ad;qv=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,n,r,o){const a=t*this.size+n;this.data[a]=r,o&&(this.reservedBit[a]=!0)},e.prototype.get=function(t,n){return this.data[t*this.size+n]},e.prototype.xor=function(t,n,r){this.data[t*this.size+n]^=r},e.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]},ad=e,ad}var ld={},Vv;function f2(){return Vv||(Vv=1,(function(e){const t=qs().getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const o=Math.floor(r/7)+2,a=t(r),u=a===145?26:Math.ceil((a-13)/(2*o-2))*2,h=[a-7];for(let f=1;f<o-1;f++)h[f]=h[f-1]-u;return h.push(6),h.reverse()},e.getPositions=function(r){const o=[],a=e.getRowColCoords(r),u=a.length;for(let h=0;h<u;h++)for(let f=0;f<u;f++)h===0&&f===0||h===0&&f===u-1||h===u-1&&f===0||o.push([a[h],a[f]]);return o}})(ld)),ld}var cd={},Yv;function p2(){if(Yv)return cd;Yv=1;const e=qs().getSymbolSize,t=7;return cd.getPositions=function(r){const o=e(r);return[[0,0],[o-t,0],[0,o-t]]},cd}var ud={},Gv;function m2(){return Gv||(Gv=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(o){return o!=null&&o!==""&&!isNaN(o)&&o>=0&&o<=7},e.from=function(o){return e.isValid(o)?parseInt(o,10):void 0},e.getPenaltyN1=function(o){const a=o.size;let u=0,h=0,f=0,p=null,v=null;for(let x=0;x<a;x++){h=f=0,p=v=null;for(let w=0;w<a;w++){let S=o.get(x,w);S===p?h++:(h>=5&&(u+=t.N1+(h-5)),p=S,h=1),S=o.get(w,x),S===v?f++:(f>=5&&(u+=t.N1+(f-5)),v=S,f=1)}h>=5&&(u+=t.N1+(h-5)),f>=5&&(u+=t.N1+(f-5))}return u},e.getPenaltyN2=function(o){const a=o.size;let u=0;for(let h=0;h<a-1;h++)for(let f=0;f<a-1;f++){const p=o.get(h,f)+o.get(h,f+1)+o.get(h+1,f)+o.get(h+1,f+1);(p===4||p===0)&&u++}return u*t.N2},e.getPenaltyN3=function(o){const a=o.size;let u=0,h=0,f=0;for(let p=0;p<a;p++){h=f=0;for(let v=0;v<a;v++)h=h<<1&2047|o.get(p,v),v>=10&&(h===1488||h===93)&&u++,f=f<<1&2047|o.get(v,p),v>=10&&(f===1488||f===93)&&u++}return u*t.N3},e.getPenaltyN4=function(o){let a=0;const u=o.data.length;for(let f=0;f<u;f++)a+=o.data[f];return Math.abs(Math.ceil(a*100/u/5)-10)*t.N4};function n(r,o,a){switch(r){case e.Patterns.PATTERN000:return(o+a)%2===0;case e.Patterns.PATTERN001:return o%2===0;case e.Patterns.PATTERN010:return a%3===0;case e.Patterns.PATTERN011:return(o+a)%3===0;case e.Patterns.PATTERN100:return(Math.floor(o/2)+Math.floor(a/3))%2===0;case e.Patterns.PATTERN101:return o*a%2+o*a%3===0;case e.Patterns.PATTERN110:return(o*a%2+o*a%3)%2===0;case e.Patterns.PATTERN111:return(o*a%3+(o+a)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(o,a){const u=a.size;for(let h=0;h<u;h++)for(let f=0;f<u;f++)a.isReserved(f,h)||a.xor(f,h,n(o,f,h))},e.getBestMask=function(o,a){const u=Object.keys(e.Patterns).length;let h=0,f=1/0;for(let p=0;p<u;p++){a(p),e.applyMask(p,o);const v=e.getPenaltyN1(o)+e.getPenaltyN2(o)+e.getPenaltyN3(o)+e.getPenaltyN4(o);e.applyMask(p,o),v<f&&(f=v,h=p)}return h}})(ud)),ud}var fl={},Xv;function Nw(){if(Xv)return fl;Xv=1;const e=mf(),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],n=[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 fl.getBlocksCount=function(o,a){switch(a){case e.L:return t[(o-1)*4+0];case e.M:return t[(o-1)*4+1];case e.Q:return t[(o-1)*4+2];case e.H:return t[(o-1)*4+3];default:return}},fl.getTotalCodewordsCount=function(o,a){switch(a){case e.L:return n[(o-1)*4+0];case e.M:return n[(o-1)*4+1];case e.Q:return n[(o-1)*4+2];case e.H:return n[(o-1)*4+3];default:return}},fl}var dd={},No={},Jv;function g2(){if(Jv)return No;Jv=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let r=1;for(let o=0;o<255;o++)e[o]=r,t[r]=o,r<<=1,r&256&&(r^=285);for(let o=255;o<512;o++)e[o]=e[o-255]})(),No.log=function(r){if(r<1)throw new Error("log("+r+")");return t[r]},No.exp=function(r){return e[r]},No.mul=function(r,o){return r===0||o===0?0:e[t[r]+t[o]]},No}var Qv;function v2(){return Qv||(Qv=1,(function(e){const t=g2();e.mul=function(r,o){const a=new Uint8Array(r.length+o.length-1);for(let u=0;u<r.length;u++)for(let h=0;h<o.length;h++)a[u+h]^=t.mul(r[u],o[h]);return a},e.mod=function(r,o){let a=new Uint8Array(r);for(;a.length-o.length>=0;){const u=a[0];for(let f=0;f<o.length;f++)a[f]^=t.mul(o[f],u);let h=0;for(;h<a.length&&a[h]===0;)h++;a=a.slice(h)}return a},e.generateECPolynomial=function(r){let o=new Uint8Array([1]);for(let a=0;a<r;a++)o=e.mul(o,new Uint8Array([1,t.exp(a)]));return o}})(dd)),dd}var hd,Zv;function _2(){if(Zv)return hd;Zv=1;const e=v2();function t(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(r){this.degree=r,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const o=new Uint8Array(r.length+this.degree);o.set(r);const a=e.mod(o,this.genPoly),u=this.degree-a.length;if(u>0){const h=new Uint8Array(this.degree);return h.set(a,u),h}return a},hd=t,hd}var fd={},pd={},md={},e_;function Rw(){return e_||(e_=1,md.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),md}var gi={},t_;function jw(){if(t_)return gi;t_=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r
82
+ ]))+`;gi.KANJI=new RegExp(n,"g"),gi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),gi.BYTE=new RegExp(r,"g"),gi.NUMERIC=new RegExp(e,"g"),gi.ALPHANUMERIC=new RegExp(t,"g");const o=new RegExp("^"+n+"$"),a=new RegExp("^"+e+"$"),u=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return gi.testKanji=function(f){return o.test(f)},gi.testNumeric=function(f){return a.test(f)},gi.testAlphanumeric=function(f){return u.test(f)},gi}var n_;function Vs(){return n_||(n_=1,(function(e){const t=Rw(),n=jw();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,u){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!t.isValid(u))throw new Error("Invalid version: "+u);return u>=1&&u<10?a.ccBits[0]:u<27?a.ccBits[1]:a.ccBits[2]},e.getBestModeForData=function(a){return n.testNumeric(a)?e.NUMERIC:n.testAlphanumeric(a)?e.ALPHANUMERIC:n.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 r(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.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: "+o)}}e.from=function(a,u){if(e.isValid(a))return a;try{return r(a)}catch{return u}}})(pd)),pd}var i_;function y2(){return i_||(i_=1,(function(e){const t=qs(),n=Nw(),r=mf(),o=Vs(),a=Rw(),u=7973,h=t.getBCHDigit(u);function f(w,S,y){for(let b=1;b<=40;b++)if(S<=e.getCapacity(b,y,w))return b}function p(w,S){return o.getCharCountIndicator(w,S)+4}function v(w,S){let y=0;return w.forEach(function(b){const C=p(b.mode,S);y+=C+b.getBitsLength()}),y}function x(w,S){for(let y=1;y<=40;y++)if(v(w,y)<=e.getCapacity(y,S,o.MIXED))return y}e.from=function(S,y){return a.isValid(S)?parseInt(S,10):y},e.getCapacity=function(S,y,b){if(!a.isValid(S))throw new Error("Invalid QR Code version");typeof b>"u"&&(b=o.BYTE);const C=t.getSymbolTotalCodewords(S),R=n.getTotalCodewordsCount(S,y),k=(C-R)*8;if(b===o.MIXED)return k;const F=k-p(b,S);switch(b){case o.NUMERIC:return Math.floor(F/10*3);case o.ALPHANUMERIC:return Math.floor(F/11*2);case o.KANJI:return Math.floor(F/13);case o.BYTE:default:return Math.floor(F/8)}},e.getBestVersionForData=function(S,y){let b;const C=r.from(y,r.M);if(Array.isArray(S)){if(S.length>1)return x(S,C);if(S.length===0)return 1;b=S[0]}else b=S;return f(b.mode,b.getLength(),C)},e.getEncodedBits=function(S){if(!a.isValid(S)||S<7)throw new Error("Invalid QR Code version");let y=S<<12;for(;t.getBCHDigit(y)-h>=0;)y^=u<<t.getBCHDigit(y)-h;return S<<12|y}})(fd)),fd}var gd={},s_;function w2(){if(s_)return gd;s_=1;const e=qs(),t=1335,n=21522,r=e.getBCHDigit(t);return gd.getEncodedBits=function(a,u){const h=a.bit<<3|u;let f=h<<10;for(;e.getBCHDigit(f)-r>=0;)f^=t<<e.getBCHDigit(f)-r;return(h<<10|f)^n},gd}var vd={},_d,r_;function S2(){if(r_)return _d;r_=1;const e=Vs();function t(n){this.mode=e.NUMERIC,this.data=n.toString()}return t.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%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(r){let o,a,u;for(o=0;o+3<=this.data.length;o+=3)a=this.data.substr(o,3),u=parseInt(a,10),r.put(u,10);const h=this.data.length-o;h>0&&(a=this.data.substr(o),u=parseInt(a,10),r.put(u,h*3+1))},_d=t,_d}var yd,o_;function b2(){if(o_)return yd;o_=1;const e=Vs(),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 n(r){this.mode=e.ALPHANUMERIC,this.data=r}return n.getBitsLength=function(o){return 11*Math.floor(o/2)+6*(o%2)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(o){let a;for(a=0;a+2<=this.data.length;a+=2){let u=t.indexOf(this.data[a])*45;u+=t.indexOf(this.data[a+1]),o.put(u,11)}this.data.length%2&&o.put(t.indexOf(this.data[a]),6)},yd=n,yd}var wd,a_;function x2(){if(a_)return wd;a_=1;const e=Vs();function t(n){this.mode=e.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n)}return t.getBitsLength=function(r){return r*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){for(let r=0,o=this.data.length;r<o;r++)n.put(this.data[r],8)},wd=t,wd}var Sd,l_;function k2(){if(l_)return Sd;l_=1;const e=Vs(),t=qs();function n(r){this.mode=e.KANJI,this.data=r}return n.getBitsLength=function(o){return o*13},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){let o;for(o=0;o<this.data.length;o++){let a=t.toSJIS(this.data[o]);if(a>=33088&&a<=40956)a-=33088;else if(a>=57408&&a<=60351)a-=49472;else throw new Error("Invalid SJIS character: "+this.data[o]+`
83
+ Make sure your charset is UTF-8`);a=(a>>>8&255)*192+(a&255),r.put(a,13)}},Sd=n,Sd}var bd={exports:{}},c_;function C2(){return c_||(c_=1,(function(e){var t={single_source_shortest_paths:function(n,r,o){var a={},u={};u[r]=0;var h=t.PriorityQueue.make();h.push(r,0);for(var f,p,v,x,w,S,y,b,C;!h.empty();){f=h.pop(),p=f.value,x=f.cost,w=n[p]||{};for(v in w)w.hasOwnProperty(v)&&(S=w[v],y=x+S,b=u[v],C=typeof u[v]>"u",(C||b>y)&&(u[v]=y,h.push(v,y),a[v]=p))}if(typeof o<"u"&&typeof u[o]>"u"){var R=["Could not find a path from ",r," to ",o,"."].join("");throw new Error(R)}return a},extract_shortest_path_from_predecessor_list:function(n,r){for(var o=[],a=r;a;)o.push(a),n[a],a=n[a];return o.reverse(),o},find_path:function(n,r,o){var a=t.single_source_shortest_paths(n,r,o);return t.extract_shortest_path_from_predecessor_list(a,o)},PriorityQueue:{make:function(n){var r=t.PriorityQueue,o={},a;n=n||{};for(a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);return o.queue=[],o.sorter=n.sorter||r.default_sorter,o},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var o={value:n,cost:r};this.queue.push(o),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(bd)),bd.exports}var u_;function E2(){return u_||(u_=1,(function(e){const t=Vs(),n=S2(),r=b2(),o=x2(),a=k2(),u=jw(),h=qs(),f=C2();function p(R){return unescape(encodeURIComponent(R)).length}function v(R,k,F){const B=[];let V;for(;(V=R.exec(F))!==null;)B.push({data:V[0],index:V.index,mode:k,length:V[0].length});return B}function x(R){const k=v(u.NUMERIC,t.NUMERIC,R),F=v(u.ALPHANUMERIC,t.ALPHANUMERIC,R);let B,V;return h.isKanjiModeEnabled()?(B=v(u.BYTE,t.BYTE,R),V=v(u.KANJI,t.KANJI,R)):(B=v(u.BYTE_KANJI,t.BYTE,R),V=[]),k.concat(F,B,V).sort(function(z,te){return z.index-te.index}).map(function(z){return{data:z.data,mode:z.mode,length:z.length}})}function w(R,k){switch(k){case t.NUMERIC:return n.getBitsLength(R);case t.ALPHANUMERIC:return r.getBitsLength(R);case t.KANJI:return a.getBitsLength(R);case t.BYTE:return o.getBitsLength(R)}}function S(R){return R.reduce(function(k,F){const B=k.length-1>=0?k[k.length-1]:null;return B&&B.mode===F.mode?(k[k.length-1].data+=F.data,k):(k.push(F),k)},[])}function y(R){const k=[];for(let F=0;F<R.length;F++){const B=R[F];switch(B.mode){case t.NUMERIC:k.push([B,{data:B.data,mode:t.ALPHANUMERIC,length:B.length},{data:B.data,mode:t.BYTE,length:B.length}]);break;case t.ALPHANUMERIC:k.push([B,{data:B.data,mode:t.BYTE,length:B.length}]);break;case t.KANJI:k.push([B,{data:B.data,mode:t.BYTE,length:p(B.data)}]);break;case t.BYTE:k.push([{data:B.data,mode:t.BYTE,length:p(B.data)}])}}return k}function b(R,k){const F={},B={start:{}};let V=["start"];for(let G=0;G<R.length;G++){const z=R[G],te=[];for(let H=0;H<z.length;H++){const X=z[H],A=""+G+H;te.push(A),F[A]={node:X,lastCount:0},B[A]={};for(let M=0;M<V.length;M++){const E=V[M];F[E]&&F[E].node.mode===X.mode?(B[E][A]=w(F[E].lastCount+X.length,X.mode)-w(F[E].lastCount,X.mode),F[E].lastCount+=X.length):(F[E]&&(F[E].lastCount=X.length),B[E][A]=w(X.length,X.mode)+4+t.getCharCountIndicator(X.mode,k))}}V=te}for(let G=0;G<V.length;G++)B[V[G]].end=0;return{map:B,table:F}}function C(R,k){let F;const B=t.getBestModeForData(R);if(F=t.from(k,B),F!==t.BYTE&&F.bit<B.bit)throw new Error('"'+R+'" cannot be encoded with mode '+t.toString(F)+`.
84
+ Suggested mode is: `+t.toString(B));switch(F===t.KANJI&&!h.isKanjiModeEnabled()&&(F=t.BYTE),F){case t.NUMERIC:return new n(R);case t.ALPHANUMERIC:return new r(R);case t.KANJI:return new a(R);case t.BYTE:return new o(R)}}e.fromArray=function(k){return k.reduce(function(F,B){return typeof B=="string"?F.push(C(B,null)):B.data&&F.push(C(B.data,B.mode)),F},[])},e.fromString=function(k,F){const B=x(k,h.isKanjiModeEnabled()),V=y(B),G=b(V,F),z=f.find_path(G.map,"start","end"),te=[];for(let H=1;H<z.length-1;H++)te.push(G.table[z[H]].node);return e.fromArray(S(te))},e.rawSplit=function(k){return e.fromArray(x(k,h.isKanjiModeEnabled()))}})(vd)),vd}var d_;function N2(){if(d_)return sd;d_=1;const e=qs(),t=mf(),n=d2(),r=h2(),o=f2(),a=p2(),u=m2(),h=Nw(),f=_2(),p=y2(),v=w2(),x=Vs(),w=E2();function S(G,z){const te=G.size,H=a.getPositions(z);for(let X=0;X<H.length;X++){const A=H[X][0],M=H[X][1];for(let E=-1;E<=7;E++)if(!(A+E<=-1||te<=A+E))for(let D=-1;D<=7;D++)M+D<=-1||te<=M+D||(E>=0&&E<=6&&(D===0||D===6)||D>=0&&D<=6&&(E===0||E===6)||E>=2&&E<=4&&D>=2&&D<=4?G.set(A+E,M+D,!0,!0):G.set(A+E,M+D,!1,!0))}}function y(G){const z=G.size;for(let te=8;te<z-8;te++){const H=te%2===0;G.set(te,6,H,!0),G.set(6,te,H,!0)}}function b(G,z){const te=o.getPositions(z);for(let H=0;H<te.length;H++){const X=te[H][0],A=te[H][1];for(let M=-2;M<=2;M++)for(let E=-2;E<=2;E++)M===-2||M===2||E===-2||E===2||M===0&&E===0?G.set(X+M,A+E,!0,!0):G.set(X+M,A+E,!1,!0)}}function C(G,z){const te=G.size,H=p.getEncodedBits(z);let X,A,M;for(let E=0;E<18;E++)X=Math.floor(E/3),A=E%3+te-8-3,M=(H>>E&1)===1,G.set(X,A,M,!0),G.set(A,X,M,!0)}function R(G,z,te){const H=G.size,X=v.getEncodedBits(z,te);let A,M;for(A=0;A<15;A++)M=(X>>A&1)===1,A<6?G.set(A,8,M,!0):A<8?G.set(A+1,8,M,!0):G.set(H-15+A,8,M,!0),A<8?G.set(8,H-A-1,M,!0):A<9?G.set(8,15-A-1+1,M,!0):G.set(8,15-A-1,M,!0);G.set(H-8,8,1,!0)}function k(G,z){const te=G.size;let H=-1,X=te-1,A=7,M=0;for(let E=te-1;E>0;E-=2)for(E===6&&E--;;){for(let D=0;D<2;D++)if(!G.isReserved(X,E-D)){let O=!1;M<z.length&&(O=(z[M]>>>A&1)===1),G.set(X,E-D,O),A--,A===-1&&(M++,A=7)}if(X+=H,X<0||te<=X){X-=H,H=-H;break}}}function F(G,z,te){const H=new n;te.forEach(function(D){H.put(D.mode.bit,4),H.put(D.getLength(),x.getCharCountIndicator(D.mode,G)),D.write(H)});const X=e.getSymbolTotalCodewords(G),A=h.getTotalCodewordsCount(G,z),M=(X-A)*8;for(H.getLengthInBits()+4<=M&&H.put(0,4);H.getLengthInBits()%8!==0;)H.putBit(0);const E=(M-H.getLengthInBits())/8;for(let D=0;D<E;D++)H.put(D%2?17:236,8);return B(H,G,z)}function B(G,z,te){const H=e.getSymbolTotalCodewords(z),X=h.getTotalCodewordsCount(z,te),A=H-X,M=h.getBlocksCount(z,te),E=H%M,D=M-E,O=Math.floor(H/M),P=Math.floor(A/M),$=P+1,L=O-P,q=new f(L);let I=0;const T=new Array(M),U=new Array(M);let Z=0;const ae=new Uint8Array(G.buffer);for(let fe=0;fe<M;fe++){const Se=fe<D?P:$;T[fe]=ae.slice(I,I+Se),U[fe]=q.encode(T[fe]),I+=Se,Z=Math.max(Z,Se)}const he=new Uint8Array(H);let pe=0,Q,ne;for(Q=0;Q<Z;Q++)for(ne=0;ne<M;ne++)Q<T[ne].length&&(he[pe++]=T[ne][Q]);for(Q=0;Q<L;Q++)for(ne=0;ne<M;ne++)he[pe++]=U[ne][Q];return he}function V(G,z,te,H){let X;if(Array.isArray(G))X=w.fromArray(G);else if(typeof G=="string"){let O=z;if(!O){const P=w.rawSplit(G);O=p.getBestVersionForData(P,te)}X=w.fromString(G,O||40)}else throw new Error("Invalid data");const A=p.getBestVersionForData(X,te);if(!A)throw new Error("The amount of data is too big to be stored in a QR Code");if(!z)z=A;else if(z<A)throw new Error(`
85
+ The chosen QR Code version cannot contain this amount of data.
86
+ Minimum version required to store current data is: `+A+`.
87
+ `);const M=F(z,te,X),E=e.getSymbolSize(z),D=new r(E);return S(D,z),y(D),b(D,z),R(D,te,0),z>=7&&C(D,z),k(D,M),isNaN(H)&&(H=u.getBestMask(D,R.bind(null,D,te))),u.applyMask(H,D),R(D,te,H),{modules:D,version:z,errorCorrectionLevel:te,maskPattern:H,segments:X}}return sd.create=function(z,te){if(typeof z>"u"||z==="")throw new Error("No input text");let H=t.M,X,A;return typeof te<"u"&&(H=t.from(te.errorCorrectionLevel,t.M),X=p.from(te.version),A=u.from(te.maskPattern),te.toSJISFunc&&e.setToSJISFunction(te.toSJISFunc)),V(z,X,H,A)},sd}var xd={},kd={},h_;function Pw(){return h_||(h_=1,(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(a){return[a,a]}))),r.length===6&&r.push("F","F");const o=parseInt(r.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const o=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,a=r.width&&r.width>=21?r.width:void 0,u=r.scale||4;return{width:a,scale:a?4:u,margin:o,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,o){return o.width&&o.width>=r+o.margin*2?o.width/(r+o.margin*2):o.scale},e.getImageWidth=function(r,o){const a=e.getScale(r,o);return Math.floor((r+o.margin*2)*a)},e.qrToImageData=function(r,o,a){const u=o.modules.size,h=o.modules.data,f=e.getScale(u,a),p=Math.floor((u+a.margin*2)*f),v=a.margin*f,x=[a.color.light,a.color.dark];for(let w=0;w<p;w++)for(let S=0;S<p;S++){let y=(w*p+S)*4,b=a.color.light;if(w>=v&&S>=v&&w<p-v&&S<p-v){const C=Math.floor((w-v)/f),R=Math.floor((S-v)/f);b=x[h[C*u+R]?1:0]}r[y++]=b.r,r[y++]=b.g,r[y++]=b.b,r[y]=b.a}}})(kd)),kd}var f_;function R2(){return f_||(f_=1,(function(e){const t=Pw();function n(o,a,u){o.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=u,a.width=u,a.style.height=u+"px",a.style.width=u+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(a,u,h){let f=h,p=u;typeof f>"u"&&(!u||!u.getContext)&&(f=u,u=void 0),u||(p=r()),f=t.getOptions(f);const v=t.getImageWidth(a.modules.size,f),x=p.getContext("2d"),w=x.createImageData(v,v);return t.qrToImageData(w.data,a,f),n(x,p,v),x.putImageData(w,0,0),p},e.renderToDataURL=function(a,u,h){let f=h;typeof f>"u"&&(!u||!u.getContext)&&(f=u,u=void 0),f||(f={});const p=e.render(a,u,f),v=f.type||"image/png",x=f.rendererOpts||{};return p.toDataURL(v,x.quality)}})(xd)),xd}var Cd={},p_;function j2(){if(p_)return Cd;p_=1;const e=Pw();function t(o,a){const u=o.a/255,h=a+'="'+o.hex+'"';return u<1?h+" "+a+'-opacity="'+u.toFixed(2).slice(1)+'"':h}function n(o,a,u){let h=o+a;return typeof u<"u"&&(h+=" "+u),h}function r(o,a,u){let h="",f=0,p=!1,v=0;for(let x=0;x<o.length;x++){const w=Math.floor(x%a),S=Math.floor(x/a);!w&&!p&&(p=!0),o[x]?(v++,x>0&&w>0&&o[x-1]||(h+=p?n("M",w+u,.5+S+u):n("m",f,0),f=0,p=!1),w+1<a&&o[x+1]||(h+=n("h",v),v=0)):f++}return h}return Cd.render=function(a,u,h){const f=e.getOptions(u),p=a.modules.size,v=a.modules.data,x=p+f.margin*2,w=f.color.light.a?"<path "+t(f.color.light,"fill")+' d="M0 0h'+x+"v"+x+'H0z"/>':"",S="<path "+t(f.color.dark,"stroke")+' d="'+r(v,p,f.margin)+'"/>',y='viewBox="0 0 '+x+" "+x+'"',C='<svg xmlns="http://www.w3.org/2000/svg" '+(f.width?'width="'+f.width+'" height="'+f.width+'" ':"")+y+' shape-rendering="crispEdges">'+w+S+`</svg>
88
+ `;return typeof h=="function"&&h(null,C),C},Cd}var m_;function P2(){if(m_)return Sr;m_=1;const e=u2(),t=N2(),n=R2(),r=j2();function o(a,u,h,f,p){const v=[].slice.call(arguments,1),x=v.length,w=typeof v[x-1]=="function";if(!w&&!e())throw new Error("Callback required as last argument");if(w){if(x<2)throw new Error("Too few arguments provided");x===2?(p=h,h=u,u=f=void 0):x===3&&(u.getContext&&typeof p>"u"?(p=f,f=void 0):(p=f,f=h,h=u,u=void 0))}else{if(x<1)throw new Error("Too few arguments provided");return x===1?(h=u,u=f=void 0):x===2&&!u.getContext&&(f=h,h=u,u=void 0),new Promise(function(S,y){try{const b=t.create(h,f);S(a(b,u,f))}catch(b){y(b)}})}try{const S=t.create(h,f);p(null,a(S,u,f))}catch(S){p(S)}}return Sr.create=t.create,Sr.toCanvas=o.bind(null,n.render),Sr.toDataURL=o.bind(null,n.renderToDataURL),Sr.toString=o.bind(null,function(a,u,h){return r.render(a,h)}),Sr}var L2=P2();const T2=Th(L2);function g_(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.data=="string"?e.data.trim():""}function D2(e){const t=String(e||"").trim();if(!t)return{kind:"empty"};const n=b1(t);if(!n||!n.ok)return{kind:"invalid"};const r=[];return n.ssh||r.push("ssh"),n.name||r.push("name"),r.length?{kind:"partial",decoded:n,missing:r}:{kind:"complete",decoded:n}}function M2(e,t,n=new Set,r=!1){if(!t||!t.ok)return e;const o=x1(e,t,n);return t.version===2&&t.name&&!n.has("name")&&!r&&(o.name=t.name),!n.has("label")&&!o.label&&t.label&&(o.label=t.label),o}function v_(e,t,n=new Set,r=!1){const o=String(t||"").trim(),a=D2(o);let u={...e,pairingUrl:o};return(a.kind==="complete"||a.kind==="partial")&&(u={...M2(u,a.decoded,n,r),pairingUrl:o}),{classification:a,form:u}}function xl(e,t){const n=String(t||"").toLowerCase();if(!/^[a-f0-9]{16,64}$/.test(n))return"";const r=String(e||"NexusCrew").replace(/([a-z0-9])([A-Z])/g,"$1 $2");let o=ps(r);(o==="localhost"||o==="node")&&(o="nexuscrew");const a=n.slice(0,4),u=Math.max(1,32-a.length-1);return`${o.slice(0,u).replace(/-+$/g,"")||"n"}-${a}`}function A2(e,{deviceDefault:t="",localNodeId:n="",localNameDefault:r=""}={}){const o={name:e.name,ssh:e.ssh,pairingUrl:e.pairingUrl,...e.label?{label:e.label}:{},...e.sshPort?{sshPort:Number(e.sshPort)}:{}},a=e.localLabel||t;a&&(o.localLabel=a);const u=String(e.localName||xl(a,n)||r||"").trim();return u&&(o.localName=u),o}function I2(){const e=new Set;let t=!1;return{canAuto(n){return!t&&!e.has(String(n||""))},start(n){return t?!1:(t=!0,e.add(String(n||"")),!0)},finish(){t=!1},reset(n){e.delete(String(n||""))},isBusy(){return t}}}const B2=["validation","conflict","ssh-start","ssh-ready","join","tunnel-final","confirm","health"];function O2(e){const t=e&&e.data||{},n=typeof t.stage=="string"&&t.stage?t.stage:"",r=typeof t.detail=="string"&&t.detail?t.detail:"";return{stage:n,code:typeof t.code=="string"?t.code:"",detail:r,hint:typeof t.hint=="string"?t.hint:"",suggestedName:typeof t.suggestedName=="string"?t.suggestedName:"",retryable:typeof t.retryable=="boolean"?t.retryable:!n,message:r||String(e&&e.message||e)}}const z2="modulepreload",F2=function(e){return"/"+e},__={},$2=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let u=function(p){return Promise.all(p.map(v=>Promise.resolve(v).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),f=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));o=u(n.map(p=>{if(p=F2(p),p in __)return;__[p]=!0;const v=p.endsWith(".css"),x=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${x}`))return;const w=document.createElement("link");if(w.rel=v?"stylesheet":z2,v||(w.as="script"),w.crossOrigin="",w.href=p,f&&w.setAttribute("nonce",f),document.head.appendChild(w),v)return new Promise((S,y)=>{w.addEventListener("load",S),w.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${p}`)))})}))}function a(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return o.then(u=>{for(const h of u||[])h.status==="rejected"&&a(h.reason);return t().catch(a)})};class Qe{constructor(t,n,r,o,a){this._legacyCanvasSize=Qe.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"),r&&typeof r=="object"?this._onDecode=n:(console.warn(r||o||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=n),n=typeof r=="object"?r:{},this._onDecodeError=n.onDecodeError||(typeof r=="function"?r:this._onDecodeError),this._calculateScanRegion=n.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=n.preferredCamera||a||this._preferredCamera,this._legacyCanvasSize=typeof r=="number"?r:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=n.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 u=!1;if(t.hidden&&(t.hidden=!1,u=!0),document.body.contains(t)||(document.body.appendChild(t),u=!0),r=t.parentElement,n.highlightScanRegion||n.highlightCodeOutline){if(o=!!n.overlay,this.$overlay=n.overlay||document.createElement("div"),a=this.$overlay.style,a.position="absolute",a.display="none",a.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&n.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{}r.insertBefore(this.$overlay,this.$video.nextSibling)}n.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 h=window.getComputedStyle(t);h.display==="none"&&(t.style.setProperty("display","block","important"),u=!0),h.visibility!=="visible"&&(t.style.setProperty("visibility","visible","important"),u=!0),u&&(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=Qe.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 Qe.listCameras(!1)).length}catch{return!1}}static async listCameras(t=!1){if(!navigator.mediaDevices)return[];let n=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),r;try{t&&(await n()).every(o=>!o.label)&&(r=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await n()).map((o,a)=>({id:o.deviceId,label:o.label||(a===0?"Default Camera":`Camera ${a+1}`)}))}finally{r&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),Qe._stopVideoStream(r))}}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"),Qe._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(),Qe._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:n}=await this._getCameraStream();!this._active||this._paused?Qe._stopVideoStream(t):(this._setVideoMirror(n),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 n=()=>{this.$video.srcObject instanceof MediaStream&&(Qe._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return t?(n(),!0):(await new Promise(r=>setTimeout(r,300)),this._paused?(n(),!0):!1)}async setCamera(t){t!==this._preferredCamera&&(this._preferredCamera=t,await this._restartVideoStream())}static async scanImage(t,n,r,o,a=!1,u=!1){let h,f=!1;n&&("scanRegion"in n||"qrEngine"in n||"canvas"in n||"disallowCanvasResizing"in n||"alsoTryWithoutScanRegion"in n||"returnDetailedScanResult"in n)?(h=n.scanRegion,r=n.qrEngine,o=n.canvas,a=n.disallowCanvasResizing||!1,u=n.alsoTryWithoutScanRegion||!1,f=!0):console.warn(n||r||o||a||u?"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."),n=!!r;try{let p,v;[r,p]=await Promise.all([r||Qe.createQrEngine(),Qe._loadImage(t)]),[o,v]=Qe._drawToCanvas(p,h,o,a);let x;if(r instanceof Worker){let w=r;n||Qe._postWorkerMessageSync(w,"inversionMode","both"),x=await new Promise((S,y)=>{let b,C,R,k=-1;C=B=>{B.data.id===k&&(w.removeEventListener("message",C),w.removeEventListener("error",R),clearTimeout(b),B.data.data!==null?S({data:B.data.data,cornerPoints:Qe._convertPoints(B.data.cornerPoints,h)}):y(Qe.NO_QR_CODE_FOUND))},R=B=>{w.removeEventListener("message",C),w.removeEventListener("error",R),clearTimeout(b),y("Scanner error: "+(B?B.message||B:"Unknown Error"))},w.addEventListener("message",C),w.addEventListener("error",R),b=setTimeout(()=>R("timeout"),1e4);let F=v.getImageData(0,0,o.width,o.height);k=Qe._postWorkerMessageSync(w,"decode",F,[F.data.buffer])})}else x=await Promise.race([new Promise((w,S)=>window.setTimeout(()=>S("Scanner error: timeout"),1e4)),(async()=>{try{var[w]=await r.detect(o);if(!w)throw Qe.NO_QR_CODE_FOUND;return{data:w.rawValue,cornerPoints:Qe._convertPoints(w.cornerPoints,h)}}catch(S){if(w=S.message||S,/not implemented|service unavailable/.test(w))return Qe._disableBarcodeDetector=!0,Qe.scanImage(t,{scanRegion:h,canvas:o,disallowCanvasResizing:a,alsoTryWithoutScanRegion:u});throw`Scanner error: ${w}`}})()]);return f?x:x.data}catch(p){if(!h||!u)throw p;let v=await Qe.scanImage(t,{qrEngine:r,canvas:o,disallowCanvasResizing:a});return f?v:v.data}finally{n||Qe._postWorkerMessage(r,"close")}}setGrayscaleWeights(t,n,r,o=!0){Qe._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(t){Qe._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=()=>$2(()=>import("./qr-scanner-worker.min-D85Z9gVD.js"),[]).then(r=>r.createWorker()),!(!Qe._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return t();let n=navigator.userAgentData;return n&&n.brands.some(({brand:r})=>/Chromium/i.test(r))&&/mac ?OS/i.test(n.platform)&&await n.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:r,platformVersion:o})=>/arm/i.test(r||"arm")&&13<=parseInt(o||"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 n=Math.round(.6666666666666666*Math.min(t.videoWidth,t.videoHeight));return{x:Math.round((t.videoWidth-n)/2),y:Math.round((t.videoHeight-n)/2),width:n,height:n,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var t=this.$video,n=t.videoWidth,r=t.videoHeight,o=t.offsetWidth,a=t.offsetHeight,u=t.offsetLeft,h=t.offsetTop,f=window.getComputedStyle(t),p=f.objectFit,v=n/r,x=o/a;switch(p){case"none":var w=n,S=r;break;case"fill":w=o,S=a;break;default:(p==="cover"?v>x:v<x)?(S=a,w=S*v):(w=o,S=w/v),p==="scale-down"&&(w=Math.min(w,n),S=Math.min(S,r))}var[y,b]=f.objectPosition.split(" ").map((R,k)=>{const F=parseFloat(R);return R.endsWith("%")?(k?a-S:o-w)*F/100:F});f=this._scanRegion.width||n,x=this._scanRegion.height||r,p=this._scanRegion.x||0;var C=this._scanRegion.y||0;v=this.$overlay.style,v.width=`${f/n*w}px`,v.height=`${x/r*S}px`,v.top=`${h+b+C/r*S}px`,r=/scaleX\(-1\)/.test(t.style.transform),v.left=`${u+(r?o-y-w:y)+(r?n-p-f:p)/n*w}px`,v.transform=t.style.transform}})}static _convertPoints(t,n){if(!n)return t;let r=n.x||0,o=n.y||0,a=n.width&&n.downScaledWidth?n.width/n.downScaledWidth:1;n=n.height&&n.downScaledHeight?n.height/n.downScaledHeight:1;for(let u of t)u.x=u.x*a+r,u.y=u.y*n+o;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,n=1e3/this._maxScansPerSecond;t<n&&await new Promise(o=>setTimeout(o,n-t)),this._lastScanTimestamp=Date.now();try{var r=await Qe.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!Qe._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=Qe.createQrEngine()),r?(this._onDecode?this._onDecode(r):this._legacyOnDecode&&this._legacyOnDecode(r.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",r.cornerPoints.map(({x:o,y:a})=>`${o},${a}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(t){t!==Qe.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",n=[{width:{min:1024}},{width:{min:768}},{}],r=n.map(o=>Object.assign({},o,{[t]:{exact:this._preferredCamera}}));for(let o of[...r,...n])try{let a=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),u=this._getFacingMode(a)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:a,facingMode:u}}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 n of t.getTracks())n.stop(),t.removeTrack(n)}_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,n,r,o=!1){r=r||document.createElement("canvas");let a=n&&n.x?n.x:0,u=n&&n.y?n.y:0,h=n&&n.width?n.width:t.videoWidth||t.width,f=n&&n.height?n.height:t.videoHeight||t.height;return o||(o=n&&n.downScaledWidth?n.downScaledWidth:h,n=n&&n.downScaledHeight?n.downScaledHeight:f,r.width!==o&&(r.width=o),r.height!==n&&(r.height=n)),n=r.getContext("2d",{alpha:!1}),n.imageSmoothingEnabled=!1,n.drawImage(t,a,u,h,f,0,0,r.width,r.height),[r,n]}static async _loadImage(t){if(t instanceof Image)return await Qe._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 n=new Image;n.src=t instanceof File||t instanceof Blob?URL.createObjectURL(t):t.toString();try{return await Qe._awaitImageLoad(n),n}finally{(t instanceof File||t instanceof Blob)&&URL.revokeObjectURL(n.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(t){t.complete&&t.naturalWidth!==0||await new Promise((n,r)=>{let o=a=>{t.removeEventListener("load",o),t.removeEventListener("error",o),a instanceof ErrorEvent?r("Image load error"):n()};t.addEventListener("load",o),t.addEventListener("error",o)})}static async _postWorkerMessage(t,n,r,o){return Qe._postWorkerMessageSync(await t,n,r,o)}static _postWorkerMessageSync(t,n,r,o){if(!(t instanceof Worker))return-1;let a=Qe._workerMessageId++;return t.postMessage({id:a,type:n,data:r},o),a}}Qe.DEFAULT_CANVAS_SIZE=400;Qe.NO_QR_CODE_FOUND="No QR code found";Qe._disableBarcodeDetector=!1;Qe._workerMessageId=0;function H2({onResult:e,onClose:t}){const n=N.useRef(null),r=N.useRef(null),o=N.useRef(!1),[a,u]=N.useState("");N.useEffect(()=>{let f=!1;const p=n.current,v=x=>{f||o.current||(o.current=!0,e(x))};return(async()=>{if(typeof navigator>"u"||!navigator.mediaDevices||typeof navigator.mediaDevices.getUserMedia!="function"){u(g("qr-unsupported"));return}let x=!1;try{x=await Qe.hasCamera()}catch{x=!1}if(!x){u(g("qr-no-camera"));return}if(f||!p)return;const w=new Qe(p,S=>{const y=g_(S);y&&v(y)},{returnDetailedScanResult:!0,preferredCamera:"environment",calculateScanRegion:S=>{const y=S.videoWidth||640,b=S.videoHeight||480,C=Math.max(1,Math.round(Math.min(y,b)*.92));return{x:Math.round((y-C)/2),y:Math.round((b-C)/2),width:C,height:C,downScaledWidth:600,downScaledHeight:600}},highlightScanRegion:!0,highlightCodeOutline:!0});r.current=w;try{await w.start()}catch(S){if(f)return;const y=S&&S.name||"";u(g(y==="NotAllowedError"||y==="SecurityError"?"qr-permission":y==="NotFoundError"||y==="OverconstrainedError"||y==="NotReadableError"?"qr-no-camera":"qr-unsupported"))}})(),()=>{f=!0;const x=r.current;if(x){try{x.stop()}catch{}try{x.destroy()}catch{}r.current=null}const w=p,S=w&&w.srcObject;if(S&&typeof S.getTracks=="function"){for(const y of S.getTracks())try{y.stop()}catch{}try{w.srcObject=null}catch{}}}},[]);const h=async f=>{const p=f.target.files&&f.target.files[0];if(f.target.value="",!!p)try{const v=await Qe.scanImage(p,{returnDetailedScanResult:!0}),x=g_(v);if(!x)throw new Error("empty");o.current||(o.current=!0,e(x))}catch{u(g("pairing-qr-invalid"))}};return c.jsx("div",{className:"nc-sheet-overlay nc-qr-overlay",onClick:t,children:c.jsxs("div",{className:"nc-sheet nc-qr-modal",onClick:f=>f.stopPropagation(),children:[c.jsx("div",{className:"nc-sheet-head",children:c.jsx("b",{children:g("scan-qr")})}),c.jsx("video",{ref:n,className:"nc-qr-video",playsInline:!0,muted:!0}),a&&c.jsx("div",{className:"nc-err",role:"alert",children:a}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsxs("label",{className:"nc-btn ghost nc-qr-upload",children:[g("qr-upload"),c.jsx("input",{type:"file",accept:"image/*",hidden:!0,onChange:h})]}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:t,children:g("cancel")})]})]})})}const y_=()=>({name:"",label:"",ssh:"",sshPort:"",pairingUrl:"",localLabel:"",localName:""});function Lw({token:e,initial:t="",autoStart:n=!1,deviceDefault:r="",localNodeId:o="",localNameDefault:a="",readonly:u=!1,onSuccess:h,onBusyChange:f}){const[p,v]=N.useState(y_),[x,w]=N.useState(!1),[S,y]=N.useState(!1),[b,C]=N.useState("idle"),[R,k]=N.useState(null),[F,B]=N.useState(""),[V,G]=N.useState(!1),[z,te]=N.useState(!1),H=N.useRef(I2()),X=N.useRef(new Set),A=b==="busy",M=xl(p.localLabel||r,o)||a,E=z?p.localName:M;N.useEffect(()=>(f&&f(A),()=>{f&&f(!1)}),[A,f]);const D=async I=>{const T=String(I.pairingUrl||"").trim();if(H.current.start(T)){C("busy"),k(null),B("");try{await f0(e,A2({...I,localName:z?I.localName:xl(I.localLabel||r,o)||a},{deviceDefault:r,localNodeId:o,localNameDefault:a})),C("ok"),w(!1),v(y_()),X.current=new Set,G(!1),te(!1),H.current.finish(),h&&await h()}catch(U){const Z=O2(U);k(Z),C("idle"),H.current.finish(),Z.code==="peer-name-conflict"&&Md(Z.suggestedName)&&(te(!0),X.current.add("localName"),v(ae=>({...ae,localName:Z.suggestedName}))),(Z.stage==="validation"||Z.stage==="conflict"||Z.stage==="ssh-start"||Z.stage==="ssh-ready"||String(Z.code||"").startsWith("ssh-"))&&w(!0)}}},O=(I,T=!0)=>{const{classification:U,form:Z}=v_(p,I,X.current,V),ae=Z.pairingUrl;if(k(null),B(""),b==="ok"&&C("idle"),v(Z),U.kind==="invalid"){k({stage:"validation",code:"bad-link",message:g("pair-invalid-link"),hint:g("pair-invalid-hint"),retryable:!0});return}if(U.kind==="partial"){w(!0),B(U.missing.includes("ssh")?g("pair-missing-ssh"):g("pair-missing-name"));return}U.kind==="complete"&&T&&!u&&H.current.canAuto(ae)&&D(Z)};N.useEffect(()=>{t&&O(t,n)},[]);const P=()=>{const I=String(p.pairingUrl||"").trim(),{classification:T,form:U}=v_(p,I,X.current,V);if(v(U),B(""),k(null),T.kind==="empty"){k({stage:"validation",message:g("pairing-required"),retryable:!0});return}if(T.kind==="invalid"){k({stage:"validation",code:"bad-link",message:g("pair-invalid-link"),hint:g("pair-invalid-hint"),retryable:!0});return}if(!U.ssh||!U.name){w(!0),B(U.ssh?g("pair-missing-name"):g("pair-missing-ssh"));return}if(U.label&&!jr(U.label)){k({stage:"validation",message:g("err-label"),retryable:!0});return}if(U.localLabel&&!jr(U.localLabel)){k({stage:"validation",message:g("err-label"),retryable:!0});return}const Z=z?U.localName:xl(U.localLabel||r,o)||a;if(!Md(Z)||Z==="localhost"){w(!0),k({stage:"validation",code:"bad-local-name",message:g("err-local-name"),retryable:!0});return}H.current.reset(I),D(U)},$=async()=>{try{if(!navigator.clipboard||typeof navigator.clipboard.readText!="function")throw new Error("unsupported");const I=await navigator.clipboard.readText();I&&I.trim()?O(I):B(g("pair-clipboard-empty"))}catch{B(g("pair-clipboard-denied"))}},L=(I,T)=>{X.current.add(I),v(U=>({...U,[I]:T}))},q=R&&R.stage&&(B2.includes(R.stage)||R.stage==="internal")?g(`pair-stage-${R.stage}`):g("pair-stage-generic");return c.jsxs("div",{className:"nc-set-form nc-pair-card",children:[c.jsx("div",{className:"nc-sheet-label",children:g("pair-card-title")}),c.jsx("div",{className:"nc-set-info",children:g("pair-card-help")}),c.jsx("input",{className:"nc-pair-input",placeholder:g("pair-paste-ph"),value:p.pairingUrl,disabled:u||A,onChange:I=>{v({...p,pairingUrl:I.target.value}),k(null),B("")},onPaste:I=>{const T=I.clipboardData&&I.clipboardData.getData("text")||"";T.trim()&&(I.preventDefault(),O(T))},onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),P())}}),c.jsxs("div",{className:"nc-pair-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:u||A,onClick:$,children:g("pair-paste-btn")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:u||A,onClick:()=>y(!0),children:g("scan-qr")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:u||A,title:u?g("settings-readonly"):"",onClick:P,children:g("test-and-connect")})]}),c.jsxs("div",{className:"nc-pair-status","aria-live":"polite",children:[A&&c.jsx("div",{className:"nc-pair-progress",children:g("pair-progress")}),b==="ok"&&c.jsx("div",{className:"nc-set-test ok",children:g("node-connected")}),F&&c.jsx("div",{className:"nc-set-hint nc-pair-notice",children:F}),R&&c.jsxs("div",{className:"nc-err",role:"alert",children:[c.jsx("b",{children:q})," — ",R.message,R.hint&&c.jsx("div",{className:"nc-pair-hint",children:R.hint}),R.retryable&&c.jsx("div",{children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:u||A,onClick:P,children:g("pair-retry")})})]})]}),c.jsxs("button",{type:"button",className:"nc-btn ghost nc-pair-advanced-toggle",disabled:A,onClick:()=>w(I=>!I),children:[x?"▾":"▸"," ",g("pair-advanced")]}),x&&c.jsxs("div",{className:"nc-pair-advanced",children:[c.jsxs("label",{className:"nc-field",children:[g("node-display-label"),c.jsx("input",{placeholder:"Home Relay",value:p.label,disabled:u||A,onChange:I=>{X.current.add("label"),v(T=>({...T,label:I.target.value,name:V?T.name:ps(I.target.value)}))}})]}),c.jsxs("label",{className:"nc-field",children:[g("node-name-label"),c.jsx("input",{placeholder:g("node-name-ph"),value:p.name,disabled:u||A,onChange:I=>{G(!0),X.current.add("name"),v(T=>({...T,name:I.target.value?ps(I.target.value):""}))}})]}),c.jsx("small",{className:"nc-set-hint",children:g("node-slug-hint").replace("{slug}",p.name||"home-relay")}),c.jsxs("label",{className:"nc-field",children:[g("pair-ssh-local-label"),c.jsx("input",{placeholder:"my-relay",value:p.ssh,disabled:u||A,onChange:I=>{X.current.add("ssh"),L("ssh",I.target.value)}}),c.jsx("small",{className:"nc-set-hint",children:g("node-ssh-local-help")})]}),c.jsxs("label",{className:"nc-field",children:[g("node-ssh-port-label"),c.jsx("input",{inputMode:"numeric",placeholder:g("node-ssh-port-help"),value:p.sshPort,disabled:u||A,onChange:I=>L("sshPort",I.target.value.replace(/[^0-9]/g,"").slice(0,5))})]}),c.jsxs("label",{className:"nc-field",children:[g("device-name-label"),c.jsx("input",{placeholder:r||"NexusCrew",value:p.localLabel,disabled:u||A,onChange:I=>L("localLabel",I.target.value)}),c.jsx("small",{className:"nc-set-hint",children:g("device-name-hint")})]}),c.jsxs("label",{className:"nc-field",children:[g("local-route-name-label"),c.jsx("input",{placeholder:M||"nexuscrew-5bd6",value:E,disabled:u||A,onChange:I=>{te(!0),X.current.add("localName"),v(T=>({...T,localName:I.target.value?ps(I.target.value):""}))}}),c.jsx("small",{className:"nc-set-hint",children:g("local-route-name-hint")})]})]}),S&&c.jsx(H2,{onResult:I=>{y(!1),O(I)},onClose:()=>y(!1)})]})}function gf(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&typeof Notification<"u"}function W2(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=atob(n),o=new Uint8Array(r.length);for(let a=0;a<r.length;a+=1)o[a]=r.charCodeAt(a);return o}async function U2(){if(!gf())return"unsupported";if(Notification.permission==="denied")return"denied";try{return await(await navigator.serviceWorker.ready).pushManager.getSubscription()?"subscribed":"idle"}catch{return"idle"}}async function K2(e){if(!gf())throw new Error("push-unsupported");if(await Notification.requestPermission()!=="granted")throw new Error("push-denied");const n=await Vt("/api/push/vapid",e),{publicKey:r}=await n.json();if(!r)throw new Error("vapid non disponibile");const a=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:W2(r)}),u=await Vt("/api/push/subscribe",e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({subscription:a.toJSON()})});if(!u.ok){try{await a.unsubscribe()}catch{}const h=await u.json().catch(()=>({}));throw new Error(h.error||`HTTP ${u.status}`)}return!0}async function q2(e){if(!gf())return!1;const n=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!n)return!1;const r=n.endpoint;try{await n.unsubscribe()}catch{}try{await Vt("/api/push/subscribe",e,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:r})})}catch{}return!0}const Ch="nexuscrew.fleet",Tw=3,V2="nexuscrew.cells",Dw=/^[A-Za-z0-9._-]{1,32}$/,Jl=/^[a-z0-9._-]{1,32}$/,Mw=/^[A-Za-z_][A-Za-z0-9_]{0,63}$/,Aw=new Set(["standard","unsafe"]),Y2=4096,G2=4096,Fl=256,Iw=8192,X2=4096,J2=32,Q2=24,Z2=new Set(["format","version","exportedAt","cells","engines"]),eN=new Set(["id","cwdRel","engine","boot","model","models","permissionPolicies","commands","systemPrompt","prompt"]),tN=new Set(["id","cwd","engine","boot","model","models","permissionPolicies","systemPrompt","prompt"]);function Bs(e){if(typeof e!="string"||e.length>G2)return null;for(let n=0;n<e.length;n+=1){const r=e.charCodeAt(n);if(r<=31||r===127||r===92)return null}if(e==="")return"";if(e.charAt(0)==="/"||/^[A-Za-z]:/.test(e))return null;const t=[];for(const n of e.split("/"))if(!(n===""||n===".")){if(n==="..")return null;t.push(n)}return t.join("/")}const nN=new Set(["id","label","rc","managed","command","args","envKeys","model","promptMode","promptFlag"]),iN=new Set(["client","provider","credentialProfile","model","permissionPolicy","displayName","protocol","baseUrl","envKey","providerId"]);function cs(e,t){return typeof e=="string"&&e.length<=t&&!/[\x00-\x1f\x7f]/.test(e)}function vf(e){const t=String(e||"");return/(?:bearer\s+|authorization\s*[:=]|(?:api[_-]?key|secret|token)\s*[:=])/i.test(t)||/^-{1,2}(?:api[-_]?key|access[-_]?key|auth(?:orization)?[-_]?token|token|secret|password|credential)(?:$|=)/i.test(t)||/\b(?:sk|fw|fpk|hf|zai)[-_][A-Za-z0-9._-]{8,}\b/i.test(t)||/https?:\/\/[^\s/@:]+:[^\s/@]+@/i.test(t)}function Io(e,t){if(e===void 0)return{};if(!e||typeof e!="object"||Array.isArray(e))return null;const n=Object.entries(e);if(n.length>128)return null;const r={};for(const[o,a]of n){if(!Jl.test(o)||!t(a))return null;r[o]=a}return r}function Bw(e){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(h=>!eN.has(h))||!Dw.test(String(e.id||""))||typeof e.cwdRel!="string")return null;const t=Bs(e.cwdRel);if(t===null||!Jl.test(String(e.engine||""))||e.boot!==void 0&&typeof e.boot!="boolean"||e.model!==void 0&&(typeof e.model!="string"||e.model.length>Fl)||e.systemPrompt!==void 0&&e.prompt!==void 0&&e.systemPrompt!==e.prompt)return null;const n=e.systemPrompt===void 0?e.prompt===void 0?"":e.prompt:e.systemPrompt;if(typeof n!="string"||n.length>Iw)return null;const r=Io(e.models,h=>typeof h=="string"&&!!h&&h.length<=Fl),o=Io(e.permissionPolicies,h=>Aw.has(h)),a=Io(e.commands,h=>cs(h,X2)&&!vf(h));if(r===null||o===null||a===null)return null;const u={id:e.id,cwdRel:t,engine:e.engine,boot:e.boot===!0,systemPrompt:n};return e.model&&(u.model=e.model),Object.keys(r).length&&(u.models=r),Object.keys(o).length&&(u.permissionPolicies=o),Object.keys(a).length&&(u.commands=a),u}function sN(e){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(a=>!tN.has(a))||!Dw.test(String(e.id||""))||typeof e.cwd!="string"||!e.cwd||e.cwd.length>Y2||!Jl.test(String(e.engine||""))||e.boot!==void 0&&typeof e.boot!="boolean"||e.model!==void 0&&(typeof e.model!="string"||e.model.length>Fl)||e.systemPrompt!==void 0&&e.prompt!==void 0&&e.systemPrompt!==e.prompt)return null;const t=e.systemPrompt===void 0?e.prompt===void 0?"":e.prompt:e.systemPrompt;if(typeof t!="string"||t.length>Iw)return null;const n=Io(e.models,a=>typeof a=="string"&&!!a&&a.length<=Fl),r=Io(e.permissionPolicies,a=>Aw.has(a));if(n===null||r===null)return null;const o={id:e.id,cwd:e.cwd,engine:e.engine,boot:e.boot===!0,systemPrompt:t};return e.model&&(o.model=e.model),Object.keys(n).length&&(o.models=n),Object.keys(r).length&&(o.permissionPolicies=r),o}function rN(e){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(n=>!iN.has(n)))return null;const t={};for(const[n,r]of Object.entries(e)){if(typeof r!="string"||!cs(r,n==="baseUrl"?512:128)||vf(r))return null;t[n]=r}return!t.client||!t.provider||t.envKey&&!Mw.test(t.envKey)?null:t}function Ow(e){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(r=>!nN.has(r))||!Jl.test(String(e.id||""))||!cs(e.label||e.id,64)||e.rc!==void 0&&typeof e.rc!="boolean")return null;const t={id:e.id,label:e.label||e.id,rc:e.rc===!0};if(e.managed!==void 0){const r=rN(e.managed);return!r||["command","args","envKeys","model","promptMode","promptFlag"].some(o=>e[o]!==void 0)?null:(t.managed=r,t)}if(!cs(e.command,512)||!e.command.startsWith("/")||!Array.isArray(e.args)||e.args.length>32||e.args.some(r=>!cs(r,1024)||vf(r))||e.promptMode!=="flag"&&e.promptMode!=="send-keys"||e.promptMode==="flag"&&(!cs(e.promptFlag,32)||/\s/.test(e.promptFlag)))return null;if(e.model!==void 0){if(!e.model||typeof e.model!="object"||Array.isArray(e.model)||Object.keys(e.model).some(r=>r!=="flag"&&r!=="value")||!cs(e.model.flag,32)||/\s/.test(e.model.flag)||!cs(e.model.value||"",128))return null;t.model={flag:e.model.flag,value:e.model.value||""}}const n=e.envKeys===void 0?[]:e.envKeys;return!Array.isArray(n)||n.length>32||n.some(r=>!Mw.test(r))?null:(Object.assign(t,{command:e.command,args:[...e.args],envKeys:[...new Set(n)].sort(),promptMode:e.promptMode}),e.promptMode==="flag"&&(t.promptFlag=e.promptFlag),t)}function zw(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.managed?{id:e.id,label:e.label,rc:e.rc,managed:e.managed}:{id:e.id,label:e.label,rc:e.rc,command:e.command,args:e.args,envKeys:e.envKeys,model:e.model,promptMode:e.promptMode,promptFlag:e.promptFlag},n=Ow(t);return n||null}function oN(e,t,n=[],r=[],o=new Date){n instanceof Date&&(o=n,n=[],r=[]);const a=t instanceof Set?t:new Set(t||[]),u=r instanceof Set?r:new Set(r||[]),h=[];for(const p of Array.isArray(e)?e:[]){if(!a.has(p.id))continue;const v=Bw({id:p.id,cwdRel:p.cwdRel,engine:p.engine,boot:p.boot===!0,...p.model?{model:p.model}:{},...p.models?{models:p.models}:{},...p.permissionPolicies?{permissionPolicies:p.permissionPolicies}:{},systemPrompt:p.prompt||"",...p.commands?{commands:p.commands}:{}});if(!v)return{ok:!1,error:"invalid-cell",invalidCellIds:[p.id]};h.push(v)}const f=[];for(const p of Array.isArray(n)?n:[]){if(!u.has(p.id))continue;const v=zw(p);v&&f.push(v)}return{format:Ch,version:Tw,exportedAt:o.toISOString(),cells:h,engines:f}}function aN(e){let t;try{t=JSON.parse(String(e||""))}catch{return{ok:!1,error:"invalid-json",cells:[],engines:[]}}const n=(t==null?void 0:t.format)===V2&&(t==null?void 0:t.version)===1,r=(t==null?void 0:t.format)===Ch&&(t==null?void 0:t.version)===2,o=(t==null?void 0:t.format)===Ch&&(t==null?void 0:t.version)===Tw,a=n||r,u=r||o;if(!t||typeof t!="object"||Array.isArray(t)||Object.keys(t).some(x=>!Z2.has(x))||!n&&!r&&!o||!Array.isArray(t.cells)||t.cells.length>J2||u&&(!Array.isArray(t.engines)||t.engines.length>Q2))return{ok:!1,error:"invalid-format",cells:[],engines:[]};const h=[],f=new Set;for(const x of t.cells){const w=a?sN(x):Bw(x);if(!w)return{ok:!1,error:"invalid-cell",cells:[],engines:[]};if(f.has(w.id))return{ok:!1,error:"duplicate-cell",cells:[],engines:[]};f.add(w.id),h.push(w)}const p=[],v=new Set;for(const x of u?t.engines:[]){const w=Ow(x);if(!w)return{ok:!1,error:"invalid-engine",cells:[],engines:[]};if(v.has(w.id))return{ok:!1,error:"duplicate-engine",cells:[],engines:[]};v.add(w.id),p.push(w)}return{ok:!0,cells:h,engines:p,legacy:a,exportedAt:typeof t.exportedAt=="string"?t.exportedAt:""}}function lN(e,t,n){const r=new Set(n||[]);if(!r.has(t))return null;const o=p=>Object.fromEntries(Object.entries(p||{}).filter(([v])=>r.has(v))),a={id:e.id,engine:t,boot:e.boot===!0,prompt:e.systemPrompt||""};typeof e.cwdRel=="string"?a.cwdRel=e.cwdRel:typeof e.cwd=="string"&&e.cwd&&(a.cwd=e.cwd),t===e.engine&&e.model?a.model=e.model:e.models&&e.models[t]&&(a.model=e.models[t]);const u=o(e.models),h=o(e.permissionPolicies),f=o(e.commands);return Object.keys(u).length&&(a.models=u),Object.keys(h).length&&(a.permissionPolicies=h),Object.keys(f).length&&(a.commands=f),a}const cN=()=>({kind:"managed",id:"claude.native",label:"",client:"claude",provider:"native",credentialProfile:"",managedModel:"",permissionPolicy:"unsafe",credentialSourcePolicy:"auto",displayName:"",protocol:"anthropic_messages",baseUrl:"",envKey:"",providerId:"nexuscrew-custom",command:"",argsText:"",rc:!0,promptMode:"send-keys",promptFlag:"",modelFlag:"",modelValue:"",envRows:[],credentialValue:"",credentialReveal:!1,allowMissingCredential:!1}),w_=(e="")=>({id:"",cwd:"",engine:e,boot:!1,model:"",prompt:"",commands:{},command:""}),Fw=e=>e==="claude"?"unsafe":"standard",Fo=(e,t)=>e.find(n=>n.client===t.client&&n.provider===t.provider&&(n.credentialProfile||"")===(t.credentialProfile||"")),uN=(e,t)=>{var n;return((n=Fo(e,t))==null?void 0:n.label)||`${t.client} · ${t.provider}`};function dN(e){var t,n,r,o,a,u,h,f,p,v,x,w,S,y,b;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:((n=e.managed)==null?void 0:n.provider)||"native",credentialProfile:((r=e.managed)==null?void 0:r.credentialProfile)||"",managedModel:((o=e.managed)==null?void 0:o.model)||"",permissionPolicy:((a=e.managed)==null?void 0:a.permissionPolicy)||Fw((u=e.managed)==null?void 0:u.client),credentialSourcePolicy:((h=e.managed)==null?void 0:h.credentialSourcePolicy)||"auto",displayName:((f=e.managed)==null?void 0:f.displayName)||"",protocol:((p=e.managed)==null?void 0:p.protocol)||"",baseUrl:((v=e.managed)==null?void 0:v.baseUrl)||"",envKey:((x=e.managed)==null?void 0:x.envKey)||"",providerId:((w=e.managed)==null?void 0:w.providerId)||"nexuscrew-custom",modelOptions:e.availableModels||((S=e.managedInfo)==null?void 0:S.models)||[],promptMode:e.promptMode||"send-keys",promptFlag:e.promptFlag||"",modelFlag:((y=e.model)==null?void 0:y.flag)||"",modelValue:((b=e.model)==null?void 0:b.value)||"",envRows:(e.envKeys||[]).map(C=>({key:C,value:"",configured:!0,remove:!1})),credentialValue:"",credentialReveal:!1,allowMissingCredential:!1}}function hN(e,t,n=[]){if(e.kind==="managed"){const o={client:e.client,provider:e.provider,model:e.client==="shell"?"":e.managedModel||"",permissionPolicy:e.client==="shell"?"standard":e.permissionPolicy||Fw(e.client)};e.credentialProfile&&(o.credentialProfile=e.credentialProfile),e.credentialSourcePolicy&&e.credentialSourcePolicy!=="auto"&&(o.credentialSourcePolicy=e.credentialSourcePolicy);const a=Fo(n,e);return(a==null?void 0:a.credentialEnv)===!0&&(o.envKey=e.envKey),e.provider==="custom"&&Object.assign(o,{displayName:e.displayName,protocol:e.protocol,baseUrl:e.baseUrl,envKey:e.envKey,providerId:e.providerId}),{...t?{id:e.id}:{},label:e.label||uN(n,e),rc:!!e.rc,managed:o}}const r={...t?{id:e.id}:{},label:e.label||e.id,rc:!!e.rc,command:e.command,args:e.argsText.split(`
90
+ `).filter(o=>o!==""),promptMode:e.promptMode};return e.modelFlag&&(r.model={flag:e.modelFlag,value:e.modelValue||""}),e.promptMode==="flag"&&(r.promptFlag=e.promptFlag),t&&(r.env=Object.fromEntries(e.envRows.filter(o=>!o.remove&&o.key).map(o=>[o.key,o.value]))),r}function Ds({children:e,onClose:t,label:n,error:r=""}){const o=N.useRef(null),a=N.useRef(null),u=N.useRef(t);return u.current=t,N.useEffect(()=>{const h=document.activeElement,f=o.current,p=()=>Array.from((f==null?void 0:f.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))||[]).filter(w=>w.offsetParent!==null),v=requestAnimationFrame(()=>{var w;return(w=p()[0]||f)==null?void 0:w.focus({preventScroll:!0})}),x=w=>{var C;if(w.key==="Escape"){w.preventDefault(),(C=u.current)==null||C.call(u);return}if(w.key!=="Tab")return;const S=p();if(!S.length){w.preventDefault(),f==null||f.focus();return}const y=S[0],b=S[S.length-1];w.shiftKey&&document.activeElement===y?(w.preventDefault(),b.focus()):!w.shiftKey&&document.activeElement===b&&(w.preventDefault(),y.focus())};return document.addEventListener("keydown",x),()=>{cancelAnimationFrame(v),document.removeEventListener("keydown",x),h&&h.isConnected&&typeof h.focus=="function"&&h.focus({preventScroll:!0})}},[]),N.useEffect(()=>{r&&requestAnimationFrame(()=>{var h;return(h=a.current)==null?void 0:h.scrollIntoView({block:"nearest"})})},[r]),c.jsx("div",{className:"nc-fleet-modal",role:"presentation",onMouseDown:h=>{h.target===h.currentTarget&&t()},children:c.jsxs("div",{ref:o,className:"nc-fleet-modal-dialog",role:"dialog","aria-modal":"true","aria-label":n||g("settings"),tabIndex:-1,children:[e,r&&c.jsx("div",{ref:a,className:"nc-err nc-fleet-modal-error",role:"alert","aria-live":"assertive",children:r})]})})}function Ed({token:e,targets:t=[],readonly:n=!1,onPower:r,onImport:o}){const[a,u]=N.useState([]),[h,f]=N.useState(0);N.useEffect(()=>{let C=!0;async function R(){const F=[{route:[],label:g("local")}].concat((t||[]).map(V=>({route:Array.isArray(V.route)?V.route:[],label:V.label||(V.route||[]).join(" › ")}))),B=await Promise.all(F.map(async V=>{const G={...V,available:!1,readonly:!1,capabilities:[],provider:null,cells:[],unmanaged:[],err:""};try{const z=await vs(e,V.route);G.available=!!z.available,G.capabilities=z.capabilities||[],G.provider=z.provider||null,G.cells=(z.cells||[]).map(te=>({...te,route:V.route}));try{G.readonly=!!(await Oh(e,V.route)).readonlyDefault}catch{}try{const te=await z_(e,V.route),H=new Set(G.cells.map(X=>X.tmuxSession).filter(Boolean));G.unmanaged=(te.sessions||[]).filter(X=>X&&!H.has(X.name))}catch{}}catch(z){G.err=String(z&&z.message||z)}return G}));C&&u(B)}R();const k=setInterval(R,6e3);return()=>{C=!1,clearInterval(k)}},[e,t,h]);const p=(C,R)=>Array.isArray(C.capabilities)&&C.capabilities.includes(R)&&!n&&!C.readonly,v=()=>f(C=>C+1),x=(C,R)=>{r&&r({...C,route:R})},w=(C,R)=>{r&&r({...C,route:R})},S=async(C,R)=>{try{await jo(e,C.cell,R)}catch{}v()},y=async(C,R)=>{if(window.confirm(g("fleet-remove-cell").replace("{id}",C.cell))){try{await I_(e,C.cell,!0,R)}catch{}v()}},b=async(C,R)=>{if(window.confirm(g("terminate-confirm").replace("{name}",C.name))){try{await Ih(e,C.name,R)}catch{}v()}};return c.jsxs("div",{className:"nc-fleet-inventory",children:[c.jsxs("div",{className:"nc-fleet-section-head",children:[c.jsx("b",{children:g("fleet-inventory")}),c.jsx("small",{children:g("fleet-inventory-help")})]}),a.map(C=>{const R=C.route.length?C.route.join("/"):"local";return c.jsxs("div",{className:"nc-fleet-pos",children:[c.jsxs("div",{className:"nc-fleet-pos-title",children:[c.jsx("span",{className:`dot ${C.available?"on":"warn"}`}),c.jsx("b",{children:C.label}),c.jsx("small",{children:C.available?`${C.cells.length} ${g("fleet-cells")} · ${C.unmanaged.length} ${g("fleet-tmux")}`:C.err||g("fleet-not-available")})]}),C.cells.map(k=>c.jsxs("div",{className:"nc-fleet-item nc-fleet-cell",children:[c.jsxs("span",{children:[c.jsx("b",{children:k.cell}),c.jsx("small",{children:`${k.engine||""}${k.key?`·${k.key}`:""}${k.active?"":` · ${g("cell-off")}`}`})]}),c.jsxs("span",{className:"nc-fleet-cell-actions",children:[k.active&&p(C,"down")&&c.jsx("button",{className:"nc-btn ghost",title:g("power-off"),onClick:()=>w(k,C.route),children:g("stop")}),!k.active&&p(C,"up")&&c.jsx("button",{className:"nc-btn ghost",title:g("power-on"),onClick:()=>x(k,C.route),children:g("start")}),p(C,"restart")&&k.active&&c.jsx("button",{className:"nc-btn ghost",title:g("restart"),onClick:()=>S(k,C.route),children:g("restart")}),p(C,"remove")&&c.jsx("button",{className:"nc-btn danger",title:g("delete"),onClick:()=>y(k,C.route),children:"×"})]})]},`${R}:${k.cell}`)),C.unmanaged.map(k=>c.jsxs("div",{className:"nc-fleet-item nc-fleet-unmanaged",children:[c.jsxs("span",{children:[c.jsx("b",{children:k.name}),c.jsx("small",{children:g("fleet-tmux")})]}),c.jsxs("span",{className:"nc-fleet-cell-actions",children:[p(C,"import")&&o&&c.jsx("button",{className:"nc-btn ghost",title:g("import-as-cell"),onClick:()=>o(k,C.route),children:g("import-as-cell")}),c.jsx("button",{className:"nc-btn danger",title:g("terminate"),onClick:()=>b(k,C.route),children:"×"})]})]},`${R}:u:${k.name}`)),C.available&&C.cells.length===0&&C.unmanaged.length===0&&c.jsx("div",{className:"nc-empty",children:g("fleet-inventory-empty")})]},R)})]})}function fN({cells:e=[],engines:t=[],busy:n,canRestore:r=!1,onRestore:o,onClose:a}){const[u,h]=N.useState("export"),[f,p]=N.useState(()=>new Set(e.map(E=>E.id))),[v,x]=N.useState(()=>new Set(t.map(E=>E.id))),[w,S]=N.useState([]),[y,b]=N.useState([]),[C,R]=N.useState(""),k=new Set(t.map(E=>E.id)),F=new Set(e.map(E=>E.id)),B=(E,D)=>E(O=>{const P=new Set(O);return P.has(D)?P.delete(D):P.add(D),P}),V=()=>{const E=oN(e,f,t,v);if(E.ok===!1){R(g(`fleet-backup-${E.error}`));return}const D=e.filter(q=>f.has(q.id)).length,O=t.filter(q=>v.has(q.id)).length;if(E.cells.length!==D){R(g("fleet-backup-invalid-cell"));return}if(E.engines.length!==O){R(g("fleet-backup-invalid-engine"));return}if(!E.cells.length&&!E.engines.length){R(g("fleet-backup-select-one"));return}const P=new Blob([`${JSON.stringify(E,null,2)}
91
+ `],{type:"application/json"}),$=URL.createObjectURL(P),L=document.createElement("a");L.href=$,L.download=`nexuscrew-fleet-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(L),L.click(),L.remove(),setTimeout(()=>URL.revokeObjectURL($),0),R("")},G=async E=>{if(R(""),S([]),b([]),!!E){if(E.size>1024*1024){R(g("fleet-backup-too-large"));return}try{const D=aN(await E.text());if(!D.ok){R(g(`fleet-backup-${D.error}`));return}const O=new Set(D.engines.map(P=>P.id));b(D.engines.map(P=>({engine:P,exists:k.has(P.id),selected:!k.has(P.id)}))),S(D.cells.map(P=>{const $=k.has(P.engine)||O.has(P.engine),L=F.has(P.id);return{cell:P,engine:$?P.engine:"",selected:$&&!L,exists:L}}))}catch(D){R(String(D.message||D))}}},z=(E,D)=>S(O=>O.map((P,$)=>$===E?{...P,...D}:P)),te=(E,D)=>b(O=>O.map((P,$)=>$===E?{...P,...D}:P)),H=new Set([...k,...y.filter(E=>E.selected).map(E=>E.engine.id)]),X=w.filter(E=>E.selected&&E.engine&&H.has(E.engine)),A=y.filter(E=>E.selected),M=[...new Map([...t.map(E=>[E.id,E.label||E.id]),...y.filter(E=>E.selected).map(E=>[E.engine.id,E.engine.label||E.engine.id])]).entries()];return c.jsxs("div",{className:"nc-set-form nc-fleet-form nc-backup-dialog",children:[c.jsx("b",{children:g("fleet-backup")}),c.jsx("small",{children:g("fleet-backup-help")}),c.jsxs("div",{className:"nc-set-tabs nc-backup-tabs",children:[c.jsx("button",{type:"button",className:`nc-set-tabbtn${u==="export"?" on":""}`,onClick:()=>{h("export"),R("")},children:g("fleet-backup-export")}),c.jsx("button",{type:"button",className:`nc-set-tabbtn${u==="import"?" on":""}`,disabled:!r,title:r?"":g("fleet-backup-restore-unavailable"),onClick:()=>{h("import"),R("")},children:g("fleet-backup-import")})]}),u==="export"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{p(new Set(e.map(E=>E.id))),x(new Set(t.map(E=>E.id)))},children:g("select-all")}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{p(new Set),x(new Set)},children:g("select-none")})]}),c.jsxs("div",{className:"nc-backup-list",children:[c.jsx("b",{children:g("fleet-engines")}),t.map(E=>{var D;return c.jsxs("label",{className:"nc-check nc-backup-row",children:[c.jsx("input",{type:"checkbox",checked:v.has(E.id),onChange:()=>B(x,E.id)}),c.jsxs("span",{children:[c.jsx("b",{children:E.label||E.id}),c.jsxs("small",{children:[E.id,(D=E.envKeys)!=null&&D.length?` · ${E.envKeys.length} ${g("fleet-backup-env-names")}`:""]})]})]},E.id)}),c.jsx("b",{children:g("fleet-cells")}),e.map(E=>c.jsxs("label",{className:"nc-check nc-backup-row",children:[c.jsx("input",{type:"checkbox",checked:f.has(E.id),onChange:()=>B(p,E.id)}),c.jsxs("span",{children:[c.jsx("b",{children:E.id}),c.jsxs("small",{children:[E.engine," · ",g("fleet-system-prompt")," ",(E.prompt||"").length," ",g("characters")]})]})]},E.id)),!e.length&&!t.length&&c.jsx("div",{className:"nc-empty",children:g("fleet-backup-empty")})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:a,children:g("cancel")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:!f.size&&!v.size,onClick:V,children:g("fleet-backup-download")})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"file",accept:"application/json,.json",disabled:n,onChange:E=>G(E.target.files&&E.target.files[0])}),c.jsx("small",{children:g("fleet-backup-import-help")}),!!(w.length||y.length)&&c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{b(E=>E.map(D=>({...D,selected:!0}))),S(E=>E.map(D=>({...D,selected:!!D.engine})))},children:g("select-all")}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{b(E=>E.map(D=>({...D,selected:!1}))),S(E=>E.map(D=>({...D,selected:!1})))},children:g("select-none")})]}),c.jsxs("div",{className:"nc-backup-list",children:[!!y.length&&c.jsx("b",{children:g("fleet-engines")}),y.map((E,D)=>{var O;return c.jsx("div",{className:"nc-backup-import-row",children:c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:E.selected,onChange:P=>te(D,{selected:P.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:E.engine.label||E.engine.id}),c.jsxs("small",{children:[E.engine.id," · ",E.exists?g("fleet-backup-overwrite"):g("fleet-backup-new"),(O=E.engine.envKeys)!=null&&O.length?` · ${g("fleet-backup-env-values-required")}`:""]})]})]})},E.engine.id)}),!!w.length&&c.jsx("b",{children:g("fleet-cells")}),w.map((E,D)=>c.jsxs("div",{className:"nc-backup-import-row",children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:E.selected,disabled:!E.engine||!H.has(E.engine),onChange:O=>z(D,{selected:O.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:E.cell.id}),c.jsxs("small",{children:[E.exists?g("fleet-backup-overwrite"):g("fleet-backup-new")," · ",g("fleet-system-prompt")," ",E.cell.systemPrompt.length," ",g("characters")]})]})]}),c.jsxs("select",{value:E.engine,onChange:O=>z(D,{engine:O.target.value,selected:!!O.target.value}),children:[c.jsx("option",{value:"",children:g("fleet-backup-engine-missing")}),M.map(([O,P])=>c.jsx("option",{value:O,children:P},O))]})]},E.cell.id))]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:a,children:g("cancel")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:n||!X.length&&!A.length,onClick:()=>o({engineRows:y,cellRows:w}),children:g("fleet-backup-restore")})]})]}),C&&c.jsx("div",{className:"nc-err",children:C})]})}function pN({state:e,setState:t,busy:n,onSave:r,catalog:o}){var R;const a=e.form,u=k=>t({...e,form:{...a,...k}}),h=a.envRows||[],f=[...new Map(o.map(k=>[k.client,k.clientLabel||k.client])).entries()],p=o.filter(k=>k.client===a.client),v=Fo(o,a),x=typeof(v==null?void 0:v.credentialEnv)=="string"?v.credentialEnv:"",w=Array.isArray(v==null?void 0:v.credentialUsedBy)?v.credentialUsedBy:[],S=(v==null?void 0:v.credentialSource)||"missing",y=!!(v!=null&&v.credentialEnv)||a.credentialProfile==="a"||a.credentialProfile==="p",b=!!x&&e.mode==="new"&&(v==null?void 0:v.authConfigured)!==!0&&!a.credentialValue&&!a.allowMissingCredential,C=k=>{k&&u({client:k.client,provider:k.provider,credentialProfile:k.credentialProfile||"",managedModel:k.model||"",protocol:k.protocol||"",permissionPolicy:k.permissionPolicyDefault||"standard",credentialSourcePolicy:"auto",rc:!!k.rc,displayName:k.custom?g("fleet-custom-provider-default"):"",baseUrl:k.custom?"":k.endpoint||"",envKey:k.defaultEnvKey||"",providerId:"nexuscrew-custom",credentialValue:"",credentialReveal:!1,allowMissingCredential:!1,...e.mode==="new"?{id:k.id,label:""}:{}})};return c.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[c.jsx("b",{children:e.mode==="new"?g("fleet-new-engine"):`${g("edit")} ${a.id}`}),c.jsx("input",{value:a.id,disabled:e.mode!=="new",placeholder:"id",onChange:k=>u({id:k.target.value})}),c.jsx("input",{value:a.label,placeholder:g("label"),onChange:k=>u({label:k.target.value})}),c.jsxs("select",{value:a.kind,disabled:e.mode!=="new",onChange:k=>u({kind:k.target.value}),children:[c.jsx("option",{value:"managed",children:g("fleet-managed")}),c.jsx("option",{value:"custom",children:g("fleet-custom")})]}),a.kind==="managed"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("select",{value:a.client,disabled:e.mode!=="new",onChange:k=>C(o.find(F=>F.client===k.target.value&&F.default)||o.find(F=>F.client===k.target.value)),children:f.map(([k,F])=>c.jsx("option",{value:k,children:F},k))}),c.jsx("select",{value:((R=Fo(o,a))==null?void 0:R.id)||"",disabled:e.mode!=="new",onChange:k=>C(o.find(F=>F.id===k.target.value)),children:p.map(k=>c.jsx("option",{value:k.id,children:k.label},k.id))})]}),a.client!=="shell"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{value:a.managedModel,list:"nc-managed-models",placeholder:g(v!=null&&v.requiresModel?"fleet-model-required":"fleet-model-default"),onChange:k=>u({managedModel:k.target.value})}),c.jsx("datalist",{id:"nc-managed-models",children:[...(v==null?void 0:v.models)||[],...a.modelOptions||[]].filter((k,F,B)=>k&&B.indexOf(k)===F).map(k=>c.jsx("option",{value:k},k))})]}),v!=null&&v.supportsUnsafe?c.jsxs("select",{value:a.permissionPolicy,onChange:k=>u({permissionPolicy:k.target.value}),children:[c.jsx("option",{value:"standard",children:g("fleet-standard-permissions")}),c.jsx("option",{value:"unsafe",children:g("fleet-unsafe-permissions")})]}):c.jsx("small",{children:g("fleet-standard-permissions")}),(v==null?void 0:v.supportsUnsafe)&&a.permissionPolicy==="unsafe"&&c.jsx("small",{className:"nc-err",children:g("fleet-unsafe-warning")}),y&&c.jsxs("select",{"aria-label":g("fleet-credential-source-policy"),value:a.credentialSourcePolicy||"auto",onChange:k=>u({credentialSourcePolicy:k.target.value}),children:[c.jsx("option",{value:"auto",children:g("fleet-credential-source-policy-auto")}),c.jsx("option",{value:"nexuscrew-store",children:g("fleet-credential-source-policy-nexuscrew-store")}),c.jsx("option",{value:"environment",children:g("fleet-credential-source-policy-environment")})]}),(v==null?void 0:v.credentialEnv)===!0&&c.jsxs(c.Fragment,{children:[c.jsx("input",{value:a.envKey,placeholder:g("fleet-api-key-env"),onChange:k=>u({envKey:k.target.value})}),c.jsx("small",{children:g("fleet-custom-secret-help")})]}),x&&c.jsxs("section",{className:"nc-fleet-key","aria-label":g("fleet-key-section"),children:[c.jsxs("div",{className:"nc-fleet-key-head",children:[c.jsx("b",{children:g("fleet-key-section")}),c.jsx("span",{children:g(`fleet-credential-source-${S}`)})]}),c.jsxs("label",{className:"nc-field",children:[g("fleet-key-variable"),c.jsx("input",{value:x,readOnly:!0,"aria-label":g("fleet-key-variable")})]}),c.jsx("small",{children:w.length?g("fleet-key-used-by").replace("{engines}",w.join(", ")):g("fleet-key-used-by-none")}),w.length>0&&c.jsx("small",{children:g("fleet-key-shared-impact").replace("{key}",x).replace("{engines}",w.join(", "))}),c.jsxs("div",{className:"nc-fleet-key-input",children:[c.jsx("input",{type:a.credentialReveal?"text":"password",value:a.credentialValue||"","aria-label":g("fleet-key-value").replace("{key}",x),autoComplete:"new-password",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",placeholder:v!=null&&v.authConfigured||e.mode==="edit"?g("fleet-key-blank-keeps"):g("fleet-key-enter"),onChange:k=>u({credentialValue:k.target.value,allowMissingCredential:k.target.value?!1:a.allowMissingCredential})}),c.jsx("button",{type:"button",className:"nc-btn ghost","aria-label":g(a.credentialReveal?"fleet-key-hide":"fleet-key-reveal"),onClick:()=>u({credentialReveal:!a.credentialReveal}),children:g(a.credentialReveal?"fleet-key-hide":"fleet-key-reveal")})]}),c.jsx("small",{children:g("fleet-key-local-help")}),e.mode==="new"&&(v==null?void 0:v.authConfigured)!==!0&&!a.credentialValue&&c.jsxs("label",{className:"nc-check nc-fleet-key-missing",children:[c.jsx("input",{type:"checkbox",checked:!!a.allowMissingCredential,onChange:k=>u({allowMissingCredential:k.target.checked})}),g("fleet-key-create-missing")]}),(v==null?void 0:v.notice)&&c.jsx("small",{className:"nc-fleet-provider-notice",children:g(`fleet-provider-notice-${v.notice}`)})]}),a.provider==="custom"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{value:a.displayName,placeholder:g("fleet-provider-display"),onChange:k=>u({displayName:k.target.value})}),c.jsx("input",{value:a.baseUrl,placeholder:"https://api.example.com/v1",onChange:k=>u({baseUrl:k.target.value})}),((v==null?void 0:v.protocols)||[]).length>1&&c.jsx("select",{value:a.protocol,onChange:k=>u({protocol:k.target.value}),children:v.protocols.map(k=>c.jsx("option",{value:k,children:k},k))}),c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("input",{value:a.envKey,placeholder:g("fleet-api-key-env"),onChange:k=>u({envKey:k.target.value})}),c.jsx("input",{value:a.providerId,placeholder:g("fleet-provider-id"),onChange:k=>u({providerId:k.target.value})})]}),c.jsxs("small",{children:[a.protocol," · ",g("fleet-custom-secret-help")]})]}),c.jsx("small",{children:g(a.client==="shell"?"fleet-shell-engine-help":"fleet-managed-help")})]}):c.jsxs(c.Fragment,{children:[c.jsx("input",{value:a.command,placeholder:g("command-path"),onChange:k=>u({command:k.target.value})}),c.jsx("textarea",{value:a.argsText,placeholder:g("args-lines"),onChange:k=>u({argsText:k.target.value})}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:a.rc,onChange:k=>u({rc:k.target.checked})})," remote control"]}),c.jsxs("select",{value:a.promptMode,onChange:k=>u({promptMode:k.target.value}),children:[c.jsx("option",{value:"send-keys",children:"send-keys"}),c.jsx("option",{value:"flag",children:"flag"})]}),a.promptMode==="flag"&&c.jsx("input",{value:a.promptFlag,placeholder:"prompt flag",onChange:k=>u({promptFlag:k.target.value})}),c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("input",{value:a.modelFlag,placeholder:"model flag",onChange:k=>u({modelFlag:k.target.value})}),c.jsx("input",{value:a.modelValue,placeholder:"model default",onChange:k=>u({modelValue:k.target.value})})]}),c.jsx("small",{children:g("env-write-only")}),h.map((k,F)=>c.jsxs("div",{className:"nc-fleet-env",children:[c.jsx("input",{value:k.key,disabled:k.configured,placeholder:"ENV_KEY",onChange:B=>{const V=h.slice();V[F]={...k,key:B.target.value},u({envRows:V})}}),c.jsx("input",{type:"password",value:k.value,placeholder:k.configured?"•••••• (unchanged)":"value",onChange:B=>{const V=h.slice();V[F]={...k,value:B.target.value},u({envRows:V})}}),c.jsx("button",{className:"nc-btn danger",onClick:()=>u({envRows:h.filter((B,V)=>V!==F)}),children:"×"})]},`${k.key}-${F}`)),c.jsx("button",{className:"nc-btn ghost",onClick:()=>u({envRows:[...h,{key:"",value:"",configured:!1}]}),children:"+ env"})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",onClick:()=>t(null),children:g("cancel")}),c.jsx("button",{className:"nc-btn primary",disabled:n||!a.id||b||a.kind==="custom"&&!a.command||a.kind==="managed"&&(v==null?void 0:v.requiresModel)&&!a.managedModel||a.kind==="managed"&&(v==null?void 0:v.credentialEnv)===!0&&!a.envKey||a.kind==="managed"&&a.provider==="custom"&&(!a.displayName||!a.baseUrl||!a.envKey||!a.providerId),onClick:r,children:g("save")})]})]})}function mN({token:e,route:t,targets:n=[],location:r,setLocation:o,state:a,setState:u,engines:h,busy:f,onSave:p}){var G;const[v,x]=N.useState(null),[w,S]=N.useState(""),y=a.form,b=z=>u({...a,form:{...y,...z}}),C=h.find(z=>z.id===y.engine),R=((G=C==null?void 0:C.managed)==null?void 0:G.client)==="shell",k=z=>{var X,A,M,E;const te=h.find(D=>D.id===z),H={...y.commands||{}};((X=C==null?void 0:C.managed)==null?void 0:X.client)==="shell"&&(y.command?H[y.engine]=y.command:delete H[y.engine]),b({engine:z,model:((A=y.models)==null?void 0:A[z])||((M=te==null?void 0:te.managed)==null?void 0:M.model)||((E=te==null?void 0:te.model)==null?void 0:E.value)||"",commands:H,command:H[z]||""})},F=z=>{const te={...y.commands||{}};z?te[y.engine]=z:delete te[y.engine],b({command:z,commands:te})},B=R&&/[|&;<>()`$*?{}\[\]~]/.test(y.command||""),V=async z=>{try{const te=await Bh(e,z,t);x(te),b({cwd:te.path}),S("")}catch(te){S(String(te.message||te))}};return c.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[c.jsx("b",{children:a.mode==="new"?g("fleet-new-cell"):`${g("edit")} ${y.id}`}),a.mode==="new"&&c.jsxs("label",{className:"nc-field",children:[g("location"),c.jsx("span",{className:"nc-req",children:" *"}),c.jsxs("select",{value:r,onChange:z=>{o(z.target.value),b({engine:""})},children:[c.jsx("option",{value:"",children:g("local")}),n.map(z=>c.jsxs("option",{value:z.route.join("/"),disabled:z.status&&z.status!=="up",children:[z.label,z.status&&z.status!=="up"?` · ${g("node-offline")}`:""]},z.route.join("/")))]})]}),c.jsx("input",{value:y.id,disabled:a.mode!=="new",placeholder:"id",onChange:z=>b({id:z.target.value})}),c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("input",{value:y.cwd,placeholder:g("cwd"),onChange:z=>b({cwd:z.target.value})}),c.jsx("button",{className:"nc-btn ghost",onClick:()=>v?x(null):V(y.cwd),children:g("browse")})]}),v&&c.jsxs("div",{className:"nc-fs",children:[c.jsx("div",{className:"nc-fs-path",children:v.path}),c.jsxs("div",{className:"nc-fs-list",children:[v.parent&&c.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>V(v.parent),children:["↑ ",g("fs-parent")]}),(v.dirs||[]).map(z=>c.jsxs("button",{className:"nc-fs-item",onClick:()=>V(`${v.path.replace(/\/$/,"")}/${z}`),children:["📁 ",z]},z))]})]}),w&&c.jsx("div",{className:"nc-err",children:w}),c.jsx("select",{value:y.engine,onChange:z=>k(z.target.value),children:h.map(z=>c.jsx("option",{value:z.id,children:z.label},z.id))}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:!!y.boot,onChange:z=>b({boot:z.target.checked})})," boot"]}),R?c.jsxs(c.Fragment,{children:[c.jsx("input",{value:y.command||"",maxLength:4096,placeholder:g("fleet-shell-command-placeholder"),onChange:z=>F(z.target.value)}),c.jsx("small",{children:y.command?g("fleet-shell-command-help"):g("fleet-shell-interactive")}),B&&c.jsx("small",{className:"nc-note",children:g("fleet-shell-command-metachar")})]}):c.jsxs(c.Fragment,{children:[c.jsx("input",{value:y.model||"",list:"nc-cell-models",placeholder:g("fleet-model-override"),onChange:z=>b({model:z.target.value})}),c.jsx("datalist",{id:"nc-cell-models",children:((C==null?void 0:C.availableModels)||[]).map(z=>c.jsx("option",{value:z},z))}),c.jsx("textarea",{value:y.prompt||"",placeholder:"prompt",onChange:z=>b({prompt:z.target.value})})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",onClick:()=>u(null),children:g("cancel")}),c.jsx("button",{className:"nc-btn primary",disabled:f||!y.id||!y.cwd||!y.engine,onClick:p,children:g("save")})]})]})}function S_({token:e,route:t=[],state:n,setState:r,busy:o,onSave:a}){const[u,h]=N.useState(null),[f,p]=N.useState([]),[v,x]=N.useState(""),w=Array.isArray(t)?t.join("/"):"";N.useEffect(()=>{let R=!0;return Ah(e,w?w.split("/"):[]).then(k=>{R&&(p(k.engines||[]),x(""))}).catch(k=>{R&&(p([]),x(String(k.message||k)))}),()=>{R=!1}},[e,w]);const S=n.form,y=R=>r({...n,form:{...S,...R}}),b=async R=>{try{const k=await Bh(e,R,t);h(k),y({cwd:k.path})}catch{}},C=!S.id&&S.tmuxSession?S.tmuxSession.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32):S.id;return c.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[c.jsxs("b",{children:[g("import-as-cell")," · ",S.tmuxSession]}),c.jsx("small",{children:g("import-help")}),c.jsx("input",{value:S.tmuxSession,disabled:!0,placeholder:"tmux session",readOnly:!0}),c.jsx("input",{value:S.id,placeholder:g("name"),onChange:R=>y({id:R.target.value})}),c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("input",{value:S.cwd,placeholder:g("cwd"),onChange:R=>y({cwd:R.target.value})}),c.jsx("button",{className:"nc-btn ghost",type:"button",onClick:()=>u?h(null):b(S.cwd),children:g("browse")})]}),u&&c.jsxs("div",{className:"nc-fs",children:[c.jsx("div",{className:"nc-fs-path",children:u.path}),c.jsxs("div",{className:"nc-fs-list",children:[u.parent&&c.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>b(u.parent),children:["↑ ",g("fs-parent")]}),(u.dirs||[]).map(R=>c.jsxs("button",{className:"nc-fs-item",onClick:()=>b(`${u.path.replace(/\/$/,"")}/${R}`),children:["📁 ",R]},R))]})]}),c.jsxs("select",{value:S.engine,onChange:R=>y({engine:R.target.value}),children:[c.jsx("option",{value:"",children:g("import-engine-required")}),f.map(R=>c.jsx("option",{value:R.id,children:R.label},R.id))]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:!!S.boot,onChange:R=>y({boot:R.target.checked})})," boot"]}),(n.err||v)&&c.jsx("div",{className:"nc-err",children:n.err||v}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",onClick:()=>r(null),children:g("cancel")}),c.jsx("button",{className:"nc-btn primary",disabled:o||!S.tmuxSession||!S.engine||!f.length,onClick:a,children:g(C?"import-as-cell":"save")})]})]})}function pl(e){const t=Bs(e);return t===null?`~/${e}`:t?`~/${t}`:"~"}function gN(e){if(!e||typeof e.path!="string"||typeof e.home!="string")return"";const{path:t,home:n}=e;return!n||t===n||!t.startsWith(n+"/")?"":t.slice(n.length+1).replace(/\/+$/,"")}function vN({token:e,route:t,cell:n,busy:r=!1,onSaved:o,onClose:a}){const[u,h]=N.useState(""),[f,p]=N.useState(null),[v,x]=N.useState(!1),[w,S]=N.useState(""),y=typeof(n==null?void 0:n.cwdSuggestion)=="string"&&Bs(n.cwdSuggestion)!==null?Bs(n.cwdSuggestion):null,[b,C]=N.useState(y),R=n==null?void 0:n.id,k=r||v,F=async H=>{const X=Bs(H);if(X===null){p({rel:"",dirs:[],loading:!1,err:g("fleet-cwd-repair-invalid")});return}p({rel:X,dirs:[],loading:!0,err:""});try{const A=await Bh(e,X,t),M=gN(A);p({rel:M,dirs:Array.isArray(A.dirs)?A.dirs:[],loading:!1,err:""})}catch(A){p({rel:X,dirs:[],loading:!1,err:String(A&&A.message||A)})}},B=H=>{if(!f)return;const X=f.rel?`${f.rel}/${H}`:H;F(X)},V=()=>{f!=null&&f.rel&&F(f.rel.split("/").slice(0,-1).join("/"))},G=()=>{f&&(h(f.rel||""),p(null),S(""),C(null))},z=()=>{b!==null&&(h(b),C(null),S(""))},te=async()=>{if(k)return;const H=Bs(u);if(H===null){S(g("fleet-cwd-repair-invalid"));return}const X=pl(H);let A=!0;try{A=window.confirm(g("fleet-cwd-repair-confirm").replace("{id}",String(R||"")).replace("{path}",X))}catch{A=!1}if(A){x(!0),S(""),C(null);try{const M=await A_(e,R,{cwdRel:H},t);o==null||o(M)}catch(M){const E=M&&M.data||{};if(E.code==="unportable-cwd"){S(g("fleet-cwd-repair-unportable"));const D=Array.isArray(E.cells)?E.cells.find(P=>P&&P.id===R):null,O=D&&typeof D.suggestion=="string"?D.suggestion:null;O!==null&&Bs(O)!==null&&C(O)}else S(String(M&&M.message||M))}finally{x(!1)}}};return c.jsxs("div",{className:"nc-set-form nc-fleet-form nc-cwd-repair",children:[c.jsx("b",{children:g("fleet-cwd-repair-title").replace("{id}",String(R||""))}),c.jsx("small",{className:"nc-set-info",children:g("fleet-cwd-repair-help")}),c.jsx("small",{className:"nc-cwd-no-source",children:g("fleet-cwd-repair-no-source-path")}),c.jsxs("label",{className:"nc-field",children:[g("cwd"),c.jsxs("div",{className:"nc-cwd-rel-row",children:[c.jsx("span",{className:"nc-cwd-rel-prefix",children:"~/"}),c.jsx("input",{value:u,placeholder:g("fleet-cwd-repair-placeholder"),autoComplete:"off",spellCheck:"false",autoCapitalize:"none",onChange:H=>h(H.target.value)}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:k,onClick:()=>f?p(null):F(""),children:g(f?"close":"fleet-cwd-repair-browse")})]})]}),c.jsx("div",{className:"nc-cwd-preview",children:g("fleet-cwd-repair-preview").replace("{path}",pl(u))}),f&&c.jsxs("div",{className:"nc-fs",children:[c.jsx("div",{className:"nc-fs-path",children:pl(f.rel)}),c.jsxs("div",{className:"nc-fs-list",children:[f.rel&&c.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:V,children:["↑ ",g("fs-parent")]}),f.loading&&c.jsx("div",{className:"nc-fs-empty",children:"…"}),!f.loading&&f.dirs.length===0&&c.jsx("div",{className:"nc-fs-empty",children:g("fleet-cwd-repair-fs-empty")}),!f.loading&&f.dirs.map(H=>c.jsxs("button",{type:"button",className:"nc-fs-item",onClick:()=>B(H),children:["📁 ",H]},H))]}),f.err&&c.jsx("div",{className:"nc-err",children:f.err}),c.jsx("div",{className:"nc-sheet-actions",children:c.jsx("button",{type:"button",className:"nc-btn primary",disabled:k||f.loading||!!f.err,onClick:G,children:g("fleet-cwd-repair-use-current")})})]}),w&&c.jsx("div",{className:"nc-err",role:"alert",children:w}),b!==null&&c.jsxs("div",{className:"nc-cwd-suggestion",role:"status",children:[c.jsx("span",{children:g("fleet-cwd-repair-suggestion")}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:z,children:g("fleet-cwd-repair-use-suggestion").replace("{path}",pl(b))})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:v,onClick:a,children:g("cancel")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:k,onClick:te,children:v?"…":g("save")})]})]})}function _N({token:e,readonly:t,targets:n=[],startNewCell:r=!1,initialLocation:o=""}){const[a,u]=N.useState({engines:[],cells:[],managedCatalog:[]}),[h,f]=N.useState({available:!1,capabilities:[]}),[p,v]=N.useState(!1),[x,w]=N.useState(null),[S,y]=N.useState(null),[b,C]=N.useState(!1),[R,k]=N.useState(""),[F,B]=N.useState(""),[V,G]=N.useState(o),[z,te]=N.useState(!1),[H,X]=N.useState(null),[A,M]=N.useState(null),[E,D]=N.useState(null),[O,P]=N.useState(!1),[$,L]=N.useState([]),[q,I]=N.useState(null),[T,U]=N.useState("manage"),Z=N.useRef(!1),ae=V?V.split("/"):[],he=N.useCallback(async()=>{try{const le=await vs(e,ae);f(le);try{const xe=await Oh(e,ae);te(!!xe.readonlyDefault)}catch{te(!1)}if(le.provider==="builtin"&&(le.capabilities||[]).includes("definitions")){const xe=await Ah(e,ae),ze=new Map((le.engines||[]).map(Ie=>[Ie.id,Ie]));if(xe.engines=(xe.engines||[]).map(Ie=>{var ue;return{...Ie,availableModels:((ue=ze.get(Ie.id))==null?void 0:ue.models)||[]}}),u(xe),(le.capabilities||[]).includes("credentials"))try{L((await e0(e,ae)).credentials||[])}catch{L([])}else L([])}k("")}catch(le){k(String(le.message||le))}finally{v(!0)}},[e,V]);N.useEffect(()=>{he();const le=setInterval(he,5e3);return()=>clearInterval(le)},[he]);const pe=new Set((h.cells||[]).filter(le=>le.active).map(le=>le.cell)),Q=h.provider==="builtin"&&(h.capabilities||[]).includes("edit"),ne=(h.capabilities||[]).includes("restore");N.useEffect(()=>{!r||Z.current||!Q||!a.engines.length||(Z.current=!0,y({mode:"new",form:w_(a.engines[0].id)}))},[r,Q,a.engines]);const fe=async le=>{C(!0),k(""),B("");try{await le(),await he()}catch(xe){k(String(xe.message||xe))}C(!1)},Se=()=>fe(async()=>{var Re;const le=x.mode==="new",xe=x.form,ze=a.managedCatalog||[],Ie=xe.kind==="managed"?Fo(ze,xe):null,ue=typeof(Ie==null?void 0:Ie.credentialEnv)=="string"?Ie.credentialEnv:"",Y=ue&&xe.credentialValue||"",ie=hN(xe,le,ze);!le&&x.form.kind==="custom"&&!x.form.modelFlag&&(ie.model=null),!le&&x.form.kind==="custom"&&x.form.promptMode!=="flag"&&(ie.promptFlag=null);let W;if(le)W=await n0(e,ie,ae);else{const we=x.original,je=new Set(x.form.envRows.filter(Oe=>!Oe.remove).map(Oe=>Oe.key)),st=(we.envKeys||[]).filter(Oe=>!je.has(Oe)),It=Object.fromEntries(x.form.envRows.filter(Oe=>!Oe.remove&&Oe.key&&(!Oe.configured||Oe.value!=="")).map(Oe=>[Oe.key,Oe.value]));W=await i0(e,we.id,ie,x.form.kind==="custom"?{set:It,remove:st}:void 0,ae)}let se=null;if(ue&&Y)try{se=await ng(e,ue,Y,ae),L(se.credentials||[])}catch{throw await he(),le&&w({mode:"edit",original:{...ie,id:xe.id},form:{...xe,credentialReveal:!1}}),new Error(g(le?"fleet-key-partial-create":"fleet-key-partial-edit"))}await he(),w(null),B(g("fleet-saved"));const ve=((Re=((se==null?void 0:se.credentials)||[]).find(we=>we.envKey===ue))==null?void 0:Re.activeCells)||[],ke=[...new Set([...(W==null?void 0:W.activeCells)||[],...ve])];if(ke.length&&window.confirm(g("fleet-restart-confirm").replace("{cells}",ke.join(", "))))for(const we of ke)await jo(e,we,ae)}),Ze=()=>fe(async()=>{var W,se,ve,ke,Re,we;const le=S.mode==="new",xe=S.form,ze={...le?{id:xe.id}:{},cwd:xe.cwd,engine:xe.engine,boot:!!xe.boot},Ie={...xe.commands||{}},ue=a.engines.find(je=>je.id===xe.engine);((W=ue==null?void 0:ue.managed)==null?void 0:W.client)==="shell"&&typeof xe.command=="string"&&xe.command.length?Ie[xe.engine]=xe.command:((se=ue==null?void 0:ue.managed)==null?void 0:se.client)==="shell"&&delete Ie[xe.engine],(Object.keys(Ie).length||!le)&&(ze.commands=Ie),le?(((ve=ue==null?void 0:ue.managed)==null?void 0:ve.client)!=="shell"&&xe.model&&(ze.model=xe.model),((ke=ue==null?void 0:ue.managed)==null?void 0:ke.client)!=="shell"&&xe.prompt&&(ze.prompt=xe.prompt)):(ze.model=((Re=ue==null?void 0:ue.managed)==null?void 0:Re.client)==="shell"?null:xe.model||null,((we=ue==null?void 0:ue.managed)==null?void 0:we.client)!=="shell"&&(ze.prompt=xe.prompt||null));const Y=le?await r0(e,ze,ae):await A_(e,S.original.id,ze,ae),ie=le?xe.id:S.original.id;y(null),B(g("fleet-saved")),!le&&(Y!=null&&Y.active)&&window.confirm(g("fleet-restart-confirm").replace("{cells}",ie))&&await jo(e,ie,ae)}),$e=t||z,He=le=>$.find(xe=>{var ze;return(ze=xe.engines)==null?void 0:ze.includes(le.id)})||null,vt=()=>fe(async()=>{var ze;const le=await ng(e,q.envKey,q.value,ae);L(le.credentials||[]),I(null),B(g("fleet-credential-saved"));const xe=((ze=(le.credentials||[]).find(Ie=>Ie.envKey===q.envKey))==null?void 0:ze.activeCells)||[];if(xe.length&&window.confirm(g("fleet-restart-confirm").replace("{cells}",xe.join(", "))))for(const Ie of xe)await jo(e,Ie,ae)}),Xe=le=>fe(async()=>{if(!window.confirm(g("fleet-credential-remove-confirm").replace("{key}",le.envKey)))return;const xe=await t0(e,le.envKey,ae);L(xe.credentials||[]),B(g("fleet-credential-removed"))}),St=le=>X({...le,route:Array.isArray(le==null?void 0:le.route)?le.route:ae}),Et=async le=>{if(!H)return;const xe=H.cell||H.id,ze=Array.isArray(H.route)?H.route:ae;le.action==="up"?await Mh(e,{cell:xe,boot:!!le.boot,...le.engine?{engine:le.engine}:{},...le.model!==void 0?{model:le.model}:{},...le.permissionPolicy?{permissionPolicy:le.permissionPolicy}:{}},ze):await kl(e,{cell:xe,boot:!!le.boot},ze)},rt=(le,xe)=>{k(""),M({mode:"new",route:Array.isArray(xe)?xe:ae,form:{tmuxSession:le.name,id:"",engine:"",cwd:"",boot:!1},err:""})},ct=()=>fe(async()=>{const le=A.form;if(!le.engine){M({...A,err:g("import-engine-required")});return}await o0(e,{tmuxSession:le.tmuxSession,id:le.id||void 0,engine:le.engine,cwd:le.cwd||void 0,boot:!!le.boot},le.route||ae),M(null),B(g("fleet-saved"))}),ot=({engineRows:le=[],cellRows:xe=[]})=>fe(async()=>{const ze=le.filter(Re=>Re.selected),Ie=ze.map(Re=>zw(Re.engine));if(Ie.some(Re=>!Re))throw new Error(g("fleet-backup-invalid-engine"));const ue=ze.filter(Re=>Re.exists).map(Re=>Re.engine.id);if(ue.length&&!window.confirm(g("fleet-backup-confirm-engine-overwrite").replace("{engines}",ue.join(", "))))return;const Y=[...new Set([...a.engines.map(Re=>Re.id),...Ie.map(Re=>Re.id)])],ie=[];for(const Re of xe.filter(we=>we.selected)){const we=lN(Re.cell,Re.engine,Y);if(!we)throw new Error(`${Re.cell.id}: ${g("fleet-backup-engine-missing")}`);ie.push(we)}const W=xe.filter(Re=>Re.selected&&Re.exists).map(Re=>Re.cell.id);if(W.length&&!window.confirm(g("fleet-backup-confirm-overwrite").replace("{cells}",W.join(", "))))return;const se=Ie.length?await l0(e,Ie,ue.length>0,ae):{needsRestart:[]},ve=ie.length?await a0(e,ie,ae):{needsRestart:[]},ke=[...new Set([...se.needsRestart||[],...ve.needsRestart||[]])];P(!1),B(`${g("fleet-backup-restored").replace("{n}",String(ie.length))}${Ie.length?` · ${Ie.length} ${g("fleet-engines").toLowerCase()}`:""}${ke.length?` · ${g("fleet-backup-needs-restart").replace("{cells}",ke.join(", "))}`:""}`)}),ut=c.jsxs("label",{className:"nc-field",children:[g("location"),c.jsxs("select",{value:V,onChange:le=>{G(le.target.value),w(null),y(null),k(""),B(""),te(!1),v(!1),f({available:!1,capabilities:[]}),u({engines:[],cells:[],managedCatalog:[]}),L([]),I(null)},children:[c.jsx("option",{value:"",children:g("local")}),n.map(le=>c.jsxs("option",{value:le.route.join("/"),disabled:le.status&&le.status!=="up",children:[le.label,le.status&&le.status!=="up"?` · ${g("node-offline")}`:""]},le.route.join("/")))]})]}),dt=c.jsxs("div",{className:"nc-fleet-view-tabs",role:"tablist","aria-label":g("tab-fleet"),children:[c.jsx("button",{type:"button",role:"tab","aria-selected":T==="manage",className:`nc-set-tabbtn${T==="manage"?" on":""}`,onClick:()=>U("manage"),children:g("fleet-manage-location")}),c.jsx("button",{type:"button",role:"tab","aria-selected":T==="overview",className:`nc-set-tabbtn${T==="overview"?" on":""}`,onClick:()=>U("overview"),children:g("fleet-network-overview")})]});return p?Q?c.jsxs("div",{className:"nc-set-tab nc-fleet-editor",children:[dt,T==="overview"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"nc-set-info",children:g("fleet-overview-help")}),c.jsx(Ed,{token:e,targets:n,readonly:t,onPower:St,onImport:rt})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"nc-set-info",children:g("fleet-manage-help")}),ut,c.jsxs("div",{className:"nc-set-row nc-fleet-backup-actions",children:[c.jsx("button",{className:"nc-btn ghost",disabled:$e||b,onClick:()=>{k(""),P(!0)},children:g("fleet-backup")}),c.jsx("small",{children:g("fleet-backup-help")})]}),c.jsxs("div",{className:"nc-fleet-section-head",children:[c.jsx("b",{children:g("fleet-cells")}),c.jsx("span",{className:"nc-fleet-head-actions",children:c.jsxs("button",{className:"nc-btn primary",disabled:$e||b||!a.engines.length,onClick:()=>{var le;k(""),y({mode:"new",form:w_((le=a.engines[0])==null?void 0:le.id)})},children:["+ ",g("add")]})})]}),a.cells.map(le=>{const xe=pe.has(le.id),ze=h.capabilities||[],Ie=le.needsRepair===!0;return c.jsxs("div",{className:"nc-fleet-item",children:[c.jsxs("span",{children:[c.jsx("b",{children:le.id}),c.jsxs("small",{children:[le.engine," · ",Ie?c.jsx("span",{className:"nc-fleet-tag nc-fleet-tag-warn",children:g("fleet-cwd-needs-repair")}):le.cwd,xe?` · ${g("service-active")}`:` · ${g("cell-off")}`]})]}),c.jsxs("span",{children:[xe&&ze.includes("down")&&c.jsx("button",{className:"nc-btn ghost",disabled:$e||b,onClick:()=>fe(()=>kl(e,{cell:le.id},ae)),children:g("stop")}),!xe&&ze.includes("up")&&c.jsx("button",{className:"nc-btn primary",disabled:$e||b,onClick:()=>St({cell:le.id,id:le.id,engine:le.engine,model:le.model,models:le.models,permissionPolicies:le.permissionPolicies,active:!1,boot:le.boot}),children:g("start")}),xe&&ze.includes("restart")&&c.jsx("button",{className:"nc-btn ghost",disabled:$e||b,onClick:()=>fe(()=>jo(e,le.id,ae)),children:g("restart")}),Ie?c.jsx("button",{className:"nc-btn ghost",disabled:$e||b,onClick:()=>{k(""),D(le)},children:g("fleet-cwd-repair")}):c.jsx("button",{className:"nc-btn ghost",disabled:$e||b,onClick:()=>{var ue;k(""),y({mode:"edit",original:le,form:{...le,commands:{...le.commands||{}},command:((ue=le.commands)==null?void 0:ue[le.engine])||""}})},children:g("edit")}),c.jsx("button",{className:"nc-btn danger",disabled:$e||b,onClick:()=>fe(async()=>{window.confirm(g("fleet-remove-cell").replace("{id}",le.id))&&await I_(e,le.id,!0,ae)}),children:"×"})]})]},le.id)}),c.jsxs("div",{className:"nc-fleet-section-head",children:[c.jsx("b",{children:g("fleet-engines")}),c.jsxs("button",{className:"nc-btn primary",disabled:$e||b,onClick:()=>{k(""),w({mode:"new",form:cN()})},children:["+ ",g("add")]})]}),a.engines.map(le=>{var ze,Ie;const xe=He(le);return c.jsxs("div",{className:"nc-fleet-item",children:[c.jsxs("span",{children:[c.jsx("b",{children:le.label}),c.jsx("small",{children:le.managed?`${le.id} · ${le.managed.client} / ${le.managed.provider} · ${(ze=le.managedInfo)!=null&&ze.configured?g("fleet-ready"):((Ie=le.managedInfo)==null?void 0:Ie.reason)||g("fleet-not-ready")}`:`${le.id} · ${le.command}`}),xe&&c.jsxs("small",{children:[xe.envKey," · ",g(`fleet-credential-source-${xe.source||"missing"}`)]})]}),c.jsxs("span",{children:[xe&&c.jsx("button",{className:"nc-btn ghost",disabled:$e||b,onClick:()=>{k(""),I({envKey:xe.envKey,value:""})},children:xe.configured?g("fleet-credential-change"):g("fleet-credential-set")}),(xe==null?void 0:xe.source)==="local"&&c.jsx("button",{className:"nc-btn danger",disabled:$e||b,onClick:()=>Xe(xe),children:g("fleet-credential-forget")}),c.jsx("button",{className:"nc-btn ghost",disabled:$e||b,onClick:()=>{k(""),w({mode:"edit",original:le,form:dN(le)})},children:g("edit")}),c.jsx("button",{className:"nc-btn danger",disabled:$e||b,onClick:()=>fe(async()=>{window.confirm(g("fleet-remove-engine").replace("{id}",le.id))&&await s0(e,le.id,ae)}),children:"×"})]})]},le.id)})]}),x&&c.jsx(Ds,{onClose:()=>w(null),label:g("fleet-new-engine"),error:R,children:c.jsx(pN,{state:x,setState:w,busy:b,onSave:Se,catalog:a.managedCatalog||[]})}),S&&c.jsx(Ds,{onClose:()=>y(null),label:g("fleet-new-cell"),error:R,children:c.jsx(mN,{token:e,route:ae,targets:n,location:V,setLocation:G,state:S,setState:y,engines:a.engines,busy:b,onSave:Ze})}),E&&c.jsx(Ds,{onClose:()=>D(null),label:g("fleet-cwd-repair-title").replace("{id}",E.id),error:"",children:c.jsx(vN,{token:e,route:ae,cell:E,busy:b,onSaved:async()=>{D(null),B(g("fleet-cwd-repaired")),await he()},onClose:()=>D(null)})}),F&&c.jsx("div",{className:"nc-set-note",children:F}),R&&c.jsx("div",{className:"nc-err",children:R}),O&&c.jsx(Ds,{onClose:()=>P(!1),label:g("fleet-backup"),error:R,children:c.jsx(fN,{cells:a.cells,engines:a.engines,busy:b,canRestore:ne,onRestore:ot,onClose:()=>P(!1)})}),q&&c.jsx(Ds,{onClose:()=>I(null),label:g("fleet-credential-title"),error:R,children:c.jsxs("div",{className:"nc-fleet-form nc-credential-form",children:[c.jsx("b",{children:g("fleet-credential-title")}),c.jsx("small",{children:g("fleet-credential-help")}),c.jsxs("label",{className:"nc-field",children:[q.envKey,c.jsx("input",{type:"password",autoComplete:"off",spellCheck:"false",autoCapitalize:"none",value:q.value,onChange:le=>I({...q,value:le.target.value})})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",onClick:()=>I(null),children:g("cancel")}),c.jsx("button",{className:"nc-btn primary",disabled:b||!q.value,onClick:vt,children:g("save")})]})]})}),A&&c.jsx(Ds,{onClose:()=>M(null),label:g("import-as-cell"),error:R,children:c.jsx(S_,{token:e,route:A.route||ae,state:A,setState:M,busy:b,onSave:ct})}),H&&c.jsx(El,{cell:H,token:e,route:Array.isArray(H.route)?H.route:ae,onConfirm:async le=>{try{await Et(le)}finally{await he()}},onClose:()=>X(null)})]}):c.jsxs("div",{className:"nc-set-tab",children:[dt,T==="overview"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"nc-set-info",children:g("fleet-overview-help")}),c.jsx(Ed,{token:e,targets:n,readonly:t,onPower:St,onImport:rt})]}):c.jsxs(c.Fragment,{children:[ut,c.jsxs("div",{className:"nc-set-info",children:[g(R?"fleet-editor-load-error":"fleet-editor-unavailable"),!R&&h.reason?` ${h.reason}`:""]})]}),R&&c.jsx("div",{className:"nc-err",children:R}),A&&c.jsx(Ds,{onClose:()=>M(null),label:g("import-as-cell"),error:R,children:c.jsx(S_,{token:e,route:A.route||ae,state:A,setState:M,busy:b,onSave:ct})}),H&&c.jsx(El,{cell:H,token:e,route:Array.isArray(H.route)?H.route:ae,onConfirm:async le=>{try{await Et(le)}finally{await he()}},onClose:()=>X(null)})]}):c.jsxs("div",{className:"nc-set-tab",children:[dt,T==="overview"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"nc-set-info",children:g("fleet-overview-help")}),c.jsx(Ed,{token:e,targets:n,readonly:t,onPower:St,onImport:rt})]}):c.jsxs(c.Fragment,{children:[ut,c.jsx("div",{className:"nc-set-info",children:g("fleet-editor-loading")})]})]})}const _f="nc_notification_speech_v1",ml="nc-notification-speech",Eh="nc-notification-speech-preview",yN=320,wN=2,SN=3e4,bN=1e4,xN=6e4,kN=64,b_=Object.freeze({enabled:!1}),CN=Object.freeze({it:"it-IT",en:"en-US",es:"es-ES"}),EN=Object.freeze({it:new Set(["che","con","correzione","della","delle","difetto","il","lavoro","nessun","non","per","pronto","pubblicata","pubblicato","rilascio","sono","stato","tutti","verificata","verificato","versione","completata","completato","riepilogo"]),en:new Set(["all","and","completed","fix","for","issue","no","published","ready","release","summary","the","verified","version","with","work"]),es:new Set(["con","correccion","defecto","el","esta","para","publicada","publicado","resumen","sin","todos","trabajo","verificada","verificado","version","y"])}),yf=new WeakSet;function wf(e){return{enabled:(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).enabled===!0}}function $w(){try{return typeof localStorage<"u"?localStorage:null}catch{return null}}function x_(e=$w()){if(!e)return{...b_};try{return wf(JSON.parse(e.getItem(_f)||"null"))}catch{return{...b_}}}function NN(e,t=$w()){const n=wf(e);if(t)try{t.setItem(_f,JSON.stringify(n))}catch{}return n}function Br(){try{return typeof window<"u"?window:null}catch{return null}}function $o(e=Br()){try{return!!(e&&e.speechSynthesis&&typeof e.speechSynthesis.speak=="function"&&typeof e.SpeechSynthesisUtterance=="function")}catch{return!1}}function Hw(e=Br()){return!!(e&&(typeof e=="object"||typeof e=="function")&&yf.has(e))}function Nh(e=Br()){e&&(typeof e=="object"||typeof e=="function")&&yf.delete(e)}function Er(e){const t=String(e||"").trim().toLowerCase().split("-")[0];return CN[t]||""}function Ql(e){return String(e||"").normalize("NFC").replace(/[\p{Cc}\p{Cf}]+/gu," ").replace(/\s+/g," ").trim()}function RN(e){const t=Ql(e).normalize("NFD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase(),n=new Set(t.match(new RegExp("\\p{L}+","gu"))||[]);if(n.size<4)return"";const r=Object.entries(EN).map(([o,a])=>({lang:o,score:[...n].reduce((u,h)=>u+(a.has(h)?1:0),0)})).sort((o,a)=>a.score-o.score);return r[0].score>=3&&r[0].score-r[1].score>=2?r[0].lang:""}function jN(e,t){const n=Er(e&&e.lang);return n||Er(RN(e&&e.body))||Er(t)}function Ww(e){try{const t=e&&e.speechSynthesis&&e.speechSynthesis.getVoices;return typeof t=="function"?Array.from(t.call(e.speechSynthesis)||[]).filter(Boolean):[]}catch{return[]}}function Uw(e,t){const n=Er(t);if(!n)return null;const r=Array.from(e||[]).filter(h=>h&&typeof h.lang=="string"&&h.lang.trim()),o=r.filter(h=>h.lang.trim().toLowerCase()===n.toLowerCase()),a=n.slice(0,2).toLowerCase(),u=r.filter(h=>h.lang.trim().toLowerCase().split("-")[0]===a);return o.find(h=>h.default===!0)||o[0]||u.find(h=>h.default===!0)||u[0]||null}function k_(e){return Ql(e).replace(/\bBearer\s+\S+/gi,"Bearer [redacted]").replace(/\b(?:sk|hf|zai|xox[baprs]|gh[pousr]|npm)[_-][A-Za-z0-9._-]{8,}\b/gi,"[redacted]").replace(/\b(?:token|password|secret|credential|api[_-]?key)\s*[=:]\s*(?:"[^"]*"|'[^']*'|\S+)/gi,"[redacted]").replace(/\b[A-Z][A-Z0-9_]{2,}\s*=\s*(?:"[^"]*"|'[^']*'|\S+)/g,"[redacted]").replace(/(?:\/home\/[^/\s]+|\/Users\/[^/\s]+|\/data\/(?:data|user\/\d+)\/[^/\s]+)(?:\/[^\s]*)?/g,"[private path]").replace(/\b[A-Za-z]:\\Users\\[^\\\s]+(?:\\[^\s]*)?/g,"[private path]")}function PN(e,t=yN){const n=k_(e&&e.title),r=k_(e&&e.body),o=[n,r&&r!==n?r:""].filter(Boolean).join(". "),a=Array.from(o);return a.length<=t?o:`${a.slice(0,Math.max(0,t-1)).join("").trimEnd()}…`}function LN(e){try{return!!(e&&e.visibilityState==="visible"&&typeof e.hasFocus=="function"&&e.hasFocus())}catch{return!1}}function Kw(e=Br()){if(!$o(e))return!1;try{return e.speechSynthesis.cancel(),!0}catch{return!1}}function TN(e){try{e&&typeof e.dispatchEvent=="function"&&typeof e.Event=="function"&&e.dispatchEvent(new e.Event(Eh))}catch{}}function DN(e,t,n=Br(),r={}){var p;if(Nh(n),!$o(n))return Promise.resolve(!1);const o=Ql(e);if(!o||(p=r.signal)!=null&&p.aborted)return Promise.resolve(!1);const a=Number.isFinite(r.timeoutMs)&&r.timeoutMs>0?r.timeoutMs:bN,u=r.setTimer||((v,x)=>setTimeout(v,x)),h=r.clearTimer||(v=>clearTimeout(v)),f=r.signal;return TN(n),new Promise(v=>{let x=!1,w=!1,S=null,y=null;const b=C=>{if(!x){if(x=!0,f&&y&&f.removeEventListener("abort",y),S!==null&&h(S),C)yf.add(n);else try{n.speechSynthesis.cancel()}catch{}v(C)}};y=()=>b(!1),f&&f.addEventListener("abort",y,{once:!0});try{n.speechSynthesis.cancel();const C=new n.SpeechSynthesisUtterance(o);C.lang=Er(t);const R=Uw(Ww(n),C.lang);R&&(C.voice=R),C.onstart=()=>{w=!0},C.onend=()=>b(w),C.onerror=()=>b(!1),S=u(()=>b(!1),a),n.speechSynthesis.speak(C)}catch{b(!1)}})}function MN(e={}){const t=e.scope||Br(),n=e.document||t&&t.document,r=Number.isInteger(e.maxPending)&&e.maxPending>=0?e.maxPending:wN,o=Number.isFinite(e.watchdogMs)&&e.watchdogMs>0?e.watchdogMs:SN,a=Number.isFinite(e.dedupWindowMs)&&e.dedupWindowMs>0?e.dedupWindowMs:xN,u=Number.isInteger(e.maxDedup)&&e.maxDedup>0?e.maxDedup:kN,h=e.now||Date.now,f=e.setTimer||((A,M)=>setTimeout(A,M)),p=e.clearTimer||(A=>clearTimeout(A)),v=e.isPrimed||(()=>Hw(t)),x=t&&t.speechSynthesis;let w=null,S=null,y=[],b=[],C=()=>{};const R=new Map,k=()=>{b=Ww(t)};if(k(),x&&typeof x.addEventListener=="function")x.addEventListener("voiceschanged",k),C=()=>x.removeEventListener("voiceschanged",k);else if(x&&"onvoiceschanged"in x){const A=x.onvoiceschanged,M=(...E)=>{k(),typeof A=="function"&&A.apply(x,E)};x.onvoiceschanged=M,C=()=>{x.onvoiceschanged===M&&(x.onvoiceschanged=A)}}const F=A=>{if(A&&typeof A.id=="string"&&A.id)return`id:${A.id}`;const M=Number(A&&A.ts),E=Ql(A&&A.title);return Number.isFinite(M)&&E?`frame:${M}:${E}`:""},B=A=>{if(!A)return!0;const M=h();for(const[E,D]of R)M-D>=a&&R.delete(E);if(R.has(A))return!1;for(R.set(A,M);R.size>u;)R.delete(R.keys().next().value);return!0},V=()=>{S!==null&&p(S),S=null},G=()=>{V(),w&&(w.onend=null,w.onerror=null,w=null),Kw(t)},z=A=>{if(!$o(t))return y=[],"unsupported";let M;try{M=new t.SpeechSynthesisUtterance(A.text),M.lang=Er(A.lang);const D=Uw(b,M.lang);D&&(M.voice=D)}catch{return y=[],"error"}w=M;const E=()=>{if(w!==M)return;V(),w=null,M.onend=null,M.onerror=null;const D=y.shift();D&&z(D)};M.onend=E,M.onerror=E;try{return S=f(()=>{if(w!==M)return;w=null,M.onend=null,M.onerror=null;try{t.speechSynthesis.cancel()}catch{}V();const D=y.shift();D&&z(D)},o),t.speechSynthesis.speak(M),"speaking"}catch{return E(),"error"}},te=(A,M)=>{if(!$o(t))return"unsupported";const E=PN(A);if(!E)return"empty";if(!B(F(A)))return"duplicate";if(!LN(n))return"inactive";if(!v())return"unprimed";const D={text:E,lang:M};return A&&A.urgency==="high"?(y=[],G(),z(D)):w?r===0?"dropped":(y.length>=r&&y.shift(),y.push(D),"queued"):z(D)},H=()=>{y=[],G()};return{enqueue:te,stop:H,dispose:()=>{H(),C(),C=()=>{}}}}function qw(){const[e,t]=N.useState(x_);N.useEffect(()=>{const r=o=>{if((o==null?void 0:o.type)==="storage"&&o.key!==_f&&o.key!==null)return;const a=(o==null?void 0:o.type)===ml?wf(o.detail):x_();t(a)};return window.addEventListener(ml,r),window.addEventListener("storage",r),()=>{window.removeEventListener(ml,r),window.removeEventListener("storage",r)}},[]);const n=N.useCallback(r=>{const o=NN({enabled:r===!0});return t(o),window.dispatchEvent(new CustomEvent(ml,{detail:o})),o.enabled},[]);return[e.enabled,n]}function AN({text:e}){const[t,n]=N.useState(!1),r=async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}};return c.jsxs("div",{className:"nc-set-copyline",children:[c.jsx("code",{children:e}),c.jsxs("button",{type:"button",className:"nc-btn ghost",onClick:r,children:[c.jsx(it,{name:"copy",size:14})," ",g(t?"copied":"copy")]})]})}function IN({value:e}){const[t,n]=N.useState("");return N.useEffect(()=>{let r=!0;return T2.toDataURL(e,{margin:1,width:220}).then(o=>{r&&n(o)}).catch(()=>{}),()=>{r=!1}},[e]),t?c.jsx("img",{src:t,width:"220",height:"220",alt:"NexusCrew pairing QR"}):null}function BN({token:e,nodes:t,roster:n,settings:r,readonly:o,refresh:a,refreshAliases:u}){const[h,f]=N.useState(null),[p,v]=N.useState(null),[x,w]=N.useState({}),[S,y]=N.useState(null),[b,C]=N.useState({ssh:"",sshPort:"",name:""}),[R,k]=N.useState(""),[F,B]=N.useState(""),[V,G]=N.useState(""),[z,te]=N.useState(!1),[H,X]=N.useState(null),[A,M]=N.useState(null),E=Date.now(),D=r&&r.deviceName||"",O=(t||[]).filter(Q=>Q&&Q.direction==="outbound"&&Q.name&&Q.ssh),P=O.find(Q=>Q.name===R)||O[0]||null,$=O.find(Q=>Q.name===F)||O[0]||null,L=$?Sg($.tunnel,E):null,q=$!=null&&$.shared?L!=null&&L.up?"share-local-active":"share-local-pending":L!=null&&L.up?"share-local-private":"share-local-private-down",I=[{key:"peer-group-hubs",rows:(t||[]).filter(Q=>Q.kind!=="transitive"&&Q.relation!=="client")},{key:"peer-group-clients",rows:(t||[]).filter(Q=>Q.kind!=="transitive"&&Q.relation==="client")},{key:"peer-group-routed",rows:(t||[]).filter(Q=>Q.kind==="transitive")}],T=async(Q,ne)=>{f(null),v(`${Q}:${ne}`);try{const fe=await zh(e,Q,ne);ne==="test"&&w(Se=>({...Se,[Q]:fe})),await a()}catch(fe){f(`${Q}: ${String(fe.message||fe)}`)}v(null)},U=async Q=>{f(null),v(`${Q}:remove`);try{await v0(e,Q),M(null),await a()}catch(ne){f(`${Q}: ${String(ne.message||ne)}`)}v(null)},Z=Q=>X({name:Q.name,direction:Q.direction,label:Q.label||Q.name,ssh:Q.ssh||"",sshPort:Q.sshPort?String(Q.sshPort):"",autostart:Q.autostart===!0,visibility:Q.visibility||"network",selected:[...Q.selected||[]]}),ae=async()=>{if(!H||!jr(H.label)){f(g("err-label"));return}const Q=H.direction==="inbound"?{label:H.label,visibility:H.visibility,selected:H.visibility==="selected"?H.selected:[]}:{label:H.label,ssh:H.ssh,autostart:H.autostart,...H.sshPort?{sshPort:Number(H.sshPort)}:{}};f(null),v(`${H.name}:edit`);try{await g0(e,H.name,Q),X(null),await a()}catch(ne){f(`${H.name}: ${String(ne.message||ne)}`)}v(null)},he=async Q=>{if($){f(null),v(`${$.name}:share`);try{await _0(e,$.name,Q),await a()}catch(ne){const fe=ne!=null&&ne.data&&ne.data.shared===!1?ne.data:null;if(fe)try{await a()}catch{}const Se=ne!=null&&ne.data&&typeof ne.data.hint=="string"?ne.data.hint:"",Ze=(fe==null?void 0:fe.revoked)===!0&&(fe==null?void 0:fe.localReconcilePending)===!0?g("share-off-local-reconcile-pending"):(fe==null?void 0:fe.revoked)===!1&&(fe==null?void 0:fe.reconcilePending)===!0?g("share-off-hub-reconcile-pending"):"";f(`${$.name}: ${String(ne.message||ne)}${Se?` — ${Se}`:""}${Ze?` — ${Ze}`:""}`)}v(null)}},pe=async()=>{if(f(null),P){const fe=wg({name:P.name,ssh:P.ssh,sshPort:P.sshPort||""});if(!fe.ok){f(g(fe.error));return}v("invite");try{y(await sg(e,{ssh:fe.value.ssh,...fe.value.sshPort?{sshPort:fe.value.sshPort}:{}},[P.name]))}catch(Se){f(String(Se.message||Se))}v(null);return}const Q=ps(b.name||V||D||"NexusCrew"),ne=wg({name:Q,ssh:b.ssh,sshPort:b.sshPort});if(!ne.ok){f(g(ne.error));return}v("invite");try{y(await sg(e,{...V||D?{label:V||D}:{},name:Q,ssh:ne.value.ssh,...ne.value.sshPort?{sshPort:ne.value.sshPort}:{}}))}catch(fe){f(String(fe.message||fe))}v(null)};return c.jsxs("div",{className:"nc-set-tab",children:[c.jsx("div",{className:"nc-sheet-label",children:g("peer-inventory-title")}),(t||[]).length===0&&c.jsx("div",{className:"nc-empty",children:g("no-nodes")}),I.map(Q=>Q.rows.length>0&&c.jsxs("div",{className:"nc-peer-group",children:[c.jsxs("div",{className:"nc-peer-group-title",children:[g(Q.key)," ",c.jsx("span",{children:Q.rows.length})]}),Q.rows.map(ne=>{var He,vt;const fe=ne.kind==="transitive",Se=fe?{up:ne.stale!==!0,label:ne.stale===!0?"peer-routed-stale":"peer-routed"}:Sg(ne.tunnel,E),Ze=x[ne.name],$e=ne.actions||{};return c.jsxs("div",{className:`nc-set-node${fe?" routed":""}`,children:[c.jsxs("div",{className:"nc-set-node-head",children:[c.jsx("span",{className:`nc-dot ${Se.up?"on":""}`}),c.jsx("b",{children:ne.label||ne.name}),c.jsxs("small",{children:[ne.name,fe?` · ${ne.route.join(" → ")}`:ne.direction==="outbound"?` · SSH ${ne.ssh||""}`:` · ${g("node-connected-client")}`,(He=ne.tunnel)!=null&&He.transport?` · ${ne.tunnel.transport} ${g("transport-used")}`:""]}),c.jsxs("span",{className:`nc-set-tunnel${Se.up?" up":""}`,children:[g(Se.label),Se.since?` · ${Se.since}`:""]})]}),!fe&&ne.direction==="inbound"&&c.jsx("div",{className:"nc-set-info",children:g(ne.shared?"peer-shared":"peer-private")}),$e.visibility&&ne.shared&&c.jsxs(c.Fragment,{children:[c.jsxs("select",{value:ne.visibility||"network",disabled:o||!!p,onChange:async Xe=>{v(`${ne.name}:visibility`);try{await og(e,ne.name,Xe.target.value),await a()}catch(St){f(String(St.message||St))}v(null)},children:[c.jsx("option",{value:"network",children:g("visibility-network")}),c.jsx("option",{value:"relay-only",children:g("visibility-relay")}),c.jsx("option",{value:"selected",children:g("visibility-selected")})]}),ne.visibility==="selected"&&c.jsx("div",{className:"nc-set-row",children:(t||[]).filter(Xe=>Xe.name!==ne.name&&Xe.nodeId).map(Xe=>{const St=(ne.selected||[]).includes(Xe.nodeId);return c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:St,disabled:o||!!p,onChange:async Et=>{const rt=Et.target.checked?[...ne.selected||[],Xe.nodeId]:(ne.selected||[]).filter(ct=>ct!==Xe.nodeId);v(`${ne.name}:visibility`);try{await og(e,ne.name,"selected",rt),await a()}catch(ct){f(String(ct.message||ct))}v(null)}})," ",Xe.label||Xe.name]},Xe.nodeId)})})]}),c.jsxs("div",{className:"nc-set-node-actions",children:[$e.edit&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>Z(ne),children:g("edit")}),$e.test&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!p,onClick:()=>T(ne.name,"test"),children:g("node-test")}),$e.disconnect&&Se.up&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>T(ne.name,"down"),children:g("tunnel-stop")}),$e.connect&&!Se.up&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>T(ne.name,"up"),children:g("tunnel-start")}),$e.restart&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>T(ne.name,"restart"),children:g("tunnel-restart")}),$e.remove&&c.jsxs("button",{type:"button",className:"nc-btn danger",disabled:o||!!p,title:g(o?"settings-readonly":"delete"),onClick:()=>M(ne.name),children:[c.jsx(it,{name:"trash",size:14})," ",g("delete")]})]}),(H==null?void 0:H.name)===ne.name&&c.jsxs("div",{className:"nc-set-form nc-node-editor",children:[c.jsxs("label",{className:"nc-field",children:[g("node-display-label"),c.jsx("input",{value:H.label,disabled:!!p,onChange:Xe=>X({...H,label:Xe.target.value})})]}),H.direction==="outbound"?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"nc-field",children:[g("node-ssh-label"),c.jsx("input",{value:H.ssh,disabled:!!p,onChange:Xe=>X({...H,ssh:Xe.target.value})})]}),c.jsxs("label",{className:"nc-field",children:[g("node-ssh-port-label"),c.jsx("input",{inputMode:"numeric",value:H.sshPort,disabled:!!p,onChange:Xe=>X({...H,sshPort:Xe.target.value.replace(/[^0-9]/g,"").slice(0,5)})})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:H.autostart,disabled:!!p,onChange:Xe=>X({...H,autostart:Xe.target.checked})})," ",g("boot-persist")]})]}):c.jsxs("label",{className:"nc-field",children:[g("peer-visibility"),c.jsxs("select",{value:H.visibility,disabled:!!p,onChange:Xe=>X({...H,visibility:Xe.target.value}),children:[c.jsx("option",{value:"network",children:g("visibility-network")}),c.jsx("option",{value:"relay-only",children:g("visibility-relay")}),c.jsx("option",{value:"selected",children:g("visibility-selected")})]})]}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn primary",disabled:!!p,onClick:ae,children:g("save")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!p,onClick:()=>X(null),children:g("cancel")})]})]}),A===ne.name&&c.jsxs("div",{className:"nc-set-confirm",children:[c.jsx("b",{children:g("node-remove-confirm").replace("{name}",ne.label||ne.name)}),c.jsx("small",{children:g("node-remove-warning")}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn danger",disabled:!!p,onClick:()=>U(ne.name),children:g("delete")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!p,onClick:()=>M(null),children:g("cancel")})]})]}),((vt=ne.health)==null?void 0:vt.detail)&&c.jsx("div",{className:`nc-set-test${ne.health.status==="healthy"?" ok":ne.health.status==="passive"?"":" ko"}`,children:ne.health.detail}),Ze&&c.jsxs("div",{className:`nc-set-test${Ze.ok?" ok":" ko"}`,children:[Ze.result,Ze.detail?` — ${Ze.detail}`:""]})]},`${ne.kind||"direct"}:${ne.nodeId||ne.name}`)})]},Q.key)),(n||[]).some(Q=>!Q.direct&&Q.instanceId)&&c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:g("routed-node-aliases")}),c.jsx("small",{className:"nc-set-hint",children:g("routed-node-aliases-help")}),(n||[]).filter(Q=>!Q.direct&&Q.instanceId).map(Q=>c.jsxs("div",{className:"nc-set-node",children:[c.jsxs("div",{className:"nc-set-node-head",children:[c.jsx("span",{className:`nc-dot ${Q.status==="up"?"on":""}`}),c.jsx("b",{children:Q.label||Q.name}),c.jsx("small",{children:(Q.route||[]).join(" › ")})]}),c.jsxs("div",{className:"nc-set-node-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:async()=>{const ne=window.prompt(g("node-local-alias"),Q.alias||"");if(ne!=null){if(ne.trim()&&!jr(ne.normalize("NFC"))){f(g("err-label"));return}v(`${Q.instanceId}:alias`),f(null);try{ne.trim()?await m0(e,Q.instanceId,ne):await rg(e,Q.instanceId),u()}catch(fe){f(String(fe.message||fe))}v(null)}},children:g("alias-on-device")}),Q.alias&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:async()=>{v(`${Q.instanceId}:alias-reset`),f(null);try{await rg(e,Q.instanceId),u()}catch(ne){f(String(ne.message||ne))}v(null)},children:g("reset-alias")})]})]},Q.instanceId))]}),$&&c.jsxs("div",{className:"nc-set-form nc-local-share",children:[c.jsx("div",{className:"nc-sheet-label",children:g("share-local-heading")}),O.length>1&&c.jsxs("label",{className:"nc-field",children:[g("share-local-hub"),c.jsx("select",{value:$.name,disabled:o||!!p,onChange:Q=>B(Q.target.value),children:O.map(Q=>c.jsx("option",{value:Q.name,children:Q.label||Q.name},Q.name))})]}),c.jsxs("label",{className:"nc-check nc-node-share",children:[c.jsx("input",{type:"checkbox",checked:$.shared===!0,disabled:o||!!p,onChange:Q=>he(Q.target.checked)}),c.jsxs("span",{children:[c.jsx("b",{children:g("share-local-through").replace("{device}",D||g("local")).replace("{hub}",$.label||$.name)}),c.jsx("small",{children:g($.shared?"share-node-on-desc":"share-node-off-desc")})]})]}),c.jsx("div",{className:`nc-set-test${$.shared&&(L!=null&&L.up)?" ok":L!=null&&L.up?"":" ko"}`,children:g(q)}),!(L!=null&&L.up)&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>he($.shared===!0),children:g("share-local-reconnect")})]}),c.jsx(Lw,{token:e,deviceDefault:D,localNodeId:r&&r.nodeId||"",localNameDefault:r&&r.localName||"",readonly:o,onSuccess:a}),c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:g("invite-node")}),c.jsx("small",{className:"nc-set-hint",children:g(P?"invite-network-hint":"invite-v2-hint")}),P?c.jsxs(c.Fragment,{children:[O.length>1&&c.jsxs("label",{className:"nc-field",children:[g("invite-network-label"),c.jsx("select",{value:P.name,disabled:o||!!p,onChange:Q=>{k(Q.target.value),y(null)},children:O.map(Q=>c.jsx("option",{value:Q.name,children:Q.label||Q.name},Q.name))})]}),c.jsxs("div",{className:"nc-set-info nc-invite-endpoint",children:[g("invite-network-via"),": ",c.jsx("b",{children:P.label||P.name})," · ",P.ssh,P.sshPort?`:${P.sshPort}`:""]}),c.jsx("small",{className:"nc-set-hint",children:g("invite-network-route")})]}):c.jsxs("label",{className:"nc-field",children:[g("invite-endpoint-label"),c.jsx("input",{placeholder:"user@host",value:b.ssh,disabled:o,onChange:Q=>C({...b,ssh:Q.target.value})}),c.jsx("small",{className:"nc-set-hint",children:g("invite-endpoint-needed")})]}),!P&&z&&c.jsxs("div",{className:"nc-invite-advanced",children:[c.jsxs("label",{className:"nc-field",children:[g("node-ssh-port-label"),c.jsx("input",{inputMode:"numeric",placeholder:"22",value:b.sshPort,disabled:o,onChange:Q=>C({...b,sshPort:Q.target.value.replace(/[^0-9]/g,"").slice(0,5)})})]}),c.jsxs("label",{className:"nc-field",children:[g("device-name-label"),c.jsx("input",{placeholder:D||"NexusCrew",value:V,disabled:o,onChange:Q=>G(Q.target.value)}),c.jsx("small",{className:"nc-set-hint",children:g("device-name-hint")})]}),c.jsxs("label",{className:"nc-field",children:[g("node-name-label"),c.jsx("input",{placeholder:ps(V||D||g("node-name-ph")),value:b.name,disabled:o,onChange:Q=>C({...b,name:Q.target.value?ps(Q.target.value):""})})]})]}),c.jsxs("div",{className:"nc-set-row nc-invite-actions",children:[c.jsx("button",{type:"button",className:"nc-btn primary",disabled:o||!!p||!P&&!b.ssh.trim(),onClick:pe,children:g("create-pairing-link")}),!P&&c.jsxs("button",{type:"button",className:"nc-btn ghost",disabled:!!p,onClick:()=>te(Q=>!Q),children:[z?"▾":"▸"," ",g("pair-advanced")]})]}),S&&c.jsxs(c.Fragment,{children:[c.jsx(IN,{value:S.pairingUrl}),c.jsx(AN,{text:S.pairingUrl}),c.jsx("div",{className:"nc-set-info",children:g("invite-next-steps")})]})]}),h&&c.jsx("div",{className:"nc-err",children:h})]})}function ON({token:e,readonly:t}){const[n,r]=N.useState("idle"),[o,a]=N.useState(!1),[u,h]=N.useState(null);N.useEffect(()=>{let p=!1;return U2().then(v=>{p||r(v)}),()=>{p=!0}},[]);const f=async()=>{h(null),a(!0);try{n==="subscribed"?(await q2(e),r("idle")):(await K2(e),r("subscribed"))}catch(p){const v=String(p.message||p);v==="push-denied"?(r("denied"),h(g("push-denied"))):v==="push-unsupported"?(r("unsupported"),h(g("push-unsupported"))):h(v)}a(!1)};return n==="unsupported"?c.jsx("div",{className:"nc-set-info",children:g("push-unsupported")}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||o||n==="denied",title:t?g("settings-readonly"):"",onClick:f,children:g(n==="subscribed"?"push-disable":"push-enable")}),c.jsx("span",{className:"nc-set-info",children:g(n==="subscribed"?"push-on":n==="denied"?"push-denied":"push-off")})]}),u&&c.jsx("div",{className:"nc-err",children:u})]})}function zN(){const[e,t]=qw(),[n,r]=N.useState(""),[o,a]=N.useState(""),[u,h]=N.useState(!1),[f,p]=N.useState(Hw),v=N.useRef(0),x=N.useRef(!1),w=N.useRef(null),S=$o();N.useEffect(()=>()=>{var C;v.current+=1,x.current&&((C=w.current)==null||C.abort(),w.current=null,x.current=!1,Nh())},[]);const y=async()=>{const C=v.current+=1,R=typeof AbortController=="function"?new AbortController:null;r(""),a(""),h(!0),p(!1),x.current=!0,w.current=R;const k=await DN(g("notification-speech-preview"),Cl(),void 0,R?{signal:R.signal}:{});return C!==v.current||(w.current=null,x.current=!1,h(!1),p(k),k?a(g("notification-speech-preview-ok")):r(g("notification-speech-preview-failed"))),k},b=C=>{var R;if(t(C),r(""),a(""),C)y();else{v.current+=1;const k=x.current;(R=w.current)==null||R.abort(),w.current=null,x.current=!1,h(!1),p(!1),Nh(),k||Kw()}};return c.jsxs("div",{className:"nc-set-form",children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox","aria-label":g("notification-speech-enable"),checked:e,disabled:!S,onChange:C=>b(C.target.checked)}),c.jsxs("span",{children:[c.jsx("b",{children:g("notification-speech-enable")}),c.jsx("small",{children:g("notification-speech-help")})]})]}),S?c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!e||u,onClick:()=>{y()},children:g(u?"notification-speech-testing":"notification-speech-test")})}):c.jsx("div",{className:"nc-set-info",children:g("notification-speech-unsupported")}),e&&!f&&!u&&!n&&c.jsx("div",{className:"nc-set-info",children:g("notification-speech-needs-test")}),o&&c.jsx("div",{className:"nc-set-info",role:"status",children:o}),n&&c.jsx("div",{className:"nc-err",children:n})]})}function FN({token:e,readonly:t,nodes:n=[],settings:r=null}){const[o,a]=N.useState(null),[u,h]=N.useState([]),[f,p]=N.useState({name:"",mode:"primary-failover",targets:[]}),[v,x]=N.useState(null),[w,S]=N.useState(!1),[y,b]=N.useState(null),[C,R]=N.useState(""),k=N.useCallback(async()=>{try{const[$,L]=await Promise.all([y0(e),x0(e)]);a($),h(Array.isArray(L==null?void 0:L.groups)?L.groups:[]),R("")}catch($){R(String($.message||$))}},[e]);N.useEffect(()=>{k()},[k]);const F=async $=>{S(!0),b(null),R("");try{a(await w0(e,$))}catch(L){R(String(L.message||L))}S(!1)},B=async()=>{S(!0),b(null),R("");try{b({kind:"test",...await S0(e)})}catch($){R(String($.message||$))}S(!1)},V=async()=>{S(!0),b(null),R("");try{b({kind:"stop",...await b0(e)})}catch($){R(String($.message||$))}S(!1)},G=[],z=new Set,te=($,L)=>{const q=typeof $=="string"?$.toLowerCase():"";!/^[a-f0-9]{32}$/.test(q)||z.has(q)||(z.add(q),G.push({id:q,label:L||q}))};te(r==null?void 0:r.nodeId,g("audio-group-local"));for(const $ of n||[])te(($==null?void 0:$.nodeId)||($==null?void 0:$.instanceId),($==null?void 0:$.label)||($==null?void 0:$.name)||($==null?void 0:$.nodeId));for(const $ of f.targets)te($,`${$} (${g("audio-group-unavailable-target")})`);const H=($=null)=>{R(""),$?(x($.name),p({name:$.name,mode:$.mode,targets:[...$.targets||[]]})):(x(null),p({name:"",mode:"primary-failover",targets:[]}))},X=($,L)=>p(q=>({...q,targets:L?[...new Set([...q.targets,$])]:q.targets.filter(I=>I!==$)})),A=async()=>{const $=f.name.trim().toLowerCase();if(!/^[a-z0-9][a-z0-9-]{0,31}$/.test($)||f.targets.length<1){R(g("audio-group-invalid"));return}S(!0),R("");try{const L=await k0(e,$,{targets:f.targets,mode:f.mode}),q=L==null?void 0:L.group;if(!q||!q.name)throw new Error(g("audio-group-save-failed"));h(I=>[...I.filter(T=>T.name!==q.name),q].sort((T,U)=>T.name.localeCompare(U.name))),H(null)}catch(L){R(String(L.message||L))}S(!1)},M=async $=>{S(!0),R("");try{await C0(e,$),h(L=>L.filter(q=>q.name!==$)),v===$&&H(null)}catch(L){R(String(L.message||L))}S(!1)},E=(o==null?void 0:o.installed)===!0,D=(o==null?void 0:o.liveness)==="ready",O=(o==null?void 0:o.consent)===!0&&E&&D,P=y?y.kind==="stop"?g(y.stopped?"audio-stop-stopped":"audio-stop-idle"):y.status==="accepted"||y.status==="spoken"?g("audio-test-accepted"):y.status==="unknown"?g("audio-test-unknown"):`${g("audio-test-refused")}${y.reason?` (${y.reason})`:""}`:"";return c.jsxs("div",{className:"nc-set-tab nc-audio-settings",children:[c.jsxs("div",{className:"nc-set-info",children:[c.jsx("b",{children:g("audio-title")}),c.jsx("br",{}),g("audio-help")]}),o?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox","aria-label":g("audio-consent"),checked:o.consent===!0,disabled:t||w,onChange:$=>{F($.target.checked)}}),c.jsxs("span",{children:[c.jsx("b",{children:g("audio-consent")}),c.jsx("small",{children:g("audio-consent-help")})]})]}),c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:g("audio-capability")}),c.jsxs("div",{className:"nc-set-info",children:[g("audio-adapter"),": ",o.adapter||g("audio-adapter-none"),c.jsx("br",{}),g("audio-installed"),": ",g(E?"audio-installed-yes":"audio-installed-no"),c.jsx("br",{}),g("audio-liveness"),": ",g(D?"audio-liveness-ready":"audio-liveness-unavailable"),Array.isArray(o.languages)&&o.languages.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("br",{}),g("audio-languages"),": ",o.languages.join(", ")]})]}),o.limits&&c.jsxs("small",{className:"nc-set-hint",children:[g("audio-limits"),": ",o.limits]})]}),!o.consent&&c.jsx("div",{className:"nc-set-info",children:g("audio-test-needs-consent")}),!E&&c.jsx("div",{className:"nc-set-info",children:g("audio-unavailable")}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn primary",disabled:t||w||!O,title:t?g("settings-readonly"):"",onClick:()=>{B()},children:g(w?"audio-testing":"audio-test")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:w,onClick:()=>{V()},children:g(w?"audio-stopping":"audio-stop")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:w,onClick:()=>{k()},children:g("refresh")})]}),c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:g("audio-groups-title")}),c.jsx("small",{className:"nc-set-hint",children:g("audio-groups-help")}),u.length===0&&c.jsx("div",{className:"nc-set-info",children:g("audio-groups-empty")}),u.map($=>{var L;return c.jsxs("div",{className:"nc-set-row",children:[c.jsxs("span",{children:[c.jsx("b",{children:$.name})," ",c.jsxs("small",{children:["· ",$.mode==="fanout"?g("audio-group-fanout"):g("audio-group-primary")," · ",((L=$.targets)==null?void 0:L.length)||0]})]}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||w,onClick:()=>H($),children:g("audio-group-edit")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||w,onClick:()=>{M($.name)},children:g("audio-group-delete")})]},$.name)}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||w,onClick:()=>H(null),children:g("audio-group-new")})}),c.jsxs("label",{className:"nc-field",children:[g("audio-group-name"),c.jsx("input",{"aria-label":g("audio-group-name"),value:f.name,maxLength:"32",disabled:t||w,onChange:$=>p(L=>({...L,name:$.target.value}))})]}),c.jsxs("label",{className:"nc-field",children:[g("audio-group-mode"),c.jsxs("select",{"aria-label":g("audio-group-mode"),value:f.mode,disabled:t||w,onChange:$=>p(L=>({...L,mode:$.target.value})),children:[c.jsx("option",{value:"primary-failover",children:g("audio-group-primary")}),c.jsx("option",{value:"fanout",children:g("audio-group-fanout")})]})]}),c.jsx("div",{className:"nc-set-info",children:g("audio-group-targets")}),G.length===0?c.jsx("small",{className:"nc-set-hint",children:g("audio-group-no-targets")}):G.map($=>c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:f.targets.includes($.id),disabled:t||w,onChange:L=>X($.id,L.target.checked)}),c.jsxs("span",{children:[$.label,c.jsx("small",{children:$.id})]})]},$.id)),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn primary",disabled:t||w,onClick:()=>{A()},children:g("audio-group-save")}),v&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:w,onClick:()=>H(null),children:g("audio-group-cancel")})]})]})]}):c.jsx("div",{className:"nc-set-info",children:g("audio-loading")}),P&&c.jsx("div",{className:"nc-set-note",role:"status",children:P}),C&&c.jsx("div",{className:"nc-err",children:C})]})}function $N(){const[e,t]=of();return c.jsxs("div",{className:"nc-set-tab nc-input-settings",children:[c.jsx("div",{className:"nc-set-info",children:g("input-settings-local")}),c.jsxs("div",{className:"nc-set-form",children:[c.jsxs("label",{className:"nc-field",children:[g("terminal-keyboard-gesture"),c.jsx("select",{"aria-label":g("terminal-keyboard-gesture"),value:e.terminalKeyboardGesture,onChange:n=>t({terminalKeyboardGesture:n.target.value}),children:cw.map(n=>c.jsx("option",{value:n,children:g(`terminal-keyboard-${n}`)},n))}),c.jsx("small",{children:g("terminal-keyboard-gesture-help")})]}),c.jsxs("label",{className:"nc-field",children:[g("keybar-layout"),c.jsx("select",{"aria-label":g("keybar-layout"),value:e.keybarLayout,onChange:n=>t({keybarLayout:n.target.value}),children:uw.map(n=>c.jsx("option",{value:n,children:g(`keybar-layout-${n}`)},n))}),c.jsx("small",{children:g("keybar-layout-help")})]})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:e.keybarKeepsKeyboardClosed,onChange:n=>t({keybarKeepsKeyboardClosed:n.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:g("keybar-ime-lock")}),c.jsx("small",{children:g("keybar-ime-lock-help")})]})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:e.voiceKeepsKeyboardClosed,onChange:n=>t({voiceKeepsKeyboardClosed:n.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:g("voice-ime-lock")}),c.jsx("small",{children:g("voice-ime-lock-help")})]})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:e.showKeybarEnter,onChange:n=>t({showKeybarEnter:n.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:g("keybar-enter-show")}),c.jsx("small",{children:g("keybar-enter-show-help")})]})]}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>t(ds),children:g("input-settings-reset")})})]})}function HN({token:e,roster:t=[],readonly:n}){const r=[{key:"local",route:[],label:g("diagnostics-local"),status:"up"},...t.filter(O=>Array.isArray(O.route)&&O.route.length).map(O=>({key:O.route.join("/"),route:O.route,label:O.label||O.name,status:O.status}))],[o,a]=N.useState("local"),u=r.find(O=>O.key===o)||r[0],[h,f]=N.useState(null),[p,v]=N.useState([]),[x,w]=N.useState(""),[S,y]=N.useState(!1),[b,C]=N.useState(!0),[R,k]=N.useState(900),[F,B]=N.useState("all"),[V,G]=N.useState(""),z=N.useRef(0),te=N.useRef(null),H=N.useCallback(async()=>{try{const O=await j0(e,u.route);if(f(O),w(""),!S){const P=await P0(e,{after:z.current,limit:200},u.route);Array.isArray(P.records)&&P.records.length&&(z.current=P.cursor,v($=>[...$,...P.records].slice(-500)))}}catch(O){w(O&&O.status===404?g("diagnostics-unsupported"):String(O.message||O))}},[e,u.key,S]);N.useEffect(()=>{z.current=0,v([]),f(null),w("")},[u.key]),N.useEffect(()=>{let O=null,P=!0;const $=()=>{!P||document.visibilityState==="hidden"||H()},L=()=>{O&&clearInterval(O),O=document.visibilityState==="hidden"?null:setInterval($,2e3),document.visibilityState!=="hidden"&&$()};return document.addEventListener("visibilitychange",L),L(),()=>{P=!1,O&&clearInterval(O),document.removeEventListener("visibilitychange",L)}},[H]),N.useEffect(()=>{b&&te.current&&(te.current.scrollTop=te.current.scrollHeight)},[p,b]);const X=p.filter(O=>(F==="all"||O.level===F)&&(!V||String(O.component||"").toLowerCase().includes(V.toLowerCase()))),A=X.map(O=>`${O.ts} ${O.level.toUpperCase()} ${O.component} ${O.code} ${O.message}${Object.keys(O.meta||{}).length?` ${JSON.stringify(O.meta)}`:""}`).join(`
92
+ `),M=async O=>{w("");try{const P=await O();f(P),await H()}catch(P){w(String(P.message||P))}},E=async()=>{try{await navigator.clipboard.writeText(A)}catch{w(g("copy-manual"))}},D=()=>{try{const O=new Blob([`${JSON.stringify(X,null,2)}
93
+ `],{type:"application/json"}),P=URL.createObjectURL(O),$=document.createElement("a");$.href=P,$.download="nexuscrew-diagnostics.json",$.click(),URL.revokeObjectURL(P)}catch{w(g("diagnostics-export-failed"))}};return c.jsxs("div",{className:"nc-set-tab nc-diagnostics",children:[c.jsxs("label",{className:"nc-field",children:[g("diagnostics-target"),c.jsx("select",{value:u.key,onChange:O=>a(O.target.value),children:r.map(O=>c.jsxs("option",{value:O.key,children:[O.label,O.status!=="up"?` · ${O.status}`:""]},O.key))})]}),c.jsxs("div",{className:"nc-set-form nc-diag-controls",children:[c.jsx("div",{className:"nc-sheet-label",children:g("diagnostics-verbose")}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("select",{"aria-label":g("diagnostics-duration"),value:R,onChange:O=>k(Number(O.target.value)),disabled:n,children:[300,900,1800,3600].map(O=>c.jsxs("option",{value:O,children:[O/60," min"]},O))}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:n||(h==null?void 0:h.verbose)===!0,onClick:()=>M(()=>ag(e,!0,R,u.route)),children:g("enable")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||(h==null?void 0:h.verbose)!==!0,onClick:()=>M(()=>ag(e,!1,R,u.route)),children:g("stop")})]}),c.jsx("small",{className:"nc-set-hint",children:h!=null&&h.verbose?g("diagnostics-expires").replace("{time}",new Date(h.expiresAt).toLocaleTimeString()):g("diagnostics-off")})]}),c.jsxs("div",{className:"nc-diag-filters",children:[c.jsxs("select",{"aria-label":g("diagnostics-level"),value:F,onChange:O=>B(O.target.value),children:[c.jsx("option",{value:"all",children:g("diagnostics-all-levels")}),["debug","info","warn","error"].map(O=>c.jsx("option",{value:O,children:O},O))]}),c.jsx("input",{"aria-label":g("diagnostics-component"),placeholder:g("diagnostics-component"),value:V,onChange:O=>G(O.target.value)})]}),c.jsxs("div",{className:"nc-set-row",children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:S,onChange:O=>y(O.target.checked)})," ",g("diagnostics-pause")]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:b,onChange:O=>C(O.target.checked)})," ",g("diagnostics-autoscroll")]})]}),c.jsx("pre",{ref:te,className:"nc-diag-log","aria-label":g("diagnostics-log"),children:A||g("diagnostics-empty")}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:E,children:g("copy")}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:D,children:g("diagnostics-export")}),c.jsx("button",{type:"button",className:"nc-btn danger",disabled:n,onClick:()=>{window.confirm(g("diagnostics-clear-confirm"))&&M(async()=>{const O=await L0(e,u.route);return z.current=0,v([]),O})},children:g("diagnostics-clear")})]}),x&&c.jsx("div",{className:"nc-err",children:x})]})}function WN({token:e,settings:t,readonly:n,refresh:r,roster:o,section:a,setSection:u}){const[h,f]=N.useState(null),[p,v]=N.useState(null),[x,w]=N.useState(!1),[S,y]=N.useState(!1),[b,C]=N.useState(null),[R,k]=N.useState(!0),[F,B]=N.useState(!1);N.useEffect(()=>{C(t&&t.update||null),k(!t||t.autoUpdate!==!1),B(!!(t&&t.alternateScreen))},[t]);const V=async()=>{f(null),v(null),y(!0);try{const E=await h0(e);v(E.note||"ok"),w(!1)}catch(E){f(String(E.message||E))}y(!1)},G=async()=>{f(null),v(null),y(!0);try{const E=await E0(e);v(`${E.note||"ok"}${E.target?` (${E.target})`:""}`)}catch(E){f(String(E.message||E))}y(!1)},z=async E=>{f(null),v(null),y(!0);try{await jd(e,{autoUpdate:E}),k(E),r&&await r()}catch(D){f(String(D.message||D))}y(!1)},te=async E=>{f(null),v(null),y(!0);try{await jd(e,{alternateScreen:E}),B(E),r&&await r()}catch(D){f(String(D.message||D))}y(!1)},H=async()=>{f(null),v(null),y(!0);try{C(await N0(e))}catch(E){f(String(E.message||E))}y(!1)},X=async()=>{f(null),v(null),y(!0);try{const E=await R0(e);C(E),v(g("npm-update-restarting"))}catch(E){f(String(E.message||E))}y(!1)},A=()=>{window.confirm(g("composer-clear-confirm"))&&(f(null),SE()?(window.dispatchEvent(new Event(wh)),v(g("composer-clear-done"))):f(g("composer-clear-failed")))},M=t&&t.service;return c.jsxs("div",{className:"nc-set-tab",children:[c.jsx("div",{className:"nc-system-tabs",role:"tablist","aria-label":g("tab-system"),children:["general","diagnostics"].map(E=>c.jsx("button",{type:"button",role:"tab","aria-selected":a===E,className:`nc-set-tabbtn${a===E?" on":""}`,onClick:()=>u(E),children:g(`system-${E}`)},E))}),a==="general"&&c.jsxs(c.Fragment,{children:[c.jsxs("section",{className:"nc-system-group",children:[c.jsx("h3",{children:g("system-this-node")}),t&&c.jsxs("div",{className:"nc-set-info",children:["v",t.version," · ",t.platform," · :",t.port,c.jsx("br",{}),M&&M.installed?g("service-installed"):g("service-missing"),M&&M.installed?` · ${M.active?g("service-active"):g("service-inactive")}`:"",M?` · boot ${M.boot?"on":"off"}`:""]}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||S,title:n?g("settings-readonly"):"",onClick:G,children:g("service-regenerate")})}),c.jsx(ON,{token:e,readonly:n}),c.jsx(zN,{})]}),c.jsxs("section",{className:"nc-system-group",children:[c.jsx("h3",{children:g("system-updates")}),c.jsxs("div",{className:"nc-set-form nc-update-settings",children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:R,disabled:n||S||b&&!b.supported,onChange:E=>z(E.target.checked)}),c.jsxs("span",{children:[c.jsx("b",{children:g("npm-auto-update")}),c.jsx("small",{children:g("npm-auto-update-help")})]})]}),b&&c.jsxs("div",{className:"nc-set-info",children:[g("npm-update-current")," v",b.current,b.latest?` · ${g("npm-update-latest")} v${b.latest}`:""," · ",g(`npm-update-${b.supported?b.phase:"unsupported"}`)]}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||S||!b||!b.supported,onClick:H,children:g("npm-update-check")}),b&&b.available&&c.jsx("button",{type:"button",className:"nc-btn primary",disabled:n||S||b.phase==="installing",onClick:X,children:g("npm-update-install")})]}),b&&b.lastError&&c.jsx("div",{className:"nc-err",children:b.lastError})]})]}),c.jsxs("section",{className:"nc-system-group",children:[c.jsx("h3",{children:g("system-security")}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||S,title:n?g("settings-readonly"):"",onClick:()=>{f(null),v(null),w(!0)},children:g("token-rotate")})})]}),c.jsxs("section",{className:"nc-system-group",children:[c.jsx("h3",{children:g("system-local-data")}),c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:g("composer-clear-data")}),c.jsx("small",{className:"nc-set-hint",children:g("composer-clear-data-help")}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:A,children:g("composer-clear-data")})})]})]})]}),a==="diagnostics"&&c.jsxs("section",{className:"nc-system-group nc-system-diagnostics",children:[c.jsx("h3",{children:g("system-diagnostics")}),c.jsxs("div",{className:"nc-set-form nc-alternate-screen-settings",children:[c.jsx("div",{className:"nc-sheet-label",children:g("system-terminal")}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox","aria-label":g("alternate-screen"),checked:F,disabled:n||S,onChange:E=>te(E.target.checked)}),c.jsxs("span",{children:[c.jsx("b",{children:g("alternate-screen")}),c.jsx("small",{children:g("alternate-screen-help")})]})]})]}),c.jsx(HN,{token:e,roster:o,readonly:n})]}),x&&c.jsxs("div",{className:"nc-set-confirm",children:[c.jsx("div",{children:g("token-rotate-explain")}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:S,onClick:()=>w(!1),children:g("cancel")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:S,onClick:V,children:g("confirm")})]})]}),p&&c.jsx("div",{className:"nc-set-note",children:p}),h&&c.jsx("div",{className:"nc-err",children:h})]})}function UN({token:e,onClose:t,initialTab:n="nodes",initialLocation:r="",startNewCell:o=!1}){$n();const a=n==="diagnostics"?"diagnostics":"general",[u,h]=N.useState(n==="diagnostics"?"system":n),f=N.useRef(null),p=N.useRef(null),[v,x]=N.useState({start:!1,end:!1}),[w,S]=N.useState(a),[y,b]=N.useState(null),[C,R]=N.useState([]),[k,F]=N.useState(!1),[B,V]=N.useState(null),[G,z]=N.useState(0),te=$h(e,!0,G),H=N.useCallback(()=>{const A=f.current;if(!A)return;const M=A.scrollWidth>A.clientWidth+1,E={start:M&&A.scrollLeft>1,end:M&&A.scrollLeft+A.clientWidth<A.scrollWidth-1};x(D=>D.start===E.start&&D.end===E.end?D:E)},[]);N.useEffect(()=>{const A=f.current;if(!A)return;const M=typeof ResizeObserver=="function"?new ResizeObserver(H):null;return M==null||M.observe(A),window.addEventListener("resize",H),H(),()=>{M==null||M.disconnect(),window.removeEventListener("resize",H)}},[H]),N.useEffect(()=>{var M,E;(E=(M=p.current)==null?void 0:M.scrollIntoView)==null||E.call(M,{behavior:"smooth",block:"nearest",inline:"nearest"});const A=window.requestAnimationFrame?window.requestAnimationFrame(H):setTimeout(H,0);return()=>{window.cancelAnimationFrame?window.cancelAnimationFrame(A):clearTimeout(A)}},[u,H]);const X=N.useCallback(async()=>{try{const A=await O_(e);b(A),V(null)}catch(A){V(String(A.message||A))}try{const A=await u0(e);R(A.peers||[])}catch(A){V(String(A.message||A))}},[e]);return N.useEffect(()=>{X();const A=setInterval(X,5e3);return()=>clearInterval(A)},[X]),N.useEffect(()=>{let A=!1;return Vt("/api/config",e).then(M=>M.json()).then(M=>{A||F(!!M.readonlyDefault)}).catch(()=>{}),()=>{A=!0}},[e]),c.jsx("div",{className:"nc-set-overlay",onClick:t,children:c.jsxs("div",{className:"nc-set-panel",onClick:A=>A.stopPropagation(),children:[c.jsxs("div",{className:"nc-set-head",children:[c.jsx(it,{name:"gear",size:18}),c.jsx("b",{children:g("settings")}),c.jsx("button",{type:"button",className:"nc-set-close",onClick:t,title:g("close"),children:c.jsx(it,{name:"x",size:18})})]}),k&&c.jsx("div",{className:"nc-set-readonly",children:g("settings-readonly")}),B&&c.jsx("div",{className:"nc-err",children:B}),c.jsx("div",{className:`nc-set-tabs-wrap${v.start?" has-start-overflow":""}${v.end?" has-end-overflow":""}`,children:c.jsx("div",{className:"nc-set-tabs",ref:f,onScroll:H,children:["nodes","fleet","audio","input","system"].map(A=>c.jsx("button",{ref:u===A?p:null,type:"button",className:`nc-set-tabbtn${u===A?" on":""}`,onClick:()=>h(A),children:g(`tab-${A}`)},A))})}),c.jsxs("div",{className:"nc-set-body",children:[u==="nodes"&&c.jsx(BN,{token:e,nodes:C,roster:te,settings:y,readonly:k,refresh:X,refreshAliases:()=>z(A=>A+1)}),u==="fleet"&&c.jsx(_N,{token:e,readonly:k,startNewCell:o,initialLocation:r,targets:te.map(A=>({route:A.route,label:A.label||A.name,status:A.status}))}),u==="audio"&&c.jsx(FN,{token:e,readonly:k,nodes:C,settings:y}),u==="input"&&c.jsx($N,{}),u==="system"&&c.jsx(WN,{token:e,settings:y,readonly:k,refresh:X,roster:te,section:w,setSection:S})]})]})})}function KN({token:e,initialPair:t,deviceDefault:n="",localNodeId:r="",localNameDefault:o="",onPairDone:a,onDone:u}){$n();const[h,f]=N.useState(t?"pair":"welcome"),[p,v]=N.useState(!1),[x,w]=N.useState(null),S=async()=>{v(!0),w(null);try{await jd(e,{wizardDone:!0}),a&&a(),u()}catch(y){w(String(y.message||y)),v(!1)}};return c.jsx("div",{className:"nc-wiz-overlay",children:c.jsxs("div",{className:"nc-wiz",children:[c.jsxs("div",{className:"nc-wiz-head",children:[c.jsx("b",{children:g("wizard-title")}),c.jsx("small",{children:g("hydra-simple")})]}),h==="welcome"&&c.jsxs("div",{className:"nc-wiz-body",children:[c.jsx("div",{className:"nc-wiz-done",children:g("local-ready")}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",disabled:p,onClick:S,children:g("local-only")}),c.jsx("button",{className:"nc-btn primary",disabled:p,onClick:()=>f("pair"),children:g("add-node")})]})]}),h==="pair"&&c.jsxs("div",{className:"nc-wiz-body",children:[c.jsx(Lw,{token:e,initial:t||"",autoStart:!!t,deviceDefault:n,localNodeId:r,localNameDefault:o,onBusyChange:v,onSuccess:async()=>{a&&a(),f("done")}}),c.jsx("div",{className:"nc-sheet-actions",children:c.jsx("button",{className:"nc-btn ghost",disabled:p,onClick:()=>{a&&a(),f("welcome")},children:g("back")})})]}),h==="done"&&c.jsxs("div",{className:"nc-wiz-body",children:[c.jsx("div",{className:"nc-wiz-done",children:g("node-connected")}),c.jsx("div",{className:"nc-sheet-actions",children:c.jsx("button",{className:"nc-btn primary",disabled:p,onClick:S,children:g("finish")})})]}),x&&c.jsx("div",{className:"nc-err",children:x})]})})}function qN(e,t){if(typeof EventSource>"u"||!e)return()=>{};const n=new EventSource(`/api/events?token=${encodeURIComponent(e)}`);return n.onmessage=r=>{try{const o=JSON.parse(r.data);o&&typeof o=="object"&&typeof o.type=="string"&&t(o)}catch{}},()=>{try{n.close()}catch{}}}const VN=6e3,YN=12e3;function GN({n:e,onClose:t}){return c.jsxs("div",{className:`nc-ntf-toast${e.urgency==="high"?" high":""}`,role:"status","aria-live":"polite",children:[c.jsxs("div",{className:"nc-ntf-toast-txt",children:[c.jsx("b",{children:e.title}),e.body&&c.jsx("small",{children:e.body}),e.session&&c.jsx("span",{className:"nc-ntf-from",children:e.session})]}),c.jsx("button",{type:"button",className:"nc-ntf-x",onClick:t,title:g("close"),children:c.jsx(it,{name:"x",size:14})})]})}function XN({ask:e,token:t,onAnswered:n}){const[r,o]=N.useState(""),[a,u]=N.useState(!1),[h,f]=N.useState(null),p=async v=>{const x=String(v||"").trim();if(!(!x||a)){f(null),u(!0);try{await D0(t,e.id,x),n(e.id)}catch(w){f(String(w.message||w))}u(!1)}};return c.jsxs("div",{className:"nc-ask-card",children:[c.jsxs("div",{className:"nc-ask-head",children:[c.jsx("span",{className:"nc-ntf-from",children:e.session}),c.jsxs("code",{className:"nc-ask-id",children:["#",e.id]})]}),c.jsx("div",{className:"nc-ask-q",children:e.question}),Array.isArray(e.options)&&e.options.length>0&&c.jsx("div",{className:"nc-ask-opts",children:e.options.map(v=>c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:a,onClick:()=>p(v),children:v},v))}),c.jsxs("div",{className:"nc-ask-reply",children:[c.jsx("textarea",{rows:2,placeholder:g("ask-reply-ph"),value:r,disabled:a,onChange:v=>o(v.target.value)}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:a||!r.trim(),onClick:()=>p(r),children:g("send")})]}),h&&c.jsx("div",{className:"nc-err",children:h})]})}function JN({token:e}){const[t]=$n(),[n]=qw(),[r,o]=N.useState([]),[a,u]=N.useState([]),[h,f]=N.useState(()=>{try{return/(?:^|[#&])ask=/.test(location.hash)}catch{return!1}}),p=N.useRef(0),v=N.useRef(null);v.current||(v.current=MN());const x=N.useRef({enabled:n,lang:t});x.current={enabled:n,lang:t};const w=N.useCallback(b=>{o(C=>C.filter(R=>R.key!==b))},[]),S=N.useCallback(b=>{const C=`t${p.current+=1}`;o(k=>[...k.slice(-3),{...b,key:C}]),setTimeout(()=>w(C),b.urgency==="high"?YN:VN);const R=x.current;if(R.enabled)try{v.current.enqueue(b,jN(b,R.lang))}catch{}},[w]);N.useEffect(()=>{n||v.current.stop()},[n]),N.useEffect(()=>{const b=()=>{(document.visibilityState!=="visible"||!document.hasFocus())&&v.current.stop()},C=()=>v.current.stop();return document.addEventListener("visibilitychange",b),window.addEventListener("blur",b),window.addEventListener(Eh,C),()=>{document.removeEventListener("visibilitychange",b),window.removeEventListener("blur",b),window.removeEventListener(Eh,C),typeof v.current.dispose=="function"?v.current.dispose():v.current.stop()}},[]),N.useEffect(()=>{if(!e)return;let b=!1;T0(e).then(R=>{b||u(R.asks||[])}).catch(()=>{});const C=qN(e,R=>{R.type==="notify"?S(R):R.type==="ask"&&R.ask&&R.ask.id?u(k=>k.some(F=>F.id===R.ask.id)?k:[...k,R.ask]):R.type==="ask-answered"&&R.id&&u(k=>k.filter(F=>F.id!==R.id))});return()=>{b=!0,C()}},[e,S]);const y=b=>u(C=>C.filter(R=>R.id!==b));return c.jsxs(c.Fragment,{children:[r.length>0&&c.jsx("div",{className:"nc-ntf-toasts",children:r.map(b=>c.jsx(GN,{n:b,onClose:()=>w(b.key)},b.key))}),a.length>0&&!h&&c.jsxs("button",{type:"button",className:"nc-ask-badge",onClick:()=>f(!0),title:g("asks-title"),children:["? ",c.jsx("span",{className:"nc-ask-count",children:a.length})]}),a.length>0&&h&&c.jsxs("div",{className:"nc-ask-panel",children:[c.jsxs("div",{className:"nc-ask-panel-head",children:[c.jsx("b",{children:g("asks-title")}),c.jsx("span",{className:"nc-ask-count",children:a.length}),c.jsx("button",{type:"button",className:"nc-ntf-x",onClick:()=>f(!1),title:g("close"),children:c.jsx(it,{name:"x",size:16})})]}),c.jsx("div",{className:"nc-ask-panel-body",children:a.map(b=>c.jsx(XN,{ask:b,token:e,onAnswered:y},b.id))})]})]})}function QN(e){const t=new Map((e.sessions||[]).map(o=>[o.name,o])),n=[],r=(o,a,u=[],h="")=>{const f=new Map((a||[]).map(p=>[p.name,p]));for(const p of o||[]){const v=f.get(p.tmuxSession)||{},x=Wh(p,v);n.push({key:`${u.join("/")||"local"}:${p.tmuxSession}`,session:p.tmuxSession,cellName:p.cell,node:u.length?u.join("/"):"",nodeLabel:h,live:!!p.tmux,working:x.working,degraded:!!p.degraded,activity:v.activity||p.activity||0,subtitle:x.subtitle})}};r(e.cells,[...t.values()]);for(const o of e.nodeGroups||[])r(o.cells,o.sessions,Array.isArray(o.route)?o.route:[],o.label||o.name||"");return n.sort((o,a)=>Number(a.live)-Number(o.live)||a.activity-o.activity||o.cellName.localeCompare(a.cellName))}function ZN({token:e,current:t,onPick:n,onClose:r}){const[o,a]=N.useState(bg),u=N.useRef(null),h=N.useMemo(()=>QN(o),[o]);return N.useEffect(()=>{var p;(p=u.current)==null||p.focus();const f=v=>{v.key==="Escape"&&r()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]),N.useEffect(()=>{let f=!0;return Promise.all([Vt("/api/sessions",e).then(p=>p.json()).catch(()=>({})),vs(e).catch(()=>({}))]).then(([p,v])=>{if(!f)return;const x=sy({...bg(),sessions:Array.isArray(p.sessions)?p.sessions:o.sessions,cells:v.available?v.cells||[]:o.cells});a(x)}),()=>{f=!1}},[e]),c.jsx("div",{className:"nc-cell-switcher-backdrop",onClick:r,children:c.jsxs("aside",{ref:u,className:"nc-cell-switcher",role:"dialog","aria-modal":"true","aria-label":g("fleet-cells"),tabIndex:-1,onClick:f=>f.stopPropagation(),children:[c.jsxs("div",{className:"nc-cell-switcher-head",children:[c.jsx("b",{children:g("fleet-cells")}),c.jsx("button",{type:"button",onClick:r,children:"×"})]}),c.jsxs("div",{className:"nc-cell-switcher-list",children:[h.length===0&&c.jsx("div",{className:"nc-empty",children:g("fleet-inventory-empty")}),h.map(f=>{const p=(t==null?void 0:t.session)===f.session&&((t==null?void 0:t.node)||"")===f.node,v=f.degraded?g("cell-degraded"):f.working?g("cell-working"):f.live?g("cell-idle"):g("cell-off");return c.jsxs("button",{type:"button",className:`nc-cell-switcher-row${p?" on":""}${f.live?"":" off"}`,disabled:!f.live,title:v,onClick:()=>{n({session:f.session,...f.node?{node:f.node}:{},cellName:f.cellName}),r()},children:[c.jsx("span",{className:`nc-cell-switcher-dot${f.degraded?" warn":f.live?` on${f.working?" working":""}`:""}`}),c.jsxs("span",{className:"nc-cell-switcher-copy",children:[c.jsx("b",{children:f.cellName}),c.jsx("small",{children:[f.nodeLabel,f.subtitle].filter(Boolean).join(" · ")})]})]},f.key)})]})]})})}const Nd=e=>wi($s(e)).length===0,Rd=e=>Array.isArray(e)?e.join("/"):"";function eR(e){const t=new Set,n=[];for(const r of Array.isArray(e)?e:[])!r||!zn.test(String(r.instanceId||""))||!Array.isArray(r.route)||!r.route.length||t.has(r.instanceId)||(t.add(r.instanceId),n.push({instanceId:r.instanceId,route:[...r.route],label:String(r.label||r.name||r.route.join(" › ")),status:r.status||"offline"}));return n.sort((r,o)=>r.label.localeCompare(o.label))}function Ro(e){return{instanceId:e.ownerId,route:e.ownerRoute||[],label:e.ownerLabel,status:e.available===!1?"offline":"up"}}function Ms(e,t,n,r=!1,o=!0){const a=t.instanceId;return{...e,id:Cr(r?null:a,e.name),ownerId:a,ownerRoute:r?[]:[...t.route],ownerLabel:r?"Local":t.label,local:r,available:o,ownerTopology:Array.isArray(n)?n:[],layout:bh(e.layout,a,n)}}function tR(e,t,n,r,o=[]){const[a,u]=N.useState([]),[h,f]=N.useState(!1),[p,v]=N.useState("idle"),[x,w]=N.useState(""),[S,y]=N.useState(""),b=N.useRef([]),C=N.useRef([]),R=N.useRef(""),k=N.useRef(t),F=N.useRef(n),B=N.useRef(!1),V=N.useRef(!0),G=N.useRef(""),z=N.useMemo(()=>eR(o),[o]),te=z.map(I=>`${I.instanceId}:${Rd(I.route)}:${I.status}:${I.label}`).join("|");C.current=z,F.current=n,k.current=t,b.current=a;const H=N.useCallback(I=>xh(I.layout,R.current,C.current),[]),X=N.useCallback((I,T=!0,U=k.current)=>{const Z=Mv(I,dl()),ae=b.current.some(pe=>pe.id===U);b.current=Z,u(Z);const he=Z.find(pe=>pe.id===U);if(T&&he){V.current=!0;const pe=H(he);r(pe),he.local&&KE(he.name,pe)}else ae&&!he&&(V.current=!0,r(kr()),w("deck non più condiviso dal nodo owner"));$E(Z.filter(pe=>pe.local).map(pe=>pe.name))},[r,H]),A=N.useCallback(async I=>{let T=await nl(e);const U=T.decks.find(Z=>Z.name==="main");if(T.decks.length===1&&U&&U.revision===0&&Nd(U.layout)){const Z=FE(),ae=$s(kh("main")||kr());if(!Nd(ae)){const he=bh(ae,I,[]);T.decks[0]=await il(e,"main",he,0,[])}for(const he of Z.filter(pe=>pe!=="main"))try{let pe=await lg(e,he,[]);const Q=$s(kh(he)||kr());Nd(Q)||(pe=await il(e,he,bh(Q,I,[]),pe.revision,[]))}catch{}T=await nl(e)}return T},[e]),M=N.useCallback(async({migrate:I=!1}={})=>{const T=await Oh(e,[]),U=zn.test(String(T.instanceId||""))?T.instanceId:"";if(!U)throw new Error("instanceId locale non disponibile");R.current=U,y(U);const[Z,ae]=await Promise.all([I?A(U):nl(e),ig(e,[]).catch(()=>({nodes:[]}))]),he={instanceId:U,route:[],label:"Local"},pe=Z.decks.map(ne=>Ms(ne,he,ae.nodes,!0,!0)),Q=b.current;return await Promise.all(C.current.map(async ne=>{if(ne.status!=="up"){pe.push(...Q.filter(fe=>!fe.local&&fe.ownerId===ne.instanceId).map(fe=>({...fe,ownerRoute:[...ne.route],ownerLabel:ne.label,available:!1})));return}try{const[fe,Se]=await Promise.all([nl(e,ne.route),ig(e,ne.route).catch(()=>({nodes:[]}))]);pe.push(...fe.decks.map(Ze=>Ms(Ze,ne,Se.nodes,!1,!0)))}catch{pe.push(...Q.filter(Se=>!Se.local&&Se.ownerId===ne.instanceId).map(Se=>({...Se,ownerRoute:[...ne.route],ownerLabel:ne.label,available:!1})))}})),pe.sort((ne,fe)=>ne.local===fe.local?ne.ownerLabel.localeCompare(fe.ownerLabel)||(ne.name==="main"?-1:fe.name==="main"?1:ne.name.localeCompare(fe.name)):ne.local?-1:1),pe},[e,A,te]);N.useEffect(()=>{if(!e)return;let I=!1;const T=G.current!==e;return G.current=e,M({migrate:T}).then(U=>{if(I)return;const Z=b.current.find(pe=>pe.id===k.current),ae=U.find(pe=>pe.id===k.current),he=ae&&(!Z||ae.revision>Z.revision||Z.available!==ae.available||Rd(Z.ownerRoute)!==Rd(ae.ownerRoute));X(U,T||!!he&&!B.current),f(!0),ae&&w("")}).catch(U=>{I||(f(!0),w(String(U.message||U)))}),()=>{I=!0}},[X,M,te,e]);const E=N.useCallback(async(I=k.current)=>{if(!h||!B.current)return!0;const T=b.current.find(U=>U.id===I);if(!T)return w(`deck inesistente: ${I}`),!1;if(T.available===!1)return w(`nodo owner offline: ${T.ownerLabel}`),!1;v("saving");try{const U=Tv($s(F.current),T.ownerId,T.ownerTopology),Z=await il(e,T.name,U,T.revision,T.ownerRoute),ae=Ms(Z,Ro(T),T.ownerTopology,T.local,!0);return X(b.current.map(he=>he.id===I?ae:he),!1),B.current=!1,v("saved"),w(""),setTimeout(()=>v("idle"),1500),!0}catch(U){if(v("error"),w(String(U.message||U)),U.status===409&&U.data&&U.data.current){const Z=b.current.find(he=>he.id===I),ae=Ms(U.data.current,Ro(Z),Z.ownerTopology,Z.local,!0);X(b.current.map(he=>he.id===I?ae:he),!1)}return!1}},[h,e,X]);return N.useEffect(()=>{if(!h)return;if(V.current){V.current=!1;return}B.current=!0,v("saving");const I=setTimeout(E,650);return()=>clearTimeout(I)},[n,h,E]),N.useEffect(()=>{if(!h)return;const I=setInterval(async()=>{try{const T=await M(),U=b.current.find(he=>he.id===k.current),Z=T.find(he=>he.id===k.current),ae=Z&&(!U||Z.revision>U.revision||U.available!==Z.available);X(T,ae&&!B.current)}catch{}},5e3);return()=>clearInterval(I)},[h,M,X]),{decks:a,records:a,localNodeId:S,ready:h,saveState:p,error:x,setError:w,saveNow:E,select:async I=>{if(B.current&&!await E(k.current))throw new Error("salvataggio del deck corrente fallito: cambio annullato");const T=b.current.find(U=>U.id===I);if(!T)throw new Error(`deck inesistente: ${I}`);return B.current=!1,V.current=!0,H(T)},add:async(I,T=null)=>{const U=T===_i?b.current.find(he=>he.local):T?b.current.find(he=>he.ownerId===T):null;if(!U||U.available===!1)throw new Error("nodo owner non disponibile");const Z=await lg(e,I,U.ownerRoute),ae=Ms(Z,Ro(U),U.ownerTopology,U.local,!0);return X([...b.current,ae],!1),ae},rename:async(I,T)=>{const U=b.current.find(Q=>Q.id===I);if(!U)throw new Error("deck inesistente");if(I===k.current&&B.current&&!await E(I))throw new Error(`salvataggio di "${U.name}" fallito: rinomina annullata`);const Z=b.current.find(Q=>Q.id===I);if(!Z)throw new Error("deck inesistente");const ae=await M0(e,Z.name,T,Z.revision,Z.ownerRoute),he=Ms(ae,Ro(Z),Z.ownerTopology,Z.local,!0),pe=Z.local?_i:Z.ownerId;return td(WE(dl(),pe,I,he.id)),X(b.current.map(Q=>Q.id===I?he:Q),!1),he},remove:async I=>{const T=b.current.find(Z=>Z.id===I);if(!T)throw new Error("deck inesistente");I===k.current&&(B.current=!1),await A0(e,T.name,T.revision,T.ownerRoute);const U=T.local?_i:T.ownerId;td(UE(dl(),U,I)),X(b.current.filter(Z=>Z.id!==I),!1)},reorder:(I,T)=>{const U=b.current.find(ne=>ne.id===I),Z=b.current.find(ne=>ne.id===T);if(!U||!Z)return!1;const ae=U.local?_i:U.ownerId,he=Z.local?_i:Z.ownerId;if(ae!==he)return!1;const pe=b.current.filter(ne=>(ne.local?_i:ne.ownerId)===ae).map(ne=>ne.id),Q=td(HE(dl(),ae,I,T,pe));return X(Mv(b.current,Q),!1),!0},addTileTo:async(I,T)=>{const U=b.current.find(ne=>ne.id===I);if(!U)throw new Error("deck inesistente");if(U.available===!1)throw new Error(`nodo owner offline: ${U.ownerLabel}`);const Z=fw(T,R.current,C.current);if(!Z)throw new Error("riferimento sessione non valido");const ae=H(U),he=Tv(ty(ae,Z),U.ownerId,U.ownerTopology),pe=await il(e,U.name,he,U.revision,U.ownerRoute),Q=Ms(pe,Ro(U),U.ownerTopology,U.local,!0);return X(b.current.map(ne=>ne.id===I?Q:ne),!1),Q},localMainId:Cr(null,"main"),parseDeckId:Vl}}const nR="/sw.js",Rh="nc-sw-update";let jh=null,Ph=!1,Lh=null,Vw=Object.freeze({needed:!1,kind:null,version:""}),Yw=!1;function Gw(){typeof window<"u"&&window.dispatchEvent(new Event(Rh))}function Xw(){const e=Lh||(Ph?{kind:"reload",version:""}:null);Vw=Object.freeze({needed:!!e,kind:(e==null?void 0:e.kind)||null,version:(e==null?void 0:e.version)||""})}function C_(){return Vw}function iR(e){return typeof window>"u"?()=>{}:(window.addEventListener(Rh,e),()=>window.removeEventListener(Rh,e))}function Sf(e){Ph!==e&&(Ph=e,Xw(),Gw())}function sR(e,t,n){let r=null;e&&t&&e!==t?r={kind:"install",version:e}:t&&n&&t!==n&&(r={kind:"reload",version:t});const o=JSON.stringify(r)===JSON.stringify(Lh);Lh=r,Xw(),o||Gw()}function rR(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&Sf(!0)})}function oR(){typeof navigator>"u"||!("serviceWorker"in navigator)||(navigator.serviceWorker.addEventListener("controllerchange",()=>{Yw&&location.reload()}),navigator.serviceWorker.register(nR).then(e=>{jh=e,e.waiting&&Sf(!0),e.addEventListener("updatefound",()=>{const t=e.installing;t&&rR(t)}),setInterval(()=>{e.update().catch(()=>{})},3600*1e3)}).catch(()=>{}))}function aR(){Yw=!0,Sf(!1);const e=jh&&jh.waiting;e?(e.postMessage({type:"SKIP_WAITING"}),setTimeout(()=>location.reload(),4e3)):location.reload()}function lR({hash:e="",origin:t="",pathname:n="",search:r=""}={}){const o=String(e||"").replace(/^#/,""),a=`${n||""}${r||""}`;if(!o)return{token:"",pair:"",nextUrl:a};const u=new URLSearchParams(o),h=u.get("token")||"",f=u.get("pair")||"",p=f?`${t||""}${n||""}#pair=${f}`:"";return{token:h,pair:p,nextUrl:a}}const Jw=9,Qw=24,Zw="nc_side_w",E_="nc_side_min",cR=240,N_="(min-width:1024px) and (pointer:fine)";function uR(){const e=Number(localStorage.getItem(Zw));return e>=180&&e<=480?e:cR}function dR(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=Jw&&e<=Qw?e:13}function hR(){const e={token:"",pair:""};try{const{token:t,pair:n,nextUrl:r}=lR({hash:location.hash,origin:location.origin,pathname:location.pathname,search:location.search});if(t){e.token=t;try{localStorage.setItem("nc_token",t)}catch{}}if(n){e.pair=n;try{sessionStorage.setItem("nc_pair",n)}catch{}}if(location.hash)try{history.replaceState(null,"",r)}catch{}}catch{}if(e.token||(e.token=sessionStorage.getItem("nc_token")||localStorage.getItem("nc_token")||""),!e.pair){const t=sessionStorage.getItem("nc_pair");t&&(e.pair=t)}return e}function fR(e){try{return $s(kh(e))}catch{return kr()}}function R_(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 pR(){const[e,t]=N.useState(()=>window.matchMedia(N_).matches);return N.useEffect(()=>{const n=window.matchMedia(N_),r=o=>t(o.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}function j_({session:e,node:t,ownerId:n,cellName:r,token:o,readonly:a=!1,onBack:u,onCellSwitcher:h,cellSwitcherOpen:f=!1}){$n();const[p]=of(),[v,x]=N.useState(!1),[w,S]=N.useState(()=>window.matchMedia("(pointer: coarse)").matches),[y,b]=N.useState(null),[C,R]=N.useState(dR),[k,F]=N.useState(r||e),[B,V]=N.useState(""),G=P=>R($=>{const L=Math.max(Jw,Math.min(Qw,$+P));return localStorage.setItem("nc_fontsize",String(L)),L}),z=N.useRef(()=>{}),te=N.useRef(()=>!1),H=N.useRef(()=>{}),X=N.useRef(!1),[A,M]=N.useState(!1),[E,D]=N.useState(!1),O=()=>{X.current=!X.current,M(X.current)};return N.useEffect(()=>{F(r||e)},[r,e]),N.useEffect(()=>{let P=!0;const $=t?t.split("/"):[],L=t?`/api/route/${t.split("/").map(encodeURIComponent).join("/")}/_`:"/api";async function q(){let T=null,U=null;try{const he=await(await Vt(`${L}/sessions`,o)).json();Array.isArray(he.sessions)&&(T=he.sessions.find(pe=>pe.name===e))}catch{}try{const ae=await vs(o,$);ae.available&&Array.isArray(ae.cells)&&(U=ae.cells.find(he=>he.tmuxSession===e))}catch{}if(!P)return;F(af({session:e,cell:U||(r?{cell:r}:null)}));let Z="";U?Z=`${U.engine}${U.key?`·${U.key}`:""}`:T&&(Z=T.attached?`attached · ${R_(T.activity)}`:T.activity?R_(T.activity):""),V(Z)}q();const I=setInterval(q,4e3);return()=>{P=!1,clearInterval(I)}},[e,t,o]),c.jsxs("div",{className:"nc-app",children:[c.jsxs("header",{className:"nc-bar nc-bar-single",children:[c.jsxs("button",{onClick:u,title:g("sessions"),children:[c.jsx(it,{name:"chevronLeft",size:18}),c.jsx("span",{className:"nc-bar-label",children:g("sessions")})]}),c.jsxs("span",{className:"nc-bar-center",children:[c.jsx("b",{title:t?`${k} · ${t}`:k,children:k}),B&&c.jsx("small",{className:"nc-bar-sub",children:B})]}),c.jsxs("span",{className:"nc-bar-right",children:[c.jsx("button",{onClick:()=>G(-1),title:g("zoom-out"),children:c.jsx(it,{name:"zoomOut",size:18})}),c.jsx("button",{onClick:()=>G(1),title:g("zoom-in"),children:c.jsx(it,{name:"zoomIn",size:18})}),c.jsx("button",{onClick:()=>S(P=>!P),title:g("composer"),children:c.jsx(it,{name:"keyboard",size:20})}),c.jsx("button",{onClick:()=>x(P=>!P),title:g("files"),children:c.jsx(it,{name:"folder",size:20})})]})]}),c.jsx("div",{className:"nc-termwrap",children:c.jsx(Qy,{session:e,node:t,token:o,readonly:a,takeSize:!0,sendRef:z,composerRef:te,actionRef:H,ctrlRef:X,setCtrlArmed:M,onFiles:b,fontSize:C,selectionMode:E,onSelectionModeChange:D,keyboardGesture:p.terminalKeyboardGesture})}),c.jsx(uE,{onKeyboard:()=>S(P=>!P),onCellSwitcher:h,cellSwitcherOpen:f,send:P=>z.current(P),action:P=>H.current(P),ctrlArmed:A,onCtrl:O,selectionMode:E,onSelectionMode:D,keepKeyboardClosed:p.keybarKeepsKeyboardClosed,showEnter:p.showKeybarEnter,keybarLayout:p.keybarLayout}),w&&c.jsx(lw,{submitText:P=>te.current(P),token:o,session:e,node:t,ownerId:n,keepKeyboardClosedOnVoice:p.voiceKeepsKeyboardClosed}),v&&c.jsx(Zy,{session:e,node:t,token:o,filesEvent:y,onClose:()=>x(!1)})]})}function mR(){$n();const[e]=N.useState(hR),[t,n]=N.useState(e.token),[r,o]=N.useState(e.pair||""),a=N.useCallback(()=>{o("");try{sessionStorage.removeItem("nc_pair")}catch{}},[]),[u,h]=N.useState(!1),f=pR(),[p]=N.useState(()=>zE(typeof location<"u"?location.pathname:"/")),[v,x]=N.useState(p.id),w=v===Cr(null,Fn),[S,y]=N.useState(null),b=de=>{const Ne=gs(de);y(Ne?{...Ne,...typeof(de==null?void 0:de.cellName)=="string"&&de.cellName?{cellName:de.cellName}:{}}:null)},[C,R]=N.useState([]),[k,F]=N.useState([]),[B,V]=N.useState([]),[G,z]=N.useState(()=>p.ownerId?kr():fR(p.name)),[te,H]=N.useState(null),[X,A]=N.useState(null),M=de=>A(gs(de)),E=$h(t,f),D=N.useMemo(()=>(E||[]).filter(de=>de.instanceId).map(de=>({instanceId:de.instanceId,route:de.route,label:de.label,status:de.status})),[E]),O=tR(t,v,G,z,D),P=O.decks;N.useEffect(()=>{const de=new Map;for(const Ne of E||[]){const Ke=(Ne.route||[Ne.name]).join("/"),Nt=new Set((Ne.sessions||[]).map(pt=>pt.name));for(const pt of Ne.cells||[])!pt.cell||!pt.tmuxSession||pt.cell===pt.tmuxSession||Nt.has(pt.cell)||de.set(`${Ke}:${pt.cell}`,`${Ke}:${pt.tmuxSession}`)}z(Ne=>c1(Ne,de))},[E]),N.useEffect(()=>{O.localNodeId&&z(de=>{const Ne=xh(de,O.localNodeId,D);return JSON.stringify(Ne)===JSON.stringify(de)?de:Ne})},[D,O.localNodeId]);const[$,L]=N.useState(null),[q,I]=N.useState(null),T=N.useRef(0),[U,Z]=N.useState(!1),[ae,he]=N.useState(uR),[pe,Q]=N.useState(!w),[ne,fe]=N.useState(()=>w?localStorage.getItem(E_)==="1":!0),[Se,Ze]=N.useState(!1),[$e,He]=N.useState("nodes"),[vt,Xe]=N.useState(!1),[St,Et]=N.useState(""),[rt,ct]=N.useState(!1),ot=(de="nodes",Ne=!1,Ke="")=>{He(de),Xe(Ne),Et(Ke),Ze(!0)},[ut,dt]=N.useState(!1),[le,xe]=N.useState({deviceDefault:"",localNodeId:"",localNameDefault:""}),[ze,Ie]=N.useState(!1);N.useEffect(()=>{try{localStorage.setItem(Zw,String(ae))}catch{}},[ae]),N.useEffect(()=>{try{localStorage.setItem(E_,ne?"1":"")}catch{}},[ne]),N.useEffect(()=>{if(!t)return;let de=!1;return Promise.all([O_(t),Vt("/api/config",t).then(Ne=>Ne.json())]).then(([Ne,Ke])=>{de||(xe({deviceDefault:Ne.deviceName||"",localNodeId:Ne.nodeId||"",localNameDefault:Ne.localName||""}),Ie(!!Ke.readonlyDefault),(Ne.firstRun===!0&&!Ke.readonlyDefault||r)&&dt(!0))}).catch(()=>{}),()=>{de=!0}},[t,r]);const ue=N.useCallback(async()=>{try{const Ne=await(await Vt("/api/sessions",t)).json();Ne.error||R(Ne.sessions||[])}catch{}try{const de=await vs(t);F(de.available?de.cells||[]:[]),V(de.available?de.capabilities||[]:[])}catch{F([]),V([])}},[t]);N.useEffect(()=>{if(!f)return;ue();const de=setInterval(ue,4e3);return()=>clearInterval(de)},[f,ue]),N.useEffect(()=>{let de=!1;return Vt("/api/config",t).then(Ne=>Ne.json()).then(Ne=>{de||sR(Ne.version,Ne.uiVersion,"0.8.42")}).catch(()=>{}),()=>{de=!0}},[t]);const Y=new Set([...C.map(de=>de.name),...E.flatMap(de=>de.sessions.map(Ne=>Ne.key))]),ie=wi(G),W=de=>z(Ne=>{const Ke=fw(de,O.localNodeId,D)||de,Nt=ty(Ne,Ke);return Nt===Ne&&wi(Ne).length>=9&&O.setError(g("grid-full")),Nt}),se=async(de,Ne=[])=>{try{await Ih(t,de,Ne)}catch{return}const Ke=Ne.length?`${Ne.join("/")}:${de}`:de;z(Nt=>Ll(Nt,Ke)),ue()},ve=async(de,Ne,Ke=[])=>{try{await B_(t,de,Ne,Ke)}catch{return}ue()},ke=async(de,Ne,Ke=[])=>{await M_(t,{cell:de,enabled:!!Ne},Ke),ue()},Re=async de=>{if(!$)return;const{cell:Ne}=$,Ke=Array.isArray($.route)?$.route:[];de.action==="up"?await Mh(t,{cell:Ne,boot:!!de.boot,...de.engine?{engine:de.engine}:{},...de.model!==void 0?{model:de.model}:{},...de.permissionPolicy?{permissionPolicy:de.permissionPolicy}:{}},Ke):await kl(t,{cell:Ne,boot:!!de.boot},Ke);const Nt=de.action==="up"?!!de.boot:de.boot?!1:!!$.boot;I({id:++T.current,cell:Ne,route:Ke,enabled:Nt}),ue()},we=N.useCallback(de=>{I(Ne=>(Ne==null?void 0:Ne.id)===de?null:Ne)},[]),je=async de=>{if(!(!(de!=null&&de.direct)||U)){Z(!0);try{await zh(t,de.name,de.tunnelStatus==="up"?"down":"up")}finally{Z(!1)}}},st=async(de,Ne)=>{const Ke=String(Ne||"").trim();return!(de!=null&&de.direct)||!jr(Ke)?!1:(await F_(t,de.name,Ke),!0)},It=de=>{const Ne=P.find(Ke=>Ke.id===de);if(!Ne)return!1;try{const Ke=window.open(ed(Ne,t),"_blank");return Ke&&(Ke.opener=null),!!Ke}catch{return!1}},Oe=async de=>{if(!de||de===v)return;const Ne=await O.select(de),Ke=O.records.find(Nt=>Nt.id===de);x(de),z(Ne),H(null),A(null);try{history.replaceState(null,"",ed(Ke||de,null))}catch{}},_n=async(de,Ne)=>{const Ke=await O.add(de,Ne);await Oe(Ke.id)},bt=async(de,Ne)=>{const Ke=await O.rename(de,Ne);if(de===v){x(Ke.id),z(xh(Ke.layout,O.localNodeId,D)),H(null),A(null);try{history.replaceState(null,"",ed(Ke,null))}catch{}}},Ye=async de=>{await O.remove(de),de===v&&await Oe(O.localMainId)},Gt=async(de,Ne)=>{!Ne||Ne===v||(await O.addTileTo(Ne,de),z(Ke=>Ll(Ke,de)))};if(!t)return c.jsxs("div",{className:"nc-auth",children:[c.jsx("p",{children:g("auth-prompt")}),c.jsx("input",{onChange:de=>n(de.target.value.trim()),placeholder:"token"}),c.jsxs("label",{children:[c.jsx("input",{type:"checkbox",checked:u,onChange:de=>h(de.target.checked)})," ",g("remember-device")]}),c.jsx("button",{onClick:()=>{(u?localStorage:sessionStorage).setItem("nc_token",t)},children:"ok"})]});const Hn=c.jsxs(c.Fragment,{children:[Se&&c.jsx(UN,{token:t,initialTab:$e,initialLocation:St,startNewCell:vt,onClose:()=>{Ze(!1),Xe(!1),Et("")}}),ut&&c.jsx(KN,{token:t,initialPair:r,...le,onPairDone:a,onDone:()=>dt(!1)}),c.jsx(JN,{token:t})]});if(!f)return S?c.jsxs(c.Fragment,{children:[c.jsx(j_,{session:S.session,node:S.node,ownerId:S.ownerId,cellName:S.cellName,token:t,readonly:ze,onBack:()=>y(null),onCellSwitcher:()=>ct(!0),cellSwitcherOpen:rt}),rt&&c.jsx(ZN,{token:t,current:S,onPick:de=>{b(de),ct(!1)},onClose:()=>ct(!1)}),Hn]}):c.jsxs(c.Fragment,{children:[c.jsx(k1,{onPick:b,token:t,onSettings:ot}),Hn]});const li=w||!pe;return c.jsxs("div",{className:"nc-workspace",children:[li&&c.jsx(NE,{sessions:C,cells:k,activeSessions:ie,nodeGroups:E,fleetCapabilities:B,bootSettlement:q,onBootSettlementApplied:we,localNodeId:O.localNodeId,onPick:M,onAddTile:W,onPower:L,onBoot:ke,onBootError:de=>O.setError(String((de==null?void 0:de.message)||de)),onNodePower:je,onNodeRename:st,onKill:se,onVisibility:ve,onNew:()=>ot("fleet",!0),onSettings:ot,width:ae,collapsed:ne,onResize:he,onToggleCollapse:()=>fe(de=>!de)}),c.jsxs("div",{className:"nc-workspace-main",children:[c.jsx(l2,{decks:P,currentDeck:v,onCreate:_n,onRename:bt,onDelete:Ye,onReorder:O.reorder,onOpenWindow:It,onNavigate:Oe,saveState:O.saveState,error:O.error,sidebarVisible:li,onToggleSidebar:w?null:()=>Q(de=>!de)}),c.jsx(ME,{layout:G,onLayoutChange:z,token:t,readonly:ze,sessionsAlive:Y,focusSession:te,onFocus:H,onOpenSingle:M,decks:P,currentDeck:v,onSendToDeck:Gt,cells:k,nodeGroups:E})]}),X&&c.jsx("div",{className:"nc-single-overlay",children:c.jsx(j_,{session:X.session,node:X.node,ownerId:X.ownerId,cellName:af({session:X.session,node:X.node,ownerId:X.ownerId,cells:k,nodeGroups:E}),token:t,readonly:ze,onBack:()=>A(null)})}),$&&c.jsx(El,{cell:$,token:t,route:Array.isArray($.route)?$.route:[],onConfirm:Re,onClose:()=>L(null)}),Hn]})}function gR(){$n();const e=N.useSyncExternalStore(iR,C_,C_);if(!e.needed)return null;const t=e.kind==="install"?g("install-version-mismatch").replace("{v}",e.version):g("update-available").replace("{v}",e.version).replace(" "," ").trim();return c.jsxs("div",{className:"nc-update",role:"status","aria-live":"polite",children:[c.jsx("span",{className:"nc-update-msg",children:t}),e.kind==="reload"&&c.jsx("button",{className:"nc-update-btn",onClick:aR,children:g("reload")})]})}oR();Zb.createRoot(document.getElementById("root")).render(c.jsxs(qb.StrictMode,{children:[c.jsx(mR,{}),c.jsx(gR,{})]}));