@mmmbuto/nexuscrew 0.8.12 → 0.8.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -36
- package/frontend/dist/assets/index-BR2Qfqi2.js +91 -0
- package/frontend/dist/assets/{index-PkKeNfT7.css → index-CopPQTMk.css} +2 -2
- package/frontend/dist/index.html +2 -2
- package/frontend/dist/version.json +1 -1
- package/lib/cells/routes.js +137 -0
- package/lib/cli/service.js +18 -6
- package/lib/config.js +14 -0
- package/lib/fleet/builtin.js +243 -38
- package/lib/fleet/cell-exec.js +81 -0
- package/lib/fleet/credentials.js +135 -0
- package/lib/fleet/env-key.js +12 -0
- package/lib/fleet/launch-broker.js +136 -0
- package/lib/fleet/managed.js +139 -19
- package/lib/fleet/routes.js +16 -1
- package/lib/mcp/server.js +131 -3
- package/lib/proxy/federation.js +47 -7
- package/lib/pty/attach.js +3 -2
- package/lib/runtime/env.js +50 -0
- package/lib/server.js +26 -2
- package/lib/settings/routes.js +4 -3
- package/lib/tmux/actions.js +96 -1
- package/lib/tmux/list.js +22 -3
- package/lib/update/core.js +35 -8
- package/lib/update/manager.js +6 -3
- package/lib/update/runner.js +7 -3
- package/package.json +1 -1
- package/skills/nexuscrew-agent/SKILL.md +14 -3
- package/frontend/dist/assets/index-DrroT7uq.js +0 -91
|
@@ -1,91 +0,0 @@
|
|
|
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"]'))s(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function r(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(o){if(o.ep)return;o.ep=!0;const l=r(o);fetch(o.href,l)}})();function xh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bc={exports:{}},Ds={},Ic={exports:{}},He={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Tp;function DS(){if(Tp)return He;Tp=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),w=Symbol.iterator;function _(R){return R===null||typeof R!="object"?null:(R=w&&R[w]||R["@@iterator"],typeof R=="function"?R:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,k={};function E(R,Z,D){this.props=R,this.context=Z,this.refs=k,this.updater=D||v}E.prototype.isReactComponent={},E.prototype.setState=function(R,Z){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,Z,"setState")},E.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function N(){}N.prototype=E.prototype;function A(R,Z,D){this.props=R,this.context=Z,this.refs=k,this.updater=D||v}var z=A.prototype=new N;z.constructor=A,b(z,E.prototype),z.isPureReactComponent=!0;var I=Array.isArray,U=Object.prototype.hasOwnProperty,O={current:null},B={key:!0,ref:!0,__self:!0,__source:!0};function X(R,Z,D){var T,se={},oe=null,ae=null;if(Z!=null)for(T in Z.ref!==void 0&&(ae=Z.ref),Z.key!==void 0&&(oe=""+Z.key),Z)U.call(Z,T)&&!B.hasOwnProperty(T)&&(se[T]=Z[T]);var ge=arguments.length-2;if(ge===1)se.children=D;else if(1<ge){for(var we=Array(ge),_e=0;_e<ge;_e++)we[_e]=arguments[_e+2];se.children=we}if(R&&R.defaultProps)for(T in ge=R.defaultProps,ge)se[T]===void 0&&(se[T]=ge[T]);return{$$typeof:e,type:R,key:oe,ref:ae,props:se,_owner:O.current}}function q(R,Z){return{$$typeof:e,type:R.type,key:Z,ref:R.ref,props:R.props,_owner:R._owner}}function re(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function te(R){var Z={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(D){return Z[D]})}var x=/\/+/g;function P(R,Z){return typeof R=="object"&&R!==null&&R.key!=null?te(""+R.key):Z.toString(36)}function j(R,Z,D,T,se){var oe=typeof R;(oe==="undefined"||oe==="boolean")&&(R=null);var ae=!1;if(R===null)ae=!0;else switch(oe){case"string":case"number":ae=!0;break;case"object":switch(R.$$typeof){case e:case t:ae=!0}}if(ae)return ae=R,se=se(ae),R=T===""?"."+P(ae,0):T,I(se)?(D="",R!=null&&(D=R.replace(x,"$&/")+"/"),j(se,Z,D,"",function(_e){return _e})):se!=null&&(re(se)&&(se=q(se,D+(!se.key||ae&&ae.key===se.key?"":(""+se.key).replace(x,"$&/")+"/")+R)),Z.push(se)),1;if(ae=0,T=T===""?".":T+":",I(R))for(var ge=0;ge<R.length;ge++){oe=R[ge];var we=T+P(oe,ge);ae+=j(oe,Z,D,we,se)}else if(we=_(R),typeof we=="function")for(R=we.call(R),ge=0;!(oe=R.next()).done;)oe=oe.value,we=T+P(oe,ge++),ae+=j(oe,Z,D,we,se);else if(oe==="object")throw Z=String(R),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.");return ae}function J(R,Z,D){if(R==null)return R;var T=[],se=0;return j(R,T,"","",function(oe){return Z.call(D,oe,se++)}),T}function F(R){if(R._status===-1){var Z=R._result;Z=Z(),Z.then(function(D){(R._status===0||R._status===-1)&&(R._status=1,R._result=D)},function(D){(R._status===0||R._status===-1)&&(R._status=2,R._result=D)}),R._status===-1&&(R._status=0,R._result=Z)}if(R._status===1)return R._result.default;throw R._result}var Q={current:null},$={transition:null},K={ReactCurrentDispatcher:Q,ReactCurrentBatchConfig:$,ReactCurrentOwner:O};function G(){throw Error("act(...) is not supported in production builds of React.")}return He.Children={map:J,forEach:function(R,Z,D){J(R,function(){Z.apply(this,arguments)},D)},count:function(R){var Z=0;return J(R,function(){Z++}),Z},toArray:function(R){return J(R,function(Z){return Z})||[]},only:function(R){if(!re(R))throw Error("React.Children.only expected to receive a single React element child.");return R}},He.Component=E,He.Fragment=r,He.Profiler=o,He.PureComponent=A,He.StrictMode=s,He.Suspense=p,He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=K,He.act=G,He.cloneElement=function(R,Z,D){if(R==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+R+".");var T=b({},R.props),se=R.key,oe=R.ref,ae=R._owner;if(Z!=null){if(Z.ref!==void 0&&(oe=Z.ref,ae=O.current),Z.key!==void 0&&(se=""+Z.key),R.type&&R.type.defaultProps)var ge=R.type.defaultProps;for(we in Z)U.call(Z,we)&&!B.hasOwnProperty(we)&&(T[we]=Z[we]===void 0&&ge!==void 0?ge[we]:Z[we])}var we=arguments.length-2;if(we===1)T.children=D;else if(1<we){ge=Array(we);for(var _e=0;_e<we;_e++)ge[_e]=arguments[_e+2];T.children=ge}return{$$typeof:e,type:R.type,key:se,ref:oe,props:T,_owner:ae}},He.createContext=function(R){return R={$$typeof:u,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},R.Provider={$$typeof:l,_context:R},R.Consumer=R},He.createElement=X,He.createFactory=function(R){var Z=X.bind(null,R);return Z.type=R,Z},He.createRef=function(){return{current:null}},He.forwardRef=function(R){return{$$typeof:d,render:R}},He.isValidElement=re,He.lazy=function(R){return{$$typeof:y,_payload:{_status:-1,_result:R},_init:F}},He.memo=function(R,Z){return{$$typeof:m,type:R,compare:Z===void 0?null:Z}},He.startTransition=function(R){var Z=$.transition;$.transition={};try{R()}finally{$.transition=Z}},He.unstable_act=G,He.useCallback=function(R,Z){return Q.current.useCallback(R,Z)},He.useContext=function(R){return Q.current.useContext(R)},He.useDebugValue=function(){},He.useDeferredValue=function(R){return Q.current.useDeferredValue(R)},He.useEffect=function(R,Z){return Q.current.useEffect(R,Z)},He.useId=function(){return Q.current.useId()},He.useImperativeHandle=function(R,Z,D){return Q.current.useImperativeHandle(R,Z,D)},He.useInsertionEffect=function(R,Z){return Q.current.useInsertionEffect(R,Z)},He.useLayoutEffect=function(R,Z){return Q.current.useLayoutEffect(R,Z)},He.useMemo=function(R,Z){return Q.current.useMemo(R,Z)},He.useReducer=function(R,Z,D){return Q.current.useReducer(R,Z,D)},He.useRef=function(R){return Q.current.useRef(R)},He.useState=function(R){return Q.current.useState(R)},He.useSyncExternalStore=function(R,Z,D){return Q.current.useSyncExternalStore(R,Z,D)},He.useTransition=function(){return Q.current.useTransition()},He.version="18.3.1",He}var jp;function kh(){return jp||(jp=1,Ic.exports=DS()),Ic.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 Bp;function LS(){if(Bp)return Ds;Bp=1;var e=kh(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(d,p,m){var y,w={},_=null,v=null;m!==void 0&&(_=""+m),p.key!==void 0&&(_=""+p.key),p.ref!==void 0&&(v=p.ref);for(y in p)s.call(p,y)&&!l.hasOwnProperty(y)&&(w[y]=p[y]);if(d&&d.defaultProps)for(y in p=d.defaultProps,p)w[y]===void 0&&(w[y]=p[y]);return{$$typeof:t,type:d,key:_,ref:v,props:w,_owner:o.current}}return Ds.Fragment=r,Ds.jsx=u,Ds.jsxs=u,Ds}var Ip;function MS(){return Ip||(Ip=1,Bc.exports=LS()),Bc.exports}var h=MS(),L=kh();const TS=xh(L);var la={},Ac={exports:{}},ei={},Oc={exports:{}},zc={};/**
|
|
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 Ap;function jS(){return Ap||(Ap=1,(function(e){function t($,K){var G=$.length;$.push(K);e:for(;0<G;){var R=G-1>>>1,Z=$[R];if(0<o(Z,K))$[R]=K,$[G]=Z,G=R;else break e}}function r($){return $.length===0?null:$[0]}function s($){if($.length===0)return null;var K=$[0],G=$.pop();if(G!==K){$[0]=G;e:for(var R=0,Z=$.length,D=Z>>>1;R<D;){var T=2*(R+1)-1,se=$[T],oe=T+1,ae=$[oe];if(0>o(se,G))oe<Z&&0>o(ae,se)?($[R]=ae,$[oe]=G,R=oe):($[R]=se,$[T]=G,R=T);else if(oe<Z&&0>o(ae,G))$[R]=ae,$[oe]=G,R=oe;else break e}}return K}function o($,K){var G=$.sortIndex-K.sortIndex;return G!==0?G:$.id-K.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var p=[],m=[],y=1,w=null,_=3,v=!1,b=!1,k=!1,E=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function z($){for(var K=r(m);K!==null;){if(K.callback===null)s(m);else if(K.startTime<=$)s(m),K.sortIndex=K.expirationTime,t(p,K);else break;K=r(m)}}function I($){if(k=!1,z($),!b)if(r(p)!==null)b=!0,F(U);else{var K=r(m);K!==null&&Q(I,K.startTime-$)}}function U($,K){b=!1,k&&(k=!1,N(X),X=-1),v=!0;var G=_;try{for(z(K),w=r(p);w!==null&&(!(w.expirationTime>K)||$&&!te());){var R=w.callback;if(typeof R=="function"){w.callback=null,_=w.priorityLevel;var Z=R(w.expirationTime<=K);K=e.unstable_now(),typeof Z=="function"?w.callback=Z:w===r(p)&&s(p),z(K)}else s(p);w=r(p)}if(w!==null)var D=!0;else{var T=r(m);T!==null&&Q(I,T.startTime-K),D=!1}return D}finally{w=null,_=G,v=!1}}var O=!1,B=null,X=-1,q=5,re=-1;function te(){return!(e.unstable_now()-re<q)}function x(){if(B!==null){var $=e.unstable_now();re=$;var K=!0;try{K=B(!0,$)}finally{K?P():(O=!1,B=null)}}else O=!1}var P;if(typeof A=="function")P=function(){A(x)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,J=j.port2;j.port1.onmessage=x,P=function(){J.postMessage(null)}}else P=function(){E(x,0)};function F($){B=$,O||(O=!0,P())}function Q($,K){X=E(function(){$(e.unstable_now())},K)}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($){$.callback=null},e.unstable_continueExecution=function(){b||v||(b=!0,F(U))},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_getFirstCallbackNode=function(){return r(p)},e.unstable_next=function($){switch(_){case 1:case 2:case 3:var K=3;break;default:K=_}var G=_;_=K;try{return $()}finally{_=G}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,K){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var G=_;_=$;try{return K()}finally{_=G}},e.unstable_scheduleCallback=function($,K,G){var R=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?R+G:R):G=R,$){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=G+Z,$={id:y++,callback:K,priorityLevel:$,startTime:G,expirationTime:Z,sortIndex:-1},G>R?($.sortIndex=G,t(m,$),r(p)===null&&$===r(m)&&(k?(N(X),X=-1):k=!0,Q(I,G-R))):($.sortIndex=Z,t(p,$),b||v||(b=!0,F(U))),$},e.unstable_shouldYield=te,e.unstable_wrapCallback=function($){var K=_;return function(){var G=_;_=K;try{return $.apply(this,arguments)}finally{_=G}}}})(zc)),zc}var Op;function BS(){return Op||(Op=1,Oc.exports=jS()),Oc.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 zp;function IS(){if(zp)return ei;zp=1;var e=kh(),t=BS();function r(i){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+i,a=1;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+i+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,o={};function l(i,n){u(i,n),u(i+"Capture",n)}function u(i,n){for(o[i]=n,i=0;i<n.length;i++)s.add(n[i])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[: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]*$/,y={},w={};function _(i){return p.call(w,i)?!0:p.call(y,i)?!1:m.test(i)?w[i]=!0:(y[i]=!0,!1)}function v(i,n,a,c){if(a!==null&&a.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return c?!1:a!==null?!a.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function b(i,n,a,c){if(n===null||typeof n>"u"||v(i,n,a,c))return!0;if(c)return!1;if(a!==null)switch(a.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function k(i,n,a,c,f,g,C){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=c,this.attributeNamespace=f,this.mustUseProperty=a,this.propertyName=i,this.type=n,this.sanitizeURL=g,this.removeEmptyString=C}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){E[i]=new k(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var n=i[0];E[n]=new k(n,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){E[i]=new k(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){E[i]=new k(i,2,!1,i,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){E[i]=new k(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){E[i]=new k(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){E[i]=new k(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){E[i]=new k(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){E[i]=new k(i,5,!1,i.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function A(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 n=i.replace(N,A);E[n]=new k(n,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var n=i.replace(N,A);E[n]=new k(n,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var n=i.replace(N,A);E[n]=new k(n,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){E[i]=new k(i,1,!1,i.toLowerCase(),null,!1,!1)}),E.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){E[i]=new k(i,1,!1,i.toLowerCase(),null,!0,!0)});function z(i,n,a,c){var f=E.hasOwnProperty(n)?E[n]:null;(f!==null?f.type!==0:c||!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(b(n,a,f,c)&&(a=null),c||f===null?_(n)&&(a===null?i.removeAttribute(n):i.setAttribute(n,""+a)):f.mustUseProperty?i[f.propertyName]=a===null?f.type===3?!1:"":a:(n=f.attributeName,c=f.attributeNamespace,a===null?i.removeAttribute(n):(f=f.type,a=f===3||f===4&&a===!0?"":""+a,c?i.setAttributeNS(c,n,a):i.setAttribute(n,a))))}var I=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,U=Symbol.for("react.element"),O=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),X=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),re=Symbol.for("react.provider"),te=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),Q=Symbol.for("react.offscreen"),$=Symbol.iterator;function K(i){return i===null||typeof i!="object"?null:(i=$&&i[$]||i["@@iterator"],typeof i=="function"?i:null)}var G=Object.assign,R;function Z(i){if(R===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);R=n&&n[1]||""}return`
|
|
34
|
-
`+R+i}var D=!1;function T(i,n){if(!i||D)return"";D=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(ne){var c=ne}Reflect.construct(i,[],n)}else{try{n.call()}catch(ne){c=ne}i.call(n.prototype)}else{try{throw Error()}catch(ne){c=ne}i()}}catch(ne){if(ne&&c&&typeof ne.stack=="string"){for(var f=ne.stack.split(`
|
|
35
|
-
`),g=c.stack.split(`
|
|
36
|
-
`),C=f.length-1,M=g.length-1;1<=C&&0<=M&&f[C]!==g[M];)M--;for(;1<=C&&0<=M;C--,M--)if(f[C]!==g[M]){if(C!==1||M!==1)do if(C--,M--,0>M||f[C]!==g[M]){var H=`
|
|
37
|
-
`+f[C].replace(" at new "," at ");return i.displayName&&H.includes("<anonymous>")&&(H=H.replace("<anonymous>",i.displayName)),H}while(1<=C&&0<=M);break}}}finally{D=!1,Error.prepareStackTrace=a}return(i=i?i.displayName||i.name:"")?Z(i):""}function se(i){switch(i.tag){case 5:return Z(i.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return i=T(i.type,!1),i;case 11:return i=T(i.type.render,!1),i;case 1:return i=T(i.type,!0),i;default:return""}}function oe(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 B:return"Fragment";case O:return"Portal";case q:return"Profiler";case X:return"StrictMode";case P:return"Suspense";case j:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case te:return(i.displayName||"Context")+".Consumer";case re:return(i._context.displayName||"Context")+".Provider";case x:var n=i.render;return i=i.displayName,i||(i=n.displayName||n.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case J:return n=i.displayName||null,n!==null?n:oe(i.type)||"Memo";case F:n=i._payload,i=i._init;try{return oe(i(n))}catch{}}return null}function ae(i){var n=i.type;switch(i.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=n.render,i=i.displayName||i.name||"",n.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return oe(n);case 8:return n===X?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function ge(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function we(i){var n=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function _e(i){var n=we(i)?"checked":"value",a=Object.getOwnPropertyDescriptor(i.constructor.prototype,n),c=""+i[n];if(!i.hasOwnProperty(n)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,g=a.set;return Object.defineProperty(i,n,{configurable:!0,get:function(){return f.call(this)},set:function(C){c=""+C,g.call(this,C)}}),Object.defineProperty(i,n,{enumerable:a.enumerable}),{getValue:function(){return c},setValue:function(C){c=""+C},stopTracking:function(){i._valueTracker=null,delete i[n]}}}}function W(i){i._valueTracker||(i._valueTracker=_e(i))}function Y(i){if(!i)return!1;var n=i._valueTracker;if(!n)return!0;var a=n.getValue(),c="";return i&&(c=we(i)?i.checked?"true":"false":i.value),i=c,i!==a?(n.setValue(i),!0):!1}function ue(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 Ne(i,n){var a=n.checked;return G({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??i._wrapperState.initialChecked})}function Te(i,n){var a=n.defaultValue==null?"":n.defaultValue,c=n.checked!=null?n.checked:n.defaultChecked;a=ge(n.value!=null?n.value:a),i._wrapperState={initialChecked:c,initialValue:a,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Ve(i,n){n=n.checked,n!=null&&z(i,"checked",n,!1)}function tt(i,n){Ve(i,n);var a=ge(n.value),c=n.type;if(a!=null)c==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+a):i.value!==""+a&&(i.value=""+a);else if(c==="submit"||c==="reset"){i.removeAttribute("value");return}n.hasOwnProperty("value")?Ue(i,n.type,a):n.hasOwnProperty("defaultValue")&&Ue(i,n.type,ge(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(i.defaultChecked=!!n.defaultChecked)}function De(i,n,a){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var c=n.type;if(!(c!=="submit"&&c!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+i._wrapperState.initialValue,a||n===i.value||(i.value=n),i.defaultValue=n}a=i.name,a!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,a!==""&&(i.name=a)}function Ue(i,n,a){(n!=="number"||ue(i.ownerDocument)!==i)&&(a==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+a&&(i.defaultValue=""+a))}var Ye=Array.isArray;function At(i,n,a,c){if(i=i.options,n){n={};for(var f=0;f<a.length;f++)n["$"+a[f]]=!0;for(a=0;a<i.length;a++)f=n.hasOwnProperty("$"+i[a].value),i[a].selected!==f&&(i[a].selected=f),f&&c&&(i[a].defaultSelected=!0)}else{for(a=""+ge(a),n=null,f=0;f<i.length;f++){if(i[f].value===a){i[f].selected=!0,c&&(i[f].defaultSelected=!0);return}n!==null||i[f].disabled||(n=i[f])}n!==null&&(n.selected=!0)}}function Lt(i,n){if(n.dangerouslySetInnerHTML!=null)throw Error(r(91));return G({},n,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function je(i,n){var a=n.value;if(a==null){if(a=n.children,n=n.defaultValue,a!=null){if(n!=null)throw Error(r(92));if(Ye(a)){if(1<a.length)throw Error(r(93));a=a[0]}n=a}n==null&&(n=""),a=n}i._wrapperState={initialValue:ge(a)}}function ri(i,n){var a=ge(n.value),c=ge(n.defaultValue);a!=null&&(a=""+a,a!==i.value&&(i.value=a),n.defaultValue==null&&i.defaultValue!==a&&(i.defaultValue=a)),c!=null&&(i.defaultValue=""+c)}function Ar(i){var n=i.textContent;n===i._wrapperState.initialValue&&n!==""&&n!==null&&(i.value=n)}function Or(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 Wt(i,n){return i==null||i==="http://www.w3.org/1999/xhtml"?Or(n):i==="http://www.w3.org/2000/svg"&&n==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var ni,Gi=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(n,a,c,f){MSApp.execUnsafeLocalFunction(function(){return i(n,a,c,f)})}:i})(function(i,n){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=n;else{for(ni=ni||document.createElement("div"),ni.innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=ni.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;n.firstChild;)i.appendChild(n.firstChild)}});function si(i,n){if(n){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=n;return}}i.textContent=n}var pe={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},Fe=["Webkit","ms","Moz","O"];Object.keys(pe).forEach(function(i){Fe.forEach(function(n){n=n+i.charAt(0).toUpperCase()+i.substring(1),pe[n]=pe[i]})});function qe(i,n,a){return n==null||typeof n=="boolean"||n===""?"":a||typeof n!="number"||n===0||pe.hasOwnProperty(i)&&pe[i]?(""+n).trim():n+"px"}function le(i,n){i=i.style;for(var a in n)if(n.hasOwnProperty(a)){var c=a.indexOf("--")===0,f=qe(a,n[a],c);a==="float"&&(a="cssFloat"),c?i.setProperty(a,f):i[a]=f}}var ke=G({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 Be(i,n){if(n){if(ke[i]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,i));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Mt(i,n){if(i.indexOf("-")===-1)return typeof n.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 oi=null;function Ga(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Qa=null,dn=null,fn=null;function Xh(i){if(i=ms(i)){if(typeof Qa!="function")throw Error(r(280));var n=i.stateNode;n&&(n=Co(n),Qa(i.stateNode,i.type,n))}}function Gh(i){dn?fn?fn.push(i):fn=[i]:dn=i}function Qh(){if(dn){var i=dn,n=fn;if(fn=dn=null,Xh(i),n)for(i=0;i<n.length;i++)Xh(n[i])}}function Jh(i,n){return i(n)}function Zh(){}var Ja=!1;function ed(i,n,a){if(Ja)return i(n,a);Ja=!0;try{return Jh(i,n,a)}finally{Ja=!1,(dn!==null||fn!==null)&&(Zh(),Qh())}}function Yn(i,n){var a=i.stateNode;if(a===null)return null;var c=Co(a);if(c===null)return null;a=c[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(i=i.type,c=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!c;break e;default:i=!1}if(i)return null;if(a&&typeof a!="function")throw Error(r(231,n,typeof a));return a}var Za=!1;if(d)try{var Xn={};Object.defineProperty(Xn,"passive",{get:function(){Za=!0}}),window.addEventListener("test",Xn,Xn),window.removeEventListener("test",Xn,Xn)}catch{Za=!1}function I_(i,n,a,c,f,g,C,M,H){var ne=Array.prototype.slice.call(arguments,3);try{n.apply(a,ne)}catch(de){this.onError(de)}}var Gn=!1,eo=null,to=!1,el=null,A_={onError:function(i){Gn=!0,eo=i}};function O_(i,n,a,c,f,g,C,M,H){Gn=!1,eo=null,I_.apply(A_,arguments)}function z_(i,n,a,c,f,g,C,M,H){if(O_.apply(this,arguments),Gn){if(Gn){var ne=eo;Gn=!1,eo=null}else throw Error(r(198));to||(to=!0,el=ne)}}function zr(i){var n=i,a=i;if(i.alternate)for(;n.return;)n=n.return;else{i=n;do n=i,(n.flags&4098)!==0&&(a=n.return),i=n.return;while(i)}return n.tag===3?a:null}function td(i){if(i.tag===13){var n=i.memoizedState;if(n===null&&(i=i.alternate,i!==null&&(n=i.memoizedState)),n!==null)return n.dehydrated}return null}function id(i){if(zr(i)!==i)throw Error(r(188))}function F_(i){var n=i.alternate;if(!n){if(n=zr(i),n===null)throw Error(r(188));return n!==i?null:i}for(var a=i,c=n;;){var f=a.return;if(f===null)break;var g=f.alternate;if(g===null){if(c=f.return,c!==null){a=c;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===a)return id(f),i;if(g===c)return id(f),n;g=g.sibling}throw Error(r(188))}if(a.return!==c.return)a=f,c=g;else{for(var C=!1,M=f.child;M;){if(M===a){C=!0,a=f,c=g;break}if(M===c){C=!0,c=f,a=g;break}M=M.sibling}if(!C){for(M=g.child;M;){if(M===a){C=!0,a=g,c=f;break}if(M===c){C=!0,c=g,a=f;break}M=M.sibling}if(!C)throw Error(r(189))}}if(a.alternate!==c)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?i:n}function rd(i){return i=F_(i),i!==null?nd(i):null}function nd(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var n=nd(i);if(n!==null)return n;i=i.sibling}return null}var sd=t.unstable_scheduleCallback,od=t.unstable_cancelCallback,H_=t.unstable_shouldYield,$_=t.unstable_requestPaint,ht=t.unstable_now,W_=t.unstable_getCurrentPriorityLevel,tl=t.unstable_ImmediatePriority,ad=t.unstable_UserBlockingPriority,io=t.unstable_NormalPriority,U_=t.unstable_LowPriority,ld=t.unstable_IdlePriority,ro=null,Ai=null;function q_(i){if(Ai&&typeof Ai.onCommitFiberRoot=="function")try{Ai.onCommitFiberRoot(ro,i,void 0,(i.current.flags&128)===128)}catch{}}var Ri=Math.clz32?Math.clz32:Y_,K_=Math.log,V_=Math.LN2;function Y_(i){return i>>>=0,i===0?32:31-(K_(i)/V_|0)|0}var no=64,so=4194304;function Qn(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 oo(i,n){var a=i.pendingLanes;if(a===0)return 0;var c=0,f=i.suspendedLanes,g=i.pingedLanes,C=a&268435455;if(C!==0){var M=C&~f;M!==0?c=Qn(M):(g&=C,g!==0&&(c=Qn(g)))}else C=a&~f,C!==0?c=Qn(C):g!==0&&(c=Qn(g));if(c===0)return 0;if(n!==0&&n!==c&&(n&f)===0&&(f=c&-c,g=n&-n,f>=g||f===16&&(g&4194240)!==0))return n;if((c&4)!==0&&(c|=a&16),n=i.entangledLanes,n!==0)for(i=i.entanglements,n&=c;0<n;)a=31-Ri(n),f=1<<a,c|=i[a],n&=~f;return c}function X_(i,n){switch(i){case 1:case 2:case 4:return n+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 n+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 G_(i,n){for(var a=i.suspendedLanes,c=i.pingedLanes,f=i.expirationTimes,g=i.pendingLanes;0<g;){var C=31-Ri(g),M=1<<C,H=f[C];H===-1?((M&a)===0||(M&c)!==0)&&(f[C]=X_(M,n)):H<=n&&(i.expiredLanes|=M),g&=~M}}function il(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function cd(){var i=no;return no<<=1,(no&4194240)===0&&(no=64),i}function rl(i){for(var n=[],a=0;31>a;a++)n.push(i);return n}function Jn(i,n,a){i.pendingLanes|=n,n!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,n=31-Ri(n),i[n]=a}function Q_(i,n){var a=i.pendingLanes&~n;i.pendingLanes=n,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=n,i.mutableReadLanes&=n,i.entangledLanes&=n,n=i.entanglements;var c=i.eventTimes;for(i=i.expirationTimes;0<a;){var f=31-Ri(a),g=1<<f;n[f]=0,c[f]=-1,i[f]=-1,a&=~g}}function nl(i,n){var a=i.entangledLanes|=n;for(i=i.entanglements;a;){var c=31-Ri(a),f=1<<c;f&n|i[c]&n&&(i[c]|=n),a&=~f}}var Xe=0;function ud(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var hd,sl,dd,fd,pd,ol=!1,ao=[],ur=null,hr=null,dr=null,Zn=new Map,es=new Map,fr=[],J_="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function md(i,n){switch(i){case"focusin":case"focusout":ur=null;break;case"dragenter":case"dragleave":hr=null;break;case"mouseover":case"mouseout":dr=null;break;case"pointerover":case"pointerout":Zn.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":es.delete(n.pointerId)}}function ts(i,n,a,c,f,g){return i===null||i.nativeEvent!==g?(i={blockedOn:n,domEventName:a,eventSystemFlags:c,nativeEvent:g,targetContainers:[f]},n!==null&&(n=ms(n),n!==null&&sl(n)),i):(i.eventSystemFlags|=c,n=i.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),i)}function Z_(i,n,a,c,f){switch(n){case"focusin":return ur=ts(ur,i,n,a,c,f),!0;case"dragenter":return hr=ts(hr,i,n,a,c,f),!0;case"mouseover":return dr=ts(dr,i,n,a,c,f),!0;case"pointerover":var g=f.pointerId;return Zn.set(g,ts(Zn.get(g)||null,i,n,a,c,f)),!0;case"gotpointercapture":return g=f.pointerId,es.set(g,ts(es.get(g)||null,i,n,a,c,f)),!0}return!1}function gd(i){var n=Fr(i.target);if(n!==null){var a=zr(n);if(a!==null){if(n=a.tag,n===13){if(n=td(a),n!==null){i.blockedOn=n,pd(i.priority,function(){dd(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function lo(i){if(i.blockedOn!==null)return!1;for(var n=i.targetContainers;0<n.length;){var a=ll(i.domEventName,i.eventSystemFlags,n[0],i.nativeEvent);if(a===null){a=i.nativeEvent;var c=new a.constructor(a.type,a);oi=c,a.target.dispatchEvent(c),oi=null}else return n=ms(a),n!==null&&sl(n),i.blockedOn=a,!1;n.shift()}return!0}function vd(i,n,a){lo(i)&&a.delete(n)}function ey(){ol=!1,ur!==null&&lo(ur)&&(ur=null),hr!==null&&lo(hr)&&(hr=null),dr!==null&&lo(dr)&&(dr=null),Zn.forEach(vd),es.forEach(vd)}function is(i,n){i.blockedOn===n&&(i.blockedOn=null,ol||(ol=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,ey)))}function rs(i){function n(f){return is(f,i)}if(0<ao.length){is(ao[0],i);for(var a=1;a<ao.length;a++){var c=ao[a];c.blockedOn===i&&(c.blockedOn=null)}}for(ur!==null&&is(ur,i),hr!==null&&is(hr,i),dr!==null&&is(dr,i),Zn.forEach(n),es.forEach(n),a=0;a<fr.length;a++)c=fr[a],c.blockedOn===i&&(c.blockedOn=null);for(;0<fr.length&&(a=fr[0],a.blockedOn===null);)gd(a),a.blockedOn===null&&fr.shift()}var pn=I.ReactCurrentBatchConfig,co=!0;function ty(i,n,a,c){var f=Xe,g=pn.transition;pn.transition=null;try{Xe=1,al(i,n,a,c)}finally{Xe=f,pn.transition=g}}function iy(i,n,a,c){var f=Xe,g=pn.transition;pn.transition=null;try{Xe=4,al(i,n,a,c)}finally{Xe=f,pn.transition=g}}function al(i,n,a,c){if(co){var f=ll(i,n,a,c);if(f===null)kl(i,n,c,uo,a),md(i,c);else if(Z_(f,i,n,a,c))c.stopPropagation();else if(md(i,c),n&4&&-1<J_.indexOf(i)){for(;f!==null;){var g=ms(f);if(g!==null&&hd(g),g=ll(i,n,a,c),g===null&&kl(i,n,c,uo,a),g===f)break;f=g}f!==null&&c.stopPropagation()}else kl(i,n,c,null,a)}}var uo=null;function ll(i,n,a,c){if(uo=null,i=Ga(c),i=Fr(i),i!==null)if(n=zr(i),n===null)i=null;else if(a=n.tag,a===13){if(i=td(n),i!==null)return i;i=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;i=null}else n!==i&&(i=null);return uo=i,null}function _d(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(W_()){case tl:return 1;case ad:return 4;case io:case U_:return 16;case ld:return 536870912;default:return 16}default:return 16}}var pr=null,cl=null,ho=null;function yd(){if(ho)return ho;var i,n=cl,a=n.length,c,f="value"in pr?pr.value:pr.textContent,g=f.length;for(i=0;i<a&&n[i]===f[i];i++);var C=a-i;for(c=1;c<=C&&n[a-c]===f[g-c];c++);return ho=f.slice(i,1<c?1-c:void 0)}function fo(i){var n=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&n===13&&(i=13)):i=n,i===10&&(i=13),32<=i||i===13?i:0}function po(){return!0}function Sd(){return!1}function ai(i){function n(a,c,f,g,C){this._reactName=a,this._targetInst=f,this.type=c,this.nativeEvent=g,this.target=C,this.currentTarget=null;for(var M in i)i.hasOwnProperty(M)&&(a=i[M],this[M]=a?a(g):g[M]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?po:Sd,this.isPropagationStopped=Sd,this}return G(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=po)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=po)},persist:function(){},isPersistent:po}),n}var mn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ul=ai(mn),ns=G({},mn,{view:0,detail:0}),ry=ai(ns),hl,dl,ss,mo=G({},ns,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pl,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!==ss&&(ss&&i.type==="mousemove"?(hl=i.screenX-ss.screenX,dl=i.screenY-ss.screenY):dl=hl=0,ss=i),hl)},movementY:function(i){return"movementY"in i?i.movementY:dl}}),wd=ai(mo),ny=G({},mo,{dataTransfer:0}),sy=ai(ny),oy=G({},ns,{relatedTarget:0}),fl=ai(oy),ay=G({},mn,{animationName:0,elapsedTime:0,pseudoElement:0}),ly=ai(ay),cy=G({},mn,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),uy=ai(cy),hy=G({},mn,{data:0}),bd=ai(hy),dy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fy={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"},py={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function my(i){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(i):(i=py[i])?!!n[i]:!1}function pl(){return my}var gy=G({},ns,{key:function(i){if(i.key){var n=dy[i.key]||i.key;if(n!=="Unidentified")return n}return i.type==="keypress"?(i=fo(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?fy[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pl,charCode:function(i){return i.type==="keypress"?fo(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?fo(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),vy=ai(gy),_y=G({},mo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cd=ai(_y),yy=G({},ns,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pl}),Sy=ai(yy),wy=G({},mn,{propertyName:0,elapsedTime:0,pseudoElement:0}),by=ai(wy),Cy=G({},mo,{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}),xy=ai(Cy),ky=[9,13,27,32],ml=d&&"CompositionEvent"in window,os=null;d&&"documentMode"in document&&(os=document.documentMode);var Ey=d&&"TextEvent"in window&&!os,xd=d&&(!ml||os&&8<os&&11>=os),kd=" ",Ed=!1;function Nd(i,n){switch(i){case"keyup":return ky.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rd(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var gn=!1;function Ny(i,n){switch(i){case"compositionend":return Rd(n);case"keypress":return n.which!==32?null:(Ed=!0,kd);case"textInput":return i=n.data,i===kd&&Ed?null:i;default:return null}}function Ry(i,n){if(gn)return i==="compositionend"||!ml&&Nd(i,n)?(i=yd(),ho=cl=pr=null,gn=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return xd&&n.locale!=="ko"?null:n.data;default:return null}}var Py={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 Pd(i){var n=i&&i.nodeName&&i.nodeName.toLowerCase();return n==="input"?!!Py[i.type]:n==="textarea"}function Dd(i,n,a,c){Gh(c),n=So(n,"onChange"),0<n.length&&(a=new ul("onChange","change",null,a,c),i.push({event:a,listeners:n}))}var as=null,ls=null;function Dy(i){Yd(i,0)}function go(i){var n=wn(i);if(Y(n))return i}function Ly(i,n){if(i==="change")return n}var Ld=!1;if(d){var gl;if(d){var vl="oninput"in document;if(!vl){var Md=document.createElement("div");Md.setAttribute("oninput","return;"),vl=typeof Md.oninput=="function"}gl=vl}else gl=!1;Ld=gl&&(!document.documentMode||9<document.documentMode)}function Td(){as&&(as.detachEvent("onpropertychange",jd),ls=as=null)}function jd(i){if(i.propertyName==="value"&&go(ls)){var n=[];Dd(n,ls,i,Ga(i)),ed(Dy,n)}}function My(i,n,a){i==="focusin"?(Td(),as=n,ls=a,as.attachEvent("onpropertychange",jd)):i==="focusout"&&Td()}function Ty(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return go(ls)}function jy(i,n){if(i==="click")return go(n)}function By(i,n){if(i==="input"||i==="change")return go(n)}function Iy(i,n){return i===n&&(i!==0||1/i===1/n)||i!==i&&n!==n}var Pi=typeof Object.is=="function"?Object.is:Iy;function cs(i,n){if(Pi(i,n))return!0;if(typeof i!="object"||i===null||typeof n!="object"||n===null)return!1;var a=Object.keys(i),c=Object.keys(n);if(a.length!==c.length)return!1;for(c=0;c<a.length;c++){var f=a[c];if(!p.call(n,f)||!Pi(i[f],n[f]))return!1}return!0}function Bd(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Id(i,n){var a=Bd(i);i=0;for(var c;a;){if(a.nodeType===3){if(c=i+a.textContent.length,i<=n&&c>=n)return{node:a,offset:n-i};i=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Bd(a)}}function Ad(i,n){return i&&n?i===n?!0:i&&i.nodeType===3?!1:n&&n.nodeType===3?Ad(i,n.parentNode):"contains"in i?i.contains(n):i.compareDocumentPosition?!!(i.compareDocumentPosition(n)&16):!1:!1}function Od(){for(var i=window,n=ue();n instanceof i.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)i=n.contentWindow;else break;n=ue(i.document)}return n}function _l(i){var n=i&&i.nodeName&&i.nodeName.toLowerCase();return n&&(n==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||n==="textarea"||i.contentEditable==="true")}function Ay(i){var n=Od(),a=i.focusedElem,c=i.selectionRange;if(n!==a&&a&&a.ownerDocument&&Ad(a.ownerDocument.documentElement,a)){if(c!==null&&_l(a)){if(n=c.start,i=c.end,i===void 0&&(i=n),"selectionStart"in a)a.selectionStart=n,a.selectionEnd=Math.min(i,a.value.length);else if(i=(n=a.ownerDocument||document)&&n.defaultView||window,i.getSelection){i=i.getSelection();var f=a.textContent.length,g=Math.min(c.start,f);c=c.end===void 0?g:Math.min(c.end,f),!i.extend&&g>c&&(f=c,c=g,g=f),f=Id(a,g);var C=Id(a,c);f&&C&&(i.rangeCount!==1||i.anchorNode!==f.node||i.anchorOffset!==f.offset||i.focusNode!==C.node||i.focusOffset!==C.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),i.removeAllRanges(),g>c?(i.addRange(n),i.extend(C.node,C.offset)):(n.setEnd(C.node,C.offset),i.addRange(n)))}}for(n=[],i=a;i=i.parentNode;)i.nodeType===1&&n.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<n.length;a++)i=n[a],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var Oy=d&&"documentMode"in document&&11>=document.documentMode,vn=null,yl=null,us=null,Sl=!1;function zd(i,n,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Sl||vn==null||vn!==ue(c)||(c=vn,"selectionStart"in c&&_l(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),us&&cs(us,c)||(us=c,c=So(yl,"onSelect"),0<c.length&&(n=new ul("onSelect","select",null,n,a),i.push({event:n,listeners:c}),n.target=vn)))}function vo(i,n){var a={};return a[i.toLowerCase()]=n.toLowerCase(),a["Webkit"+i]="webkit"+n,a["Moz"+i]="moz"+n,a}var _n={animationend:vo("Animation","AnimationEnd"),animationiteration:vo("Animation","AnimationIteration"),animationstart:vo("Animation","AnimationStart"),transitionend:vo("Transition","TransitionEnd")},wl={},Fd={};d&&(Fd=document.createElement("div").style,"AnimationEvent"in window||(delete _n.animationend.animation,delete _n.animationiteration.animation,delete _n.animationstart.animation),"TransitionEvent"in window||delete _n.transitionend.transition);function _o(i){if(wl[i])return wl[i];if(!_n[i])return i;var n=_n[i],a;for(a in n)if(n.hasOwnProperty(a)&&a in Fd)return wl[i]=n[a];return i}var Hd=_o("animationend"),$d=_o("animationiteration"),Wd=_o("animationstart"),Ud=_o("transitionend"),qd=new Map,Kd="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 mr(i,n){qd.set(i,n),l(n,[i])}for(var bl=0;bl<Kd.length;bl++){var Cl=Kd[bl],zy=Cl.toLowerCase(),Fy=Cl[0].toUpperCase()+Cl.slice(1);mr(zy,"on"+Fy)}mr(Hd,"onAnimationEnd"),mr($d,"onAnimationIteration"),mr(Wd,"onAnimationStart"),mr("dblclick","onDoubleClick"),mr("focusin","onFocus"),mr("focusout","onBlur"),mr(Ud,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var hs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Hy=new Set("cancel close invalid load scroll toggle".split(" ").concat(hs));function Vd(i,n,a){var c=i.type||"unknown-event";i.currentTarget=a,z_(c,n,void 0,i),i.currentTarget=null}function Yd(i,n){n=(n&4)!==0;for(var a=0;a<i.length;a++){var c=i[a],f=c.event;c=c.listeners;e:{var g=void 0;if(n)for(var C=c.length-1;0<=C;C--){var M=c[C],H=M.instance,ne=M.currentTarget;if(M=M.listener,H!==g&&f.isPropagationStopped())break e;Vd(f,M,ne),g=H}else for(C=0;C<c.length;C++){if(M=c[C],H=M.instance,ne=M.currentTarget,M=M.listener,H!==g&&f.isPropagationStopped())break e;Vd(f,M,ne),g=H}}}if(to)throw i=el,to=!1,el=null,i}function Je(i,n){var a=n[Ll];a===void 0&&(a=n[Ll]=new Set);var c=i+"__bubble";a.has(c)||(Xd(n,i,2,!1),a.add(c))}function xl(i,n,a){var c=0;n&&(c|=4),Xd(a,i,c,n)}var yo="_reactListening"+Math.random().toString(36).slice(2);function ds(i){if(!i[yo]){i[yo]=!0,s.forEach(function(a){a!=="selectionchange"&&(Hy.has(a)||xl(a,!1,i),xl(a,!0,i))});var n=i.nodeType===9?i:i.ownerDocument;n===null||n[yo]||(n[yo]=!0,xl("selectionchange",!1,n))}}function Xd(i,n,a,c){switch(_d(n)){case 1:var f=ty;break;case 4:f=iy;break;default:f=al}a=f.bind(null,n,a,i),f=void 0,!Za||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),c?f!==void 0?i.addEventListener(n,a,{capture:!0,passive:f}):i.addEventListener(n,a,!0):f!==void 0?i.addEventListener(n,a,{passive:f}):i.addEventListener(n,a,!1)}function kl(i,n,a,c,f){var g=c;if((n&1)===0&&(n&2)===0&&c!==null)e:for(;;){if(c===null)return;var C=c.tag;if(C===3||C===4){var M=c.stateNode.containerInfo;if(M===f||M.nodeType===8&&M.parentNode===f)break;if(C===4)for(C=c.return;C!==null;){var H=C.tag;if((H===3||H===4)&&(H=C.stateNode.containerInfo,H===f||H.nodeType===8&&H.parentNode===f))return;C=C.return}for(;M!==null;){if(C=Fr(M),C===null)return;if(H=C.tag,H===5||H===6){c=g=C;continue e}M=M.parentNode}}c=c.return}ed(function(){var ne=g,de=Ga(a),fe=[];e:{var he=qd.get(i);if(he!==void 0){var Se=ul,Ce=i;switch(i){case"keypress":if(fo(a)===0)break e;case"keydown":case"keyup":Se=vy;break;case"focusin":Ce="focus",Se=fl;break;case"focusout":Ce="blur",Se=fl;break;case"beforeblur":case"afterblur":Se=fl;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Se=wd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Se=sy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Se=Sy;break;case Hd:case $d:case Wd:Se=ly;break;case Ud:Se=by;break;case"scroll":Se=ry;break;case"wheel":Se=xy;break;case"copy":case"cut":case"paste":Se=uy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Se=Cd}var xe=(n&4)!==0,dt=!xe&&i==="scroll",ee=xe?he!==null?he+"Capture":null:he;xe=[];for(var V=ne,ie;V!==null;){ie=V;var me=ie.stateNode;if(ie.tag===5&&me!==null&&(ie=me,ee!==null&&(me=Yn(V,ee),me!=null&&xe.push(fs(V,me,ie)))),dt)break;V=V.return}0<xe.length&&(he=new Se(he,Ce,null,a,de),fe.push({event:he,listeners:xe}))}}if((n&7)===0){e:{if(he=i==="mouseover"||i==="pointerover",Se=i==="mouseout"||i==="pointerout",he&&a!==oi&&(Ce=a.relatedTarget||a.fromElement)&&(Fr(Ce)||Ce[Qi]))break e;if((Se||he)&&(he=de.window===de?de:(he=de.ownerDocument)?he.defaultView||he.parentWindow:window,Se?(Ce=a.relatedTarget||a.toElement,Se=ne,Ce=Ce?Fr(Ce):null,Ce!==null&&(dt=zr(Ce),Ce!==dt||Ce.tag!==5&&Ce.tag!==6)&&(Ce=null)):(Se=null,Ce=ne),Se!==Ce)){if(xe=wd,me="onMouseLeave",ee="onMouseEnter",V="mouse",(i==="pointerout"||i==="pointerover")&&(xe=Cd,me="onPointerLeave",ee="onPointerEnter",V="pointer"),dt=Se==null?he:wn(Se),ie=Ce==null?he:wn(Ce),he=new xe(me,V+"leave",Se,a,de),he.target=dt,he.relatedTarget=ie,me=null,Fr(de)===ne&&(xe=new xe(ee,V+"enter",Ce,a,de),xe.target=ie,xe.relatedTarget=dt,me=xe),dt=me,Se&&Ce)t:{for(xe=Se,ee=Ce,V=0,ie=xe;ie;ie=yn(ie))V++;for(ie=0,me=ee;me;me=yn(me))ie++;for(;0<V-ie;)xe=yn(xe),V--;for(;0<ie-V;)ee=yn(ee),ie--;for(;V--;){if(xe===ee||ee!==null&&xe===ee.alternate)break t;xe=yn(xe),ee=yn(ee)}xe=null}else xe=null;Se!==null&&Gd(fe,he,Se,xe,!1),Ce!==null&&dt!==null&&Gd(fe,dt,Ce,xe,!0)}}e:{if(he=ne?wn(ne):window,Se=he.nodeName&&he.nodeName.toLowerCase(),Se==="select"||Se==="input"&&he.type==="file")var Ee=Ly;else if(Pd(he))if(Ld)Ee=By;else{Ee=Ty;var Re=My}else(Se=he.nodeName)&&Se.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(Ee=jy);if(Ee&&(Ee=Ee(i,ne))){Dd(fe,Ee,a,de);break e}Re&&Re(i,he,ne),i==="focusout"&&(Re=he._wrapperState)&&Re.controlled&&he.type==="number"&&Ue(he,"number",he.value)}switch(Re=ne?wn(ne):window,i){case"focusin":(Pd(Re)||Re.contentEditable==="true")&&(vn=Re,yl=ne,us=null);break;case"focusout":us=yl=vn=null;break;case"mousedown":Sl=!0;break;case"contextmenu":case"mouseup":case"dragend":Sl=!1,zd(fe,a,de);break;case"selectionchange":if(Oy)break;case"keydown":case"keyup":zd(fe,a,de)}var Pe;if(ml)e:{switch(i){case"compositionstart":var Le="onCompositionStart";break e;case"compositionend":Le="onCompositionEnd";break e;case"compositionupdate":Le="onCompositionUpdate";break e}Le=void 0}else gn?Nd(i,a)&&(Le="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(Le="onCompositionStart");Le&&(xd&&a.locale!=="ko"&&(gn||Le!=="onCompositionStart"?Le==="onCompositionEnd"&&gn&&(Pe=yd()):(pr=de,cl="value"in pr?pr.value:pr.textContent,gn=!0)),Re=So(ne,Le),0<Re.length&&(Le=new bd(Le,i,null,a,de),fe.push({event:Le,listeners:Re}),Pe?Le.data=Pe:(Pe=Rd(a),Pe!==null&&(Le.data=Pe)))),(Pe=Ey?Ny(i,a):Ry(i,a))&&(ne=So(ne,"onBeforeInput"),0<ne.length&&(de=new bd("onBeforeInput","beforeinput",null,a,de),fe.push({event:de,listeners:ne}),de.data=Pe))}Yd(fe,n)})}function fs(i,n,a){return{instance:i,listener:n,currentTarget:a}}function So(i,n){for(var a=n+"Capture",c=[];i!==null;){var f=i,g=f.stateNode;f.tag===5&&g!==null&&(f=g,g=Yn(i,a),g!=null&&c.unshift(fs(i,g,f)),g=Yn(i,n),g!=null&&c.push(fs(i,g,f))),i=i.return}return c}function yn(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function Gd(i,n,a,c,f){for(var g=n._reactName,C=[];a!==null&&a!==c;){var M=a,H=M.alternate,ne=M.stateNode;if(H!==null&&H===c)break;M.tag===5&&ne!==null&&(M=ne,f?(H=Yn(a,g),H!=null&&C.unshift(fs(a,H,M))):f||(H=Yn(a,g),H!=null&&C.push(fs(a,H,M)))),a=a.return}C.length!==0&&i.push({event:n,listeners:C})}var $y=/\r\n?/g,Wy=/\u0000|\uFFFD/g;function Qd(i){return(typeof i=="string"?i:""+i).replace($y,`
|
|
38
|
-
`).replace(Wy,"")}function wo(i,n,a){if(n=Qd(n),Qd(i)!==n&&a)throw Error(r(425))}function bo(){}var El=null,Nl=null;function Rl(i,n){return i==="textarea"||i==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Pl=typeof setTimeout=="function"?setTimeout:void 0,Uy=typeof clearTimeout=="function"?clearTimeout:void 0,Jd=typeof Promise=="function"?Promise:void 0,qy=typeof queueMicrotask=="function"?queueMicrotask:typeof Jd<"u"?function(i){return Jd.resolve(null).then(i).catch(Ky)}:Pl;function Ky(i){setTimeout(function(){throw i})}function Dl(i,n){var a=n,c=0;do{var f=a.nextSibling;if(i.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"){if(c===0){i.removeChild(f),rs(n);return}c--}else a!=="$"&&a!=="$?"&&a!=="$!"||c++;a=f}while(a);rs(n)}function gr(i){for(;i!=null;i=i.nextSibling){var n=i.nodeType;if(n===1||n===3)break;if(n===8){if(n=i.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return i}function Zd(i){i=i.previousSibling;for(var n=0;i;){if(i.nodeType===8){var a=i.data;if(a==="$"||a==="$!"||a==="$?"){if(n===0)return i;n--}else a==="/$"&&n++}i=i.previousSibling}return null}var Sn=Math.random().toString(36).slice(2),Oi="__reactFiber$"+Sn,ps="__reactProps$"+Sn,Qi="__reactContainer$"+Sn,Ll="__reactEvents$"+Sn,Vy="__reactListeners$"+Sn,Yy="__reactHandles$"+Sn;function Fr(i){var n=i[Oi];if(n)return n;for(var a=i.parentNode;a;){if(n=a[Qi]||a[Oi]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(i=Zd(i);i!==null;){if(a=i[Oi])return a;i=Zd(i)}return n}i=a,a=i.parentNode}return null}function ms(i){return i=i[Oi]||i[Qi],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function wn(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(r(33))}function Co(i){return i[ps]||null}var Ml=[],bn=-1;function vr(i){return{current:i}}function Ze(i){0>bn||(i.current=Ml[bn],Ml[bn]=null,bn--)}function Qe(i,n){bn++,Ml[bn]=i.current,i.current=n}var _r={},Ot=vr(_r),Xt=vr(!1),Hr=_r;function Cn(i,n){var a=i.type.contextTypes;if(!a)return _r;var c=i.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===n)return c.__reactInternalMemoizedMaskedChildContext;var f={},g;for(g in a)f[g]=n[g];return c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=n,i.__reactInternalMemoizedMaskedChildContext=f),f}function Gt(i){return i=i.childContextTypes,i!=null}function xo(){Ze(Xt),Ze(Ot)}function ef(i,n,a){if(Ot.current!==_r)throw Error(r(168));Qe(Ot,n),Qe(Xt,a)}function tf(i,n,a){var c=i.stateNode;if(n=n.childContextTypes,typeof c.getChildContext!="function")return a;c=c.getChildContext();for(var f in c)if(!(f in n))throw Error(r(108,ae(i)||"Unknown",f));return G({},a,c)}function ko(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||_r,Hr=Ot.current,Qe(Ot,i),Qe(Xt,Xt.current),!0}function rf(i,n,a){var c=i.stateNode;if(!c)throw Error(r(169));a?(i=tf(i,n,Hr),c.__reactInternalMemoizedMergedChildContext=i,Ze(Xt),Ze(Ot),Qe(Ot,i)):Ze(Xt),Qe(Xt,a)}var Ji=null,Eo=!1,Tl=!1;function nf(i){Ji===null?Ji=[i]:Ji.push(i)}function Xy(i){Eo=!0,nf(i)}function yr(){if(!Tl&&Ji!==null){Tl=!0;var i=0,n=Xe;try{var a=Ji;for(Xe=1;i<a.length;i++){var c=a[i];do c=c(!0);while(c!==null)}Ji=null,Eo=!1}catch(f){throw Ji!==null&&(Ji=Ji.slice(i+1)),sd(tl,yr),f}finally{Xe=n,Tl=!1}}return null}var xn=[],kn=0,No=null,Ro=0,_i=[],yi=0,$r=null,Zi=1,er="";function Wr(i,n){xn[kn++]=Ro,xn[kn++]=No,No=i,Ro=n}function sf(i,n,a){_i[yi++]=Zi,_i[yi++]=er,_i[yi++]=$r,$r=i;var c=Zi;i=er;var f=32-Ri(c)-1;c&=~(1<<f),a+=1;var g=32-Ri(n)+f;if(30<g){var C=f-f%5;g=(c&(1<<C)-1).toString(32),c>>=C,f-=C,Zi=1<<32-Ri(n)+f|a<<f|c,er=g+i}else Zi=1<<g|a<<f|c,er=i}function jl(i){i.return!==null&&(Wr(i,1),sf(i,1,0))}function Bl(i){for(;i===No;)No=xn[--kn],xn[kn]=null,Ro=xn[--kn],xn[kn]=null;for(;i===$r;)$r=_i[--yi],_i[yi]=null,er=_i[--yi],_i[yi]=null,Zi=_i[--yi],_i[yi]=null}var li=null,ci=null,it=!1,Di=null;function of(i,n){var a=Ci(5,null,null,0);a.elementType="DELETED",a.stateNode=n,a.return=i,n=i.deletions,n===null?(i.deletions=[a],i.flags|=16):n.push(a)}function af(i,n){switch(i.tag){case 5:var a=i.type;return n=n.nodeType!==1||a.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(i.stateNode=n,li=i,ci=gr(n.firstChild),!0):!1;case 6:return n=i.pendingProps===""||n.nodeType!==3?null:n,n!==null?(i.stateNode=n,li=i,ci=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(a=$r!==null?{id:Zi,overflow:er}:null,i.memoizedState={dehydrated:n,treeContext:a,retryLane:1073741824},a=Ci(18,null,null,0),a.stateNode=n,a.return=i,i.child=a,li=i,ci=null,!0):!1;default:return!1}}function Il(i){return(i.mode&1)!==0&&(i.flags&128)===0}function Al(i){if(it){var n=ci;if(n){var a=n;if(!af(i,n)){if(Il(i))throw Error(r(418));n=gr(a.nextSibling);var c=li;n&&af(i,n)?of(c,a):(i.flags=i.flags&-4097|2,it=!1,li=i)}}else{if(Il(i))throw Error(r(418));i.flags=i.flags&-4097|2,it=!1,li=i}}}function lf(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;li=i}function Po(i){if(i!==li)return!1;if(!it)return lf(i),it=!0,!1;var n;if((n=i.tag!==3)&&!(n=i.tag!==5)&&(n=i.type,n=n!=="head"&&n!=="body"&&!Rl(i.type,i.memoizedProps)),n&&(n=ci)){if(Il(i))throw cf(),Error(r(418));for(;n;)of(i,n),n=gr(n.nextSibling)}if(lf(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));e:{for(i=i.nextSibling,n=0;i;){if(i.nodeType===8){var a=i.data;if(a==="/$"){if(n===0){ci=gr(i.nextSibling);break e}n--}else a!=="$"&&a!=="$!"&&a!=="$?"||n++}i=i.nextSibling}ci=null}}else ci=li?gr(i.stateNode.nextSibling):null;return!0}function cf(){for(var i=ci;i;)i=gr(i.nextSibling)}function En(){ci=li=null,it=!1}function Ol(i){Di===null?Di=[i]:Di.push(i)}var Gy=I.ReactCurrentBatchConfig;function gs(i,n,a){if(i=a.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(r(309));var c=a.stateNode}if(!c)throw Error(r(147,i));var f=c,g=""+i;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===g?n.ref:(n=function(C){var M=f.refs;C===null?delete M[g]:M[g]=C},n._stringRef=g,n)}if(typeof i!="string")throw Error(r(284));if(!a._owner)throw Error(r(290,i))}return i}function Do(i,n){throw i=Object.prototype.toString.call(n),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":i))}function uf(i){var n=i._init;return n(i._payload)}function hf(i){function n(ee,V){if(i){var ie=ee.deletions;ie===null?(ee.deletions=[V],ee.flags|=16):ie.push(V)}}function a(ee,V){if(!i)return null;for(;V!==null;)n(ee,V),V=V.sibling;return null}function c(ee,V){for(ee=new Map;V!==null;)V.key!==null?ee.set(V.key,V):ee.set(V.index,V),V=V.sibling;return ee}function f(ee,V){return ee=Nr(ee,V),ee.index=0,ee.sibling=null,ee}function g(ee,V,ie){return ee.index=ie,i?(ie=ee.alternate,ie!==null?(ie=ie.index,ie<V?(ee.flags|=2,V):ie):(ee.flags|=2,V)):(ee.flags|=1048576,V)}function C(ee){return i&&ee.alternate===null&&(ee.flags|=2),ee}function M(ee,V,ie,me){return V===null||V.tag!==6?(V=Pc(ie,ee.mode,me),V.return=ee,V):(V=f(V,ie),V.return=ee,V)}function H(ee,V,ie,me){var Ee=ie.type;return Ee===B?de(ee,V,ie.props.children,me,ie.key):V!==null&&(V.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===F&&uf(Ee)===V.type)?(me=f(V,ie.props),me.ref=gs(ee,V,ie),me.return=ee,me):(me=ea(ie.type,ie.key,ie.props,null,ee.mode,me),me.ref=gs(ee,V,ie),me.return=ee,me)}function ne(ee,V,ie,me){return V===null||V.tag!==4||V.stateNode.containerInfo!==ie.containerInfo||V.stateNode.implementation!==ie.implementation?(V=Dc(ie,ee.mode,me),V.return=ee,V):(V=f(V,ie.children||[]),V.return=ee,V)}function de(ee,V,ie,me,Ee){return V===null||V.tag!==7?(V=Qr(ie,ee.mode,me,Ee),V.return=ee,V):(V=f(V,ie),V.return=ee,V)}function fe(ee,V,ie){if(typeof V=="string"&&V!==""||typeof V=="number")return V=Pc(""+V,ee.mode,ie),V.return=ee,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case U:return ie=ea(V.type,V.key,V.props,null,ee.mode,ie),ie.ref=gs(ee,null,V),ie.return=ee,ie;case O:return V=Dc(V,ee.mode,ie),V.return=ee,V;case F:var me=V._init;return fe(ee,me(V._payload),ie)}if(Ye(V)||K(V))return V=Qr(V,ee.mode,ie,null),V.return=ee,V;Do(ee,V)}return null}function he(ee,V,ie,me){var Ee=V!==null?V.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return Ee!==null?null:M(ee,V,""+ie,me);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case U:return ie.key===Ee?H(ee,V,ie,me):null;case O:return ie.key===Ee?ne(ee,V,ie,me):null;case F:return Ee=ie._init,he(ee,V,Ee(ie._payload),me)}if(Ye(ie)||K(ie))return Ee!==null?null:de(ee,V,ie,me,null);Do(ee,ie)}return null}function Se(ee,V,ie,me,Ee){if(typeof me=="string"&&me!==""||typeof me=="number")return ee=ee.get(ie)||null,M(V,ee,""+me,Ee);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case U:return ee=ee.get(me.key===null?ie:me.key)||null,H(V,ee,me,Ee);case O:return ee=ee.get(me.key===null?ie:me.key)||null,ne(V,ee,me,Ee);case F:var Re=me._init;return Se(ee,V,ie,Re(me._payload),Ee)}if(Ye(me)||K(me))return ee=ee.get(ie)||null,de(V,ee,me,Ee,null);Do(V,me)}return null}function Ce(ee,V,ie,me){for(var Ee=null,Re=null,Pe=V,Le=V=0,xt=null;Pe!==null&&Le<ie.length;Le++){Pe.index>Le?(xt=Pe,Pe=null):xt=Pe.sibling;var We=he(ee,Pe,ie[Le],me);if(We===null){Pe===null&&(Pe=xt);break}i&&Pe&&We.alternate===null&&n(ee,Pe),V=g(We,V,Le),Re===null?Ee=We:Re.sibling=We,Re=We,Pe=xt}if(Le===ie.length)return a(ee,Pe),it&&Wr(ee,Le),Ee;if(Pe===null){for(;Le<ie.length;Le++)Pe=fe(ee,ie[Le],me),Pe!==null&&(V=g(Pe,V,Le),Re===null?Ee=Pe:Re.sibling=Pe,Re=Pe);return it&&Wr(ee,Le),Ee}for(Pe=c(ee,Pe);Le<ie.length;Le++)xt=Se(Pe,ee,Le,ie[Le],me),xt!==null&&(i&&xt.alternate!==null&&Pe.delete(xt.key===null?Le:xt.key),V=g(xt,V,Le),Re===null?Ee=xt:Re.sibling=xt,Re=xt);return i&&Pe.forEach(function(Rr){return n(ee,Rr)}),it&&Wr(ee,Le),Ee}function xe(ee,V,ie,me){var Ee=K(ie);if(typeof Ee!="function")throw Error(r(150));if(ie=Ee.call(ie),ie==null)throw Error(r(151));for(var Re=Ee=null,Pe=V,Le=V=0,xt=null,We=ie.next();Pe!==null&&!We.done;Le++,We=ie.next()){Pe.index>Le?(xt=Pe,Pe=null):xt=Pe.sibling;var Rr=he(ee,Pe,We.value,me);if(Rr===null){Pe===null&&(Pe=xt);break}i&&Pe&&Rr.alternate===null&&n(ee,Pe),V=g(Rr,V,Le),Re===null?Ee=Rr:Re.sibling=Rr,Re=Rr,Pe=xt}if(We.done)return a(ee,Pe),it&&Wr(ee,Le),Ee;if(Pe===null){for(;!We.done;Le++,We=ie.next())We=fe(ee,We.value,me),We!==null&&(V=g(We,V,Le),Re===null?Ee=We:Re.sibling=We,Re=We);return it&&Wr(ee,Le),Ee}for(Pe=c(ee,Pe);!We.done;Le++,We=ie.next())We=Se(Pe,ee,Le,We.value,me),We!==null&&(i&&We.alternate!==null&&Pe.delete(We.key===null?Le:We.key),V=g(We,V,Le),Re===null?Ee=We:Re.sibling=We,Re=We);return i&&Pe.forEach(function(PS){return n(ee,PS)}),it&&Wr(ee,Le),Ee}function dt(ee,V,ie,me){if(typeof ie=="object"&&ie!==null&&ie.type===B&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case U:e:{for(var Ee=ie.key,Re=V;Re!==null;){if(Re.key===Ee){if(Ee=ie.type,Ee===B){if(Re.tag===7){a(ee,Re.sibling),V=f(Re,ie.props.children),V.return=ee,ee=V;break e}}else if(Re.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===F&&uf(Ee)===Re.type){a(ee,Re.sibling),V=f(Re,ie.props),V.ref=gs(ee,Re,ie),V.return=ee,ee=V;break e}a(ee,Re);break}else n(ee,Re);Re=Re.sibling}ie.type===B?(V=Qr(ie.props.children,ee.mode,me,ie.key),V.return=ee,ee=V):(me=ea(ie.type,ie.key,ie.props,null,ee.mode,me),me.ref=gs(ee,V,ie),me.return=ee,ee=me)}return C(ee);case O:e:{for(Re=ie.key;V!==null;){if(V.key===Re)if(V.tag===4&&V.stateNode.containerInfo===ie.containerInfo&&V.stateNode.implementation===ie.implementation){a(ee,V.sibling),V=f(V,ie.children||[]),V.return=ee,ee=V;break e}else{a(ee,V);break}else n(ee,V);V=V.sibling}V=Dc(ie,ee.mode,me),V.return=ee,ee=V}return C(ee);case F:return Re=ie._init,dt(ee,V,Re(ie._payload),me)}if(Ye(ie))return Ce(ee,V,ie,me);if(K(ie))return xe(ee,V,ie,me);Do(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,V!==null&&V.tag===6?(a(ee,V.sibling),V=f(V,ie),V.return=ee,ee=V):(a(ee,V),V=Pc(ie,ee.mode,me),V.return=ee,ee=V),C(ee)):a(ee,V)}return dt}var Nn=hf(!0),df=hf(!1),Lo=vr(null),Mo=null,Rn=null,zl=null;function Fl(){zl=Rn=Mo=null}function Hl(i){var n=Lo.current;Ze(Lo),i._currentValue=n}function $l(i,n,a){for(;i!==null;){var c=i.alternate;if((i.childLanes&n)!==n?(i.childLanes|=n,c!==null&&(c.childLanes|=n)):c!==null&&(c.childLanes&n)!==n&&(c.childLanes|=n),i===a)break;i=i.return}}function Pn(i,n){Mo=i,zl=Rn=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&n)!==0&&(Qt=!0),i.firstContext=null)}function Si(i){var n=i._currentValue;if(zl!==i)if(i={context:i,memoizedValue:n,next:null},Rn===null){if(Mo===null)throw Error(r(308));Rn=i,Mo.dependencies={lanes:0,firstContext:i}}else Rn=Rn.next=i;return n}var Ur=null;function Wl(i){Ur===null?Ur=[i]:Ur.push(i)}function ff(i,n,a,c){var f=n.interleaved;return f===null?(a.next=a,Wl(n)):(a.next=f.next,f.next=a),n.interleaved=a,tr(i,c)}function tr(i,n){i.lanes|=n;var a=i.alternate;for(a!==null&&(a.lanes|=n),a=i,i=i.return;i!==null;)i.childLanes|=n,a=i.alternate,a!==null&&(a.childLanes|=n),a=i,i=i.return;return a.tag===3?a.stateNode:null}var Sr=!1;function Ul(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function pf(i,n){i=i.updateQueue,n.updateQueue===i&&(n.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function ir(i,n){return{eventTime:i,lane:n,tag:0,payload:null,callback:null,next:null}}function wr(i,n,a){var c=i.updateQueue;if(c===null)return null;if(c=c.shared,($e&2)!==0){var f=c.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),c.pending=n,tr(i,a)}return f=c.interleaved,f===null?(n.next=n,Wl(c)):(n.next=f.next,f.next=n),c.interleaved=n,tr(i,a)}function To(i,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194240)!==0)){var c=n.lanes;c&=i.pendingLanes,a|=c,n.lanes=a,nl(i,a)}}function mf(i,n){var a=i.updateQueue,c=i.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var f=null,g=null;if(a=a.firstBaseUpdate,a!==null){do{var C={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};g===null?f=g=C:g=g.next=C,a=a.next}while(a!==null);g===null?f=g=n:g=g.next=n}else f=g=n;a={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:g,shared:c.shared,effects:c.effects},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=n:i.next=n,a.lastBaseUpdate=n}function jo(i,n,a,c){var f=i.updateQueue;Sr=!1;var g=f.firstBaseUpdate,C=f.lastBaseUpdate,M=f.shared.pending;if(M!==null){f.shared.pending=null;var H=M,ne=H.next;H.next=null,C===null?g=ne:C.next=ne,C=H;var de=i.alternate;de!==null&&(de=de.updateQueue,M=de.lastBaseUpdate,M!==C&&(M===null?de.firstBaseUpdate=ne:M.next=ne,de.lastBaseUpdate=H))}if(g!==null){var fe=f.baseState;C=0,de=ne=H=null,M=g;do{var he=M.lane,Se=M.eventTime;if((c&he)===he){de!==null&&(de=de.next={eventTime:Se,lane:0,tag:M.tag,payload:M.payload,callback:M.callback,next:null});e:{var Ce=i,xe=M;switch(he=n,Se=a,xe.tag){case 1:if(Ce=xe.payload,typeof Ce=="function"){fe=Ce.call(Se,fe,he);break e}fe=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=xe.payload,he=typeof Ce=="function"?Ce.call(Se,fe,he):Ce,he==null)break e;fe=G({},fe,he);break e;case 2:Sr=!0}}M.callback!==null&&M.lane!==0&&(i.flags|=64,he=f.effects,he===null?f.effects=[M]:he.push(M))}else Se={eventTime:Se,lane:he,tag:M.tag,payload:M.payload,callback:M.callback,next:null},de===null?(ne=de=Se,H=fe):de=de.next=Se,C|=he;if(M=M.next,M===null){if(M=f.shared.pending,M===null)break;he=M,M=he.next,he.next=null,f.lastBaseUpdate=he,f.shared.pending=null}}while(!0);if(de===null&&(H=fe),f.baseState=H,f.firstBaseUpdate=ne,f.lastBaseUpdate=de,n=f.shared.interleaved,n!==null){f=n;do C|=f.lane,f=f.next;while(f!==n)}else g===null&&(f.shared.lanes=0);Vr|=C,i.lanes=C,i.memoizedState=fe}}function gf(i,n,a){if(i=n.effects,n.effects=null,i!==null)for(n=0;n<i.length;n++){var c=i[n],f=c.callback;if(f!==null){if(c.callback=null,c=a,typeof f!="function")throw Error(r(191,f));f.call(c)}}}var vs={},zi=vr(vs),_s=vr(vs),ys=vr(vs);function qr(i){if(i===vs)throw Error(r(174));return i}function ql(i,n){switch(Qe(ys,n),Qe(_s,i),Qe(zi,vs),i=n.nodeType,i){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:Wt(null,"");break;default:i=i===8?n.parentNode:n,n=i.namespaceURI||null,i=i.tagName,n=Wt(n,i)}Ze(zi),Qe(zi,n)}function Dn(){Ze(zi),Ze(_s),Ze(ys)}function vf(i){qr(ys.current);var n=qr(zi.current),a=Wt(n,i.type);n!==a&&(Qe(_s,i),Qe(zi,a))}function Kl(i){_s.current===i&&(Ze(zi),Ze(_s))}var nt=vr(0);function Bo(i){for(var n=i;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===i)break;for(;n.sibling===null;){if(n.return===null||n.return===i)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Vl=[];function Yl(){for(var i=0;i<Vl.length;i++)Vl[i]._workInProgressVersionPrimary=null;Vl.length=0}var Io=I.ReactCurrentDispatcher,Xl=I.ReactCurrentBatchConfig,Kr=0,st=null,vt=null,bt=null,Ao=!1,Ss=!1,ws=0,Qy=0;function zt(){throw Error(r(321))}function Gl(i,n){if(n===null)return!1;for(var a=0;a<n.length&&a<i.length;a++)if(!Pi(i[a],n[a]))return!1;return!0}function Ql(i,n,a,c,f,g){if(Kr=g,st=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Io.current=i===null||i.memoizedState===null?tS:iS,i=a(c,f),Ss){g=0;do{if(Ss=!1,ws=0,25<=g)throw Error(r(301));g+=1,bt=vt=null,n.updateQueue=null,Io.current=rS,i=a(c,f)}while(Ss)}if(Io.current=Fo,n=vt!==null&&vt.next!==null,Kr=0,bt=vt=st=null,Ao=!1,n)throw Error(r(300));return i}function Jl(){var i=ws!==0;return ws=0,i}function Fi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?st.memoizedState=bt=i:bt=bt.next=i,bt}function wi(){if(vt===null){var i=st.alternate;i=i!==null?i.memoizedState:null}else i=vt.next;var n=bt===null?st.memoizedState:bt.next;if(n!==null)bt=n,vt=i;else{if(i===null)throw Error(r(310));vt=i,i={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},bt===null?st.memoizedState=bt=i:bt=bt.next=i}return bt}function bs(i,n){return typeof n=="function"?n(i):n}function Zl(i){var n=wi(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var c=vt,f=c.baseQueue,g=a.pending;if(g!==null){if(f!==null){var C=f.next;f.next=g.next,g.next=C}c.baseQueue=f=g,a.pending=null}if(f!==null){g=f.next,c=c.baseState;var M=C=null,H=null,ne=g;do{var de=ne.lane;if((Kr&de)===de)H!==null&&(H=H.next={lane:0,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),c=ne.hasEagerState?ne.eagerState:i(c,ne.action);else{var fe={lane:de,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null};H===null?(M=H=fe,C=c):H=H.next=fe,st.lanes|=de,Vr|=de}ne=ne.next}while(ne!==null&&ne!==g);H===null?C=c:H.next=M,Pi(c,n.memoizedState)||(Qt=!0),n.memoizedState=c,n.baseState=C,n.baseQueue=H,a.lastRenderedState=c}if(i=a.interleaved,i!==null){f=i;do g=f.lane,st.lanes|=g,Vr|=g,f=f.next;while(f!==i)}else f===null&&(a.lanes=0);return[n.memoizedState,a.dispatch]}function ec(i){var n=wi(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var c=a.dispatch,f=a.pending,g=n.memoizedState;if(f!==null){a.pending=null;var C=f=f.next;do g=i(g,C.action),C=C.next;while(C!==f);Pi(g,n.memoizedState)||(Qt=!0),n.memoizedState=g,n.baseQueue===null&&(n.baseState=g),a.lastRenderedState=g}return[g,c]}function _f(){}function yf(i,n){var a=st,c=wi(),f=n(),g=!Pi(c.memoizedState,f);if(g&&(c.memoizedState=f,Qt=!0),c=c.queue,tc(bf.bind(null,a,c,i),[i]),c.getSnapshot!==n||g||bt!==null&&bt.memoizedState.tag&1){if(a.flags|=2048,Cs(9,wf.bind(null,a,c,f,n),void 0,null),Ct===null)throw Error(r(349));(Kr&30)!==0||Sf(a,n,f)}return f}function Sf(i,n,a){i.flags|=16384,i={getSnapshot:n,value:a},n=st.updateQueue,n===null?(n={lastEffect:null,stores:null},st.updateQueue=n,n.stores=[i]):(a=n.stores,a===null?n.stores=[i]:a.push(i))}function wf(i,n,a,c){n.value=a,n.getSnapshot=c,Cf(n)&&xf(i)}function bf(i,n,a){return a(function(){Cf(n)&&xf(i)})}function Cf(i){var n=i.getSnapshot;i=i.value;try{var a=n();return!Pi(i,a)}catch{return!0}}function xf(i){var n=tr(i,1);n!==null&&ji(n,i,1,-1)}function kf(i){var n=Fi();return typeof i=="function"&&(i=i()),n.memoizedState=n.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:bs,lastRenderedState:i},n.queue=i,i=i.dispatch=eS.bind(null,st,i),[n.memoizedState,i]}function Cs(i,n,a,c){return i={tag:i,create:n,destroy:a,deps:c,next:null},n=st.updateQueue,n===null?(n={lastEffect:null,stores:null},st.updateQueue=n,n.lastEffect=i.next=i):(a=n.lastEffect,a===null?n.lastEffect=i.next=i:(c=a.next,a.next=i,i.next=c,n.lastEffect=i)),i}function Ef(){return wi().memoizedState}function Oo(i,n,a,c){var f=Fi();st.flags|=i,f.memoizedState=Cs(1|n,a,void 0,c===void 0?null:c)}function zo(i,n,a,c){var f=wi();c=c===void 0?null:c;var g=void 0;if(vt!==null){var C=vt.memoizedState;if(g=C.destroy,c!==null&&Gl(c,C.deps)){f.memoizedState=Cs(n,a,g,c);return}}st.flags|=i,f.memoizedState=Cs(1|n,a,g,c)}function Nf(i,n){return Oo(8390656,8,i,n)}function tc(i,n){return zo(2048,8,i,n)}function Rf(i,n){return zo(4,2,i,n)}function Pf(i,n){return zo(4,4,i,n)}function Df(i,n){if(typeof n=="function")return i=i(),n(i),function(){n(null)};if(n!=null)return i=i(),n.current=i,function(){n.current=null}}function Lf(i,n,a){return a=a!=null?a.concat([i]):null,zo(4,4,Df.bind(null,n,i),a)}function ic(){}function Mf(i,n){var a=wi();n=n===void 0?null:n;var c=a.memoizedState;return c!==null&&n!==null&&Gl(n,c[1])?c[0]:(a.memoizedState=[i,n],i)}function Tf(i,n){var a=wi();n=n===void 0?null:n;var c=a.memoizedState;return c!==null&&n!==null&&Gl(n,c[1])?c[0]:(i=i(),a.memoizedState=[i,n],i)}function jf(i,n,a){return(Kr&21)===0?(i.baseState&&(i.baseState=!1,Qt=!0),i.memoizedState=a):(Pi(a,n)||(a=cd(),st.lanes|=a,Vr|=a,i.baseState=!0),n)}function Jy(i,n){var a=Xe;Xe=a!==0&&4>a?a:4,i(!0);var c=Xl.transition;Xl.transition={};try{i(!1),n()}finally{Xe=a,Xl.transition=c}}function Bf(){return wi().memoizedState}function Zy(i,n,a){var c=kr(i);if(a={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null},If(i))Af(n,a);else if(a=ff(i,n,a,c),a!==null){var f=qt();ji(a,i,c,f),Of(a,n,c)}}function eS(i,n,a){var c=kr(i),f={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null};if(If(i))Af(n,f);else{var g=i.alternate;if(i.lanes===0&&(g===null||g.lanes===0)&&(g=n.lastRenderedReducer,g!==null))try{var C=n.lastRenderedState,M=g(C,a);if(f.hasEagerState=!0,f.eagerState=M,Pi(M,C)){var H=n.interleaved;H===null?(f.next=f,Wl(n)):(f.next=H.next,H.next=f),n.interleaved=f;return}}catch{}finally{}a=ff(i,n,f,c),a!==null&&(f=qt(),ji(a,i,c,f),Of(a,n,c))}}function If(i){var n=i.alternate;return i===st||n!==null&&n===st}function Af(i,n){Ss=Ao=!0;var a=i.pending;a===null?n.next=n:(n.next=a.next,a.next=n),i.pending=n}function Of(i,n,a){if((a&4194240)!==0){var c=n.lanes;c&=i.pendingLanes,a|=c,n.lanes=a,nl(i,a)}}var Fo={readContext:Si,useCallback:zt,useContext:zt,useEffect:zt,useImperativeHandle:zt,useInsertionEffect:zt,useLayoutEffect:zt,useMemo:zt,useReducer:zt,useRef:zt,useState:zt,useDebugValue:zt,useDeferredValue:zt,useTransition:zt,useMutableSource:zt,useSyncExternalStore:zt,useId:zt,unstable_isNewReconciler:!1},tS={readContext:Si,useCallback:function(i,n){return Fi().memoizedState=[i,n===void 0?null:n],i},useContext:Si,useEffect:Nf,useImperativeHandle:function(i,n,a){return a=a!=null?a.concat([i]):null,Oo(4194308,4,Df.bind(null,n,i),a)},useLayoutEffect:function(i,n){return Oo(4194308,4,i,n)},useInsertionEffect:function(i,n){return Oo(4,2,i,n)},useMemo:function(i,n){var a=Fi();return n=n===void 0?null:n,i=i(),a.memoizedState=[i,n],i},useReducer:function(i,n,a){var c=Fi();return n=a!==void 0?a(n):n,c.memoizedState=c.baseState=n,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:n},c.queue=i,i=i.dispatch=Zy.bind(null,st,i),[c.memoizedState,i]},useRef:function(i){var n=Fi();return i={current:i},n.memoizedState=i},useState:kf,useDebugValue:ic,useDeferredValue:function(i){return Fi().memoizedState=i},useTransition:function(){var i=kf(!1),n=i[0];return i=Jy.bind(null,i[1]),Fi().memoizedState=i,[n,i]},useMutableSource:function(){},useSyncExternalStore:function(i,n,a){var c=st,f=Fi();if(it){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),Ct===null)throw Error(r(349));(Kr&30)!==0||Sf(c,n,a)}f.memoizedState=a;var g={value:a,getSnapshot:n};return f.queue=g,Nf(bf.bind(null,c,g,i),[i]),c.flags|=2048,Cs(9,wf.bind(null,c,g,a,n),void 0,null),a},useId:function(){var i=Fi(),n=Ct.identifierPrefix;if(it){var a=er,c=Zi;a=(c&~(1<<32-Ri(c)-1)).toString(32)+a,n=":"+n+"R"+a,a=ws++,0<a&&(n+="H"+a.toString(32)),n+=":"}else a=Qy++,n=":"+n+"r"+a.toString(32)+":";return i.memoizedState=n},unstable_isNewReconciler:!1},iS={readContext:Si,useCallback:Mf,useContext:Si,useEffect:tc,useImperativeHandle:Lf,useInsertionEffect:Rf,useLayoutEffect:Pf,useMemo:Tf,useReducer:Zl,useRef:Ef,useState:function(){return Zl(bs)},useDebugValue:ic,useDeferredValue:function(i){var n=wi();return jf(n,vt.memoizedState,i)},useTransition:function(){var i=Zl(bs)[0],n=wi().memoizedState;return[i,n]},useMutableSource:_f,useSyncExternalStore:yf,useId:Bf,unstable_isNewReconciler:!1},rS={readContext:Si,useCallback:Mf,useContext:Si,useEffect:tc,useImperativeHandle:Lf,useInsertionEffect:Rf,useLayoutEffect:Pf,useMemo:Tf,useReducer:ec,useRef:Ef,useState:function(){return ec(bs)},useDebugValue:ic,useDeferredValue:function(i){var n=wi();return vt===null?n.memoizedState=i:jf(n,vt.memoizedState,i)},useTransition:function(){var i=ec(bs)[0],n=wi().memoizedState;return[i,n]},useMutableSource:_f,useSyncExternalStore:yf,useId:Bf,unstable_isNewReconciler:!1};function Li(i,n){if(i&&i.defaultProps){n=G({},n),i=i.defaultProps;for(var a in i)n[a]===void 0&&(n[a]=i[a]);return n}return n}function rc(i,n,a,c){n=i.memoizedState,a=a(c,n),a=a==null?n:G({},n,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var Ho={isMounted:function(i){return(i=i._reactInternals)?zr(i)===i:!1},enqueueSetState:function(i,n,a){i=i._reactInternals;var c=qt(),f=kr(i),g=ir(c,f);g.payload=n,a!=null&&(g.callback=a),n=wr(i,g,f),n!==null&&(ji(n,i,f,c),To(n,i,f))},enqueueReplaceState:function(i,n,a){i=i._reactInternals;var c=qt(),f=kr(i),g=ir(c,f);g.tag=1,g.payload=n,a!=null&&(g.callback=a),n=wr(i,g,f),n!==null&&(ji(n,i,f,c),To(n,i,f))},enqueueForceUpdate:function(i,n){i=i._reactInternals;var a=qt(),c=kr(i),f=ir(a,c);f.tag=2,n!=null&&(f.callback=n),n=wr(i,f,c),n!==null&&(ji(n,i,c,a),To(n,i,c))}};function zf(i,n,a,c,f,g,C){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(c,g,C):n.prototype&&n.prototype.isPureReactComponent?!cs(a,c)||!cs(f,g):!0}function Ff(i,n,a){var c=!1,f=_r,g=n.contextType;return typeof g=="object"&&g!==null?g=Si(g):(f=Gt(n)?Hr:Ot.current,c=n.contextTypes,g=(c=c!=null)?Cn(i,f):_r),n=new n(a,g),i.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=Ho,i.stateNode=n,n._reactInternals=i,c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=f,i.__reactInternalMemoizedMaskedChildContext=g),n}function Hf(i,n,a,c){i=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,c),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,c),n.state!==i&&Ho.enqueueReplaceState(n,n.state,null)}function nc(i,n,a,c){var f=i.stateNode;f.props=a,f.state=i.memoizedState,f.refs={},Ul(i);var g=n.contextType;typeof g=="object"&&g!==null?f.context=Si(g):(g=Gt(n)?Hr:Ot.current,f.context=Cn(i,g)),f.state=i.memoizedState,g=n.getDerivedStateFromProps,typeof g=="function"&&(rc(i,n,g,a),f.state=i.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(n=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),n!==f.state&&Ho.enqueueReplaceState(f,f.state,null),jo(i,a,f,c),f.state=i.memoizedState),typeof f.componentDidMount=="function"&&(i.flags|=4194308)}function Ln(i,n){try{var a="",c=n;do a+=se(c),c=c.return;while(c);var f=a}catch(g){f=`
|
|
39
|
-
Error generating stack: `+g.message+`
|
|
40
|
-
`+g.stack}return{value:i,source:n,stack:f,digest:null}}function sc(i,n,a){return{value:i,source:null,stack:a??null,digest:n??null}}function oc(i,n){try{console.error(n.value)}catch(a){setTimeout(function(){throw a})}}var nS=typeof WeakMap=="function"?WeakMap:Map;function $f(i,n,a){a=ir(-1,a),a.tag=3,a.payload={element:null};var c=n.value;return a.callback=function(){Yo||(Yo=!0,wc=c),oc(i,n)},a}function Wf(i,n,a){a=ir(-1,a),a.tag=3;var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var f=n.value;a.payload=function(){return c(f)},a.callback=function(){oc(i,n)}}var g=i.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(a.callback=function(){oc(i,n),typeof c!="function"&&(Cr===null?Cr=new Set([this]):Cr.add(this));var C=n.stack;this.componentDidCatch(n.value,{componentStack:C!==null?C:""})}),a}function Uf(i,n,a){var c=i.pingCache;if(c===null){c=i.pingCache=new nS;var f=new Set;c.set(n,f)}else f=c.get(n),f===void 0&&(f=new Set,c.set(n,f));f.has(a)||(f.add(a),i=_S.bind(null,i,n,a),n.then(i,i))}function qf(i){do{var n;if((n=i.tag===13)&&(n=i.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return i;i=i.return}while(i!==null);return null}function Kf(i,n,a,c,f){return(i.mode&1)===0?(i===n?i.flags|=65536:(i.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(n=ir(-1,1),n.tag=2,wr(a,n,1))),a.lanes|=1),i):(i.flags|=65536,i.lanes=f,i)}var sS=I.ReactCurrentOwner,Qt=!1;function Ut(i,n,a,c){n.child=i===null?df(n,null,a,c):Nn(n,i.child,a,c)}function Vf(i,n,a,c,f){a=a.render;var g=n.ref;return Pn(n,f),c=Ql(i,n,a,c,g,f),a=Jl(),i!==null&&!Qt?(n.updateQueue=i.updateQueue,n.flags&=-2053,i.lanes&=~f,rr(i,n,f)):(it&&a&&jl(n),n.flags|=1,Ut(i,n,c,f),n.child)}function Yf(i,n,a,c,f){if(i===null){var g=a.type;return typeof g=="function"&&!Rc(g)&&g.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(n.tag=15,n.type=g,Xf(i,n,g,c,f)):(i=ea(a.type,null,c,n,n.mode,f),i.ref=n.ref,i.return=n,n.child=i)}if(g=i.child,(i.lanes&f)===0){var C=g.memoizedProps;if(a=a.compare,a=a!==null?a:cs,a(C,c)&&i.ref===n.ref)return rr(i,n,f)}return n.flags|=1,i=Nr(g,c),i.ref=n.ref,i.return=n,n.child=i}function Xf(i,n,a,c,f){if(i!==null){var g=i.memoizedProps;if(cs(g,c)&&i.ref===n.ref)if(Qt=!1,n.pendingProps=c=g,(i.lanes&f)!==0)(i.flags&131072)!==0&&(Qt=!0);else return n.lanes=i.lanes,rr(i,n,f)}return ac(i,n,a,c,f)}function Gf(i,n,a){var c=n.pendingProps,f=c.children,g=i!==null?i.memoizedState:null;if(c.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},Qe(Tn,ui),ui|=a;else{if((a&1073741824)===0)return i=g!==null?g.baseLanes|a:a,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:i,cachePool:null,transitions:null},n.updateQueue=null,Qe(Tn,ui),ui|=i,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=g!==null?g.baseLanes:a,Qe(Tn,ui),ui|=c}else g!==null?(c=g.baseLanes|a,n.memoizedState=null):c=a,Qe(Tn,ui),ui|=c;return Ut(i,n,f,a),n.child}function Qf(i,n){var a=n.ref;(i===null&&a!==null||i!==null&&i.ref!==a)&&(n.flags|=512,n.flags|=2097152)}function ac(i,n,a,c,f){var g=Gt(a)?Hr:Ot.current;return g=Cn(n,g),Pn(n,f),a=Ql(i,n,a,c,g,f),c=Jl(),i!==null&&!Qt?(n.updateQueue=i.updateQueue,n.flags&=-2053,i.lanes&=~f,rr(i,n,f)):(it&&c&&jl(n),n.flags|=1,Ut(i,n,a,f),n.child)}function Jf(i,n,a,c,f){if(Gt(a)){var g=!0;ko(n)}else g=!1;if(Pn(n,f),n.stateNode===null)Wo(i,n),Ff(n,a,c),nc(n,a,c,f),c=!0;else if(i===null){var C=n.stateNode,M=n.memoizedProps;C.props=M;var H=C.context,ne=a.contextType;typeof ne=="object"&&ne!==null?ne=Si(ne):(ne=Gt(a)?Hr:Ot.current,ne=Cn(n,ne));var de=a.getDerivedStateFromProps,fe=typeof de=="function"||typeof C.getSnapshotBeforeUpdate=="function";fe||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(M!==c||H!==ne)&&Hf(n,C,c,ne),Sr=!1;var he=n.memoizedState;C.state=he,jo(n,c,C,f),H=n.memoizedState,M!==c||he!==H||Xt.current||Sr?(typeof de=="function"&&(rc(n,a,de,c),H=n.memoizedState),(M=Sr||zf(n,a,M,c,he,H,ne))?(fe||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(n.flags|=4194308)):(typeof C.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=H),C.props=c,C.state=H,C.context=ne,c=M):(typeof C.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{C=n.stateNode,pf(i,n),M=n.memoizedProps,ne=n.type===n.elementType?M:Li(n.type,M),C.props=ne,fe=n.pendingProps,he=C.context,H=a.contextType,typeof H=="object"&&H!==null?H=Si(H):(H=Gt(a)?Hr:Ot.current,H=Cn(n,H));var Se=a.getDerivedStateFromProps;(de=typeof Se=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(M!==fe||he!==H)&&Hf(n,C,c,H),Sr=!1,he=n.memoizedState,C.state=he,jo(n,c,C,f);var Ce=n.memoizedState;M!==fe||he!==Ce||Xt.current||Sr?(typeof Se=="function"&&(rc(n,a,Se,c),Ce=n.memoizedState),(ne=Sr||zf(n,a,ne,c,he,Ce,H)||!1)?(de||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(c,Ce,H),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(c,Ce,H)),typeof C.componentDidUpdate=="function"&&(n.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof C.componentDidUpdate!="function"||M===i.memoizedProps&&he===i.memoizedState||(n.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||M===i.memoizedProps&&he===i.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=Ce),C.props=c,C.state=Ce,C.context=H,c=ne):(typeof C.componentDidUpdate!="function"||M===i.memoizedProps&&he===i.memoizedState||(n.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||M===i.memoizedProps&&he===i.memoizedState||(n.flags|=1024),c=!1)}return lc(i,n,a,c,g,f)}function lc(i,n,a,c,f,g){Qf(i,n);var C=(n.flags&128)!==0;if(!c&&!C)return f&&rf(n,a,!1),rr(i,n,g);c=n.stateNode,sS.current=n;var M=C&&typeof a.getDerivedStateFromError!="function"?null:c.render();return n.flags|=1,i!==null&&C?(n.child=Nn(n,i.child,null,g),n.child=Nn(n,null,M,g)):Ut(i,n,M,g),n.memoizedState=c.state,f&&rf(n,a,!0),n.child}function Zf(i){var n=i.stateNode;n.pendingContext?ef(i,n.pendingContext,n.pendingContext!==n.context):n.context&&ef(i,n.context,!1),ql(i,n.containerInfo)}function ep(i,n,a,c,f){return En(),Ol(f),n.flags|=256,Ut(i,n,a,c),n.child}var cc={dehydrated:null,treeContext:null,retryLane:0};function uc(i){return{baseLanes:i,cachePool:null,transitions:null}}function tp(i,n,a){var c=n.pendingProps,f=nt.current,g=!1,C=(n.flags&128)!==0,M;if((M=C)||(M=i!==null&&i.memoizedState===null?!1:(f&2)!==0),M?(g=!0,n.flags&=-129):(i===null||i.memoizedState!==null)&&(f|=1),Qe(nt,f&1),i===null)return Al(n),i=n.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((n.mode&1)===0?n.lanes=1:i.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(C=c.children,i=c.fallback,g?(c=n.mode,g=n.child,C={mode:"hidden",children:C},(c&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=C):g=ta(C,c,0,null),i=Qr(i,c,a,null),g.return=n,i.return=n,g.sibling=i,n.child=g,n.child.memoizedState=uc(a),n.memoizedState=cc,i):hc(n,C));if(f=i.memoizedState,f!==null&&(M=f.dehydrated,M!==null))return oS(i,n,C,c,M,f,a);if(g){g=c.fallback,C=n.mode,f=i.child,M=f.sibling;var H={mode:"hidden",children:c.children};return(C&1)===0&&n.child!==f?(c=n.child,c.childLanes=0,c.pendingProps=H,n.deletions=null):(c=Nr(f,H),c.subtreeFlags=f.subtreeFlags&14680064),M!==null?g=Nr(M,g):(g=Qr(g,C,a,null),g.flags|=2),g.return=n,c.return=n,c.sibling=g,n.child=c,c=g,g=n.child,C=i.child.memoizedState,C=C===null?uc(a):{baseLanes:C.baseLanes|a,cachePool:null,transitions:C.transitions},g.memoizedState=C,g.childLanes=i.childLanes&~a,n.memoizedState=cc,c}return g=i.child,i=g.sibling,c=Nr(g,{mode:"visible",children:c.children}),(n.mode&1)===0&&(c.lanes=a),c.return=n,c.sibling=null,i!==null&&(a=n.deletions,a===null?(n.deletions=[i],n.flags|=16):a.push(i)),n.child=c,n.memoizedState=null,c}function hc(i,n){return n=ta({mode:"visible",children:n},i.mode,0,null),n.return=i,i.child=n}function $o(i,n,a,c){return c!==null&&Ol(c),Nn(n,i.child,null,a),i=hc(n,n.pendingProps.children),i.flags|=2,n.memoizedState=null,i}function oS(i,n,a,c,f,g,C){if(a)return n.flags&256?(n.flags&=-257,c=sc(Error(r(422))),$o(i,n,C,c)):n.memoizedState!==null?(n.child=i.child,n.flags|=128,null):(g=c.fallback,f=n.mode,c=ta({mode:"visible",children:c.children},f,0,null),g=Qr(g,f,C,null),g.flags|=2,c.return=n,g.return=n,c.sibling=g,n.child=c,(n.mode&1)!==0&&Nn(n,i.child,null,C),n.child.memoizedState=uc(C),n.memoizedState=cc,g);if((n.mode&1)===0)return $o(i,n,C,null);if(f.data==="$!"){if(c=f.nextSibling&&f.nextSibling.dataset,c)var M=c.dgst;return c=M,g=Error(r(419)),c=sc(g,c,void 0),$o(i,n,C,c)}if(M=(C&i.childLanes)!==0,Qt||M){if(c=Ct,c!==null){switch(C&-C){case 4:f=2;break;case 16:f=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:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(c.suspendedLanes|C))!==0?0:f,f!==0&&f!==g.retryLane&&(g.retryLane=f,tr(i,f),ji(c,i,f,-1))}return Nc(),c=sc(Error(r(421))),$o(i,n,C,c)}return f.data==="$?"?(n.flags|=128,n.child=i.child,n=yS.bind(null,i),f._reactRetry=n,null):(i=g.treeContext,ci=gr(f.nextSibling),li=n,it=!0,Di=null,i!==null&&(_i[yi++]=Zi,_i[yi++]=er,_i[yi++]=$r,Zi=i.id,er=i.overflow,$r=n),n=hc(n,c.children),n.flags|=4096,n)}function ip(i,n,a){i.lanes|=n;var c=i.alternate;c!==null&&(c.lanes|=n),$l(i.return,n,a)}function dc(i,n,a,c,f){var g=i.memoizedState;g===null?i.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:f}:(g.isBackwards=n,g.rendering=null,g.renderingStartTime=0,g.last=c,g.tail=a,g.tailMode=f)}function rp(i,n,a){var c=n.pendingProps,f=c.revealOrder,g=c.tail;if(Ut(i,n,c.children,a),c=nt.current,(c&2)!==0)c=c&1|2,n.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=n.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&ip(i,a,n);else if(i.tag===19)ip(i,a,n);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break e;for(;i.sibling===null;){if(i.return===null||i.return===n)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}c&=1}if(Qe(nt,c),(n.mode&1)===0)n.memoizedState=null;else switch(f){case"forwards":for(a=n.child,f=null;a!==null;)i=a.alternate,i!==null&&Bo(i)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),dc(n,!1,f,a,g);break;case"backwards":for(a=null,f=n.child,n.child=null;f!==null;){if(i=f.alternate,i!==null&&Bo(i)===null){n.child=f;break}i=f.sibling,f.sibling=a,a=f,f=i}dc(n,!0,a,null,g);break;case"together":dc(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function Wo(i,n){(n.mode&1)===0&&i!==null&&(i.alternate=null,n.alternate=null,n.flags|=2)}function rr(i,n,a){if(i!==null&&(n.dependencies=i.dependencies),Vr|=n.lanes,(a&n.childLanes)===0)return null;if(i!==null&&n.child!==i.child)throw Error(r(153));if(n.child!==null){for(i=n.child,a=Nr(i,i.pendingProps),n.child=a,a.return=n;i.sibling!==null;)i=i.sibling,a=a.sibling=Nr(i,i.pendingProps),a.return=n;a.sibling=null}return n.child}function aS(i,n,a){switch(n.tag){case 3:Zf(n),En();break;case 5:vf(n);break;case 1:Gt(n.type)&&ko(n);break;case 4:ql(n,n.stateNode.containerInfo);break;case 10:var c=n.type._context,f=n.memoizedProps.value;Qe(Lo,c._currentValue),c._currentValue=f;break;case 13:if(c=n.memoizedState,c!==null)return c.dehydrated!==null?(Qe(nt,nt.current&1),n.flags|=128,null):(a&n.child.childLanes)!==0?tp(i,n,a):(Qe(nt,nt.current&1),i=rr(i,n,a),i!==null?i.sibling:null);Qe(nt,nt.current&1);break;case 19:if(c=(a&n.childLanes)!==0,(i.flags&128)!==0){if(c)return rp(i,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Qe(nt,nt.current),c)break;return null;case 22:case 23:return n.lanes=0,Gf(i,n,a)}return rr(i,n,a)}var np,fc,sp,op;np=function(i,n){for(var a=n.child;a!==null;){if(a.tag===5||a.tag===6)i.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},fc=function(){},sp=function(i,n,a,c){var f=i.memoizedProps;if(f!==c){i=n.stateNode,qr(zi.current);var g=null;switch(a){case"input":f=Ne(i,f),c=Ne(i,c),g=[];break;case"select":f=G({},f,{value:void 0}),c=G({},c,{value:void 0}),g=[];break;case"textarea":f=Lt(i,f),c=Lt(i,c),g=[];break;default:typeof f.onClick!="function"&&typeof c.onClick=="function"&&(i.onclick=bo)}Be(a,c);var C;a=null;for(ne in f)if(!c.hasOwnProperty(ne)&&f.hasOwnProperty(ne)&&f[ne]!=null)if(ne==="style"){var M=f[ne];for(C in M)M.hasOwnProperty(C)&&(a||(a={}),a[C]="")}else ne!=="dangerouslySetInnerHTML"&&ne!=="children"&&ne!=="suppressContentEditableWarning"&&ne!=="suppressHydrationWarning"&&ne!=="autoFocus"&&(o.hasOwnProperty(ne)?g||(g=[]):(g=g||[]).push(ne,null));for(ne in c){var H=c[ne];if(M=f!=null?f[ne]:void 0,c.hasOwnProperty(ne)&&H!==M&&(H!=null||M!=null))if(ne==="style")if(M){for(C in M)!M.hasOwnProperty(C)||H&&H.hasOwnProperty(C)||(a||(a={}),a[C]="");for(C in H)H.hasOwnProperty(C)&&M[C]!==H[C]&&(a||(a={}),a[C]=H[C])}else a||(g||(g=[]),g.push(ne,a)),a=H;else ne==="dangerouslySetInnerHTML"?(H=H?H.__html:void 0,M=M?M.__html:void 0,H!=null&&M!==H&&(g=g||[]).push(ne,H)):ne==="children"?typeof H!="string"&&typeof H!="number"||(g=g||[]).push(ne,""+H):ne!=="suppressContentEditableWarning"&&ne!=="suppressHydrationWarning"&&(o.hasOwnProperty(ne)?(H!=null&&ne==="onScroll"&&Je("scroll",i),g||M===H||(g=[])):(g=g||[]).push(ne,H))}a&&(g=g||[]).push("style",a);var ne=g;(n.updateQueue=ne)&&(n.flags|=4)}},op=function(i,n,a,c){a!==c&&(n.flags|=4)};function xs(i,n){if(!it)switch(i.tailMode){case"hidden":n=i.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?i.tail=null:a.sibling=null;break;case"collapsed":a=i.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?n||i.tail===null?i.tail=null:i.tail.sibling=null:c.sibling=null}}function Ft(i){var n=i.alternate!==null&&i.alternate.child===i.child,a=0,c=0;if(n)for(var f=i.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags&14680064,c|=f.flags&14680064,f.return=i,f=f.sibling;else for(f=i.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags,c|=f.flags,f.return=i,f=f.sibling;return i.subtreeFlags|=c,i.childLanes=a,n}function lS(i,n,a){var c=n.pendingProps;switch(Bl(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ft(n),null;case 1:return Gt(n.type)&&xo(),Ft(n),null;case 3:return c=n.stateNode,Dn(),Ze(Xt),Ze(Ot),Yl(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(Po(n)?n.flags|=4:i===null||i.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Di!==null&&(xc(Di),Di=null))),fc(i,n),Ft(n),null;case 5:Kl(n);var f=qr(ys.current);if(a=n.type,i!==null&&n.stateNode!=null)sp(i,n,a,c,f),i.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!c){if(n.stateNode===null)throw Error(r(166));return Ft(n),null}if(i=qr(zi.current),Po(n)){c=n.stateNode,a=n.type;var g=n.memoizedProps;switch(c[Oi]=n,c[ps]=g,i=(n.mode&1)!==0,a){case"dialog":Je("cancel",c),Je("close",c);break;case"iframe":case"object":case"embed":Je("load",c);break;case"video":case"audio":for(f=0;f<hs.length;f++)Je(hs[f],c);break;case"source":Je("error",c);break;case"img":case"image":case"link":Je("error",c),Je("load",c);break;case"details":Je("toggle",c);break;case"input":Te(c,g),Je("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!g.multiple},Je("invalid",c);break;case"textarea":je(c,g),Je("invalid",c)}Be(a,g),f=null;for(var C in g)if(g.hasOwnProperty(C)){var M=g[C];C==="children"?typeof M=="string"?c.textContent!==M&&(g.suppressHydrationWarning!==!0&&wo(c.textContent,M,i),f=["children",M]):typeof M=="number"&&c.textContent!==""+M&&(g.suppressHydrationWarning!==!0&&wo(c.textContent,M,i),f=["children",""+M]):o.hasOwnProperty(C)&&M!=null&&C==="onScroll"&&Je("scroll",c)}switch(a){case"input":W(c),De(c,g,!0);break;case"textarea":W(c),Ar(c);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(c.onclick=bo)}c=f,n.updateQueue=c,c!==null&&(n.flags|=4)}else{C=f.nodeType===9?f:f.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=Or(a)),i==="http://www.w3.org/1999/xhtml"?a==="script"?(i=C.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof c.is=="string"?i=C.createElement(a,{is:c.is}):(i=C.createElement(a),a==="select"&&(C=i,c.multiple?C.multiple=!0:c.size&&(C.size=c.size))):i=C.createElementNS(i,a),i[Oi]=n,i[ps]=c,np(i,n,!1,!1),n.stateNode=i;e:{switch(C=Mt(a,c),a){case"dialog":Je("cancel",i),Je("close",i),f=c;break;case"iframe":case"object":case"embed":Je("load",i),f=c;break;case"video":case"audio":for(f=0;f<hs.length;f++)Je(hs[f],i);f=c;break;case"source":Je("error",i),f=c;break;case"img":case"image":case"link":Je("error",i),Je("load",i),f=c;break;case"details":Je("toggle",i),f=c;break;case"input":Te(i,c),f=Ne(i,c),Je("invalid",i);break;case"option":f=c;break;case"select":i._wrapperState={wasMultiple:!!c.multiple},f=G({},c,{value:void 0}),Je("invalid",i);break;case"textarea":je(i,c),f=Lt(i,c),Je("invalid",i);break;default:f=c}Be(a,f),M=f;for(g in M)if(M.hasOwnProperty(g)){var H=M[g];g==="style"?le(i,H):g==="dangerouslySetInnerHTML"?(H=H?H.__html:void 0,H!=null&&Gi(i,H)):g==="children"?typeof H=="string"?(a!=="textarea"||H!=="")&&si(i,H):typeof H=="number"&&si(i,""+H):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(o.hasOwnProperty(g)?H!=null&&g==="onScroll"&&Je("scroll",i):H!=null&&z(i,g,H,C))}switch(a){case"input":W(i),De(i,c,!1);break;case"textarea":W(i),Ar(i);break;case"option":c.value!=null&&i.setAttribute("value",""+ge(c.value));break;case"select":i.multiple=!!c.multiple,g=c.value,g!=null?At(i,!!c.multiple,g,!1):c.defaultValue!=null&&At(i,!!c.multiple,c.defaultValue,!0);break;default:typeof f.onClick=="function"&&(i.onclick=bo)}switch(a){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return Ft(n),null;case 6:if(i&&n.stateNode!=null)op(i,n,i.memoizedProps,c);else{if(typeof c!="string"&&n.stateNode===null)throw Error(r(166));if(a=qr(ys.current),qr(zi.current),Po(n)){if(c=n.stateNode,a=n.memoizedProps,c[Oi]=n,(g=c.nodeValue!==a)&&(i=li,i!==null))switch(i.tag){case 3:wo(c.nodeValue,a,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&wo(c.nodeValue,a,(i.mode&1)!==0)}g&&(n.flags|=4)}else c=(a.nodeType===9?a:a.ownerDocument).createTextNode(c),c[Oi]=n,n.stateNode=c}return Ft(n),null;case 13:if(Ze(nt),c=n.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(it&&ci!==null&&(n.mode&1)!==0&&(n.flags&128)===0)cf(),En(),n.flags|=98560,g=!1;else if(g=Po(n),c!==null&&c.dehydrated!==null){if(i===null){if(!g)throw Error(r(318));if(g=n.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[Oi]=n}else En(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ft(n),g=!1}else Di!==null&&(xc(Di),Di=null),g=!0;if(!g)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=a,n):(c=c!==null,c!==(i!==null&&i.memoizedState!==null)&&c&&(n.child.flags|=8192,(n.mode&1)!==0&&(i===null||(nt.current&1)!==0?_t===0&&(_t=3):Nc())),n.updateQueue!==null&&(n.flags|=4),Ft(n),null);case 4:return Dn(),fc(i,n),i===null&&ds(n.stateNode.containerInfo),Ft(n),null;case 10:return Hl(n.type._context),Ft(n),null;case 17:return Gt(n.type)&&xo(),Ft(n),null;case 19:if(Ze(nt),g=n.memoizedState,g===null)return Ft(n),null;if(c=(n.flags&128)!==0,C=g.rendering,C===null)if(c)xs(g,!1);else{if(_t!==0||i!==null&&(i.flags&128)!==0)for(i=n.child;i!==null;){if(C=Bo(i),C!==null){for(n.flags|=128,xs(g,!1),c=C.updateQueue,c!==null&&(n.updateQueue=c,n.flags|=4),n.subtreeFlags=0,c=a,a=n.child;a!==null;)g=a,i=c,g.flags&=14680066,C=g.alternate,C===null?(g.childLanes=0,g.lanes=i,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=C.childLanes,g.lanes=C.lanes,g.child=C.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=C.memoizedProps,g.memoizedState=C.memoizedState,g.updateQueue=C.updateQueue,g.type=C.type,i=C.dependencies,g.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),a=a.sibling;return Qe(nt,nt.current&1|2),n.child}i=i.sibling}g.tail!==null&&ht()>jn&&(n.flags|=128,c=!0,xs(g,!1),n.lanes=4194304)}else{if(!c)if(i=Bo(C),i!==null){if(n.flags|=128,c=!0,a=i.updateQueue,a!==null&&(n.updateQueue=a,n.flags|=4),xs(g,!0),g.tail===null&&g.tailMode==="hidden"&&!C.alternate&&!it)return Ft(n),null}else 2*ht()-g.renderingStartTime>jn&&a!==1073741824&&(n.flags|=128,c=!0,xs(g,!1),n.lanes=4194304);g.isBackwards?(C.sibling=n.child,n.child=C):(a=g.last,a!==null?a.sibling=C:n.child=C,g.last=C)}return g.tail!==null?(n=g.tail,g.rendering=n,g.tail=n.sibling,g.renderingStartTime=ht(),n.sibling=null,a=nt.current,Qe(nt,c?a&1|2:a&1),n):(Ft(n),null);case 22:case 23:return Ec(),c=n.memoizedState!==null,i!==null&&i.memoizedState!==null!==c&&(n.flags|=8192),c&&(n.mode&1)!==0?(ui&1073741824)!==0&&(Ft(n),n.subtreeFlags&6&&(n.flags|=8192)):Ft(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function cS(i,n){switch(Bl(n),n.tag){case 1:return Gt(n.type)&&xo(),i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 3:return Dn(),Ze(Xt),Ze(Ot),Yl(),i=n.flags,(i&65536)!==0&&(i&128)===0?(n.flags=i&-65537|128,n):null;case 5:return Kl(n),null;case 13:if(Ze(nt),i=n.memoizedState,i!==null&&i.dehydrated!==null){if(n.alternate===null)throw Error(r(340));En()}return i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 19:return Ze(nt),null;case 4:return Dn(),null;case 10:return Hl(n.type._context),null;case 22:case 23:return Ec(),null;case 24:return null;default:return null}}var Uo=!1,Ht=!1,uS=typeof WeakSet=="function"?WeakSet:Set,be=null;function Mn(i,n){var a=i.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(c){lt(i,n,c)}else a.current=null}function pc(i,n,a){try{a()}catch(c){lt(i,n,c)}}var ap=!1;function hS(i,n){if(El=co,i=Od(),_l(i)){if("selectionStart"in i)var a={start:i.selectionStart,end:i.selectionEnd};else e:{a=(a=i.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var f=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{a.nodeType,g.nodeType}catch{a=null;break e}var C=0,M=-1,H=-1,ne=0,de=0,fe=i,he=null;t:for(;;){for(var Se;fe!==a||f!==0&&fe.nodeType!==3||(M=C+f),fe!==g||c!==0&&fe.nodeType!==3||(H=C+c),fe.nodeType===3&&(C+=fe.nodeValue.length),(Se=fe.firstChild)!==null;)he=fe,fe=Se;for(;;){if(fe===i)break t;if(he===a&&++ne===f&&(M=C),he===g&&++de===c&&(H=C),(Se=fe.nextSibling)!==null)break;fe=he,he=fe.parentNode}fe=Se}a=M===-1||H===-1?null:{start:M,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Nl={focusedElem:i,selectionRange:a},co=!1,be=n;be!==null;)if(n=be,i=n.child,(n.subtreeFlags&1028)!==0&&i!==null)i.return=n,be=i;else for(;be!==null;){n=be;try{var Ce=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(Ce!==null){var xe=Ce.memoizedProps,dt=Ce.memoizedState,ee=n.stateNode,V=ee.getSnapshotBeforeUpdate(n.elementType===n.type?xe:Li(n.type,xe),dt);ee.__reactInternalSnapshotBeforeUpdate=V}break;case 3:var ie=n.stateNode.containerInfo;ie.nodeType===1?ie.textContent="":ie.nodeType===9&&ie.documentElement&&ie.removeChild(ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(me){lt(n,n.return,me)}if(i=n.sibling,i!==null){i.return=n.return,be=i;break}be=n.return}return Ce=ap,ap=!1,Ce}function ks(i,n,a){var c=n.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var f=c=c.next;do{if((f.tag&i)===i){var g=f.destroy;f.destroy=void 0,g!==void 0&&pc(n,a,g)}f=f.next}while(f!==c)}}function qo(i,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var a=n=n.next;do{if((a.tag&i)===i){var c=a.create;a.destroy=c()}a=a.next}while(a!==n)}}function mc(i){var n=i.ref;if(n!==null){var a=i.stateNode;switch(i.tag){case 5:i=a;break;default:i=a}typeof n=="function"?n(i):n.current=i}}function lp(i){var n=i.alternate;n!==null&&(i.alternate=null,lp(n)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(n=i.stateNode,n!==null&&(delete n[Oi],delete n[ps],delete n[Ll],delete n[Vy],delete n[Yy])),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 cp(i){return i.tag===5||i.tag===3||i.tag===4}function up(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||cp(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 gc(i,n,a){var c=i.tag;if(c===5||c===6)i=i.stateNode,n?a.nodeType===8?a.parentNode.insertBefore(i,n):a.insertBefore(i,n):(a.nodeType===8?(n=a.parentNode,n.insertBefore(i,a)):(n=a,n.appendChild(i)),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=bo));else if(c!==4&&(i=i.child,i!==null))for(gc(i,n,a),i=i.sibling;i!==null;)gc(i,n,a),i=i.sibling}function vc(i,n,a){var c=i.tag;if(c===5||c===6)i=i.stateNode,n?a.insertBefore(i,n):a.appendChild(i);else if(c!==4&&(i=i.child,i!==null))for(vc(i,n,a),i=i.sibling;i!==null;)vc(i,n,a),i=i.sibling}var Tt=null,Mi=!1;function br(i,n,a){for(a=a.child;a!==null;)hp(i,n,a),a=a.sibling}function hp(i,n,a){if(Ai&&typeof Ai.onCommitFiberUnmount=="function")try{Ai.onCommitFiberUnmount(ro,a)}catch{}switch(a.tag){case 5:Ht||Mn(a,n);case 6:var c=Tt,f=Mi;Tt=null,br(i,n,a),Tt=c,Mi=f,Tt!==null&&(Mi?(i=Tt,a=a.stateNode,i.nodeType===8?i.parentNode.removeChild(a):i.removeChild(a)):Tt.removeChild(a.stateNode));break;case 18:Tt!==null&&(Mi?(i=Tt,a=a.stateNode,i.nodeType===8?Dl(i.parentNode,a):i.nodeType===1&&Dl(i,a),rs(i)):Dl(Tt,a.stateNode));break;case 4:c=Tt,f=Mi,Tt=a.stateNode.containerInfo,Mi=!0,br(i,n,a),Tt=c,Mi=f;break;case 0:case 11:case 14:case 15:if(!Ht&&(c=a.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){f=c=c.next;do{var g=f,C=g.destroy;g=g.tag,C!==void 0&&((g&2)!==0||(g&4)!==0)&&pc(a,n,C),f=f.next}while(f!==c)}br(i,n,a);break;case 1:if(!Ht&&(Mn(a,n),c=a.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=a.memoizedProps,c.state=a.memoizedState,c.componentWillUnmount()}catch(M){lt(a,n,M)}br(i,n,a);break;case 21:br(i,n,a);break;case 22:a.mode&1?(Ht=(c=Ht)||a.memoizedState!==null,br(i,n,a),Ht=c):br(i,n,a);break;default:br(i,n,a)}}function dp(i){var n=i.updateQueue;if(n!==null){i.updateQueue=null;var a=i.stateNode;a===null&&(a=i.stateNode=new uS),n.forEach(function(c){var f=SS.bind(null,i,c);a.has(c)||(a.add(c),c.then(f,f))})}}function Ti(i,n){var a=n.deletions;if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];try{var g=i,C=n,M=C;e:for(;M!==null;){switch(M.tag){case 5:Tt=M.stateNode,Mi=!1;break e;case 3:Tt=M.stateNode.containerInfo,Mi=!0;break e;case 4:Tt=M.stateNode.containerInfo,Mi=!0;break e}M=M.return}if(Tt===null)throw Error(r(160));hp(g,C,f),Tt=null,Mi=!1;var H=f.alternate;H!==null&&(H.return=null),f.return=null}catch(ne){lt(f,n,ne)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)fp(n,i),n=n.sibling}function fp(i,n){var a=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(Ti(n,i),Hi(i),c&4){try{ks(3,i,i.return),qo(3,i)}catch(xe){lt(i,i.return,xe)}try{ks(5,i,i.return)}catch(xe){lt(i,i.return,xe)}}break;case 1:Ti(n,i),Hi(i),c&512&&a!==null&&Mn(a,a.return);break;case 5:if(Ti(n,i),Hi(i),c&512&&a!==null&&Mn(a,a.return),i.flags&32){var f=i.stateNode;try{si(f,"")}catch(xe){lt(i,i.return,xe)}}if(c&4&&(f=i.stateNode,f!=null)){var g=i.memoizedProps,C=a!==null?a.memoizedProps:g,M=i.type,H=i.updateQueue;if(i.updateQueue=null,H!==null)try{M==="input"&&g.type==="radio"&&g.name!=null&&Ve(f,g),Mt(M,C);var ne=Mt(M,g);for(C=0;C<H.length;C+=2){var de=H[C],fe=H[C+1];de==="style"?le(f,fe):de==="dangerouslySetInnerHTML"?Gi(f,fe):de==="children"?si(f,fe):z(f,de,fe,ne)}switch(M){case"input":tt(f,g);break;case"textarea":ri(f,g);break;case"select":var he=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!g.multiple;var Se=g.value;Se!=null?At(f,!!g.multiple,Se,!1):he!==!!g.multiple&&(g.defaultValue!=null?At(f,!!g.multiple,g.defaultValue,!0):At(f,!!g.multiple,g.multiple?[]:"",!1))}f[ps]=g}catch(xe){lt(i,i.return,xe)}}break;case 6:if(Ti(n,i),Hi(i),c&4){if(i.stateNode===null)throw Error(r(162));f=i.stateNode,g=i.memoizedProps;try{f.nodeValue=g}catch(xe){lt(i,i.return,xe)}}break;case 3:if(Ti(n,i),Hi(i),c&4&&a!==null&&a.memoizedState.isDehydrated)try{rs(n.containerInfo)}catch(xe){lt(i,i.return,xe)}break;case 4:Ti(n,i),Hi(i);break;case 13:Ti(n,i),Hi(i),f=i.child,f.flags&8192&&(g=f.memoizedState!==null,f.stateNode.isHidden=g,!g||f.alternate!==null&&f.alternate.memoizedState!==null||(Sc=ht())),c&4&&dp(i);break;case 22:if(de=a!==null&&a.memoizedState!==null,i.mode&1?(Ht=(ne=Ht)||de,Ti(n,i),Ht=ne):Ti(n,i),Hi(i),c&8192){if(ne=i.memoizedState!==null,(i.stateNode.isHidden=ne)&&!de&&(i.mode&1)!==0)for(be=i,de=i.child;de!==null;){for(fe=be=de;be!==null;){switch(he=be,Se=he.child,he.tag){case 0:case 11:case 14:case 15:ks(4,he,he.return);break;case 1:Mn(he,he.return);var Ce=he.stateNode;if(typeof Ce.componentWillUnmount=="function"){c=he,a=he.return;try{n=c,Ce.props=n.memoizedProps,Ce.state=n.memoizedState,Ce.componentWillUnmount()}catch(xe){lt(c,a,xe)}}break;case 5:Mn(he,he.return);break;case 22:if(he.memoizedState!==null){gp(fe);continue}}Se!==null?(Se.return=he,be=Se):gp(fe)}de=de.sibling}e:for(de=null,fe=i;;){if(fe.tag===5){if(de===null){de=fe;try{f=fe.stateNode,ne?(g=f.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(M=fe.stateNode,H=fe.memoizedProps.style,C=H!=null&&H.hasOwnProperty("display")?H.display:null,M.style.display=qe("display",C))}catch(xe){lt(i,i.return,xe)}}}else if(fe.tag===6){if(de===null)try{fe.stateNode.nodeValue=ne?"":fe.memoizedProps}catch(xe){lt(i,i.return,xe)}}else if((fe.tag!==22&&fe.tag!==23||fe.memoizedState===null||fe===i)&&fe.child!==null){fe.child.return=fe,fe=fe.child;continue}if(fe===i)break e;for(;fe.sibling===null;){if(fe.return===null||fe.return===i)break e;de===fe&&(de=null),fe=fe.return}de===fe&&(de=null),fe.sibling.return=fe.return,fe=fe.sibling}}break;case 19:Ti(n,i),Hi(i),c&4&&dp(i);break;case 21:break;default:Ti(n,i),Hi(i)}}function Hi(i){var n=i.flags;if(n&2){try{e:{for(var a=i.return;a!==null;){if(cp(a)){var c=a;break e}a=a.return}throw Error(r(160))}switch(c.tag){case 5:var f=c.stateNode;c.flags&32&&(si(f,""),c.flags&=-33);var g=up(i);vc(i,g,f);break;case 3:case 4:var C=c.stateNode.containerInfo,M=up(i);gc(i,M,C);break;default:throw Error(r(161))}}catch(H){lt(i,i.return,H)}i.flags&=-3}n&4096&&(i.flags&=-4097)}function dS(i,n,a){be=i,pp(i)}function pp(i,n,a){for(var c=(i.mode&1)!==0;be!==null;){var f=be,g=f.child;if(f.tag===22&&c){var C=f.memoizedState!==null||Uo;if(!C){var M=f.alternate,H=M!==null&&M.memoizedState!==null||Ht;M=Uo;var ne=Ht;if(Uo=C,(Ht=H)&&!ne)for(be=f;be!==null;)C=be,H=C.child,C.tag===22&&C.memoizedState!==null?vp(f):H!==null?(H.return=C,be=H):vp(f);for(;g!==null;)be=g,pp(g),g=g.sibling;be=f,Uo=M,Ht=ne}mp(i)}else(f.subtreeFlags&8772)!==0&&g!==null?(g.return=f,be=g):mp(i)}}function mp(i){for(;be!==null;){var n=be;if((n.flags&8772)!==0){var a=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:Ht||qo(5,n);break;case 1:var c=n.stateNode;if(n.flags&4&&!Ht)if(a===null)c.componentDidMount();else{var f=n.elementType===n.type?a.memoizedProps:Li(n.type,a.memoizedProps);c.componentDidUpdate(f,a.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var g=n.updateQueue;g!==null&&gf(n,g,c);break;case 3:var C=n.updateQueue;if(C!==null){if(a=null,n.child!==null)switch(n.child.tag){case 5:a=n.child.stateNode;break;case 1:a=n.child.stateNode}gf(n,C,a)}break;case 5:var M=n.stateNode;if(a===null&&n.flags&4){a=M;var H=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":H.autoFocus&&a.focus();break;case"img":H.src&&(a.src=H.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var ne=n.alternate;if(ne!==null){var de=ne.memoizedState;if(de!==null){var fe=de.dehydrated;fe!==null&&rs(fe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Ht||n.flags&512&&mc(n)}catch(he){lt(n,n.return,he)}}if(n===i){be=null;break}if(a=n.sibling,a!==null){a.return=n.return,be=a;break}be=n.return}}function gp(i){for(;be!==null;){var n=be;if(n===i){be=null;break}var a=n.sibling;if(a!==null){a.return=n.return,be=a;break}be=n.return}}function vp(i){for(;be!==null;){var n=be;try{switch(n.tag){case 0:case 11:case 15:var a=n.return;try{qo(4,n)}catch(H){lt(n,a,H)}break;case 1:var c=n.stateNode;if(typeof c.componentDidMount=="function"){var f=n.return;try{c.componentDidMount()}catch(H){lt(n,f,H)}}var g=n.return;try{mc(n)}catch(H){lt(n,g,H)}break;case 5:var C=n.return;try{mc(n)}catch(H){lt(n,C,H)}}}catch(H){lt(n,n.return,H)}if(n===i){be=null;break}var M=n.sibling;if(M!==null){M.return=n.return,be=M;break}be=n.return}}var fS=Math.ceil,Ko=I.ReactCurrentDispatcher,_c=I.ReactCurrentOwner,bi=I.ReactCurrentBatchConfig,$e=0,Ct=null,pt=null,jt=0,ui=0,Tn=vr(0),_t=0,Es=null,Vr=0,Vo=0,yc=0,Ns=null,Jt=null,Sc=0,jn=1/0,nr=null,Yo=!1,wc=null,Cr=null,Xo=!1,xr=null,Go=0,Rs=0,bc=null,Qo=-1,Jo=0;function qt(){return($e&6)!==0?ht():Qo!==-1?Qo:Qo=ht()}function kr(i){return(i.mode&1)===0?1:($e&2)!==0&&jt!==0?jt&-jt:Gy.transition!==null?(Jo===0&&(Jo=cd()),Jo):(i=Xe,i!==0||(i=window.event,i=i===void 0?16:_d(i.type)),i)}function ji(i,n,a,c){if(50<Rs)throw Rs=0,bc=null,Error(r(185));Jn(i,a,c),(($e&2)===0||i!==Ct)&&(i===Ct&&(($e&2)===0&&(Vo|=a),_t===4&&Er(i,jt)),Zt(i,c),a===1&&$e===0&&(n.mode&1)===0&&(jn=ht()+500,Eo&&yr()))}function Zt(i,n){var a=i.callbackNode;G_(i,n);var c=oo(i,i===Ct?jt:0);if(c===0)a!==null&&od(a),i.callbackNode=null,i.callbackPriority=0;else if(n=c&-c,i.callbackPriority!==n){if(a!=null&&od(a),n===1)i.tag===0?Xy(yp.bind(null,i)):nf(yp.bind(null,i)),qy(function(){($e&6)===0&&yr()}),a=null;else{switch(ud(c)){case 1:a=tl;break;case 4:a=ad;break;case 16:a=io;break;case 536870912:a=ld;break;default:a=io}a=Np(a,_p.bind(null,i))}i.callbackPriority=n,i.callbackNode=a}}function _p(i,n){if(Qo=-1,Jo=0,($e&6)!==0)throw Error(r(327));var a=i.callbackNode;if(Bn()&&i.callbackNode!==a)return null;var c=oo(i,i===Ct?jt:0);if(c===0)return null;if((c&30)!==0||(c&i.expiredLanes)!==0||n)n=Zo(i,c);else{n=c;var f=$e;$e|=2;var g=wp();(Ct!==i||jt!==n)&&(nr=null,jn=ht()+500,Xr(i,n));do try{gS();break}catch(M){Sp(i,M)}while(!0);Fl(),Ko.current=g,$e=f,pt!==null?n=0:(Ct=null,jt=0,n=_t)}if(n!==0){if(n===2&&(f=il(i),f!==0&&(c=f,n=Cc(i,f))),n===1)throw a=Es,Xr(i,0),Er(i,c),Zt(i,ht()),a;if(n===6)Er(i,c);else{if(f=i.current.alternate,(c&30)===0&&!pS(f)&&(n=Zo(i,c),n===2&&(g=il(i),g!==0&&(c=g,n=Cc(i,g))),n===1))throw a=Es,Xr(i,0),Er(i,c),Zt(i,ht()),a;switch(i.finishedWork=f,i.finishedLanes=c,n){case 0:case 1:throw Error(r(345));case 2:Gr(i,Jt,nr);break;case 3:if(Er(i,c),(c&130023424)===c&&(n=Sc+500-ht(),10<n)){if(oo(i,0)!==0)break;if(f=i.suspendedLanes,(f&c)!==c){qt(),i.pingedLanes|=i.suspendedLanes&f;break}i.timeoutHandle=Pl(Gr.bind(null,i,Jt,nr),n);break}Gr(i,Jt,nr);break;case 4:if(Er(i,c),(c&4194240)===c)break;for(n=i.eventTimes,f=-1;0<c;){var C=31-Ri(c);g=1<<C,C=n[C],C>f&&(f=C),c&=~g}if(c=f,c=ht()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*fS(c/1960))-c,10<c){i.timeoutHandle=Pl(Gr.bind(null,i,Jt,nr),c);break}Gr(i,Jt,nr);break;case 5:Gr(i,Jt,nr);break;default:throw Error(r(329))}}}return Zt(i,ht()),i.callbackNode===a?_p.bind(null,i):null}function Cc(i,n){var a=Ns;return i.current.memoizedState.isDehydrated&&(Xr(i,n).flags|=256),i=Zo(i,n),i!==2&&(n=Jt,Jt=a,n!==null&&xc(n)),i}function xc(i){Jt===null?Jt=i:Jt.push.apply(Jt,i)}function pS(i){for(var n=i;;){if(n.flags&16384){var a=n.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var c=0;c<a.length;c++){var f=a[c],g=f.getSnapshot;f=f.value;try{if(!Pi(g(),f))return!1}catch{return!1}}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===i)break;for(;n.sibling===null;){if(n.return===null||n.return===i)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Er(i,n){for(n&=~yc,n&=~Vo,i.suspendedLanes|=n,i.pingedLanes&=~n,i=i.expirationTimes;0<n;){var a=31-Ri(n),c=1<<a;i[a]=-1,n&=~c}}function yp(i){if(($e&6)!==0)throw Error(r(327));Bn();var n=oo(i,0);if((n&1)===0)return Zt(i,ht()),null;var a=Zo(i,n);if(i.tag!==0&&a===2){var c=il(i);c!==0&&(n=c,a=Cc(i,c))}if(a===1)throw a=Es,Xr(i,0),Er(i,n),Zt(i,ht()),a;if(a===6)throw Error(r(345));return i.finishedWork=i.current.alternate,i.finishedLanes=n,Gr(i,Jt,nr),Zt(i,ht()),null}function kc(i,n){var a=$e;$e|=1;try{return i(n)}finally{$e=a,$e===0&&(jn=ht()+500,Eo&&yr())}}function Yr(i){xr!==null&&xr.tag===0&&($e&6)===0&&Bn();var n=$e;$e|=1;var a=bi.transition,c=Xe;try{if(bi.transition=null,Xe=1,i)return i()}finally{Xe=c,bi.transition=a,$e=n,($e&6)===0&&yr()}}function Ec(){ui=Tn.current,Ze(Tn)}function Xr(i,n){i.finishedWork=null,i.finishedLanes=0;var a=i.timeoutHandle;if(a!==-1&&(i.timeoutHandle=-1,Uy(a)),pt!==null)for(a=pt.return;a!==null;){var c=a;switch(Bl(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&xo();break;case 3:Dn(),Ze(Xt),Ze(Ot),Yl();break;case 5:Kl(c);break;case 4:Dn();break;case 13:Ze(nt);break;case 19:Ze(nt);break;case 10:Hl(c.type._context);break;case 22:case 23:Ec()}a=a.return}if(Ct=i,pt=i=Nr(i.current,null),jt=ui=n,_t=0,Es=null,yc=Vo=Vr=0,Jt=Ns=null,Ur!==null){for(n=0;n<Ur.length;n++)if(a=Ur[n],c=a.interleaved,c!==null){a.interleaved=null;var f=c.next,g=a.pending;if(g!==null){var C=g.next;g.next=f,c.next=C}a.pending=c}Ur=null}return i}function Sp(i,n){do{var a=pt;try{if(Fl(),Io.current=Fo,Ao){for(var c=st.memoizedState;c!==null;){var f=c.queue;f!==null&&(f.pending=null),c=c.next}Ao=!1}if(Kr=0,bt=vt=st=null,Ss=!1,ws=0,_c.current=null,a===null||a.return===null){_t=1,Es=n,pt=null;break}e:{var g=i,C=a.return,M=a,H=n;if(n=jt,M.flags|=32768,H!==null&&typeof H=="object"&&typeof H.then=="function"){var ne=H,de=M,fe=de.tag;if((de.mode&1)===0&&(fe===0||fe===11||fe===15)){var he=de.alternate;he?(de.updateQueue=he.updateQueue,de.memoizedState=he.memoizedState,de.lanes=he.lanes):(de.updateQueue=null,de.memoizedState=null)}var Se=qf(C);if(Se!==null){Se.flags&=-257,Kf(Se,C,M,g,n),Se.mode&1&&Uf(g,ne,n),n=Se,H=ne;var Ce=n.updateQueue;if(Ce===null){var xe=new Set;xe.add(H),n.updateQueue=xe}else Ce.add(H);break e}else{if((n&1)===0){Uf(g,ne,n),Nc();break e}H=Error(r(426))}}else if(it&&M.mode&1){var dt=qf(C);if(dt!==null){(dt.flags&65536)===0&&(dt.flags|=256),Kf(dt,C,M,g,n),Ol(Ln(H,M));break e}}g=H=Ln(H,M),_t!==4&&(_t=2),Ns===null?Ns=[g]:Ns.push(g),g=C;do{switch(g.tag){case 3:g.flags|=65536,n&=-n,g.lanes|=n;var ee=$f(g,H,n);mf(g,ee);break e;case 1:M=H;var V=g.type,ie=g.stateNode;if((g.flags&128)===0&&(typeof V.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(Cr===null||!Cr.has(ie)))){g.flags|=65536,n&=-n,g.lanes|=n;var me=Wf(g,M,n);mf(g,me);break e}}g=g.return}while(g!==null)}Cp(a)}catch(Ee){n=Ee,pt===a&&a!==null&&(pt=a=a.return);continue}break}while(!0)}function wp(){var i=Ko.current;return Ko.current=Fo,i===null?Fo:i}function Nc(){(_t===0||_t===3||_t===2)&&(_t=4),Ct===null||(Vr&268435455)===0&&(Vo&268435455)===0||Er(Ct,jt)}function Zo(i,n){var a=$e;$e|=2;var c=wp();(Ct!==i||jt!==n)&&(nr=null,Xr(i,n));do try{mS();break}catch(f){Sp(i,f)}while(!0);if(Fl(),$e=a,Ko.current=c,pt!==null)throw Error(r(261));return Ct=null,jt=0,_t}function mS(){for(;pt!==null;)bp(pt)}function gS(){for(;pt!==null&&!H_();)bp(pt)}function bp(i){var n=Ep(i.alternate,i,ui);i.memoizedProps=i.pendingProps,n===null?Cp(i):pt=n,_c.current=null}function Cp(i){var n=i;do{var a=n.alternate;if(i=n.return,(n.flags&32768)===0){if(a=lS(a,n,ui),a!==null){pt=a;return}}else{if(a=cS(a,n),a!==null){a.flags&=32767,pt=a;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{_t=6,pt=null;return}}if(n=n.sibling,n!==null){pt=n;return}pt=n=i}while(n!==null);_t===0&&(_t=5)}function Gr(i,n,a){var c=Xe,f=bi.transition;try{bi.transition=null,Xe=1,vS(i,n,a,c)}finally{bi.transition=f,Xe=c}return null}function vS(i,n,a,c){do Bn();while(xr!==null);if(($e&6)!==0)throw Error(r(327));a=i.finishedWork;var f=i.finishedLanes;if(a===null)return null;if(i.finishedWork=null,i.finishedLanes=0,a===i.current)throw Error(r(177));i.callbackNode=null,i.callbackPriority=0;var g=a.lanes|a.childLanes;if(Q_(i,g),i===Ct&&(pt=Ct=null,jt=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Xo||(Xo=!0,Np(io,function(){return Bn(),null})),g=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||g){g=bi.transition,bi.transition=null;var C=Xe;Xe=1;var M=$e;$e|=4,_c.current=null,hS(i,a),fp(a,i),Ay(Nl),co=!!El,Nl=El=null,i.current=a,dS(a),$_(),$e=M,Xe=C,bi.transition=g}else i.current=a;if(Xo&&(Xo=!1,xr=i,Go=f),g=i.pendingLanes,g===0&&(Cr=null),q_(a.stateNode),Zt(i,ht()),n!==null)for(c=i.onRecoverableError,a=0;a<n.length;a++)f=n[a],c(f.value,{componentStack:f.stack,digest:f.digest});if(Yo)throw Yo=!1,i=wc,wc=null,i;return(Go&1)!==0&&i.tag!==0&&Bn(),g=i.pendingLanes,(g&1)!==0?i===bc?Rs++:(Rs=0,bc=i):Rs=0,yr(),null}function Bn(){if(xr!==null){var i=ud(Go),n=bi.transition,a=Xe;try{if(bi.transition=null,Xe=16>i?16:i,xr===null)var c=!1;else{if(i=xr,xr=null,Go=0,($e&6)!==0)throw Error(r(331));var f=$e;for($e|=4,be=i.current;be!==null;){var g=be,C=g.child;if((be.flags&16)!==0){var M=g.deletions;if(M!==null){for(var H=0;H<M.length;H++){var ne=M[H];for(be=ne;be!==null;){var de=be;switch(de.tag){case 0:case 11:case 15:ks(8,de,g)}var fe=de.child;if(fe!==null)fe.return=de,be=fe;else for(;be!==null;){de=be;var he=de.sibling,Se=de.return;if(lp(de),de===ne){be=null;break}if(he!==null){he.return=Se,be=he;break}be=Se}}}var Ce=g.alternate;if(Ce!==null){var xe=Ce.child;if(xe!==null){Ce.child=null;do{var dt=xe.sibling;xe.sibling=null,xe=dt}while(xe!==null)}}be=g}}if((g.subtreeFlags&2064)!==0&&C!==null)C.return=g,be=C;else e:for(;be!==null;){if(g=be,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:ks(9,g,g.return)}var ee=g.sibling;if(ee!==null){ee.return=g.return,be=ee;break e}be=g.return}}var V=i.current;for(be=V;be!==null;){C=be;var ie=C.child;if((C.subtreeFlags&2064)!==0&&ie!==null)ie.return=C,be=ie;else e:for(C=V;be!==null;){if(M=be,(M.flags&2048)!==0)try{switch(M.tag){case 0:case 11:case 15:qo(9,M)}}catch(Ee){lt(M,M.return,Ee)}if(M===C){be=null;break e}var me=M.sibling;if(me!==null){me.return=M.return,be=me;break e}be=M.return}}if($e=f,yr(),Ai&&typeof Ai.onPostCommitFiberRoot=="function")try{Ai.onPostCommitFiberRoot(ro,i)}catch{}c=!0}return c}finally{Xe=a,bi.transition=n}}return!1}function xp(i,n,a){n=Ln(a,n),n=$f(i,n,1),i=wr(i,n,1),n=qt(),i!==null&&(Jn(i,1,n),Zt(i,n))}function lt(i,n,a){if(i.tag===3)xp(i,i,a);else for(;n!==null;){if(n.tag===3){xp(n,i,a);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Cr===null||!Cr.has(c))){i=Ln(a,i),i=Wf(n,i,1),n=wr(n,i,1),i=qt(),n!==null&&(Jn(n,1,i),Zt(n,i));break}}n=n.return}}function _S(i,n,a){var c=i.pingCache;c!==null&&c.delete(n),n=qt(),i.pingedLanes|=i.suspendedLanes&a,Ct===i&&(jt&a)===a&&(_t===4||_t===3&&(jt&130023424)===jt&&500>ht()-Sc?Xr(i,0):yc|=a),Zt(i,n)}function kp(i,n){n===0&&((i.mode&1)===0?n=1:(n=so,so<<=1,(so&130023424)===0&&(so=4194304)));var a=qt();i=tr(i,n),i!==null&&(Jn(i,n,a),Zt(i,a))}function yS(i){var n=i.memoizedState,a=0;n!==null&&(a=n.retryLane),kp(i,a)}function SS(i,n){var a=0;switch(i.tag){case 13:var c=i.stateNode,f=i.memoizedState;f!==null&&(a=f.retryLane);break;case 19:c=i.stateNode;break;default:throw Error(r(314))}c!==null&&c.delete(n),kp(i,a)}var Ep;Ep=function(i,n,a){if(i!==null)if(i.memoizedProps!==n.pendingProps||Xt.current)Qt=!0;else{if((i.lanes&a)===0&&(n.flags&128)===0)return Qt=!1,aS(i,n,a);Qt=(i.flags&131072)!==0}else Qt=!1,it&&(n.flags&1048576)!==0&&sf(n,Ro,n.index);switch(n.lanes=0,n.tag){case 2:var c=n.type;Wo(i,n),i=n.pendingProps;var f=Cn(n,Ot.current);Pn(n,a),f=Ql(null,n,c,i,f,a);var g=Jl();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Gt(c)?(g=!0,ko(n)):g=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Ul(n),f.updater=Ho,n.stateNode=f,f._reactInternals=n,nc(n,c,i,a),n=lc(null,n,c,!0,g,a)):(n.tag=0,it&&g&&jl(n),Ut(null,n,f,a),n=n.child),n;case 16:c=n.elementType;e:{switch(Wo(i,n),i=n.pendingProps,f=c._init,c=f(c._payload),n.type=c,f=n.tag=bS(c),i=Li(c,i),f){case 0:n=ac(null,n,c,i,a);break e;case 1:n=Jf(null,n,c,i,a);break e;case 11:n=Vf(null,n,c,i,a);break e;case 14:n=Yf(null,n,c,Li(c.type,i),a);break e}throw Error(r(306,c,""))}return n;case 0:return c=n.type,f=n.pendingProps,f=n.elementType===c?f:Li(c,f),ac(i,n,c,f,a);case 1:return c=n.type,f=n.pendingProps,f=n.elementType===c?f:Li(c,f),Jf(i,n,c,f,a);case 3:e:{if(Zf(n),i===null)throw Error(r(387));c=n.pendingProps,g=n.memoizedState,f=g.element,pf(i,n),jo(n,c,null,a);var C=n.memoizedState;if(c=C.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:C.cache,pendingSuspenseBoundaries:C.pendingSuspenseBoundaries,transitions:C.transitions},n.updateQueue.baseState=g,n.memoizedState=g,n.flags&256){f=Ln(Error(r(423)),n),n=ep(i,n,c,a,f);break e}else if(c!==f){f=Ln(Error(r(424)),n),n=ep(i,n,c,a,f);break e}else for(ci=gr(n.stateNode.containerInfo.firstChild),li=n,it=!0,Di=null,a=df(n,null,c,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(En(),c===f){n=rr(i,n,a);break e}Ut(i,n,c,a)}n=n.child}return n;case 5:return vf(n),i===null&&Al(n),c=n.type,f=n.pendingProps,g=i!==null?i.memoizedProps:null,C=f.children,Rl(c,f)?C=null:g!==null&&Rl(c,g)&&(n.flags|=32),Qf(i,n),Ut(i,n,C,a),n.child;case 6:return i===null&&Al(n),null;case 13:return tp(i,n,a);case 4:return ql(n,n.stateNode.containerInfo),c=n.pendingProps,i===null?n.child=Nn(n,null,c,a):Ut(i,n,c,a),n.child;case 11:return c=n.type,f=n.pendingProps,f=n.elementType===c?f:Li(c,f),Vf(i,n,c,f,a);case 7:return Ut(i,n,n.pendingProps,a),n.child;case 8:return Ut(i,n,n.pendingProps.children,a),n.child;case 12:return Ut(i,n,n.pendingProps.children,a),n.child;case 10:e:{if(c=n.type._context,f=n.pendingProps,g=n.memoizedProps,C=f.value,Qe(Lo,c._currentValue),c._currentValue=C,g!==null)if(Pi(g.value,C)){if(g.children===f.children&&!Xt.current){n=rr(i,n,a);break e}}else for(g=n.child,g!==null&&(g.return=n);g!==null;){var M=g.dependencies;if(M!==null){C=g.child;for(var H=M.firstContext;H!==null;){if(H.context===c){if(g.tag===1){H=ir(-1,a&-a),H.tag=2;var ne=g.updateQueue;if(ne!==null){ne=ne.shared;var de=ne.pending;de===null?H.next=H:(H.next=de.next,de.next=H),ne.pending=H}}g.lanes|=a,H=g.alternate,H!==null&&(H.lanes|=a),$l(g.return,a,n),M.lanes|=a;break}H=H.next}}else if(g.tag===10)C=g.type===n.type?null:g.child;else if(g.tag===18){if(C=g.return,C===null)throw Error(r(341));C.lanes|=a,M=C.alternate,M!==null&&(M.lanes|=a),$l(C,a,n),C=g.sibling}else C=g.child;if(C!==null)C.return=g;else for(C=g;C!==null;){if(C===n){C=null;break}if(g=C.sibling,g!==null){g.return=C.return,C=g;break}C=C.return}g=C}Ut(i,n,f.children,a),n=n.child}return n;case 9:return f=n.type,c=n.pendingProps.children,Pn(n,a),f=Si(f),c=c(f),n.flags|=1,Ut(i,n,c,a),n.child;case 14:return c=n.type,f=Li(c,n.pendingProps),f=Li(c.type,f),Yf(i,n,c,f,a);case 15:return Xf(i,n,n.type,n.pendingProps,a);case 17:return c=n.type,f=n.pendingProps,f=n.elementType===c?f:Li(c,f),Wo(i,n),n.tag=1,Gt(c)?(i=!0,ko(n)):i=!1,Pn(n,a),Ff(n,c,f),nc(n,c,f,a),lc(null,n,c,!0,i,a);case 19:return rp(i,n,a);case 22:return Gf(i,n,a)}throw Error(r(156,n.tag))};function Np(i,n){return sd(i,n)}function wS(i,n,a,c){this.tag=i,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ci(i,n,a,c){return new wS(i,n,a,c)}function Rc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function bS(i){if(typeof i=="function")return Rc(i)?1:0;if(i!=null){if(i=i.$$typeof,i===x)return 11;if(i===J)return 14}return 2}function Nr(i,n){var a=i.alternate;return a===null?(a=Ci(i.tag,n,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=n,a.type=i.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=i.flags&14680064,a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,n=i.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a}function ea(i,n,a,c,f,g){var C=2;if(c=i,typeof i=="function")Rc(i)&&(C=1);else if(typeof i=="string")C=5;else e:switch(i){case B:return Qr(a.children,f,g,n);case X:C=8,f|=8;break;case q:return i=Ci(12,a,n,f|2),i.elementType=q,i.lanes=g,i;case P:return i=Ci(13,a,n,f),i.elementType=P,i.lanes=g,i;case j:return i=Ci(19,a,n,f),i.elementType=j,i.lanes=g,i;case Q:return ta(a,f,g,n);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case re:C=10;break e;case te:C=9;break e;case x:C=11;break e;case J:C=14;break e;case F:C=16,c=null;break e}throw Error(r(130,i==null?i:typeof i,""))}return n=Ci(C,a,n,f),n.elementType=i,n.type=c,n.lanes=g,n}function Qr(i,n,a,c){return i=Ci(7,i,c,n),i.lanes=a,i}function ta(i,n,a,c){return i=Ci(22,i,c,n),i.elementType=Q,i.lanes=a,i.stateNode={isHidden:!1},i}function Pc(i,n,a){return i=Ci(6,i,null,n),i.lanes=a,i}function Dc(i,n,a){return n=Ci(4,i.children!==null?i.children:[],i.key,n),n.lanes=a,n.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},n}function CS(i,n,a,c,f){this.tag=n,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=rl(0),this.expirationTimes=rl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rl(0),this.identifierPrefix=c,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Lc(i,n,a,c,f,g,C,M,H){return i=new CS(i,n,a,M,H),n===1?(n=1,g===!0&&(n|=8)):n=0,g=Ci(3,null,null,n),i.current=g,g.stateNode=i,g.memoizedState={element:c,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ul(g),i}function xS(i,n,a){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:c==null?null:""+c,children:i,containerInfo:n,implementation:a}}function Rp(i){if(!i)return _r;i=i._reactInternals;e:{if(zr(i)!==i||i.tag!==1)throw Error(r(170));var n=i;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(Gt(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(r(171))}if(i.tag===1){var a=i.type;if(Gt(a))return tf(i,a,n)}return n}function Pp(i,n,a,c,f,g,C,M,H){return i=Lc(a,c,!0,i,f,g,C,M,H),i.context=Rp(null),a=i.current,c=qt(),f=kr(a),g=ir(c,f),g.callback=n??null,wr(a,g,f),i.current.lanes=f,Jn(i,f,c),Zt(i,c),i}function ia(i,n,a,c){var f=n.current,g=qt(),C=kr(f);return a=Rp(a),n.context===null?n.context=a:n.pendingContext=a,n=ir(g,C),n.payload={element:i},c=c===void 0?null:c,c!==null&&(n.callback=c),i=wr(f,n,C),i!==null&&(ji(i,f,C,g),To(i,f,C)),C}function ra(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 Dp(i,n){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<n?a:n}}function Mc(i,n){Dp(i,n),(i=i.alternate)&&Dp(i,n)}function kS(){return null}var Lp=typeof reportError=="function"?reportError:function(i){console.error(i)};function Tc(i){this._internalRoot=i}na.prototype.render=Tc.prototype.render=function(i){var n=this._internalRoot;if(n===null)throw Error(r(409));ia(i,n,null,null)},na.prototype.unmount=Tc.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var n=i.containerInfo;Yr(function(){ia(null,i,null,null)}),n[Qi]=null}};function na(i){this._internalRoot=i}na.prototype.unstable_scheduleHydration=function(i){if(i){var n=fd();i={blockedOn:null,target:i,priority:n};for(var a=0;a<fr.length&&n!==0&&n<fr[a].priority;a++);fr.splice(a,0,i),a===0&&gd(i)}};function jc(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function sa(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function Mp(){}function ES(i,n,a,c,f){if(f){if(typeof c=="function"){var g=c;c=function(){var ne=ra(C);g.call(ne)}}var C=Pp(n,c,i,0,null,!1,!1,"",Mp);return i._reactRootContainer=C,i[Qi]=C.current,ds(i.nodeType===8?i.parentNode:i),Yr(),C}for(;f=i.lastChild;)i.removeChild(f);if(typeof c=="function"){var M=c;c=function(){var ne=ra(H);M.call(ne)}}var H=Lc(i,0,!1,null,null,!1,!1,"",Mp);return i._reactRootContainer=H,i[Qi]=H.current,ds(i.nodeType===8?i.parentNode:i),Yr(function(){ia(n,H,a,c)}),H}function oa(i,n,a,c,f){var g=a._reactRootContainer;if(g){var C=g;if(typeof f=="function"){var M=f;f=function(){var H=ra(C);M.call(H)}}ia(n,C,i,f)}else C=ES(a,n,i,f,c);return ra(C)}hd=function(i){switch(i.tag){case 3:var n=i.stateNode;if(n.current.memoizedState.isDehydrated){var a=Qn(n.pendingLanes);a!==0&&(nl(n,a|1),Zt(n,ht()),($e&6)===0&&(jn=ht()+500,yr()))}break;case 13:Yr(function(){var c=tr(i,1);if(c!==null){var f=qt();ji(c,i,1,f)}}),Mc(i,1)}},sl=function(i){if(i.tag===13){var n=tr(i,134217728);if(n!==null){var a=qt();ji(n,i,134217728,a)}Mc(i,134217728)}},dd=function(i){if(i.tag===13){var n=kr(i),a=tr(i,n);if(a!==null){var c=qt();ji(a,i,n,c)}Mc(i,n)}},fd=function(){return Xe},pd=function(i,n){var a=Xe;try{return Xe=i,n()}finally{Xe=a}},Qa=function(i,n,a){switch(n){case"input":if(tt(i,a),n=a.name,a.type==="radio"&&n!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<a.length;n++){var c=a[n];if(c!==i&&c.form===i.form){var f=Co(c);if(!f)throw Error(r(90));Y(c),tt(c,f)}}}break;case"textarea":ri(i,a);break;case"select":n=a.value,n!=null&&At(i,!!a.multiple,n,!1)}},Jh=kc,Zh=Yr;var NS={usingClientEntryPoint:!1,Events:[ms,wn,Co,Gh,Qh,kc]},Ps={findFiberByHostInstance:Fr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},RS={bundleType:Ps.bundleType,version:Ps.version,rendererPackageName:Ps.rendererPackageName,rendererConfig:Ps.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:I.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=rd(i),i===null?null:i.stateNode},findFiberByHostInstance:Ps.findFiberByHostInstance||kS,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 aa=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!aa.isDisabled&&aa.supportsFiber)try{ro=aa.inject(RS),Ai=aa}catch{}}return ei.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=NS,ei.createPortal=function(i,n){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!jc(n))throw Error(r(200));return xS(i,n,null,a)},ei.createRoot=function(i,n){if(!jc(i))throw Error(r(299));var a=!1,c="",f=Lp;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onRecoverableError!==void 0&&(f=n.onRecoverableError)),n=Lc(i,1,!1,null,null,a,!1,c,f),i[Qi]=n.current,ds(i.nodeType===8?i.parentNode:i),new Tc(n)},ei.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var n=i._reactInternals;if(n===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=rd(n),i=i===null?null:i.stateNode,i},ei.flushSync=function(i){return Yr(i)},ei.hydrate=function(i,n,a){if(!sa(n))throw Error(r(200));return oa(null,i,n,!0,a)},ei.hydrateRoot=function(i,n,a){if(!jc(i))throw Error(r(405));var c=a!=null&&a.hydratedSources||null,f=!1,g="",C=Lp;if(a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onRecoverableError!==void 0&&(C=a.onRecoverableError)),n=Pp(n,null,i,1,a??null,f,!1,g,C),i[Qi]=n.current,ds(i),c)for(i=0;i<c.length;i++)a=c[i],f=a._getVersion,f=f(a._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[a,f]:n.mutableSourceEagerHydrationData.push(a,f);return new na(n)},ei.render=function(i,n,a){if(!sa(n))throw Error(r(200));return oa(null,i,n,!1,a)},ei.unmountComponentAtNode=function(i){if(!sa(i))throw Error(r(40));return i._reactRootContainer?(Yr(function(){oa(null,null,i,!1,function(){i._reactRootContainer=null,i[Qi]=null})}),!0):!1},ei.unstable_batchedUpdates=kc,ei.unstable_renderSubtreeIntoContainer=function(i,n,a,c){if(!sa(a))throw Error(r(200));if(i==null||i._reactInternals===void 0)throw Error(r(38));return oa(i,n,a,!1,c)},ei.version="18.3.1-next-f1338f8080-20240426",ei}var Fp;function AS(){if(Fp)return Ac.exports;Fp=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(),Ac.exports=IS(),Ac.exports}var Hp;function OS(){if(Hp)return la;Hp=1;var e=AS();return la.createRoot=e.createRoot,la.hydrateRoot=e.hydrateRoot,la}var zS=OS();const FS=xh(zS);function Pt(e,t,r={}){return fetch(e,{...r,headers:{...r.headers||{},Authorization:`Bearer ${t}`}})}const Ra=e=>`nc_seen_${e}`;async function Ae(e,t,r={}){const s=await Pt(e,t,{method:r.method||"GET",headers:{"content-type":"application/json"},body:r.body?JSON.stringify(r.body):void 0}),o=await s.json().catch(()=>({}));if(!s.ok){const l=new Error(o.error||`HTTP ${s.status}`);throw l.status=s.status,l.data=o,l}return o}const mi=e=>Array.isArray(e)&&e.length?`/api/route/${e.map(encodeURIComponent).join("/")}/_`:"/api",gi=(e,t)=>`${mi(e)}/fleet/${t}`,ln=(e,t)=>Ae(gi(t,"status"),e),Eh=(e,t,r)=>Ae(gi(r,"up"),e,{method:"POST",body:t}),Pa=(e,t,r)=>Ae(gi(r,"down"),e,{method:"POST",body:t}),Sa=(e,t,r)=>Ae(gi(r,"restart"),e,{method:"POST",body:{cell:t}}),Nh=(e,t)=>Ae(gi(t,"definitions"),e),HS=(e,t,r)=>Ae(gi(r,"define-engine"),e,{method:"POST",body:{def:t}}),$S=(e,t,r,s,o)=>Ae(gi(o,"edit-engine"),e,{method:"POST",body:{id:t,patch:r,envChanges:s}}),WS=(e,t,r)=>Ae(gi(r,"remove-engine"),e,{method:"POST",body:{id:t}}),US=(e,t,r)=>Ae(gi(r,"define-cell"),e,{method:"POST",body:{def:t}}),qS=(e,t,r,s)=>Ae(gi(s,"edit-cell"),e,{method:"POST",body:{id:t,patch:r}}),Qg=(e,t,r=!1,s)=>Ae(gi(s,"remove-cell"),e,{method:"POST",body:{id:t,stop:r}}),KS=(e,t,r)=>Ae(gi(r,"import-cell"),e,{method:"POST",body:t}),VS=(e,t,r)=>Ae(gi(r,"restore-cells"),e,{method:"POST",body:{cells:t}}),Rh=(e,t,r)=>Ae(`${mi(r)}/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),Jg=(e,t,r)=>Ae(`${mi(r)}/fs/dirs${t?`?path=${encodeURIComponent(t)}`:""}`,e),Zg=e=>Ae("/api/settings",e),ev=e=>Ae("/api/nodes",e),YS=e=>Ae("/api/topology",e),tv=(e,t)=>Ae(`${mi(t)}/sessions`,e),Ph=(e,t)=>Ae(`${mi(t)}/config`,e),$p=(e,t)=>Ae(`${mi(t)}/topology`,e),iv=(e,t)=>Ae("/api/settings/config",e,{method:"POST",body:t}),XS=e=>Ae("/api/settings/token/rotate",e,{method:"POST"}),GS=(e,t)=>Ae("/api/settings/nodes/pair",e,{method:"POST",body:t}),Wp=(e,t,r=[])=>Ae(`${mi(r)}/settings/peering/invite`,e,{method:"POST",body:t||{}}),QS=(e,t,r)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/label`,e,{method:"PATCH",body:{label:r}}),JS=(e,t)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"DELETE"}),Dh=(e,t,r)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/${r}`,e,{method:"POST"}),ZS=(e,t,r)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/share`,e,{method:"PATCH",body:{shared:r}}),Up=(e,t,r,s=[])=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{visibility:r,selected:s}}),ew=e=>Ae("/api/settings/service/regenerate",e,{method:"POST"}),tw=e=>Ae("/api/settings/update/check",e,{method:"POST"}),iw=e=>Ae("/api/settings/update/apply",e,{method:"POST"}),rw=(e,t=!0)=>Ae(`/api/asks${t?"?open=1":""}`,e),nw=(e,t,r)=>Ae(`/api/asks/${encodeURIComponent(t)}/answer`,e,{method:"POST",body:{text:r}}),ca=(e,t=[])=>Ae(`${mi(t)}/decks`,e),qp=(e,t,r=[])=>Ae(`${mi(r)}/decks`,e,{method:"POST",body:{name:t}}),ua=(e,t,r,s,o=[])=>Ae(`${mi(o)}/decks/${encodeURIComponent(t)}`,e,{method:"PUT",body:{layout:r,expectedRevision:s}}),sw=(e,t,r,s,o=[])=>Ae(`${mi(o)}/decks/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{name:r,expectedRevision:s}}),ow=(e,t,r,s=[])=>Ae(`${mi(s)}/decks/${encodeURIComponent(t)}`,e,{method:"DELETE",body:{expectedRevision:r}}),aw={power:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 3v8"}),h.jsx("path",{d:"M6.6 6.6a8 8 0 1 0 10.8 0"})]}),folder:h.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:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),h.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),h.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),h.jsx("path",{d:"M12 18v3"})]}),enter:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),h.jsx("polyline",{points:"9 9 5 13 9 17"})]}),send:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M22 2 15 22 11 13 2 9Z"}),h.jsx("path",{d:"M22 2 11 13"})]}),trash:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M4 7h16"}),h.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),h.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),h.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:h.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),h.jsx("polyline",{points:"21 3 21 8 16 8"})]}),upload:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 16V5"}),h.jsx("polyline",{points:"8 9 12 5 16 9"}),h.jsx("path",{d:"M5 20h14"})]}),chevronLeft:h.jsx("polyline",{points:"14 6 8 12 14 18"}),attach:h.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:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"})]}),camera:h.jsxs(h.Fragment,{children:[h.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"}),h.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),image:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),h.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),h.jsx("path",{d:"M21 15l-5-5L5 21"})]}),zoomIn:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"M21 21l-4.35-4.35"}),h.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"M21 21l-4.35-4.35"}),h.jsx("path",{d:"M8 11h6"})]}),gear:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.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:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),h.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})};function Ke({name:e,size:t=20}){return h.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:aw[e]||null})}const rv="nc_pins";function nv(){try{const e=JSON.parse(localStorage.getItem(rv));return Array.isArray(e)?e:[]}catch{return[]}}function sv(e,t){const r=e.includes(t)?e.filter(s=>s!==t):[...e,t];try{localStorage.setItem(rv,JSON.stringify(r))}catch{}return r}function lw(e,t,r){const s=e.indexOf(t);return[s===-1?1e9:s,-(r||0)]}function cw(e,t){return e[0]-t[0]||e[1]-t[1]}const Kp=/^[a-z0-9-]{1,32}$/;function or(e,t){const r=Array.isArray(e)?e:[];return r.length?`${r.map(encodeURIComponent).join("/")}:${t}`:String(t)}function uw(e,t,r){const s={};for(const o of Array.isArray(t)?t:[]){const l=Array.isArray(o==null?void 0:o.route)?o.route:typeof(o==null?void 0:o.name)=="string"?[o.name]:[];if(!l.length)continue;const u=l.join("/"),d=o.status==="up"||o.tunnel&&o.tunnel.status==="up",p=o.status==="passive"||o.tunnel&&o.tunnel.status==="passive";!d&&!p&&(s[u]=e&&e[u]||r)}return s}function Vp(e,t,r){return!e||!Array.isArray(e.cells)?[]:e.cells.map(s=>({...s,route:t,key:`${r}:${s.tmuxSession||s.cell}`}))}function Yp({nodes:e,topology:t,remote:r,down:s,fleet:o}={}){var p,m,y,w;const l=[],u=new Set,d=new Set;for(const _ of Array.isArray(e)?e:[]){if(!_||typeof _.name!="string"||!Kp.test(_.name)||_.direction==="inbound"&&_.shared!==!0)continue;const v=[_.name],b=_.name;u.add(b);const k=((p=_.tunnel)==null?void 0:p.status)||"unknown",E=k==="up",N={name:_.name,label:_.label||_.name,route:v,direct:!0,instanceId:_.nodeId||null,shared:_.shared===!0,tunnelStatus:k,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:_.health||null,direction:_.direction||"outbound",roles:_.roles||null,rolesKnown:_.rolesKnown===!0};if(_.nodeId&&d.add(_.nodeId),!_.nodeId&&_.paired===!1){l.push({...N,status:"needs-repair",downSince:s&&s[b]||null});continue}if(((m=_.health)==null?void 0:m.auth)==="failed"||k==="degraded"&&((y=_.health)==null?void 0:y.status)==="degraded"){l.push({...N,status:"needs-repair",downSince:s&&s[b]||null});continue}if(k==="passive"||((w=_.health)==null?void 0:w.status)==="passive"){l.push({...N,status:"passive",downSince:null});continue}if(!E){l.push({...N,status:"down",downSince:s&&s[b]||null});continue}const A=r&&(r[b]||r[_.name])||null;if(!A||A.error||!Array.isArray(A.sessions)){l.push({...N,status:"unreachable"});continue}const z=A.sessions.filter(B=>B&&typeof B.name=="string"&&B.name).map(B=>({...B,node:b,route:v,key:`${b}:${B.name}`})),I=o&&(o[b]||o[_.name]),U=Vp(I,v,b),O=new Set(U.map(B=>B.tmuxSession).filter(Boolean));l.push({...N,status:"up",sessions:z,cells:U,unmanaged:z.filter(B=>!O.has(B.name)),fleetAvailable:!!(I&&I.available),capabilities:I&&I.capabilities||[],engines:I&&I.engines||[],fleetProvider:I&&I.provider||null})}for(const _ of Array.isArray(t)?t:[]){if(!_||!Array.isArray(_.route)||_.route.length<1||_.route.some(I=>!Kp.test(I)))continue;const v=_.route.join("/");if(u.has(v)||_.instanceId&&d.has(_.instanceId))continue;_.instanceId&&d.add(_.instanceId);const b={name:_.name,label:_.label||_.route.join(" › "),route:[..._.route],direct:!1,instanceId:_.instanceId||null,shared:!0,tunnelStatus:null,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:_.health||null,lastSeen:_.lastSeen||null};if(_.stale){l.push({...b,status:"offline",downSince:s&&s[v]||_.lastSeen||null});continue}const k=r&&r[v]||null;if(!k||k.error||!Array.isArray(k.sessions)){l.push({...b,status:"unreachable",downSince:s&&s[v]||null});continue}const E=k.sessions.filter(I=>I&&typeof I.name=="string"&&I.name).map(I=>({...I,node:v,route:_.route,key:`${v}:${I.name}`})),N=o&&o[v],A=Vp(N,_.route,v),z=new Set(A.map(I=>I.tmuxSession).filter(Boolean));l.push({...b,status:"up",sessions:E,cells:A,unmanaged:E.filter(I=>!z.has(I.name)),fleetAvailable:!!(N&&N.available),capabilities:N&&N.capabilities||[],engines:N&&N.engines||[],fleetProvider:N&&N.provider||null,lastSeen:_.lastSeen||null})}return l.sort((_,v)=>_.label.localeCompare(v.label))}const hw=["all","pinned","active","off"],ov="nc_sidebar_views_v1";function av(e){return hw.includes(e)?e:"all"}function dw(e,t=[],r="all"){const s=av(r);return s==="pinned"?t.includes(e.key):s==="active"?!!e.live:s==="off"?!e.live:!0}function fw(e,t,r=[]){const s=r.indexOf(e.key),o=r.indexOf(t.key),l=s===-1?Number.MAX_SAFE_INTEGER:s,u=o===-1?Number.MAX_SAFE_INTEGER:o;return l-u||+!!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 lv(e=globalThis.localStorage){try{const t=JSON.parse(e.getItem(ov));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Da(e,t){var r,s;return{open:((r=e==null?void 0:e[t])==null?void 0:r.open)!==!1,filter:av((s=e==null?void 0:e[t])==null?void 0:s.filter)}}function cv(e,t=globalThis.localStorage){try{t.setItem(ov,JSON.stringify(e))}catch{}return e}function Xp(e,t=""){const r=String(t||"").trim().toLocaleLowerCase();return r?[e.label,e.key,e.searchText].filter(Boolean).join(" ").toLocaleLowerCase().includes(r):!0}function La(e=[],t=[],r="all"){return[...e].filter(s=>dw(s,t,r)).sort((s,o)=>fw(s,o,t))}const Lh=["it","en","es"];function pw(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return Lh.includes(t)?t:"en"}catch{return"en"}}const wa=pw(),uv="nc_lang",Pu="nc-lang";function hv(){return typeof localStorage<"u"?localStorage:null}const ha={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",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","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-degraded":"degradata: unit attiva, tmux morto","power-on":"accendi","power-off":"spegni","state-on":"accesa","state-off":"spenta",engine:"Engine",model:"Modello","model-default":"Modello predefinito del provider","model-remembered":"Ultimo modello usato con questo engine","boot-persist":"avvia al boot","remove-boot":"togli anche dal boot","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…",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","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","fleet-editor-unavailable":"Editor disponibile solo con il provider fleet builtin.","fleet-managed":"gestito da NexusCrew","fleet-custom":"comando personalizzato","fleet-managed-help":"Client, provider e avvio sono gestiti internamente; i segreti non vengono mostrati.","fleet-model-default":"modello predefinito (opzionale)","fleet-model-required":"modello (obbligatorio)","fleet-standard-permissions":"permessi standard","fleet-unsafe-permissions":"non sicuro · ignora approvazioni/sandbox","fleet-unsafe-warning":"Modalità non sicura esplicita: il worker può agire senza le normali approvazioni o protezioni sandbox.","fleet-provider-display":"nome visualizzato del provider","fleet-custom-provider-default":"Provider personalizzato","fleet-api-key-env":"NOME_VARIABILE_API_KEY","fleet-provider-id":"id-provider","fleet-custom-secret-help":"NexusCrew salva solo il nome della variabile d’ambiente, mai il suo valore.","fleet-model-override":"modello alternativo","fleet-ready":"pronto","fleet-not-ready":"non configurato","fleet-engines":"Engine","fleet-cells":"Celle / sessioni cloud","fleet-backup":"backup / ripristino","fleet-backup-help":"Esporta o ripristina selettivamente 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-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.',"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","node-ssh-port-label":"Porta SSH","node-ssh-port-help":"Di solito 22; usa la porta pubblica del server SSH.","node-app-port-label":"Porta NexusCrew sul nodo","node-app-port-help":"È la porta mostrata da `nexuscrew status` sul nodo remoto.","node-name-ph":"nome (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"porta remota (opz.)","node-remove-confirm":'Rimuovere il nodo "{name}"?',"node-test":"test","tunnel-start":"avvia tunnel","tunnel-stop":"ferma tunnel","tunnel-restart":"riavvia tunnel","share-node":"Condividi questo nodo","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-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","node-display-label":"Nome (etichetta)","node-slug-hint":"routing su slug: {slug}","device-name-label":"Nome dispositivo","device-name-hint":"come ti vedono i peer (modificabile)","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-external-hint":"Provider esterno: engine/modello si configurano nel fleet esterno.","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",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","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-degraded":"degraded: unit active, tmux dead","power-on":"power on","power-off":"power off","state-on":"running","state-off":"stopped",engine:"Engine",model:"Model","model-default":"Provider default model","model-remembered":"Last model used with this engine","boot-persist":"start at boot","remove-boot":"also remove from boot","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…",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","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","fleet-editor-unavailable":"The editor is available only with the builtin fleet provider.","fleet-managed":"managed by NexusCrew","fleet-custom":"custom command","fleet-managed-help":"Client, provider and launch are managed internally; secrets are never displayed.","fleet-model-default":"default model (optional)","fleet-model-required":"model (required)","fleet-standard-permissions":"standard permissions","fleet-unsafe-permissions":"unsafe · bypass approvals/sandbox","fleet-unsafe-warning":"Explicit unsafe mode: the worker can act without normal approval or sandbox gates.","fleet-provider-display":"provider display name","fleet-custom-provider-default":"Custom provider","fleet-api-key-env":"API_KEY_ENV_NAME","fleet-provider-id":"provider-id","fleet-custom-secret-help":"NexusCrew stores only the environment-variable name, never its value.","fleet-model-override":"model override","fleet-ready":"ready","fleet-not-ready":"not configured","fleet-engines":"Engines","fleet-cells":"Cells / cloud sessions","fleet-backup":"backup / restore","fleet-backup-help":"Selectively export or restore 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-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.',"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","node-ssh-port-label":"SSH port","node-ssh-port-help":"Usually 22; use the SSH server public port.","node-app-port-label":"NexusCrew port on node","node-app-port-help":"The port reported by `nexuscrew status` on the remote node.","node-name-ph":"name (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"remote port (opt.)","node-remove-confirm":'Remove node "{name}"?',"node-test":"test","tunnel-start":"start tunnel","tunnel-stop":"stop tunnel","tunnel-restart":"restart tunnel","share-node":"Share this node","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-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","node-display-label":"Name (label)","node-slug-hint":"routing on slug: {slug}","device-name-label":"Device name","device-name-hint":"how peers see you (editable)","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-external-hint":"External provider: engine/model are configured in the external fleet.","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",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","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-degraded":"degradada: unit activa, tmux muerto","power-on":"encender","power-off":"apagar","state-on":"encendida","state-off":"apagada",engine:"Motor",model:"Modelo","model-default":"Modelo predeterminado del proveedor","model-remembered":"Último modelo usado con este motor","boot-persist":"iniciar en el boot","remove-boot":"quitar también del boot","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…",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í","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","fleet-editor-unavailable":"El editor solo está disponible con el proveedor builtin.","fleet-managed":"gestionado por NexusCrew","fleet-custom":"comando personalizado","fleet-managed-help":"Cliente, proveedor e inicio se gestionan internamente; los secretos nunca se muestran.","fleet-model-default":"modelo predeterminado (opcional)","fleet-model-required":"modelo (obligatorio)","fleet-standard-permissions":"permisos estándar","fleet-unsafe-permissions":"inseguro · omitir aprobaciones/sandbox","fleet-unsafe-warning":"Modo inseguro explícito: el worker puede actuar sin las aprobaciones normales ni las protecciones del sandbox.","fleet-provider-display":"nombre visible del proveedor","fleet-custom-provider-default":"Proveedor personalizado","fleet-api-key-env":"NOMBRE_VARIABLE_API_KEY","fleet-provider-id":"id-proveedor","fleet-custom-secret-help":"NexusCrew guarda solo el nombre de la variable de entorno, nunca su valor.","fleet-model-override":"modelo alternativo","fleet-ready":"listo","fleet-not-ready":"no configurado","fleet-engines":"Motores","fleet-cells":"Celdas / sesiones cloud","fleet-backup":"copia / restauración","fleet-backup-help":"Exporta o restaura selectivamente 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-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.',"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","node-ssh-port-label":"Puerto SSH","node-ssh-port-help":"Normalmente 22; usa el puerto público del servidor SSH.","node-app-port-label":"Puerto NexusCrew del nodo","node-app-port-help":"El puerto indicado por `nexuscrew status` en el nodo remoto.","node-name-ph":"nombre (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"puerto remoto (opc.)","node-remove-confirm":"¿Eliminar el nodo «{name}»?","node-test":"test","tunnel-start":"iniciar túnel","tunnel-stop":"detener túnel","tunnel-restart":"reiniciar túnel","share-node":"Compartir este nodo","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-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","node-display-label":"Nombre (etiqueta)","node-slug-hint":"enrutado por slug: {slug}","device-name-label":"Nombre del dispositivo","device-name-hint":"cómo te ven los pares (editable)","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-external-hint":"Proveedor externo: motor/modelo se configuran en el fleet externo.","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 Du(){const e=hv(),t=e?e.getItem(uv):null;return Lh.includes(t)?t:wa}function mw(e){const t=hv();if(t)try{t.setItem(uv,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(Pu))}function S(e){const t=Du(),r=ha[t]||ha[wa];return Object.prototype.hasOwnProperty.call(r,e)?r[e]:Object.prototype.hasOwnProperty.call(ha[wa],e)?ha[wa][e]:e}function gw(e){return typeof window>"u"?()=>{}:(window.addEventListener(Pu,e),()=>window.removeEventListener(Pu,e))}const dv=Lh;function vi(){return[L.useSyncExternalStore(gw,Du,Du),mw]}function Ma({cell:e,token:t,route:r=[],onConfirm:s,onClose:o}){var J,F;vi();const l=!!(e&&e.active),u=Array.isArray(r)?r.join("/"):"",[d,p]=L.useState([]),[m,y]=L.useState(!1);L.useEffect(()=>{let Q=!0;return(async()=>{if(t)try{const $=await ln(t,u?u.split("/"):[]);if(!Q)return;if(y($.provider==="builtin"&&($.capabilities||[]).includes("edit")),$.provider==="builtin"&&($.capabilities||[]).includes("definitions")){const K=await Nh(t,u?u.split("/"):[]);if(!Q)return;const G=new Map(($.engines||[]).map(R=>[R.id,R]));p((K.engines||[]).map(R=>{var Z,D,T,se,oe,ae,ge;return{id:R.id,label:R.label||R.id,client:((Z=R.managed)==null?void 0:Z.client)||"",models:[...new Set([...((D=G.get(R.id))==null?void 0:D.models)||[],...((T=R.managedInfo)==null?void 0:T.models)||[]])].filter(Boolean),defaultModel:((se=R.managed)==null?void 0:se.model)||((oe=R.managedInfo)==null?void 0:oe.defaultModel)||"",policyDefault:((ae=R.managed)==null?void 0:ae.permissionPolicy)||((ge=R.managed)!=null&&ge.client&&R.managed.client==="claude"?"unsafe":"standard")}}))}}catch{}})(),()=>{Q=!1}},[t,u]);const w=(e==null?void 0:e.engine)||((J=d[0])==null?void 0:J.id)||"",_=Q=>(e==null?void 0:e.models)&&e.models[Q]||"",v=Q=>{const $=(e==null?void 0:e.permissionPolicies)&&e.permissionPolicies[Q];if($==="standard"||$==="unsafe")return $;const K=d.find(G=>G.id===Q);return K?K.policyDefault:"standard"},[b,k]=L.useState(w),[E,N]=L.useState((e==null?void 0:e.model)||""),A=(e==null?void 0:e.permissionPolicy)==="standard"||(e==null?void 0:e.permissionPolicy)==="unsafe"?e.permissionPolicy:((F=e==null?void 0:e.permissionPolicies)==null?void 0:F[e==null?void 0:e.engine])||"",[z,I]=L.useState(A),[U,O]=L.useState((e==null?void 0:e.boot)??!0),[B,X]=L.useState(!1),[q,re]=L.useState(null);L.useEffect(()=>{d.length&&(k(Q=>Q||w),N(Q=>Q||_((e==null?void 0:e.engine)||w)||""),I(Q=>Q==="standard"||Q==="unsafe"?Q:v((e==null?void 0:e.engine)||w)))},[d.length]);const te=L.useMemo(()=>d.find(Q=>Q.id===b)||null,[d,b]),x=!!(te&&["claude","codex","codex-vl"].includes(te.client));function P(Q){k(Q);const $=d.find(K=>K.id===Q);N(_(Q)||($==null?void 0:$.defaultModel)||""),I(v(Q))}async function j(Q){Q.preventDefault(),X(!0),re(null);try{if(l)await s({action:"down",boot:U});else{const $=z==="standard"||z==="unsafe"?z:(te==null?void 0:te.policyDefault)||"standard";await s({action:"up",...m?{engine:b,model:E||"",...x?{permissionPolicy:$}:(te==null?void 0:te.client)==="pi"?{permissionPolicy:"standard"}:{}}:{},boot:U})}o()}catch($){re(String($&&$.message||$)),X(!1)}}return h.jsx("div",{className:"nc-sheet-overlay nc-launch-overlay",onClick:o,children:h.jsxs("form",{className:"nc-sheet nc-power-sheet nc-launch-sheet",onClick:Q=>Q.stopPropagation(),onSubmit:j,children:[h.jsxs("div",{className:"nc-sheet-head",children:[h.jsx("b",{children:e==null?void 0:e.cell}),h.jsx("span",{className:"nc-sheet-state",children:S(l?"state-on":"state-off")})]}),l?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-power-config",children:[h.jsx("span",{children:S("engine")}),h.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&h.jsxs("small",{children:[S("model"),": ",e.model]}),h.jsx("small",{children:S("power-on-hint")})]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:U,onChange:Q=>O(Q.target.checked)}),S("remove-boot")]})]}):h.jsxs(h.Fragment,{children:[m&&d.length>0?h.jsxs("div",{className:"nc-launch-fields",children:[h.jsxs("label",{className:"nc-field",children:[S("engine"),h.jsx("select",{value:b,onChange:Q=>P(Q.target.value),children:d.map(Q=>h.jsx("option",{value:Q.id,children:Q.label},Q.id))})]}),h.jsxs("label",{className:"nc-field",children:[S("model"),h.jsx("input",{value:E,list:"nc-launch-models",placeholder:S("model-default"),onChange:Q=>N(Q.target.value)}),h.jsx("datalist",{id:"nc-launch-models",children:((te==null?void 0:te.models)||[]).map(Q=>h.jsx("option",{value:Q},Q))})]}),x?h.jsxs("label",{className:"nc-field",children:[S("permissions"),h.jsxs("select",{value:z,onChange:Q=>I(Q.target.value),children:[h.jsx("option",{value:"standard",children:S("fleet-standard-permissions")}),h.jsx("option",{value:"unsafe",children:S("fleet-unsafe-permissions")})]})]}):h.jsx("small",{className:"nc-note",children:S("fleet-standard-permissions")}),x&&z==="unsafe"&&h.jsx("small",{className:"nc-err",children:S("fleet-unsafe-warning")}),h.jsx("small",{className:"nc-note",children:S("launch-engine-help")})]}):h.jsxs("div",{className:"nc-power-config",children:[h.jsx("span",{children:S("engine")}),h.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&h.jsxs("small",{children:[S("model"),": ",e.model]}),h.jsx("small",{children:S("launch-external-hint")})]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:U,onChange:Q=>O(Q.target.checked)}),S("boot-persist")]})]}),q&&h.jsx("div",{className:"nc-err",children:q}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:o,disabled:B,children:S("cancel")}),h.jsx("button",{type:"submit",className:"nc-btn primary",disabled:B,children:S(l?"power-off":"save-and-start")})]})]})})}const vw=4e3;function Mh(e,t=!0){const[r,s]=L.useState([]),o=L.useRef({});return L.useEffect(()=>{if(!t||!e){s([]);return}let l=!0;async function u(){var k;let p=[],m=[];if(await Promise.all([ev(e).then(E=>{p=Array.isArray(E.nodes)?E.nodes:[]}).catch(()=>{}),YS(e).then(E=>{m=Array.isArray(E.nodes)?E.nodes:[]}).catch(()=>{})]),!l)return;const y={},w={},_=new Set(p.map(E=>E.name)),v=[];for(const E of p)((k=E.tunnel)==null?void 0:k.status)==="up"&&(E.nodeId||E.paired!==!1)&&(E.direction!=="inbound"||E.shared===!0)&&v.push([E.name]);for(const E of m)!E.stale&&Array.isArray(E.route)&&!(E.route.length===1&&_.has(E.route[0]))&&v.push(E.route);if(await Promise.all(v.map(async E=>{const N=E.join("/");try{y[N]=await tv(e,E)}catch{y[N]={error:"unreachable"}}try{w[N]=await ln(e,E)}catch{w[N]={available:!1}}})),!l)return;const b=Yp({nodes:p,topology:m,remote:y,fleet:w,down:o.current});o.current=uw(o.current,b,Math.floor(Date.now()/1e3)),s(Yp({nodes:p,topology:m,remote:y,fleet:w,down:o.current}))}u();const d=setInterval(u,vw);return()=>{l=!1,clearInterval(d)}},[e,t]),r}function Ta(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 Fc(e){return e.status==="passive"?S("node-passive"):e.status==="down"?e.downSince?S("tunnel-down-since").replace("{t}",Ta(e.downSince)):S("tunnel-down"):e.status==="unreachable"?S("node-unreachable"):e.status==="offline"?e.lastSeen?S("node-offline-seen").replace("{t}",Ta(e.lastSeen)):S("node-offline"):e.status==="needs-repair"?S("node-needs-repair"):""}function _w(e){return e?e.status==="healthy"?"on":"warn":null}function Gp(e){return e&&(e.detail||e.status)||""}function yw({onPick:e,token:t,onSettings:r}){const[s,o]=vi(),l=Mh(t),[u,d]=L.useState(null),[p,m]=L.useState(null),[y,w]=L.useState(""),[_,v]=L.useState(""),[b,k]=L.useState({bind:"127.0.0.1",port:""}),[E,N]=L.useState([]),[A,z]=L.useState(null),[I,U]=L.useState(null),[O,B]=L.useState(nv),[X,q]=L.useState(lv);async function re(){try{const Y=await(await Pt("/api/sessions",t)).json();Y.error?(m(Y.error),d([])):(m(null),d(Y.sessions||[]))}catch(W){m(String(W)),d([])}try{const W=await ln(t);N(W.available?W.cells||[]:[])}catch{N([])}}L.useEffect(()=>{re(),Pt("/api/config",t).then(Y=>Y.json()).then(Y=>{v(Y.version||""),k({bind:Y.bind||"127.0.0.1",port:Y.port||""})}).catch(()=>{});const W=setInterval(re,4e3);return()=>clearInterval(W)},[]);async function te(){if(!b.port)return;const W=`http://${b.bind}:${b.port}/#token=${t}`;try{await navigator.clipboard.writeText(W)}catch{}}async function x(W){if(!A)return;const{cell:Y}=A,ue=Array.isArray(A.route)?A.route:[];W.action==="up"?await Eh(t,{cell:Y,boot:!!W.boot,...W.engine?{engine:W.engine}:{},...W.model!==void 0?{model:W.model}:{},...W.permissionPolicy?{permissionPolicy:W.permissionPolicy}:{}},ue):await Pa(t,{cell:Y,boot:!!W.boot},ue),re()}async function P(W,Y=[]){try{await Rh(t,W,Y)}catch{return}re()}async function j(W){if(!(!(W!=null&&W.direct)||I)){U(W.name);try{await Dh(t,W.name,W.tunnelStatus==="up"?"down":"up")}catch{}U(null)}}const J=W=>B(Y=>sv(Y,W)),F=W=>Da(X,W),Q=(W,Y)=>q(ue=>{const Ne={...ue,[W]:{...Da(ue,W),...Y}};return cv(Ne)}),$=L.useMemo(()=>(u||[]).map(W=>{const Y=Number(localStorage.getItem(Ra(W.name))||0),ue=!!(W.outbox&&W.outbox.count>0&&W.outbox.latest>Y);return{...W,fresh:ue}}),[u]),K=L.useMemo(()=>new Map($.map(W=>[W.name,W])),[$]),G=L.useMemo(()=>new Set(E.map(W=>W.tmuxSession)),[E]),R=L.useMemo(()=>$.filter(W=>!G.has(W.name)),[$,G]),Z=L.useMemo(()=>[...E.map(W=>{const Y=K.get(W.tmuxSession)||{};return{type:"cell",value:W,key:or([],W.tmuxSession),label:W.cell,live:!!W.tmux,fresh:!!Y.fresh,activity:Y.activity||0,searchText:`${W.engine||""} ${W.key||""} ${Y.preview||""}`}}),...R.map(W=>({type:"session",value:W,key:or([],W.name),label:W.name,live:!0,fresh:!!W.fresh,activity:W.activity||0,searchText:`${W.preview||""} ${W.cmd||""}`}))],[E,R,K]),D=F("local"),T=L.useMemo(()=>La(Z,O,D.filter).filter(W=>Xp(W,y)),[Z,O,D.filter,y]),se=l.reduce((W,Y)=>W+(Y.cells||[]).length+(Y.unmanaged||[]).length,0),oe=Z.length+se,ae=u?u.length:0,ge=(u||[]).filter(W=>W.attached).length,we=b.port?`${b.bind}:${b.port}`:b.bind;function _e(W,Y=null){var Ve,tt;const ue=Array.isArray(Y==null?void 0:Y.route)?Y.route:[],Ne=ue.join("/");if(W.type==="cell"){const De=W.value,Ue=ue.length?((Y==null?void 0:Y.sessions)||[]).find(je=>je.name===De.tmuxSession):K.get(De.tmuxSession),Ye=(Ue==null?void 0:Ue.preview)||De.preview||"",At=[`${De.engine}${De.key?`·${De.key}`:""}`,Ye,De.active?"":S("cell-off")].filter(Boolean).join(" · "),Lt=ue.length===0||((Y==null?void 0:Y.capabilities)||[]).includes(De.active?"down":"up");return h.jsxs("div",{className:"nc-mcard","data-roster-key":W.key,children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>De.tmux&&e(ue.length?{session:De.tmuxSession,node:Ne}:De.tmuxSession),title:De.degraded?S("cell-degraded"):De.tmux?S("cell-on"):S("cell-off"),children:[h.jsx("span",{className:`dot ${De.degraded?"warn":De.tmux?"on":""}`}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:De.cell}),h.jsx("small",{children:At})]})]}),W.activity?h.jsx("span",{className:"nc-rel",children:Ta(W.activity)}):null,W.fresh&&((Ve=Ue==null?void 0:Ue.outbox)==null?void 0:Ve.count)>0&&h.jsx("span",{className:"nc-badge",title:S("new-files-outbox"),children:Ue.outbox.count}),h.jsx("button",{className:`nc-act pin${O.includes(W.key)?" on":""}`,"aria-label":`${S("pin")} ${De.cell}`,title:S("pin"),onClick:()=>J(W.key),children:O.includes(W.key)?"★":"☆"}),Lt&&h.jsx("button",{className:`nc-act power${De.tmux?" on":""}${De.degraded?" warn":""}`,onClick:()=>z(ue.length?{...De,route:ue,availableEngines:(Y==null?void 0:Y.engines)||[]}:De),title:De.active?S("power-off"):S("power-on"),"aria-label":`${De.active?S("power-off"):S("power-on")} ${De.cell}`,children:h.jsx(Ke,{name:"power",size:16})})]},W.key)}const Te=W.value;return h.jsxs("div",{className:"nc-mcard","data-roster-key":W.key,children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>e(ue.length?{session:Te.name,node:Ne}:Te.name),children:[h.jsx("span",{className:Te.attached?"dot on":"dot"}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:Te.name}),h.jsx("small",{children:Te.preview?Te.preview:Te.cmd?Te.cmd:S("windows").replace("{n}",String(Te.windows||0))})]})]}),W.activity?h.jsx("span",{className:"nc-rel",children:Ta(W.activity)}):null,W.fresh&&((tt=Te.outbox)==null?void 0:tt.count)>0&&h.jsx("span",{className:"nc-badge",title:S("new-files-outbox"),children:Te.outbox.count}),h.jsx("button",{className:`nc-act pin${O.includes(W.key)?" on":""}`,"aria-label":`${S("pin")} ${Te.name}`,title:S("pin"),onClick:()=>J(W.key),children:O.includes(W.key)?"★":"☆"}),h.jsx("button",{className:"nc-menu",title:S("terminate"),"aria-label":`${S("terminate")} ${Te.name}`,onClick:()=>{window.confirm(S("terminate-confirm").replace("{name}",Te.name))&&P(Te.name,ue)},children:"⋯"})]},W.key)}return h.jsxs("div",{className:"nc-home",children:[h.jsxs("header",{className:"nc-home-head",children:[h.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",h.jsx("span",{className:"nc-cursor"})]}),h.jsxs("div",{className:"nc-home-sub",children:[S("fleet-tmux")," · ",ae," ",S("sessions"),ge>0&&` · ${ge} attached`]}),h.jsxs("span",{className:"nc-head-actions",children:[h.jsx("button",{className:"nc-refresh",onClick:()=>r("nodes",!1),title:S("settings"),children:h.jsx(Ke,{name:"gear",size:18})}),h.jsx("button",{className:"nc-refresh",onClick:re,title:S("refresh"),children:h.jsx(Ke,{name:"refresh",size:18})})]})]}),h.jsxs("main",{className:"nc-home-scroll",children:[oe>8&&h.jsx("input",{className:"nc-filter",type:"search",placeholder:S("filter-placeholder"),"aria-label":S("filter-placeholder"),value:y,onChange:W=>w(W.target.value)}),p&&h.jsx("div",{className:"nc-err",children:p}),h.jsxs("section",{className:"nc-group","data-position":"local",children:[h.jsx(Qp,{label:S("position-local"),count:Z.length,state:D,dotClass:"on",onToggle:()=>Q("local",{open:!D.open}),onFilter:W=>Q("local",{filter:W})}),D.open&&T.map(W=>_e(W)),D.open&&u===null&&h.jsx("div",{className:"nc-empty",children:S("loading-fleet")}),D.open&&u!==null&&T.length===0&&!p&&h.jsx("div",{className:"nc-empty",children:y?S("no-match").replace("{q}",y):S("no-sessions-short")})]}),l.map(W=>{const ue=_w(W.health)||(W.status==="up"?"on":W.status==="passive"?"":"warn"),Ne=W.health?Gp(W.health):W.status==="up"?"":Fc(W),Te=W.route||[W.name],Ve=Te.join("/"),tt=F(Ve),De=new Map((W.sessions||[]).map(je=>[je.name,je])),Ue=je=>{const ri=Number(localStorage.getItem(Ra(or(Te,je.name)))||0);return!!(je.outbox&&je.outbox.count>0&&je.outbox.latest>ri)},Ye=[...(W.cells||[]).map(je=>{const ri=De.get(je.tmuxSession)||{};return{type:"cell",value:je,key:or(Te,je.tmuxSession||je.cell),label:je.cell,live:!!je.tmux,fresh:Ue({...ri,name:je.tmuxSession||je.cell}),activity:ri.activity||je.activity||0,searchText:`${je.engine||""} ${je.key||""} ${ri.preview||je.preview||""}`}}),...(W.unmanaged||[]).map(je=>({type:"session",value:je,key:or(Te,je.name),label:je.name,live:!0,fresh:Ue(je),activity:je.activity||0,searchText:`${je.preview||""} ${je.cmd||""}`}))],At=La(Ye,O,tt.filter).filter(je=>Xp(je,y)),Lt=W.direct&&W.health&&W.health.managed!==!1?h.jsx("button",{type:"button",className:`nc-act power${W.tunnelStatus==="up"?" on":""}`,disabled:I===W.name,title:W.tunnelStatus==="up"?S("power-off"):S("power-on"),"aria-label":`${W.tunnelStatus==="up"?S("power-off"):S("power-on")} ${W.label||W.name}`,onClick:()=>j(W),children:h.jsx(Ke,{name:"power",size:15})}):null;return h.jsxs("section",{className:"nc-group","data-position":Ve,children:[h.jsx(Qp,{label:W.label||W.name,count:Ye.length,state:tt,dotClass:ue,dotTitle:Ne,detail:W.status==="up"?"":W.health&&Gp(W.health)||Fc(W),onToggle:()=>Q(Ve,{open:!tt.open}),onFilter:je=>Q(Ve,{filter:je}),action:Lt}),W.status==="up"&&tt.open&&At.map(je=>_e(je,W)),W.status==="up"&&tt.open&&At.length===0&&h.jsx("div",{className:"nc-empty",children:y?S("no-match").replace("{q}",y):S("no-sessions-short")})]},`nodo-${Ve}`)}),h.jsxs("footer",{className:"nc-home-foot",onClick:te,title:S("copy-url"),children:[h.jsxs("span",{className:"nc-home-meta",children:[_&&h.jsxs("span",{className:"nc-home-version",children:["v",_]}),h.jsxs("span",{className:"nc-home-endpoint",children:[we," · ",S("ssh-only")]})]}),h.jsx("span",{className:"nc-lang",onClick:W=>W.stopPropagation(),children:dv.map((W,Y)=>h.jsxs("span",{children:[Y>0&&" · ",h.jsx("button",{className:`nc-lang-btn${s===W?" on":""}`,onClick:()=>o(W),title:W,children:W.toUpperCase()})]},W))})]})]}),h.jsx("button",{className:"nc-fab",onClick:()=>r("fleet",!0),title:S("fleet-new-cell"),"aria-label":S("fleet-new-cell"),children:"+"}),A&&h.jsx(Ma,{cell:A,token:t,route:Array.isArray(A.route)?A.route:[],onConfirm:x,onClose:()=>z(null)})]})}function Qp({label:e,count:t,state:r,dotClass:s="",dotTitle:o="",detail:l="",onToggle:u,onFilter:d,action:p=null}){return h.jsxs("div",{className:"nc-mobile-position-head",children:[h.jsxs("button",{type:"button",className:"nc-mobile-position-toggle",onClick:u,"aria-expanded":r.open,"aria-label":`${e} · ${S("node-sessions").replace("{n}",String(t))}`,children:[h.jsx("span",{className:"nc-mobile-chevron","aria-hidden":"true",children:r.open?"⌄":"›"}),h.jsx("span",{className:`dot ${s}`,title:o}),h.jsxs("span",{className:"nc-mobile-position-copy",children:[h.jsx("b",{children:e}),h.jsx("small",{children:l||S("node-sessions").replace("{n}",String(t))})]})]}),h.jsxs("select",{className:"nc-mobile-position-filter",value:r.filter,"aria-label":`${e} · ${S("filter-placeholder")}`,title:S(`view-${r.filter}`),onChange:m=>d(m.target.value),children:[h.jsx("option",{value:"all",children:S("view-all")}),h.jsx("option",{value:"pinned",children:S("view-pinned")}),h.jsx("option",{value:"active",children:S("view-active")}),h.jsx("option",{value:"off",children:S("view-off")})]}),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 fv=Object.defineProperty,Sw=Object.getOwnPropertyDescriptor,ww=(e,t)=>{for(var r in t)fv(e,r,{get:t[r],enumerable:!0})},ut=(e,t,r,s)=>{for(var o=s>1?void 0:s?Sw(t,r):t,l=e.length-1,u;l>=0;l--)(u=e[l])&&(o=(s?u(t,r,o):u(o))||o);return s&&o&&fv(t,r,o),o},ye=(e,t)=>(r,s)=>t(r,s,e),Jp="Terminal input",Lu={get:()=>Jp,set:e=>Jp=e},Zp="Too much output to announce, navigate to rows manually to read",Mu={get:()=>Zp,set:e=>Zp=e};function bw(e){return e.replace(/\r?\n/g,"\r")}function Cw(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function xw(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function kw(e,t,r,s){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");pv(o,t,r,s)}}function pv(e,t,r,s){e=bw(e),e=Cw(e,r.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function mv(e,t,r){let s=r.getBoundingClientRect(),o=e.clientX-s.left-10,l=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${o}px`,t.style.top=`${l}px`,t.style.zIndex="1000",t.focus()}function em(e,t,r,s,o){mv(e,t,r),o&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Tr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Ua(e,t=0,r=e.length){let s="";for(let o=t;o<r;++o){let l=e[o];l>65535?(l-=65536,s+=String.fromCharCode((l>>10)+55296)+String.fromCharCode(l%1024+56320)):s+=String.fromCharCode(l)}return s}var Ew=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let s=0,o=0;if(this._interim){let l=e.charCodeAt(o++);56320<=l&&l<=57343?t[s++]=(this._interim-55296)*1024+l-56320+65536:(t[s++]=this._interim,t[s++]=l),this._interim=0}for(let l=o;l<r;++l){let u=e.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=r)return this._interim=u,s;let d=e.charCodeAt(l);56320<=d&&d<=57343?t[s++]=(u-55296)*1024+d-56320+65536:(t[s++]=u,t[s++]=d);continue}u!==65279&&(t[s++]=u)}return s}},Nw=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let s=0,o,l,u,d,p=0,m=0;if(this.interim[0]){let _=!1,v=this.interim[0];v&=(v&224)===192?31:(v&240)===224?15:7;let b=0,k;for(;(k=this.interim[++b]&63)&&b<4;)v<<=6,v|=k;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,N=E-b;for(;m<N;){if(m>=r)return 0;if(k=e[m++],(k&192)!==128){m--,_=!0;break}else this.interim[b++]=k,v<<=6,v|=k&63}_||(E===2?v<128?m--:t[s++]=v:E===3?v<2048||v>=55296&&v<=57343||v===65279||(t[s++]=v):v<65536||v>1114111||(t[s++]=v)),this.interim.fill(0)}let y=r-4,w=m;for(;w<r;){for(;w<y&&!((o=e[w])&128)&&!((l=e[w+1])&128)&&!((u=e[w+2])&128)&&!((d=e[w+3])&128);)t[s++]=o,t[s++]=l,t[s++]=u,t[s++]=d,w+=4;if(o=e[w++],o<128)t[s++]=o;else if((o&224)===192){if(w>=r)return this.interim[0]=o,s;if(l=e[w++],(l&192)!==128){w--;continue}if(p=(o&31)<<6|l&63,p<128){w--;continue}t[s++]=p}else if((o&240)===224){if(w>=r)return this.interim[0]=o,s;if(l=e[w++],(l&192)!==128){w--;continue}if(w>=r)return this.interim[0]=o,this.interim[1]=l,s;if(u=e[w++],(u&192)!==128){w--;continue}if(p=(o&15)<<12|(l&63)<<6|u&63,p<2048||p>=55296&&p<=57343||p===65279)continue;t[s++]=p}else if((o&248)===240){if(w>=r)return this.interim[0]=o,s;if(l=e[w++],(l&192)!==128){w--;continue}if(w>=r)return this.interim[0]=o,this.interim[1]=l,s;if(u=e[w++],(u&192)!==128){w--;continue}if(w>=r)return this.interim[0]=o,this.interim[1]=l,this.interim[2]=u,s;if(d=e[w++],(d&192)!==128){w--;continue}if(p=(o&7)<<18|(l&63)<<12|(u&63)<<6|d&63,p<65536||p>1114111)continue;t[s++]=p}}return s}},gv="",jr=" ",Xs=class vv{constructor(){this.fg=0,this.bg=0,this.extended=new ja}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 vv;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}},ja=class _v{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new _v(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ni=class yv extends Xs{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ja,this.combinedData=""}static fromCharData(t){let r=new yv;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Tr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(s-55296)*1024+o-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},tm="di$target",Tu="di$dependencies",Hc=new Map;function Rw(e){return e[Tu]||[]}function Dt(e){if(Hc.has(e))return Hc.get(e);let t=function(r,s,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Pw(t,r,o)};return t._id=e,Hc.set(e,t),t}function Pw(e,t,r){t[tm]===t?t[Tu].push({id:e,index:r}):(t[Tu]=[{id:e,index:r}],t[tm]=t)}var Vt=Dt("BufferService"),Sv=Dt("CoreMouseService"),cn=Dt("CoreService"),Dw=Dt("CharsetService"),Th=Dt("InstantiationService"),wv=Dt("LogService"),Yt=Dt("OptionsService"),bv=Dt("OscLinkService"),Lw=Dt("UnicodeService"),Gs=Dt("DecorationService"),ju=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var y;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let s=[],o=this._optionsService.rawOptions.linkHandler,l=new Ni,u=r.getTrimmedLength(),d=-1,p=-1,m=!1;for(let w=0;w<u;w++)if(!(p===-1&&!r.hasContent(w))){if(r.loadCell(w,l),l.hasExtendedAttrs()&&l.extended.urlId)if(p===-1){p=w,d=l.extended.urlId;continue}else m=l.extended.urlId!==d;else p!==-1&&(m=!0);if(m||p!==-1&&w===u-1){let _=(y=this._oscLinkService.getLinkData(d))==null?void 0:y.uri;if(_){let v={start:{x:p+1,y:e},end:{x:w+(!m&&w===u-1?1:0),y:e}},b=!1;if(!(o!=null&&o.allowNonHttpProtocols))try{let k=new URL(_);["http:","https:"].includes(k.protocol)||(b=!0)}catch{b=!0}b||s.push({text:_,range:v,activate:(k,E)=>o?o.activate(k,E,v):Mw(k,E),hover:(k,E)=>{var N;return(N=o==null?void 0:o.hover)==null?void 0:N.call(o,k,E,v)},leave:(k,E)=>{var N;return(N=o==null?void 0:o.leave)==null?void 0:N.call(o,k,E,v)}})}m=!1,l.hasExtendedAttrs()&&l.extended.urlId?(p=w,d=l.extended.urlId):(p=-1,d=-1)}}t(s)}};ju=ut([ye(0,Vt),ye(1,Yt),ye(2,bv)],ju);function Mw(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
52
|
-
|
|
53
|
-
WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var qa=Dt("CharSizeService"),lr=Dt("CoreBrowserService"),jh=Dt("MouseService"),cr=Dt("RenderService"),Tw=Dt("SelectionService"),Cv=Dt("CharacterJoinerService"),qn=Dt("ThemeService"),xv=Dt("LinkProviderService"),jw=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?im.isErrorNoTelemetry(e)?new im(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)}},Bw=new jw;function ba(e){Iw(e)||Bw.onUnexpectedError(e)}var Bu="Canceled";function Iw(e){return e instanceof Aw?!0:e instanceof Error&&e.name===Bu&&e.message===Bu}var Aw=class extends Error{constructor(){super(Bu),this.name=this.message}};function Ow(e){return new Error(`Illegal argument: ${e}`)}var im=class Iu extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Iu)return t;let r=new Iu;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Au=class kv extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,kv.prototype)}};function hi(e,t=0){return e[e.length-(1+t)]}var zw;(e=>{function t(l){return l<0}e.isLessThan=t;function r(l){return l<=0}e.isLessThanOrEqual=r;function s(l){return l>0}e.isGreaterThan=s;function o(l){return l===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(zw||(zw={}));function Fw(e,t){let r=this,s=!1,o;return function(){return s||(s=!0,t||(o=e.apply(r,arguments))),o}}var Ev;(e=>{function t(I){return I&&typeof I=="object"&&typeof I[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function s(){return r}e.empty=s;function*o(I){yield I}e.single=o;function l(I){return t(I)?I:o(I)}e.wrap=l;function u(I){return I||r}e.from=u;function*d(I){for(let U=I.length-1;U>=0;U--)yield I[U]}e.reverse=d;function p(I){return!I||I[Symbol.iterator]().next().done===!0}e.isEmpty=p;function m(I){return I[Symbol.iterator]().next().value}e.first=m;function y(I,U){let O=0;for(let B of I)if(U(B,O++))return!0;return!1}e.some=y;function w(I,U){for(let O of I)if(U(O))return O}e.find=w;function*_(I,U){for(let O of I)U(O)&&(yield O)}e.filter=_;function*v(I,U){let O=0;for(let B of I)yield U(B,O++)}e.map=v;function*b(I,U){let O=0;for(let B of I)yield*U(B,O++)}e.flatMap=b;function*k(...I){for(let U of I)yield*U}e.concat=k;function E(I,U,O){let B=O;for(let X of I)B=U(B,X);return B}e.reduce=E;function*N(I,U,O=I.length){for(U<0&&(U+=I.length),O<0?O+=I.length:O>I.length&&(O=I.length);U<O;U++)yield I[U]}e.slice=N;function A(I,U=Number.POSITIVE_INFINITY){let O=[];if(U===0)return[O,I];let B=I[Symbol.iterator]();for(let X=0;X<U;X++){let q=B.next();if(q.done)return[O,e.empty()];O.push(q.value)}return[O,{[Symbol.iterator](){return B}}]}e.consume=A;async function z(I){let U=[];for await(let O of I)U.push(O);return Promise.resolve(U)}e.asyncToArray=z})(Ev||(Ev={}));function on(e){if(Ev.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(s){t.push(s)}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 Hw(...e){return rt(()=>on(e))}function rt(e){return{dispose:Fw(()=>{e()})}}var Nv=class Rv{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{on(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?Rv.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)}};Nv.DISABLE_DISPOSED_WARNING=!1;var Br=Nv,ze=class{constructor(){this._store=new Br,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)}};ze.None=Object.freeze({dispose(){}});var Wn=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}},ar=typeof window=="object"?window:globalThis,Ou=class zu{constructor(t){this.element=t,this.next=zu.Undefined,this.prev=zu.Undefined}};Ou.Undefined=new Ou(void 0);var ot=Ou,rm=class{constructor(){this._first=ot.Undefined,this._last=ot.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ot.Undefined}clear(){let e=this._first;for(;e!==ot.Undefined;){let t=e.next;e.prev=ot.Undefined,e.next=ot.Undefined,e=t}this._first=ot.Undefined,this._last=ot.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ot(e);if(this._first===ot.Undefined)this._first=r,this._last=r;else if(t){let o=this._last;this._last=r,r.prev=o,o.next=r}else{let o=this._first;this._first=r,r.next=o,o.prev=r}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(r))}}shift(){if(this._first!==ot.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ot.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ot.Undefined&&e.next!==ot.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ot.Undefined&&e.next===ot.Undefined?(this._first=ot.Undefined,this._last=ot.Undefined):e.next===ot.Undefined?(this._last=this._last.prev,this._last.next=ot.Undefined):e.prev===ot.Undefined&&(this._first=this._first.next,this._first.prev=ot.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ot.Undefined;)yield e.element,e=e.next}},$w=globalThis.performance&&typeof globalThis.performance.now=="function",Ww=class Pv{static create(t){return new Pv(t)}constructor(t){this._now=$w&&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}},It;(e=>{e.None=()=>ze.None;function t(x,P){return w(x,()=>{},0,void 0,!0,void 0,P)}e.defer=t;function r(x){return(P,j=null,J)=>{let F=!1,Q;return Q=x($=>{if(!F)return Q?Q.dispose():F=!0,P.call(j,$)},null,J),F&&Q.dispose(),Q}}e.once=r;function s(x,P,j){return m((J,F=null,Q)=>x($=>J.call(F,P($)),null,Q),j)}e.map=s;function o(x,P,j){return m((J,F=null,Q)=>x($=>{P($),J.call(F,$)},null,Q),j)}e.forEach=o;function l(x,P,j){return m((J,F=null,Q)=>x($=>P($)&&J.call(F,$),null,Q),j)}e.filter=l;function u(x){return x}e.signal=u;function d(...x){return(P,j=null,J)=>{let F=Hw(...x.map(Q=>Q($=>P.call(j,$))));return y(F,J)}}e.any=d;function p(x,P,j,J){let F=j;return s(x,Q=>(F=P(F,Q),F),J)}e.reduce=p;function m(x,P){let j,J={onWillAddFirstListener(){j=x(F.fire,F)},onDidRemoveLastListener(){j==null||j.dispose()}},F=new ve(J);return P==null||P.add(F),F.event}function y(x,P){return P instanceof Array?P.push(x):P&&P.add(x),x}function w(x,P,j=100,J=!1,F=!1,Q,$){let K,G,R,Z=0,D,T={leakWarningThreshold:Q,onWillAddFirstListener(){K=x(oe=>{Z++,G=P(G,oe),J&&!R&&(se.fire(G),G=void 0),D=()=>{let ae=G;G=void 0,R=void 0,(!J||Z>1)&&se.fire(ae),Z=0},typeof j=="number"?(clearTimeout(R),R=setTimeout(D,j)):R===void 0&&(R=0,queueMicrotask(D))})},onWillRemoveListener(){F&&Z>0&&(D==null||D())},onDidRemoveLastListener(){D=void 0,K.dispose()}},se=new ve(T);return $==null||$.add(se),se.event}e.debounce=w;function _(x,P=0,j){return e.debounce(x,(J,F)=>J?(J.push(F),J):[F],P,void 0,!0,void 0,j)}e.accumulate=_;function v(x,P=(J,F)=>J===F,j){let J=!0,F;return l(x,Q=>{let $=J||!P(Q,F);return J=!1,F=Q,$},j)}e.latch=v;function b(x,P,j){return[e.filter(x,P,j),e.filter(x,J=>!P(J),j)]}e.split=b;function k(x,P=!1,j=[],J){let F=j.slice(),Q=x(G=>{F?F.push(G):K.fire(G)});J&&J.add(Q);let $=()=>{F==null||F.forEach(G=>K.fire(G)),F=null},K=new ve({onWillAddFirstListener(){Q||(Q=x(G=>K.fire(G)),J&&J.add(Q))},onDidAddFirstListener(){F&&(P?setTimeout($):$())},onDidRemoveLastListener(){Q&&Q.dispose(),Q=null}});return J&&J.add(K),K.event}e.buffer=k;function E(x,P){return(j,J,F)=>{let Q=P(new A);return x(function($){let K=Q.evaluate($);K!==N&&j.call(J,K)},void 0,F)}}e.chain=E;let N=Symbol("HaltChainable");class A{constructor(){this.steps=[]}map(P){return this.steps.push(P),this}forEach(P){return this.steps.push(j=>(P(j),j)),this}filter(P){return this.steps.push(j=>P(j)?j:N),this}reduce(P,j){let J=j;return this.steps.push(F=>(J=P(J,F),J)),this}latch(P=(j,J)=>j===J){let j=!0,J;return this.steps.push(F=>{let Q=j||!P(F,J);return j=!1,J=F,Q?F:N}),this}evaluate(P){for(let j of this.steps)if(P=j(P),P===N)break;return P}}function z(x,P,j=J=>J){let J=(...K)=>$.fire(j(...K)),F=()=>x.on(P,J),Q=()=>x.removeListener(P,J),$=new ve({onWillAddFirstListener:F,onDidRemoveLastListener:Q});return $.event}e.fromNodeEventEmitter=z;function I(x,P,j=J=>J){let J=(...K)=>$.fire(j(...K)),F=()=>x.addEventListener(P,J),Q=()=>x.removeEventListener(P,J),$=new ve({onWillAddFirstListener:F,onDidRemoveLastListener:Q});return $.event}e.fromDOMEventEmitter=I;function U(x){return new Promise(P=>r(x)(P))}e.toPromise=U;function O(x){let P=new ve;return x.then(j=>{P.fire(j)},()=>{P.fire(void 0)}).finally(()=>{P.dispose()}),P.event}e.fromPromise=O;function B(x,P){return x(j=>P.fire(j))}e.forward=B;function X(x,P,j){return P(j),x(J=>P(J))}e.runAndSubscribe=X;class q{constructor(P,j){this._observable=P,this._counter=0,this._hasChanged=!1;let J={onWillAddFirstListener:()=>{P.addObserver(this)},onDidRemoveLastListener:()=>{P.removeObserver(this)}};this.emitter=new ve(J),j&&j.add(this.emitter)}beginUpdate(P){this._counter++}handlePossibleChange(P){}handleChange(P,j){this._hasChanged=!0}endUpdate(P){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function re(x,P){return new q(x,P).emitter.event}e.fromObservable=re;function te(x){return(P,j,J)=>{let F=0,Q=!1,$={beginUpdate(){F++},endUpdate(){F--,F===0&&(x.reportChanges(),Q&&(Q=!1,P.call(j)))},handlePossibleChange(){},handleChange(){Q=!0}};x.addObserver($),x.reportChanges();let K={dispose(){x.removeObserver($)}};return J instanceof Br?J.add(K):Array.isArray(J)&&J.push(K),K}}e.fromObservableLight=te})(It||(It={}));var Fu=class Hu{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Hu._idPool++}`,Hu.all.add(this)}start(t){this._stopWatch=new Ww,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}}};Fu.all=new Set,Fu._idPool=0;var Uw=Fu,qw=-1,Dv=class Lv{constructor(t,r,s=(Lv._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let s=this.threshold;if(s<=0||r<s)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=s*.5;let[l,u]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${u}):`;console.warn(d),console.warn(l);let p=new Yw(d,l);this._errorHandler(p)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[s,o]of this._stacks)(!t||r<o)&&(t=[s,o],r=o);return t}};Dv._idPool=1;var Kw=Dv,Vw=class Mv{constructor(t){this.value=t}static create(){let t=new Error;return new Mv(t.stack??"")}print(){console.warn(this.value.split(`
|
|
58
|
-
`).slice(2).join(`
|
|
59
|
-
`))}},Yw=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Xw=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Gw=0,$c=class{constructor(e){this.value=e,this.id=Gw++}},Qw=2,Jw,ve=class{constructor(e){var t,r,s,o;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new Kw((e==null?void 0:e.onListenerError)??ba,((r=this._options)==null?void 0:r.leakWarningThreshold)??qw):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new Uw(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var e,t,r,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,t,r)=>{var u,d,p,m,y;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let w=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(w);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],v=new Xw(`${w}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((u=this._options)==null?void 0:u.onListenerError)||ba)(v),ze.None}if(this._disposed)return ze.None;t&&(e=e.bind(t));let s=new $c(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=Vw.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof $c?(this._deliveryQueue??(this._deliveryQueue=new Zw),this._listeners=[this._listeners,s]):this._listeners.push(s):((p=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||p.call(d,this),this._listeners=s,(y=(m=this._options)==null?void 0:m.onDidAddFirstListener)==null||y.call(m,this)),this._size++;let l=rt(()=>{o==null||o(),this._removeListener(s)});return r instanceof Br?r.add(l):Array.isArray(r)&&r.push(l),l}),this._event}_removeListener(e){var o,l,u,d;if((l=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||l.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(u=this._options)==null?void 0:u.onDidRemoveLastListener)==null||d.call(u,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let s=this._deliveryQueue.current===this;if(this._size*Qw<=t.length){let p=0;for(let m=0;m<t.length;m++)t[m]?t[p++]=t[m]:s&&(this._deliveryQueue.end--,p<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=p}}_deliver(e,t){var s;if(!e)return;let r=((s=this._options)==null?void 0:s.onListenerError)||ba;if(!r){e.value(t);return}try{e.value(t)}catch(o){r(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,r,s,o;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof $c)this._deliver(this._listeners,e);else{let l=this._deliveryQueue;l.enqueue(this,e,this._listeners.length),this._deliverQueue(l)}(o=this._perfMon)==null||o.stop()}hasListeners(){return this._size>0}},Zw=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},$u=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ve,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ve,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let s=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let s=this.getWindowId(r);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};$u.INSTANCE=new $u;var Bh=$u;function e0(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}Bh.INSTANCE.onDidChangeZoomLevel;function t0(e){return Bh.INSTANCE.getZoomFactor(e)}Bh.INSTANCE.onDidChangeFullscreen;var Kn=typeof navigator=="object"?navigator.userAgent:"",Wu=Kn.indexOf("Firefox")>=0,i0=Kn.indexOf("AppleWebKit")>=0,Ih=Kn.indexOf("Chrome")>=0,r0=!Ih&&Kn.indexOf("Safari")>=0;Kn.indexOf("Electron/")>=0;Kn.indexOf("Android")>=0;var Wc=!1;if(typeof ar.matchMedia=="function"){let e=ar.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ar.matchMedia("(display-mode: fullscreen)");Wc=e.matches,e0(ar,e,({matches:r})=>{Wc&&t.matches||(Wc=r)})}var zn="en",Uu=!1,qu=!1,Ca=!1,Tv=!1,da,xa=zn,nm=zn,n0,Bi,nn=globalThis,Bt,Yg;typeof nn.vscode<"u"&&typeof nn.vscode.process<"u"?Bt=nn.vscode.process:typeof process<"u"&&typeof((Yg=process==null?void 0:process.versions)==null?void 0:Yg.node)=="string"&&(Bt=process);var Xg,s0=typeof((Xg=Bt==null?void 0:Bt.versions)==null?void 0:Xg.electron)=="string",o0=s0&&(Bt==null?void 0:Bt.type)==="renderer",Gg;if(typeof Bt=="object"){Uu=Bt.platform==="win32",qu=Bt.platform==="darwin",Ca=Bt.platform==="linux",Ca&&Bt.env.SNAP&&Bt.env.SNAP_REVISION,Bt.env.CI||Bt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,da=zn,xa=zn;let e=Bt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);da=t.userLocale,nm=t.osLocale,xa=t.resolvedLanguage||zn,n0=(Gg=t.languagePack)==null?void 0:Gg.translationsConfigFile}catch{}Tv=!0}else typeof navigator=="object"&&!o0?(Bi=navigator.userAgent,Uu=Bi.indexOf("Windows")>=0,qu=Bi.indexOf("Macintosh")>=0,(Bi.indexOf("Macintosh")>=0||Bi.indexOf("iPad")>=0||Bi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ca=Bi.indexOf("Linux")>=0,(Bi==null?void 0:Bi.indexOf("Mobi"))>=0,xa=globalThis._VSCODE_NLS_LANGUAGE||zn,da=navigator.language.toLowerCase(),nm=da):console.error("Unable to resolve platform.");var jv=Uu,Vi=qu,a0=Ca,sm=Tv,Xi=Bi,Pr=xa,l0;(e=>{function t(){return Pr}e.value=t;function r(){return Pr.length===2?Pr==="en":Pr.length>=3?Pr[0]==="e"&&Pr[1]==="n"&&Pr[2]==="-":!1}e.isDefaultVariant=r;function s(){return Pr==="en"}e.isDefault=s})(l0||(l0={}));var c0=typeof nn.postMessage=="function"&&!nn.importScripts;(()=>{if(c0){let e=[];nn.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let s=0,o=e.length;s<o;s++){let l=e[s];if(l.id===r.data.vscodeScheduleAsyncWork){e.splice(s,1),l.callback();return}}});let t=0;return r=>{let s=++t;e.push({id:s,callback:r}),nn.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var u0=!!(Xi&&Xi.indexOf("Chrome")>=0);Xi&&Xi.indexOf("Firefox")>=0;!u0&&Xi&&Xi.indexOf("Safari")>=0;Xi&&Xi.indexOf("Edg/")>=0;Xi&&Xi.indexOf("Android")>=0;var In=typeof navigator=="object"?navigator:{};sm||document.queryCommandSupported&&document.queryCommandSupported("copy")||In&&In.clipboard&&In.clipboard.writeText,sm||In&&In.clipboard&&In.clipboard.readText;var Ah=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}},Uc=new Ah,om=new Ah,am=new Ah,h0=new Array(230),Bv;(e=>{function t(d){return Uc.keyCodeToStr(d)}e.toString=t;function r(d){return Uc.strToKeyCode(d)}e.fromString=r;function s(d){return om.keyCodeToStr(d)}e.toUserSettingsUS=s;function o(d){return am.keyCodeToStr(d)}e.toUserSettingsGeneral=o;function l(d){return om.strToKeyCode(d)||am.strToKeyCode(d)}e.fromUserSettings=l;function u(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Uc.keyCodeToStr(d)}e.toElectronAccelerator=u})(Bv||(Bv={}));var d0=class Iv{constructor(t,r,s,o,l){this.ctrlKey=t,this.shiftKey=r,this.altKey=s,this.metaKey=o,this.keyCode=l}equals(t){return t instanceof Iv&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",s=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${t}${r}${s}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new f0([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},f0=class{constructor(e){if(e.length===0)throw Ow("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function p0(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return Bv.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Wu)switch(t){case 59:return 85;case 60:if(a0)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Vi)return 57;break}else if(i0&&(Vi&&t===93||!Vi&&t===92))return 57;return h0[t]||0}var m0=Vi?256:2048,g0=512,v0=1024,_0=Vi?2048:256,lm=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=p0(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|=m0),this.altKey&&(t|=g0),this.shiftKey&&(t|=v0),this.metaKey&&(t|=_0),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new d0(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},cm=new WeakMap;function y0(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var S0=class{static getSameOriginWindowChain(e){let t=cm.get(e);if(!t){t=[],cm.set(e,t);let r=e,s;do s=y0(r),s?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=s;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,s=0,o=this.getSameOriginWindowChain(e);for(let l of o){let u=l.window.deref();if(r+=(u==null?void 0:u.scrollY)??0,s+=(u==null?void 0:u.scrollX)??0,u===t||!l.iframeElement)break;let d=l.iframeElement.getBoundingClientRect();r+=d.top,s+=d.left}return{top:r,left:s}}},fa=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=S0.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},um=class{constructor(e,t=0,r=0){var o;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let s=!1;if(Ih){let l=navigator.userAgent.match(/Chrome\/(\d+)/);s=(l?parseInt(l[1]):123)<=122}if(e){let l=e,u=e,d=((o=e.view)==null?void 0:o.devicePixelRatio)||1;if(typeof l.wheelDeltaY<"u")s?this.deltaY=l.wheelDeltaY/(120*d):this.deltaY=l.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 p=e;p.deltaMode===p.DOM_DELTA_LINE?Wu&&!Vi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")r0&&jv?this.deltaX=-(l.wheelDeltaX/120):s?this.deltaX=l.wheelDeltaX/(120*d):this.deltaX=l.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 p=e;p.deltaMode===p.DOM_DELTA_LINE?Wu&&!Vi?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Av=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),w0;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof b0?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:It.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Av})})(w0||(w0={}));var b0=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?Av:(this._emitter||(this._emitter=new ve),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Oh=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 Au("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Au("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},C0=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new Au("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=r.setInterval(()=>{e()},t);this.disposable=rt(()=>{r.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},x0;(e=>{async function t(s){let o,l=await Promise.all(s.map(u=>u.then(d=>d,d=>{o||(o=d)})));if(typeof o<"u")throw o;return l}e.settled=t;function r(s){return new Promise(async(o,l)=>{try{await s(o,l)}catch(u){l(u)}})}e.withAsyncBody=r})(x0||(x0={}));var hm=class ki{static fromArray(t){return new ki(r=>{r.emitMany(t)})}static fromPromise(t){return new ki(async r=>{r.emitMany(await t)})}static fromPromises(t){return new ki(async r=>{await Promise.all(t.map(async s=>r.emitOne(await s)))})}static merge(t){return new ki(async r=>{await Promise.all(t.map(async s=>{for await(let o of s)r.emitOne(o)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new ve,queueMicrotask(async()=>{let s={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(s)),this.resolve()}catch(o){this.reject(o)}finally{s.emitOne=void 0,s.emitMany=void 0,s.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 It.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new ki(async s=>{for await(let o of t)s.emitOne(r(o))})}map(t){return ki.map(this,t)}static filter(t,r){return new ki(async s=>{for await(let o of t)r(o)&&s.emitOne(o)})}filter(t){return ki.filter(this,t)}static coalesce(t){return ki.filter(t,r=>!!r)}coalesce(){return ki.coalesce(this)}static async toPromise(t){let r=[];for await(let s of t)r.push(s);return r}toPromise(){return ki.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())}};hm.EMPTY=hm.fromArray([]);var{getWindow:Ki,getWindowId:k0,onDidRegisterWindow:E0}=(function(){let e=new Map,t={window:ar,disposables:new Br};e.set(ar.vscodeWindowId,t);let r=new ve,s=new ve,o=new ve;function l(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:s.event,registerWindow(u){if(e.has(u.vscodeWindowId))return ze.None;let d=new Br,p={window:u,disposables:d.add(new Br)};return e.set(u.vscodeWindowId,p),d.add(rt(()=>{e.delete(u.vscodeWindowId),s.fire(u)})),d.add(Me(u,kt.BEFORE_UNLOAD,()=>{o.fire(u)})),r.fire(p),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:l,getWindow(u){var m;let d=u;if((m=d==null?void 0:d.ownerDocument)!=null&&m.defaultView)return d.ownerDocument.defaultView.window;let p=u;return p!=null&&p.view?p.view.window:ar},getDocument(u){return Ki(u).document}}})(),N0=class{constructor(e,t,r,s){this._node=e,this._type=t,this._handler=r,this._options=s||!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 Me(e,t,r,s){return new N0(e,t,r,s)}var dm=function(e,t,r,s){return Me(e,t,r,s)},zh,R0=class extends C0{constructor(e){super(),this.defaultTarget=e&&Ki(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},fm=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){ba(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,s=new Map,o=l=>{r.set(l,!1);let u=e.get(l)??[];for(t.set(l,u),e.set(l,[]),s.set(l,!0);u.length>0;)u.sort(fm.sort),u.shift().execute();s.set(l,!1)};zh=(l,u,d=0)=>{let p=k0(l),m=new fm(u,d),y=e.get(p);return y||(y=[],e.set(p,y)),y.push(m),r.get(p)||(r.set(p,!0),l.requestAnimationFrame(()=>o(p))),m}})();function P0(e){let t=e.getBoundingClientRect(),r=Ki(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var kt={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"},D0=class{constructor(t){this.domNode=t,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(t){let r=ti(t);this._maxWidth!==r&&(this._maxWidth=r,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let r=ti(t);this._width!==r&&(this._width=r,this.domNode.style.width=this._width)}setHeight(t){let r=ti(t);this._height!==r&&(this._height=r,this.domNode.style.height=this._height)}setTop(t){let r=ti(t);this._top!==r&&(this._top=r,this.domNode.style.top=this._top)}setLeft(t){let r=ti(t);this._left!==r&&(this._left=r,this.domNode.style.left=this._left)}setBottom(t){let r=ti(t);this._bottom!==r&&(this._bottom=r,this.domNode.style.bottom=this._bottom)}setRight(t){let r=ti(t);this._right!==r&&(this._right=r,this.domNode.style.right=this._right)}setPaddingTop(t){let r=ti(t);this._paddingTop!==r&&(this._paddingTop=r,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let r=ti(t);this._paddingLeft!==r&&(this._paddingLeft=r,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let r=ti(t);this._paddingBottom!==r&&(this._paddingBottom=r,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let r=ti(t);this._paddingRight!==r&&(this._paddingRight=r,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let r=ti(t);this._fontSize!==r&&(this._fontSize=r,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let r=ti(t);this._lineHeight!==r&&(this._lineHeight=r,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let r=ti(t);this._letterSpacing!==r&&(this._letterSpacing=r,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,r){this.domNode.classList.toggle(t,r),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,r){this.domNode.setAttribute(t,r)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function ti(e){return typeof e=="number"?`${e}px`:e}function qs(e){return new D0(e)}var Ov=class{constructor(){this._hooks=new Br,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,s,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=o;let l=e;try{e.setPointerCapture(t),this._hooks.add(rt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Ki(e)}this._hooks.add(Me(l,kt.POINTER_MOVE,u=>{if(u.buttons!==r){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(Me(l,kt.POINTER_UP,u=>this.stopMonitoring(!0)))}};function L0(e,t,r){let s=null,o=null;if(typeof r.value=="function"?(s="value",o=r.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(s="get",o=r.get),!o)throw new Error("not supported");let l=`$memoize$${t}`;r[s]=function(...u){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,u)}),this[l]}}var qi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(qi||(qi={}));var Fs=class $t extends ze{constructor(){super(),this.dispatched=!1,this.targets=new rm,this.ignoreTargets=new rm,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(It.runAndSubscribe(E0,({window:t,disposables:r})=>{r.add(Me(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),r.add(Me(t.document,"touchend",s=>this.onTouchEnd(t,s))),r.add(Me(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:ar,disposables:this._store}))}static addTarget(t){if(!$t.isTouchDevice())return ze.None;$t.INSTANCE||($t.INSTANCE=new $t);let r=$t.INSTANCE.targets.push(t);return rt(r)}static ignoreTarget(t){if(!$t.isTouchDevice())return ze.None;$t.INSTANCE||($t.INSTANCE=new $t);let r=$t.INSTANCE.ignoreTargets.push(t);return rt(r)}static isTouchDevice(){return"ontouchstart"in ar||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,o=t.targetTouches.length;s<o;s++){let l=t.targetTouches.item(s);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:r,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[r],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let u=this.newGestureEvent(qi.Start,l.target);u.pageX=l.pageX,u.pageY=l.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let s=Date.now(),o=Object.keys(this.activeTouches).length;for(let l=0,u=r.changedTouches.length;l<u;l++){let d=r.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let p=this.activeTouches[d.identifier],m=Date.now()-p.initialTimeStamp;if(m<$t.HOLD_DELAY&&Math.abs(p.initialPageX-hi(p.rollingPageX))<30&&Math.abs(p.initialPageY-hi(p.rollingPageY))<30){let y=this.newGestureEvent(qi.Tap,p.initialTarget);y.pageX=hi(p.rollingPageX),y.pageY=hi(p.rollingPageY),this.dispatchEvent(y)}else if(m>=$t.HOLD_DELAY&&Math.abs(p.initialPageX-hi(p.rollingPageX))<30&&Math.abs(p.initialPageY-hi(p.rollingPageY))<30){let y=this.newGestureEvent(qi.Contextmenu,p.initialTarget);y.pageX=hi(p.rollingPageX),y.pageY=hi(p.rollingPageY),this.dispatchEvent(y)}else if(o===1){let y=hi(p.rollingPageX),w=hi(p.rollingPageY),_=hi(p.rollingTimestamps)-p.rollingTimestamps[0],v=y-p.rollingPageX[0],b=w-p.rollingPageY[0],k=[...this.targets].filter(E=>p.initialTarget instanceof Node&&E.contains(p.initialTarget));this.inertia(t,k,s,Math.abs(v)/_,v>0?1:-1,y,Math.abs(b)/_,b>0?1:-1,w)}this.dispatchEvent(this.newGestureEvent(qi.End,p.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=r,s.tapCount=0,s}dispatchEvent(t){if(t.type===qi.Tap){let r=new Date().getTime(),s=0;r-this._lastSetTapCountTime>$t.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=r,t.tapCount=s}else(t.type===qi.Change||t.type===qi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let r=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let o=0,l=t.initialTarget;for(;l&&l!==s;)o++,l=l.parentElement;r.push([o,s])}r.sort((s,o)=>s[0]-o[0]);for(let[s,o]of r)o.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,s,o,l,u,d,p,m){this.handle=zh(t,()=>{let y=Date.now(),w=y-s,_=0,v=0,b=!0;o+=$t.SCROLL_FRICTION*w,d+=$t.SCROLL_FRICTION*w,o>0&&(b=!1,_=l*o*w),d>0&&(b=!1,v=p*d*w);let k=this.newGestureEvent(qi.Change);k.translationX=_,k.translationY=v,r.forEach(E=>E.dispatchEvent(k)),b||this.inertia(t,r,y,o,l,u+_,d,p,m+v)})}onTouchMove(t){let r=Date.now();for(let s=0,o=t.changedTouches.length;s<o;s++){let l=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let u=this.activeTouches[l.identifier],d=this.newGestureEvent(qi.Change,u.initialTarget);d.translationX=l.pageX-hi(u.rollingPageX),d.translationY=l.pageY-hi(u.rollingPageY),d.pageX=l.pageX,d.pageY=l.pageY,this.dispatchEvent(d),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(l.pageX),u.rollingPageY.push(l.pageY),u.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Fs.SCROLL_FRICTION=-.005,Fs.HOLD_DELAY=700,Fs.CLEAR_TAP_COUNT_TIME=400,ut([L0],Fs,"isTouchDevice",1);var M0=Fs,Fh=class extends ze{onclick(e,t){this._register(Me(e,kt.CLICK,r=>t(new fa(Ki(e),r))))}onmousedown(e,t){this._register(Me(e,kt.MOUSE_DOWN,r=>t(new fa(Ki(e),r))))}onmouseover(e,t){this._register(Me(e,kt.MOUSE_OVER,r=>t(new fa(Ki(e),r))))}onmouseleave(e,t){this._register(Me(e,kt.MOUSE_LEAVE,r=>t(new fa(Ki(e),r))))}onkeydown(e,t){this._register(Me(e,kt.KEY_DOWN,r=>t(new lm(r))))}onkeyup(e,t){this._register(Me(e,kt.KEY_UP,r=>t(new lm(r))))}oninput(e,t){this._register(Me(e,kt.INPUT,t))}onblur(e,t){this._register(Me(e,kt.BLUR,t))}onfocus(e,t){this._register(Me(e,kt.FOCUS,t))}onchange(e,t){this._register(Me(e,kt.CHANGE,t))}ignoreGesture(e){return M0.ignoreTarget(e)}},pm=11,T0=class extends Fh{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=pm+"px",this.domNode.style.height=pm+"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 Ov),this._register(dm(this.bgDomNode,kt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(dm(this.domNode,kt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new R0),this._pointerdownScheduleRepeatTimer=this._register(new Oh)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ki(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},j0=class Ku{constructor(t,r,s,o,l,u,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,s=s|0,o=o|0,l=l|0,u=u|0,d=d|0),this.rawScrollLeft=o,this.rawScrollTop=d,r<0&&(r=0),o+r>s&&(o=s-r),o<0&&(o=0),l<0&&(l=0),d+l>u&&(d=u-l),d<0&&(d=0),this.width=r,this.scrollWidth=s,this.scrollLeft=o,this.height=l,this.scrollHeight=u,this.scrollTop=d}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new Ku(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Ku(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,r){let s=this.width!==t.width,o=this.scrollWidth!==t.scrollWidth,l=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,p=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:o,scrollLeftChanged:l,heightChanged:u,scrollHeightChanged:d,scrollTopChanged:p}}},B0=class extends ze{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ve),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new j0(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 s;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let s;t?s=new gm(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=gm.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},mm=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function qc(e,t){let r=t-e;return function(s){return e+r*O0(s)}}function I0(e,t,r){return function(s){return s<r?e(s/r):t((s-r)/(1-r))}}var gm=class Vu{constructor(t,r,s,o){this.from=t,this.to=r,this.duration=o,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,r,s){if(Math.abs(t-r)>2.5*s){let o,l;return t<r?(o=t+.75*s,l=r-.75*s):(o=t-.75*s,l=r+.75*s),I0(qc(t,o),qc(l,r),.33)}return qc(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let s=this.scrollLeft(r),o=this.scrollTop(r);return new mm(s,o,!1)}return new mm(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,s){return Vu.start(t,r,s)}static start(t,r,s){s=s+10;let o=Date.now()-10;return new Vu(t,r,o,s)}};function A0(e){return Math.pow(e,3)}function O0(e){return 1-A0(1-e)}var z0=class extends ze{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Oh)}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":"")))}},F0=140,zv=class extends Fh{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 z0(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Ov),this._shouldRender=!0,this.domNode=qs(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(Me(this.domNode.domNode,kt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new T0(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,s){this.slider=qs(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Me(this.slider.domNode,kt.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,r=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);r<=o&&o<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let o=P0(this.domNode.domNode);t=e.pageX-o.left,r=e.pageY-o.top}let s=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>{let l=this._sliderOrthogonalPointerPosition(o),u=Math.abs(l-r);if(jv&&u>F0){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let d=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(d))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Fv=class Yu{constructor(t,r,s,o,l,u){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=o,this._scrollSize=l,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Yu(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,s,o,l){let u=Math.max(0,s-t),d=Math.max(0,u-2*r),p=o>0&&o>s;if(!p)return{computedAvailableSize:Math.round(u),computedIsNeeded:p,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let m=Math.round(Math.max(20,Math.floor(s*d/o))),y=(d-m)/(o-s),w=l*y;return{computedAvailableSize:Math.round(u),computedIsNeeded:p,computedSliderSize:Math.round(m),computedSliderRatio:y,computedSliderPosition:Math.round(w)}}_refreshComputedValues(){let t=Yu._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,s=this._scrollPosition;return r<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},H0=class extends zv{constructor(e,t,r){let s=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Fv(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.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}},$0=class extends zv{constructor(e,t,r){let s=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Fv(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.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}},W0=500,vm=50,U0=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Xu=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,s=1,o=this._rear;do{let l=o===this._front?t:Math.pow(2,-s);if(t-=l,r+=this._memory[o].score*l,o===this._front)break;o=(this._capacity+o-1)%this._capacity,s++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(Ih){let r=Ki(t.browserEvent),s=t0(r);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,s){let o=null,l=new U0(t,r,s);this._front===-1&&this._rear===-1?(this._memory[0]=l,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]=l),l.score=this._computeScore(l,o)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),r){let o=Math.abs(t.deltaX),l=Math.abs(t.deltaY),u=Math.abs(r.deltaX),d=Math.abs(r.deltaY),p=Math.max(Math.min(o,u),1),m=Math.max(Math.min(l,d),1),y=Math.max(o,u),w=Math.max(l,d);y%p===0&&w%m===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Xu.INSTANCE=new Xu;var q0=Xu,K0=class extends Fh{constructor(e,t,r){super(),this._onScroll=this._register(new ve),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ve),this.onWillScroll=this._onWillScroll.event,this._options=Y0(t),this._scrollable=r,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let s={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new $0(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new H0(this._scrollable,this._options,s)),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=qs(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=qs(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=qs(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 Oh),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=on(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,Vi&&(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 um(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=on(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new um(r))};this._mouseWheelToDispose.push(Me(this._listenOnDomNode,kt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var o;if((o=e.browserEvent)!=null&&o.defaultPrevented)return;let t=q0.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,u=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&u+l===0?u=l=0:Math.abs(l)>=Math.abs(u)?u=0:l=0),this._options.flipAxes&&([l,u]=[u,l]);let d=!Vi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!u&&(u=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(u=u*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),m={};if(l){let y=vm*l,w=p.scrollTop-(y<0?Math.floor(y):Math.ceil(y));this._verticalScrollbar.writeScrollPosition(m,w)}if(u){let y=vm*u,w=p.scrollLeft-(y<0?Math.floor(y):Math.ceil(y));this._horizontalScrollbar.writeScrollPosition(m,w)}m=this._scrollable.validateScrollPosition(m),(p.scrollLeft!==m.scrollLeft||p.scrollTop!==m.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(m):this._scrollable.setScrollPositionNow(m),r=!0)}let s=r;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,r=e.scrollLeft>0,s=r?" left":"",o=t?" top":"",l=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${o}${s}`)}}_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(),W0)}},V0=class extends K0{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Y0(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,Vi&&(t.className+=" mac"),t}var Gu=class extends ze{constructor(e,t,r,s,o,l,u,d){super(),this._bufferService=r,this._optionsService=u,this._renderService=d,this._onRequestScrollLines=this._register(new ve),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new B0({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:m=>zh(s.window,m)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new V0(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},p)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(m=>{this._scrollableElement.updateOptions({handleMouseWheel:!(m&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(It.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(rt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(rt(()=>this._styleElement.remove())),this._register(It.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.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(m=>this._handleScroll(m)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Gu=ut([ye(2,Vt),ye(3,lr),ye(4,Sv),ye(5,qn),ye(6,Yt),ye(7,cr)],Gu);var Qu=class extends ze{constructor(e,t,r,s,o){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=s,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(l=>this._removeDecoration(l))),this._register(rt(()=>{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 s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Qu=ut([ye(1,Vt),ye(2,lr),ye(3,Gs),ye(4,cr)],Qu);var X0=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},$i={full:0,left:0,center:0,right:0},Dr={full:0,left:0,center:0,right:0},Ls={full:0,left:0,center:0,right:0},Ba=class extends ze{constructor(e,t,r,s,o,l,u,d){var m;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=s,this._renderService=o,this._optionsService=l,this._themeService=u,this._coreBrowserService=d,this._colorZoneStore=new X0,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(),(m=this._viewportElement.parentElement)==null||m.insertBefore(this._canvas,this._viewportElement),this._register(rt(()=>{var y;return(y=this._canvas)==null?void 0:y.remove()}));let p=this._canvas.getContext("2d");if(p)this._ctx=p;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);Dr.full=this._canvas.width,Dr.left=e,Dr.center=t,Dr.right=e,this._refreshDrawHeightConstants(),Ls.full=1,Ls.left=1,Ls.center=1+Dr.left,Ls.right=1+Dr.left+Dr.center}_refreshDrawHeightConstants(){$i.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);$i.left=t,$i.center=t,$i.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$i.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$i.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$i.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$i.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(Ls[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-$i[e.position||"full"]/2),Dr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+$i[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}))}};Ba=ut([ye(2,Vt),ye(3,Gs),ye(4,cr),ye(5,Yt),ye(6,qn),ye(7,lr)],Ba);var ce;(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=""))(ce||(ce={}));var ka;(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=""))(ka||(ka={}));var Hv;(e=>e.ST=`${ce.ESC}\\`)(Hv||(Hv={}));var Ju=class{constructor(e,t,r,s,o,l){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=s,this._coreService=o,this._renderService=l,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ce.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,s=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=s+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let l=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Ju=ut([ye(2,Vt),ye(3,Yt),ye(4,cn),ye(5,cr)],Ju);var Et=0,Nt=0,Rt=0,ct=0,_m={css:"#00000000",rgba:0},gt;(e=>{function t(o,l,u,d){return d!==void 0?`#${Jr(o)}${Jr(l)}${Jr(u)}${Jr(d)}`:`#${Jr(o)}${Jr(l)}${Jr(u)}`}e.toCss=t;function r(o,l,u,d=255){return(o<<24|l<<16|u<<8|d)>>>0}e.toRgba=r;function s(o,l,u,d){return{css:e.toCss(o,l,u,d),rgba:e.toRgba(o,l,u,d)}}e.toColor=s})(gt||(gt={}));var et;(e=>{function t(p,m){if(ct=(m.rgba&255)/255,ct===1)return{css:m.css,rgba:m.rgba};let y=m.rgba>>24&255,w=m.rgba>>16&255,_=m.rgba>>8&255,v=p.rgba>>24&255,b=p.rgba>>16&255,k=p.rgba>>8&255;Et=v+Math.round((y-v)*ct),Nt=b+Math.round((w-b)*ct),Rt=k+Math.round((_-k)*ct);let E=gt.toCss(Et,Nt,Rt),N=gt.toRgba(Et,Nt,Rt);return{css:E,rgba:N}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function s(p,m,y){let w=Ea.ensureContrastRatio(p.rgba,m.rgba,y);if(w)return gt.toColor(w>>24&255,w>>16&255,w>>8&255)}e.ensureContrastRatio=s;function o(p){let m=(p.rgba|255)>>>0;return[Et,Nt,Rt]=Ea.toChannels(m),{css:gt.toCss(Et,Nt,Rt),rgba:m}}e.opaque=o;function l(p,m){return ct=Math.round(m*255),[Et,Nt,Rt]=Ea.toChannels(p.rgba),{css:gt.toCss(Et,Nt,Rt,ct),rgba:gt.toRgba(Et,Nt,Rt,ct)}}e.opacity=l;function u(p,m){return ct=p.rgba&255,l(p,ct*m/255)}e.multiplyOpacity=u;function d(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=d})(et||(et={}));var at;(e=>{let t,r;try{let o=document.createElement("canvas");o.width=1,o.height=1;let l=o.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return Et=parseInt(o.slice(1,2).repeat(2),16),Nt=parseInt(o.slice(2,3).repeat(2),16),Rt=parseInt(o.slice(3,4).repeat(2),16),gt.toColor(Et,Nt,Rt);case 5:return Et=parseInt(o.slice(1,2).repeat(2),16),Nt=parseInt(o.slice(2,3).repeat(2),16),Rt=parseInt(o.slice(3,4).repeat(2),16),ct=parseInt(o.slice(4,5).repeat(2),16),gt.toColor(Et,Nt,Rt,ct);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 l=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(l)return Et=parseInt(l[1]),Nt=parseInt(l[2]),Rt=parseInt(l[3]),ct=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),gt.toColor(Et,Nt,Rt,ct);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Et,Nt,Rt,ct]=t.getImageData(0,0,1,1).data,ct!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:gt.toRgba(Et,Nt,Rt,ct),css:o}}e.toColor=s})(at||(at={}));var Kt;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,o,l){let u=s/255,d=o/255,p=l/255,m=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),y=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),w=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return m*.2126+y*.7152+w*.0722}e.relativeLuminance2=r})(Kt||(Kt={}));var Ea;(e=>{function t(u,d){if(ct=(d&255)/255,ct===1)return d;let p=d>>24&255,m=d>>16&255,y=d>>8&255,w=u>>24&255,_=u>>16&255,v=u>>8&255;return Et=w+Math.round((p-w)*ct),Nt=_+Math.round((m-_)*ct),Rt=v+Math.round((y-v)*ct),gt.toRgba(Et,Nt,Rt)}e.blend=t;function r(u,d,p){let m=Kt.relativeLuminance(u>>8),y=Kt.relativeLuminance(d>>8);if(sr(m,y)<p){if(y<m){let v=s(u,d,p),b=sr(m,Kt.relativeLuminance(v>>8));if(b<p){let k=o(u,d,p),E=sr(m,Kt.relativeLuminance(k>>8));return b>E?v:k}return v}let w=o(u,d,p),_=sr(m,Kt.relativeLuminance(w>>8));if(_<p){let v=s(u,d,p),b=sr(m,Kt.relativeLuminance(v>>8));return _>b?w:v}return w}}e.ensureContrastRatio=r;function s(u,d,p){let m=u>>24&255,y=u>>16&255,w=u>>8&255,_=d>>24&255,v=d>>16&255,b=d>>8&255,k=sr(Kt.relativeLuminance2(_,v,b),Kt.relativeLuminance2(m,y,w));for(;k<p&&(_>0||v>0||b>0);)_-=Math.max(0,Math.ceil(_*.1)),v-=Math.max(0,Math.ceil(v*.1)),b-=Math.max(0,Math.ceil(b*.1)),k=sr(Kt.relativeLuminance2(_,v,b),Kt.relativeLuminance2(m,y,w));return(_<<24|v<<16|b<<8|255)>>>0}e.reduceLuminance=s;function o(u,d,p){let m=u>>24&255,y=u>>16&255,w=u>>8&255,_=d>>24&255,v=d>>16&255,b=d>>8&255,k=sr(Kt.relativeLuminance2(_,v,b),Kt.relativeLuminance2(m,y,w));for(;k<p&&(_<255||v<255||b<255);)_=Math.min(255,_+Math.ceil((255-_)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),k=sr(Kt.relativeLuminance2(_,v,b),Kt.relativeLuminance2(m,y,w));return(_<<24|v<<16|b<<8|255)>>>0}e.increaseLuminance=o;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=l})(Ea||(Ea={}));function Jr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function sr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var G0=class extends Xs{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ia=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ni}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],s=t.translateToString(!0),o=0,l=0,u=0,d=t.getFg(0),p=t.getBg(0);for(let m=0;m<t.getTrimmedLength();m++)if(t.loadCell(m,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==p){if(m-o>1){let y=this._getJoinedRanges(s,u,l,t,o);for(let w=0;w<y.length;w++)r.push(y[w])}o=m,u=l,d=this._workCell.fg,p=this._workCell.bg}l+=this._workCell.getChars().length||jr.length}if(this._bufferService.cols-o>1){let m=this._getJoinedRanges(s,u,l,t,o);for(let y=0;y<m.length;y++)r.push(m[y])}return r}_getJoinedRanges(e,t,r,s,o){let l=e.substring(t,r),u=[];try{u=this._characterJoiners[0].handler(l)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let p=this._characterJoiners[d].handler(l);for(let m=0;m<p.length;m++)Ia._mergeRanges(u,p[m])}catch(p){console.error(p)}return this._stringRangesToCellRanges(u,s,o),u}_stringRangesToCellRanges(e,t,r){let s=0,o=!1,l=0,u=e[s];if(u){for(let d=r;d<this._bufferService.cols;d++){let p=t.getWidth(d),m=t.getString(d).length||jr.length;if(p!==0){if(!o&&u[0]<=l&&(u[0]=d,o=!0),u[1]<=l){if(u[1]=d,u=e[++s],!u)break;u[0]<=l?(u[0]=d,o=!0):o=!1}l+=m}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(r){if(t[1]<=o[0])return e[s-1][1]=t[1],e;if(t[1]<=o[1])return e[s-1][1]=Math.max(t[1],o[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=o[0])return e.splice(s,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]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};Ia=ut([ye(0,Vt)],Ia);function Q0(e){return 57508<=e&&e<=57558}function J0(e){return 9472<=e&&e<=9631}function Z0(e){return Q0(e)||J0(e)}function e1(){return{css:{canvas:pa(),cell:pa()},device:{canvas:pa(),cell:pa(),char:{width:0,height:0,left:0,top:0}}}}function pa(){return{width:0,height:0}}var Zu=class{constructor(e,t,r,s,o,l,u){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=s,this._coreService=o,this._decorationService=l,this._themeService=u,this._workCell=new Ni,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,s,o,l,u,d,p,m,y){let w=[],_=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,b=e.getNoBgTrimmedLength();r&&b<l+1&&(b=l+1);let k,E=0,N="",A=0,z=0,I=0,U=0,O=!1,B=0,X=!1,q=0,re=0,te=[],x=m!==-1&&y!==-1;for(let P=0;P<b;P++){e.loadCell(P,this._workCell);let j=this._workCell.getWidth();if(j===0)continue;let J=!1,F=P>=re,Q=P,$=this._workCell;if(_.length>0&&P===_[0][0]&&F){let ue=_.shift(),Ne=this._isCellInSelection(ue[0],t);for(A=ue[0]+1;A<ue[1];A++)F&&(F=Ne===this._isCellInSelection(A,t));F&&(F=!r||l<ue[0]||l>=ue[1]),F?(J=!0,$=new G0(this._workCell,e.translateToString(!0,ue[0],ue[1]),ue[1]-ue[0]),Q=ue[1]-1,j=$.getWidth()):re=ue[1]}let K=this._isCellInSelection(P,t),G=r&&P===l,R=x&&P>=m&&P<=y,Z=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,ue=>{Z=!0});let D=$.getChars()||jr;if(D===" "&&($.isUnderline()||$.isOverline())&&(D=" "),q=j*d-p.get(D,$.isBold(),$.isItalic()),!k)k=this._document.createElement("span");else if(E&&(K&&X||!K&&!X&&$.bg===z)&&(K&&X&&v.selectionForeground||$.fg===I)&&$.extended.ext===U&&R===O&&q===B&&!G&&!J&&!Z&&F){$.isInvisible()?N+=jr:N+=D,E++;continue}else E&&(k.textContent=N),k=this._document.createElement("span"),E=0,N="";if(z=$.bg,I=$.fg,U=$.extended.ext,O=R,B=q,X=K,J&&l>=P&&l<=Q&&(l=P),!this._coreService.isCursorHidden&&G&&this._coreService.isCursorInitialized){if(te.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&te.push("xterm-cursor-blink"),te.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":te.push("xterm-cursor-outline");break;case"block":te.push("xterm-cursor-block");break;case"bar":te.push("xterm-cursor-bar");break;case"underline":te.push("xterm-cursor-underline");break}}if($.isBold()&&te.push("xterm-bold"),$.isItalic()&&te.push("xterm-italic"),$.isDim()&&te.push("xterm-dim"),$.isInvisible()?N=jr:N=$.getChars()||jr,$.isUnderline()&&(te.push(`xterm-underline-${$.extended.underlineStyle}`),N===" "&&(N=" "),!$.isUnderlineColorDefault()))if($.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${Xs.toColorRGB($.getUnderlineColor()).join(",")})`;else{let ue=$.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&$.isBold()&&ue<8&&(ue+=8),k.style.textDecorationColor=v.ansi[ue].css}$.isOverline()&&(te.push("xterm-overline"),N===" "&&(N=" ")),$.isStrikethrough()&&te.push("xterm-strikethrough"),R&&(k.style.textDecoration="underline");let T=$.getFgColor(),se=$.getFgColorMode(),oe=$.getBgColor(),ae=$.getBgColorMode(),ge=!!$.isInverse();if(ge){let ue=T;T=oe,oe=ue;let Ne=se;se=ae,ae=Ne}let we,_e,W=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,ue=>{ue.options.layer!=="top"&&W||(ue.backgroundColorRGB&&(ae=50331648,oe=ue.backgroundColorRGB.rgba>>8&16777215,we=ue.backgroundColorRGB),ue.foregroundColorRGB&&(se=50331648,T=ue.foregroundColorRGB.rgba>>8&16777215,_e=ue.foregroundColorRGB),W=ue.options.layer==="top")}),!W&&K&&(we=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,oe=we.rgba>>8&16777215,ae=50331648,W=!0,v.selectionForeground&&(se=50331648,T=v.selectionForeground.rgba>>8&16777215,_e=v.selectionForeground)),W&&te.push("xterm-decoration-top");let Y;switch(ae){case 16777216:case 33554432:Y=v.ansi[oe],te.push(`xterm-bg-${oe}`);break;case 50331648:Y=gt.toColor(oe>>16,oe>>8&255,oe&255),this._addStyle(k,`background-color:#${ym((oe>>>0).toString(16),"0",6)}`);break;case 0:default:ge?(Y=v.foreground,te.push("xterm-bg-257")):Y=v.background}switch(we||$.isDim()&&(we=et.multiplyOpacity(Y,.5)),se){case 16777216:case 33554432:$.isBold()&&T<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(T+=8),this._applyMinimumContrast(k,Y,v.ansi[T],$,we,void 0)||te.push(`xterm-fg-${T}`);break;case 50331648:let ue=gt.toColor(T>>16&255,T>>8&255,T&255);this._applyMinimumContrast(k,Y,ue,$,we,_e)||this._addStyle(k,`color:#${ym(T.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(k,Y,v.foreground,$,we,_e)||ge&&te.push("xterm-fg-257")}te.length&&(k.className=te.join(" "),te.length=0),!G&&!J&&!Z&&F?E++:k.textContent=N,q!==this.defaultSpacing&&(k.style.letterSpacing=`${q}px`),w.push(k),P=Q}return k&&E&&(k.textContent=N),w}_applyMinimumContrast(e,t,r,s,o,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||Z0(s.getCode()))return!1;let u=this._getContrastCache(s),d;if(!o&&!l&&(d=u.getColor(t.rgba,r.rgba)),d===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);d=et.ensureContrastRatio(o||t,l||r,p),u.setColor((o||t).rgba,(l||r).rgba,d??null)}return d?(this._addStyle(e,`color:${d.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,s=this._selectionEnd;return!r||!s?!1:this._columnSelectMode?r[0]<=s[0]?e>=r[0]&&t>=r[1]&&e<s[0]&&t<=s[1]:e<r[0]&&t>=r[1]&&e>=s[0]&&t<=s[1]:t>r[1]&&t<s[1]||r[1]===s[1]&&t===r[1]&&e>=r[0]&&e<s[0]||r[1]<s[1]&&t===s[1]&&e<s[0]||r[1]<s[1]&&t===r[1]&&e>=r[0]}};Zu=ut([ye(1,Cv),ye(2,Yt),ye(3,lr),ye(4,cn),ye(5,Gs),ye(6,qn)],Zu);function ym(e,t,r){for(;e.length<r;)e=t+e;return e}var t1=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontStyle="italic";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold",l.style.fontStyle="italic",this._measureElements=[r,s,o,l],this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(o),this._container.appendChild(l),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,r,s){e===this._font&&t===this._fontSize&&r===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,r){let s=0;if(!t&&!r&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let u=this._measure(e,0);return u>0&&(this._flat[s]=u),u}let o=e;t&&(o+="B"),r&&(o+="I");let l=this._holey.get(o);if(l===void 0){let u=0;t&&(u|=1),r&&(u|=2),l=this._measure(e,u),l>0&&this._holey.set(o,l)}return l}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},i1=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,s=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let o=e.buffers.active.ydisp,l=t[1]-o,u=r[1]-o,d=Math.max(l,0),p=Math.min(u,e.rows-1);if(d>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=l,this.viewportEndRow=u,this.viewportCappedStartRow=d,this.viewportCappedEndRow=p,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function r1(){return new i1}var Kc="xterm-dom-renderer-owner-",xi="xterm-rows",ma="xterm-fg-",Sm="xterm-bg-",Ms="xterm-focus",ga="xterm-selection",n1=1,eh=class extends ze{constructor(e,t,r,s,o,l,u,d,p,m,y,w,_,v){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=s,this._viewportElement=o,this._helperContainer=l,this._linkifier2=u,this._charSizeService=p,this._optionsService=m,this._bufferService=y,this._coreService=w,this._coreBrowserService=_,this._themeService=v,this._terminalClass=n1++,this._rowElements=[],this._selectionRenderModel=r1(),this.onRequestRedraw=this._register(new ve).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(xi),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(ga),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=e1(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(b=>this._injectCss(b))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(Zu,document),this._element.classList.add(Kc+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(b=>this._handleLinkHover(b))),this._register(this._linkifier2.onHideLinkUnderline(b=>this._handleLinkLeave(b))),this._register(rt(()=>{this._element.classList.remove(Kc+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new t1(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${xi} 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} .${xi} { 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} .${xi} .xterm-dim { color: ${et.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 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} .${xi}.${Ms} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${xi}.${Ms} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${xi}.${Ms} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${xi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${xi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${xi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${xi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${xi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ga} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ga} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ga} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,u]of e.ansi.entries())t+=`${this._terminalSelector} .${ma}${l} { color: ${u.css}; }${this._terminalSelector} .${ma}${l}.xterm-dim { color: ${et.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${Sm}${l} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${ma}257 { color: ${et.opaque(e.background).css}; }${this._terminalSelector} .${ma}257.xterm-dim { color: ${et.multiplyOpacity(et.opaque(e.background),.5).css}; }${this._terminalSelector} .${Sm}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let r=this._rowElements.length;r<=t;r++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}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(Ms),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ms),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(r){let p=e[0]>t[0];d.appendChild(this._createSelectionElement(l,p?t[0]:e[0],p?e[0]:t[0],u-l+1))}else{let p=s===l?e[0]:0,m=l===o?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(l,p,m));let y=u-l-1;if(d.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,y)),l!==u){let w=o===u?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(u,0,w))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,r,s=1){let o=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(r-t);return l+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-l),o.style.height=`${s*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${l}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 r=this._bufferService.buffer,s=r.ybase+r.y,o=Math.min(r.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=t;p++){let m=p+r.ydisp,y=this._rowElements[p],w=r.lines.get(m);if(!y||!w)break;y.replaceChildren(...this._rowFactory.createRow(w,m,m===s,u,d,o,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Kc}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,r,s,o,l){r<0&&(e=0),s<0&&(t=0);let u=this._bufferService.rows-1;r=Math.max(Math.min(r,u),0),s=Math.max(Math.min(s,u),0),o=Math.min(o,this._bufferService.cols);let d=this._bufferService.buffer,p=d.ybase+d.y,m=Math.min(d.x,o-1),y=this._optionsService.rawOptions.cursorBlink,w=this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let v=r;v<=s;++v){let b=v+d.ydisp,k=this._rowElements[v],E=d.lines.get(b);if(!k||!E)break;k.replaceChildren(...this._rowFactory.createRow(E,b,b===p,w,_,m,y,this.dimensions.css.cell.width,this._widthCache,l?v===r?e:0:-1,l?(v===s?t:o)-1:-1))}}};eh=ut([ye(7,Th),ye(8,qa),ye(9,Yt),ye(10,Vt),ye(11,cn),ye(12,lr),ye(13,qn)],eh);var th=class extends ze{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ve),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new o1(this._optionsService))}catch{this._measureStrategy=this._register(new s1(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())}};th=ut([ye(2,Yt)],th);var $v=class extends ze{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)}},s1=class extends $v{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},o1=class extends $v{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}},a1=class extends ze{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new l1(this._window)),this._onDprChange=this._register(new ve),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ve),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(It.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Me(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Me(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}},l1=class extends ze{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Wn),this._onDprChange=this._register(new ve),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(rt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Me(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)}},c1=class extends ze{constructor(){super(),this.linkProviders=[],this._register(rt(()=>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 Hh(e,t,r){let s=r.getBoundingClientRect(),o=e.getComputedStyle(r),l=parseInt(o.getPropertyValue("padding-left")),u=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-s.left-l,t.clientY-s.top-u]}function u1(e,t,r,s,o,l,u,d,p){if(!l)return;let m=Hh(e,t,r);if(m)return m[0]=Math.ceil((m[0]+(p?u/2:0))/u),m[1]=Math.ceil(m[1]/d),m[0]=Math.min(Math.max(m[0],1),s+(p?1:0)),m[1]=Math.min(Math.max(m[1],1),o),m}var ih=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,s,o){return u1(window,e,t,r,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,t){let r=Hh(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};ih=ut([ye(0,cr),ye(1,qa)],ih);var h1=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Wv={};ww(Wv,{getSafariVersion:()=>f1,isChromeOS:()=>Vv,isFirefox:()=>Uv,isIpad:()=>p1,isIphone:()=>m1,isLegacyEdge:()=>d1,isLinux:()=>$h,isMac:()=>Aa,isNode:()=>Ka,isSafari:()=>qv,isWindows:()=>Kv});var Ka=typeof process<"u"&&"title"in process,Qs=Ka?"node":navigator.userAgent,Js=Ka?"node":navigator.platform,Uv=Qs.includes("Firefox"),d1=Qs.includes("Edge"),qv=/^((?!chrome|android).)*safari/i.test(Qs);function f1(){if(!qv)return 0;let e=Qs.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Aa=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Js),p1=Js==="iPad",m1=Js==="iPhone",Kv=["Windows","Win16","Win32","WinCE"].includes(Js),$h=Js.indexOf("Linux")>=0,Vv=/\bCrOS\b/.test(Qs),Yv=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,s=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),r=Math.max(t,r),o=e.timeRemaining(),r*1.5>o){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=o}this.clear()}},g1=class extends Yv{_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())}}},v1=class extends Yv{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Oa=!Ka&&"requestIdleCallback"in window?v1:g1,_1=class{constructor(){this._queue=new Oa}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},rh=class extends ze{constructor(e,t,r,s,o,l,u,d,p){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=s,this._coreService=o,this._coreBrowserService=d,this._renderer=this._register(new Wn),this._pausedResizeTask=new _1,this._observerDisposable=this._register(new Wn),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 ve),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ve),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ve),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ve),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h1((m,y)=>this._renderRows(m,y),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new y1(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(rt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>{var m;return(m=this._renderer.value)==null?void 0:m.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.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(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(m=>this._registerIntersectionObserver(m,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=rt(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};rh=ut([ye(2,Yt),ye(3,qa),ye(4,cn),ye(5,Gs),ye(6,Vt),ye(7,lr),ye(8,qn)],rh);var y1=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function S1(e,t,r,s){let o=r.buffer.x,l=r.buffer.y;if(!r.buffer.hasScrollback)return C1(o,l,e,t,r,s)+Va(l,t,r,s)+x1(o,l,e,t,r,s);let u;if(l===t)return u=o>e?"D":"C",Vs(Math.abs(o-e),Ks(u,s));u=l>t?"D":"C";let d=Math.abs(l-t),p=b1(l>t?e:o,r)+(d-1)*r.cols+1+w1(l>t?o:e);return Vs(p,Ks(u,s))}function w1(e,t){return e-1}function b1(e,t){return t.cols-e}function C1(e,t,r,s,o,l){return Va(t,s,o,l).length===0?"":Vs(Gv(e,t,e,t-an(t,o),!1,o).length,Ks("D",l))}function Va(e,t,r,s){let o=e-an(e,r),l=t-an(t,r),u=Math.abs(o-l)-k1(e,t,r);return Vs(u,Ks(Xv(e,t),s))}function x1(e,t,r,s,o,l){let u;Va(t,s,o,l).length>0?u=s-an(s,o):u=t;let d=s,p=E1(e,t,r,s,o,l);return Vs(Gv(e,u,r,d,p==="C",o).length,Ks(p,l))}function k1(e,t,r){var u;let s=0,o=e-an(e,r),l=t-an(t,r);for(let d=0;d<Math.abs(o-l);d++){let p=Xv(e,t)==="A"?-1:1;(u=r.buffer.lines.get(o+p*d))!=null&&u.isWrapped&&s++}return s}function an(e,t){let r=0,s=t.buffer.lines.get(e),o=s==null?void 0:s.isWrapped;for(;o&&e>=0&&e<t.rows;)r++,s=t.buffer.lines.get(--e),o=s==null?void 0:s.isWrapped;return r}function E1(e,t,r,s,o,l){let u;return Va(r,s,o,l).length>0?u=s-an(s,o):u=t,e<r&&u<=s||e>=r&&u<s?"C":"D"}function Xv(e,t){return e>t?"A":"B"}function Gv(e,t,r,s,o,l){let u=e,d=t,p="";for(;(u!==r||d!==s)&&d>=0&&d<l.buffer.lines.length;)u+=o?1:-1,o&&u>l.cols-1?(p+=l.buffer.translateBufferLineToString(d,!1,e,u),u=0,e=0,d++):!o&&u<0&&(p+=l.buffer.translateBufferLineToString(d,!1,0,e+1),u=l.cols-1,e=u,d--);return p+l.buffer.translateBufferLineToString(d,!1,e,u)}function Ks(e,t){let r=t?"O":"[";return ce.ESC+r+e}function Vs(e,t){e=Math.floor(e);let r="";for(let s=0;s<e;s++)r+=t;return r}var N1=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 wm(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 Vc=50,R1=15,P1=50,D1=500,L1=" ",M1=new RegExp(L1,"g"),nh=class extends ze{constructor(e,t,r,s,o,l,u,d,p){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=s,this._coreService=o,this._mouseService=l,this._optionsService=u,this._renderService=d,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ni,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ve),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ve),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ve),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ve),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=m=>this._handleMouseMove(m),this._mouseUpListener=m=>this._handleMouseUp(m),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(m=>this._handleTrim(m)),this._register(this._bufferService.buffers.onBufferActivate(m=>this._handleBufferActivate(m))),this.enable(),this._model=new N1(this._bufferService),this._activeSelectionMode=0,this._register(rt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(m=>{m.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let o=e[0]<t[0]?e[0]:t[0],l=e[0]<t[0]?t[0]:e[0];for(let u=e[1];u<=t[1];u++){let d=r.translateBufferLineToString(u,!0,o,l);s.push(d)}}else{let o=e[1]===t[1]?t[0]:void 0;s.push(r.translateBufferLineToString(e[1],!0,e[0],o));for(let l=e[1]+1;l<=t[1]-1;l++){let u=r.lines.get(l),d=r.translateBufferLineToString(l,!0);u!=null&&u.isWrapped?s[s.length-1]+=d:s.push(d)}if(e[1]!==t[1]){let l=r.lines.get(t[1]),u=r.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?s[s.length-1]+=u:s.push(u)}}return s.map(o=>o.replace(M1," ")).join(Kv?`\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())),$h&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s||!t?!1:this._areCoordsInSelection(t,r,s)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s?!1:this._areCoordsInSelection([e,t],r,s)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var o,l;let r=(l=(o=this._linkifier.currentLink)==null?void 0:o.link)==null?void 0:l.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=wm(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,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=Hh(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-Vc),Vc),t/=Vc,t/Math.abs(t)+Math.round(t*(R1-1)))}shouldForceSelection(e){return Aa?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(),P1)}_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&&!(Aa&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let s=r.lines.get(this._model.selectionEnd[1]);s&&s.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<D1&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let s=S1(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let s=0;t>=s;s++){let o=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:o>1&&t!==s&&(r+=o-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,l=o.lines.get(e[1]);if(!l)return;let u=o.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(l,e[0]),p=d,m=e[0]-d,y=0,w=0,_=0,v=0;if(u.charAt(d)===" "){for(;d>0&&u.charAt(d-1)===" ";)d--;for(;p<u.length&&u.charAt(p+1)===" ";)p++}else{let E=e[0],N=e[0];l.getWidth(E)===0&&(y++,E--),l.getWidth(N)===2&&(w++,N++);let A=l.getString(N).length;for(A>1&&(v+=A-1,p+=A-1);E>0&&d>0&&!this._isCharWordSeparator(l.loadCell(E-1,this._workCell));){l.loadCell(E-1,this._workCell);let z=this._workCell.getChars().length;this._workCell.getWidth()===0?(y++,E--):z>1&&(_+=z-1,d-=z-1),d--,E--}for(;N<l.length&&p+1<u.length&&!this._isCharWordSeparator(l.loadCell(N+1,this._workCell));){l.loadCell(N+1,this._workCell);let z=this._workCell.getChars().length;this._workCell.getWidth()===2?(w++,N++):z>1&&(v+=z-1,p+=z-1),p++,N++}}p++;let b=d+m-y+_,k=Math.min(this._bufferService.cols,p-d+y+w-_-v);if(!(!t&&u.slice(d,p).trim()==="")){if(r&&b===0&&l.getCodePoint(0)!==32){let E=o.lines.get(e[1]-1);if(E&&l.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let N=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(N){let A=this._bufferService.cols-N.start;b-=A,k+=A}}}if(s&&b+k===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let E=o.lines.get(e[1]+1);if(E!=null&&E.isWrapped&&E.getCodePoint(0)!==32){let N=this._getWordAt([0,e[1]+1],!1,!1,!0);N&&(k+=N.length)}}return{start:b,length:k}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=wm(r,this._bufferService.cols)}};nh=ut([ye(3,Vt),ye(4,cn),ye(5,jh),ye(6,Yt),ye(7,cr),ye(8,lr)],nh);var bm=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Cm=class{constructor(){this._color=new bm,this._css=new bm}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},yt=Object.freeze((()=>{let e=[at.toColor("#2e3436"),at.toColor("#cc0000"),at.toColor("#4e9a06"),at.toColor("#c4a000"),at.toColor("#3465a4"),at.toColor("#75507b"),at.toColor("#06989a"),at.toColor("#d3d7cf"),at.toColor("#555753"),at.toColor("#ef2929"),at.toColor("#8ae234"),at.toColor("#fce94f"),at.toColor("#729fcf"),at.toColor("#ad7fa8"),at.toColor("#34e2e2"),at.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let s=t[r/36%6|0],o=t[r/6%6|0],l=t[r%6];e.push({css:gt.toCss(s,o,l),rgba:gt.toRgba(s,o,l)})}for(let r=0;r<24;r++){let s=8+r*10;e.push({css:gt.toCss(s,s,s),rgba:gt.toRgba(s,s,s)})}return e})()),en=at.toColor("#ffffff"),Hs=at.toColor("#000000"),xm=at.toColor("#ffffff"),km=Hs,Ts={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},T1=en,sh=class extends ze{constructor(e){super(),this._optionsService=e,this._contrastCache=new Cm,this._halfContrastCache=new Cm,this._onChangeColors=this._register(new ve),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:en,background:Hs,cursor:xm,cursorAccent:km,selectionForeground:void 0,selectionBackgroundTransparent:Ts,selectionBackgroundOpaque:et.blend(Hs,Ts),selectionInactiveBackgroundTransparent:Ts,selectionInactiveBackgroundOpaque:et.blend(Hs,Ts),scrollbarSliderBackground:et.opacity(en,.2),scrollbarSliderHoverBackground:et.opacity(en,.4),scrollbarSliderActiveBackground:et.opacity(en,.5),overviewRulerBorder:en,ansi:yt.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=Ge(e.foreground,en),t.background=Ge(e.background,Hs),t.cursor=et.blend(t.background,Ge(e.cursor,xm)),t.cursorAccent=et.blend(t.background,Ge(e.cursorAccent,km)),t.selectionBackgroundTransparent=Ge(e.selectionBackground,Ts),t.selectionBackgroundOpaque=et.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ge(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=et.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ge(e.selectionForeground,_m):void 0,t.selectionForeground===_m&&(t.selectionForeground=void 0),et.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=et.opacity(t.selectionBackgroundTransparent,.3)),et.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=et.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ge(e.scrollbarSliderBackground,et.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ge(e.scrollbarSliderHoverBackground,et.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ge(e.scrollbarSliderActiveBackground,et.opacity(t.foreground,.5)),t.overviewRulerBorder=Ge(e.overviewRulerBorder,T1),t.ansi=yt.slice(),t.ansi[0]=Ge(e.black,yt[0]),t.ansi[1]=Ge(e.red,yt[1]),t.ansi[2]=Ge(e.green,yt[2]),t.ansi[3]=Ge(e.yellow,yt[3]),t.ansi[4]=Ge(e.blue,yt[4]),t.ansi[5]=Ge(e.magenta,yt[5]),t.ansi[6]=Ge(e.cyan,yt[6]),t.ansi[7]=Ge(e.white,yt[7]),t.ansi[8]=Ge(e.brightBlack,yt[8]),t.ansi[9]=Ge(e.brightRed,yt[9]),t.ansi[10]=Ge(e.brightGreen,yt[10]),t.ansi[11]=Ge(e.brightYellow,yt[11]),t.ansi[12]=Ge(e.brightBlue,yt[12]),t.ansi[13]=Ge(e.brightMagenta,yt[13]),t.ansi[14]=Ge(e.brightCyan,yt[14]),t.ansi[15]=Ge(e.brightWhite,yt[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<r;s++)t.ansi[s+16]=Ge(e.extendedAnsi[s],yt[s+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()}}};sh=ut([ye(0,Yt)],sh);function Ge(e,t){if(e!==void 0)try{return at.toColor(e)}catch{}return t}var j1=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},B1=class{constructor(){this._services=new j1,this._services.set(Th,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=Rw(e).sort((l,u)=>l.index-u.index),s=[];for(let l of r){let u=this._services.get(l.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.id._id}.`);s.push(u)}let o=r.length>0?r[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,...s)}},I1={trace:0,debug:1,info:2,warn:3,error:4,off:5},A1="xterm.js: ",oh=class extends ze{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=I1[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":A1)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};oh=ut([ye(0,Yt)],oh);var Em=class extends ze{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ve),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ve),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ve),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...r){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+r.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<r.length;s++)this._array[this._getCyclicIndex(e+s)]=r[s];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let s=this._length+r.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let o=t-1;o>=0;o--)this.set(e+o+r,this.get(e+o));let s=e+t+r-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+r,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Oe=3,mt=Object.freeze(new Xs),va=0,Yc=2,$s=class Qv{constructor(t,r,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Oe);let o=r||Ni.fromCharData([0,gv,1,0]);for(let l=0;l<t;++l)this.setCell(l,o);this.length=t}get(t){let r=this._data[t*Oe+0],s=r&2097151;return[this._data[t*Oe+1],r&2097152?this._combined[t]:s?Tr(s):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,r){this._data[t*Oe+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Oe+0]=t|2097152|r[2]<<22):this._data[t*Oe+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Oe+0]>>22}hasWidth(t){return this._data[t*Oe+0]&12582912}getFg(t){return this._data[t*Oe+1]}getBg(t){return this._data[t*Oe+2]}hasContent(t){return this._data[t*Oe+0]&4194303}getCodePoint(t){let r=this._data[t*Oe+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Oe+0]&2097152}getString(t){let r=this._data[t*Oe+0];return r&2097152?this._combined[t]:r&2097151?Tr(r&2097151):""}isProtected(t){return this._data[t*Oe+2]&536870912}loadCell(t,r){return va=t*Oe,r.content=this._data[va+0],r.fg=this._data[va+1],r.bg=this._data[va+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Oe+0]=r.content,this._data[t*Oe+1]=r.fg,this._data[t*Oe+2]=r.bg}setCellFromCodepoint(t,r,s,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*Oe+0]=r|s<<22,this._data[t*Oe+1]=o.fg,this._data[t*Oe+2]=o.bg}addCodepointToCell(t,r,s){let o=this._data[t*Oe+0];o&2097152?this._combined[t]+=Tr(r):o&2097151?(this._combined[t]=Tr(o&2097151)+Tr(r),o&=-2097152,o|=2097152):o=r|1<<22,s&&(o&=-12582913,o|=s<<22),this._data[t*Oe+0]=o}insertCells(t,r,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),r<this.length-t){let o=new Ni;for(let l=this.length-t-r-1;l>=0;--l)this.setCell(t+r+l,this.loadCell(t+l,o));for(let l=0;l<r;++l)this.setCell(t+l,s)}else for(let o=t;o<this.length;++o)this.setCell(o,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,r,s){if(t%=this.length,r<this.length-t){let o=new Ni;for(let l=0;l<this.length-t-r;++l)this.setCell(t+l,this.loadCell(t+r+l,o));for(let l=this.length-r;l<this.length;++l)this.setCell(l,s)}else for(let o=t;o<this.length;++o)this.setCell(o,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,r,s,o=!1){if(o){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,s);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,s);t<r&&t<this.length;)this.setCell(t++,s)}resize(t,r){if(t===this.length)return this._data.length*4*Yc<this._data.buffer.byteLength;let s=t*Oe;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let o=new Uint32Array(s);o.set(this._data),this._data=o}for(let o=this.length;o<t;++o)this.setCell(o,r)}else{this._data=this._data.subarray(0,s);let o=Object.keys(this._combined);for(let u=0;u<o.length;u++){let d=parseInt(o[u],10);d>=t&&delete this._combined[d]}let l=Object.keys(this._extendedAttrs);for(let u=0;u<l.length;u++){let d=parseInt(l[u],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,s*4*Yc<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Yc<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new Qv(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Oe+0]&4194303)return t+(this._data[t*Oe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Oe+0]&4194303||this._data[t*Oe+2]&50331648)return t+(this._data[t*Oe+0]>>22);return 0}copyCellsFrom(t,r,s,o,l){let u=t._data;if(l)for(let p=o-1;p>=0;p--){for(let m=0;m<Oe;m++)this._data[(s+p)*Oe+m]=u[(r+p)*Oe+m];u[(r+p)*Oe+2]&268435456&&(this._extendedAttrs[s+p]=t._extendedAttrs[r+p])}else for(let p=0;p<o;p++){for(let m=0;m<Oe;m++)this._data[(s+p)*Oe+m]=u[(r+p)*Oe+m];u[(r+p)*Oe+2]&268435456&&(this._extendedAttrs[s+p]=t._extendedAttrs[r+p])}let d=Object.keys(t._combined);for(let p=0;p<d.length;p++){let m=parseInt(d[p],10);m>=r&&(this._combined[m-r+s]=t._combined[m])}}translateToString(t,r,s,o){r=r??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),o&&(o.length=0);let l="";for(;r<s;){let u=this._data[r*Oe+0],d=u&2097151,p=u&2097152?this._combined[r]:d?Tr(d):jr;if(l+=p,o)for(let m=0;m<p.length;++m)o.push(r);r+=u>>22||1}return o&&o.push(r),l}};function O1(e,t,r,s,o,l){let u=[];for(let d=0;d<e.length-1;d++){let p=d,m=e.get(++p);if(!m.isWrapped)continue;let y=[e.get(d)];for(;p<e.length&&m.isWrapped;)y.push(m),m=e.get(++p);if(!l&&s>=d&&s<p){d+=y.length-1;continue}let w=0,_=Ys(y,w,t),v=1,b=0;for(;v<y.length;){let E=Ys(y,v,t),N=E-b,A=r-_,z=Math.min(N,A);y[w].copyCellsFrom(y[v],b,_,z,!1),_+=z,_===r&&(w++,_=0),b+=z,b===E&&(v++,b=0),_===0&&w!==0&&y[w-1].getWidth(r-1)===2&&(y[w].copyCellsFrom(y[w-1],r-1,_++,1,!1),y[w-1].setCell(r-1,o))}y[w].replaceCells(_,r,o);let k=0;for(let E=y.length-1;E>0&&(E>w||y[E].getTrimmedLength()===0);E--)k++;k>0&&(u.push(d+y.length-k),u.push(k)),d+=y.length-1}return u}function z1(e,t){let r=[],s=0,o=t[s],l=0;for(let u=0;u<e.length;u++)if(o===u){let d=t[++s];e.onDeleteEmitter.fire({index:u-l,amount:d}),u+=d-1,l+=d,o=t[++s]}else r.push(u);return{layout:r,countRemoved:l}}function F1(e,t){let r=[];for(let s=0;s<t.length;s++)r.push(e.get(t[s]));for(let s=0;s<r.length;s++)e.set(s,r[s]);e.length=t.length}function H1(e,t,r){let s=[],o=e.map((p,m)=>Ys(e,m,t)).reduce((p,m)=>p+m),l=0,u=0,d=0;for(;d<o;){if(o-d<r){s.push(o-d);break}l+=r;let p=Ys(e,u,t);l>p&&(l-=p,u++);let m=e[u].getWidth(l-1)===2;m&&l--;let y=m?r-1:r;s.push(y),d+=y}return s}function Ys(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,o=e[t+1].getWidth(0)===2;return s&&o?r-1:r}var Jv=class Zv{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Zv._nextId++,this._onDispose=this.register(new ve),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),on(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Jv._nextId=1;var $1=Jv,wt={},tn=wt.B;wt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};wt.A={"#":"£"};wt.B=void 0;wt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};wt.C=wt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};wt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};wt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};wt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};wt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};wt.E=wt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};wt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};wt.H=wt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};wt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Nm=4294967295,Rm=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=mt.clone(),this.savedCharset=tn,this.markers=[],this._nullCell=Ni.fromCharData([0,gv,1,0]),this._whitespaceCell=Ni.fromCharData([0,jr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Oa,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Em(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 ja),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 ja),this._whitespaceCell}getBlankLine(e,t){return new $s(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>Nm?Nm:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=mt);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 Em(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(mt),s=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++)s+=+this.lines.get(u).resize(e,r);let l=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 $s(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+l+1?(this.ybase--,l++,this.ydisp>0&&this.ydisp--):this.lines.push(new $s(e,r)));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),l&&(this.y+=l),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 l=0;l<this.lines.length;l++)s+=+this.lines.get(l).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,s=O1(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(mt),r);if(s.length>0){let o=z1(this.lines,s);F1(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let s=this.getNullCell(mt),o=r;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new $s(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(mt),o=[],l=0;for(let u=this.lines.length-1;u>=0;u--){let d=this.lines.get(u);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let p=[d];for(;d.isWrapped&&u>0;)d=this.lines.get(--u),p.unshift(d);if(!r){let z=this.ybase+this.y;if(z>=u&&z<u+p.length)continue}let m=p[p.length-1].getTrimmedLength(),y=H1(p,this._cols,e),w=y.length-p.length,_;this.ybase===0&&this.y!==this.lines.length-1?_=Math.max(0,this.y-this.lines.maxLength+w):_=Math.max(0,this.lines.length-this.lines.maxLength+w);let v=[];for(let z=0;z<w;z++){let I=this.getBlankLine(mt,!0);v.push(I)}v.length>0&&(o.push({start:u+p.length+l,newLines:v}),l+=v.length),p.push(...v);let b=y.length-1,k=y[b];k===0&&(b--,k=y[b]);let E=p.length-w-1,N=m;for(;E>=0;){let z=Math.min(N,k);if(p[b]===void 0)break;if(p[b].copyCellsFrom(p[E],N-z,k-z,z,!0),k-=z,k===0&&(b--,k=y[b]),N-=z,N===0){E--;let I=Math.max(E,0);N=Ys(p,I,this._cols)}}for(let z=0;z<p.length;z++)y[z]<e&&p[z].setCell(y[z],s);let A=w-_;for(;A-- >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+l)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+t-1)}if(o.length>0){let u=[],d=[];for(let k=0;k<this.lines.length;k++)d.push(this.lines.get(k));let p=this.lines.length,m=p-1,y=0,w=o[y];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let _=0;for(let k=Math.min(this.lines.maxLength-1,p+l-1);k>=0;k--)if(w&&w.start>m+_){for(let E=w.newLines.length-1;E>=0;E--)this.lines.set(k--,w.newLines[E]);k++,u.push({index:m+1,amount:w.newLines.length}),_+=w.newLines.length,w=o[++y]}else this.lines.set(k,d[m--]);let v=0;for(let k=u.length-1;k>=0;k--)u[k].index+=v,this.lines.onInsertEmitter.fire(u[k]),v+=u[k].amount;let b=Math.max(0,p+l-this.lines.maxLength);b>0&&this.lines.onTrimEmitter.fire(b)}}translateBufferLineToString(e,t,r=0,s){let o=this.lines.get(e);return o?o.translateToString(t,r,s):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new $1(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},W1=class extends ze{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ve),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 Rm(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Rm(!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)}},e_=2,t_=1,ah=class extends ze{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ve),this.onResize=this._onResize.event,this._onScroll=this._register(new ve),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,e_),this.rows=Math.max(e.rawOptions.rows||0,t_),this.buffers=this._register(new W1(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=r.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let o=r.ybase+r.scrollTop,l=r.ybase+r.scrollBottom;if(r.scrollTop===0){let u=r.lines.isFull;l===r.lines.length-1?u?r.lines.recycle().copyFrom(s):r.lines.push(s.clone()):r.lines.splice(l+1,0,s.clone()),u?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let u=l-o+1;r.lines.shiftElements(o+1,u-1,-1),r.lines.set(l,s.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let s=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),s!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};ah=ut([ye(0,Yt)],ah);var An={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:Aa,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},U1=["normal","bold","100","200","300","400","500","600","700","800","900"],q1=class extends ze{constructor(e){super(),this._onOptionChange=this._register(new ve),this.onOptionChange=this._onOptionChange.event;let t={...An};for(let r in e)if(r in t)try{let s=e[r];t[r]=this._sanitizeAndValidateOption(r,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(rt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in An))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,s)=>{if(!(r in An))throw new Error(`No option with key "${r}"`);s=this._sanitizeAndValidateOption(r,s),this.rawOptions[r]!==s&&(this.rawOptions[r]=s,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let s={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=An[e]),!K1(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=An[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=U1.includes(t)?t:An[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 K1(e){return e==="block"||e==="underline"||e==="bar"}function Ws(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let s in e)r[s]=t<=1?e[s]:e[s]&&Ws(e[s],t-1);return r}var Pm=Object.freeze({insertMode:!1}),Dm=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),lh=class extends ze{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ve),this.onData=this._onData.event,this._onUserInput=this._register(new ve),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ve),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ve),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Ws(Pm),this.decPrivateModes=Ws(Dm)}reset(){this.modes=Ws(Pm),this.decPrivateModes=Ws(Dm)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.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))}};lh=ut([ye(0,Vt),ye(1,wv),ye(2,Yt)],lh);var Lm={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 Xc(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var Gc=String.fromCharCode,Mm={DEFAULT:e=>{let t=[Xc(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Gc(t[0])}${Gc(t[1])}${Gc(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Xc(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Xc(e,!0)};${e.x};${e.y}${t}`}},ch=class extends ze{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ve),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(Lm))this.addProtocol(s,Lm[s]);for(let s of Object.keys(Mm))this.addEncoding(s,Mm[s]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let s=t/r,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=s+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,r){if(r){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};ch=ut([ye(0,Vt),ye(1,cn),ye(2,Yt)],ch);var Qc=[[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]],V1=[[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]],St;function Y1(e,t){let r=0,s=t.length-1,o;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=r;)if(o=r+s>>1,e>t[o][1])r=o+1;else if(e<t[o][0])s=o-1;else return!0;return!1}var X1=class{constructor(){if(this.version="6",!St){St=new Uint8Array(65536),St.fill(1),St[0]=0,St.fill(0,1,32),St.fill(0,127,160),St.fill(2,4352,4448),St[9001]=2,St[9002]=2,St.fill(2,11904,42192),St[12351]=1,St.fill(2,44032,55204),St.fill(2,63744,64256),St.fill(2,65040,65050),St.fill(2,65072,65136),St.fill(2,65280,65377),St.fill(2,65504,65511);for(let e=0;e<Qc.length;++e)St.fill(0,Qc[e][0],Qc[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?St[e]:Y1(e,V1)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),s=r===0&&t!==0;if(s){let o=rn.extractWidth(t);o===0?s=!1:o>r&&(r=o)}return rn.createPropertyValue(0,r,s)}},rn=class Na{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ve,this.onChange=this._onChange.event;let t=new X1;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,s=!1){return(t&16777215)<<3|(r&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,s=0,o=t.length;for(let l=0;l<o;++l){let u=t.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=o)return r+this.wcwidth(u);let m=t.charCodeAt(l);56320<=m&&m<=57343?u=(u-55296)*1024+m-56320+65536:r+=this.wcwidth(m)}let d=this.charProperties(u,s),p=Na.extractWidth(d);Na.extractShouldJoin(d)&&(p-=Na.extractWidth(s)),r+=p,s=d}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},G1=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 Tm(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var js=2147483647,Q1=256,i_=class uh{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>Q1)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new uh;if(!t.length)return r;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let o=t[s];if(Array.isArray(o))for(let l=0;l<o.length;++l)r.addSubParam(o[l]);else r.addParam(o)}return r}clone(){let t=new uh(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let r=0;r<this.length;++r){t.push(this.params[r]);let s=this._subParamsIdx[r]>>8,o=this._subParamsIdx[r]&255;o-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,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>js?js: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>js?js:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-r>0?this._subParams.subarray(r,s):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let s=this._subParamsIdx[r]>>8,o=this._subParamsIdx[r]&255;o-s>0&&(t[r]=this._subParams.slice(s,o))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,o=s[r-1];s[r-1]=~o?Math.min(o*10+t,js):t}},Bs=[],J1=class{constructor(){this._state=0,this._active=Bs,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,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=Bs}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=Bs,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Bs,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",Ua(e,t,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,s=this._active.length-1,o=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&r===!1){for(;s>=0&&(r=this._active[s].end(e),r!==!0);s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if(r=this._active[s].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=Bs,this._id=-1,this._state=0}}},di=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Ua(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},Is=[],Z1=class{constructor(){this._handlers=Object.create(null),this._active=Is,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Is}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,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=Is,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Is,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ua(e,t,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,s=this._active.length-1,o=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&r===!1){for(;s>=0&&(r=this._active[s].unhook(e),r!==!0);s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if(r=this._active[s].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=Is,this._ident=0}},Us=new i_;Us.addParam(0);var jm=class{constructor(e){this._handler=e,this._data="",this._params=Us,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Us,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Ua(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(r=>(this._params=Us,this._data="",this._hitLimit=!1,r));return this._params=Us,this._data="",this._hitLimit=!1,t}},eb=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,s){this.table[t<<8|e]=r<<4|s}addMany(e,t,r,s){for(let o=0;o<e.length;o++)this.table[t<<8|e[o]]=r<<4|s}},Ei=160,tb=(function(){let e=new eb(4095),t=Array.apply(null,Array(256)).map((d,p)=>p),r=(d,p)=>t.slice(d,p),s=r(32,127),o=r(0,24);o.push(25),o.push.apply(o,r(28,32));let l=r(0,14),u;e.setDefault(1,0),e.addMany(s,0,2,0);for(u in l)e.addMany([24,26,153,154],u,3,0),e.addMany(r(128,144),u,3,0),e.addMany(r(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(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,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(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Ei,0,2,0),e.add(Ei,8,5,8),e.add(Ei,6,0,6),e.add(Ei,11,0,11),e.add(Ei,13,13,13),e})(),ib=class extends ze{constructor(e=tb){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 i_,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(rt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new J1),this._dcsParser=this._register(new Z1),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;o<e.intermediates.length;++o){let l=e.intermediates.charCodeAt(o);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=s,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let s=this._escHandlers[r];return s.push(t),{dispose:()=>{let o=s.indexOf(t);o!==-1&&s.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 r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let s=this._csiHandlers[r];return s.push(t),{dispose:()=>{let o=s.indexOf(t);o!==-1&&s.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,r,s,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=s,this._parseStack.chunkPos=o}parse(e,t,r){let s=0,o=0,l=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&p>-1){for(;p>=0&&(u=d[p](this._params),u!==!0);p--)if(u instanceof Promise)return this._parseStack.handlerPos=p,u}this._parseStack.handlers=[];break;case 4:if(r===!1&&p>-1){for(;p>=0&&(u=d[p](),u!==!0);p--)if(u instanceof Promise)return this._parseStack.handlerPos=p,u}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(s!==24&&s!==26,r),u)return u;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],u=this._oscParser.end(s!==24&&s!==26,r),u)return u;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=l;d<t;++d){switch(s=e[d],o=this._transitions.table[this.currentState<<8|(s<160?s:Ei)],o>>4){case 2:for(let _=d+1;;++_){if(_>=t||(s=e[_])<32||s>126&&s<Ei){this._printHandler(e,d,_),d=_-1;break}if(++_>=t||(s=e[_])<32||s>126&&s<Ei){this._printHandler(e,d,_),d=_-1;break}if(++_>=t||(s=e[_])<32||s>126&&s<Ei){this._printHandler(e,d,_),d=_-1;break}if(++_>=t||(s=e[_])<32||s>126&&s<Ei){this._printHandler(e,d,_),d=_-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|s],m=p?p.length-1:-1;for(;m>=0&&(u=p[m](this._params),u!==!0);m--)if(u instanceof Promise)return this._preserveStack(3,p,m,o,d),u;m<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++d<t&&(s=e[d])>47&&s<60);d--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let y=this._escHandlers[this._collect<<8|s],w=y?y.length-1:-1;for(;w>=0&&(u=y[w](),u!==!0);w--)if(u instanceof Promise)return this._preserveStack(4,y,w,o,d),u;w<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let _=d+1;;++_)if(_>=t||(s=e[_])===24||s===26||s===27||s>127&&s<Ei){this._dcsParser.put(e,d,_),d=_-1;break}break;case 14:if(u=this._dcsParser.unhook(s!==24&&s!==26),u)return this._preserveStack(6,[],0,o,d),u;s===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 _=d+1;;_++)if(_>=t||(s=e[_])<32||s>127&&s<Ei){this._oscParser.put(e,d,_),d=_-1;break}break;case 6:if(u=this._oscParser.end(s!==24&&s!==26),u)return this._preserveStack(5,[],0,o,d),u;s===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},rb=/^([\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})$/,nb=/^[\da-f]+$/;function Bm(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=rb.exec(t);if(r){let s=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/s*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/s*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),nb.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,s=[0,0,0];for(let o=0;o<3;++o){let l=parseInt(t.slice(r*o,r*o+r),16);s[o]=r===1?l<<4:r===2?l:r===3?l>>4:l>>8}return s}}function Jc(e,t){let r=e.toString(16),s=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function sb(e,t=16){let[r,s,o]=e;return`rgb:${Jc(r,t)}/${Jc(s,t)}/${Jc(o,t)}`}var ob={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Lr=131072,Im=10;function Am(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 Om=5e3,zm=0,ab=class extends ze{constructor(e,t,r,s,o,l,u,d,p=new ib){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=s,this._optionsService=o,this._oscLinkService=l,this._coreMouseService=u,this._unicodeService=d,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Ew,this._utf8Decoder=new Nw,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=mt.clone(),this._eraseAttrDataInternal=mt.clone(),this._onRequestBell=this._register(new ve),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ve),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ve),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ve),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ve),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ve),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ve),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ve),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ve),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ve),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ve),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ve),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ve),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 hh(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(m=>this._activeBuffer=m.activeBuffer)),this._parser.setCsiHandlerFallback((m,y)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(m),params:y.toArray()})}),this._parser.setEscHandlerFallback(m=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(m)})}),this._parser.setExecuteHandlerFallback(m=>{this._logService.debug("Unknown EXECUTE code: ",{code:m})}),this._parser.setOscHandlerFallback((m,y,w)=>{this._logService.debug("Unknown OSC code: ",{identifier:m,action:y,data:w})}),this._parser.setDcsHandlerFallback((m,y,w)=>{y==="HOOK"&&(w=w.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(m),action:y,payload:w})}),this._parser.setPrintHandler((m,y,w)=>this.print(m,y,w)),this._parser.registerCsiHandler({final:"@"},m=>this.insertChars(m)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},m=>this.scrollLeft(m)),this._parser.registerCsiHandler({final:"A"},m=>this.cursorUp(m)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},m=>this.scrollRight(m)),this._parser.registerCsiHandler({final:"B"},m=>this.cursorDown(m)),this._parser.registerCsiHandler({final:"C"},m=>this.cursorForward(m)),this._parser.registerCsiHandler({final:"D"},m=>this.cursorBackward(m)),this._parser.registerCsiHandler({final:"E"},m=>this.cursorNextLine(m)),this._parser.registerCsiHandler({final:"F"},m=>this.cursorPrecedingLine(m)),this._parser.registerCsiHandler({final:"G"},m=>this.cursorCharAbsolute(m)),this._parser.registerCsiHandler({final:"H"},m=>this.cursorPosition(m)),this._parser.registerCsiHandler({final:"I"},m=>this.cursorForwardTab(m)),this._parser.registerCsiHandler({final:"J"},m=>this.eraseInDisplay(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},m=>this.eraseInDisplay(m,!0)),this._parser.registerCsiHandler({final:"K"},m=>this.eraseInLine(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},m=>this.eraseInLine(m,!0)),this._parser.registerCsiHandler({final:"L"},m=>this.insertLines(m)),this._parser.registerCsiHandler({final:"M"},m=>this.deleteLines(m)),this._parser.registerCsiHandler({final:"P"},m=>this.deleteChars(m)),this._parser.registerCsiHandler({final:"S"},m=>this.scrollUp(m)),this._parser.registerCsiHandler({final:"T"},m=>this.scrollDown(m)),this._parser.registerCsiHandler({final:"X"},m=>this.eraseChars(m)),this._parser.registerCsiHandler({final:"Z"},m=>this.cursorBackwardTab(m)),this._parser.registerCsiHandler({final:"`"},m=>this.charPosAbsolute(m)),this._parser.registerCsiHandler({final:"a"},m=>this.hPositionRelative(m)),this._parser.registerCsiHandler({final:"b"},m=>this.repeatPrecedingCharacter(m)),this._parser.registerCsiHandler({final:"c"},m=>this.sendDeviceAttributesPrimary(m)),this._parser.registerCsiHandler({prefix:">",final:"c"},m=>this.sendDeviceAttributesSecondary(m)),this._parser.registerCsiHandler({final:"d"},m=>this.linePosAbsolute(m)),this._parser.registerCsiHandler({final:"e"},m=>this.vPositionRelative(m)),this._parser.registerCsiHandler({final:"f"},m=>this.hVPosition(m)),this._parser.registerCsiHandler({final:"g"},m=>this.tabClear(m)),this._parser.registerCsiHandler({final:"h"},m=>this.setMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"h"},m=>this.setModePrivate(m)),this._parser.registerCsiHandler({final:"l"},m=>this.resetMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"l"},m=>this.resetModePrivate(m)),this._parser.registerCsiHandler({final:"m"},m=>this.charAttributes(m)),this._parser.registerCsiHandler({final:"n"},m=>this.deviceStatus(m)),this._parser.registerCsiHandler({prefix:"?",final:"n"},m=>this.deviceStatusPrivate(m)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},m=>this.softReset(m)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},m=>this.setCursorStyle(m)),this._parser.registerCsiHandler({final:"r"},m=>this.setScrollRegion(m)),this._parser.registerCsiHandler({final:"s"},m=>this.saveCursor(m)),this._parser.registerCsiHandler({final:"t"},m=>this.windowOptions(m)),this._parser.registerCsiHandler({final:"u"},m=>this.restoreCursor(m)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},m=>this.insertColumns(m)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},m=>this.deleteColumns(m)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},m=>this.selectProtected(m)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},m=>this.requestMode(m,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},m=>this.requestMode(m,!1)),this._parser.setExecuteHandler(ce.BEL,()=>this.bell()),this._parser.setExecuteHandler(ce.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ce.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ce.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ce.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ce.BS,()=>this.backspace()),this._parser.setExecuteHandler(ce.HT,()=>this.tab()),this._parser.setExecuteHandler(ce.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ce.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(ka.IND,()=>this.index()),this._parser.setExecuteHandler(ka.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(ka.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new di(m=>(this.setTitle(m),this.setIconName(m),!0))),this._parser.registerOscHandler(1,new di(m=>this.setIconName(m))),this._parser.registerOscHandler(2,new di(m=>this.setTitle(m))),this._parser.registerOscHandler(4,new di(m=>this.setOrReportIndexedColor(m))),this._parser.registerOscHandler(8,new di(m=>this.setHyperlink(m))),this._parser.registerOscHandler(10,new di(m=>this.setOrReportFgColor(m))),this._parser.registerOscHandler(11,new di(m=>this.setOrReportBgColor(m))),this._parser.registerOscHandler(12,new di(m=>this.setOrReportCursorColor(m))),this._parser.registerOscHandler(104,new di(m=>this.restoreIndexedColor(m))),this._parser.registerOscHandler(110,new di(m=>this.restoreFgColor(m))),this._parser.registerOscHandler(111,new di(m=>this.restoreBgColor(m))),this._parser.registerOscHandler(112,new di(m=>this.restoreCursorColor(m))),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 m in wt)this._parser.registerEscHandler({intermediates:"(",final:m},()=>this.selectCharset("("+m)),this._parser.registerEscHandler({intermediates:")",final:m},()=>this.selectCharset(")"+m)),this._parser.registerEscHandler({intermediates:"*",final:m},()=>this.selectCharset("*"+m)),this._parser.registerEscHandler({intermediates:"+",final:m},()=>this.selectCharset("+"+m)),this._parser.registerEscHandler({intermediates:"-",final:m},()=>this.selectCharset("-"+m)),this._parser.registerEscHandler({intermediates:".",final:m},()=>this.selectCharset("."+m)),this._parser.registerEscHandler({intermediates:"/",final:m},()=>this.selectCharset("/"+m));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(m=>(this._logService.error("Parsing error: ",m),m)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new jm((m,y)=>this.requestStatusString(m,y)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),Om))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Om} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,s=this._activeBuffer.x,o=this._activeBuffer.y,l=0,u=this._parseStack.paused;if(u){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;s=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Lr&&(l=this._parseStack.position+Lr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,m=>String.fromCharCode(m)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(m=>m.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Lr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Lr))),u||this._dirtyRowTracker.clearRange(),e.length>Lr)for(let m=l;m<e.length;m+=Lr){let y=m+Lr<e.length?m+Lr:e.length,w=typeof e=="string"?this._stringDecoder.decode(e.substring(m,y),this._parseBuffer):this._utf8Decoder.decode(e.subarray(m,y),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,w))return this._preserveStack(s,o,w,m),this._logSlowResolvingAsync(r),r}else if(!u){let m=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,m))return this._preserveStack(s,o,m,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==s||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,r){let s,o,l=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,m=this._coreService.modes.insertMode,y=this._curAttrData,w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&w.getWidth(this._activeBuffer.x-1)===2&&w.setCellFromCodepoint(this._activeBuffer.x-1,0,1,y);let _=this._parser.precedingJoinState;for(let v=t;v<r;++v){if(s=e[v],s<127&&l){let N=l[String.fromCharCode(s)];N&&(s=N.charCodeAt(0))}let b=this._unicodeService.charProperties(s,_);o=rn.extractWidth(b);let k=rn.extractShouldJoin(b),E=k?rn.extractWidth(_):0;if(_=b,u&&this._onA11yChar.fire(Tr(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-E>d){if(p){let N=w,A=this._activeBuffer.x-E;for(this._activeBuffer.x=E,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&w instanceof $s&&w.copyCellsFrom(N,A,0,E,!1);A<d;)N.setCellFromCodepoint(A++,0,1,y)}else if(this._activeBuffer.x=d-1,o===2)continue}if(k&&this._activeBuffer.x){let N=w.getWidth(this._activeBuffer.x-1)?1:2;w.addCodepointToCell(this._activeBuffer.x-N,s,o);for(let A=o-E;--A>=0;)w.setCellFromCodepoint(this._activeBuffer.x++,0,0,y);continue}if(m&&(w.insertCells(this._activeBuffer.x,o-E,this._activeBuffer.getNullCell(y)),w.getWidth(d-1)===2&&w.setCellFromCodepoint(d-1,0,1,y)),w.setCellFromCodepoint(this._activeBuffer.x++,s,o,y),o>0)for(;--o;)w.setCellFromCodepoint(this._activeBuffer.x++,0,0,y)}this._parser.precedingJoinState=_,this._activeBuffer.x<d&&r-t>0&&w.getWidth(this._activeBuffer.x)===0&&!w.hasContent(this._activeBuffer.x)&&w.setCellFromCodepoint(this._activeBuffer.x,0,1,y),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>Am(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new jm(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new di(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,s=!1,o=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),o),s&&(l.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&s.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let 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 r=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(o-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(s,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(mt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let r=e.params[0]||1,s=rn.extractWidth(t),o=this._activeBuffer.x-s,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),u=new Uint32Array(l.length*r),d=0;for(let m=0;m<l.length;){let y=l.codePointAt(m)||0;u[d++]=y,m+=y>65535?2:1}let p=d;for(let m=1;m<r;++m)u.copyWithin(p,0,d),p+=d;return this.print(u,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ce.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ce.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ce.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ce.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ce.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,tn),this._charsetService.setgCharset(1,tn),this._charsetService.setgCharset(2,tn),this._charsetService.setgCharset(3,tn);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){(k=>(k[k.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",k[k.SET=1]="SET",k[k.RESET=2]="RESET",k[k.PERMANENTLY_SET=3]="PERMANENTLY_SET",k[k.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let s=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:l}=this._coreMouseService,u=this._coreService,{buffers:d,cols:p}=this._bufferService,{active:m,alt:y}=d,w=this._optionsService.rawOptions,_=(k,E)=>(u.triggerDataEvent(`${ce.ESC}[${t?"":"?"}${k};${E}$y`),!0),v=k=>k?1:2,b=e.params[0];return t?b===2?_(b,4):b===4?_(b,v(u.modes.insertMode)):b===12?_(b,3):b===20?_(b,v(w.convertEol)):_(b,0):b===1?_(b,v(s.applicationCursorKeys)):b===3?_(b,w.windowOptions.setWinLines?p===80?2:p===132?1:0:0):b===6?_(b,v(s.origin)):b===7?_(b,v(s.wraparound)):b===8?_(b,3):b===9?_(b,v(o==="X10")):b===12?_(b,v(w.cursorBlink)):b===25?_(b,v(!u.isCursorHidden)):b===45?_(b,v(s.reverseWraparound)):b===66?_(b,v(s.applicationKeypad)):b===67?_(b,4):b===1e3?_(b,v(o==="VT200")):b===1002?_(b,v(o==="DRAG")):b===1003?_(b,v(o==="ANY")):b===1004?_(b,v(s.sendFocus)):b===1005?_(b,4):b===1006?_(b,v(l==="SGR")):b===1015?_(b,4):b===1016?_(b,v(l==="SGR_PIXELS")):b===1048?_(b,1):b===47||b===1047||b===1049?_(b,v(m===y)):b===2004?_(b,v(s.bracketedPasteMode)):b===2026?_(b,v(s.synchronizedOutput)):_(b,0)}_updateAttrColor(e,t,r,s,o){return t===2?(e|=50331648,e&=-16777216,e|=Xs.fromColorRGB([r,s,o])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let s=[0,0,-1,0,0,0],o=0,l=0;do{if(s[l+o]=e.params[t+l],e.hasSubParams(t+l)){let u=e.getSubParams(t+l),d=0;do s[1]===5&&(o=1),s[l+d+1+o]=u[d];while(++d<u.length&&d+l+1+o<s.length);break}if(s[1]===5&&l+o>=2||s[1]===2&&l+o>=5)break;s[1]&&(o=1)}while(++l+t<e.length&&l+o<s.length);for(let u=2;u<s.length;++u)s[u]===-1&&(s[u]=0);switch(s[0]){case 38:r.fg=this._updateAttrColor(r.fg,s[1],s[3],s[4],s[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,s[1],s[3],s[4],s[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,s[1],s[3],s[4],s[5])}return l}_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=mt.fg,e.bg=mt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,s=this._curAttrData;for(let o=0;o<t;o++)r=e.params[o],r>=30&&r<=37?(s.fg&=-50331904,s.fg|=16777216|r-30):r>=40&&r<=47?(s.bg&=-50331904,s.bg|=16777216|r-40):r>=90&&r<=97?(s.fg&=-50331904,s.fg|=16777216|r-90|8):r>=100&&r<=107?(s.bg&=-50331904,s.bg|=16777216|r-100|8):r===0?this._processSGR0(s):r===1?s.fg|=134217728:r===3?s.bg|=67108864:r===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,s)):r===5?s.fg|=536870912:r===7?s.fg|=67108864:r===8?s.fg|=1073741824:r===9?s.fg|=2147483648:r===2?s.bg|=134217728:r===21?this._processUnderline(2,s):r===22?(s.fg&=-134217729,s.bg&=-134217729):r===23?s.bg&=-67108865:r===24?(s.fg&=-268435457,this._processUnderline(0,s)):r===25?s.fg&=-536870913:r===27?s.fg&=-67108865:r===28?s.fg&=-1073741825:r===29?s.fg&=2147483647:r===39?(s.fg&=-67108864,s.fg|=mt.fg&16777215):r===49?(s.bg&=-67108864,s.bg|=mt.bg&16777215):r===38||r===48||r===58?o+=this._extractColor(e,o,s):r===53?s.bg|=1073741824:r===55?s.bg&=-1073741825:r===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):r===100?(s.fg&=-67108864,s.fg|=mt.fg&16777215,s.bg&=-67108864,s.bg|=mt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ce.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ce.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ce.ESC}[?${t};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=mt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Am(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(`${ce.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Im&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Im&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let s=r.shift(),o=r.shift();if(/^\d+$/.exec(s)){let l=parseInt(s);if(Fm(l))if(o==="?")t.push({type:0,index:l});else{let u=Bm(o);u&&t.push({type:1,index:l,color:u})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(r,s):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),s,o=r.findIndex(l=>l.startsWith("id="));return o!==-1&&(s=r[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let r=e.split(";");for(let s=0;s<r.length&&!(t>=this._specialColors.length);++s,++t)if(r[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let o=Bm(r[s]);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=[],r=e.split(";");for(let s=0;s<r.length;++s)if(/^\d+$/.exec(r[s])){let o=parseInt(r[s]);Fm(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,tn),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(ob[e[0]],wt[e[1]]||tn),!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=mt.clone(),this._eraseAttrDataInternal=mt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Ni;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(r);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=u=>(this._coreService.triggerDataEvent(`${ce.ESC}${u}${ce.ESC}\\`),!0),s=this._bufferService.buffer,o=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.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)}},hh=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&&(zm=e,e=t,t=zm),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};hh=ut([ye(0,Vt)],hh);function Fm(e){return 0<=e&&e<256}var lb=5e7,Hm=12,cb=50,ub=class extends ze{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 ve),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>lb)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],o=this._action(s,t);if(o){let u=d=>performance.now()-r>=Hm?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(r,d);o.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(u);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-r>=Hm)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>cb&&(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()}},dh=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let d=t.addMarker(t.ybase+t.y),p={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(p,d)),this._dataByLinkId.set(p.id,p),p.id}let r=e,s=this._getEntryIdKey(r),o=this._entriesWithId.get(s);if(o)return this.addLineToLink(o.id,t.ybase+t.y),o.id;let l=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);r.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(r,s))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};dh=ut([ye(0,Vt)],dh);var $m=!1,hb=class extends ze{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Wn),this._onBinary=this._register(new ve),this.onBinary=this._onBinary.event,this._onData=this._register(new ve),this.onData=this._onData.event,this._onLineFeed=this._register(new ve),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ve),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ve),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ve),this._instantiationService=new B1,this.optionsService=this._register(new q1(e)),this._instantiationService.setService(Yt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(ah)),this._instantiationService.setService(Vt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(oh)),this._instantiationService.setService(wv,this._logService),this.coreService=this._register(this._instantiationService.createInstance(lh)),this._instantiationService.setService(cn,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(ch)),this._instantiationService.setService(Sv,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(rn)),this._instantiationService.setService(Lw,this.unicodeService),this._charsetService=this._instantiationService.createInstance(G1),this._instantiationService.setService(Dw,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(dh),this._instantiationService.setService(bv,this._oscLinkService),this._inputHandler=this._register(new ab(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(It.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(It.forward(this._bufferService.onResize,this._onResize)),this._register(It.forward(this.coreService.onData,this._onData)),this._register(It.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 ub((t,r)=>this._inputHandler.parse(t,r))),this._register(It.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ve),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&&!$m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),$m=!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,e_),t=Math.max(t,t_),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(Tm.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Tm(this._bufferService),!1))),this._windowsWrappingHeuristics.value=rt(()=>{for(let t of e)t.dispose()})}}},db={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 fb(e,t,r,s){var u;let o={type:0,cancel:!1,key:void 0},l=(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=ce.ESC+"OA":o.key=ce.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=ce.ESC+"OD":o.key=ce.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=ce.ESC+"OC":o.key=ce.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=ce.ESC+"OB":o.key=ce.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":ce.DEL,e.altKey&&(o.key=ce.ESC+o.key);break;case 9:if(e.shiftKey){o.key=ce.ESC+"[Z";break}o.key=ce.HT,o.cancel=!0;break;case 13:o.key=e.altKey?ce.ESC+ce.CR:ce.CR,o.cancel=!0;break;case 27:o.key=ce.ESC,e.altKey&&(o.key=ce.ESC+ce.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;l?o.key=ce.ESC+"[1;"+(l+1)+"D":t?o.key=ce.ESC+"OD":o.key=ce.ESC+"[D";break;case 39:if(e.metaKey)break;l?o.key=ce.ESC+"[1;"+(l+1)+"C":t?o.key=ce.ESC+"OC":o.key=ce.ESC+"[C";break;case 38:if(e.metaKey)break;l?o.key=ce.ESC+"[1;"+(l+1)+"A":t?o.key=ce.ESC+"OA":o.key=ce.ESC+"[A";break;case 40:if(e.metaKey)break;l?o.key=ce.ESC+"[1;"+(l+1)+"B":t?o.key=ce.ESC+"OB":o.key=ce.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=ce.ESC+"[2~");break;case 46:l?o.key=ce.ESC+"[3;"+(l+1)+"~":o.key=ce.ESC+"[3~";break;case 36:l?o.key=ce.ESC+"[1;"+(l+1)+"H":t?o.key=ce.ESC+"OH":o.key=ce.ESC+"[H";break;case 35:l?o.key=ce.ESC+"[1;"+(l+1)+"F":t?o.key=ce.ESC+"OF":o.key=ce.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=ce.ESC+"[5;"+(l+1)+"~":o.key=ce.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=ce.ESC+"[6;"+(l+1)+"~":o.key=ce.ESC+"[6~";break;case 112:l?o.key=ce.ESC+"[1;"+(l+1)+"P":o.key=ce.ESC+"OP";break;case 113:l?o.key=ce.ESC+"[1;"+(l+1)+"Q":o.key=ce.ESC+"OQ";break;case 114:l?o.key=ce.ESC+"[1;"+(l+1)+"R":o.key=ce.ESC+"OR";break;case 115:l?o.key=ce.ESC+"[1;"+(l+1)+"S":o.key=ce.ESC+"OS";break;case 116:l?o.key=ce.ESC+"[15;"+(l+1)+"~":o.key=ce.ESC+"[15~";break;case 117:l?o.key=ce.ESC+"[17;"+(l+1)+"~":o.key=ce.ESC+"[17~";break;case 118:l?o.key=ce.ESC+"[18;"+(l+1)+"~":o.key=ce.ESC+"[18~";break;case 119:l?o.key=ce.ESC+"[19;"+(l+1)+"~":o.key=ce.ESC+"[19~";break;case 120:l?o.key=ce.ESC+"[20;"+(l+1)+"~":o.key=ce.ESC+"[20~";break;case 121:l?o.key=ce.ESC+"[21;"+(l+1)+"~":o.key=ce.ESC+"[21~";break;case 122:l?o.key=ce.ESC+"[23;"+(l+1)+"~":o.key=ce.ESC+"[23~";break;case 123:l?o.key=ce.ESC+"[24;"+(l+1)+"~":o.key=ce.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=ce.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=ce.DEL:e.keyCode===219?o.key=ce.ESC:e.keyCode===220?o.key=ce.FS:e.keyCode===221&&(o.key=ce.GS);else if((!r||s)&&e.altKey&&!e.metaKey){let d=(u=db[e.keyCode])==null?void 0:u[e.shiftKey?1:0];if(d)o.key=ce.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,m=String.fromCharCode(p);e.shiftKey&&(m=m.toUpperCase()),o.key=ce.ESC+m}else if(e.keyCode===32)o.key=ce.ESC+(e.ctrlKey?ce.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),o.key=ce.ESC+p,o.cancel=!0}}else r&&!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=ce.US),e.key==="@"&&(o.key=ce.NUL));break}return o}var ft=0,pb=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Oa,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Oa,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,l)=>this._getKey(o)-this._getKey(l)),t=0,r=0,s=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<s.length;o++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(s[o]=e[t],t++):s[o]=this._array[r++];this._array=s,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||(ft=this._search(t),ft===-1)||this._getKey(this._array[ft])!==t)return!1;do if(this._array[ft]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ft),!0;while(++ft<this._array.length&&this._getKey(this._array[ft])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,l)=>o-l),t=0,r=new Array(this._array.length-e.length),s=0;for(let o=0;o<this._array.length;o++)e[t]===o?t++:r[s++]=this._array[o];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ft=this._search(e),!(ft<0||ft>=this._array.length)&&this._getKey(this._array[ft])===e))do yield this._array[ft];while(++ft<this._array.length&&this._getKey(this._array[ft])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ft=this._search(e),!(ft<0||ft>=this._array.length)&&this._getKey(this._array[ft])===e))do t(this._array[ft]);while(++ft<this._array.length&&this._getKey(this._array[ft])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let s=t+r>>1,o=this._getKey(this._array[s]);if(o>e)r=s-1;else if(o<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},Zc=0,Wm=0,mb=class extends ze{constructor(){super(),this._decorations=new pb(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ve),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ve),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(rt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new gb(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let s=0,o=0;for(let l of this._decorations.getKeyIterator(t))s=l.options.x??0,o=s+(l.options.width??1),e>=s&&e<o&&(!r||(l.options.layer??"bottom")===r)&&(yield l)}forEachDecorationAtCell(e,t,r,s){this._decorations.forEachByKey(t,o=>{Zc=o.options.x??0,Wm=Zc+(o.options.width??1),e>=Zc&&e<Wm&&(!r||(o.options.layer??"bottom")===r)&&s(o)})}},gb=class extends Br{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ve),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ve),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=at.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=at.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},vb=1e3,_b=class{constructor(e,t=vb){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let o=s-this._lastRefreshMs,l=this._debounceThresholdMS-o;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},l)}}_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)}},Um=20,za=class extends ze{constructor(e,t,r,s){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=s,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 l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,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 _b(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(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
64
|
-
`))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Me(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(rt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Um+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
65
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Um+1&&(this._liveRegion.textContent+=Mu.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,s=r.lines.length.toString();for(let o=e;o<=t;o++){let l=r.lines.get(r.ydisp+o),u=[],d=(l==null?void 0:l.translateToString(!0,void 0,void 0,u))||"",p=(r.ydisp+o+1).toString(),m=this._rowElements[o];m&&(d.length===0?(m.textContent=" ",this._rowColumns.set(m,[0,1])):(m.textContent=d,this._rowColumns.set(m,u)),m.setAttribute("aria-posinset",p),m.setAttribute("aria-setsize",s),this._alignRowWidth(m))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],o=r.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(o===l||e.relatedTarget!==s)return;let u,d;if(t===0?(u=r,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(u=this._rowElements.shift(),d=r,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var d;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let s=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:s,offset:((d=s.textContent)==null?void 0:d.length)??0}),!this._rowContainer.contains(r.node))return;let o=({node:p,offset:m})=>{let y=p instanceof Text?p.parentNode:p,w=parseInt(y==null?void 0:y.getAttribute("aria-posinset"),10)-1;if(isNaN(w))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(y);if(!_)return console.warn("columns is null. Race condition?"),null;let v=m<_.length?_[m]:_.slice(-1)[0]+1;return v>=this._terminal.cols&&(++w,v=0),{row:w,column:v}},l=o(t),u=o(r);if(!(!l||!u)){if(l.row>u.row||l.row===u.row&&l.column>=u.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(u.row-l.row)*this._terminal.cols-l.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,l;e.style.transform="";let t=e.getBoundingClientRect().width,r=(l=(o=this._rowColumns.get(e))==null?void 0:o.slice(-1))==null?void 0:l[0];if(!r)return;let s=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};za=ut([ye(1,Th),ye(2,lr),ye(3,cr)],za);var fh=class extends ze{constructor(e,t,r,s,o){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=s,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ve),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ve),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(rt(()=>{var l;on(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(l=this._activeProviderReplies)==null||l.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Me(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Me(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Me(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Me(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let s=0;s<r.length;s++){let o=r[s];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 s,o;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(l=>{l==null||l.forEach(u=>{u.link.dispose&&u.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[l,u]of this._linkProviderService.linkProviders.entries())t?(o=this._activeProviderReplies)!=null&&o.get(l)&&(r=this._checkLinkProviderResult(l,e,r)):u.provideLinks(e.y,d=>{var m,y;if(this._isMouseOut)return;let p=d==null?void 0:d.map(w=>({link:w}));(m=this._activeProviderReplies)==null||m.set(l,p),r=this._checkLinkProviderResult(l,e,r),((y=this._activeProviderReplies)==null?void 0:y.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let s=0;s<t.size;s++){let o=t.get(s);if(o)for(let l=0;l<o.length;l++){let u=o[l],d=u.link.range.start.y<e?0:u.link.range.start.x,p=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let m=d;m<=p;m++){if(r.has(m)){o.splice(l--,1);break}r.add(m)}}}}_checkLinkProviderResult(e,t,r){var l;if(!this._activeProviderReplies)return r;let s=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&&s){let u=s.find(d=>this._linkAtPosition(d.link,t));u&&(r=!0,this._handleNewLink(u))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let u=0;u<this._activeProviderReplies.size;u++){let d=(l=this._activeProviderReplies.get(u))==null?void 0:l.find(p=>this._linkAtPosition(p.link,t));if(d){r=!0,this._handleNewLink(d);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&yb(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,on(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,s;return(s=(r=this._currentLink)==null?void 0:r.state)==null?void 0:s.decorations.pointerCursor},set:r=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,s;return(s=(r=this._currentLink)==null?void 0:r.state)==null?void 0:s.decorations.underline},set:r=>{var s,o,l;(s=this._currentLink)!=null&&s.state&&((l=(o=this._currentLink)==null?void 0:o.state)==null?void 0:l.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let s=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(s,o),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,t,r){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,s=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-s-1,r.end.x,r.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,t,r){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,o=t.y*this._bufferService.cols+t.x;return r<=o&&o<=s}_positionFromMouseEvent(e,t,r){let s=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,s,o){return{x1:e,y1:t,x2:r,y2:s,cols:this._bufferService.cols,fg:o}}};fh=ut([ye(1,jh),ye(2,cr),ye(3,Vt),ye(4,xv)],fh);function yb(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 Sb=class extends hb{constructor(e={}){super(e),this._linkifier=this._register(new Wn),this.browser=Wv,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Wn),this._onCursorMove=this._register(new ve),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ve),this.onKey=this._onKey.event,this._onRender=this._register(new ve),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ve),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ve),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ve),this.onBell=this._onBell.event,this._onFocus=this._register(new ve),this._onBlur=this._register(new ve),this._onA11yCharEmitter=this._register(new ve),this._onA11yTabEmitter=this._register(new ve),this._onWillOpen=this._register(new ve),this._setup(),this._decorationService=this._instantiationService.createInstance(mb),this._instantiationService.setService(Gs,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(c1),this._instantiationService.setService(xv,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(ju)),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(It.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(It.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(It.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(It.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(rt(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,s="";switch(t.index){case 256:r="foreground",s="10";break;case 257:r="background",s="11";break;case 258:r="cursor",s="12";break;default:r="ansi",s="4;"+t.index}switch(t.type){case 0:let o=et.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${ce.ESC}]${s};${sb(o)}${Hv.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=gt.toColor(...t.color));else{let l=r;this._themeService.modifyColors(u=>u[l]=gt.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(za,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ce.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(ce.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,o=t.getWidth(r),l=this._renderService.dimensions.css.cell.width*o,u=this.buffer.y*this._renderService.dimensions.css.cell.height,d=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=u+"px",this.textarea.style.width=l+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Me(this.element,"copy",t=>{this.hasSelection()&&xw(t,this._selectionService)}));let e=t=>kw(t,this.textarea,this.coreService,this.optionsService);this._register(Me(this.textarea,"paste",e)),this._register(Me(this.element,"paste",e)),Uv?this._register(Me(this.element,"mousedown",t=>{t.button===2&&em(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Me(this.element,"contextmenu",t=>{em(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),$h&&this._register(Me(this.element,"auxclick",t=>{t.button===1&&mv(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Me(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Me(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Me(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Me(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Me(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Me(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Me(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(Me(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Lu.get()),Vv||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(a1,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(lr,this._coreBrowserService),this._register(Me(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Me(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(th,this._document,this._helperContainer),this._instantiationService.setService(qa,this._charSizeService),this._themeService=this._instantiationService.createInstance(sh),this._instantiationService.setService(qn,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ia),this._instantiationService.setService(Cv,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(rh,this.rows,this.screenElement)),this._instantiationService.setService(cr,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Ju,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ih),this._instantiationService.setService(jh,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(fh,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(Gu,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(nh,this.element,this.screenElement,s)),this._instantiationService.setService(Tw,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(It.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var l;this._selectionService.refresh(),(l=this._viewport)==null||l.queueSync()})),this._register(this._instantiationService.createInstance(Qu,this.screenElement)),this._register(Me(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),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(za,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ba,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ba,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(eh,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(l){var m,y,w,_,v;let u=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!u)return!1;let d,p;switch(l.overrideType||l.type){case"mousemove":p=32,l.buttons===void 0?(d=3,l.button!==void 0&&(d=l.button<3?l.button:3)):d=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":p=0,d=l.button<3?l.button:3;break;case"mousedown":p=1,d=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let b=l.deltaY;if(b===0||e.coreMouseService.consumeWheelEvent(l,(_=(w=(y=(m=e._renderService)==null?void 0:m.dimensions)==null?void 0:y.device)==null?void 0:w.cell)==null?void 0:_.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return!1;p=b<0?0:1,d=4;break;default:return!1}return p===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:d,action:p,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:l=>(r(l),l.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(l)),wheel:l=>(r(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&r(l)},mousemove:l=>{l.buttons||r(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),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()),l&8?s.mousemove||(t.addEventListener("mousemove",o.mousemove),s.mousemove=o.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),l&16?s.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),s.wheel=o.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),l&2?s.mouseup||(s.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),l&4?s.mousedrag||(s.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Me(t,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return r(l),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(l)})),this._register(Me(t,"wheel",l=>{var u,d,p,m,y;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(l,(m=(p=(d=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:d.device)==null?void 0:p.cell)==null?void 0:m.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return this.cancel(l,!0);let w=ce.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(w,!0),this.cancel(l,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){pv(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var r;(r=this._selectionService)==null||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=fb(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let s=this.rows-1;return this.scrollLines(r.type===2?-s:s),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===ce.ETX||r.key===ce.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(wb(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(mt));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(ce.ESC+"[I"):this.coreService.triggerDataEvent(ce.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ce.ESC}[4;${r};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ce.ESC}[6;${o};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function wb(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var bb=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Cb=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Ni)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},qm=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 Cb(t)}getNullCell(){return new Ni}},xb=class extends ze{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ve),this.onBufferChange=this._onBufferChange.event,this._normal=new qm(this._core.buffers.normal,"normal"),this._alternate=new qm(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)}},kb=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,s)=>t(r,s.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)}},Eb=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}},Nb=["cols","rows"],Wi=0,Rb=class extends ze{constructor(e){super(),this._core=this._register(new Sb(e)),this._addonManager=this._register(new bb),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],r=(s,o)=>{this._checkReadonlyOptions(s),this._core.options[s]=o};for(let s in this._core.options){let o={get:t.bind(this,s),set:r.bind(this,s)};Object.defineProperty(this._publicOptions,s,o)}}_checkReadonlyOptions(e){if(Nb.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 kb(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Eb(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 xb(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
66
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Lu.get()},set promptLabel(e){Lu.set(e)},get tooMuchOutput(){return Mu.get()},set tooMuchOutput(e){Mu.set(e)}}}_verifyIntegers(...e){for(Wi of e)if(Wi===1/0||isNaN(Wi)||Wi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Wi of e)if(Wi&&(Wi===1/0||isNaN(Wi)||Wi%1!==0||Wi<0))throw new Error("This API only accepts positive integers")}};/**
|
|
67
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
68
|
-
* @license MIT
|
|
69
|
-
*
|
|
70
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
71
|
-
* @license MIT
|
|
72
|
-
*
|
|
73
|
-
* Originally forked from (with the author's permission):
|
|
74
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
75
|
-
* http://bellard.org/jslinux/
|
|
76
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
77
|
-
*/var Pb=2,Db=1,Lb=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 w;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:((w=this._terminal.options.overviewRuler)==null?void 0:w.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(r.getPropertyValue("height")),o=Math.max(0,parseInt(r.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),u={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},d=u.top+u.bottom,p=u.right+u.left,m=s-d,y=o-p-t;return{cols:Math.max(Pb,Math.floor(y/e.css.cell.width)),rows:Math.max(Db,Math.floor(m/e.css.cell.height))}}};function Mb(e,t){return e?`/api/route/${String(e).split("/").map(encodeURIComponent).join("/")}/_/ws?token=${encodeURIComponent(t||"")}`:"/ws"}function Tb({session:e,node:t,token:r,cols:s,rows:o,readonly:l=!1,takeSize:u,focused:d,onData:p,onExit:m,onFiles:y,retryBaseMs:w=250}){const _=["localhost","127.0.0.1","::1","[::1]"].includes(location.hostname);if(location.protocol!=="https:"&&!_)throw new Error("nexuscrew: ws:// rifiutato su origine non-locale e non-TLS (apri via tunnel su localhost o servi in HTTPS)");const b=`${location.protocol==="https:"?"wss":"ws"}://${location.host}${Mb(t,r)}`;let k=null,E=!1,N=!1,A=null,z=0,I=d;const U=()=>{if(E||N||A)return;const B=Math.min(5e3,Math.max(0,w)*2**Math.min(z++,5));A=setTimeout(()=>{A=null,O()},B)},O=()=>{if(E||N)return;const B=new WebSocket(b);k=B,B.binaryType="arraybuffer",B.onopen=()=>{if(k!==B||E)return;z=0;const X={type:"attach",session:e,token:r,cols:s,rows:o,readonly:l};u!==void 0&&(X.takeSize=u),B.send(JSON.stringify(X)),I!==void 0&&B.send(JSON.stringify({type:"focus",on:!!I}))},B.onmessage=X=>{if(!(k!==B||E))if(typeof X.data=="string"){let q;try{q=JSON.parse(X.data)}catch{return}q.type==="exit"&&(N=!0,m&&m(q.code)),q.type==="files"&&y&&y(q)}else p&&p(new Uint8Array(X.data))},B.onerror=()=>{if(k===B)try{B.close()}catch{}},B.onclose=X=>{k!==B||E||N||[1e3,1002,4401,4404].includes(X==null?void 0:X.code)||U()}};return O(),{sendInput:B=>{if(!k||k.readyState!==1)return!1;try{return k.send(typeof B=="string"?new TextEncoder().encode(B):B),!0}catch{try{k.close()}catch{}return!1}},isReady:()=>!!k&&k.readyState===1,resize:(B,X)=>{s=B,o=X,(k==null?void 0:k.readyState)===1&&k.send(JSON.stringify({type:"resize",cols:B,rows:X}))},action:B=>{(k==null?void 0:k.readyState)===1&&k.send(JSON.stringify({type:"action",name:B}))},focus:B=>{I=B,(k==null?void 0:k.readyState)===1&&k.send(JSON.stringify({type:"focus",on:!!B}))},close:()=>{if(E=!0,A&&clearTimeout(A),A=null,k)try{k.close()}catch{}},get raw(){return k}}}async function Km(e){const t=String(e||"");if(!t)return!1;try{if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")return await navigator.clipboard.writeText(t),!0}catch{}try{const r=document.createElement("textarea");r.value=t,r.readOnly=!0,r.style.position="fixed",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r),r.select();const s=document.execCommand&&document.execCommand("copy");if(r.remove(),s)return!0}catch{}return!1}const jb="\r";function Bb(e){const t=String(e||"");let r=t.length;for(;r>0;){const s=t.charCodeAt(r-1);if(s===10||s===13)r-=1;else break}return t.slice(0,r)}function Ib({isReady:e,paste:t,send:r}){return s=>{if(!s||!e())return!1;try{return t(s)===!1||!e()?!1:r(jb)!==!1}catch{return!1}}}function Ab(e){return!e||typeof e!="object"?!1:!!e.shiftKey}function Ob(e){return!e||typeof e!="object"||String(e.key||"").toLowerCase()!=="c"?!1:!!(e.metaKey||e.ctrlKey&&e.shiftKey)}const zb=450,Vm=8;function Fb(e,t,r,s){return Math.abs(Number(r)-Number(e))>Vm||Math.abs(Number(s)-Number(t))>Vm}const Hb=new Map([["image/png","png"],["image/jpeg","jpg"],["image/gif","gif"],["image/webp","webp"],["application/pdf","pdf"],["text/plain","txt"]]);function eu(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 Ym(e){if(!e)return[];const t=Array.from(e.files||[]).filter(Boolean);return t.length?t:Array.from(e.items||[]).filter(r=>r&&r.kind==="file"&&typeof r.getAsFile=="function").map(r=>r.getAsFile()).filter(Boolean)}function $b(e,t=0,r=Date.now()){const s=String((e==null?void 0:e.name)||"").trim();if(s)return s;const o=Hb.get(String((e==null?void 0:e.type)||"").toLowerCase())||"bin";return`clipboard-${r}-${t+1}.${o}`}async function r_({files:e,token:t,session:r,node:s="",paste:o=!0,fetchImpl:l=Pt,onProgress:u=()=>{},now:d=Date.now()}={}){const p=Array.from(e||[]).filter(Boolean),m=[],y=[];if(!r||!p.length)return{paths:m,errors:y};const w=mi(s?String(s).split("/"):[]);for(let _=0;_<p.length;_+=1){const v=p[_],b=$b(v,_,d);u({index:_,total:p.length,name:b,state:"uploading"});try{const k=new FormData;k.append("session",r),k.append("paste",o?"true":"false"),k.append("file",v,b);const E=await l(`${w}/files/upload`,t,{method:"POST",body:k}),N=await E.json().catch(()=>({}));if(!E.ok||N.error)throw new Error(N.error||`HTTP ${E.status}`);m.push(N.path),u({index:_,total:p.length,name:b,state:"done",path:N.path})}catch(k){const E=String((k==null?void 0:k.message)||k);y.push({name:b,message:E}),u({index:_,total:p.length,name:b,state:"error",error:E})}}return{paths:m,errors:y}}function n_({session:e,node:t,token:r,readonly:s,takeSize:o,focused:l,sendRef:u,composerRef:d,actionRef:p,ctrlRef:m,setCtrlArmed:y,onFiles:w,fontSize:_=13,selectionMode:v=!1,onSelectionModeChange:b}){const k=L.useRef(null),E=L.useRef(null),N=L.useRef(_);N.current=_;const A=L.useRef(l);A.current=l;const z=L.useRef(v);z.current=v;const[I,U]=L.useState(""),[O,B]=L.useState(""),[X,q]=L.useState(null),re=async()=>{var j,J,F,Q;const x=((J=(j=E.current)==null?void 0:j.term)==null?void 0:J.getSelection())||I;if(!x){B(S("copy-empty")),setTimeout(()=>B(""),1500);return}const P=await Km(x);B(S(P?"copied":"copy-manual")),P&&((Q=(F=E.current)==null?void 0:F.term)==null||Q.clearSelection(),b==null||b(!1)),setTimeout(()=>B(""),1800)},te=L.useRef(re);return te.current=re,L.useEffect(()=>{const x=E.current;x&&x.sock&&x.sock.focus&&x.sock.focus(!!l)},[l]),L.useEffect(()=>{const x=E.current;x&&(x.term.options.fontSize=_,x.fit.fit(),x.sock.resize(x.term.cols,x.term.rows))},[_]),L.useEffect(()=>{const x=new Rb({cursorBlink:!0,fontSize:N.current,scrollback:1e3,theme:{background:"#0a0e0a"}}),P=new Lb;x.loadAddon(P),x.open(k.current),P.fit();const j=new TextDecoder;let J;try{J=Tb({session:e,node:t,token:r,readonly:s,takeSize:o,focused:A.current,onFiles:w,cols:x.cols,rows:x.rows,onData:pe=>x.write(j.decode(pe)),onExit:()=>x.write(`\r
|
|
78
|
-
\x1B[33m[sessione finita]\x1B[0m\r
|
|
79
|
-
`)})}catch(pe){return x.write(`\r
|
|
80
|
-
\x1B[31m${pe.message}\x1B[0m\r
|
|
81
|
-
`),()=>x.dispose()}E.current={term:x,fit:P,sock:J};let F=null;const Q=x.onData(pe=>{if(s){F&&(F.ok=!1);return}if(!F&&m&&m.current&&pe.length===1){const qe=pe.charCodeAt(0);let le=qe;qe>=97&&qe<=122?le=qe-96:qe>=64&&qe<=95?le=qe-64:qe===32&&(le=0),pe=String.fromCharCode(le),m.current=!1,y&&y(!1)}const Fe=J.sendInput(pe);F&&(F.seen=!0,F.ok=F.ok&&Fe)});u&&(u.current=pe=>J.sendInput(pe)),p&&(p.current=pe=>J.action(pe)),d&&(d.current=Ib({isReady:()=>!s&&J.isReady(),paste:pe=>{const Fe={seen:!1,ok:!0};F=Fe;try{x.paste(pe)}catch{Fe.ok=!1}finally{F=null}return Fe.seen&&Fe.ok},send:pe=>J.sendInput(pe)}));const $=x.onSelectionChange(()=>U(x.getSelection()));x.attachCustomKeyEventHandler(pe=>(pe.ctrlKey||pe.metaKey)&&pe.key.toLowerCase()==="c"&&x.getSelection()?(pe.type==="keydown"&&Km(x.getSelection()),!1):!0);const K=k.current;let G=!1;const R=async pe=>{if(!pe.length||G)return;if(s){q({error:S("settings-readonly")});return}G=!0,q({current:0,total:pe.length,name:""});const Fe=await r_({files:pe,token:r,session:e,node:t,paste:!0,onProgress:({index:qe,total:le,name:ke,state:Be,error:Mt})=>q({current:qe+1,total:le,name:ke,...Be==="error"?{error:Mt}:{}})});G=!1,Fe.errors.length?q({error:Fe.errors.map(qe=>`${qe.name}: ${qe.message}`).join(" · ")}):(q({done:!0,total:Fe.paths.length}),setTimeout(()=>q(null),1600))},Z=pe=>{const Fe=pe.clipboardData;if(!eu(Fe))return;const qe=Ym(Fe);qe.length&&(pe.preventDefault(),pe.stopPropagation(),R(qe))},D=pe=>{eu(pe.dataTransfer)&&(pe.preventDefault(),pe.stopPropagation())},T=pe=>{eu(pe.dataTransfer)&&(pe.preventDefault(),pe.stopPropagation(),R(Ym(pe.dataTransfer)))};K.addEventListener("paste",Z,!0),K.addEventListener("dragenter",D,!0),K.addEventListener("dragover",D,!0),K.addEventListener("drop",T,!0);const se=24;let oe=null,ae=null,ge=0,we=null,_e=null,W=null,Y=!1;const ue=()=>{W&&clearTimeout(W),W=null},Ne=(pe,Fe)=>{const le=(K.querySelector(".xterm-screen")||K).getBoundingClientRect(),ke=Math.max(0,Math.min(x.cols-1,Math.floor((pe-le.left)/Math.max(1,le.width)*x.cols))),Be=Math.max(0,Math.min(x.rows-1,Math.floor((Fe-le.top)/Math.max(1,le.height)*x.rows)));return{col:ke,row:x.buffer.active.viewportY+Be}},Te=pe=>Ne(pe.clientX,pe.clientY),Ve=pe=>{if(ue(),Y=!1,pe.touches.length!==1){oe=null;return}if(z.current){pe.preventDefault(),pe.stopPropagation(),_e=Te(pe.touches[0]),x.clearSelection();return}oe=pe.touches[0].clientY,ae=pe.touches[0].clientX,ge=0,we=null;const Fe={x:ae,y:oe};W=setTimeout(()=>{W=null,Y=!0,z.current=!0,b==null||b(!0),_e=Ne(Fe.x,Fe.y),x.clearSelection(),x.select(_e.col,_e.row,1),oe=null,ae=null,we=null,ge=0},zb)},tt=pe=>{if((z.current||Y)&&_e&&pe.touches.length===1){pe.preventDefault(),pe.stopPropagation();const qe=Te(pe.touches[0]),le=_e.row*x.cols+_e.col,ke=qe.row*x.cols+qe.col,Be=le<=ke?_e:qe;x.select(Be.col,Be.row,Math.abs(ke-le)+1);return}if(oe===null||pe.touches.length!==1)return;pe.preventDefault(),pe.stopPropagation();const Fe=pe.touches[0];if(W&&Fb(ae,oe,Fe.clientX,Fe.clientY)&&ue(),we===null&&(Math.abs(Fe.clientY-oe)>8||Math.abs(Fe.clientX-ae)>8)&&(we=Math.abs(Fe.clientY-oe)>Math.abs(Fe.clientX-ae)),!!we){for(ge+=Fe.clientY-oe,oe=Fe.clientY;ge>=se;)J.action("scroll-up"),ge-=se;for(;ge<=-se;)J.action("scroll-down"),ge+=se}},De=()=>{ue(),oe=null,ae=null,_e=null,Y=!1};let Ue=0;const Ye=pe=>{for(pe.preventDefault(),pe.stopPropagation(),Ue+=pe.deltaY;Ue<=-se;)J.action("scroll-up"),Ue+=se;for(;Ue>=se;)J.action("scroll-down"),Ue-=se};K.addEventListener("touchstart",Ve,{passive:!1}),K.addEventListener("touchmove",tt,{passive:!1,capture:!0}),K.addEventListener("touchend",De,{passive:!0}),K.addEventListener("touchcancel",De,{passive:!0});const At=pe=>{(z.current||Y)&&(pe.preventDefault(),pe.stopPropagation())};K.addEventListener("contextmenu",At,!0),K.addEventListener("wheel",Ye,{passive:!1,capture:!0});let Lt=null;const je=pe=>{Ab(pe)&&(pe.preventDefault(),pe.stopPropagation(),Lt=Ne(pe.clientX,pe.clientY),x.clearSelection())},ri=pe=>{if(!Lt)return;pe.preventDefault(),pe.stopPropagation();const Fe=Ne(pe.clientX,pe.clientY),qe=Lt.row*x.cols+Lt.col,le=Fe.row*x.cols+Fe.col,ke=qe<=le?Lt:Fe;x.select(ke.col,ke.row,Math.abs(le-qe)+1)},Ar=pe=>{Lt&&(pe.stopPropagation(),Lt=null)};K.addEventListener("mousedown",je,!0),K.addEventListener("mousemove",ri,!0),K.addEventListener("mouseup",Ar,!0);const Or=pe=>{!Ob(pe)||!(E.current&&E.current.term&&E.current.term.getSelection())||(pe.preventDefault(),pe.stopPropagation(),te.current&&te.current())};K.addEventListener("keydown",Or,!0);const Wt=()=>{P.fit(),J.resize(x.cols,x.rows)};window.addEventListener("resize",Wt);const ni=window.visualViewport;ni&&(ni.addEventListener("resize",Wt),ni.addEventListener("scroll",Wt));let Gi=null,si=0;return typeof ResizeObserver<"u"&&(Gi=new ResizeObserver(()=>{si&&cancelAnimationFrame(si),si=requestAnimationFrame(Wt)}),Gi.observe(K)),()=>{E.current=null,u&&(u.current=()=>!1),d&&(d.current=()=>!1),p&&(p.current=()=>!1),Q.dispose(),$.dispose(),K.removeEventListener("touchstart",Ve),K.removeEventListener("touchmove",tt,{capture:!0}),K.removeEventListener("touchend",De),K.removeEventListener("touchcancel",De),K.removeEventListener("contextmenu",At,!0),ue(),K.removeEventListener("wheel",Ye,{capture:!0}),K.removeEventListener("mousedown",je,!0),K.removeEventListener("mousemove",ri,!0),K.removeEventListener("mouseup",Ar,!0),K.removeEventListener("keydown",Or,!0),K.removeEventListener("paste",Z,!0),K.removeEventListener("dragenter",D,!0),K.removeEventListener("dragover",D,!0),K.removeEventListener("drop",T,!0),window.removeEventListener("resize",Wt),ni&&(ni.removeEventListener("resize",Wt),ni.removeEventListener("scroll",Wt)),Gi&&Gi.disconnect(),si&&cancelAnimationFrame(si),J.close(),x.dispose()}},[e,t,r,s,o,u,d,p,m,y,w]),h.jsxs("div",{className:`nc-terminal${v?" selecting":""}`,children:[h.jsx("div",{className:"nc-terminal-host",ref:k}),X&&h.jsx("div",{className:`nc-upload-state${X.error?" error":""}`,role:"status",children:X.error?X.error:X.done?S("attach-uploaded").replace("{n}",String(X.total||0)):S("attach-upload-progress").replace("{n}",String(X.current||0)).replace("{total}",String(X.total||0))}),(I||v)&&h.jsxs("div",{className:"nc-selection-tools",children:[I?h.jsx("button",{type:"button",onClick:re,children:O||S("copy")}):h.jsx("span",{children:S("select-drag")}),h.jsx("button",{type:"button",onClick:()=>{var x,P;(P=(x=E.current)==null?void 0:x.term)==null||P.clearSelection(),U(""),b==null||b(!1)},children:S("cancel")}),O===S("copy-manual")&&h.jsx("textarea",{readOnly:!0,value:I,onFocus:x=>x.target.select()})]})]})}const Xm="",ii="\x1B",Wb=[{label:"↑",seq:ii+"[A"},{label:"↓",seq:ii+"[B"},{label:"PGUP",seq:ii+"[5~"},{label:"PGDN",seq:ii+"[6~"}];function Ub({send:e,action:t,ctrlArmed:r=!1,onCtrl:s,onKeyboard:o,selectionMode:l=!1,onSelectionMode:u}){const[d,p]=L.useState(!1),[m,y]=L.useState(!1),[w,_]=L.useState(!1),v=E=>{w?(e(ii+E),_(!1)):e(E)},b=(E,N,A)=>h.jsx("button",{onMouseDown:z=>{z.preventDefault(),v(N),A&&A()},children:E},E),k=(E,N)=>h.jsx("button",{onMouseDown:A=>{A.preventDefault(),t(N),y(!1)},children:E},E);return d?h.jsxs("div",{className:"nc-keybar copy",children:[h.jsx("span",{className:"tag",children:"copy-mode"}),Wb.map(E=>b(E.label,E.seq)),b("ESCI (q)","q",()=>p(!1))]}):h.jsxs("div",{className:"nc-keybar termux",children:[m&&h.jsxs("div",{className:"nc-keymenu",children:[k("←WIN","prev-window"),k("WIN→","next-window"),k("⬅PANE","pane-left"),k("PANE➡","pane-right"),b("SCROLL",Xm+"[",()=>{p(!0),y(!1)}),h.jsx("button",{className:l?"armed":"",onMouseDown:E=>{E.preventDefault(),u==null||u(!l),y(!1)},children:"SELECT"}),b("⌃C","",()=>y(!1)),b("DETACH",Xm+"d",()=>y(!1))]}),h.jsxs("div",{className:"row",children:[b("ESC",ii),h.jsx("button",{className:m?"armed":"",onMouseDown:E=>{E.preventDefault(),y(N=>!N)},children:"☰"},"menu"),b("/","/"),b("—","-"),b("HOME",ii+"[H"),b("↑",ii+"[A"),b("END",ii+"[F"),b("PGUP",ii+"[5~")]}),h.jsxs("div",{className:"row",children:[b("⇥"," "),h.jsx("button",{onMouseDown:E=>{E.preventDefault(),o&&o()},children:"⌨"},"kbd"),h.jsx("button",{className:r?"armed":"",onMouseDown:E=>{E.preventDefault(),s&&s()},children:"CTRL"},"ctrl"),h.jsx("button",{className:w?"armed":"",onMouseDown:E=>{E.preventDefault(),_(N=>!N)},children:"ALT"},"alt"),b("←",ii+"[D"),b("↓",ii+"[B"),b("→",ii+"[C"),b("PGDN",ii+"[6~")]})]})}const qb=e=>e>1048576?`${(e/1048576).toFixed(1)}M`:e>1024?`${(e/1024).toFixed(0)}K`:`${e}B`;function s_({session:e,node:t,token:r,filesEvent:s,onClose:o}){vi();const l=t?`/api/route/${String(t).split("/").map(encodeURIComponent).join("/")}/_`:"/api",u=t?`${t}:${e}`:e,[d,p]=L.useState("outbox"),[m,y]=L.useState({inbox:[],outbox:[]}),[w,_]=L.useState(""),v=L.useRef(null);async function b(){try{const z=await(await Pt(`${l}/files?session=${encodeURIComponent(e)}`,r)).json();if(z.error){_(z.error);return}y(z);const I=z.outbox[0]?z.outbox[0].mtime:0;localStorage.setItem(Ra(u),String(I))}catch(A){_(String(A))}}L.useEffect(()=>{b()},[e,t]),L.useEffect(()=>{s&&s.session===e&&b()},[s]);async function k(A){for(const z of A){_(`carico ${z.name}…`);const I=new FormData;I.append("session",e),I.append("file",z);try{const O=await(await Pt(`${l}/files/upload`,r,{method:"POST",body:I})).json();_(O.error?`errore: ${O.error}`:"")}catch(U){_(String(U))}}b()}async function E(A){const z=await Pt(`${l}/files/download?session=${encodeURIComponent(e)}&box=${d}&name=${encodeURIComponent(A)}`,r);if(!z.ok){_("errore download");return}const I=await z.blob(),U=URL.createObjectURL(I),O=document.createElement("a");O.href=U,O.download=A,O.click(),URL.revokeObjectURL(U)}async function N(A){await Pt(`${l}/files?session=${encodeURIComponent(e)}&box=${d}&name=${encodeURIComponent(A)}`,r,{method:"DELETE"}),b()}return h.jsxs("div",{className:"nc-files",children:[h.jsxs("header",{children:[h.jsx("b",{children:t?`${t}:${e}`:e}),h.jsx("button",{onClick:o,title:S("close"),children:h.jsx(Ke,{name:"x",size:20})})]}),h.jsxs("nav",{children:[h.jsx("button",{className:d==="outbox"?"on":"",onClick:()=>p("outbox"),children:"outbox"}),h.jsx("button",{className:d==="inbox"?"on":"",onClick:()=>p("inbox"),children:"inbox"}),h.jsxs("button",{className:"up",onClick:()=>v.current&&v.current.click(),children:[h.jsx(Ke,{name:"upload",size:18})," ",S("upload")]}),h.jsx("input",{type:"file",multiple:!0,ref:v,style:{display:"none"},onChange:A=>{k(Array.from(A.target.files||[])),A.target.value=""}})]}),w&&h.jsx("div",{className:"nc-busy",children:w}),h.jsxs("ul",{children:[m[d].map(A=>h.jsxs("li",{children:[h.jsx("span",{className:"name",onClick:()=>E(A.name),children:A.name}),h.jsx("small",{children:qb(A.size)}),h.jsx("button",{onClick:()=>N(A.name),title:"elimina",children:h.jsx(Ke,{name:"trash",size:18})})]},A.name)),m[d].length===0&&h.jsx("li",{className:"empty",children:S("empty-files")})]})]})}function o_({submitText:e,token:t,session:r,node:s}){vi();const o=s?`/api/route/${String(s).split("/").map(encodeURIComponent).join("/")}/_`:"/api",[l,u]=L.useState(""),[d,p]=L.useState(!1),[m,y]=L.useState(""),[w,_]=L.useState(!1),v=L.useRef(null),b=L.useRef(null),k=L.useRef(null),[E,N]=L.useState(!1),[A,z]=L.useState({left:0,bottom:0}),[I,U]=L.useState(!1),[O,B]=L.useState(!1),X=L.useRef(null),q=L.useRef(null),re=L.useRef(null),te=L.useRef(null),x=L.useRef(null),P=L.useRef(`nc-attach-${Math.random().toString(36).slice(2,8)}`);L.useEffect(()=>{let D=!1;if(s){_(!1);return}return Pt(`${o}/voice/status`,t).then(T=>T.json()).then(T=>{D||_(!!T.serverSttConfigured)}).catch(()=>{D||_(!1)}),()=>{D=!0}},[t,o]);const J=!!(typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)||w);async function F(){const D=l,T=Bb(D);if(!T||O)return;B(!0),y("");let se=!1;try{se=!!await e(T)}catch{se=!1}se?u(oe=>oe===D?"":oe):y(S("composer-send-failed")),B(!1),requestAnimationFrame(()=>{var oe;return(oe=k.current)==null?void 0:oe.focus({preventScroll:!0})})}function Q(){const D=X.current&&X.current.getBoundingClientRect();D&&z({left:Math.max(6,Math.min(D.left,window.innerWidth-186)),bottom:window.innerHeight-D.top+6}),N(!0)}function $(D){N(!1),D&&X.current&&X.current.focus()}L.useEffect(()=>{if(!E)return;const D=se=>{se.key==="Escape"&&$(!0)},T=se=>{const oe=q.current&&q.current.contains(se.target),ae=X.current&&X.current.contains(se.target);!oe&&!ae&&$(!1)};return document.addEventListener("keydown",D),document.addEventListener("pointerdown",T),()=>{document.removeEventListener("keydown",D),document.removeEventListener("pointerdown",T)}},[E]);function K(D){$(!1),D.current&&D.current.click()}async function G(D){if(!D.length||!r)return;U(!0),y("");const{paths:T,errors:se}=await r_({files:D,token:t,session:r,node:s,paste:!1});se.length&&y(se.map(oe=>`${oe.name}: ${oe.message}`).join(" · ")),T.length&&u(oe=>oe+(oe&&!oe.endsWith(" ")?" ":"")+T.join(" ")),U(!1)}function R(){v.current&&v.current.stop(),b.current&&b.current.stop(),p(!1)}async function Z(){y("");const D=window.SpeechRecognition||window.webkitSpeechRecognition;if(D){const T=new D;T.lang="it-IT",T.continuous=!1,T.interimResults=!0;const se=l?`${l} `:"";T.onresult=oe=>{const ae=Array.from(oe.results).map(ge=>ge[0].transcript).join("");u(se+ae)},T.onend=()=>p(!1),T.onerror=oe=>{y(`voice: ${oe.error||"errore"}`),p(!1)},v.current=T,T.start(),p(!0);return}try{const T=await navigator.mediaDevices.getUserMedia({audio:!0}),se=new MediaRecorder(T),oe=[];se.ondataavailable=ae=>oe.push(ae.data),se.onstop=async()=>{T.getTracks().forEach(ae=>ae.stop()),p(!1),y("trascrivo…");try{const ae=new Blob(oe,{type:se.mimeType||"audio/webm"}),we=await(await Pt(`${o}/voice/transcribe`,t,{method:"POST",headers:{"content-type":"application/octet-stream"},body:ae})).json();we.error?y(we.error):(y(""),u(_e=>_e+(_e?" ":"")+(we.text||"")))}catch(ae){y(String(ae))}},b.current={stop:()=>se.state!=="inactive"&&se.stop()},se.start(),p(!0)}catch{y("microfono non disponibile"),p(!1)}}return h.jsxs("div",{className:"nc-composer",children:[m&&h.jsx("div",{className:"nc-composer-err",children:m}),h.jsxs("div",{className:"nc-composer-row",children:[r&&h.jsx("button",{ref:X,className:I?"attach busy":"attach",disabled:I,onClick:()=>E?$(!1):Q(),title:S(I?"attach-uploading":"attach"),"aria-label":S("attach"),"aria-haspopup":"menu","aria-expanded":E,"aria-controls":P.current,children:h.jsx(Ke,{name:"attach",size:22})}),E&&h.jsxs("div",{ref:q,id:P.current,role:"menu",className:"nc-attach-menu",style:{left:A.left,bottom:A.bottom},children:[h.jsxs("button",{role:"menuitem",onClick:()=>K(re),children:[h.jsx(Ke,{name:"file",size:18})," ",S("attach-file")]}),h.jsxs("button",{role:"menuitem",onClick:()=>K(te),children:[h.jsx(Ke,{name:"camera",size:18})," ",S("attach-camera")]}),h.jsxs("button",{role:"menuitem",onClick:()=>K(x),children:[h.jsx(Ke,{name:"image",size:18})," ",S("attach-gallery")]})]}),h.jsx("input",{ref:re,type:"file",multiple:!0,hidden:!0,onChange:D=>{G(Array.from(D.target.files||[])),D.target.value=""}}),h.jsx("input",{ref:te,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:D=>{G(Array.from(D.target.files||[])),D.target.value=""}}),h.jsx("input",{ref:x,type:"file",accept:"image/*,video/*",multiple:!0,hidden:!0,onChange:D=>{G(Array.from(D.target.files||[])),D.target.value=""}}),h.jsx("textarea",{ref:k,rows:2,value:l,placeholder:S("composer-placeholder"),onChange:D=>u(D.target.value)}),J&&h.jsx("button",{className:d?"mic on":"mic",onClick:d?R:Z,title:S("voice"),children:h.jsx(Ke,{name:"mic",size:22})}),h.jsx("button",{type:"button",className:"go",disabled:O,onPointerDown:D=>D.preventDefault(),onClick:F,title:S("send"),children:h.jsx(Ke,{name:"enter",size:22})})]})]})}function Fa(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 Gm(e){return String(e||"?").replace(/^[^a-zA-Z0-9]+/,"").charAt(0).toUpperCase()||"?"}function _a(e,t){if(!(e!=null&&e.outbox)||e.outbox.count<1)return!1;const r=Number(localStorage.getItem(Ra(t))||0);return e.outbox.latest>r}const Kb=180,Vb=480;function tu(e){return e.status==="passive"?S("node-passive"):e.status==="down"?e.downSince?S("tunnel-down-since").replace("{t}",Fa(e.downSince)):S("tunnel-down"):e.status==="unreachable"?S("node-unreachable"):e.status==="offline"?e.lastSeen?S("node-offline-seen").replace("{t}",Fa(e.lastSeen)):S("node-offline"):e.status==="needs-repair"?S("node-needs-repair"):""}function Yb(e){return!e||e.status==="passive"?null:e.status==="healthy"?"on":"warn"}function Qm(e){return e&&(e.detail||e.status)||""}function Xb({sessions:e=[],cells:t=[],activeSessions:r=[],nodeGroups:s=[],onPick:o,onAddTile:l,onPower:u,onNodePower:d,onKill:p,onNew:m,onSettings:y,width:w=240,collapsed:_=!1,onResize:v,onToggleCollapse:b}){const[k,E]=vi(),[N,A]=L.useState(nv),[z,I]=L.useState(lv),U=D=>A(T=>sv(T,D)),O=new Set((t||[]).map(D=>D.tmuxSession)),B=new Map((e||[]).map(D=>[D.name,D])),X=(D,T)=>lw(N,D,T),q=cw,re=[...t||[]].sort((D,T)=>q(X(D.tmuxSession,(B.get(D.tmuxSession)||{}).activity),X(T.tmuxSession,(B.get(T.tmuxSession)||{}).activity))),te=(e||[]).filter(D=>!O.has(D.name)).sort((D,T)=>q(X(D.name,D.activity),X(T.name,T.activity))||D.name.localeCompare(T.name)),x=new Set(r||[]),P=D=>Da(z,D),j=(D,T)=>I(se=>{const oe={...se,[D]:{...Da(se,D),...T}};return cv(oe)}),J=La([...re.map(D=>{const T=B.get(D.tmuxSession)||{},se=or([],D.tmuxSession);return{type:"cell",value:D,key:se,label:D.cell,live:!!D.tmux,fresh:_a(T,se),activity:T.activity||0}}),...te.map(D=>{const T=or([],D.name);return{type:"session",value:D,key:T,label:D.name,live:!0,fresh:_a(D,T),activity:D.activity||0}})],N,P("local").filter),[F,Q]=L.useState(null),$=(D,T)=>{const se=D.currentTarget.getBoundingClientRect();Q({text:T,y:se.top+se.height/2})},K=()=>Q(null),G=L.useRef(null);L.useEffect(()=>()=>{G.current&&G.current()},[]);function R(D){D.preventDefault(),D.stopPropagation();const T=D.clientX,se=w,oe=ge=>{const we=Math.max(Kb,Math.min(Vb,se+(ge.clientX-T)));v&&v(we)},ae=()=>{window.removeEventListener("pointermove",oe),window.removeEventListener("pointerup",ae),window.removeEventListener("pointercancel",ae),window.removeEventListener("blur",ae),G.current=null};window.addEventListener("pointermove",oe),window.addEventListener("pointerup",ae),window.addEventListener("pointercancel",ae),window.addEventListener("blur",ae),G.current=ae}const Z=_?{width:48,flex:"0 0 48px"}:{width:w,flex:`0 0 ${w}px`};return _?h.jsxs("aside",{className:"nc-sidebar mini",style:Z,children:[h.jsx("div",{className:"nc-side-head mini",children:h.jsx("button",{className:"nc-collapse-btn",onClick:b,title:S("expand"),children:"⟩"})}),h.jsx("button",{className:"nc-side-gear mini",onClick:()=>y&&y("nodes",!1),title:S("settings"),onMouseEnter:D=>$(D,S("settings")),onMouseLeave:K,children:h.jsx(Ke,{name:"gear",size:16})}),h.jsx("div",{className:"nc-side-scroll mini",children:h.jsxs("div",{className:"nc-side-group mini",children:[re.map(D=>{const T=D.degraded?"warn":D.tmux?"on":"",se=!!D.tmux;return h.jsx("button",{type:"button",className:`nc-mini-dot${x.has(D.tmuxSession)?" active":""}`,onMouseEnter:oe=>$(oe,D.cell),onMouseLeave:K,draggable:se,onDragStart:se?oe=>oe.dataTransfer.setData("text/nc-session",D.tmuxSession):void 0,onClick:se?()=>l&&l(D.tmuxSession):()=>u&&u(D),onDoubleClick:se?()=>o&&o(D.tmuxSession):void 0,children:h.jsx("span",{className:`nc-dot ${T}`})},D.cell)}),te.map(D=>h.jsx("button",{type:"button",className:`nc-mini-init${x.has(D.name)?" active":""}`,onMouseEnter:T=>$(T,D.name),onMouseLeave:K,draggable:!0,onDragStart:T=>T.dataTransfer.setData("text/nc-session",D.name),onClick:()=>l&&l(D.name),onDoubleClick:()=>o&&o(D.name),children:Gm(D.name)},D.name)),(s||[]).flatMap(D=>D.status==="up"?D.sessions.map(T=>h.jsx("button",{type:"button",className:`nc-mini-init${x.has(T.key)?" active":""}`,onMouseEnter:se=>$(se,T.key),onMouseLeave:K,draggable:!0,onDragStart:se=>se.dataTransfer.setData("text/nc-session",T.key),onClick:()=>l&&l(T.key),onDoubleClick:()=>o&&o({session:T.name,node:T.node}),children:Gm(T.name)},T.key)):[h.jsx("button",{type:"button",className:"nc-mini-dot",onMouseEnter:T=>$(T,`${D.label||(D.route||[D.name]).join(" › ")}: ${tu(D)}`),onMouseLeave:K,children:h.jsx("span",{className:`nc-dot${D.status==="passive"?"":" warn"}`})},`nodo-${(D.route||[D.name]).join("/")}`)])]})}),F&&h.jsx("div",{className:"nc-mini-tip",style:{top:F.y},children:F.text})]}):h.jsxs("aside",{className:"nc-sidebar",style:Z,children:[h.jsxs("div",{className:"nc-side-head",children:[h.jsx("button",{className:"nc-collapse-btn",onClick:b,title:S("collapse"),children:"⟨"}),h.jsx("span",{className:"nc-side-title",children:S("fleet")}),h.jsxs("button",{className:"nc-new-btn",onClick:m,title:S("fleet-new-cell"),children:["+ ",S("new")]})]}),h.jsxs("button",{className:"nc-side-gear",onClick:()=>y&&y("nodes",!1),title:S("settings"),children:[h.jsx(Ke,{name:"gear",size:15})," ",S("settings")]}),h.jsxs("div",{className:"nc-side-scroll",children:[h.jsx(Gb,{label:S("position-local"),count:(t||[]).length+te.length,state:P("local"),onToggle:()=>j("local",{open:!P("local").open}),onFilter:D=>j("local",{filter:D})}),P("local").open&&h.jsxs("div",{className:"nc-side-group",children:[J.map(D=>D.type==="cell"?(()=>{const T=D.value,se=T.degraded?"warn":T.tmux?"on":"",oe=T.degraded?S("cell-degraded"):T.tmux?S("cell-on"):S("cell-off"),ae=!!T.tmux;return h.jsxs("div",{className:`nc-cell${ae?" live":""}${x.has(T.tmuxSession)?" active":""}`,title:`${T.cell} · ${T.engine}${T.key?`·${T.key}`:""} · ${oe}`,"aria-label":`${T.cell}, ${T.engine}${T.key?` ${T.key}`:""}, ${oe}`,draggable:ae,onDragStart:ae?ge=>ge.dataTransfer.setData("text/nc-session",T.tmuxSession):void 0,onClick:ae?()=>l&&l(T.tmuxSession):void 0,onDoubleClick:ae?()=>o&&o(T.tmuxSession):void 0,children:[h.jsx("span",{className:`nc-dot ${se}`}),h.jsxs("span",{className:"nc-cell-main",children:[h.jsx("b",{title:T.cell,children:T.cell}),h.jsxs("small",{title:`${T.engine}${T.key?`·${T.key}`:""}`,children:[T.engine,T.key?`·${T.key}`:""]})]}),h.jsx("button",{className:`nc-pin${N.includes(D.key)?" on":""}`,title:S("pin"),onClick:ge=>{ge.stopPropagation(),U(D.key)},children:N.includes(D.key)?"★":"☆"}),h.jsx("button",{className:`nc-power${T.tmux?" on":""}${T.degraded?" warn":""}`,onClick:ge=>{ge.stopPropagation(),u&&u(T)},title:T.active?S("power-off"):S("power-on"),children:h.jsx(Ke,{name:"power",size:14})})]},D.key)})():(()=>{var se;const T=D.value;return h.jsxs("div",{className:`nc-side-card${x.has(T.name)?" active":""}`,draggable:!0,onDragStart:oe=>oe.dataTransfer.setData("text/nc-session",T.name),onClick:()=>l&&l(T.name),onDoubleClick:()=>o&&o(T.name),children:[h.jsx("span",{className:T.attached?"nc-dot on":"nc-dot"}),h.jsxs("span",{className:"nc-card-main",children:[h.jsx("b",{children:T.name}),h.jsxs("small",{children:[T.preview||T.cmd||S("windows").replace("{n}",String(T.windows||0)),((se=T.outbox)==null?void 0:se.count)>0?` · 📦${T.outbox.count}`:""]})]}),T.activity?h.jsx("span",{className:"nc-rel",children:Fa(T.activity)}):null,h.jsx("button",{className:`nc-pin${N.includes(D.key)?" on":""}`,title:S("pin"),onClick:oe=>{oe.stopPropagation(),U(D.key)},children:N.includes(D.key)?"★":"☆"}),h.jsx("button",{className:"nc-menu",title:S("terminate"),onClick:oe=>{oe.stopPropagation(),window.confirm(S("terminate-confirm").replace("{name}",T.name))&&p&&p(T.name)},children:"⋯"})]},D.key)})()),J.length===0&&h.jsx("div",{className:"nc-empty",children:S("no-sessions-short")})]}),(s||[]).map(D=>{const se=Yb(D.health)||(D.status==="up"?"on":D.status==="passive"?"":"warn"),oe=(D.route||[D.name]).join("/"),ae=P(oe),ge=new Map((D.sessions||[]).map(_e=>[_e.name,_e])),we=La([...(D.cells||[]).map(_e=>{const W=ge.get(_e.tmuxSession)||{},Y=or(D.route,_e.tmuxSession||_e.cell);return{type:"cell",value:_e,key:Y,label:_e.cell,live:!!_e.tmux,fresh:_a(W,Y),activity:W.activity||_e.activity||0}}),...(D.unmanaged||[]).map(_e=>{const W=or(D.route,_e.name);return{type:"session",value:_e,key:W,label:_e.name,live:!0,fresh:_a(_e,W),activity:_e.activity||0}})],N,ae.filter);return h.jsxs("div",{children:[h.jsxs("div",{className:"nc-side-group-title nc-node-title",role:"button",tabIndex:0,onClick:()=>j(oe,{open:!ae.open}),onKeyDown:_e=>{(_e.key==="Enter"||_e.key===" ")&&(_e.preventDefault(),j(oe,{open:!ae.open}))},children:[h.jsx("span",{className:"nc-node-chevron",children:ae.open?"⌄":"›"}),h.jsx("span",{className:`nc-dot ${se}`,title:D.health?Qm(D.health):""}),h.jsx("b",{children:D.label||D.name}),h.jsxs("small",{children:[" · ",D.status==="up"?S("node-sessions").replace("{n}",String((D.cells||[]).length+(D.unmanaged||[]).length)):D.health&&Qm(D.health)||tu(D)]}),h.jsxs("select",{className:"nc-node-filter",value:ae.filter,title:S(`view-${ae.filter}`),onClick:_e=>_e.stopPropagation(),onChange:_e=>j(oe,{filter:_e.target.value}),children:[h.jsx("option",{value:"all",children:S("view-all")}),h.jsx("option",{value:"pinned",children:S("view-pinned")}),h.jsx("option",{value:"active",children:S("view-active")}),h.jsx("option",{value:"off",children:S("view-off")})]}),D.direct&&D.health&&D.health.managed!==!1&&h.jsx("button",{type:"button",className:`nc-power${D.tunnelStatus==="up"?" on":""}`,title:D.tunnelStatus==="up"?S("power-off"):S("power-on"),onClick:_e=>{_e.stopPropagation(),d&&d(D)},children:h.jsx(Ke,{name:"power",size:14})})]}),D.status==="up"&&ae.open&&h.jsxs("div",{className:"nc-side-group",children:[we.map(_e=>_e.type==="cell"?(()=>{const W=_e.value,Y=!!W.tmux,ue=W.degraded?"warn":W.tmux?"on":"";return h.jsxs("div",{className:`nc-side-card nc-cell${Y?" live":""}${x.has(W.key)?" active":""}`,title:W.active?S("cell-on"):S("cell-off"),draggable:Y,onDragStart:Y?Ne=>Ne.dataTransfer.setData("text/nc-session",W.key):void 0,onClick:Y?()=>l&&l(W.key):void 0,onDoubleClick:Y?()=>o&&o({session:W.tmuxSession,node:oe}):void 0,children:[h.jsx("span",{className:`nc-dot ${ue}`}),h.jsxs("span",{className:"nc-card-main",children:[h.jsx("b",{children:W.cell}),h.jsxs("small",{children:[W.engine,W.key?`·${W.key}`:"",W.active?"":` · ${S("cell-off")}`]})]}),h.jsx("button",{className:`nc-pin${N.includes(_e.key)?" on":""}`,title:S("pin"),onClick:Ne=>{Ne.stopPropagation(),U(_e.key)},children:N.includes(_e.key)?"★":"☆"}),(D.capabilities||[]).includes(W.active?"down":"up")&&h.jsx("button",{className:`nc-power${W.active?" on":""}${W.degraded?" warn":""}`,onClick:Ne=>{Ne.stopPropagation(),u&&u({...W,route:D.route,availableEngines:D.engines||[]})},title:W.active?S("power-off"):S("power-on"),children:h.jsx(Ke,{name:"power",size:14})})]},_e.key)})():(()=>{const W=_e.value;return h.jsxs("div",{className:`nc-side-card${x.has(W.key)?" active":""}`,draggable:!0,onDragStart:Y=>Y.dataTransfer.setData("text/nc-session",W.key),onClick:()=>l&&l(W.key),onDoubleClick:()=>o&&o({session:W.name,node:W.node}),children:[h.jsx("span",{className:W.attached?"nc-dot on":"nc-dot"}),h.jsxs("span",{className:"nc-card-main",children:[h.jsx("b",{children:W.name}),h.jsx("small",{children:W.preview?W.preview:W.cmd?W.cmd:S("windows").replace("{n}",String(W.windows||0))})]}),W.activity?h.jsx("span",{className:"nc-rel",children:Fa(W.activity)}):null,h.jsx("button",{className:`nc-pin${N.includes(_e.key)?" on":""}`,title:S("pin"),onClick:Y=>{Y.stopPropagation(),U(_e.key)},children:N.includes(_e.key)?"★":"☆"}),h.jsx("button",{className:"nc-menu",title:S("terminate"),onClick:Y=>{Y.stopPropagation(),window.confirm(S("terminate-confirm").replace("{name}",W.name))&&p&&p(W.name,D.route)},children:"⋯"})]},_e.key)})()),we.length===0&&h.jsx("div",{className:"nc-empty",children:S("no-sessions-short")})]})]},`nodo-${(D.route||[D.name]).join("/")}`)})]}),h.jsx("div",{className:"nc-side-lang",children:dv.map((D,T)=>h.jsxs("span",{children:[T>0&&" · ",h.jsx("button",{className:`nc-lang-btn${k===D?" on":""}`,onClick:()=>E(D),title:D,children:D.toUpperCase()})]},D))}),h.jsx("div",{className:"nc-side-resize",onPointerDown:R,title:""})]})}function Gb({label:e,count:t,state:r,onToggle:s,onFilter:o}){return h.jsxs("div",{className:"nc-side-group-title nc-node-title",role:"button",tabIndex:0,onClick:s,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),s())},children:[h.jsx("span",{className:"nc-node-chevron",children:r.open?"⌄":"›"}),h.jsx("span",{className:"nc-dot on"}),h.jsx("b",{children:e}),h.jsxs("small",{children:[" · ",S("node-sessions").replace("{n}",String(t))]}),h.jsxs("select",{className:"nc-node-filter",value:r.filter,title:S(`view-${r.filter}`),onClick:l=>l.stopPropagation(),onChange:l=>o(l.target.value),children:[h.jsx("option",{value:"all",children:S("view-all")}),h.jsx("option",{value:"pinned",children:S("view-pinned")}),h.jsx("option",{value:"active",children:S("view-active")}),h.jsx("option",{value:"off",children:S("view-off")})]})]})}const Wh=9,Ha=.2,Qb=/^[a-z0-9-]{1,32}(?:\/[a-z0-9-]{1,32}){0,3}$/,a_=/^[a-f0-9]{16,64}$/,ph=e=>Qb.test(e)&&new Set(e.split("/")).size===e.split("/").length;function Ir(e){if(typeof e=="string"&&e){const t=e.indexOf(":");if(t<0)return{session:e};const r=e.slice(0,t),s=e.slice(t+1);return!ph(r)||!s?null:{session:s,node:r}}if(e&&typeof e=="object"&&typeof e.session=="string"&&e.session){const t=e.ownerId===void 0?void 0:typeof e.ownerId=="string"&&a_.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"&&ph(e.node)?{session:e.session,node:e.node,...t?{ownerId:t}:{}}:null}return null}function fi(e){const t=Ir(e);return t?t.node?`${t.node}:${t.session}`:t.session:""}const l_=9,c_=24,Zs=11,Jb=e=>{const t=Number(e);return t>=l_&&t<=c_?t:Zs};function Fn(){return{columns:[]}}function Yi(e){return e.columns.flatMap(t=>t.tiles.map(r=>fi(r)))}function Zb(e){const t=[],r=Math.max(0,...e.columns.map(s=>s.tiles.length));for(let s=0;s<r;s+=1)for(const o of e.columns)o.tiles[s]&&t.push(fi(o.tiles[s]));return t}const Vn=e=>({columns:e.columns.map(t=>({width:t.width,tiles:t.tiles.map(r=>({...r}))}))});function Uh(e,t,r,s){const o=Ir(t);if(!o||Yi(e).includes(fi(o))||Yi(e).length>=Wh)return e;const l=Vn(e),u={session:o.session,height:1,fontSize:Zs,...s||{}};if(o.node&&(u.node=o.node),o.ownerId&&(u.ownerId=o.ownerId),r==="end")return l.columns.push({width:1,tiles:[u]}),l;if(r&&typeof r.col=="number"&&typeof r.row=="number"&&l.columns[r.col])return l.columns[r.col].tiles.splice(r.row,0,u),l;if(r&&typeof r.col=="number"){const d=Math.max(0,Math.min(l.columns.length,r.col));return l.columns.splice(d,0,{width:1,tiles:[u]}),l}return l.columns.push({width:1,tiles:[u]}),l}function u_(e,t){const r=fi(t);if(!r||Yi(e).includes(r)||Yi(e).length>=Wh)return e;const s=Yi(e).length+1,o=Math.ceil(Math.sqrt(s));if(e.columns.length>=o){let y=0;for(let w=1;w<e.columns.length;w+=1)e.columns[w].tiles.length<e.columns[y].tiles.length&&(y=w);return Uh(e,t,{col:y,row:e.columns[y].tiles.length})}const l=[...Zb(e),r],u=new Map(e.columns.flatMap(y=>y.tiles.map(w=>[fi(w),w]))),d=Ir(t),p=e.columns.length?e.columns.reduce((y,w)=>y+(Number(w.width)||1),0)/e.columns.length:1,m=Array.from({length:o},(y,w)=>{var _;return{width:((_=e.columns[w])==null?void 0:_.width)||p,tiles:[]}});return l.forEach((y,w)=>{const _=Ir(y);if(!_)return;const v=u.get(y)||(y===r?d:{})||{},b={session:_.session,height:v.height||1,fontSize:v.fontSize||Zs};_.node&&(b.node=_.node),v.ownerId&&(b.ownerId=v.ownerId),v.unavailable===!0&&(b.unavailable=!0),m[w%o].tiles.push(b)}),{columns:m.filter(y=>y.tiles.length)}}function $a(e,t){const r=fi(t),s=Vn(e);for(const o of s.columns)o.tiles=o.tiles.filter(l=>fi(l)!==r);return s.columns=s.columns.filter(o=>o.tiles.length>0),s}function eC(e,t,r){const s=fi(t);if(!Yi(e).includes(s))return e;const o=e.columns.flatMap(l=>l.tiles).find(l=>fi(l)===s);return Uh($a(e,s),s,r,{fontSize:o.fontSize,height:o.height,...o.ownerId?{ownerId:o.ownerId}:{},...o.unavailable===!0?{unavailable:!0}:{}})}function tC(e,t){if(!(t instanceof Map)||t.size===0)return e;let r=!1;const s=Vn(e);for(const o of s.columns)for(const l of o.tiles){const u=t.get(fi(l));if(!u)continue;const d=Ir(u);d&&(l.session=d.session,d.node?l.node=d.node:delete l.node,d.ownerId&&(l.ownerId=d.ownerId),r=!0)}return r?sn(s):e}function iC(e,t,r){const s=Vn(e);return s.columns[t]&&(s.columns[t].width=Math.max(Ha,Number(r)||1)),s}function rC(e,t,r,s){const o=Vn(e),l=o.columns[t]&&o.columns[t].tiles[r];return l&&(l.height=Math.max(Ha,Number(s)||1)),o}function nC(e,t,r,s){if(!(e.columns[t]&&e.columns[t].tiles[r]))return e;const l=Vn(e),u=l.columns[t].tiles[r],d=Number(u.fontSize)||Zs;return u.fontSize=Math.max(l_,Math.min(c_,d+(Number(s)||0))),l}function sC(e,t,r,s){const o=e.columns[t];if(!o||!o.tiles[r])return null;switch(s){case"left":return{col:t};case"right":return{col:t+1};case"top":return{col:t,row:r};case"bottom":return{col:t,row:r+1};default:return null}}function Jm(e){for(const t of[.25,.5,.75])if(Math.abs(e-t)<=.03)return t;return e}function sn(e){if(!e||!Array.isArray(e.columns))return Fn();const t=e.columns.map(s=>({width:Math.max(Ha,Number(s&&s.width)||1),tiles:(Array.isArray(s&&s.tiles)?s.tiles:[]).filter(o=>o&&typeof o.session=="string"&&o.session).filter(o=>o.node==null||typeof o.node=="string"&&ph(o.node)).filter(o=>o.ownerId==null||typeof o.ownerId=="string"&&a_.test(o.ownerId)).map(o=>{const l={session:o.session,height:Math.max(Ha,Number(o.height)||1),fontSize:Jb(o.fontSize)};return o.node!=null&&(l.node=o.node),o.ownerId!=null&&(l.ownerId=o.ownerId),o.unavailable===!0&&(l.unavailable=!0),l})})).filter(s=>s.tiles.length>0),r=new Set;for(const s of t)s.tiles=s.tiles.filter(o=>!r.has(fi(o))&&r.add(fi(o))&&r.size<=Wh);return{columns:t.filter(s=>s.tiles.length>0)}}function oC(e,t,r){return!e&&t?r+1:r}function aC({session:e,node:t,token:r,readonly:s=!1,focused:o,onFocus:l,onClose:u,onOpenSingle:d,alive:p=!0,available:m=!0,fontSize:y=Zs,onZoom:w,decks:_=[],currentDeck:v,onSendToDeck:b}){const k=L.useRef(()=>{}),E=L.useRef(()=>!1),N=L.useRef(()=>{}),A=L.useRef(!1),[z,I]=L.useState(!1),[U,O]=L.useState(!1),[B,X]=L.useState(!1),[q,re]=L.useState(null),[te,x]=L.useState(0),P=L.useRef(p),j=t?`${t}:${e}`:e,J=_.filter(F=>F.id!==v&&F.available!==!1);return L.useEffect(()=>{const F=P.current;!F&&p&&x(Q=>oC(F,p,Q)),P.current=p},[p]),h.jsxs("div",{className:`nc-tile${o?" focused":""}`,onMouseDown:()=>l&&l(j),children:[h.jsxs("div",{className:"nc-tile-head",draggable:!0,onDragStart:F=>{F.dataTransfer.setData("text/nc-session",j),F.dataTransfer.effectAllowed="move"},children:[h.jsxs("button",{className:"nc-tile-name",onClick:()=>l&&l(j),children:[h.jsx("span",{className:p?"nc-dot on":"nc-dot"}),h.jsx("b",{children:e}),t&&h.jsxs("small",{className:"nc-tile-node",children:["@",t]})]}),h.jsxs("span",{className:"nc-tile-actions",children:[w&&h.jsx("button",{onClick:()=>w(-1),title:S("zoom-out"),children:h.jsx(Ke,{name:"zoomOut",size:14})}),w&&h.jsx("button",{onClick:()=>w(1),title:S("zoom-in"),children:h.jsx(Ke,{name:"zoomIn",size:14})}),b&&J.length>0&&h.jsxs("select",{className:"nc-tile-deck",title:S("send-to-deck"),value:"",onMouseDown:F=>F.stopPropagation(),onChange:F=>{const Q=F.target.value;Q&&b(j,Q),F.target.value=""},children:[h.jsx("option",{value:"",children:S("send-to-deck")}),J.map(F=>h.jsxs("option",{value:F.id,children:[F.ownerLabel," · ",F.name]},F.id))]}),h.jsx("button",{onClick:()=>O(F=>!F),title:"composer",children:"⌨"}),h.jsx("button",{onClick:()=>X(F=>!F),title:"file",children:"📁"}),d&&h.jsx("button",{onClick:()=>d({session:e,node:t}),title:"vista singola",children:"↗"}),u&&h.jsx("button",{className:"nc-tile-close",onClick:()=>u(j),title:"chiudi",children:"✕"})]})]}),h.jsxs("div",{className:"nc-tile-body",children:[m?h.jsx(n_,{session:e,node:t,token:r,readonly:s,takeSize:!1,focused:o,sendRef:k,composerRef:E,actionRef:N,ctrlRef:A,setCtrlArmed:I,onFiles:re,fontSize:y},`${j}:${te}`):h.jsx("div",{className:"nc-tile-unavailable",children:S("deck-owner-unavailable")}),m&&B&&h.jsx("div",{className:"nc-tile-files",onMouseDown:F=>F.stopPropagation(),children:h.jsx(s_,{session:e,node:t,token:r,filesEvent:q,onClose:()=>X(!1)})})]}),m&&U&&h.jsx("div",{className:"nc-tile-composer",onMouseDown:F=>F.stopPropagation(),children:h.jsx(o_,{submitText:F=>E.current(F),token:r,session:e,node:t})})]})}const Zm=.2,eg=.28,h_=(e,t)=>Array.from((e==null?void 0:e.types)||[]).includes(t),iu=e=>h_(e,"text/nc-session"),tg=e=>{var t;return h_(e,"Files")||(((t=e==null?void 0:e.files)==null?void 0:t.length)||0)>0};function lC(e,t,r){const s=(e-r.left)/(r.width||1),o=(t-r.top)/(r.height||1);return s<eg?"left":s>1-eg?"right":o<.5?"top":"bottom"}function cC({layout:e,onLayoutChange:t,token:r,readonly:s=!1,sessionsAlive:o,focusSession:l,onFocus:u,onOpenSingle:d,decks:p=[],currentDeck:m,onSendToDeck:y}){vi();const[w,_]=L.useState(null),v=L.useRef(null),b=L.useRef([]),k=L.useRef(null);function E(q,re){const te=()=>{window.removeEventListener("pointermove",q),window.removeEventListener("pointerup",te),window.removeEventListener("pointercancel",te),window.removeEventListener("blur",te),k.current=null};window.addEventListener("pointermove",q),window.addEventListener("pointerup",te),window.addEventListener("pointercancel",te),window.addEventListener("blur",te),k.current=te}L.useEffect(()=>()=>{k.current&&k.current()},[]),L.useEffect(()=>{const q=()=>_(null);return window.addEventListener("dragend",q),window.addEventListener("drop",q),()=>{window.removeEventListener("dragend",q),window.removeEventListener("drop",q)}},[]);const N=e.columns.length,A=q=>w&&w.col===q&&w.row===void 0,z=!!w&&w.col===N,I=(q,re)=>w&&w.col===q&&w.row===re&&w.quadrant?` drop-${w.quadrant}`:"";function U(q){if(q.preventDefault(),tg(q.dataTransfer)){_(null);return}const re=q.dataTransfer.getData("text/nc-session"),te=w;if(_(null),!re||!te)return;let x;if(te.quadrant){if(x=sC(e,te.col,te.row,te.quadrant),!x)return}else x={col:te.col};t(Yi(e).includes(re)?eC(e,re,x):Uh(e,re,x))}function O(q,re){q.preventDefault(),q.stopPropagation();const te=q.clientX,x=e.columns[re].width,P=v.current&&v.current.clientWidth||1,j=e.columns[re+1];E(F=>{let Q=Math.max(Zm,x+(F.clientX-te)/P);if(j){const $=Jm(Q/(Q+j.width));Q=$/(1-$)*j.width}t(iC(e,re,Q))})}function B(q,re,te){q.preventDefault(),q.stopPropagation();const x=q.clientY,P=e.columns[re].tiles[te].height,j=b.current[re],J=j&&j.clientHeight||1,F=e.columns[re].tiles[te+1];E($=>{let K=Math.max(Zm,P+($.clientY-x)/J);if(F){const G=Jm(K/(K+F.height));K=G/(1-G)*F.height}t(rC(e,re,te,K))})}function X(q){t($a(e,q))}return h.jsxs("div",{className:"nc-grid",ref:v,onDragOver:q=>{if(tg(q.dataTransfer)){q.preventDefault(),_(null);return}iu(q.dataTransfer)&&(q.preventDefault(),w&&w.col===N||_({col:N}))},onDrop:U,onDragLeave:q=>{const re=q.relatedTarget;(!re||!(v.current&&v.current.contains(re)))&&_(null)},children:[e.columns.flatMap((q,re)=>{const te=[];return te.push(h.jsx("div",{className:`nc-col${A(re)?" drop-newcol":""}`,ref:x=>{b.current[re]=x},style:{flexGrow:q.width,flexBasis:0},onDragOver:x=>{iu(x.dataTransfer)&&(x.preventDefault(),x.stopPropagation(),w&&w.col===re&&w.row===void 0||_({col:re}))},children:q.tiles.flatMap((x,P)=>{const j=[],J=fi(x);return j.push(h.jsx("div",{className:`nc-tile-slot${I(re,P)}`,style:{flexGrow:x.height,flexBasis:0},onDragOver:F=>{if(!iu(F.dataTransfer))return;F.preventDefault(),F.stopPropagation();const Q=lC(F.clientX,F.clientY,F.currentTarget.getBoundingClientRect());w&&w.col===re&&w.row===P&&w.quadrant===Q||_({col:re,row:P,quadrant:Q})},children:h.jsx(aC,{session:x.session,node:x.node,token:r,readonly:s,focused:l===J,onFocus:u,onClose:X,onOpenSingle:d,available:x.unavailable!==!0,alive:x.unavailable!==!0&&(!o||o.has(J)),fontSize:x.fontSize,onZoom:F=>t(nC(e,re,P,F)),decks:p,currentDeck:m,onSendToDeck:y})},J)),P<q.tiles.length-1&&j.push(h.jsx("div",{className:"nc-divider-h",onPointerDown:F=>B(F,re,P)},`h${P}`)),j})},`c${re}`)),re<N-1&&te.push(h.jsx("div",{className:"nc-divider-v",onPointerDown:x=>O(x,re)},`v${re}`)),te}),z&&h.jsx("div",{className:"nc-drop-line-v nc-drop-line-end"}),N===0&&h.jsx("div",{className:"nc-grid-empty",children:S("grid-empty")})]})}const mh="local",Ii=/^[a-f0-9]{16,64}$/;function Hn(e,t){return`${e&&Ii.test(e)?e:mh}:${t}`}function d_(e){const t=String(e||""),r=t.indexOf(":");if(r<1)return null;const s=t.slice(0,r),o=t.slice(r+1);return s!==mh&&!Ii.test(s)||!/^[a-z0-9-]{1,32}$/.test(o)?null:{ownerId:s===mh?null:s,name:o}}function Ya(e){return Array.isArray(e)&&e.length?e.join("/"):""}function qh(e){return{columns:sn(e).columns.map(t=>({width:t.width,tiles:t.tiles.map(r=>({...r}))}))}}function uC(e){const t=new Map;for(const r of Array.isArray(e)?e:[])r&&Ii.test(String(r.instanceId||""))&&Array.isArray(r.route)&&t.set(Ya(r.route),r.instanceId);return t}function hC(e){const t=new Map;for(const r of Array.isArray(e)?e:[])r&&Ii.test(String(r.instanceId||""))&&Array.isArray(r.route)&&t.set(r.instanceId,[...r.route]);return t}function gh(e,t,r=[]){const s=qh(e),o=uC(r);for(const l of s.columns)for(const u of l.tiles)u.ownerId||(!u.node&&Ii.test(String(t||""))?u.ownerId=t:u.node&&o.has(u.node)&&(u.ownerId=o.get(u.node)));return s}function vh(e,t,r=[]){const s=qh(e),o=new Map;for(const l of r)l&&Ii.test(String(l.instanceId||""))&&Array.isArray(l.route)&&o.set(l.instanceId,[...l.route]);for(const l of s.columns)for(const u of l.tiles)u.ownerId&&(u.ownerId===t?(delete u.node,delete u.unavailable):o.has(u.ownerId)?(u.node=Ya(o.get(u.ownerId)),delete u.unavailable):u.unavailable=!0);return s}function ig(e,t,r=[]){const s=qh(e),o=hC(r);for(const l of s.columns)for(const u of l.tiles)delete u.unavailable,u.ownerId&&(u.ownerId===t?delete u.node:o.has(u.ownerId)&&(u.node=Ya(o.get(u.ownerId))));return s}function f_(e,t,r=[]){const s=Ir(e);if(!s)return null;if(s.ownerId)return s;if(!s.node)return{...s,...Ii.test(String(t||""))?{ownerId:t}:{}};const o=r.find(l=>Ya(l&&l.route)===s.node);return{...s,...o&&Ii.test(String(o.instanceId||""))?{ownerId:o.instanceId}:{}}}const dC=/^[a-z0-9-]{1,32}$/,pi="main",p_="nc_decks",fC=24;function rg(e){return typeof e!="string"?"":e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").slice(0,32).replace(/-+$/,"")}function Un(e){return typeof e=="string"&&dC.test(e)}function pC(e){const t=String(e||"").match(/^\/deck\/([^/]+)\/?$/);if(t){let r;try{r=decodeURIComponent(t[1])}catch{r=t[1]}return Un(r)?r:pi}return pi}function mC(e){const t=String(e||"").match(/^\/deck\/([^/]+)\/([^/]+)\/?$/);if(t){let s,o;try{s=decodeURIComponent(t[1]),o=decodeURIComponent(t[2])}catch{return{id:Hn(null,pi),ownerId:null,name:pi}}if(Ii.test(s)&&Un(o))return{id:Hn(s,o),ownerId:s,name:o}}const r=pC(e);return{id:Hn(null,r),ownerId:null,name:r}}function ru(e,t){const r=typeof e=="object"&&e?{ownerId:e.ownerId||null,name:e.name}:d_(e)||{ownerId:null,name:e},s=Un(r.name)?r.name:pi,o=r.ownerId?`/deck/${encodeURIComponent(r.ownerId)}/${encodeURIComponent(s)}`:s===pi?"/":`/deck/${encodeURIComponent(s)}`;return t?`${o}#token=${encodeURIComponent(t)}`:o}function m_(e){return e===pi?"nc_grid_v1":`nc_grid_v1__${e}`}function g_(e){const t=[pi];if(Array.isArray(e)){for(const r of e)if(Un(r)&&r!==pi&&!t.includes(r)&&t.push(r),t.length>=fC)break}return t}function Xa(){return typeof localStorage<"u"?localStorage:null}function gC(){const e=Xa();if(!e)return[pi];try{return g_(JSON.parse(e.getItem(p_)||"null"))}catch{return[pi]}}function vC(e){const t=Xa();if(t)try{t.setItem(p_,JSON.stringify(g_(e)))}catch{}}function _h(e){const t=Xa();if(!t)return null;try{return JSON.parse(t.getItem(m_(e))||"null")}catch{return null}}function _C(e,t){const r=Xa();if(r)try{r.setItem(m_(e),JSON.stringify(t))}catch{}}function yC({decks:e=[],currentDeck:t="local:main",onCreate:r,onRename:s,onDelete:o,onOpenWindow:l,onNavigate:u,saveState:d="idle",error:p="",sidebarVisible:m,onToggleSidebar:y}){vi();const[w,_]=L.useState(!1),[v,b]=L.useState(""),[k,E]=L.useState(!1),[N,A]=L.useState(""),[z,I]=L.useState(""),U=rg(v),O=Un(U),B=e.find(x=>x.id===t)||null,X=[];for(const x of e){const P=x.local?"local":x.ownerId;let j=X.find(J=>J.key===P);j||(j={key:P,label:x.ownerLabel||(x.local?"Local":P),local:!!x.local,decks:[]},X.push(j)),j.decks.push(x)}const q=async()=>{if(O){E(!0),A("");try{r&&await r(U),b(""),_(!1)}catch(x){A(String(x.message||x))}E(!1)}},re=x=>{I(""),l&&l(x.id)||I(x.id)},te=async x=>{if(!(x.id===t||!u||k||x.available===!1)){E(!0),A("");try{await u(x.id)}catch(P){A(String((P==null?void 0:P.message)||P))}E(!1)}};return h.jsxs("div",{className:"nc-deckbar",children:[y&&h.jsx("button",{className:"nc-deck-sidebar-toggle",title:S("toggle-sidebar"),onClick:y,children:m?"◀":"☰"}),h.jsx("span",{className:"nc-deckbar-label",children:S("decks")}),h.jsx("div",{className:"nc-deck-chips",children:X.map(x=>h.jsxs("span",{className:"nc-deck-owner-group",children:[h.jsx("span",{className:"nc-deck-owner",children:x.local?"Local":x.label}),x.decks.map(P=>h.jsxs("span",{className:`nc-deck-chip${P.id===t?" current":""}${P.available===!1?" offline":""}`,children:[h.jsxs("button",{className:"nc-deck-open",title:P.available===!1?`${P.ownerLabel} offline`:P.id===t?S("deck-current"):`${P.ownerLabel} · ${P.name}`,disabled:k||P.available===!1,onClick:()=>te(P),children:[P.name,P.id===t?" •":""]}),h.jsx("button",{className:"nc-deck-mini",disabled:P.available===!1,title:S("detach-deck"),onClick:()=>re(P),children:"↗"}),P.name!==pi&&h.jsxs(h.Fragment,{children:[h.jsx("button",{className:"nc-deck-mini",disabled:P.available===!1,title:S("rename-deck"),onClick:()=>{const j=(typeof window<"u"?window.prompt(S("rename-deck"),P.name):"")||"",J=rg(j);Un(J)&&J!==P.name&&s&&s(P.id,J).catch(F=>A(String(F.message||F)))},children:"✎"}),h.jsx("button",{className:"nc-deck-mini nc-deck-del",disabled:P.available===!1,title:S("delete-deck"),onClick:()=>{(typeof window>"u"||window.confirm(S("delete-deck-confirm").replace("{name}",`${P.ownerLabel} · ${P.name}`)))&&o&&o(P.id).catch(j=>A(String(j.message||j)))},children:"✕"})]})]},P.id))]},x.key))}),w?h.jsxs("span",{className:"nc-deck-add",children:[h.jsx("input",{autoFocus:!0,className:O||!v?"":"invalid",placeholder:S("deck-name"),value:v,onChange:x=>b(x.target.value),onKeyDown:x=>{x.key==="Enter"&&q(),x.key==="Escape"&&(b(""),_(!1))}}),v&&O&&U!==v&&h.jsxs("span",{className:"nc-deck-slug",children:["→ ",U]}),h.jsx("button",{className:"nc-deck-ok",disabled:!O||k,onClick:q,children:S("create")}),h.jsx("button",{className:"nc-deck-cancel",onClick:()=>{b(""),_(!1)},children:S("cancel")})]}):h.jsxs("button",{className:"nc-deck-newbtn",disabled:(B==null?void 0:B.available)===!1,title:S("new-deck"),onClick:()=>_(!0),children:["+ ",S("new-deck"),B?` @${B.ownerLabel}`:""]}),h.jsx("span",{className:`nc-deck-state ${d}`,title:S("deck-autosave"),children:S(d==="saving"?"saving":d==="saved"?"saved":"deck-autosave")}),(N||p)&&h.jsx("span",{className:"nc-deck-error",children:N||p}),z&&h.jsx("button",{className:"nc-deck-fallback",onClick:()=>l&&l(z),children:S("popup-blocked")})]})}var On={},nu,ng;function SC(){return ng||(ng=1,nu=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),nu}var su={},Mr={},sg;function un(){if(sg)return Mr;sg=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 Mr.getSymbolSize=function(s){if(!s)throw new Error('"version" cannot be null or undefined');if(s<1||s>40)throw new Error('"version" should be in range from 1 to 40');return s*4+17},Mr.getSymbolTotalCodewords=function(s){return t[s]},Mr.getBCHDigit=function(r){let s=0;for(;r!==0;)s++,r>>>=1;return s},Mr.setToSJISFunction=function(s){if(typeof s!="function")throw new Error('"toSJISFunc" is not a valid function.');e=s},Mr.isKanjiModeEnabled=function(){return typeof e<"u"},Mr.toSJIS=function(s){return e(s)},Mr}var ou={},og;function Kh(){return og||(og=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+r)}}e.isValid=function(s){return s&&typeof s.bit<"u"&&s.bit>=0&&s.bit<4},e.from=function(s,o){if(e.isValid(s))return s;try{return t(s)}catch{return o}}})(ou)),ou}var au,ag;function wC(){if(ag)return au;ag=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const r=Math.floor(t/8);return(this.buffer[r]>>>7-t%8&1)===1},put:function(t,r){for(let s=0;s<r;s++)this.putBit((t>>>r-s-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),t&&(this.buffer[r]|=128>>>this.length%8),this.length++}},au=e,au}var lu,lg;function bC(){if(lg)return lu;lg=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,r,s,o){const l=t*this.size+r;this.data[l]=s,o&&(this.reservedBit[l]=!0)},e.prototype.get=function(t,r){return this.data[t*this.size+r]},e.prototype.xor=function(t,r,s){this.data[t*this.size+r]^=s},e.prototype.isReserved=function(t,r){return this.reservedBit[t*this.size+r]},lu=e,lu}var cu={},cg;function CC(){return cg||(cg=1,(function(e){const t=un().getSymbolSize;e.getRowColCoords=function(s){if(s===1)return[];const o=Math.floor(s/7)+2,l=t(s),u=l===145?26:Math.ceil((l-13)/(2*o-2))*2,d=[l-7];for(let p=1;p<o-1;p++)d[p]=d[p-1]-u;return d.push(6),d.reverse()},e.getPositions=function(s){const o=[],l=e.getRowColCoords(s),u=l.length;for(let d=0;d<u;d++)for(let p=0;p<u;p++)d===0&&p===0||d===0&&p===u-1||d===u-1&&p===0||o.push([l[d],l[p]]);return o}})(cu)),cu}var uu={},ug;function xC(){if(ug)return uu;ug=1;const e=un().getSymbolSize,t=7;return uu.getPositions=function(s){const o=e(s);return[[0,0],[o-t,0],[0,o-t]]},uu}var hu={},hg;function kC(){return hg||(hg=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 l=o.size;let u=0,d=0,p=0,m=null,y=null;for(let w=0;w<l;w++){d=p=0,m=y=null;for(let _=0;_<l;_++){let v=o.get(w,_);v===m?d++:(d>=5&&(u+=t.N1+(d-5)),m=v,d=1),v=o.get(_,w),v===y?p++:(p>=5&&(u+=t.N1+(p-5)),y=v,p=1)}d>=5&&(u+=t.N1+(d-5)),p>=5&&(u+=t.N1+(p-5))}return u},e.getPenaltyN2=function(o){const l=o.size;let u=0;for(let d=0;d<l-1;d++)for(let p=0;p<l-1;p++){const m=o.get(d,p)+o.get(d,p+1)+o.get(d+1,p)+o.get(d+1,p+1);(m===4||m===0)&&u++}return u*t.N2},e.getPenaltyN3=function(o){const l=o.size;let u=0,d=0,p=0;for(let m=0;m<l;m++){d=p=0;for(let y=0;y<l;y++)d=d<<1&2047|o.get(m,y),y>=10&&(d===1488||d===93)&&u++,p=p<<1&2047|o.get(y,m),y>=10&&(p===1488||p===93)&&u++}return u*t.N3},e.getPenaltyN4=function(o){let l=0;const u=o.data.length;for(let p=0;p<u;p++)l+=o.data[p];return Math.abs(Math.ceil(l*100/u/5)-10)*t.N4};function r(s,o,l){switch(s){case e.Patterns.PATTERN000:return(o+l)%2===0;case e.Patterns.PATTERN001:return o%2===0;case e.Patterns.PATTERN010:return l%3===0;case e.Patterns.PATTERN011:return(o+l)%3===0;case e.Patterns.PATTERN100:return(Math.floor(o/2)+Math.floor(l/3))%2===0;case e.Patterns.PATTERN101:return o*l%2+o*l%3===0;case e.Patterns.PATTERN110:return(o*l%2+o*l%3)%2===0;case e.Patterns.PATTERN111:return(o*l%3+(o+l)%2)%2===0;default:throw new Error("bad maskPattern:"+s)}}e.applyMask=function(o,l){const u=l.size;for(let d=0;d<u;d++)for(let p=0;p<u;p++)l.isReserved(p,d)||l.xor(p,d,r(o,p,d))},e.getBestMask=function(o,l){const u=Object.keys(e.Patterns).length;let d=0,p=1/0;for(let m=0;m<u;m++){l(m),e.applyMask(m,o);const y=e.getPenaltyN1(o)+e.getPenaltyN2(o)+e.getPenaltyN3(o)+e.getPenaltyN4(o);e.applyMask(m,o),y<p&&(p=y,d=m)}return d}})(hu)),hu}var ya={},dg;function v_(){if(dg)return ya;dg=1;const e=Kh(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return ya.getBlocksCount=function(o,l){switch(l){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}},ya.getTotalCodewordsCount=function(o,l){switch(l){case e.L:return r[(o-1)*4+0];case e.M:return r[(o-1)*4+1];case e.Q:return r[(o-1)*4+2];case e.H:return r[(o-1)*4+3];default:return}},ya}var du={},As={},fg;function EC(){if(fg)return As;fg=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let s=1;for(let o=0;o<255;o++)e[o]=s,t[s]=o,s<<=1,s&256&&(s^=285);for(let o=255;o<512;o++)e[o]=e[o-255]})(),As.log=function(s){if(s<1)throw new Error("log("+s+")");return t[s]},As.exp=function(s){return e[s]},As.mul=function(s,o){return s===0||o===0?0:e[t[s]+t[o]]},As}var pg;function NC(){return pg||(pg=1,(function(e){const t=EC();e.mul=function(s,o){const l=new Uint8Array(s.length+o.length-1);for(let u=0;u<s.length;u++)for(let d=0;d<o.length;d++)l[u+d]^=t.mul(s[u],o[d]);return l},e.mod=function(s,o){let l=new Uint8Array(s);for(;l.length-o.length>=0;){const u=l[0];for(let p=0;p<o.length;p++)l[p]^=t.mul(o[p],u);let d=0;for(;d<l.length&&l[d]===0;)d++;l=l.slice(d)}return l},e.generateECPolynomial=function(s){let o=new Uint8Array([1]);for(let l=0;l<s;l++)o=e.mul(o,new Uint8Array([1,t.exp(l)]));return o}})(du)),du}var fu,mg;function RC(){if(mg)return fu;mg=1;const e=NC();function t(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(s){this.degree=s,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(s){if(!this.genPoly)throw new Error("Encoder not initialized");const o=new Uint8Array(s.length+this.degree);o.set(s);const l=e.mod(o,this.genPoly),u=this.degree-l.length;if(u>0){const d=new Uint8Array(this.degree);return d.set(l,u),d}return l},fu=t,fu}var pu={},mu={},gu={},gg;function __(){return gg||(gg=1,gu.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),gu}var Ui={},vg;function y_(){if(vg)return Ui;vg=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const s="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r
|
|
82
|
-
]))+`;Ui.KANJI=new RegExp(r,"g"),Ui.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Ui.BYTE=new RegExp(s,"g"),Ui.NUMERIC=new RegExp(e,"g"),Ui.ALPHANUMERIC=new RegExp(t,"g");const o=new RegExp("^"+r+"$"),l=new RegExp("^"+e+"$"),u=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Ui.testKanji=function(p){return o.test(p)},Ui.testNumeric=function(p){return l.test(p)},Ui.testAlphanumeric=function(p){return u.test(p)},Ui}var _g;function hn(){return _g||(_g=1,(function(e){const t=__(),r=y_();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(l,u){if(!l.ccBits)throw new Error("Invalid mode: "+l);if(!t.isValid(u))throw new Error("Invalid version: "+u);return u>=1&&u<10?l.ccBits[0]:u<27?l.ccBits[1]:l.ccBits[2]},e.getBestModeForData=function(l){return r.testNumeric(l)?e.NUMERIC:r.testAlphanumeric(l)?e.ALPHANUMERIC:r.testKanji(l)?e.KANJI:e.BYTE},e.toString=function(l){if(l&&l.id)return l.id;throw new Error("Invalid mode")},e.isValid=function(l){return l&&l.bit&&l.ccBits};function s(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(l,u){if(e.isValid(l))return l;try{return s(l)}catch{return u}}})(mu)),mu}var yg;function PC(){return yg||(yg=1,(function(e){const t=un(),r=v_(),s=Kh(),o=hn(),l=__(),u=7973,d=t.getBCHDigit(u);function p(_,v,b){for(let k=1;k<=40;k++)if(v<=e.getCapacity(k,b,_))return k}function m(_,v){return o.getCharCountIndicator(_,v)+4}function y(_,v){let b=0;return _.forEach(function(k){const E=m(k.mode,v);b+=E+k.getBitsLength()}),b}function w(_,v){for(let b=1;b<=40;b++)if(y(_,b)<=e.getCapacity(b,v,o.MIXED))return b}e.from=function(v,b){return l.isValid(v)?parseInt(v,10):b},e.getCapacity=function(v,b,k){if(!l.isValid(v))throw new Error("Invalid QR Code version");typeof k>"u"&&(k=o.BYTE);const E=t.getSymbolTotalCodewords(v),N=r.getTotalCodewordsCount(v,b),A=(E-N)*8;if(k===o.MIXED)return A;const z=A-m(k,v);switch(k){case o.NUMERIC:return Math.floor(z/10*3);case o.ALPHANUMERIC:return Math.floor(z/11*2);case o.KANJI:return Math.floor(z/13);case o.BYTE:default:return Math.floor(z/8)}},e.getBestVersionForData=function(v,b){let k;const E=s.from(b,s.M);if(Array.isArray(v)){if(v.length>1)return w(v,E);if(v.length===0)return 1;k=v[0]}else k=v;return p(k.mode,k.getLength(),E)},e.getEncodedBits=function(v){if(!l.isValid(v)||v<7)throw new Error("Invalid QR Code version");let b=v<<12;for(;t.getBCHDigit(b)-d>=0;)b^=u<<t.getBCHDigit(b)-d;return v<<12|b}})(pu)),pu}var vu={},Sg;function DC(){if(Sg)return vu;Sg=1;const e=un(),t=1335,r=21522,s=e.getBCHDigit(t);return vu.getEncodedBits=function(l,u){const d=l.bit<<3|u;let p=d<<10;for(;e.getBCHDigit(p)-s>=0;)p^=t<<e.getBCHDigit(p)-s;return(d<<10|p)^r},vu}var _u={},yu,wg;function LC(){if(wg)return yu;wg=1;const e=hn();function t(r){this.mode=e.NUMERIC,this.data=r.toString()}return t.getBitsLength=function(s){return 10*Math.floor(s/3)+(s%3?s%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(s){let o,l,u;for(o=0;o+3<=this.data.length;o+=3)l=this.data.substr(o,3),u=parseInt(l,10),s.put(u,10);const d=this.data.length-o;d>0&&(l=this.data.substr(o),u=parseInt(l,10),s.put(u,d*3+1))},yu=t,yu}var Su,bg;function MC(){if(bg)return Su;bg=1;const e=hn(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(s){this.mode=e.ALPHANUMERIC,this.data=s}return r.getBitsLength=function(o){return 11*Math.floor(o/2)+6*(o%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(o){let l;for(l=0;l+2<=this.data.length;l+=2){let u=t.indexOf(this.data[l])*45;u+=t.indexOf(this.data[l+1]),o.put(u,11)}this.data.length%2&&o.put(t.indexOf(this.data[l]),6)},Su=r,Su}var wu,Cg;function TC(){if(Cg)return wu;Cg=1;const e=hn();function t(r){this.mode=e.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return t.getBitsLength=function(s){return s*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){for(let s=0,o=this.data.length;s<o;s++)r.put(this.data[s],8)},wu=t,wu}var bu,xg;function jC(){if(xg)return bu;xg=1;const e=hn(),t=un();function r(s){this.mode=e.KANJI,this.data=s}return r.getBitsLength=function(o){return o*13},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(s){let o;for(o=0;o<this.data.length;o++){let l=t.toSJIS(this.data[o]);if(l>=33088&&l<=40956)l-=33088;else if(l>=57408&&l<=60351)l-=49472;else throw new Error("Invalid SJIS character: "+this.data[o]+`
|
|
83
|
-
Make sure your charset is UTF-8`);l=(l>>>8&255)*192+(l&255),s.put(l,13)}},bu=r,bu}var Cu={exports:{}},kg;function BC(){return kg||(kg=1,(function(e){var t={single_source_shortest_paths:function(r,s,o){var l={},u={};u[s]=0;var d=t.PriorityQueue.make();d.push(s,0);for(var p,m,y,w,_,v,b,k,E;!d.empty();){p=d.pop(),m=p.value,w=p.cost,_=r[m]||{};for(y in _)_.hasOwnProperty(y)&&(v=_[y],b=w+v,k=u[y],E=typeof u[y]>"u",(E||k>b)&&(u[y]=b,d.push(y,b),l[y]=m))}if(typeof o<"u"&&typeof u[o]>"u"){var N=["Could not find a path from ",s," to ",o,"."].join("");throw new Error(N)}return l},extract_shortest_path_from_predecessor_list:function(r,s){for(var o=[],l=s;l;)o.push(l),r[l],l=r[l];return o.reverse(),o},find_path:function(r,s,o){var l=t.single_source_shortest_paths(r,s,o);return t.extract_shortest_path_from_predecessor_list(l,o)},PriorityQueue:{make:function(r){var s=t.PriorityQueue,o={},l;r=r||{};for(l in s)s.hasOwnProperty(l)&&(o[l]=s[l]);return o.queue=[],o.sorter=r.sorter||s.default_sorter,o},default_sorter:function(r,s){return r.cost-s.cost},push:function(r,s){var o={value:r,cost:s};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})(Cu)),Cu.exports}var Eg;function IC(){return Eg||(Eg=1,(function(e){const t=hn(),r=LC(),s=MC(),o=TC(),l=jC(),u=y_(),d=un(),p=BC();function m(N){return unescape(encodeURIComponent(N)).length}function y(N,A,z){const I=[];let U;for(;(U=N.exec(z))!==null;)I.push({data:U[0],index:U.index,mode:A,length:U[0].length});return I}function w(N){const A=y(u.NUMERIC,t.NUMERIC,N),z=y(u.ALPHANUMERIC,t.ALPHANUMERIC,N);let I,U;return d.isKanjiModeEnabled()?(I=y(u.BYTE,t.BYTE,N),U=y(u.KANJI,t.KANJI,N)):(I=y(u.BYTE_KANJI,t.BYTE,N),U=[]),A.concat(z,I,U).sort(function(B,X){return B.index-X.index}).map(function(B){return{data:B.data,mode:B.mode,length:B.length}})}function _(N,A){switch(A){case t.NUMERIC:return r.getBitsLength(N);case t.ALPHANUMERIC:return s.getBitsLength(N);case t.KANJI:return l.getBitsLength(N);case t.BYTE:return o.getBitsLength(N)}}function v(N){return N.reduce(function(A,z){const I=A.length-1>=0?A[A.length-1]:null;return I&&I.mode===z.mode?(A[A.length-1].data+=z.data,A):(A.push(z),A)},[])}function b(N){const A=[];for(let z=0;z<N.length;z++){const I=N[z];switch(I.mode){case t.NUMERIC:A.push([I,{data:I.data,mode:t.ALPHANUMERIC,length:I.length},{data:I.data,mode:t.BYTE,length:I.length}]);break;case t.ALPHANUMERIC:A.push([I,{data:I.data,mode:t.BYTE,length:I.length}]);break;case t.KANJI:A.push([I,{data:I.data,mode:t.BYTE,length:m(I.data)}]);break;case t.BYTE:A.push([{data:I.data,mode:t.BYTE,length:m(I.data)}])}}return A}function k(N,A){const z={},I={start:{}};let U=["start"];for(let O=0;O<N.length;O++){const B=N[O],X=[];for(let q=0;q<B.length;q++){const re=B[q],te=""+O+q;X.push(te),z[te]={node:re,lastCount:0},I[te]={};for(let x=0;x<U.length;x++){const P=U[x];z[P]&&z[P].node.mode===re.mode?(I[P][te]=_(z[P].lastCount+re.length,re.mode)-_(z[P].lastCount,re.mode),z[P].lastCount+=re.length):(z[P]&&(z[P].lastCount=re.length),I[P][te]=_(re.length,re.mode)+4+t.getCharCountIndicator(re.mode,A))}}U=X}for(let O=0;O<U.length;O++)I[U[O]].end=0;return{map:I,table:z}}function E(N,A){let z;const I=t.getBestModeForData(N);if(z=t.from(A,I),z!==t.BYTE&&z.bit<I.bit)throw new Error('"'+N+'" cannot be encoded with mode '+t.toString(z)+`.
|
|
84
|
-
Suggested mode is: `+t.toString(I));switch(z===t.KANJI&&!d.isKanjiModeEnabled()&&(z=t.BYTE),z){case t.NUMERIC:return new r(N);case t.ALPHANUMERIC:return new s(N);case t.KANJI:return new l(N);case t.BYTE:return new o(N)}}e.fromArray=function(A){return A.reduce(function(z,I){return typeof I=="string"?z.push(E(I,null)):I.data&&z.push(E(I.data,I.mode)),z},[])},e.fromString=function(A,z){const I=w(A,d.isKanjiModeEnabled()),U=b(I),O=k(U,z),B=p.find_path(O.map,"start","end"),X=[];for(let q=1;q<B.length-1;q++)X.push(O.table[B[q]].node);return e.fromArray(v(X))},e.rawSplit=function(A){return e.fromArray(w(A,d.isKanjiModeEnabled()))}})(_u)),_u}var Ng;function AC(){if(Ng)return su;Ng=1;const e=un(),t=Kh(),r=wC(),s=bC(),o=CC(),l=xC(),u=kC(),d=v_(),p=RC(),m=PC(),y=DC(),w=hn(),_=IC();function v(O,B){const X=O.size,q=l.getPositions(B);for(let re=0;re<q.length;re++){const te=q[re][0],x=q[re][1];for(let P=-1;P<=7;P++)if(!(te+P<=-1||X<=te+P))for(let j=-1;j<=7;j++)x+j<=-1||X<=x+j||(P>=0&&P<=6&&(j===0||j===6)||j>=0&&j<=6&&(P===0||P===6)||P>=2&&P<=4&&j>=2&&j<=4?O.set(te+P,x+j,!0,!0):O.set(te+P,x+j,!1,!0))}}function b(O){const B=O.size;for(let X=8;X<B-8;X++){const q=X%2===0;O.set(X,6,q,!0),O.set(6,X,q,!0)}}function k(O,B){const X=o.getPositions(B);for(let q=0;q<X.length;q++){const re=X[q][0],te=X[q][1];for(let x=-2;x<=2;x++)for(let P=-2;P<=2;P++)x===-2||x===2||P===-2||P===2||x===0&&P===0?O.set(re+x,te+P,!0,!0):O.set(re+x,te+P,!1,!0)}}function E(O,B){const X=O.size,q=m.getEncodedBits(B);let re,te,x;for(let P=0;P<18;P++)re=Math.floor(P/3),te=P%3+X-8-3,x=(q>>P&1)===1,O.set(re,te,x,!0),O.set(te,re,x,!0)}function N(O,B,X){const q=O.size,re=y.getEncodedBits(B,X);let te,x;for(te=0;te<15;te++)x=(re>>te&1)===1,te<6?O.set(te,8,x,!0):te<8?O.set(te+1,8,x,!0):O.set(q-15+te,8,x,!0),te<8?O.set(8,q-te-1,x,!0):te<9?O.set(8,15-te-1+1,x,!0):O.set(8,15-te-1,x,!0);O.set(q-8,8,1,!0)}function A(O,B){const X=O.size;let q=-1,re=X-1,te=7,x=0;for(let P=X-1;P>0;P-=2)for(P===6&&P--;;){for(let j=0;j<2;j++)if(!O.isReserved(re,P-j)){let J=!1;x<B.length&&(J=(B[x]>>>te&1)===1),O.set(re,P-j,J),te--,te===-1&&(x++,te=7)}if(re+=q,re<0||X<=re){re-=q,q=-q;break}}}function z(O,B,X){const q=new r;X.forEach(function(j){q.put(j.mode.bit,4),q.put(j.getLength(),w.getCharCountIndicator(j.mode,O)),j.write(q)});const re=e.getSymbolTotalCodewords(O),te=d.getTotalCodewordsCount(O,B),x=(re-te)*8;for(q.getLengthInBits()+4<=x&&q.put(0,4);q.getLengthInBits()%8!==0;)q.putBit(0);const P=(x-q.getLengthInBits())/8;for(let j=0;j<P;j++)q.put(j%2?17:236,8);return I(q,O,B)}function I(O,B,X){const q=e.getSymbolTotalCodewords(B),re=d.getTotalCodewordsCount(B,X),te=q-re,x=d.getBlocksCount(B,X),P=q%x,j=x-P,J=Math.floor(q/x),F=Math.floor(te/x),Q=F+1,$=J-F,K=new p($);let G=0;const R=new Array(x),Z=new Array(x);let D=0;const T=new Uint8Array(O.buffer);for(let we=0;we<x;we++){const _e=we<j?F:Q;R[we]=T.slice(G,G+_e),Z[we]=K.encode(R[we]),G+=_e,D=Math.max(D,_e)}const se=new Uint8Array(q);let oe=0,ae,ge;for(ae=0;ae<D;ae++)for(ge=0;ge<x;ge++)ae<R[ge].length&&(se[oe++]=R[ge][ae]);for(ae=0;ae<$;ae++)for(ge=0;ge<x;ge++)se[oe++]=Z[ge][ae];return se}function U(O,B,X,q){let re;if(Array.isArray(O))re=_.fromArray(O);else if(typeof O=="string"){let J=B;if(!J){const F=_.rawSplit(O);J=m.getBestVersionForData(F,X)}re=_.fromString(O,J||40)}else throw new Error("Invalid data");const te=m.getBestVersionForData(re,X);if(!te)throw new Error("The amount of data is too big to be stored in a QR Code");if(!B)B=te;else if(B<te)throw new Error(`
|
|
85
|
-
The chosen QR Code version cannot contain this amount of data.
|
|
86
|
-
Minimum version required to store current data is: `+te+`.
|
|
87
|
-
`);const x=z(B,X,re),P=e.getSymbolSize(B),j=new s(P);return v(j,B),b(j),k(j,B),N(j,X,0),B>=7&&E(j,B),A(j,x),isNaN(q)&&(q=u.getBestMask(j,N.bind(null,j,X))),u.applyMask(q,j),N(j,X,q),{modules:j,version:B,errorCorrectionLevel:X,maskPattern:q,segments:re}}return su.create=function(B,X){if(typeof B>"u"||B==="")throw new Error("No input text");let q=t.M,re,te;return typeof X<"u"&&(q=t.from(X.errorCorrectionLevel,t.M),re=m.from(X.version),te=u.from(X.maskPattern),X.toSJISFunc&&e.setToSJISFunction(X.toSJISFunc)),U(B,re,q,te)},su}var xu={},ku={},Rg;function S_(){return Rg||(Rg=1,(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let s=r.slice().replace("#","").split("");if(s.length<3||s.length===5||s.length>8)throw new Error("Invalid hex color: "+r);(s.length===3||s.length===4)&&(s=Array.prototype.concat.apply([],s.map(function(l){return[l,l]}))),s.length===6&&s.push("F","F");const o=parseInt(s.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+s.slice(0,6).join("")}}e.getOptions=function(s){s||(s={}),s.color||(s.color={});const o=typeof s.margin>"u"||s.margin===null||s.margin<0?4:s.margin,l=s.width&&s.width>=21?s.width:void 0,u=s.scale||4;return{width:l,scale:l?4:u,margin:o,color:{dark:t(s.color.dark||"#000000ff"),light:t(s.color.light||"#ffffffff")},type:s.type,rendererOpts:s.rendererOpts||{}}},e.getScale=function(s,o){return o.width&&o.width>=s+o.margin*2?o.width/(s+o.margin*2):o.scale},e.getImageWidth=function(s,o){const l=e.getScale(s,o);return Math.floor((s+o.margin*2)*l)},e.qrToImageData=function(s,o,l){const u=o.modules.size,d=o.modules.data,p=e.getScale(u,l),m=Math.floor((u+l.margin*2)*p),y=l.margin*p,w=[l.color.light,l.color.dark];for(let _=0;_<m;_++)for(let v=0;v<m;v++){let b=(_*m+v)*4,k=l.color.light;if(_>=y&&v>=y&&_<m-y&&v<m-y){const E=Math.floor((_-y)/p),N=Math.floor((v-y)/p);k=w[d[E*u+N]?1:0]}s[b++]=k.r,s[b++]=k.g,s[b++]=k.b,s[b]=k.a}}})(ku)),ku}var Pg;function OC(){return Pg||(Pg=1,(function(e){const t=S_();function r(o,l,u){o.clearRect(0,0,l.width,l.height),l.style||(l.style={}),l.height=u,l.width=u,l.style.height=u+"px",l.style.width=u+"px"}function s(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(l,u,d){let p=d,m=u;typeof p>"u"&&(!u||!u.getContext)&&(p=u,u=void 0),u||(m=s()),p=t.getOptions(p);const y=t.getImageWidth(l.modules.size,p),w=m.getContext("2d"),_=w.createImageData(y,y);return t.qrToImageData(_.data,l,p),r(w,m,y),w.putImageData(_,0,0),m},e.renderToDataURL=function(l,u,d){let p=d;typeof p>"u"&&(!u||!u.getContext)&&(p=u,u=void 0),p||(p={});const m=e.render(l,u,p),y=p.type||"image/png",w=p.rendererOpts||{};return m.toDataURL(y,w.quality)}})(xu)),xu}var Eu={},Dg;function zC(){if(Dg)return Eu;Dg=1;const e=S_();function t(o,l){const u=o.a/255,d=l+'="'+o.hex+'"';return u<1?d+" "+l+'-opacity="'+u.toFixed(2).slice(1)+'"':d}function r(o,l,u){let d=o+l;return typeof u<"u"&&(d+=" "+u),d}function s(o,l,u){let d="",p=0,m=!1,y=0;for(let w=0;w<o.length;w++){const _=Math.floor(w%l),v=Math.floor(w/l);!_&&!m&&(m=!0),o[w]?(y++,w>0&&_>0&&o[w-1]||(d+=m?r("M",_+u,.5+v+u):r("m",p,0),p=0,m=!1),_+1<l&&o[w+1]||(d+=r("h",y),y=0)):p++}return d}return Eu.render=function(l,u,d){const p=e.getOptions(u),m=l.modules.size,y=l.modules.data,w=m+p.margin*2,_=p.color.light.a?"<path "+t(p.color.light,"fill")+' d="M0 0h'+w+"v"+w+'H0z"/>':"",v="<path "+t(p.color.dark,"stroke")+' d="'+s(y,m,p.margin)+'"/>',b='viewBox="0 0 '+w+" "+w+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(p.width?'width="'+p.width+'" height="'+p.width+'" ':"")+b+' shape-rendering="crispEdges">'+_+v+`</svg>
|
|
88
|
-
`;return typeof d=="function"&&d(null,E),E},Eu}var Lg;function FC(){if(Lg)return On;Lg=1;const e=SC(),t=AC(),r=OC(),s=zC();function o(l,u,d,p,m){const y=[].slice.call(arguments,1),w=y.length,_=typeof y[w-1]=="function";if(!_&&!e())throw new Error("Callback required as last argument");if(_){if(w<2)throw new Error("Too few arguments provided");w===2?(m=d,d=u,u=p=void 0):w===3&&(u.getContext&&typeof m>"u"?(m=p,p=void 0):(m=p,p=d,d=u,u=void 0))}else{if(w<1)throw new Error("Too few arguments provided");return w===1?(d=u,u=p=void 0):w===2&&!u.getContext&&(p=d,d=u,u=void 0),new Promise(function(v,b){try{const k=t.create(d,p);v(l(k,u,p))}catch(k){b(k)}})}try{const v=t.create(d,p);m(null,l(v,u,p))}catch(v){m(v)}}return On.create=t.create,On.toCanvas=o.bind(null,r.render),On.toDataURL=o.bind(null,r.renderToDataURL),On.toString=o.bind(null,function(l,u,d){return s.render(l,d)}),On}var HC=FC();const $C=xh(HC),w_=/^[a-z0-9-]{1,32}$/,WC=/^[A-Za-z0-9._-]{1,32}$/,UC=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/,qC=320;function KC(e){return typeof e=="string"&&w_.test(e)}const VC=64;function yh(e){if(typeof e!="string")return!1;const t=e.trim();return t.length>0&&t.length<=VC&&!/[\x00-\x1f\x7f]/.test(t)}function $n(e){return String(e??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32).replace(/-+$/g,"")||"node"}function b_(e){if(typeof e!="string"||!e||e.length>qC||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:WC.test(e.slice(0,t))&&UC.test(e.slice(t+1))}function Mg(e){if(e===""||e===null||e===void 0)return null;const t=String(e).trim();if(!/^[0-9]{1,5}$/.test(t))return;const r=Number(t);return Number.isInteger(r)&&r>=1&&r<=65535?r:void 0}function Tg({name:e,ssh:t,sshPort:r,remotePort:s}={}){const o=typeof e=="string"?e.trim():e,l=typeof t=="string"?t.trim():t;if(!KC(o))return{ok:!1,error:"err-node-name"};if(!b_(l))return{ok:!1,error:"err-ssh"};const u=Mg(r);if(u===void 0)return{ok:!1,error:"err-ssh-port"};const d=Mg(s);if(d===void 0)return{ok:!1,error:"err-node-port"};const p={name:o,ssh:l};return u!==null&&(p.sshPort=u),d!==null&&(p.remotePort=d),{ok:!0,value:p}}function YC(e,t){if(!e||!t||t<e)return null;const r=Math.floor((t-e)/1e3);return r<60?"ora":r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}g`}function XC(e,t){const r=!!(e&&e.status==="up"),s=!!(e&&e.status==="passive");return{up:r,...s?{passive:!0}:{},label:r?"tunnel-up":s?"node-passive":"tunnel-down",since:r?YC(e.since,t):null}}const GC=new Set(["v","instanceId","port","label","invite"]),QC=new Set(["v","instanceId","port","label","invite","name","ssh","sshPort"]);function JC(e){const t=String(e).replace(/-/g,"+").replace(/_/g,"/"),r=t+"=".repeat((4-t.length%4)%4),s=typeof atob=="function"?atob(r):Buffer.from(r,"base64").toString("binary"),o=Uint8Array.from(s,l=>l.charCodeAt(0));return typeof TextDecoder<"u"?new TextDecoder().decode(o):Buffer.from(o).toString("utf8")}function ZC(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 r;try{r=JSON.parse(JC(t))}catch{return{ok:!1}}if(!r||typeof r!="object"||Array.isArray(r))return{ok:!1};const s=r.v===1?GC:r.v===2?QC:null;if(!s)return{ok:!1};for(const u of Object.keys(r))if(!s.has(u))return{ok:!1};if(!/^[a-f0-9]{16,64}$/.test(String(r.instanceId)))return{ok:!1};const o=Number(r.port);if(!Number.isInteger(o)||o<1||o>65535)return{ok:!1};if(typeof r.label!="string")return{ok:!1};if(typeof r.invite!="string"||!r.invite)return{ok:!1};const l={ok:!0,version:r.v,label:r.label,invite:r.invite,instanceId:r.instanceId,port:o};if(r.v===2){if(r.name!==void 0){if(typeof r.name!="string"||!w_.test(r.name))return{ok:!1};l.name=r.name}if(r.ssh!==void 0){if(!b_(r.ssh))return{ok:!1};l.ssh=String(r.ssh).trim()}if(r.sshPort!==void 0){const u=Number(r.sshPort);if(!Number.isInteger(u)||u<1||u>65535)return{ok:!1};l.sshPort=u}}return l}function ex(e,t,r=new Set){if(!t||!t.ok)return e;const s={...e},o=(l,u)=>{u==null||u===""||r.has(l)||(s[l]=u)};return o("label",t.label),t.version===2&&(o("name",t.name||(t.ssh?$n(t.label):"")),o("ssh",t.ssh),t.sshPort!==void 0&&o("sshPort",String(t.sshPort))),s}function jg(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.data=="string"?e.data.trim():""}function tx(e){const t=String(e||"").trim();if(!t)return{kind:"empty"};const r=ZC(t);if(!r||!r.ok)return{kind:"invalid"};const s=[];return r.ssh||s.push("ssh"),r.name||s.push("name"),s.length?{kind:"partial",decoded:r,missing:s}:{kind:"complete",decoded:r}}function ix(e,t,r=new Set,s=!1){if(!t||!t.ok)return e;const o=ex(e,t,r);return t.version===2&&t.name&&!r.has("name")&&!s&&(o.name=t.name),!r.has("label")&&!o.label&&t.label&&(o.label=t.label),o}function Bg(e,t,r=new Set,s=!1){const o=String(t||"").trim(),l=tx(o);let u={...e,pairingUrl:o};return(l.kind==="complete"||l.kind==="partial")&&(u={...ix(u,l.decoded,r,s),pairingUrl:o}),{classification:l,form:u}}function rx(e,{deviceDefault:t=""}={}){const r={name:e.name,ssh:e.ssh,pairingUrl:e.pairingUrl,...e.label?{label:e.label}:{},...e.sshPort?{sshPort:Number(e.sshPort)}:{}},s=e.localLabel||t;return s&&(r.localLabel=s),r}function nx(){const e=new Set;let t=!1;return{canAuto(r){return!t&&!e.has(String(r||""))},start(r){return t?!1:(t=!0,e.add(String(r||"")),!0)},finish(){t=!1},reset(r){e.delete(String(r||""))},isBusy(){return t}}}const sx=["validation","conflict","ssh-start","ssh-ready","join","tunnel-final","confirm","health"];function ox(e){const t=e&&e.data||{},r=typeof t.stage=="string"&&t.stage?t.stage:"",s=typeof t.detail=="string"&&t.detail?t.detail:"";return{stage:r,code:typeof t.code=="string"?t.code:"",detail:s,hint:typeof t.hint=="string"?t.hint:"",retryable:typeof t.retryable=="boolean"?t.retryable:!r,message:s||String(e&&e.message||e)}}const ax="modulepreload",lx=function(e){return"/"+e},Ig={},cx=function(t,r,s){let o=Promise.resolve();if(r&&r.length>0){let u=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));o=u(r.map(m=>{if(m=lx(m),m in Ig)return;Ig[m]=!0;const y=m.endsWith(".css"),w=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${w}`))return;const _=document.createElement("link");if(_.rel=y?"stylesheet":ax,y||(_.as="script"),_.crossOrigin="",_.href=m,p&&_.setAttribute("nonce",p),document.head.appendChild(_),y)return new Promise((v,b)=>{_.addEventListener("load",v),_.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return o.then(u=>{for(const d of u||[])d.status==="rejected"&&l(d.reason);return t().catch(l)})};class Ie{constructor(t,r,s,o,l){this._legacyCanvasSize=Ie.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"),s&&typeof s=="object"?this._onDecode=r:(console.warn(s||o||l?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=r),r=typeof s=="object"?s:{},this._onDecodeError=r.onDecodeError||(typeof s=="function"?s:this._onDecodeError),this._calculateScanRegion=r.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=r.preferredCamera||l||this._preferredCamera,this._legacyCanvasSize=typeof s=="number"?s:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=r.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),t.disablePictureInPicture=!0,t.playsInline=!0,t.muted=!0;let u=!1;if(t.hidden&&(t.hidden=!1,u=!0),document.body.contains(t)||(document.body.appendChild(t),u=!0),s=t.parentElement,r.highlightScanRegion||r.highlightCodeOutline){if(o=!!r.overlay,this.$overlay=r.overlay||document.createElement("div"),l=this.$overlay.style,l.position="absolute",l.display="none",l.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&r.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}s.insertBefore(this.$overlay,this.$video.nextSibling)}r.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(t),requestAnimationFrame(()=>{let d=window.getComputedStyle(t);d.display==="none"&&(t.style.setProperty("display","block","important"),u=!0),d.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=Ie.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 Ie.listCameras(!1)).length}catch{return!1}}static async listCameras(t=!1){if(!navigator.mediaDevices)return[];let r=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),s;try{t&&(await r()).every(o=>!o.label)&&(s=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await r()).map((o,l)=>({id:o.deviceId,label:o.label||(l===0?"Default Camera":`Camera ${l+1}`)}))}finally{s&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),Ie._stopVideoStream(s))}}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"),Ie._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(),Ie._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:t,facingMode:r}=await this._getCameraStream();!this._active||this._paused?Ie._stopVideoStream(t):(this._setVideoMirror(r),this.$video.srcObject=t,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(t){if(!this._paused)throw this._active=!1,t}}stop(){this.pause(),this._active=!1}async pause(t=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let r=()=>{this.$video.srcObject instanceof MediaStream&&(Ie._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return t?(r(),!0):(await new Promise(s=>setTimeout(s,300)),this._paused?(r(),!0):!1)}async setCamera(t){t!==this._preferredCamera&&(this._preferredCamera=t,await this._restartVideoStream())}static async scanImage(t,r,s,o,l=!1,u=!1){let d,p=!1;r&&("scanRegion"in r||"qrEngine"in r||"canvas"in r||"disallowCanvasResizing"in r||"alsoTryWithoutScanRegion"in r||"returnDetailedScanResult"in r)?(d=r.scanRegion,s=r.qrEngine,o=r.canvas,l=r.disallowCanvasResizing||!1,u=r.alsoTryWithoutScanRegion||!1,p=!0):console.warn(r||s||o||l||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."),r=!!s;try{let m,y;[s,m]=await Promise.all([s||Ie.createQrEngine(),Ie._loadImage(t)]),[o,y]=Ie._drawToCanvas(m,d,o,l);let w;if(s instanceof Worker){let _=s;r||Ie._postWorkerMessageSync(_,"inversionMode","both"),w=await new Promise((v,b)=>{let k,E,N,A=-1;E=I=>{I.data.id===A&&(_.removeEventListener("message",E),_.removeEventListener("error",N),clearTimeout(k),I.data.data!==null?v({data:I.data.data,cornerPoints:Ie._convertPoints(I.data.cornerPoints,d)}):b(Ie.NO_QR_CODE_FOUND))},N=I=>{_.removeEventListener("message",E),_.removeEventListener("error",N),clearTimeout(k),b("Scanner error: "+(I?I.message||I:"Unknown Error"))},_.addEventListener("message",E),_.addEventListener("error",N),k=setTimeout(()=>N("timeout"),1e4);let z=y.getImageData(0,0,o.width,o.height);A=Ie._postWorkerMessageSync(_,"decode",z,[z.data.buffer])})}else w=await Promise.race([new Promise((_,v)=>window.setTimeout(()=>v("Scanner error: timeout"),1e4)),(async()=>{try{var[_]=await s.detect(o);if(!_)throw Ie.NO_QR_CODE_FOUND;return{data:_.rawValue,cornerPoints:Ie._convertPoints(_.cornerPoints,d)}}catch(v){if(_=v.message||v,/not implemented|service unavailable/.test(_))return Ie._disableBarcodeDetector=!0,Ie.scanImage(t,{scanRegion:d,canvas:o,disallowCanvasResizing:l,alsoTryWithoutScanRegion:u});throw`Scanner error: ${_}`}})()]);return p?w:w.data}catch(m){if(!d||!u)throw m;let y=await Ie.scanImage(t,{qrEngine:s,canvas:o,disallowCanvasResizing:l});return p?y:y.data}finally{r||Ie._postWorkerMessage(s,"close")}}setGrayscaleWeights(t,r,s,o=!0){Ie._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:r,blue:s,useIntegerApproximation:o})}setInversionMode(t){Ie._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=()=>cx(()=>import("./qr-scanner-worker.min-D85Z9gVD.js"),[]).then(s=>s.createWorker()),!(!Ie._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return t();let r=navigator.userAgentData;return r&&r.brands.some(({brand:s})=>/Chromium/i.test(s))&&/mac ?OS/i.test(r.platform)&&await r.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:s,platformVersion:o})=>/arm/i.test(s||"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 r=Math.round(.6666666666666666*Math.min(t.videoWidth,t.videoHeight));return{x:Math.round((t.videoWidth-r)/2),y:Math.round((t.videoHeight-r)/2),width:r,height:r,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var t=this.$video,r=t.videoWidth,s=t.videoHeight,o=t.offsetWidth,l=t.offsetHeight,u=t.offsetLeft,d=t.offsetTop,p=window.getComputedStyle(t),m=p.objectFit,y=r/s,w=o/l;switch(m){case"none":var _=r,v=s;break;case"fill":_=o,v=l;break;default:(m==="cover"?y>w:y<w)?(v=l,_=v*y):(_=o,v=_/y),m==="scale-down"&&(_=Math.min(_,r),v=Math.min(v,s))}var[b,k]=p.objectPosition.split(" ").map((N,A)=>{const z=parseFloat(N);return N.endsWith("%")?(A?l-v:o-_)*z/100:z});p=this._scanRegion.width||r,w=this._scanRegion.height||s,m=this._scanRegion.x||0;var E=this._scanRegion.y||0;y=this.$overlay.style,y.width=`${p/r*_}px`,y.height=`${w/s*v}px`,y.top=`${d+k+E/s*v}px`,s=/scaleX\(-1\)/.test(t.style.transform),y.left=`${u+(s?o-b-_:b)+(s?r-m-p:m)/r*_}px`,y.transform=t.style.transform}})}static _convertPoints(t,r){if(!r)return t;let s=r.x||0,o=r.y||0,l=r.width&&r.downScaledWidth?r.width/r.downScaledWidth:1;r=r.height&&r.downScaledHeight?r.height/r.downScaledHeight:1;for(let u of t)u.x=u.x*l+s,u.y=u.y*r+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,r=1e3/this._maxScansPerSecond;t<r&&await new Promise(o=>setTimeout(o,r-t)),this._lastScanTimestamp=Date.now();try{var s=await Ie.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!Ie._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=Ie.createQrEngine()),s?(this._onDecode?this._onDecode(s):this._legacyOnDecode&&this._legacyOnDecode(s.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",s.cornerPoints.map(({x:o,y:l})=>`${o},${l}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(t){t!==Ie.NO_QR_CODE_FOUND&&console.log(t)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let t=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",r=[{width:{min:1024}},{width:{min:768}},{}],s=r.map(o=>Object.assign({},o,{[t]:{exact:this._preferredCamera}}));for(let o of[...s,...r])try{let l=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),u=this._getFacingMode(l)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:l,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 r of t.getTracks())r.stop(),t.removeTrack(r)}_setVideoMirror(t){this.$video.style.transform="scaleX("+(t==="user"?-1:1)+")"}_getFacingMode(t){return(t=t.getVideoTracks()[0])?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(t,r,s,o=!1){s=s||document.createElement("canvas");let l=r&&r.x?r.x:0,u=r&&r.y?r.y:0,d=r&&r.width?r.width:t.videoWidth||t.width,p=r&&r.height?r.height:t.videoHeight||t.height;return o||(o=r&&r.downScaledWidth?r.downScaledWidth:d,r=r&&r.downScaledHeight?r.downScaledHeight:p,s.width!==o&&(s.width=o),s.height!==r&&(s.height=r)),r=s.getContext("2d",{alpha:!1}),r.imageSmoothingEnabled=!1,r.drawImage(t,l,u,d,p,0,0,s.width,s.height),[s,r]}static async _loadImage(t){if(t instanceof Image)return await Ie._awaitImageLoad(t),t;if(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGImageElement||"OffscreenCanvas"in window&&t instanceof OffscreenCanvas||"ImageBitmap"in window&&t instanceof ImageBitmap)return t;if(t instanceof File||t instanceof Blob||t instanceof URL||typeof t=="string"){let r=new Image;r.src=t instanceof File||t instanceof Blob?URL.createObjectURL(t):t.toString();try{return await Ie._awaitImageLoad(r),r}finally{(t instanceof File||t instanceof Blob)&&URL.revokeObjectURL(r.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(t){t.complete&&t.naturalWidth!==0||await new Promise((r,s)=>{let o=l=>{t.removeEventListener("load",o),t.removeEventListener("error",o),l instanceof ErrorEvent?s("Image load error"):r()};t.addEventListener("load",o),t.addEventListener("error",o)})}static async _postWorkerMessage(t,r,s,o){return Ie._postWorkerMessageSync(await t,r,s,o)}static _postWorkerMessageSync(t,r,s,o){if(!(t instanceof Worker))return-1;let l=Ie._workerMessageId++;return t.postMessage({id:l,type:r,data:s},o),l}}Ie.DEFAULT_CANVAS_SIZE=400;Ie.NO_QR_CODE_FOUND="No QR code found";Ie._disableBarcodeDetector=!1;Ie._workerMessageId=0;function ux({onResult:e,onClose:t}){const r=L.useRef(null),s=L.useRef(null),o=L.useRef(!1),[l,u]=L.useState("");L.useEffect(()=>{let p=!1;const m=r.current,y=w=>{p||o.current||(o.current=!0,e(w))};return(async()=>{if(typeof navigator>"u"||!navigator.mediaDevices||typeof navigator.mediaDevices.getUserMedia!="function"){u(S("qr-unsupported"));return}let w=!1;try{w=await Ie.hasCamera()}catch{w=!1}if(!w){u(S("qr-no-camera"));return}if(p||!m)return;const _=new Ie(m,v=>{const b=jg(v);b&&y(b)},{returnDetailedScanResult:!0,preferredCamera:"environment",calculateScanRegion:v=>{const b=v.videoWidth||640,k=v.videoHeight||480,E=Math.max(1,Math.round(Math.min(b,k)*.92));return{x:Math.round((b-E)/2),y:Math.round((k-E)/2),width:E,height:E,downScaledWidth:600,downScaledHeight:600}},highlightScanRegion:!0,highlightCodeOutline:!0});s.current=_;try{await _.start()}catch(v){if(p)return;const b=v&&v.name||"";u(S(b==="NotAllowedError"||b==="SecurityError"?"qr-permission":b==="NotFoundError"||b==="OverconstrainedError"||b==="NotReadableError"?"qr-no-camera":"qr-unsupported"))}})(),()=>{p=!0;const w=s.current;if(w){try{w.stop()}catch{}try{w.destroy()}catch{}s.current=null}const _=m,v=_&&_.srcObject;if(v&&typeof v.getTracks=="function"){for(const b of v.getTracks())try{b.stop()}catch{}try{_.srcObject=null}catch{}}}},[]);const d=async p=>{const m=p.target.files&&p.target.files[0];if(p.target.value="",!!m)try{const y=await Ie.scanImage(m,{returnDetailedScanResult:!0}),w=jg(y);if(!w)throw new Error("empty");o.current||(o.current=!0,e(w))}catch{u(S("pairing-qr-invalid"))}};return h.jsx("div",{className:"nc-sheet-overlay nc-qr-overlay",onClick:t,children:h.jsxs("div",{className:"nc-sheet nc-qr-modal",onClick:p=>p.stopPropagation(),children:[h.jsx("div",{className:"nc-sheet-head",children:h.jsx("b",{children:S("scan-qr")})}),h.jsx("video",{ref:r,className:"nc-qr-video",playsInline:!0,muted:!0}),l&&h.jsx("div",{className:"nc-err",role:"alert",children:l}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsxs("label",{className:"nc-btn ghost nc-qr-upload",children:[S("qr-upload"),h.jsx("input",{type:"file",accept:"image/*",hidden:!0,onChange:d})]}),h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:t,children:S("cancel")})]})]})})}const Ag=()=>({name:"",label:"",ssh:"",sshPort:"",pairingUrl:"",localLabel:""});function C_({token:e,initial:t="",autoStart:r=!1,deviceDefault:s="",readonly:o=!1,onSuccess:l,onBusyChange:u}){const[d,p]=L.useState(Ag),[m,y]=L.useState(!1),[w,_]=L.useState(!1),[v,b]=L.useState("idle"),[k,E]=L.useState(null),[N,A]=L.useState(""),[z,I]=L.useState(!1),U=L.useRef(nx()),O=L.useRef(new Set),B=v==="busy";L.useEffect(()=>(u&&u(B),()=>{u&&u(!1)}),[B,u]);const X=async j=>{const J=String(j.pairingUrl||"").trim();if(U.current.start(J)){b("busy"),E(null),A("");try{await GS(e,rx(j,{deviceDefault:s})),b("ok"),y(!1),p(Ag()),O.current=new Set,I(!1),U.current.finish(),l&&await l()}catch(F){const Q=ox(F);E(Q),b("idle"),U.current.finish(),(Q.stage==="validation"||Q.stage==="conflict")&&y(!0)}}},q=(j,J=!0)=>{const{classification:F,form:Q}=Bg(d,j,O.current,z),$=Q.pairingUrl;if(E(null),A(""),v==="ok"&&b("idle"),p(Q),F.kind==="invalid"){E({stage:"validation",code:"bad-link",message:S("pair-invalid-link"),hint:S("pair-invalid-hint"),retryable:!0});return}if(F.kind==="partial"){y(!0),A(F.missing.includes("ssh")?S("pair-missing-ssh"):S("pair-missing-name"));return}F.kind==="complete"&&J&&!o&&U.current.canAuto($)&&X(Q)};L.useEffect(()=>{t&&q(t,r)},[]);const re=()=>{const j=String(d.pairingUrl||"").trim(),{classification:J,form:F}=Bg(d,j,O.current,z);if(p(F),A(""),E(null),J.kind==="empty"){E({stage:"validation",message:S("pairing-required"),retryable:!0});return}if(J.kind==="invalid"){E({stage:"validation",code:"bad-link",message:S("pair-invalid-link"),hint:S("pair-invalid-hint"),retryable:!0});return}if(!F.ssh||!F.name){y(!0),A(F.ssh?S("pair-missing-name"):S("pair-missing-ssh"));return}if(F.label&&!yh(F.label)){E({stage:"validation",message:S("err-label"),retryable:!0});return}if(F.localLabel&&!yh(F.localLabel)){E({stage:"validation",message:S("err-label"),retryable:!0});return}U.current.reset(j),X(F)},te=async()=>{try{if(!navigator.clipboard||typeof navigator.clipboard.readText!="function")throw new Error("unsupported");const j=await navigator.clipboard.readText();j&&j.trim()?q(j):A(S("pair-clipboard-empty"))}catch{A(S("pair-clipboard-denied"))}},x=(j,J)=>{O.current.add(j),p(F=>({...F,[j]:J}))},P=k&&k.stage&&(sx.includes(k.stage)||k.stage==="internal")?S(`pair-stage-${k.stage}`):S("pair-stage-generic");return h.jsxs("div",{className:"nc-set-form nc-pair-card",children:[h.jsx("div",{className:"nc-sheet-label",children:S("pair-card-title")}),h.jsx("div",{className:"nc-set-info",children:S("pair-card-help")}),h.jsx("input",{className:"nc-pair-input",placeholder:S("pair-paste-ph"),value:d.pairingUrl,disabled:o||B,onChange:j=>{p({...d,pairingUrl:j.target.value}),E(null),A("")},onPaste:j=>{const J=j.clipboardData&&j.clipboardData.getData("text")||"";J.trim()&&(j.preventDefault(),q(J))},onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),re())}}),h.jsxs("div",{className:"nc-pair-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||B,onClick:te,children:S("pair-paste-btn")}),h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||B,onClick:()=>_(!0),children:S("scan-qr")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:o||B,title:o?S("settings-readonly"):"",onClick:re,children:S("test-and-connect")})]}),h.jsxs("div",{className:"nc-pair-status","aria-live":"polite",children:[B&&h.jsx("div",{className:"nc-pair-progress",children:S("pair-progress")}),v==="ok"&&h.jsx("div",{className:"nc-set-test ok",children:S("node-connected")}),N&&h.jsx("div",{className:"nc-set-hint nc-pair-notice",children:N}),k&&h.jsxs("div",{className:"nc-err",role:"alert",children:[h.jsx("b",{children:P})," — ",k.message,k.hint&&h.jsx("div",{className:"nc-pair-hint",children:k.hint}),k.retryable&&h.jsx("div",{children:h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||B,onClick:re,children:S("pair-retry")})})]})]}),h.jsxs("button",{type:"button",className:"nc-btn ghost nc-pair-advanced-toggle",disabled:B,onClick:()=>y(j=>!j),children:[m?"▾":"▸"," ",S("pair-advanced")]}),m&&h.jsxs("div",{className:"nc-pair-advanced",children:[h.jsxs("label",{className:"nc-field",children:[S("node-display-label"),h.jsx("input",{placeholder:"Home Relay",value:d.label,disabled:o||B,onChange:j=>{O.current.add("label"),p(J=>({...J,label:j.target.value,name:z?J.name:$n(j.target.value)}))}})]}),h.jsxs("label",{className:"nc-field",children:[S("node-name-label"),h.jsx("input",{placeholder:S("node-name-ph"),value:d.name,disabled:o||B,onChange:j=>{I(!0),O.current.add("name"),p(J=>({...J,name:j.target.value?$n(j.target.value):""}))}})]}),h.jsx("small",{className:"nc-set-hint",children:S("node-slug-hint").replace("{slug}",d.name||"home-relay")}),h.jsxs("label",{className:"nc-field",children:[S("node-ssh-label"),h.jsx("input",{placeholder:"my-relay",value:d.ssh,disabled:o||B,onChange:j=>{O.current.add("ssh"),x("ssh",j.target.value)}})]}),h.jsxs("label",{className:"nc-field",children:[S("node-ssh-port-label"),h.jsx("input",{inputMode:"numeric",placeholder:S("node-ssh-port-help"),value:d.sshPort,disabled:o||B,onChange:j=>x("sshPort",j.target.value.replace(/[^0-9]/g,"").slice(0,5))})]}),h.jsxs("label",{className:"nc-field",children:[S("device-name-label"),h.jsx("input",{placeholder:s||"NexusCrew",value:d.localLabel,disabled:o||B,onChange:j=>x("localLabel",j.target.value)}),h.jsx("small",{className:"nc-set-hint",children:S("device-name-hint")})]})]}),w&&h.jsx(ux,{onResult:j=>{_(!1),q(j)},onClose:()=>_(!1)})]})}function Vh(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&typeof Notification<"u"}function hx(e){const t="=".repeat((4-e.length%4)%4),r=(e+t).replace(/-/g,"+").replace(/_/g,"/"),s=atob(r),o=new Uint8Array(s.length);for(let l=0;l<s.length;l+=1)o[l]=s.charCodeAt(l);return o}async function dx(){if(!Vh())return"unsupported";if(Notification.permission==="denied")return"denied";try{return await(await navigator.serviceWorker.ready).pushManager.getSubscription()?"subscribed":"idle"}catch{return"idle"}}async function fx(e){if(!Vh())throw new Error("push-unsupported");if(await Notification.requestPermission()!=="granted")throw new Error("push-denied");const r=await Pt("/api/push/vapid",e),{publicKey:s}=await r.json();if(!s)throw new Error("vapid non disponibile");const l=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:hx(s)}),u=await Pt("/api/push/subscribe",e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({subscription:l.toJSON()})});if(!u.ok){try{await l.unsubscribe()}catch{}const d=await u.json().catch(()=>({}));throw new Error(d.error||`HTTP ${u.status}`)}return!0}async function px(e){if(!Vh())return!1;const r=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!r)return!1;const s=r.endpoint;try{await r.unsubscribe()}catch{}try{await Pt("/api/push/subscribe",e,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:s})})}catch{}return!0}const x_="nexuscrew.cells",k_=1,mx=/^[A-Za-z0-9._-]{1,32}$/,E_=/^[a-z0-9._-]{1,32}$/,gx=new Set(["standard","unsafe"]),vx=4096,Og=256,_x=8192,yx=32,Sx=new Set(["format","version","exportedAt","cells"]),wx=new Set(["id","cwd","engine","boot","model","models","permissionPolicies","systemPrompt","prompt"]);function zg(e,t){if(e===void 0)return{};if(!e||typeof e!="object"||Array.isArray(e))return null;const r=Object.entries(e);if(r.length>128)return null;const s={};for(const[o,l]of r){if(!E_.test(o)||!t(l))return null;s[o]=l}return s}function N_(e){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(l=>!wx.has(l))||!mx.test(String(e.id||""))||typeof e.cwd!="string"||!e.cwd||e.cwd.length>vx||!E_.test(String(e.engine||""))||e.boot!==void 0&&typeof e.boot!="boolean"||e.model!==void 0&&(typeof e.model!="string"||e.model.length>Og)||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>_x)return null;const r=zg(e.models,l=>typeof l=="string"&&!!l&&l.length<=Og),s=zg(e.permissionPolicies,l=>gx.has(l));if(r===null||s===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(r).length&&(o.models=r),Object.keys(s).length&&(o.permissionPolicies=s),o}function bx(e,t,r=new Date){const s=t instanceof Set?t:new Set(t||[]),o=[];for(const l of Array.isArray(e)?e:[]){if(!s.has(l.id))continue;const u=N_({id:l.id,cwd:l.cwd,engine:l.engine,boot:l.boot===!0,...l.model?{model:l.model}:{},...l.models?{models:l.models}:{},...l.permissionPolicies?{permissionPolicies:l.permissionPolicies}:{},systemPrompt:l.prompt||""});u&&o.push(u)}return{format:x_,version:k_,exportedAt:r.toISOString(),cells:o}}function Cx(e){let t;try{t=JSON.parse(String(e||""))}catch{return{ok:!1,error:"invalid-json",cells:[]}}if(!t||typeof t!="object"||Array.isArray(t)||Object.keys(t).some(o=>!Sx.has(o))||t.format!==x_||t.version!==k_||!Array.isArray(t.cells)||t.cells.length>yx)return{ok:!1,error:"invalid-format",cells:[]};const r=new Set,s=[];for(const o of t.cells){const l=N_(o);if(!l)return{ok:!1,error:"invalid-cell",cells:[]};if(r.has(l.id))return{ok:!1,error:"duplicate-cell",cells:[]};r.add(l.id),s.push(l)}return{ok:!0,cells:s,exportedAt:typeof t.exportedAt=="string"?t.exportedAt:""}}function xx(e,t,r){const s=new Set(r||[]);if(!s.has(t))return null;const o=p=>Object.fromEntries(Object.entries(p||{}).filter(([m])=>s.has(m))),l={id:e.id,cwd:e.cwd,engine:t,boot:e.boot===!0,prompt:e.systemPrompt||""};t===e.engine&&e.model?l.model=e.model:e.models&&e.models[t]&&(l.model=e.models[t]);const u=o(e.models),d=o(e.permissionPolicies);return Object.keys(u).length&&(l.models=u),Object.keys(d).length&&(l.permissionPolicies=d),l}const kx=()=>({kind:"managed",id:"claude.native",label:"",client:"claude",provider:"native",credentialProfile:"",managedModel:"",permissionPolicy:"unsafe",displayName:"",protocol:"anthropic_messages",baseUrl:"",envKey:"",providerId:"nexuscrew-custom",command:"",argsText:"",rc:!0,promptMode:"send-keys",promptFlag:"",modelFlag:"",modelValue:"",envRows:[]}),Fg=(e="")=>({id:"",cwd:"",engine:e,boot:!1,model:"",prompt:""}),R_=e=>e==="claude"?"unsafe":"standard",Wa=(e,t)=>e.find(r=>r.client===t.client&&r.provider===t.provider&&(r.credentialProfile||"")===(t.credentialProfile||"")),Ex=(e,t)=>{var r;return((r=Wa(e,t))==null?void 0:r.label)||`${t.client} · ${t.provider}`};function Nx(e){var t,r,s,o,l,u,d,p,m,y,w,_,v,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:((r=e.managed)==null?void 0:r.provider)||"native",credentialProfile:((s=e.managed)==null?void 0:s.credentialProfile)||"",managedModel:((o=e.managed)==null?void 0:o.model)||"",permissionPolicy:((l=e.managed)==null?void 0:l.permissionPolicy)||R_((u=e.managed)==null?void 0:u.client),displayName:((d=e.managed)==null?void 0:d.displayName)||"",protocol:((p=e.managed)==null?void 0:p.protocol)||"",baseUrl:((m=e.managed)==null?void 0:m.baseUrl)||"",envKey:((y=e.managed)==null?void 0:y.envKey)||"",providerId:((w=e.managed)==null?void 0:w.providerId)||"nexuscrew-custom",modelOptions:e.availableModels||((_=e.managedInfo)==null?void 0:_.models)||[],promptMode:e.promptMode||"send-keys",promptFlag:e.promptFlag||"",modelFlag:((v=e.model)==null?void 0:v.flag)||"",modelValue:((b=e.model)==null?void 0:b.value)||"",envRows:(e.envKeys||[]).map(k=>({key:k,value:"",configured:!0,remove:!1}))}}function Rx(e,t,r=[]){if(e.kind==="managed"){const o={client:e.client,provider:e.provider,model:e.managedModel||"",permissionPolicy:e.permissionPolicy||R_(e.client)};e.credentialProfile&&(o.credentialProfile=e.credentialProfile);const l=Wa(r,e);return l!=null&&l.credentialEnv&&(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||Ex(r,e),rc:!!e.rc,managed:o}}const s={...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&&(s.model={flag:e.modelFlag,value:e.modelValue||""}),e.promptMode==="flag"&&(s.promptFlag=e.promptFlag),t&&(s.env=Object.fromEntries(e.envRows.filter(o=>!o.remove&&o.key).map(o=>[o.key,o.value]))),s}function Os({children:e,onClose:t,label:r,error:s=""}){const o=L.useRef(null),l=L.useRef(null),u=L.useRef(t);return u.current=t,L.useEffect(()=>{const d=document.activeElement,p=o.current,m=()=>Array.from((p==null?void 0:p.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))||[]).filter(_=>_.offsetParent!==null),y=requestAnimationFrame(()=>{var _;return(_=m()[0]||p)==null?void 0:_.focus({preventScroll:!0})}),w=_=>{var E;if(_.key==="Escape"){_.preventDefault(),(E=u.current)==null||E.call(u);return}if(_.key!=="Tab")return;const v=m();if(!v.length){_.preventDefault(),p==null||p.focus();return}const b=v[0],k=v[v.length-1];_.shiftKey&&document.activeElement===b?(_.preventDefault(),k.focus()):!_.shiftKey&&document.activeElement===k&&(_.preventDefault(),b.focus())};return document.addEventListener("keydown",w),()=>{cancelAnimationFrame(y),document.removeEventListener("keydown",w),d&&d.isConnected&&typeof d.focus=="function"&&d.focus({preventScroll:!0})}},[]),L.useEffect(()=>{s&&requestAnimationFrame(()=>{var d;return(d=l.current)==null?void 0:d.scrollIntoView({block:"nearest"})})},[s]),h.jsx("div",{className:"nc-fleet-modal",role:"presentation",onMouseDown:d=>{d.target===d.currentTarget&&t()},children:h.jsxs("div",{ref:o,className:"nc-fleet-modal-dialog",role:"dialog","aria-modal":"true","aria-label":r||S("settings"),tabIndex:-1,children:[e,s&&h.jsx("div",{ref:l,className:"nc-err nc-fleet-modal-error",role:"alert","aria-live":"assertive",children:s})]})})}function Px({token:e,readonly:t,targets:r=[],startNewCell:s=!1,initialLocation:o=""}){const[l,u]=L.useState({engines:[],cells:[],managedCatalog:[]}),[d,p]=L.useState({available:!1,capabilities:[]}),[m,y]=L.useState(null),[w,_]=L.useState(null),[v,b]=L.useState(!1),[k,E]=L.useState(""),[N,A]=L.useState(""),[z,I]=L.useState(o),[U,O]=L.useState(!1),[B,X]=L.useState(null),[q,re]=L.useState(null),[te,x]=L.useState(!1),[P,j]=L.useState("manage"),J=L.useRef(!1),F=z?z.split("/"):[],Q=L.useCallback(async()=>{try{const Y=await ln(e,F);p(Y);try{const ue=await Ph(e,F);O(!!ue.readonlyDefault)}catch{O(!1)}if(Y.provider==="builtin"&&(Y.capabilities||[]).includes("definitions")){const ue=await Nh(e,F),Ne=new Map((Y.engines||[]).map(Te=>[Te.id,Te]));ue.engines=(ue.engines||[]).map(Te=>{var Ve;return{...Te,availableModels:((Ve=Ne.get(Te.id))==null?void 0:Ve.models)||[]}}),u(ue)}}catch(Y){E(String(Y.message||Y))}},[e,z]);L.useEffect(()=>{Q();const Y=setInterval(Q,5e3);return()=>clearInterval(Y)},[Q]);const $=new Set((d.cells||[]).filter(Y=>Y.active).map(Y=>Y.cell)),K=d.provider==="builtin"&&(d.capabilities||[]).includes("edit"),G=(d.capabilities||[]).includes("restore");L.useEffect(()=>{!s||J.current||!K||!l.engines.length||(J.current=!0,_({mode:"new",form:Fg(l.engines[0].id)}))},[s,K,l.engines]);const R=async Y=>{b(!0),E(""),A("");try{await Y(),await Q()}catch(ue){E(String(ue.message||ue))}b(!1)},Z=()=>R(async()=>{const Y=m.mode==="new",ue=Rx(m.form,Y,l.managedCatalog||[]);!Y&&m.form.kind==="custom"&&!m.form.modelFlag&&(ue.model=null),!Y&&m.form.kind==="custom"&&m.form.promptMode!=="flag"&&(ue.promptFlag=null);let Ne;if(Y)Ne=await HS(e,ue,F);else{const Ve=m.original,tt=new Set(m.form.envRows.filter(Ye=>!Ye.remove).map(Ye=>Ye.key)),De=(Ve.envKeys||[]).filter(Ye=>!tt.has(Ye)),Ue=Object.fromEntries(m.form.envRows.filter(Ye=>!Ye.remove&&Ye.key&&(!Ye.configured||Ye.value!=="")).map(Ye=>[Ye.key,Ye.value]));Ne=await $S(e,Ve.id,ue,m.form.kind==="custom"?{set:Ue,remove:De}:void 0,F)}y(null),A(S("fleet-saved"));const Te=(Ne==null?void 0:Ne.activeCells)||[];if(Te.length&&window.confirm(S("fleet-restart-confirm").replace("{cells}",Te.join(", "))))for(const Ve of Te)await Sa(e,Ve,F)}),D=()=>R(async()=>{const Y=w.mode==="new",ue=w.form,Ne={...Y?{id:ue.id}:{},cwd:ue.cwd,engine:ue.engine,boot:!!ue.boot};Y?(ue.model&&(Ne.model=ue.model),ue.prompt&&(Ne.prompt=ue.prompt)):(Ne.model=ue.model||null,Ne.prompt=ue.prompt||null);const Te=Y?await US(e,Ne,F):await qS(e,w.original.id,Ne,F),Ve=Y?ue.id:w.original.id;_(null),A(S("fleet-saved")),!Y&&(Te!=null&&Te.active)&&window.confirm(S("fleet-restart-confirm").replace("{cells}",Ve))&&await Sa(e,Ve,F)}),T=t||U,se=Y=>X({...Y,route:Array.isArray(Y==null?void 0:Y.route)?Y.route:F}),oe=async Y=>{if(!B)return;const ue=B.cell||B.id,Ne=Array.isArray(B.route)?B.route:F;Y.action==="up"?await Eh(e,{cell:ue,boot:!!Y.boot,...Y.engine?{engine:Y.engine}:{},...Y.model!==void 0?{model:Y.model}:{},...Y.permissionPolicy?{permissionPolicy:Y.permissionPolicy}:{}},Ne):await Pa(e,{cell:ue,boot:!!Y.boot},Ne)},ae=(Y,ue)=>{E(""),re({mode:"new",route:Array.isArray(ue)?ue:F,form:{tmuxSession:Y.name,id:"",engine:"",cwd:"",boot:!1},err:""})},ge=()=>R(async()=>{const Y=q.form;if(!Y.engine){re({...q,err:S("import-engine-required")});return}await KS(e,{tmuxSession:Y.tmuxSession,id:Y.id||void 0,engine:Y.engine,cwd:Y.cwd||void 0,boot:!!Y.boot},Y.route||F),re(null),A(S("fleet-saved"))}),we=Y=>R(async()=>{const ue=l.engines.map(De=>De.id),Ne=[];for(const De of Y){const Ue=xx(De.cell,De.engine,ue);if(!Ue)throw new Error(`${De.cell.id}: ${S("fleet-backup-engine-missing")}`);Ne.push(Ue)}const Te=Y.filter(De=>De.exists).map(De=>De.cell.id);if(Te.length&&!window.confirm(S("fleet-backup-confirm-overwrite").replace("{cells}",Te.join(", "))))return;const tt=(await VS(e,Ne,F)).needsRestart||[];x(!1),A(`${S("fleet-backup-restored").replace("{n}",String(Y.length))}${tt.length?` · ${S("fleet-backup-needs-restart").replace("{cells}",tt.join(", "))}`:""}`)}),_e=h.jsxs("label",{className:"nc-field",children:[S("location"),h.jsxs("select",{value:z,onChange:Y=>{I(Y.target.value),y(null),_(null),E(""),A(""),O(!1),p({available:!1,capabilities:[]}),u({engines:[],cells:[],managedCatalog:[]})},children:[h.jsx("option",{value:"",children:S("local")}),r.map(Y=>h.jsxs("option",{value:Y.route.join("/"),disabled:Y.status&&Y.status!=="up",children:[Y.label,Y.status&&Y.status!=="up"?` · ${S("node-offline")}`:""]},Y.route.join("/")))]})]}),W=h.jsxs("div",{className:"nc-fleet-view-tabs",role:"tablist","aria-label":S("tab-fleet"),children:[h.jsx("button",{type:"button",role:"tab","aria-selected":P==="manage",className:`nc-set-tabbtn${P==="manage"?" on":""}`,onClick:()=>j("manage"),children:S("fleet-manage-location")}),h.jsx("button",{type:"button",role:"tab","aria-selected":P==="overview",className:`nc-set-tabbtn${P==="overview"?" on":""}`,onClick:()=>j("overview"),children:S("fleet-network-overview")})]});return K?h.jsxs("div",{className:"nc-set-tab nc-fleet-editor",children:[W,P==="overview"?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"nc-set-info",children:S("fleet-overview-help")}),h.jsx(Hg,{token:e,targets:r,readonly:t,onPower:se,onImport:ae})]}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"nc-set-info",children:S("fleet-manage-help")}),_e,h.jsxs("div",{className:"nc-fleet-section-head",children:[h.jsx("b",{children:S("fleet-cells")}),h.jsxs("span",{className:"nc-fleet-head-actions",children:[h.jsx("button",{className:"nc-btn ghost",disabled:T||v,onClick:()=>{E(""),x(!0)},children:S("fleet-backup")}),h.jsxs("button",{className:"nc-btn primary",disabled:T||v||!l.engines.length,onClick:()=>{var Y;E(""),_({mode:"new",form:Fg((Y=l.engines[0])==null?void 0:Y.id)})},children:["+ ",S("add")]})]})]}),l.cells.map(Y=>{const ue=$.has(Y.id),Ne=d.capabilities||[];return h.jsxs("div",{className:"nc-fleet-item",children:[h.jsxs("span",{children:[h.jsx("b",{children:Y.id}),h.jsxs("small",{children:[Y.engine," · ",Y.cwd,ue?` · ${S("service-active")}`:` · ${S("cell-off")}`]})]}),h.jsxs("span",{children:[ue&&Ne.includes("down")&&h.jsx("button",{className:"nc-btn ghost",disabled:T||v,onClick:()=>R(()=>Pa(e,{cell:Y.id},F)),children:S("stop")}),!ue&&Ne.includes("up")&&h.jsx("button",{className:"nc-btn primary",disabled:T||v,onClick:()=>se({cell:Y.id,id:Y.id,engine:Y.engine,model:Y.model,models:Y.models,permissionPolicies:Y.permissionPolicies,active:!1,boot:Y.boot}),children:S("start")}),ue&&Ne.includes("restart")&&h.jsx("button",{className:"nc-btn ghost",disabled:T||v,onClick:()=>R(()=>Sa(e,Y.id,F)),children:S("restart")}),h.jsx("button",{className:"nc-btn ghost",disabled:T||v,onClick:()=>{E(""),_({mode:"edit",original:Y,form:{...Y}})},children:S("edit")}),h.jsx("button",{className:"nc-btn danger",disabled:T||v,onClick:()=>R(async()=>{window.confirm(S("fleet-remove-cell").replace("{id}",Y.id))&&await Qg(e,Y.id,!0,F)}),children:"×"})]})]},Y.id)}),h.jsxs("div",{className:"nc-fleet-section-head",children:[h.jsx("b",{children:S("fleet-engines")}),h.jsxs("button",{className:"nc-btn primary",disabled:T||v,onClick:()=>{E(""),y({mode:"new",form:kx()})},children:["+ ",S("add")]})]}),l.engines.map(Y=>{var ue,Ne;return h.jsxs("div",{className:"nc-fleet-item",children:[h.jsxs("span",{children:[h.jsx("b",{children:Y.label}),h.jsx("small",{children:Y.managed?`${Y.id} · ${Y.managed.client} / ${Y.managed.provider} · ${(ue=Y.managedInfo)!=null&&ue.configured?S("fleet-ready"):((Ne=Y.managedInfo)==null?void 0:Ne.reason)||S("fleet-not-ready")}`:`${Y.id} · ${Y.command}`})]}),h.jsxs("span",{children:[h.jsx("button",{className:"nc-btn ghost",disabled:T||v,onClick:()=>{E(""),y({mode:"edit",original:Y,form:Nx(Y)})},children:S("edit")}),h.jsx("button",{className:"nc-btn danger",disabled:T||v,onClick:()=>R(async()=>{window.confirm(S("fleet-remove-engine").replace("{id}",Y.id))&&await WS(e,Y.id,F)}),children:"×"})]})]},Y.id)})]}),m&&h.jsx(Os,{onClose:()=>y(null),label:S("fleet-new-engine"),error:k,children:h.jsx(Lx,{state:m,setState:y,busy:v,onSave:Z,catalog:l.managedCatalog||[]})}),w&&h.jsx(Os,{onClose:()=>_(null),label:S("fleet-new-cell"),error:k,children:h.jsx(Mx,{token:e,route:F,targets:r,location:z,setLocation:I,state:w,setState:_,engines:l.engines,busy:v,onSave:D})}),N&&h.jsx("div",{className:"nc-set-note",children:N}),k&&h.jsx("div",{className:"nc-err",children:k}),te&&h.jsx(Os,{onClose:()=>x(!1),label:S("fleet-backup"),error:k,children:h.jsx(Dx,{cells:l.cells,engines:l.engines,busy:v,canRestore:G,onRestore:we,onClose:()=>x(!1)})}),q&&h.jsx(Os,{onClose:()=>re(null),label:S("import-as-cell"),error:k,children:h.jsx($g,{token:e,route:q.route||F,state:q,setState:re,busy:v,onSave:ge})}),B&&h.jsx(Ma,{cell:B,token:e,route:Array.isArray(B.route)?B.route:F,onConfirm:async Y=>{try{await oe(Y)}finally{await Q()}},onClose:()=>X(null)})]}):h.jsxs("div",{className:"nc-set-tab",children:[W,P==="overview"?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"nc-set-info",children:S("fleet-overview-help")}),h.jsx(Hg,{token:e,targets:r,readonly:t,onPower:se,onImport:ae})]}):h.jsxs(h.Fragment,{children:[_e,h.jsx("div",{className:"nc-set-info",children:S("fleet-editor-unavailable")})]}),k&&h.jsx("div",{className:"nc-err",children:k}),q&&h.jsx(Os,{onClose:()=>re(null),label:S("import-as-cell"),error:k,children:h.jsx($g,{token:e,route:q.route||F,state:q,setState:re,busy:v,onSave:ge})}),B&&h.jsx(Ma,{cell:B,token:e,route:Array.isArray(B.route)?B.route:F,onConfirm:async Y=>{try{await oe(Y)}finally{await Q()}},onClose:()=>X(null)})]})}function Hg({token:e,targets:t=[],readonly:r=!1,onPower:s,onImport:o}){const[l,u]=L.useState([]),[d,p]=L.useState(0);L.useEffect(()=>{let E=!0;async function N(){const z=[{route:[],label:S("local")}].concat((t||[]).map(U=>({route:Array.isArray(U.route)?U.route:[],label:U.label||(U.route||[]).join(" › ")}))),I=await Promise.all(z.map(async U=>{const O={...U,available:!1,readonly:!1,capabilities:[],provider:null,cells:[],unmanaged:[],err:""};try{const B=await ln(e,U.route);O.available=!!B.available,O.capabilities=B.capabilities||[],O.provider=B.provider||null,O.cells=(B.cells||[]).map(X=>({...X,route:U.route}));try{O.readonly=!!(await Ph(e,U.route)).readonlyDefault}catch{}try{const X=await tv(e,U.route),q=new Set(O.cells.map(re=>re.tmuxSession).filter(Boolean));O.unmanaged=(X.sessions||[]).filter(re=>re&&!q.has(re.name))}catch{}}catch(B){O.err=String(B&&B.message||B)}return O}));E&&u(I)}N();const A=setInterval(N,6e3);return()=>{E=!1,clearInterval(A)}},[e,t,d]);const m=(E,N)=>Array.isArray(E.capabilities)&&E.capabilities.includes(N)&&!r&&!E.readonly,y=()=>p(E=>E+1),w=(E,N)=>{s&&s({...E,route:N})},_=(E,N)=>{s&&s({...E,route:N})},v=async(E,N)=>{try{await Sa(e,E.cell,N)}catch{}y()},b=async(E,N)=>{if(window.confirm(S("fleet-remove-cell").replace("{id}",E.cell))){try{await Qg(e,E.cell,!0,N)}catch{}y()}},k=async(E,N)=>{if(window.confirm(S("terminate-confirm").replace("{name}",E.name))){try{await Rh(e,E.name,N)}catch{}y()}};return h.jsxs("div",{className:"nc-fleet-inventory",children:[h.jsxs("div",{className:"nc-fleet-section-head",children:[h.jsx("b",{children:S("fleet-inventory")}),h.jsx("small",{children:S("fleet-inventory-help")})]}),l.map(E=>{const N=E.route.length?E.route.join("/"):"local";return h.jsxs("div",{className:"nc-fleet-pos",children:[h.jsxs("div",{className:"nc-fleet-pos-title",children:[h.jsx("span",{className:`dot ${E.available?"on":"warn"}`}),h.jsx("b",{children:E.label}),h.jsx("small",{children:E.available?`${E.cells.length} ${S("fleet-cells")} · ${E.unmanaged.length} ${S("fleet-tmux")}`:E.err||S("fleet-not-available")})]}),E.cells.map(A=>h.jsxs("div",{className:"nc-fleet-item nc-fleet-cell",children:[h.jsxs("span",{children:[h.jsx("b",{children:A.cell}),h.jsx("small",{children:`${A.engine||""}${A.key?`·${A.key}`:""}${A.active?"":` · ${S("cell-off")}`}`})]}),h.jsxs("span",{className:"nc-fleet-cell-actions",children:[A.active&&m(E,"down")&&h.jsx("button",{className:"nc-btn ghost",title:S("power-off"),onClick:()=>_(A,E.route),children:S("stop")}),!A.active&&m(E,"up")&&h.jsx("button",{className:"nc-btn ghost",title:S("power-on"),onClick:()=>w(A,E.route),children:S("start")}),m(E,"restart")&&A.active&&h.jsx("button",{className:"nc-btn ghost",title:S("restart"),onClick:()=>v(A,E.route),children:S("restart")}),m(E,"remove")&&h.jsx("button",{className:"nc-btn danger",title:S("delete"),onClick:()=>b(A,E.route),children:"×"})]})]},`${N}:${A.cell}`)),E.unmanaged.map(A=>h.jsxs("div",{className:"nc-fleet-item nc-fleet-unmanaged",children:[h.jsxs("span",{children:[h.jsx("b",{children:A.name}),h.jsx("small",{children:S("fleet-tmux")})]}),h.jsxs("span",{className:"nc-fleet-cell-actions",children:[m(E,"import")&&o&&h.jsx("button",{className:"nc-btn ghost",title:S("import-as-cell"),onClick:()=>o(A,E.route),children:S("import-as-cell")}),h.jsx("button",{className:"nc-btn danger",title:S("terminate"),onClick:()=>k(A,E.route),children:"×"})]})]},`${N}:u:${A.name}`)),E.available&&E.cells.length===0&&E.unmanaged.length===0&&h.jsx("div",{className:"nc-empty",children:S("fleet-inventory-empty")})]},N)})]})}function Dx({cells:e=[],engines:t=[],busy:r,canRestore:s=!1,onRestore:o,onClose:l}){const[u,d]=L.useState("export"),[p,m]=L.useState(()=>new Set(e.map(U=>U.id))),[y,w]=L.useState([]),[_,v]=L.useState(""),b=t.map(U=>U.id),k=new Set(e.map(U=>U.id)),E=U=>m(O=>{const B=new Set(O);return B.has(U)?B.delete(U):B.add(U),B}),N=()=>{const U=bx(e,p);if(!U.cells.length){v(S("fleet-backup-select-one"));return}const O=new Blob([`${JSON.stringify(U,null,2)}
|
|
91
|
-
`],{type:"application/json"}),B=URL.createObjectURL(O),X=document.createElement("a");X.href=B,X.download=`nexuscrew-cells-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(X),X.click(),X.remove(),setTimeout(()=>URL.revokeObjectURL(B),0),v("")},A=async U=>{if(v(""),w([]),!!U){if(U.size>1024*1024){v(S("fleet-backup-too-large"));return}try{const O=Cx(await U.text());if(!O.ok){v(S(`fleet-backup-${O.error}`));return}w(O.cells.map(B=>{const X=b.includes(B.engine),q=k.has(B.id);return{cell:B,engine:X?B.engine:"",selected:X&&!q,exists:q}}))}catch(O){v(String(O.message||O))}}},z=(U,O)=>w(B=>B.map((X,q)=>q===U?{...X,...O}:X)),I=y.filter(U=>U.selected&&U.engine);return h.jsxs("div",{className:"nc-set-form nc-fleet-form nc-backup-dialog",children:[h.jsx("b",{children:S("fleet-backup")}),h.jsx("small",{children:S("fleet-backup-help")}),h.jsxs("div",{className:"nc-set-tabs nc-backup-tabs",children:[h.jsx("button",{type:"button",className:`nc-set-tabbtn${u==="export"?" on":""}`,onClick:()=>{d("export"),v("")},children:S("fleet-backup-export")}),h.jsx("button",{type:"button",className:`nc-set-tabbtn${u==="import"?" on":""}`,disabled:!s,title:s?"":S("fleet-backup-restore-unavailable"),onClick:()=>{d("import"),v("")},children:S("fleet-backup-import")})]}),u==="export"?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>m(new Set(e.map(U=>U.id))),children:S("select-all")}),h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>m(new Set),children:S("select-none")})]}),h.jsxs("div",{className:"nc-backup-list",children:[e.map(U=>h.jsxs("label",{className:"nc-check nc-backup-row",children:[h.jsx("input",{type:"checkbox",checked:p.has(U.id),onChange:()=>E(U.id)}),h.jsxs("span",{children:[h.jsx("b",{children:U.id}),h.jsxs("small",{children:[U.engine," · ",S("fleet-system-prompt")," ",(U.prompt||"").length," ",S("characters")]})]})]},U.id)),!e.length&&h.jsx("div",{className:"nc-empty",children:S("fleet-backup-empty")})]}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:l,children:S("cancel")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:!p.size,onClick:N,children:S("fleet-backup-download")})]})]}):h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"file",accept:"application/json,.json",disabled:r,onChange:U=>A(U.target.files&&U.target.files[0])}),h.jsx("small",{children:S("fleet-backup-import-help")}),!!y.length&&h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>w(U=>U.map(O=>({...O,selected:!!O.engine}))),children:S("select-all")}),h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>w(U=>U.map(O=>({...O,selected:!1}))),children:S("select-none")})]}),h.jsx("div",{className:"nc-backup-list",children:y.map((U,O)=>h.jsxs("div",{className:"nc-backup-import-row",children:[h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:U.selected,disabled:!U.engine,onChange:B=>z(O,{selected:B.target.checked})}),h.jsxs("span",{children:[h.jsx("b",{children:U.cell.id}),h.jsxs("small",{children:[U.exists?S("fleet-backup-overwrite"):S("fleet-backup-new")," · ",S("fleet-system-prompt")," ",U.cell.systemPrompt.length," ",S("characters")]})]})]}),h.jsxs("select",{value:U.engine,onChange:B=>z(O,{engine:B.target.value,selected:!!B.target.value}),children:[h.jsx("option",{value:"",children:S("fleet-backup-engine-missing")}),t.map(B=>h.jsx("option",{value:B.id,children:B.label||B.id},B.id))]})]},U.cell.id))}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:l,children:S("cancel")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:r||!I.length,onClick:()=>o(I),children:S("fleet-backup-restore")})]})]}),_&&h.jsx("div",{className:"nc-err",children:_})]})}function Lx({state:e,setState:t,busy:r,onSave:s,catalog:o}){var _;const l=e.form,u=v=>t({...e,form:{...l,...v}}),d=l.envRows||[],p=[...new Map(o.map(v=>[v.client,v.clientLabel||v.client])).entries()],m=o.filter(v=>v.client===l.client),y=Wa(o,l),w=v=>{v&&u({client:v.client,provider:v.provider,credentialProfile:v.credentialProfile||"",managedModel:v.model||"",protocol:v.protocol||"",permissionPolicy:v.permissionPolicyDefault||"standard",rc:!!v.rc,displayName:v.custom?S("fleet-custom-provider-default"):"",baseUrl:v.custom?"":v.endpoint||"",envKey:v.defaultEnvKey||"",providerId:"nexuscrew-custom",...e.mode==="new"?{id:v.id,label:""}:{}})};return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsx("b",{children:e.mode==="new"?S("fleet-new-engine"):`${S("edit")} ${l.id}`}),h.jsx("input",{value:l.id,disabled:e.mode!=="new",placeholder:"id",onChange:v=>u({id:v.target.value})}),h.jsx("input",{value:l.label,placeholder:S("label"),onChange:v=>u({label:v.target.value})}),h.jsxs("select",{value:l.kind,disabled:e.mode!=="new",onChange:v=>u({kind:v.target.value}),children:[h.jsx("option",{value:"managed",children:S("fleet-managed")}),h.jsx("option",{value:"custom",children:S("fleet-custom")})]}),l.kind==="managed"?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("select",{value:l.client,disabled:e.mode!=="new",onChange:v=>w(o.find(b=>b.client===v.target.value&&b.default)||o.find(b=>b.client===v.target.value)),children:p.map(([v,b])=>h.jsx("option",{value:v,children:b},v))}),h.jsx("select",{value:((_=Wa(o,l))==null?void 0:_.id)||"",disabled:e.mode!=="new",onChange:v=>w(o.find(b=>b.id===v.target.value)),children:m.map(v=>h.jsx("option",{value:v.id,children:v.label},v.id))})]}),h.jsx("input",{value:l.managedModel,list:"nc-managed-models",placeholder:S(y!=null&&y.requiresModel?"fleet-model-required":"fleet-model-default"),onChange:v=>u({managedModel:v.target.value})}),h.jsx("datalist",{id:"nc-managed-models",children:[...(y==null?void 0:y.models)||[],...l.modelOptions||[]].filter((v,b,k)=>v&&k.indexOf(v)===b).map(v=>h.jsx("option",{value:v},v))}),y!=null&&y.supportsUnsafe?h.jsxs("select",{value:l.permissionPolicy,onChange:v=>u({permissionPolicy:v.target.value}),children:[h.jsx("option",{value:"standard",children:S("fleet-standard-permissions")}),h.jsx("option",{value:"unsafe",children:S("fleet-unsafe-permissions")})]}):h.jsx("small",{children:S("fleet-standard-permissions")}),(y==null?void 0:y.supportsUnsafe)&&l.permissionPolicy==="unsafe"&&h.jsx("small",{className:"nc-err",children:S("fleet-unsafe-warning")}),(y==null?void 0:y.credentialEnv)&&h.jsxs(h.Fragment,{children:[h.jsx("input",{value:l.envKey,placeholder:S("fleet-api-key-env"),onChange:v=>u({envKey:v.target.value})}),h.jsx("small",{children:S("fleet-custom-secret-help")})]}),l.provider==="custom"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{value:l.displayName,placeholder:S("fleet-provider-display"),onChange:v=>u({displayName:v.target.value})}),h.jsx("input",{value:l.baseUrl,placeholder:"https://api.example.com/v1",onChange:v=>u({baseUrl:v.target.value})}),((y==null?void 0:y.protocols)||[]).length>1&&h.jsx("select",{value:l.protocol,onChange:v=>u({protocol:v.target.value}),children:y.protocols.map(v=>h.jsx("option",{value:v,children:v},v))}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:l.envKey,placeholder:S("fleet-api-key-env"),onChange:v=>u({envKey:v.target.value})}),h.jsx("input",{value:l.providerId,placeholder:S("fleet-provider-id"),onChange:v=>u({providerId:v.target.value})})]}),h.jsxs("small",{children:[l.protocol," · ",S("fleet-custom-secret-help")]})]}),h.jsx("small",{children:S("fleet-managed-help")})]}):h.jsxs(h.Fragment,{children:[h.jsx("input",{value:l.command,placeholder:S("command-path"),onChange:v=>u({command:v.target.value})}),h.jsx("textarea",{value:l.argsText,placeholder:S("args-lines"),onChange:v=>u({argsText:v.target.value})}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:l.rc,onChange:v=>u({rc:v.target.checked})})," remote control"]}),h.jsxs("select",{value:l.promptMode,onChange:v=>u({promptMode:v.target.value}),children:[h.jsx("option",{value:"send-keys",children:"send-keys"}),h.jsx("option",{value:"flag",children:"flag"})]}),l.promptMode==="flag"&&h.jsx("input",{value:l.promptFlag,placeholder:"prompt flag",onChange:v=>u({promptFlag:v.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:l.modelFlag,placeholder:"model flag",onChange:v=>u({modelFlag:v.target.value})}),h.jsx("input",{value:l.modelValue,placeholder:"model default",onChange:v=>u({modelValue:v.target.value})})]}),h.jsx("small",{children:S("env-write-only")}),d.map((v,b)=>h.jsxs("div",{className:"nc-fleet-env",children:[h.jsx("input",{value:v.key,disabled:v.configured,placeholder:"ENV_KEY",onChange:k=>{const E=d.slice();E[b]={...v,key:k.target.value},u({envRows:E})}}),h.jsx("input",{type:"password",value:v.value,placeholder:v.configured?"•••••• (unchanged)":"value",onChange:k=>{const E=d.slice();E[b]={...v,value:k.target.value},u({envRows:E})}}),h.jsx("button",{className:"nc-btn danger",onClick:()=>u({envRows:d.filter((k,E)=>E!==b)}),children:"×"})]},`${v.key}-${b}`)),h.jsx("button",{className:"nc-btn ghost",onClick:()=>u({envRows:[...d,{key:"",value:"",configured:!1}]}),children:"+ env"})]}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>t(null),children:S("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:r||!l.id||l.kind==="custom"&&!l.command||l.kind==="managed"&&(y==null?void 0:y.requiresModel)&&!l.managedModel||l.kind==="managed"&&(y==null?void 0:y.credentialEnv)&&!l.envKey||l.kind==="managed"&&l.provider==="custom"&&(!l.displayName||!l.baseUrl||!l.envKey||!l.providerId),onClick:s,children:S("save")})]})]})}function Mx({token:e,route:t,targets:r=[],location:s,setLocation:o,state:l,setState:u,engines:d,busy:p,onSave:m}){const[y,w]=L.useState(null),[_,v]=L.useState(""),b=l.form,k=z=>u({...l,form:{...b,...z}}),E=d.find(z=>z.id===b.engine),N=z=>{var U,O,B;const I=d.find(X=>X.id===z);k({engine:z,model:((U=b.models)==null?void 0:U[z])||((O=I==null?void 0:I.managed)==null?void 0:O.model)||((B=I==null?void 0:I.model)==null?void 0:B.value)||""})},A=async z=>{try{const I=await Jg(e,z,t);w(I),k({cwd:I.path}),v("")}catch(I){v(String(I.message||I))}};return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsx("b",{children:l.mode==="new"?S("fleet-new-cell"):`${S("edit")} ${b.id}`}),l.mode==="new"&&h.jsxs("label",{className:"nc-field",children:[S("location"),h.jsx("span",{className:"nc-req",children:" *"}),h.jsxs("select",{value:s,onChange:z=>{o(z.target.value),k({engine:""})},children:[h.jsx("option",{value:"",children:S("local")}),r.map(z=>h.jsxs("option",{value:z.route.join("/"),disabled:z.status&&z.status!=="up",children:[z.label,z.status&&z.status!=="up"?` · ${S("node-offline")}`:""]},z.route.join("/")))]})]}),h.jsx("input",{value:b.id,disabled:l.mode!=="new",placeholder:"id",onChange:z=>k({id:z.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:b.cwd,placeholder:S("cwd"),onChange:z=>k({cwd:z.target.value})}),h.jsx("button",{className:"nc-btn ghost",onClick:()=>y?w(null):A(b.cwd),children:S("browse")})]}),y&&h.jsxs("div",{className:"nc-fs",children:[h.jsx("div",{className:"nc-fs-path",children:y.path}),h.jsxs("div",{className:"nc-fs-list",children:[y.parent&&h.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>A(y.parent),children:["↑ ",S("fs-parent")]}),(y.dirs||[]).map(z=>h.jsxs("button",{className:"nc-fs-item",onClick:()=>A(`${y.path.replace(/\/$/,"")}/${z}`),children:["📁 ",z]},z))]})]}),_&&h.jsx("div",{className:"nc-err",children:_}),h.jsx("select",{value:b.engine,onChange:z=>N(z.target.value),children:d.map(z=>h.jsx("option",{value:z.id,children:z.label},z.id))}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:!!b.boot,onChange:z=>k({boot:z.target.checked})})," boot"]}),h.jsx("input",{value:b.model||"",list:"nc-cell-models",placeholder:S("fleet-model-override"),onChange:z=>k({model:z.target.value})}),h.jsx("datalist",{id:"nc-cell-models",children:((E==null?void 0:E.availableModels)||[]).map(z=>h.jsx("option",{value:z},z))}),h.jsx("textarea",{value:b.prompt||"",placeholder:"prompt",onChange:z=>k({prompt:z.target.value})}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>u(null),children:S("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:p||!b.id||!b.cwd||!b.engine,onClick:m,children:S("save")})]})]})}function $g({token:e,route:t=[],state:r,setState:s,busy:o,onSave:l}){const[u,d]=L.useState(null),[p,m]=L.useState([]),[y,w]=L.useState(""),_=Array.isArray(t)?t.join("/"):"";L.useEffect(()=>{let N=!0;return Nh(e,_?_.split("/"):[]).then(A=>{N&&(m(A.engines||[]),w(""))}).catch(A=>{N&&(m([]),w(String(A.message||A)))}),()=>{N=!1}},[e,_]);const v=r.form,b=N=>s({...r,form:{...v,...N}}),k=async N=>{try{const A=await Jg(e,N,t);d(A),b({cwd:A.path})}catch{}},E=!v.id&&v.tmuxSession?v.tmuxSession.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32):v.id;return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsxs("b",{children:[S("import-as-cell")," · ",v.tmuxSession]}),h.jsx("small",{children:S("import-help")}),h.jsx("input",{value:v.tmuxSession,disabled:!0,placeholder:"tmux session",readOnly:!0}),h.jsx("input",{value:v.id,placeholder:S("name"),onChange:N=>b({id:N.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:v.cwd,placeholder:S("cwd"),onChange:N=>b({cwd:N.target.value})}),h.jsx("button",{className:"nc-btn ghost",type:"button",onClick:()=>u?d(null):k(v.cwd),children:S("browse")})]}),u&&h.jsxs("div",{className:"nc-fs",children:[h.jsx("div",{className:"nc-fs-path",children:u.path}),h.jsxs("div",{className:"nc-fs-list",children:[u.parent&&h.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>k(u.parent),children:["↑ ",S("fs-parent")]}),(u.dirs||[]).map(N=>h.jsxs("button",{className:"nc-fs-item",onClick:()=>k(`${u.path.replace(/\/$/,"")}/${N}`),children:["📁 ",N]},N))]})]}),h.jsxs("select",{value:v.engine,onChange:N=>b({engine:N.target.value}),children:[h.jsx("option",{value:"",children:S("import-engine-required")}),p.map(N=>h.jsx("option",{value:N.id,children:N.label},N.id))]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:!!v.boot,onChange:N=>b({boot:N.target.checked})})," boot"]}),(r.err||y)&&h.jsx("div",{className:"nc-err",children:r.err||y}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>s(null),children:S("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:o||!v.tmuxSession||!v.engine||!p.length,onClick:l,children:S(E?"import-as-cell":"save")})]})]})}function Tx({text:e}){const[t,r]=L.useState(!1),s=async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}};return h.jsxs("div",{className:"nc-set-copyline",children:[h.jsx("code",{children:e}),h.jsxs("button",{type:"button",className:"nc-btn ghost",onClick:s,children:[h.jsx(Ke,{name:"copy",size:14})," ",S(t?"copied":"copy")]})]})}function jx({value:e}){const[t,r]=L.useState("");return L.useEffect(()=>{let s=!0;return $C.toDataURL(e,{margin:1,width:220}).then(o=>{s&&r(o)}).catch(()=>{}),()=>{s=!1}},[e]),t?h.jsx("img",{src:t,width:"220",height:"220",alt:"NexusCrew pairing QR"}):null}function Bx({token:e,nodes:t,settings:r,readonly:s,refresh:o}){const[l,u]=L.useState(null),[d,p]=L.useState(null),[m,y]=L.useState({}),[w,_]=L.useState(null),[v,b]=L.useState({ssh:"",sshPort:"",name:""}),[k,E]=L.useState(""),[N,A]=L.useState(""),[z,I]=L.useState(!1),U=Date.now(),O=r&&r.deviceName||"",B=(t||[]).filter(x=>x&&x.direction==="outbound"&&x.name&&x.ssh),X=B.find(x=>x.name===k)||B[0]||null,q=async(x,P)=>{u(null),p(`${x}:${P}`);try{const j=await Dh(e,x,P);P==="test"&&y(J=>({...J,[x]:j})),await o()}catch(j){u(`${x}: ${String(j.message||j)}`)}p(null)},re=async x=>{if(window.confirm(S("node-remove-confirm").replace("{name}",x))){u(null),p(`${x}:remove`);try{await JS(e,x),await o()}catch(P){u(`${x}: ${String(P.message||P)}`)}p(null)}},te=async()=>{if(u(null),X){const j=Tg({name:X.name,ssh:X.ssh,sshPort:X.sshPort||""});if(!j.ok){u(S(j.error));return}p("invite");try{_(await Wp(e,{ssh:j.value.ssh,...j.value.sshPort?{sshPort:j.value.sshPort}:{}},[X.name]))}catch(J){u(String(J.message||J))}p(null);return}const x=$n(v.name||N||O||"NexusCrew"),P=Tg({name:x,ssh:v.ssh,sshPort:v.sshPort});if(!P.ok){u(S(P.error));return}p("invite");try{_(await Wp(e,{...N||O?{label:N||O}:{},name:x,ssh:P.value.ssh,...P.value.sshPort?{sshPort:P.value.sshPort}:{}}))}catch(j){u(String(j.message||j))}p(null)};return h.jsxs("div",{className:"nc-set-tab",children:[h.jsx(C_,{token:e,deviceDefault:O,readonly:s,onSuccess:o}),(t||[]).length===0&&h.jsx("div",{className:"nc-empty",children:S("no-nodes")}),(t||[]).map(x=>{var J,F,Q,$,K;const P=XC(x.tunnel,U),j=m[x.name];return h.jsxs("div",{className:"nc-set-node",children:[h.jsxs("div",{className:"nc-set-node-head",children:[h.jsx("span",{className:`nc-dot ${P.up?"on":""}`}),h.jsx("b",{children:x.label||x.name}),h.jsxs("small",{children:[x.name,x.direction==="outbound"?` · SSH ${x.ssh||""}`:` · ${S("node-connected-client")}`,(J=x.tunnel)!=null&&J.transport?` · ${x.tunnel.transport} ${S("transport-used")}`:""]}),h.jsxs("span",{className:`nc-set-tunnel${P.up?" up":""}`,children:[S(P.label),P.since?` · ${P.since}`:""]}),x.shared&&h.jsxs("select",{value:x.visibility||"network",disabled:s||!!d,onChange:async G=>{p(`${x.name}:visibility`);try{await Up(e,x.name,G.target.value),await o()}catch(R){u(String(R.message||R))}p(null)},children:[h.jsx("option",{value:"network",children:S("visibility-network")}),h.jsx("option",{value:"relay-only",children:S("visibility-relay")}),h.jsx("option",{value:"selected",children:S("visibility-selected")})]})]}),x.direction==="outbound"?h.jsxs("label",{className:"nc-check nc-node-share",children:[h.jsx("input",{type:"checkbox",checked:x.shared===!0,disabled:s||!!d||!P.up&&!x.shared,onChange:async G=>{u(null),p(`${x.name}:share`);try{await ZS(e,x.name,G.target.checked),await o()}catch(R){u(`${x.name}: ${String(R.message||R)}`)}p(null)}}),h.jsxs("span",{children:[h.jsx("b",{children:S("share-node")}),h.jsx("small",{children:S(x.shared?"share-node-on-desc":"share-node-off-desc")})]})]}):h.jsx("div",{className:"nc-set-info",children:S(x.shared?"peer-shared":"peer-private")}),x.shared&&x.visibility==="selected"&&h.jsx("div",{className:"nc-set-row",children:(t||[]).filter(G=>G.name!==x.name&&G.nodeId).map(G=>{const R=(x.selected||[]).includes(G.nodeId);return h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:R,disabled:s||!!d,onChange:async Z=>{const D=Z.target.checked?[...x.selected||[],G.nodeId]:(x.selected||[]).filter(T=>T!==G.nodeId);p(`${x.name}:visibility`);try{await Up(e,x.name,"selected",D),await o()}catch(T){u(String(T.message||T))}p(null)}})," ",G.name]},G.nodeId)})}),h.jsxs("div",{className:"nc-set-node-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:s||!!d,onClick:async()=>{const G=window.prompt(S("node-display-label"),x.label||x.name);if(G!=null){if(!yh(G)){u(S("err-label"));return}p(`${x.name}:label`);try{await QS(e,x.name,G),await o()}catch(R){u(String(R.message||R))}p(null)}},children:S("edit")}),((F=x.health)==null?void 0:F.managed)!==!1&&h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>q(x.name,"test"),children:S("node-test")}),((Q=x.health)==null?void 0:Q.managed)!==!1&&(P.up?h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>q(x.name,"down"),children:S("tunnel-stop")}):h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>q(x.name,"up"),children:S("tunnel-start")})),(($=x.health)==null?void 0:$.managed)!==!1&&h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>q(x.name,"restart"),children:S("tunnel-restart")}),h.jsx("button",{type:"button",className:"nc-btn danger",disabled:s||!!d,title:S(s?"settings-readonly":"terminate"),onClick:()=>re(x.name),children:h.jsx(Ke,{name:"trash",size:14})})]}),((K=x.health)==null?void 0:K.detail)&&h.jsx("div",{className:`nc-set-test${x.health.status==="healthy"?" ok":x.health.status==="passive"?"":" ko"}`,children:x.health.detail}),j&&h.jsxs("div",{className:`nc-set-test${j.ok?" ok":" ko"}`,children:[j.result,j.detail?` — ${j.detail}`:""]})]},x.name)}),h.jsxs("div",{className:"nc-set-form",children:[h.jsx("div",{className:"nc-sheet-label",children:S("invite-node")}),h.jsx("small",{className:"nc-set-hint",children:S(X?"invite-network-hint":"invite-v2-hint")}),X?h.jsxs(h.Fragment,{children:[B.length>1&&h.jsxs("label",{className:"nc-field",children:[S("invite-network-label"),h.jsx("select",{value:X.name,disabled:s||!!d,onChange:x=>{E(x.target.value),_(null)},children:B.map(x=>h.jsx("option",{value:x.name,children:x.label||x.name},x.name))})]}),h.jsxs("div",{className:"nc-set-info nc-invite-endpoint",children:[S("invite-network-via"),": ",h.jsx("b",{children:X.label||X.name})," · ",X.ssh,X.sshPort?`:${X.sshPort}`:""]}),h.jsx("small",{className:"nc-set-hint",children:S("invite-network-route")})]}):h.jsxs("label",{className:"nc-field",children:[S("invite-endpoint-label"),h.jsx("input",{placeholder:"user@host",value:v.ssh,disabled:s,onChange:x=>b({...v,ssh:x.target.value})}),h.jsx("small",{className:"nc-set-hint",children:S("invite-endpoint-needed")})]}),!X&&z&&h.jsxs("div",{className:"nc-invite-advanced",children:[h.jsxs("label",{className:"nc-field",children:[S("node-ssh-port-label"),h.jsx("input",{inputMode:"numeric",placeholder:"22",value:v.sshPort,disabled:s,onChange:x=>b({...v,sshPort:x.target.value.replace(/[^0-9]/g,"").slice(0,5)})})]}),h.jsxs("label",{className:"nc-field",children:[S("device-name-label"),h.jsx("input",{placeholder:O||"NexusCrew",value:N,disabled:s,onChange:x=>A(x.target.value)}),h.jsx("small",{className:"nc-set-hint",children:S("device-name-hint")})]}),h.jsxs("label",{className:"nc-field",children:[S("node-name-label"),h.jsx("input",{placeholder:$n(N||O||S("node-name-ph")),value:v.name,disabled:s,onChange:x=>b({...v,name:x.target.value?$n(x.target.value):""})})]})]}),h.jsxs("div",{className:"nc-set-row nc-invite-actions",children:[h.jsx("button",{type:"button",className:"nc-btn primary",disabled:s||!!d||!X&&!v.ssh.trim(),onClick:te,children:S("create-pairing-link")}),!X&&h.jsxs("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>I(x=>!x),children:[z?"▾":"▸"," ",S("pair-advanced")]})]}),w&&h.jsxs(h.Fragment,{children:[h.jsx(jx,{value:w.pairingUrl}),h.jsx(Tx,{text:w.pairingUrl}),h.jsx("div",{className:"nc-set-info",children:S("invite-next-steps")})]})]}),l&&h.jsx("div",{className:"nc-err",children:l})]})}function Ix({token:e,readonly:t}){const[r,s]=L.useState("idle"),[o,l]=L.useState(!1),[u,d]=L.useState(null);L.useEffect(()=>{let m=!1;return dx().then(y=>{m||s(y)}),()=>{m=!0}},[]);const p=async()=>{d(null),l(!0);try{r==="subscribed"?(await px(e),s("idle")):(await fx(e),s("subscribed"))}catch(m){const y=String(m.message||m);y==="push-denied"?(s("denied"),d(S("push-denied"))):y==="push-unsupported"?(s("unsupported"),d(S("push-unsupported"))):d(y)}l(!1)};return r==="unsupported"?h.jsx("div",{className:"nc-set-info",children:S("push-unsupported")}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||o||r==="denied",title:t?S("settings-readonly"):"",onClick:p,children:S(r==="subscribed"?"push-disable":"push-enable")}),h.jsx("span",{className:"nc-set-info",children:S(r==="subscribed"?"push-on":r==="denied"?"push-denied":"push-off")})]}),u&&h.jsx("div",{className:"nc-err",children:u})]})}function Ax({token:e,settings:t,readonly:r,refresh:s}){const[o,l]=L.useState(null),[u,d]=L.useState(null),[p,m]=L.useState(!1),[y,w]=L.useState(!1),[_,v]=L.useState(null),[b,k]=L.useState(!0);L.useEffect(()=>{v(t&&t.update||null),k(!t||t.autoUpdate!==!1)},[t]);const E=async()=>{l(null),d(null),w(!0);try{const O=await XS(e);d(O.note||"ok"),m(!1)}catch(O){l(String(O.message||O))}w(!1)},N=async()=>{l(null),d(null),w(!0);try{const O=await ew(e);d(`${O.note||"ok"}${O.target?` (${O.target})`:""}`)}catch(O){l(String(O.message||O))}w(!1)},A=async O=>{l(null),d(null),w(!0);try{await iv(e,{autoUpdate:O}),k(O),s&&await s()}catch(B){l(String(B.message||B))}w(!1)},z=async()=>{l(null),d(null),w(!0);try{v(await tw(e))}catch(O){l(String(O.message||O))}w(!1)},I=async()=>{l(null),d(null),w(!0);try{const O=await iw(e);v(O),d(S("npm-update-restarting"))}catch(O){l(String(O.message||O))}w(!1)},U=t&&t.service;return h.jsxs("div",{className:"nc-set-tab",children:[t&&h.jsxs("div",{className:"nc-set-info",children:["v",t.version," · ",t.platform," · :",t.port,h.jsx("br",{}),U&&U.installed?S("service-installed"):S("service-missing"),U&&U.installed?` · ${U.active?S("service-active"):S("service-inactive")}`:"",U?` · boot ${U.boot?"on":"off"}`:""]}),h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||y,title:r?S("settings-readonly"):"",onClick:()=>{l(null),d(null),m(!0)},children:S("token-rotate")}),h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||y,title:r?S("settings-readonly"):"",onClick:N,children:S("service-regenerate")})]}),h.jsxs("div",{className:"nc-set-form nc-update-settings",children:[h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:b,disabled:r||y||_&&!_.supported,onChange:O=>A(O.target.checked)}),h.jsxs("span",{children:[h.jsx("b",{children:S("npm-auto-update")}),h.jsx("small",{children:S("npm-auto-update-help")})]})]}),_&&h.jsxs("div",{className:"nc-set-info",children:[S("npm-update-current")," v",_.current,_.latest?` · ${S("npm-update-latest")} v${_.latest}`:""," · ",S(`npm-update-${_.supported?_.phase:"unsupported"}`)]}),h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||y||!_||!_.supported,onClick:z,children:S("npm-update-check")}),_&&_.available&&h.jsx("button",{type:"button",className:"nc-btn primary",disabled:r||y||_.phase==="installing",onClick:I,children:S("npm-update-install")})]}),_&&_.lastError&&h.jsx("div",{className:"nc-err",children:_.lastError})]}),h.jsx(Ix,{token:e,readonly:r}),p&&h.jsxs("div",{className:"nc-set-confirm",children:[h.jsx("div",{children:S("token-rotate-explain")}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:y,onClick:()=>m(!1),children:S("cancel")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:y,onClick:E,children:S("confirm")})]})]}),u&&h.jsx("div",{className:"nc-set-note",children:u}),o&&h.jsx("div",{className:"nc-err",children:o})]})}function Ox({token:e,onClose:t,initialTab:r="nodes",initialLocation:s="",startNewCell:o=!1}){vi();const[l,u]=L.useState(r),[d,p]=L.useState(null),[m,y]=L.useState([]),[w,_]=L.useState(!1),[v,b]=L.useState(null),k=Mh(e),E=L.useCallback(async()=>{try{const N=await Zg(e);p(N),b(null)}catch(N){b(String(N.message||N))}try{const N=await ev(e);y(N.nodes||[])}catch(N){b(String(N.message||N))}},[e]);return L.useEffect(()=>{E();const N=setInterval(E,5e3);return()=>clearInterval(N)},[E]),L.useEffect(()=>{let N=!1;return Pt("/api/config",e).then(A=>A.json()).then(A=>{N||_(!!A.readonlyDefault)}).catch(()=>{}),()=>{N=!0}},[e]),h.jsx("div",{className:"nc-set-overlay",onClick:t,children:h.jsxs("div",{className:"nc-set-panel",onClick:N=>N.stopPropagation(),children:[h.jsxs("div",{className:"nc-set-head",children:[h.jsx(Ke,{name:"gear",size:18}),h.jsx("b",{children:S("settings")}),h.jsx("button",{type:"button",className:"nc-set-close",onClick:t,title:S("close"),children:h.jsx(Ke,{name:"x",size:18})})]}),w&&h.jsx("div",{className:"nc-set-readonly",children:S("settings-readonly")}),v&&h.jsx("div",{className:"nc-err",children:v}),h.jsx("div",{className:"nc-set-tabs",children:["nodes","fleet","system"].map(N=>h.jsx("button",{type:"button",className:`nc-set-tabbtn${l===N?" on":""}`,onClick:()=>u(N),children:S(`tab-${N}`)},N))}),h.jsxs("div",{className:"nc-set-body",children:[l==="nodes"&&h.jsx(Bx,{token:e,nodes:m,settings:d,readonly:w,refresh:E}),l==="fleet"&&h.jsx(Px,{token:e,readonly:w,startNewCell:o,initialLocation:s,targets:k.map(N=>({route:N.route,label:N.label||N.name,status:N.status}))}),l==="system"&&h.jsx(Ax,{token:e,settings:d,readonly:w,refresh:E})]})]})})}function zx({token:e,initialPair:t,onPairDone:r,onDone:s}){vi();const[o,l]=L.useState(t?"pair":"welcome"),[u,d]=L.useState(!1),[p,m]=L.useState(null),y=async()=>{d(!0),m(null);try{await iv(e,{wizardDone:!0}),r&&r(),s()}catch(w){m(String(w.message||w)),d(!1)}};return h.jsx("div",{className:"nc-wiz-overlay",children:h.jsxs("div",{className:"nc-wiz",children:[h.jsxs("div",{className:"nc-wiz-head",children:[h.jsx("b",{children:S("wizard-title")}),h.jsx("small",{children:S("hydra-simple")})]}),o==="welcome"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx("div",{className:"nc-wiz-done",children:S("local-ready")}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",disabled:u,onClick:y,children:S("local-only")}),h.jsx("button",{className:"nc-btn primary",disabled:u,onClick:()=>l("pair"),children:S("add-node")})]})]}),o==="pair"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx(C_,{token:e,initial:t||"",autoStart:!!t,onBusyChange:d,onSuccess:async()=>{r&&r(),l("done")}}),h.jsx("div",{className:"nc-sheet-actions",children:h.jsx("button",{className:"nc-btn ghost",disabled:u,onClick:()=>{r&&r(),l("welcome")},children:S("back")})})]}),o==="done"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx("div",{className:"nc-wiz-done",children:S("node-connected")}),h.jsx("div",{className:"nc-sheet-actions",children:h.jsx("button",{className:"nc-btn primary",disabled:u,onClick:y,children:S("finish")})})]}),p&&h.jsx("div",{className:"nc-err",children:p})]})})}function Fx(e,t){if(typeof EventSource>"u"||!e)return()=>{};const r=new EventSource(`/api/events?token=${encodeURIComponent(e)}`);return r.onmessage=s=>{try{const o=JSON.parse(s.data);o&&typeof o=="object"&&typeof o.type=="string"&&t(o)}catch{}},()=>{try{r.close()}catch{}}}const Hx=6e3,$x=12e3;function Wx({n:e,onClose:t}){return h.jsxs("div",{className:`nc-ntf-toast${e.urgency==="high"?" high":""}`,role:"status","aria-live":"polite",children:[h.jsxs("div",{className:"nc-ntf-toast-txt",children:[h.jsx("b",{children:e.title}),e.body&&h.jsx("small",{children:e.body}),e.session&&h.jsx("span",{className:"nc-ntf-from",children:e.session})]}),h.jsx("button",{type:"button",className:"nc-ntf-x",onClick:t,title:S("close"),children:h.jsx(Ke,{name:"x",size:14})})]})}function Ux({ask:e,token:t,onAnswered:r}){const[s,o]=L.useState(""),[l,u]=L.useState(!1),[d,p]=L.useState(null),m=async y=>{const w=String(y||"").trim();if(!(!w||l)){p(null),u(!0);try{await nw(t,e.id,w),r(e.id)}catch(_){p(String(_.message||_))}u(!1)}};return h.jsxs("div",{className:"nc-ask-card",children:[h.jsxs("div",{className:"nc-ask-head",children:[h.jsx("span",{className:"nc-ntf-from",children:e.session}),h.jsxs("code",{className:"nc-ask-id",children:["#",e.id]})]}),h.jsx("div",{className:"nc-ask-q",children:e.question}),Array.isArray(e.options)&&e.options.length>0&&h.jsx("div",{className:"nc-ask-opts",children:e.options.map(y=>h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:l,onClick:()=>m(y),children:y},y))}),h.jsxs("div",{className:"nc-ask-reply",children:[h.jsx("textarea",{rows:2,placeholder:S("ask-reply-ph"),value:s,disabled:l,onChange:y=>o(y.target.value)}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:l||!s.trim(),onClick:()=>m(s),children:S("send")})]}),d&&h.jsx("div",{className:"nc-err",children:d})]})}function qx({token:e}){vi();const[t,r]=L.useState([]),[s,o]=L.useState([]),[l,u]=L.useState(()=>{try{return/(?:^|[#&])ask=/.test(location.hash)}catch{return!1}}),d=L.useRef(0),p=L.useCallback(w=>{r(_=>_.filter(v=>v.key!==w))},[]),m=L.useCallback(w=>{const _=`t${d.current+=1}`;r(v=>[...v.slice(-3),{...w,key:_}]),setTimeout(()=>p(_),w.urgency==="high"?$x:Hx)},[p]);L.useEffect(()=>{if(!e)return;let w=!1;rw(e).then(v=>{w||o(v.asks||[])}).catch(()=>{});const _=Fx(e,v=>{v.type==="notify"?m(v):v.type==="ask"&&v.ask&&v.ask.id?o(b=>b.some(k=>k.id===v.ask.id)?b:[...b,v.ask]):v.type==="ask-answered"&&v.id&&o(b=>b.filter(k=>k.id!==v.id))});return()=>{w=!0,_()}},[e,m]);const y=w=>o(_=>_.filter(v=>v.id!==w));return h.jsxs(h.Fragment,{children:[t.length>0&&h.jsx("div",{className:"nc-ntf-toasts",children:t.map(w=>h.jsx(Wx,{n:w,onClose:()=>p(w.key)},w.key))}),s.length>0&&!l&&h.jsxs("button",{type:"button",className:"nc-ask-badge",onClick:()=>u(!0),title:S("asks-title"),children:["? ",h.jsx("span",{className:"nc-ask-count",children:s.length})]}),s.length>0&&l&&h.jsxs("div",{className:"nc-ask-panel",children:[h.jsxs("div",{className:"nc-ask-panel-head",children:[h.jsx("b",{children:S("asks-title")}),h.jsx("span",{className:"nc-ask-count",children:s.length}),h.jsx("button",{type:"button",className:"nc-ntf-x",onClick:()=>u(!1),title:S("close"),children:h.jsx(Ke,{name:"x",size:16})})]}),h.jsx("div",{className:"nc-ask-panel-body",children:s.map(w=>h.jsx(Ux,{ask:w,token:e,onAnswered:y},w.id))})]})]})}const Nu=e=>Yi(sn(e)).length===0,Ru=e=>Array.isArray(e)?e.join("/"):"";function Kx(e){const t=new Set,r=[];for(const s of Array.isArray(e)?e:[])!s||!Ii.test(String(s.instanceId||""))||!Array.isArray(s.route)||!s.route.length||t.has(s.instanceId)||(t.add(s.instanceId),r.push({instanceId:s.instanceId,route:[...s.route],label:String(s.label||s.name||s.route.join(" › ")),status:s.status||"offline"}));return r.sort((s,o)=>s.label.localeCompare(o.label))}function zs(e){return{instanceId:e.ownerId,route:e.ownerRoute||[],label:e.ownerLabel,status:e.available===!1?"offline":"up"}}function Zr(e,t,r,s=!1,o=!0){const l=t.instanceId;return{...e,id:Hn(s?null:l,e.name),ownerId:l,ownerRoute:s?[]:[...t.route],ownerLabel:s?"Local":t.label,local:s,available:o,ownerTopology:Array.isArray(r)?r:[],layout:gh(e.layout,l,r)}}function Vx(e,t,r,s,o=[]){const[l,u]=L.useState([]),[d,p]=L.useState(!1),[m,y]=L.useState("idle"),[w,_]=L.useState(""),[v,b]=L.useState(""),k=L.useRef([]),E=L.useRef([]),N=L.useRef(""),A=L.useRef(t),z=L.useRef(r),I=L.useRef(!1),U=L.useRef(!0),O=L.useRef(""),B=L.useMemo(()=>Kx(o),[o]),X=B.map(K=>`${K.instanceId}:${Ru(K.route)}:${K.status}:${K.label}`).join("|");E.current=B,z.current=r,A.current=t,k.current=l;const q=L.useCallback(K=>vh(K.layout,N.current,E.current),[]),re=L.useCallback((K,G=!0,R=A.current)=>{const Z=k.current.some(T=>T.id===R);k.current=K,u(K);const D=K.find(T=>T.id===R);if(G&&D){U.current=!0;const T=q(D);s(T),D.local&&_C(D.name,T)}else Z&&!D&&(U.current=!0,s(Fn()),_("deck non più condiviso dal nodo owner"));vC(K.filter(T=>T.local).map(T=>T.name))},[s,q]),te=L.useCallback(async K=>{let G=await ca(e);const R=G.decks.find(Z=>Z.name==="main");if(G.decks.length===1&&R&&R.revision===0&&Nu(R.layout)){const Z=gC(),D=sn(_h("main")||Fn());if(!Nu(D)){const T=gh(D,K,[]);G.decks[0]=await ua(e,"main",T,0,[])}for(const T of Z.filter(se=>se!=="main"))try{let se=await qp(e,T,[]);const oe=sn(_h(T)||Fn());Nu(oe)||(se=await ua(e,T,gh(oe,K,[]),se.revision,[]))}catch{}G=await ca(e)}return G},[e]),x=L.useCallback(async({migrate:K=!1}={})=>{const G=await Ph(e,[]),R=Ii.test(String(G.instanceId||""))?G.instanceId:"";if(!R)throw new Error("instanceId locale non disponibile");N.current=R,b(R);const[Z,D]=await Promise.all([K?te(R):ca(e),$p(e,[]).catch(()=>({nodes:[]}))]),T={instanceId:R,route:[],label:"Local"},se=Z.decks.map(ae=>Zr(ae,T,D.nodes,!0,!0)),oe=k.current;return await Promise.all(E.current.map(async ae=>{if(ae.status!=="up"){se.push(...oe.filter(ge=>!ge.local&&ge.ownerId===ae.instanceId).map(ge=>({...ge,ownerRoute:[...ae.route],ownerLabel:ae.label,available:!1})));return}try{const[ge,we]=await Promise.all([ca(e,ae.route),$p(e,ae.route).catch(()=>({nodes:[]}))]);se.push(...ge.decks.map(_e=>Zr(_e,ae,we.nodes,!1,!0)))}catch{se.push(...oe.filter(we=>!we.local&&we.ownerId===ae.instanceId).map(we=>({...we,ownerRoute:[...ae.route],ownerLabel:ae.label,available:!1})))}})),se.sort((ae,ge)=>ae.local===ge.local?ae.ownerLabel.localeCompare(ge.ownerLabel)||(ae.name==="main"?-1:ge.name==="main"?1:ae.name.localeCompare(ge.name)):ae.local?-1:1),se},[e,te,X]);L.useEffect(()=>{if(!e)return;let K=!1;const G=O.current!==e;return O.current=e,x({migrate:G}).then(R=>{if(K)return;const Z=k.current.find(se=>se.id===A.current),D=R.find(se=>se.id===A.current),T=D&&(!Z||D.revision>Z.revision||Z.available!==D.available||Ru(Z.ownerRoute)!==Ru(D.ownerRoute));re(R,G||!!T&&!I.current),p(!0),D&&_("")}).catch(R=>{K||(p(!0),_(String(R.message||R)))}),()=>{K=!0}},[re,x,X,e]);const P=L.useCallback(async(K=A.current)=>{if(!d||!I.current)return!0;const G=k.current.find(R=>R.id===K);if(!G)return _(`deck inesistente: ${K}`),!1;if(G.available===!1)return _(`nodo owner offline: ${G.ownerLabel}`),!1;y("saving");try{const R=ig(sn(z.current),G.ownerId,G.ownerTopology),Z=await ua(e,G.name,R,G.revision,G.ownerRoute),D=Zr(Z,zs(G),G.ownerTopology,G.local,!0);return re(k.current.map(T=>T.id===K?D:T),!1),I.current=!1,y("saved"),_(""),setTimeout(()=>y("idle"),1500),!0}catch(R){if(y("error"),_(String(R.message||R)),R.status===409&&R.data&&R.data.current){const Z=k.current.find(T=>T.id===K),D=Zr(R.data.current,zs(Z),Z.ownerTopology,Z.local,!0);re(k.current.map(T=>T.id===K?D:T),!1)}return!1}},[d,e,re]);return L.useEffect(()=>{if(!d)return;if(U.current){U.current=!1;return}I.current=!0,y("saving");const K=setTimeout(P,650);return()=>clearTimeout(K)},[r,d,P]),L.useEffect(()=>{if(!d)return;const K=setInterval(async()=>{try{const G=await x(),R=k.current.find(T=>T.id===A.current),Z=G.find(T=>T.id===A.current),D=Z&&(!R||Z.revision>R.revision||R.available!==Z.available);re(G,D&&!I.current)}catch{}},5e3);return()=>clearInterval(K)},[d,x,re]),{decks:l,records:l,localNodeId:v,ready:d,saveState:m,error:w,setError:_,saveNow:P,select:async K=>{if(I.current&&!await P(A.current))throw new Error("salvataggio del deck corrente fallito: cambio annullato");const G=k.current.find(R=>R.id===K);if(!G)throw new Error(`deck inesistente: ${K}`);return I.current=!1,U.current=!0,q(G)},add:async(K,G=null)=>{const R=G?k.current.find(T=>T.ownerId===G):k.current.find(T=>T.id===A.current)||k.current.find(T=>T.local);if(!R||R.available===!1)throw new Error("nodo owner non disponibile");const Z=await qp(e,K,R.ownerRoute),D=Zr(Z,zs(R),R.ownerTopology,R.local,!0);return re([...k.current,D],!1),D},rename:async(K,G)=>{const R=k.current.find(se=>se.id===K);if(!R)throw new Error("deck inesistente");if(K===A.current&&I.current&&!await P(K))throw new Error(`salvataggio di "${R.name}" fallito: rinomina annullata`);const Z=k.current.find(se=>se.id===K);if(!Z)throw new Error("deck inesistente");const D=await sw(e,Z.name,G,Z.revision,Z.ownerRoute),T=Zr(D,zs(Z),Z.ownerTopology,Z.local,!0);return re(k.current.map(se=>se.id===K?T:se),!1),T},remove:async K=>{const G=k.current.find(R=>R.id===K);if(!G)throw new Error("deck inesistente");K===A.current&&(I.current=!1),await ow(e,G.name,G.revision,G.ownerRoute),re(k.current.filter(R=>R.id!==K),!1)},addTileTo:async(K,G)=>{const R=k.current.find(ae=>ae.id===K);if(!R)throw new Error("deck inesistente");if(R.available===!1)throw new Error(`nodo owner offline: ${R.ownerLabel}`);const Z=f_(G,N.current,E.current);if(!Z)throw new Error("riferimento sessione non valido");const D=q(R),T=ig(u_(D,Z),R.ownerId,R.ownerTopology),se=await ua(e,R.name,T,R.revision,R.ownerRoute),oe=Zr(se,zs(R),R.ownerTopology,R.local,!0);return re(k.current.map(ae=>ae.id===K?oe:ae),!1),oe},localMainId:Hn(null,"main"),parseDeckId:d_}}const Yx="/sw.js",Sh="nc-sw-update";let wh=null,bh=!1,Ch=null,P_=Object.freeze({needed:!1,kind:null,version:""}),D_=!1;function L_(){typeof window<"u"&&window.dispatchEvent(new Event(Sh))}function M_(){const e=Ch||(bh?{kind:"reload",version:""}:null);P_=Object.freeze({needed:!!e,kind:(e==null?void 0:e.kind)||null,version:(e==null?void 0:e.version)||""})}function Wg(){return P_}function Xx(e){return typeof window>"u"?()=>{}:(window.addEventListener(Sh,e),()=>window.removeEventListener(Sh,e))}function Yh(e){bh!==e&&(bh=e,M_(),L_())}function Gx(e,t,r){let s=null;e&&t&&e!==t?s={kind:"install",version:e}:t&&r&&t!==r&&(s={kind:"reload",version:t});const o=JSON.stringify(s)===JSON.stringify(Ch);Ch=s,M_(),o||L_()}function Qx(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&Yh(!0)})}function Jx(){typeof navigator>"u"||!("serviceWorker"in navigator)||(navigator.serviceWorker.addEventListener("controllerchange",()=>{D_&&location.reload()}),navigator.serviceWorker.register(Yx).then(e=>{wh=e,e.waiting&&Yh(!0),e.addEventListener("updatefound",()=>{const t=e.installing;t&&Qx(t)}),setInterval(()=>{e.update().catch(()=>{})},3600*1e3)}).catch(()=>{}))}function Zx(){D_=!0,Yh(!1);const e=wh&&wh.waiting;e?(e.postMessage({type:"SKIP_WAITING"}),setTimeout(()=>location.reload(),4e3)):location.reload()}function ek({hash:e="",origin:t="",pathname:r="",search:s=""}={}){const o=String(e||"").replace(/^#/,""),l=`${r||""}${s||""}`;if(!o)return{token:"",pair:"",nextUrl:l};const u=new URLSearchParams(o),d=u.get("token")||"",p=u.get("pair")||"",m=p?`${t||""}${r||""}#pair=${p}`:"";return{token:d,pair:m,nextUrl:l}}const T_=9,j_=24,B_="nc_side_w",Ug="nc_side_min",tk=240,qg="(min-width:1024px) and (pointer:fine)";function ik(){const e=Number(localStorage.getItem(B_));return e>=180&&e<=480?e:tk}function rk(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=T_&&e<=j_?e:13}function nk(){const e={token:"",pair:""};try{const{token:t,pair:r,nextUrl:s}=ek({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(r){e.pair=r;try{sessionStorage.setItem("nc_pair",r)}catch{}}if(location.hash)try{history.replaceState(null,"",s)}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 sk(e){try{return sn(_h(e))}catch{return Fn()}}function Kg(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 ok(){const[e,t]=L.useState(()=>window.matchMedia(qg).matches);return L.useEffect(()=>{const r=window.matchMedia(qg),s=o=>t(o.matches);return r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[]),e}function Vg({session:e,node:t,token:r,readonly:s=!1,onBack:o}){vi();const[l,u]=L.useState(!1),[d,p]=L.useState(()=>window.matchMedia("(pointer: coarse)").matches),[m,y]=L.useState(null),[w,_]=L.useState(rk),[v,b]=L.useState(""),k=q=>_(re=>{const te=Math.max(T_,Math.min(j_,re+q));return localStorage.setItem("nc_fontsize",String(te)),te}),E=L.useRef(()=>{}),N=L.useRef(()=>!1),A=L.useRef(()=>{}),z=L.useRef(!1),[I,U]=L.useState(!1),[O,B]=L.useState(!1),X=()=>{z.current=!z.current,U(z.current)};return L.useEffect(()=>{let q=!0;const re=t?t.split("/"):[],te=t?`/api/route/${t.split("/").map(encodeURIComponent).join("/")}/_`:"/api";async function x(){let j=null,J=null;try{const $=await(await Pt(`${te}/sessions`,r)).json();Array.isArray($.sessions)&&(j=$.sessions.find(K=>K.name===e))}catch{}try{const Q=await ln(r,re);Q.available&&Array.isArray(Q.cells)&&(J=Q.cells.find($=>$.tmuxSession===e))}catch{}if(!q)return;let F="";J?F=`${J.engine}${J.key?`·${J.key}`:""}`:j&&(F=j.attached?`attached · ${Kg(j.activity)}`:j.activity?Kg(j.activity):""),b(F)}x();const P=setInterval(x,4e3);return()=>{q=!1,clearInterval(P)}},[e,t,r]),h.jsxs("div",{className:"nc-app",children:[h.jsxs("header",{className:"nc-bar nc-bar-single",children:[h.jsxs("button",{onClick:o,title:S("sessions"),children:[h.jsx(Ke,{name:"chevronLeft",size:18}),h.jsx("span",{className:"nc-bar-label",children:S("sessions")})]}),h.jsxs("span",{className:"nc-bar-center",children:[h.jsx("b",{children:t?`${t}:${e}`:e}),v&&h.jsx("small",{className:"nc-bar-sub",children:v})]}),h.jsxs("span",{className:"nc-bar-right",children:[h.jsx("button",{onClick:()=>k(-1),title:S("zoom-out"),children:h.jsx(Ke,{name:"zoomOut",size:18})}),h.jsx("button",{onClick:()=>k(1),title:S("zoom-in"),children:h.jsx(Ke,{name:"zoomIn",size:18})}),h.jsx("button",{onClick:()=>p(q=>!q),title:S("composer"),children:h.jsx(Ke,{name:"keyboard",size:20})}),h.jsx("button",{onClick:()=>u(q=>!q),title:S("files"),children:h.jsx(Ke,{name:"folder",size:20})})]})]}),h.jsx("div",{className:"nc-termwrap",children:h.jsx(n_,{session:e,node:t,token:r,readonly:s,takeSize:!0,sendRef:E,composerRef:N,actionRef:A,ctrlRef:z,setCtrlArmed:U,onFiles:y,fontSize:w,selectionMode:O,onSelectionModeChange:B})}),h.jsx(Ub,{onKeyboard:()=>p(q=>!q),send:q=>E.current(q),action:q=>A.current(q),ctrlArmed:I,onCtrl:X,selectionMode:O,onSelectionMode:B}),d&&h.jsx(o_,{submitText:q=>N.current(q),token:r,session:e,node:t}),l&&h.jsx(s_,{session:e,node:t,token:r,filesEvent:m,onClose:()=>u(!1)})]})}function ak(){vi();const[e]=L.useState(nk),[t,r]=L.useState(e.token),[s,o]=L.useState(e.pair||""),l=L.useCallback(()=>{o("");try{sessionStorage.removeItem("nc_pair")}catch{}},[]),[u,d]=L.useState(!1),p=ok(),[m]=L.useState(()=>mC(typeof location<"u"?location.pathname:"/")),[y,w]=L.useState(m.id),_=y===Hn(null,pi),[v,b]=L.useState(null),k=le=>b(Ir(le)),[E,N]=L.useState([]),[A,z]=L.useState([]),[I,U]=L.useState(()=>m.ownerId?Fn():sk(m.name)),[O,B]=L.useState(null),[X,q]=L.useState(null),re=le=>q(Ir(le)),te=Mh(t,p),x=L.useMemo(()=>(te||[]).filter(le=>le.instanceId).map(le=>({instanceId:le.instanceId,route:le.route,label:le.label,status:le.status})),[te]),P=Vx(t,y,I,U,x),j=P.decks,J=j.find(le=>le.id===y)||null;L.useEffect(()=>{const le=new Map;for(const ke of te||[]){const Be=(ke.route||[ke.name]).join("/"),Mt=new Set((ke.sessions||[]).map(oi=>oi.name));for(const oi of ke.cells||[])!oi.cell||!oi.tmuxSession||oi.cell===oi.tmuxSession||Mt.has(oi.cell)||le.set(`${Be}:${oi.cell}`,`${Be}:${oi.tmuxSession}`)}U(ke=>tC(ke,le))},[te]),L.useEffect(()=>{P.localNodeId&&U(le=>{const ke=vh(le,P.localNodeId,x);return JSON.stringify(ke)===JSON.stringify(le)?le:ke})},[x,P.localNodeId]);const[F,Q]=L.useState(null),[$,K]=L.useState(!1),[G,R]=L.useState(ik),[Z,D]=L.useState(!_),[T,se]=L.useState(()=>_?localStorage.getItem(Ug)==="1":!0),[oe,ae]=L.useState(!1),[ge,we]=L.useState("nodes"),[_e,W]=L.useState(!1),[Y,ue]=L.useState(""),Ne=(le="nodes",ke=!1,Be="")=>{we(le),W(ke),ue(Be),ae(!0)},[Te,Ve]=L.useState(!1),[tt,De]=L.useState(!1);L.useEffect(()=>{try{localStorage.setItem(B_,String(G))}catch{}},[G]),L.useEffect(()=>{try{localStorage.setItem(Ug,T?"1":"")}catch{}},[T]),L.useEffect(()=>{if(!t)return;let le=!1;return Promise.all([Zg(t),Pt("/api/config",t).then(ke=>ke.json())]).then(([ke,Be])=>{le||(De(!!Be.readonlyDefault),(ke.firstRun===!0&&!Be.readonlyDefault||s)&&Ve(!0))}).catch(()=>{}),()=>{le=!0}},[t,s]);const Ue=L.useCallback(async()=>{try{const ke=await(await Pt("/api/sessions",t)).json();ke.error||N(ke.sessions||[])}catch{}try{const le=await ln(t);z(le.available?le.cells||[]:[])}catch{z([])}},[t]);L.useEffect(()=>{if(!p)return;Ue();const le=setInterval(Ue,4e3);return()=>clearInterval(le)},[p,Ue]),L.useEffect(()=>{let le=!1;return Pt("/api/config",t).then(ke=>ke.json()).then(ke=>{le||Gx(ke.version,ke.uiVersion,"0.8.12")}).catch(()=>{}),()=>{le=!0}},[t]);const Ye=new Set([...E.map(le=>le.name),...te.flatMap(le=>le.sessions.map(ke=>ke.key))]),At=Yi(I),Lt=le=>U(ke=>{const Be=f_(le,P.localNodeId,x)||le,Mt=u_(ke,Be);return Mt===ke&&Yi(ke).length>=9&&P.setError(S("grid-full")),Mt}),je=async(le,ke=[])=>{try{await Rh(t,le,ke)}catch{return}const Be=ke.length?`${ke.join("/")}:${le}`:le;U(Mt=>$a(Mt,Be)),Ue()},ri=async le=>{if(!F)return;const{cell:ke}=F,Be=Array.isArray(F.route)?F.route:[];le.action==="up"?await Eh(t,{cell:ke,boot:!!le.boot,...le.engine?{engine:le.engine}:{},...le.model!==void 0?{model:le.model}:{},...le.permissionPolicy?{permissionPolicy:le.permissionPolicy}:{}},Be):await Pa(t,{cell:ke,boot:!!le.boot},Be),Ue()},Ar=async le=>{if(!(!(le!=null&&le.direct)||$)){K(!0);try{await Dh(t,le.name,le.tunnelStatus==="up"?"down":"up")}finally{K(!1)}}},Or=le=>{const ke=j.find(Be=>Be.id===le);if(!ke)return!1;try{const Be=window.open(ru(ke,t),"_blank");return Be&&(Be.opener=null),!!Be}catch{return!1}},Wt=async le=>{if(!le||le===y)return;const ke=await P.select(le),Be=P.records.find(Mt=>Mt.id===le);w(le),U(ke),B(null),q(null);try{history.replaceState(null,"",ru(Be||le,null))}catch{}},ni=async le=>{const ke=await P.add(le,J&&J.ownerId);await Wt(ke.id)},Gi=async(le,ke)=>{const Be=await P.rename(le,ke);if(le===y){w(Be.id),U(vh(Be.layout,P.localNodeId,x)),B(null),q(null);try{history.replaceState(null,"",ru(Be,null))}catch{}}},si=async le=>{await P.remove(le),le===y&&await Wt(P.localMainId)},pe=async(le,ke)=>{!ke||ke===y||(await P.addTileTo(ke,le),U(Be=>$a(Be,le)))};if(!t)return h.jsxs("div",{className:"nc-auth",children:[h.jsx("p",{children:S("auth-prompt")}),h.jsx("input",{onChange:le=>r(le.target.value.trim()),placeholder:"token"}),h.jsxs("label",{children:[h.jsx("input",{type:"checkbox",checked:u,onChange:le=>d(le.target.checked)})," ",S("remember-device")]}),h.jsx("button",{onClick:()=>{(u?localStorage:sessionStorage).setItem("nc_token",t)},children:"ok"})]});const Fe=h.jsxs(h.Fragment,{children:[oe&&h.jsx(Ox,{token:t,initialTab:ge,initialLocation:Y,startNewCell:_e,onClose:()=>{ae(!1),W(!1),ue("")}}),Te&&h.jsx(zx,{token:t,initialPair:s,onPairDone:l,onDone:()=>Ve(!1)}),h.jsx(qx,{token:t})]});if(!p)return v?h.jsxs(h.Fragment,{children:[h.jsx(Vg,{session:v.session,node:v.node,token:t,readonly:tt,onBack:()=>b(null)}),Fe]}):h.jsxs(h.Fragment,{children:[h.jsx(yw,{onPick:k,token:t,onSettings:Ne}),Fe]});const qe=_||!Z;return h.jsxs("div",{className:"nc-workspace",children:[qe&&h.jsx(Xb,{sessions:E,cells:A,activeSessions:At,nodeGroups:te,onPick:re,onAddTile:Lt,onPower:Q,onNodePower:Ar,onKill:je,onNew:()=>Ne("fleet",!0),onSettings:Ne,width:G,collapsed:T,onResize:R,onToggleCollapse:()=>se(le=>!le)}),h.jsxs("div",{className:"nc-workspace-main",children:[h.jsx(yC,{decks:j,currentDeck:y,onCreate:ni,onRename:Gi,onDelete:si,onOpenWindow:Or,onNavigate:Wt,saveState:P.saveState,error:P.error,sidebarVisible:qe,onToggleSidebar:_?null:()=>D(le=>!le)}),h.jsx(cC,{layout:I,onLayoutChange:U,token:t,readonly:tt,sessionsAlive:Ye,focusSession:O,onFocus:B,onOpenSingle:re,decks:j,currentDeck:y,onSendToDeck:pe})]}),X&&h.jsx("div",{className:"nc-single-overlay",children:h.jsx(Vg,{session:X.session,node:X.node,token:t,readonly:tt,onBack:()=>q(null)})}),F&&h.jsx(Ma,{cell:F,token:t,route:Array.isArray(F.route)?F.route:[],onConfirm:ri,onClose:()=>Q(null)}),Fe]})}function lk(){vi();const e=L.useSyncExternalStore(Xx,Wg,Wg);if(!e.needed)return null;const t=e.kind==="install"?S("install-version-mismatch").replace("{v}",e.version):S("update-available").replace("{v}",e.version).replace(" "," ").trim();return h.jsxs("div",{className:"nc-update",role:"status","aria-live":"polite",children:[h.jsx("span",{className:"nc-update-msg",children:t}),e.kind==="reload"&&h.jsx("button",{className:"nc-update-btn",onClick:Zx,children:S("reload")})]})}Jx();FS.createRoot(document.getElementById("root")).render(h.jsxs(TS.StrictMode,{children:[h.jsx(ak,{}),h.jsx(lk,{})]}));
|