diff --git a/MoonlightServers.ApiServer/Http/Controllers/Users/ServersController.cs b/MoonlightServers.ApiServer/Http/Controllers/Users/ServersController.cs index 78769bc..920e1a1 100644 --- a/MoonlightServers.ApiServer/Http/Controllers/Users/ServersController.cs +++ b/MoonlightServers.ApiServer/Http/Controllers/Users/ServersController.cs @@ -125,7 +125,7 @@ public class ServersController : Controller { var server = await GetServerWithPermCheck(serverId); - // TODO: Handle transparent proxy + // TODO: Handle transparent node proxy var accessToken = NodeService.CreateAccessToken(server.Node, parameters => { @@ -148,6 +148,31 @@ public class ServersController : Controller AccessToken = accessToken }; } + + [HttpGet("{serverId:int}/logs")] + [RequirePermission("meta.authenticated")] + public async Task GetLogs([FromRoute] int serverId) + { + var server = await GetServerWithPermCheck(serverId); + + var apiClient = await NodeService.CreateApiClient(server.Node); + + try + { + var data = await apiClient.GetJson( + $"api/servers/{server.Id}/logs" + ); + + return new ServerLogsResponse() + { + Messages = data.Messages + }; + } + catch (HttpRequestException e) + { + throw new HttpApiException("Unable to access the node the server is running on", 502); + } + } private async Task GetServerWithPermCheck(int serverId, Func, IQueryable>? queryModifier = null) diff --git a/MoonlightServers.ApiServer/Properties/launchSettings.json b/MoonlightServers.ApiServer/Properties/launchSettings.json index ed55a69..624ac11 100644 --- a/MoonlightServers.ApiServer/Properties/launchSettings.json +++ b/MoonlightServers.ApiServer/Properties/launchSettings.json @@ -10,7 +10,8 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "MOONLIGHT_APP_PUBLICURL": "http://localhost:5269" - } + }, + "commandLineArgs": "--frontend-asset js/XtermBlazor.min.js --frontend-asset js/moonlightServers.js --frontend-asset js/addon-fit.js" } } } diff --git a/MoonlightServers.ApiServer/Startup/PluginStartup.cs b/MoonlightServers.ApiServer/Startup/PluginStartup.cs index 6bcb49e..6680191 100644 --- a/MoonlightServers.ApiServer/Startup/PluginStartup.cs +++ b/MoonlightServers.ApiServer/Startup/PluginStartup.cs @@ -19,6 +19,7 @@ public class PluginStartup : IAppStartup builder.Services.AutoAddServices(); BundleService.BundleCss("css/MoonlightServers.min.css"); + BundleService.BundleCss("css/XtermBlazor.min.css"); return Task.CompletedTask; } diff --git a/MoonlightServers.Daemon/Extensions/ServerExtensions/ServerConsoleExtensions.cs b/MoonlightServers.Daemon/Extensions/ServerExtensions/ServerConsoleExtensions.cs index 7111246..764ed07 100644 --- a/MoonlightServers.Daemon/Extensions/ServerExtensions/ServerConsoleExtensions.cs +++ b/MoonlightServers.Daemon/Extensions/ServerExtensions/ServerConsoleExtensions.cs @@ -51,6 +51,10 @@ public static class ServerConsoleExtensions { // Ignored } + catch (OperationCanceledException) + { + // Ignored + } catch (Exception e) { server.Logger.LogWarning("An unhandled error occured while reading from container stream: {e}", e); diff --git a/MoonlightServers.Daemon/Helpers/ServerConsoleConnection.cs b/MoonlightServers.Daemon/Helpers/ServerConsoleConnection.cs index f1a4535..16e1574 100644 --- a/MoonlightServers.Daemon/Helpers/ServerConsoleConnection.cs +++ b/MoonlightServers.Daemon/Helpers/ServerConsoleConnection.cs @@ -1,7 +1,149 @@ +using Microsoft.AspNetCore.SignalR; +using MoonlightServers.Daemon.Http.Hubs; +using MoonlightServers.Daemon.Models; +using MoonlightServers.Daemon.Services; +using MoonlightServers.DaemonShared.Enums; + namespace MoonlightServers.Daemon.Helpers; public class ServerConsoleConnection { - public DateTime AuthenticatedUntil { get; set; } - public int ServerId { get; set; } + private readonly ServerService ServerService; + private readonly ILogger Logger; + private readonly AccessTokenHelper AccessTokenHelper; + private readonly IHubContext HubContext; + + private int ServerId = -1; + private Server Server; + private bool IsInitialized = false; + private string ConnectionId; + + public ServerConsoleConnection( + ServerService serverService, + ILogger logger, + AccessTokenHelper accessTokenHelper, + IHubContext hubContext + ) + { + ServerService = serverService; + Logger = logger; + AccessTokenHelper = accessTokenHelper; + HubContext = hubContext; + } + + public Task Initialize(HubCallerContext context) => Task.CompletedTask; + + public async Task Authenticate(HubCallerContext context, string accessToken) + { + // Validate access token + if (!AccessTokenHelper.Process(accessToken, out var accessData)) + { + Logger.LogDebug("Received invalid or expired access token"); + + await HubContext.Clients.Client(context.ConnectionId).SendAsync( + "Error", + "Received invalid or expired access token" + ); + + return; + } + + // Validate access token data + if (!accessData.ContainsKey("type") || !accessData.ContainsKey("serverId")) + { + Logger.LogDebug("Received invalid access token: Required parameters are missing"); + + await HubContext.Clients.Client(context.ConnectionId).SendAsync( + "Error", + "Received invalid access token: Required parameters are missing" + ); + + return; + } + + // Validate access token type + var type = accessData["type"].GetString()!; + + if (type != "console") + { + Logger.LogDebug("Received invalid access token: Invalid type '{type}'", type); + + await HubContext.Clients.Client(context.ConnectionId).SendAsync( + "Error", + $"Received invalid access token: Invalid type '{type}'" + ); + + return; + } + + var serverId = accessData["serverId"].GetInt32(); + + // Check that the access token isn't or another server + if (ServerId != -1 && ServerId == serverId) + { + Logger.LogDebug("Received invalid access token: Server id not valid for this session. Current server id: {serverId}", ServerId); + + await HubContext.Clients.Client(context.ConnectionId).SendAsync( + "Error", + $"Received invalid access token: Server id not valid for this session. Current server id: {ServerId}" + ); + + return; + } + + var server = ServerService.GetServer(serverId); + + // Check i the server actually exists + if (server == null) + { + Logger.LogDebug("Received invalid access token: No server found with the requested id"); + + await HubContext.Clients.Client(context.ConnectionId).SendAsync( + "Error", + "Received invalid access token: No server found with the requested id" + ); + + return; + } + + // Set values + Server = server; + ServerId = serverId; + ConnectionId = context.ConnectionId; + + if(IsInitialized) + return; + + IsInitialized = true; + + // Setup event handlers + Server.StateMachine.OnTransitioned += HandlePowerStateChange; + Server.OnTaskAdded += HandleTaskAdded; + Server.Console.OnOutput += HandleConsoleOutput; + + Logger.LogTrace("Authenticated and initialized server console connection '{id}'", context.ConnectionId); + } + + public Task Destroy(HubCallerContext context) + { + Server.StateMachine.OnTransitioned -= HandlePowerStateChange; + Server.OnTaskAdded -= HandleTaskAdded; + + Logger.LogTrace("Destroyed server console connection '{id}'", context.ConnectionId); + + return Task.CompletedTask; + } + + #region Event Handlers + + private async Task HandlePowerStateChange(ServerState serverState) + => await HubContext.Clients.Client(ConnectionId).SendAsync("PowerStateChanged", serverState.ToString()); + + private async Task HandleTaskAdded(string task) + => await HubContext.Clients.Client(ConnectionId).SendAsync("TaskNotify", task); + + private async Task HandleConsoleOutput(string line) + => await HubContext.Clients.Client(ConnectionId).SendAsync("ConsoleOutput", line); + + #endregion } \ No newline at end of file diff --git a/MoonlightServers.Daemon/Http/Controllers/Servers/ServersController.cs b/MoonlightServers.Daemon/Http/Controllers/Servers/ServersController.cs index be7fc8a..1c7366b 100644 --- a/MoonlightServers.Daemon/Http/Controllers/Servers/ServersController.cs +++ b/MoonlightServers.Daemon/Http/Controllers/Servers/ServersController.cs @@ -32,6 +32,20 @@ public class ServersController : Controller }; } + [HttpGet("{serverId:int}/logs")] + public async Task GetLogs([FromRoute] int serverId) + { + var server = ServerService.GetServer(serverId); + + if (server == null) + throw new HttpApiException("No server with this id found", 404); + + return new ServerLogsResponse() + { + Messages = server.Console.Messages + }; + } + [HttpPost("{serverId:int}/start")] public async Task Start(int serverId) { diff --git a/MoonlightServers.Daemon/Http/Hubs/ServerConsoleHub.cs b/MoonlightServers.Daemon/Http/Hubs/ServerConsoleHub.cs index 7899dd0..8343ac9 100644 --- a/MoonlightServers.Daemon/Http/Hubs/ServerConsoleHub.cs +++ b/MoonlightServers.Daemon/Http/Hubs/ServerConsoleHub.cs @@ -17,12 +17,24 @@ public class ServerConsoleHub : Hub ConsoleService = consoleService; } + #region Connection Handlers + + public override async Task OnConnectedAsync() + => await ConsoleService.InitializeClient(Context); + + public override async Task OnDisconnectedAsync(Exception? exception) + => await ConsoleService.DestroyClient(Context); + + #endregion + + #region Methods + [HubMethodName("Authenticate")] public async Task Authenticate(string accessToken) { try { - await ConsoleService.Authenticate(Context, accessToken); + await ConsoleService.AuthenticateClient(Context, accessToken); } catch (Exception e) { @@ -30,6 +42,5 @@ public class ServerConsoleHub : Hub } } - public override async Task OnDisconnectedAsync(Exception? exception) - => await ConsoleService.OnClientDisconnected(Context); + #endregion } \ No newline at end of file diff --git a/MoonlightServers.Daemon/Services/ServerConsoleService.cs b/MoonlightServers.Daemon/Services/ServerConsoleService.cs index 9f16037..9318a8d 100644 --- a/MoonlightServers.Daemon/Services/ServerConsoleService.cs +++ b/MoonlightServers.Daemon/Services/ServerConsoleService.cs @@ -8,152 +8,61 @@ namespace MoonlightServers.Daemon.Services; [Singleton] public class ServerConsoleService { - private readonly Dictionary Monitors = new(); - private readonly Dictionary Connections = new(); - private readonly ILogger Logger; - private readonly AccessTokenHelper AccessTokenHelper; - private readonly ServerService ServerService; + private readonly IServiceProvider ServiceProvider; - private readonly IHubContext HubContext; + private readonly Dictionary Connections = new(); public ServerConsoleService( ILogger logger, - AccessTokenHelper accessTokenHelper, - ServerService serverService, IHubContext hubContext) + IServiceProvider serviceProvider + ) { Logger = logger; - AccessTokenHelper = accessTokenHelper; - ServerService = serverService; - HubContext = hubContext; + ServiceProvider = serviceProvider; } - public Task OnClientDisconnected(HubCallerContext context) + public async Task InitializeClient(HubCallerContext context) { - ServerConsoleConnection? removedConnection; + var connection = new ServerConsoleConnection( + ServiceProvider.GetRequiredService(), + ServiceProvider.GetRequiredService>(), + ServiceProvider.GetRequiredService(), + ServiceProvider.GetRequiredService>() + ); lock (Connections) - { - removedConnection = Connections.GetValueOrDefault(context.ConnectionId); - - if(removedConnection != null) - Connections.Remove(context.ConnectionId); - } - - // Client never authenticated themselves, nothing to do - if(removedConnection == null) - return Task.CompletedTask; - - Logger.LogDebug("Authenticated client {id} disconnected", context.ConnectionId); - - // Count remaining clients requesting the same resource - int count; + Connections[context.ConnectionId] = connection; - lock (Connections) - { - count = Connections - .Values - .Count(x => x.ServerId == removedConnection.ServerId); - } - - if(count > 0) - return Task.CompletedTask; - - ServerConsoleMonitor? monitor; - - lock (Monitors) - monitor = Monitors.GetValueOrDefault(removedConnection.ServerId); - - if(monitor == null) - return Task.CompletedTask; - - Logger.LogDebug("Destroying console monitor for server {id}", removedConnection.ServerId); - monitor.Destroy(); - - lock (Monitors) - Monitors.Remove(removedConnection.ServerId); - - return Task.CompletedTask; + await connection.Initialize(context); } - public async Task Authenticate(HubCallerContext context, string accessToken) + public async Task AuthenticateClient(HubCallerContext context, string accessToken) { - // Validate access token - if (!AccessTokenHelper.Process(accessToken, out var accessData)) - { - Logger.LogDebug("Received invalid or expired access token. Closing connection"); - context.Abort(); - return; - } - - // Validate access token data - if (!accessData.ContainsKey("type") || !accessData.ContainsKey("serverId")) - { - Logger.LogDebug("Received invalid access token: Required parameters are missing. Closing connection"); - context.Abort(); - return; - } - - // Validate access token type - var type = accessData["type"].GetString()!; - - if (type != "console") - { - Logger.LogDebug("Received invalid access token: Invalid type '{type}'. Closing connection", type); - context.Abort(); - return; - } - - var serverId = accessData["serverId"].GetInt32(); - var server = ServerService.GetServer(serverId); - - if (server == null) - { - Logger.LogDebug("Received invalid access token: No server found with the requested id. Closing connection"); - context.Abort(); - return; - } - ServerConsoleConnection? connection; lock (Connections) - { - connection = Connections - .GetValueOrDefault(context.ConnectionId); - } - - if (connection == null) // If no existing connection has been found, we create a new one - { - connection = new() - { - ServerId = server.Configuration.Id, - AuthenticatedUntil = DateTime.UtcNow.AddMinutes(10) - }; - - lock (Connections) - Connections.Add(context.ConnectionId, connection); - - Logger.LogDebug("Connection {id} authenticated successfully", context.ConnectionId); - } - else - Logger.LogDebug("Connection {id} re-authenticated successfully", context.ConnectionId); - - ServerConsoleMonitor? monitor; + connection = Connections.GetValueOrDefault(context.ConnectionId); - lock (Monitors) - monitor = Monitors.GetValueOrDefault(server.Configuration.Id); + if(connection == null) + return; - if (monitor == null) - { - Logger.LogDebug("Initializing console monitor for server {id}", server.Configuration.Id); - - monitor = new ServerConsoleMonitor(server, HubContext.Clients); - monitor.Initialize(); + await connection.Authenticate(context, accessToken); + } - lock (Monitors) - Monitors.Add(server.Configuration.Id, monitor); - } + public async Task DestroyClient(HubCallerContext context) + { + ServerConsoleConnection? connection; - await HubContext.Groups.AddToGroupAsync(context.ConnectionId, $"server-{server.Configuration.Id}"); + lock (Connections) + connection = Connections.GetValueOrDefault(context.ConnectionId); + + if(connection == null) + return; + + await connection.Destroy(context); + + lock (Connections) + Connections.Remove(context.ConnectionId); } } \ No newline at end of file diff --git a/MoonlightServers.DaemonShared/DaemonSide/Http/Responses/Servers/ServerLogsResponse.cs b/MoonlightServers.DaemonShared/DaemonSide/Http/Responses/Servers/ServerLogsResponse.cs new file mode 100644 index 0000000..26e0b50 --- /dev/null +++ b/MoonlightServers.DaemonShared/DaemonSide/Http/Responses/Servers/ServerLogsResponse.cs @@ -0,0 +1,6 @@ +namespace MoonlightServers.DaemonShared.DaemonSide.Http.Responses.Servers; + +public class ServerLogsResponse +{ + public string[] Messages { get; set; } +} \ No newline at end of file diff --git a/MoonlightServers.Frontend/MoonlightServers.Frontend.csproj b/MoonlightServers.Frontend/MoonlightServers.Frontend.csproj index deae6ac..57f6888 100644 --- a/MoonlightServers.Frontend/MoonlightServers.Frontend.csproj +++ b/MoonlightServers.Frontend/MoonlightServers.Frontend.csproj @@ -11,6 +11,7 @@ + @@ -21,7 +22,6 @@ - diff --git a/MoonlightServers.Frontend/Styles/additions/fonts.css b/MoonlightServers.Frontend/Styles/additions/fonts.css new file mode 100644 index 0000000..81dd17b --- /dev/null +++ b/MoonlightServers.Frontend/Styles/additions/fonts.css @@ -0,0 +1 @@ +@import url('https://fonts.googleapis.com/css2?family=Space+Mono,wght@0,200..900;1,200..900&display=swap'); \ No newline at end of file diff --git a/MoonlightServers.Frontend/Styles/style.css b/MoonlightServers.Frontend/Styles/style.css index d5e5f07..a1dd122 100644 --- a/MoonlightServers.Frontend/Styles/style.css +++ b/MoonlightServers.Frontend/Styles/style.css @@ -4,6 +4,7 @@ @import "additions/animations.css"; @import "additions/buttons.css"; @import "additions/cards.css"; +@import "additions/fonts.css"; @import "additions/progress.css"; @import "additions/scrollbar.css"; @import "additions/loaders.css"; diff --git a/MoonlightServers.Frontend/UI/Components/XtermConsole.razor b/MoonlightServers.Frontend/UI/Components/XtermConsole.razor new file mode 100644 index 0000000..a399a70 --- /dev/null +++ b/MoonlightServers.Frontend/UI/Components/XtermConsole.razor @@ -0,0 +1,97 @@ +@using XtermBlazor + +@inject IJSRuntime JsRuntime +@inject ILogger Logger + +
+ @if (IsInitialized) + { + + } +
+ +@code +{ + [Parameter] public Func? OnAfterInitialized { get; set; } + [Parameter] public Func? OnFirstRender { get; set; } + + private Xterm Terminal; + private bool IsInitialized = false; + private bool HadFirstRender = false; + + private readonly Queue MessageCache = new(); + private readonly HashSet Addons = ["addon-fit"]; + private readonly TerminalOptions Options = new() + { + CursorBlink = false, + CursorStyle = CursorStyle.Bar, + CursorWidth = 1, + FontFamily = "Space Mono, monospace", + DisableStdin = true, + CursorInactiveStyle = CursorInactiveStyle.None, + Theme = + { + Background = "#000000" + } + }; + + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if(!firstRender) + return; + + // Initialize addons + + try + { + await JsRuntime.InvokeVoidAsync("moonlightServers.loadAddons"); + } + catch (Exception e) + { + Logger.LogError("An error occured while initializing addons: {e}", e); + } + + IsInitialized = true; + await InvokeAsync(StateHasChanged); + + if(OnAfterInitialized != null) + await OnAfterInitialized.Invoke(); + } + + private async Task HandleFirstRender() + { + try + { + await Terminal.Addon("addon-fit").InvokeVoidAsync("fit"); + } + catch (Exception e) + { + Logger.LogError("An error occured while calling addons: {e}", e); + } + + HadFirstRender = true; + + // Write out cache + while (MessageCache.Count > 0) + { + await Terminal.Write(MessageCache.Dequeue()); + } + + if (OnFirstRender != null) + await OnFirstRender.Invoke(); + } + + public async Task Write(string content) + { + // We cache messages here as there is the chance that the console isn't ready for input while receiving write tasks + + if (HadFirstRender) + await Terminal.Write(content); + else + MessageCache.Enqueue(content); + } +} \ No newline at end of file diff --git a/MoonlightServers.Frontend/UI/Views/User/Manage.razor b/MoonlightServers.Frontend/UI/Views/User/Manage.razor index ef1b727..865db8b 100644 --- a/MoonlightServers.Frontend/UI/Views/User/Manage.razor +++ b/MoonlightServers.Frontend/UI/Views/User/Manage.razor @@ -6,6 +6,7 @@ @using MoonCore.Exceptions @using MoonCore.Helpers @using MoonlightServers.Shared.Enums +@using MoonlightServers.Frontend.UI.Components @inject HttpApiClient ApiClient @@ -67,11 +68,11 @@ }
- + + @@ -85,27 +86,33 @@
    +
  • Console + href="/admin/servers/all" + class="block pb-3 text-white whitespace-nowrap border-b-2 border-primary-500">Console
  • + +
  • Files
  • Files
  • -
  • Backups + href="/admin/servers/nodes" + class="block pb-3 text-gray-400 hover:text-white whitespace-nowrap hover:border-b-2 hover:border-primary-500">Backups
  • Networking + href="/admin/servers/stars" + class="block pb-3 text-gray-400 hover:text-white whitespace-nowrap hover:border-b-2 hover:border-primary-500">Networking
  • Variables + href="/admin/servers/manager" + class="block pb-3 text-gray-400 hover:text-white whitespace-nowrap hover:border-b-2 hover:border-primary-500">Variables
+ +
+ +
} @@ -116,8 +123,11 @@ private ServerDetailResponse Server; private bool NotFound = false; private ServerPowerState PowerState; + private string InitialConsoleMessage; // TODO: When moving to a single component, fail safe when failed to load private string CurrentTask = ""; + private XtermConsole? XtermConsole; + private HubConnection ConsoleConnection; private async Task Load(LazyLoader _) @@ -136,6 +146,16 @@ PowerState = status.PowerState; + // Load initial messages + var initialLogs = await ApiClient.GetJson( + $"api/servers/{ServerId}/logs" + ); + + InitialConsoleMessage = ""; + + foreach (var message in initialLogs.Messages) + InitialConsoleMessage += message; + // Load console meta var consoleDetails = await ApiClient.GetJson( $"api/servers/{ServerId}/console" @@ -161,6 +181,14 @@ await AddTask(Formatter.ConvertCamelCaseToSpaces(task)); }); + ConsoleConnection.On("ConsoleOutput", async content => + { + if (XtermConsole != null) + await XtermConsole.Write(content); + + await InvokeAsync(StateHasChanged); + }); + // Connect await ConsoleConnection.StartAsync(); @@ -175,23 +203,10 @@ throw; } } - - private async Task DoSmth() + + private async Task OnAfterConsoleInitialized() { - await AddTask("Creating storage"); - await Task.Delay(1500); - - await AddTask("Pulling docker image"); - await Task.Delay(1500); - - await AddTask("Removing container"); - await Task.Delay(1500); - - await AddTask("Creating container"); - await Task.Delay(1500); - - await AddTask("Starting container"); - await Task.Delay(1500); + await XtermConsole!.Write(InitialConsoleMessage); } private async Task AddTask(string message) @@ -201,7 +216,7 @@ Task.Run(async () => { - await Task.Delay(2000); + await Task.Delay(3000); if (CurrentTask != message) return; diff --git a/MoonlightServers.Frontend/wwwroot/css/XtermBlazor.min.css b/MoonlightServers.Frontend/wwwroot/css/XtermBlazor.min.css new file mode 100644 index 0000000..205732d --- /dev/null +++ b/MoonlightServers.Frontend/wwwroot/css/XtermBlazor.min.css @@ -0,0 +1 @@ +.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{border:0;height:0;left:-9999em;margin:0;opacity:0;overflow:hidden;padding:0;position:absolute;resize:none;top:0;white-space:nowrap;width:0;z-index:-5}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;bottom:0;cursor:default;left:0;overflow-y:scroll;position:absolute;right:0;top:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{left:0;position:absolute;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;left:-9999em;line-height:normal;position:absolute;top:0;visibility:hidden}.xterm.enable-mouse-events{cursor:default}.xterm .xterm-cursor-pointer,.xterm.xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{bottom:0;color:transparent;left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:10}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:transparent}.xterm .xterm-accessibility-tree{user-select:text;white-space:pre}.xterm .live-region{height:1px;left:-9999px;overflow:hidden;position:absolute;width:1px}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{position:absolute;z-index:6}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{pointer-events:none;position:absolute;right:0;top:0;z-index:8}.xterm-decoration-top{position:relative;z-index:2} \ No newline at end of file diff --git a/MoonlightServers.Frontend/wwwroot/js/XtermBlazor.min.js b/MoonlightServers.Frontend/wwwroot/js/XtermBlazor.min.js new file mode 100644 index 0000000..a9b2b05 --- /dev/null +++ b/MoonlightServers.Frontend/wwwroot/js/XtermBlazor.min.js @@ -0,0 +1,9 @@ +(()=>{var ye={591:Y=>{var Z=Object.defineProperty,ee=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,ue=(te,J,q)=>J in te?Z(te,J,{enumerable:!0,configurable:!0,writable:!0,value:q}):te[J]=q,ae=(te,J)=>{for(var q in J||(J={}))_e.call(J,q)&&ue(te,q,J[q]);if(ee)for(var q of ee(J))pe.call(J,q)&&ue(te,q,J[q]);return te};(function(te,J){if(1)Y.exports=J();else var q,T})(globalThis,()=>(()=>{"use strict";var te={4567:function(R,r,o){var c=this&&this.__decorate||function(e,t,a,_){var u,g=arguments.length,h=g<3?t:_===null?_=Object.getOwnPropertyDescriptor(t,a):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(e,t,a,_);else for(var m=e.length-1;m>=0;m--)(u=e[m])&&(h=(g<3?u(h):g>3?u(t,a,h):u(t,a))||h);return g>3&&h&&Object.defineProperty(t,a,h),h},f=this&&this.__param||function(e,t){return function(a,_){t(a,_,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=o(9042),d=o(9924),v=o(844),p=o(4725),l=o(2585),i=o(3656);let s=r.AccessibilityManager=class extends v.Disposable{constructor(e,t,a,_){super(),this._terminal=e,this._coreBrowserService=a,this._renderService=_,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let u=0;uthis._handleBoundaryFocus(u,0),this._bottomBoundaryFocusListener=u=>this._handleBoundaryFocus(u,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new d.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(u=>this._handleResize(u.rows))),this.register(this._terminal.onRender(u=>this._refreshRows(u.start,u.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(u=>this._handleChar(u))),this.register(this._terminal.onLineFeed(()=>this._handleChar(` +`))),this.register(this._terminal.onA11yTab(u=>this._handleTab(u))),this.register(this._terminal.onKey(u=>this._handleKey(u.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,i.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,v.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_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){const a=this._terminal.buffer,_=a.lines.length.toString();for(let u=e;u<=t;u++){const g=a.lines.get(a.ydisp+u),h=[],m=g?.translateToString(!0,void 0,void 0,h)||"",y=(a.ydisp+u+1).toString(),k=this._rowElements[u];k&&(m.length===0?(k.innerText="\xA0",this._rowColumns.set(k,[0,1])):(k.textContent=m,this._rowColumns.set(k,h)),k.setAttribute("aria-posinset",y),k.setAttribute("aria-setsize",_))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){const a=e.target,_=this._rowElements[t===0?1:this._rowElements.length-2];if(a.getAttribute("aria-posinset")===(t===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==_)return;let u,g;if(t===0?(u=a,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(u=this._rowElements.shift(),g=a,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){const h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{const h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}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 e,t;if(this._rowElements.length===0)return;const a=document.getSelection();if(!a)return;if(a.isCollapsed)return void(this._rowContainer.contains(a.anchorNode)&&this._terminal.clearSelection());if(!a.anchorNode||!a.focusNode)return void console.error("anchorNode and/or focusNode are null");let _={node:a.anchorNode,offset:a.anchorOffset},u={node:a.focusNode,offset:a.focusOffset};if((_.node.compareDocumentPosition(u.node)&Node.DOCUMENT_POSITION_PRECEDING||_.node===u.node&&_.offset>u.offset)&&([_,u]=[u,_]),_.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(_={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(_.node))return;const g=this._rowElements.slice(-1)[0];if(u.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(u={node:g,offset:(t=(e=g.textContent)==null?void 0:e.length)!=null?t:0}),!this._rowContainer.contains(u.node))return;const h=({node:k,offset:D})=>{const b=k instanceof Text?k.parentNode:k;let B=parseInt(b?.getAttribute("aria-posinset"),10)-1;if(isNaN(B))return console.warn("row is invalid. Race condition?"),null;const A=this._rowColumns.get(b);if(!A)return console.warn("columns is null. Race condition?"),null;let H=D=this._terminal.cols&&(++B,H=0),{row:B,column:H}},m=h(_),y=h(u);if(m&&y){if(m.row>y.row||m.row===y.row&&m.column>=y.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(y.row-m.row)*this._terminal.cols-m.column+y.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;te;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const 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){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{function o(d){return d.replace(/\r?\n/g,"\r")}function c(d,v){return v?"\x1B[200~"+d+"\x1B[201~":d}function f(d,v,p,l){d=c(d=o(d),p.decPrivateModes.bracketedPasteMode&&l.rawOptions.ignoreBracketedPasteMode!==!0),p.triggerDataEvent(d,!0),v.value=""}function n(d,v,p){const l=p.getBoundingClientRect(),i=d.clientX-l.left-10,s=d.clientY-l.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${i}px`,v.style.top=`${s}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=o,r.bracketTextForPaste=c,r.copyHandler=function(d,v){d.clipboardData&&d.clipboardData.setData("text/plain",v.selectionText),d.preventDefault()},r.handlePasteEvent=function(d,v,p,l){d.stopPropagation(),d.clipboardData&&f(d.clipboardData.getData("text/plain"),v,p,l)},r.paste=f,r.moveTextAreaUnderMouseCursor=n,r.rightClickHandler=function(d,v,p,l,i){n(d,v,p),i&&l.rightClickSelect(d),v.value=l.selectionText,v.select()}},7239:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const c=o(1505);r.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(f,n,d){this._css.set(f,n,d)}getCss(f,n){return this._css.get(f,n)}setColor(f,n,d){this._color.set(f,n,d)}getColor(f,n){return this._color.get(f,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(o,c,f,n){o.addEventListener(c,f,n);let d=!1;return{dispose:()=>{d||(d=!0,o.removeEventListener(c,f,n))}}}},3551:function(R,r,o){var c=this&&this.__decorate||function(s,e,t,a){var _,u=arguments.length,g=u<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,e,t,a);else for(var h=s.length-1;h>=0;h--)(_=s[h])&&(g=(u<3?_(g):u>3?_(e,t,g):_(e,t))||g);return u>3&&g&&Object.defineProperty(e,t,g),g},f=this&&this.__param||function(s,e){return function(t,a){e(t,a,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;const n=o(3656),d=o(8460),v=o(844),p=o(2585),l=o(4725);let i=r.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(s,e,t,a,_){super(),this._element=s,this._mouseService=e,this._renderService=t,this._bufferService=a,this._linkProviderService=_,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new d.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new d.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)(()=>{var u;this._lastMouseEvent=void 0,(u=this._activeProviderReplies)==null||u.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(s){this._lastMouseEvent=s;const e=this._positionFromMouseEvent(s,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;const t=s.composedPath();for(let a=0;a{u?.forEach(g=>{g.link.dispose&&g.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=s.y);let _=!1;for(const[u,g]of this._linkProviderService.linkProviders.entries())e?(a=this._activeProviderReplies)!=null&&a.get(u)&&(_=this._checkLinkProviderResult(u,s,_)):g.provideLinks(s.y,h=>{var m,y;if(this._isMouseOut)return;const k=h?.map(D=>({link:D}));(m=this._activeProviderReplies)==null||m.set(u,k),_=this._checkLinkProviderResult(u,s,_),((y=this._activeProviderReplies)==null?void 0:y.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)})}_removeIntersectingLinks(s,e){const t=new Set;for(let a=0;as?this._bufferService.cols:g.link.range.end.x;for(let y=h;y<=m;y++){if(t.has(y)){_.splice(u--,1);break}t.add(y)}}}}_checkLinkProviderResult(s,e,t){var a;if(!this._activeProviderReplies)return t;const _=this._activeProviderReplies.get(s);let u=!1;for(let g=0;gthis._linkAtPosition(h.link,e));g&&(t=!0,this._handleNewLink(g))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!t)for(let g=0;gthis._linkAtPosition(m.link,e));if(h){t=!0,this._handleNewLink(h);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(s){if(!this._currentLink)return;const e=this._positionFromMouseEvent(s,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(s,this._currentLink.link.text)}_clearCurrentLink(s,e){this._currentLink&&this._lastMouseEvent&&(!s||!e||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(s){if(!this._lastMouseEvent)return;const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(s.link,e)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:()=>{var t,a;return(a=(t=this._currentLink)==null?void 0:t.state)==null?void 0:a.decorations.pointerCursor},set:t=>{var a;(a=this._currentLink)!=null&&a.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",t))}},underline:{get:()=>{var t,a;return(a=(t=this._currentLink)==null?void 0:t.state)==null?void 0:a.decorations.underline},set:t=>{var a,_,u;(a=this._currentLink)!=null&&a.state&&((u=(_=this._currentLink)==null?void 0:_.state)==null?void 0:u.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(t=>{if(!this._currentLink)return;const a=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,_=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=_&&(this._clearCurrentLink(a,_),this._lastMouseEvent)){const u=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);u&&this._askForLink(u,!1)}})))}_linkHover(s,e,t){var a;(a=this._currentLink)!=null&&a.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(t,e.text)}_fireUnderlineEvent(s,e){const t=s.range,a=this._bufferService.buffer.ydisp,_=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-a-1,t.end.x,t.end.y-a-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(_)}_linkLeave(s,e,t){var a;(a=this._currentLink)!=null&&a.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(t,e.text)}_linkAtPosition(s,e){const t=s.range.start.y*this._bufferService.cols+s.range.start.x,a=s.range.end.y*this._bufferService.cols+s.range.end.x,_=e.y*this._bufferService.cols+e.x;return t<=_&&_<=a}_positionFromMouseEvent(s,e,t){const a=t.getCoords(s,e,this._bufferService.cols,this._bufferService.rows);if(a)return{x:a[0],y:a[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,e,t,a,_){return{x1:s,y1:e,x2:t,y2:a,cols:this._bufferService.cols,fg:_}}};r.Linkifier=i=c([f(1,l.IMouseService),f(2,l.IRenderService),f(3,p.IBufferService),f(4,l.ILinkProviderService)],i)},9042:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(R,r,o){var c=this&&this.__decorate||function(l,i,s,e){var t,a=arguments.length,_=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(l,i,s,e);else for(var u=l.length-1;u>=0;u--)(t=l[u])&&(_=(a<3?t(_):a>3?t(i,s,_):t(i,s))||_);return a>3&&_&&Object.defineProperty(i,s,_),_},f=this&&this.__param||function(l,i){return function(s,e){i(s,e,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const n=o(511),d=o(2585);let v=r.OscLinkProvider=class{constructor(l,i,s){this._bufferService=l,this._optionsService=i,this._oscLinkService=s}provideLinks(l,i){var s;const e=this._bufferService.buffer.lines.get(l-1);if(!e)return void i(void 0);const t=[],a=this._optionsService.rawOptions.linkHandler,_=new n.CellData,u=e.getTrimmedLength();let g=-1,h=-1,m=!1;for(let y=0;ya?a.activate(B,A,D):p(0,A),hover:(B,A)=>{var H;return(H=a?.hover)==null?void 0:H.call(a,B,A,D)},leave:(B,A)=>{var H;return(H=a?.leave)==null?void 0:H.call(a,B,A,D)}})}m=!1,_.hasExtendedAttrs()&&_.extended.urlId?(h=y,g=_.extended.urlId):(h=-1,g=-1)}}i(t)}};function p(l,i){if(confirm(`Do you want to navigate to ${i}? + +WARNING: This link could potentially be dangerous`)){const s=window.open();if(s){try{s.opener=null}catch{}s.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=v=c([f(0,d.IBufferService),f(1,d.IOptionsService),f(2,d.IOscLinkService)],v)},6193:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(o,c,f){this._rowCount=f,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const c=o(3614),f=o(3656),n=o(3551),d=o(9042),v=o(3730),p=o(1680),l=o(3107),i=o(5744),s=o(2950),e=o(1296),t=o(428),a=o(4269),_=o(5114),u=o(8934),g=o(3230),h=o(9312),m=o(4725),y=o(6731),k=o(8055),D=o(8969),b=o(8460),B=o(844),A=o(6114),H=o(8437),U=o(2584),F=o(7399),S=o(5941),w=o(9074),E=o(2585),L=o(5435),P=o(4567),W=o(779);class $ extends D.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(x={}){super(x),this.browser=A,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new B.MutableDisposable),this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new b.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new b.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new b.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new b.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new b.EventEmitter),this._onBlur=this.register(new b.EventEmitter),this._onA11yCharEmitter=this.register(new b.EventEmitter),this._onA11yTabEmitter=this.register(new b.EventEmitter),this._onWillOpen=this.register(new b.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(w.DecorationService),this._instantiationService.setService(E.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(W.LinkProviderService),this._instantiationService.setService(m.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((C,I)=>this.refresh(C,I))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(C=>this._reportWindowsOptions(C))),this.register(this._inputHandler.onColor(C=>this._handleColorEvent(C))),this.register((0,b.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,b.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,b.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,b.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(C=>this._afterResize(C.cols,C.rows))),this.register((0,B.toDisposable)(()=>{var C,I;this._customKeyEventHandler=void 0,(I=(C=this.element)==null?void 0:C.parentNode)==null||I.removeChild(this.element)}))}_handleColorEvent(x){if(this._themeService)for(const C of x){let I,O="";switch(C.index){case 256:I="foreground",O="10";break;case 257:I="background",O="11";break;case 258:I="cursor",O="12";break;default:I="ansi",O="4;"+C.index}switch(C.type){case 0:const N=k.color.toColorRGB(I==="ansi"?this._themeService.colors.ansi[C.index]:this._themeService.colors[I]);this.coreService.triggerDataEvent(`${U.C0.ESC}]${O};${(0,S.toRgbString)(N)}${U.C1_ESCAPED.ST}`);break;case 1:if(I==="ansi")this._themeService.modifyColors(M=>M.ansi[C.index]=k.channels.toColor(...C.color));else{const M=I;this._themeService.modifyColors(K=>K[M]=k.channels.toColor(...C.color))}break;case 2:this._themeService.restoreColor(C.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(x){x?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(P.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(x){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(U.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var x;return(x=this.textarea)==null?void 0:x.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(U.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const x=this.buffer.ybase+this.buffer.y,C=this.buffer.lines.get(x);if(!C)return;const I=Math.min(this.buffer.x,this.cols-1),O=this._renderService.dimensions.css.cell.height,N=C.getWidth(I),M=this._renderService.dimensions.css.cell.width*N,K=this.buffer.y*this._renderService.dimensions.css.cell.height,G=I*this._renderService.dimensions.css.cell.width;this.textarea.style.left=G+"px",this.textarea.style.top=K+"px",this.textarea.style.width=M+"px",this.textarea.style.height=O+"px",this.textarea.style.lineHeight=O+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",C=>{this.hasSelection()&&(0,c.copyHandler)(C,this._selectionService)}));const x=C=>(0,c.handlePasteEvent)(C,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",x)),this.register((0,f.addDisposableDomListener)(this.element,"paste",x)),A.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",C=>{C.button===2&&(0,c.rightClickHandler)(C,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",C=>{(0,c.rightClickHandler)(C,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),A.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",C=>{C.button===1&&(0,c.moveTextAreaUnderMouseCursor)(C,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",x=>this._keyUp(x),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",x=>this._keyDown(x),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",x=>this._keyPress(x),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",x=>this._compositionHelper.compositionupdate(x))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,f.addDisposableDomListener)(this.textarea,"input",x=>this._inputEvent(x),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(x){var C,I,O;if(!x)throw new Error("Terminal requires a parent element.");if(x.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((C=this.element)==null?void 0:C.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=x.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"),x.appendChild(this.element);const N=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),N.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,f.addDisposableDomListener)(this.screenElement,"mousemove",M=>this.updateCursorStyle(M))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),N.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",d.promptLabel),A.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(_.CoreBrowserService,this.textarea,(I=x.ownerDocument.defaultView)!=null?I:window,((O=this._document)!=null?O:typeof window<"u")?window.document:null)),this._instantiationService.setService(m.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",M=>this._handleTextAreaFocus(M))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(t.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(m.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(y.ThemeService),this._instantiationService.setService(m.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(a.CharacterJoinerService),this._instantiationService.setService(m.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(m.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(M=>this._onRender.fire(M))),this.onResize(M=>this._renderService.resize(M.cols,M.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(u.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(N);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(p.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(M=>this.scrollLines(M.amount,M.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(h.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(m.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(M=>this.scrollLines(M.amount,M.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(M=>this._renderService.handleSelectionChanged(M.start,M.end,M.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(M=>{this.textarea.value=M,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(M=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",M=>this._selectionService.handleMouseDown(M))),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(P.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",M=>this._handleScreenReaderModeOptionChange(M))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",M=>{!this._overviewRulerRenderer&&M&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const x=this,C=this.element;function I(M){const K=x._mouseService.getMouseReportCoords(M,x.screenElement);if(!K)return!1;let G,X;switch(M.overrideType||M.type){case"mousemove":X=32,M.buttons===void 0?(G=3,M.button!==void 0&&(G=M.button<3?M.button:3)):G=1&M.buttons?0:4&M.buttons?1:2&M.buttons?2:3;break;case"mouseup":X=0,G=M.button<3?M.button:3;break;case"mousedown":X=1,G=M.button<3?M.button:3;break;case"wheel":if(x._customWheelEventHandler&&x._customWheelEventHandler(M)===!1||x.viewport.getLinesScrolled(M)===0)return!1;X=M.deltaY<0?0:1,G=4;break;default:return!1}return!(X===void 0||G===void 0||G>4)&&x.coreMouseService.triggerMouseEvent({col:K.col,row:K.row,x:K.x,y:K.y,button:G,action:X,ctrl:M.ctrlKey,alt:M.altKey,shift:M.shiftKey})}const O={mouseup:null,wheel:null,mousedrag:null,mousemove:null},N={mouseup:M=>(I(M),M.buttons||(this._document.removeEventListener("mouseup",O.mouseup),O.mousedrag&&this._document.removeEventListener("mousemove",O.mousedrag)),this.cancel(M)),wheel:M=>(I(M),this.cancel(M,!0)),mousedrag:M=>{M.buttons&&I(M)},mousemove:M=>{M.buttons||I(M)}};this.register(this.coreMouseService.onProtocolChange(M=>{M?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(M)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&M?O.mousemove||(C.addEventListener("mousemove",N.mousemove),O.mousemove=N.mousemove):(C.removeEventListener("mousemove",O.mousemove),O.mousemove=null),16&M?O.wheel||(C.addEventListener("wheel",N.wheel,{passive:!1}),O.wheel=N.wheel):(C.removeEventListener("wheel",O.wheel),O.wheel=null),2&M?O.mouseup||(O.mouseup=N.mouseup):(this._document.removeEventListener("mouseup",O.mouseup),O.mouseup=null),4&M?O.mousedrag||(O.mousedrag=N.mousedrag):(this._document.removeEventListener("mousemove",O.mousedrag),O.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(C,"mousedown",M=>{if(M.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(M))return I(M),O.mouseup&&this._document.addEventListener("mouseup",O.mouseup),O.mousedrag&&this._document.addEventListener("mousemove",O.mousedrag),this.cancel(M)})),this.register((0,f.addDisposableDomListener)(C,"wheel",M=>{if(!O.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(M)===!1)return!1;if(!this.buffer.hasScrollback){const K=this.viewport.getLinesScrolled(M);if(K===0)return;const G=U.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(M.deltaY<0?"A":"B");let X="";for(let Q=0;Q{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(M),this.cancel(M)},{passive:!0})),this.register((0,f.addDisposableDomListener)(C,"touchmove",M=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(M)?void 0:this.cancel(M)},{passive:!1}))}refresh(x,C){var I;(I=this._renderService)==null||I.refreshRows(x,C)}updateCursorStyle(x){var C;(C=this._selectionService)!=null&&C.shouldColumnSelect(x)?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(x,C,I=0){var O;I===1?(super.scrollLines(x,C,I),this.refresh(0,this.rows-1)):(O=this.viewport)==null||O.scrollLines(x)}paste(x){(0,c.paste)(x,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(x){this._customKeyEventHandler=x}attachCustomWheelEventHandler(x){this._customWheelEventHandler=x}registerLinkProvider(x){return this._linkProviderService.registerLinkProvider(x)}registerCharacterJoiner(x){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const C=this._characterJoinerService.register(x);return this.refresh(0,this.rows-1),C}deregisterCharacterJoiner(x){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(x)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(x){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+x)}registerDecoration(x){return this._decorationService.registerDecoration(x)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(x,C,I){this._selectionService.setSelection(x,C,I)}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 x;(x=this._selectionService)==null||x.clearSelection()}selectAll(){var x;(x=this._selectionService)==null||x.selectAll()}selectLines(x,C){var I;(I=this._selectionService)==null||I.selectLines(x,C)}_keyDown(x){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(x)===!1)return!1;const C=this.browser.isMac&&this.options.macOptionIsMeta&&x.altKey;if(!C&&!this._compositionHelper.keydown(x))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;C||x.key!=="Dead"&&x.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const I=(0,F.evaluateKeyboardEvent)(x,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(x),I.type===3||I.type===2){const O=this.rows-1;return this.scrollLines(I.type===2?-O:O),this.cancel(x,!0)}return I.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,x)||(I.cancel&&this.cancel(x,!0),!I.key||!!(x.key&&!x.ctrlKey&&!x.altKey&&!x.metaKey&&x.key.length===1&&x.key.charCodeAt(0)>=65&&x.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(I.key!==U.C0.ETX&&I.key!==U.C0.CR||(this.textarea.value=""),this._onKey.fire({key:I.key,domEvent:x}),this._showCursor(),this.coreService.triggerDataEvent(I.key,!0),!this.optionsService.rawOptions.screenReaderMode||x.altKey||x.ctrlKey?this.cancel(x,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(x,C){const I=x.isMac&&!this.options.macOptionIsMeta&&C.altKey&&!C.ctrlKey&&!C.metaKey||x.isWindows&&C.altKey&&C.ctrlKey&&!C.metaKey||x.isWindows&&C.getModifierState("AltGraph");return C.type==="keypress"?I:I&&(!C.keyCode||C.keyCode>47)}_keyUp(x){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(x)===!1||(function(C){return C.keyCode===16||C.keyCode===17||C.keyCode===18}(x)||this.focus(),this.updateCursorStyle(x),this._keyPressHandled=!1)}_keyPress(x){let C;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(x)===!1)return!1;if(this.cancel(x),x.charCode)C=x.charCode;else if(x.which===null||x.which===void 0)C=x.keyCode;else{if(x.which===0||x.charCode===0)return!1;C=x.which}return!(!C||(x.altKey||x.ctrlKey||x.metaKey)&&!this._isThirdLevelShift(this.browser,x)||(C=String.fromCharCode(C),this._onKey.fire({key:C,domEvent:x}),this._showCursor(),this.coreService.triggerDataEvent(C,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(x){if(x.data&&x.inputType==="insertText"&&(!x.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const C=x.data;return this.coreService.triggerDataEvent(C,!0),this.cancel(x),!0}return!1}resize(x,C){x!==this.cols||C!==this.rows?super.resize(x,C):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(x,C){var I,O;(I=this._charSizeService)==null||I.measure(),(O=this.viewport)==null||O.syncScrollArea(!0)}clear(){var x;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 C=1;C{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(o,c=1e3){this._renderCallback=o,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,c,f){this._rowCount=f,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;const n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const d=n-this._lastRefreshMs,v=this._debounceThresholdMS-d;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c)}}},1680:function(R,r,o){var c=this&&this.__decorate||function(s,e,t,a){var _,u=arguments.length,g=u<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,e,t,a);else for(var h=s.length-1;h>=0;h--)(_=s[h])&&(g=(u<3?_(g):u>3?_(e,t,g):_(e,t))||g);return u>3&&g&&Object.defineProperty(e,t,g),g},f=this&&this.__param||function(s,e){return function(t,a){e(t,a,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const n=o(3656),d=o(4725),v=o(8460),p=o(844),l=o(2585);let i=r.Viewport=class extends p.Disposable{constructor(s,e,t,a,_,u,g,h){super(),this._viewportElement=s,this._scrollArea=e,this._bufferService=t,this._optionsService=a,this._charSizeService=_,this._renderService=u,this._coreBrowserService=g,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(m=>this._activeBuffer=m.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(m=>this._renderDimensions=m)),this._handleThemeChange(h.colors),this.register(h.onChangeColors(m=>this._handleThemeChange(m))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(s){this._viewportElement.style.backgroundColor=s.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(s){if(s)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(s,e){const t=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&t0&&(a=D),_=""}}return{bufferElements:u,cursorElement:a}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let e=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(s,e){const t=this._optionsService.rawOptions.fastScrollModifier;return t==="alt"&&e.altKey||t==="ctrl"&&e.ctrlKey||t==="shift"&&e.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){const e=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(s,e))}};r.Viewport=i=c([f(2,l.IBufferService),f(3,l.IOptionsService),f(4,d.ICharSizeService),f(5,d.IRenderService),f(6,d.ICoreBrowserService),f(7,d.IThemeService)],i)},3107:function(R,r,o){var c=this&&this.__decorate||function(l,i,s,e){var t,a=arguments.length,_=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(l,i,s,e);else for(var u=l.length-1;u>=0;u--)(t=l[u])&&(_=(a<3?t(_):a>3?t(i,s,_):t(i,s))||_);return a>3&&_&&Object.defineProperty(i,s,_),_},f=this&&this.__param||function(l,i){return function(s,e){i(s,e,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const n=o(4725),d=o(844),v=o(2585);let p=r.BufferDecorationRenderer=class extends d.Disposable{constructor(l,i,s,e,t){super(),this._screenElement=l,this._bufferService=i,this._coreBrowserService=s,this._decorationService=e,this._renderService=t,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(a=>this._removeDecoration(a))),this.register((0,d.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const l of this._decorationService.decorations)this._renderDecoration(l);this._dimensionsChanged=!1}_renderDecoration(l){this._refreshStyle(l),this._dimensionsChanged&&this._refreshXPosition(l)}_createElement(l){var i,s;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((i=l?.options)==null?void 0:i.layer)==="top"),e.style.width=`${Math.round((l.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=(l.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(l.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const t=(s=l.options.x)!=null?s:0;return t&&t>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(l,e),e}_refreshStyle(l){const i=l.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)l.element&&(l.element.style.display="none",l.onRenderEmitter.fire(l.element));else{let s=this._decorationElements.get(l);s||(s=this._createElement(l),l.element=s,this._decorationElements.set(l,s),this._container.appendChild(s),l.onDispose(()=>{this._decorationElements.delete(l),s.remove()})),s.style.top=i*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",l.onRenderEmitter.fire(s)}}_refreshXPosition(l,i=l.element){var s;if(!i)return;const e=(s=l.options.x)!=null?s:0;(l.options.anchor||"left")==="right"?i.style.right=e?e*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=e?e*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(l){var i;(i=this._decorationElements.get(l))==null||i.remove(),this._decorationElements.delete(l),l.dispose()}};r.BufferDecorationRenderer=p=c([f(1,v.IBufferService),f(2,n.ICoreBrowserService),f(3,v.IDecorationService),f(4,n.IRenderService)],p)},5871:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(o){if(o.options.overviewRulerOptions){for(const c of this._zones)if(c.color===o.options.overviewRulerOptions.color&&c.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,o.marker.line))return;if(this._lineAdjacentToZone(c,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(c,o.marker.line)}if(this._zonePoolIndex=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,f){return c>=o.startBufferLine-this._linePadding[f||"full"]&&c<=o.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(R,r,o){var c=this&&this.__decorate||function(t,a,_,u){var g,h=arguments.length,m=h<3?a:u===null?u=Object.getOwnPropertyDescriptor(a,_):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(t,a,_,u);else for(var y=t.length-1;y>=0;y--)(g=t[y])&&(m=(h<3?g(m):h>3?g(a,_,m):g(a,_))||m);return h>3&&m&&Object.defineProperty(a,_,m),m},f=this&&this.__param||function(t,a){return function(_,u){a(_,u,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const n=o(5871),d=o(4725),v=o(844),p=o(2585),l={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0};let e=r.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(t,a,_,u,g,h,m){var y;super(),this._viewportElement=t,this._screenElement=a,this._bufferService=_,this._decorationService=u,this._renderService=g,this._optionsService=h,this._coreBrowserService=m,this._colorZoneStore=new n.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(y=this._viewportElement.parentElement)==null||y.insertBefore(this._canvas,this._viewportElement);const k=this._canvas.getContext("2d");if(!k)throw new Error("Ctx cannot be null");this._ctx=k,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)(()=>{var D;(D=this._canvas)==null||D.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const t=Math.floor(this._canvas.width/3),a=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=t,i.center=a,i.right=t,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=i.left,s.right=i.left+i.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);const t=this._canvas.height/this._bufferService.buffer.lines.length,a=Math.round(Math.max(Math.min(t,12),6)*this._coreBrowserService.dpr);l.left=a,l.center=a,l.right=a}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const a of this._decorationService.decorations)this._colorZoneStore.addDecoration(a);this._ctx.lineWidth=1;const t=this._colorZoneStore.zones;for(const a of t)a.position!=="full"&&this._renderColorZone(a);for(const a of t)a.position==="full"&&this._renderColorZone(a);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(t){this._ctx.fillStyle=t.color,this._ctx.fillRect(s[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-l[t.position||"full"]/2),i[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[t.position||"full"]))}_queueRefresh(t,a){this._shouldUpdateDimensions=t||this._shouldUpdateDimensions,this._shouldUpdateAnchor=a||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};r.OverviewRulerRenderer=e=c([f(2,p.IBufferService),f(3,p.IDecorationService),f(4,d.IRenderService),f(5,p.IOptionsService),f(6,d.ICoreBrowserService)],e)},2950:function(R,r,o){var c=this&&this.__decorate||function(l,i,s,e){var t,a=arguments.length,_=a<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(l,i,s,e);else for(var u=l.length-1;u>=0;u--)(t=l[u])&&(_=(a<3?t(_):a>3?t(i,s,_):t(i,s))||_);return a>3&&_&&Object.defineProperty(i,s,_),_},f=this&&this.__param||function(l,i){return function(s,e){i(s,e,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const n=o(4725),d=o(2585),v=o(2584);let p=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(l,i,s,e,t,a){this._textarea=l,this._compositionView=i,this._bufferService=s,this._optionsService=e,this._coreService=t,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(l){this._compositionView.textContent=l.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(l){if(this._isComposing||this._isSendingComposition){if(l.keyCode===229||l.keyCode===16||l.keyCode===17||l.keyCode===18)return!1;this._finalizeComposition(!1)}return l.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(l){if(this._compositionView.classList.remove("active"),this._isComposing=!1,l){const i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let s;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;const i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){const l=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const i=this._textarea.value,s=i.replace(l,"");this._dataAlreadySent=s,i.length>l.length?this._coreService.triggerDataEvent(s,!0):i.lengththis.updateCompositionElements(!0),0)}}};r.CompositionHelper=p=c([f(2,d.IBufferService),f(3,d.IOptionsService),f(4,d.ICoreService),f(5,n.IRenderService)],p)},9806:(R,r)=>{function o(c,f,n){const d=n.getBoundingClientRect(),v=c.getComputedStyle(n),p=parseInt(v.getPropertyValue("padding-left")),l=parseInt(v.getPropertyValue("padding-top"));return[f.clientX-d.left-p,f.clientY-d.top-l]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=o,r.getCoords=function(c,f,n,d,v,p,l,i,s){if(!p)return;const e=o(c,f,n);return e?(e[0]=Math.ceil((e[0]+(s?l/2:0))/l),e[1]=Math.ceil(e[1]/i),e[0]=Math.min(Math.max(e[0],1),d+(s?1:0)),e[1]=Math.min(Math.max(e[1],1),v),e):void 0}},9504:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const c=o(2584);function f(i,s,e,t){const a=i-n(i,e),_=s-n(s,e),u=Math.abs(a-_)-function(g,h,m){let y=0;const k=g-n(g,m),D=h-n(h,m);for(let b=0;b=0&&is?"A":"B"}function v(i,s,e,t,a,_){let u=i,g=s,h="";for(;u!==e||g!==t;)u+=a?1:-1,a&&u>_.cols-1?(h+=_.buffer.translateBufferLineToString(g,!1,i,u),u=0,i=0,g++):!a&&u<0&&(h+=_.buffer.translateBufferLineToString(g,!1,0,i+1),u=_.cols-1,i=u,g--);return h+_.buffer.translateBufferLineToString(g,!1,i,u)}function p(i,s){const e=s?"O":"[";return c.C0.ESC+e+i}function l(i,s){i=Math.floor(i);let e="";for(let t=0;t0?k-n(k,D):m;const A=k,H=function(U,F,S,w,E,L){let P;return P=f(S,w,E,L).length>0?w-n(w,E):F,U=S&&Pi?"D":"C",l(Math.abs(a-i),p(u,t));u=_>s?"D":"C";const g=Math.abs(_-s);return l(function(h,m){return m.cols-h}(_>s?i:a,e)+(g-1)*e.cols+1+((_>s?a:i)-1),p(u,t))}},1296:function(R,r,o){var c=this&&this.__decorate||function(b,B,A,H){var U,F=arguments.length,S=F<3?B:H===null?H=Object.getOwnPropertyDescriptor(B,A):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(b,B,A,H);else for(var w=b.length-1;w>=0;w--)(U=b[w])&&(S=(F<3?U(S):F>3?U(B,A,S):U(B,A))||S);return F>3&&S&&Object.defineProperty(B,A,S),S},f=this&&this.__param||function(b,B){return function(A,H){B(A,H,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const n=o(3787),d=o(2550),v=o(2223),p=o(6171),l=o(6052),i=o(4725),s=o(8055),e=o(8460),t=o(844),a=o(2585),_="xterm-dom-renderer-owner-",u="xterm-rows",g="xterm-fg-",h="xterm-bg-",m="xterm-focus",y="xterm-selection";let k=1,D=r.DomRenderer=class extends t.Disposable{constructor(b,B,A,H,U,F,S,w,E,L,P,W,$){super(),this._terminal=b,this._document=B,this._element=A,this._screenElement=H,this._viewportElement=U,this._helperContainer=F,this._linkifier2=S,this._charSizeService=E,this._optionsService=L,this._bufferService=P,this._coreBrowserService=W,this._themeService=$,this._terminalClass=k++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(u),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(y),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,p.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(j=>this._injectCss(j))),this._injectCss(this._themeService.colors),this._rowFactory=w.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(j=>this._handleLinkHover(j))),this.register(this._linkifier2.onHideLinkUnderline(j=>this._handleLinkLeave(j))),this.register((0,t.toDisposable)(()=>{this._element.classList.remove(_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new d.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const b=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*b,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*b),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/b),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/b),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const A of this._rowElements)A.style.width=`${this.dimensions.css.canvas.width}px`,A.style.height=`${this.dimensions.css.cell.height}px`,A.style.lineHeight=`${this.dimensions.css.cell.height}px`,A.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const B=`${this._terminalSelector} .${u} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=B,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(b){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let B=`${this._terminalSelector} .${u} { color: ${b.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;B+=`${this._terminalSelector} .${u} .xterm-dim { color: ${s.color.multiplyOpacity(b.foreground,.5).css};}`,B+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const A=`blink_underline_${this._terminalClass}`,H=`blink_bar_${this._terminalClass}`,U=`blink_block_${this._terminalClass}`;B+=`@keyframes ${A} { 50% { border-bottom-style: hidden; }}`,B+=`@keyframes ${H} { 50% { box-shadow: none; }}`,B+=`@keyframes ${U} { 0% { background-color: ${b.cursor.css}; color: ${b.cursorAccent.css}; } 50% { background-color: inherit; color: ${b.cursor.css}; }}`,B+=`${this._terminalSelector} .${u}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${A} 1s step-end infinite;}${this._terminalSelector} .${u}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${u}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block { background-color: ${b.cursor.css}; color: ${b.cursorAccent.css};}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${b.cursor.css} !important; color: ${b.cursorAccent.css} !important;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${b.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${b.cursor.css} inset;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${b.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,B+=`${this._terminalSelector} .${y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${y} div { position: absolute; background-color: ${b.selectionBackgroundOpaque.css};}${this._terminalSelector} .${y} div { position: absolute; background-color: ${b.selectionInactiveBackgroundOpaque.css};}`;for(const[F,S]of b.ansi.entries())B+=`${this._terminalSelector} .${g}${F} { color: ${S.css}; }${this._terminalSelector} .${g}${F}.xterm-dim { color: ${s.color.multiplyOpacity(S,.5).css}; }${this._terminalSelector} .${h}${F} { background-color: ${S.css}; }`;B+=`${this._terminalSelector} .${g}${v.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(b.background).css}; }${this._terminalSelector} .${g}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(b.background),.5).css}; }${this._terminalSelector} .${h}${v.INVERTED_DEFAULT_COLOR} { background-color: ${b.foreground.css}; }`,this._themeStyleElement.textContent=B}_setDefaultSpacing(){const b=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${b}px`,this._rowFactory.defaultSpacing=b}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(b,B){for(let A=this._rowElements.length;A<=B;A++){const H=this._document.createElement("div");this._rowContainer.appendChild(H),this._rowElements.push(H)}for(;this._rowElements.length>B;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(b,B){this._refreshRowElements(b,B),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(m),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(m),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(b,B,A){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(b,B,A),this.renderRows(0,this._bufferService.rows-1),!b||!B)return;this._selectionRenderModel.update(this._terminal,b,B,A);const H=this._selectionRenderModel.viewportStartRow,U=this._selectionRenderModel.viewportEndRow,F=this._selectionRenderModel.viewportCappedStartRow,S=this._selectionRenderModel.viewportCappedEndRow;if(F>=this._bufferService.rows||S<0)return;const w=this._document.createDocumentFragment();if(A){const E=b[0]>B[0];w.appendChild(this._createSelectionElement(F,E?B[0]:b[0],E?b[0]:B[0],S-F+1))}else{const E=H===F?b[0]:0,L=F===U?B[0]:this._bufferService.cols;w.appendChild(this._createSelectionElement(F,E,L));const P=S-F-1;if(w.appendChild(this._createSelectionElement(F+1,0,this._bufferService.cols,P)),F!==S){const W=U===S?B[0]:this._bufferService.cols;w.appendChild(this._createSelectionElement(S,0,W))}}this._selectionContainer.appendChild(w)}_createSelectionElement(b,B,A,H=1){const U=this._document.createElement("div"),F=B*this.dimensions.css.cell.width;let S=this.dimensions.css.cell.width*(A-B);return F+S>this.dimensions.css.canvas.width&&(S=this.dimensions.css.canvas.width-F),U.style.height=H*this.dimensions.css.cell.height+"px",U.style.top=b*this.dimensions.css.cell.height+"px",U.style.left=`${F}px`,U.style.width=`${S}px`,U}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const b of this._rowElements)b.replaceChildren()}renderRows(b,B){const A=this._bufferService.buffer,H=A.ybase+A.y,U=Math.min(A.x,this._bufferService.cols-1),F=this._optionsService.rawOptions.cursorBlink,S=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let E=b;E<=B;E++){const L=E+A.ydisp,P=this._rowElements[E],W=A.lines.get(L);if(!P||!W)break;P.replaceChildren(...this._rowFactory.createRow(W,L,L===H,S,w,U,F,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${_}${this._terminalClass}`}_handleLinkHover(b){this._setCellUnderline(b.x1,b.x2,b.y1,b.y2,b.cols,!0)}_handleLinkLeave(b){this._setCellUnderline(b.x1,b.x2,b.y1,b.y2,b.cols,!1)}_setCellUnderline(b,B,A,H,U,F){A<0&&(b=0),H<0&&(B=0);const S=this._bufferService.rows-1;A=Math.max(Math.min(A,S),0),H=Math.max(Math.min(H,S),0),U=Math.min(U,this._bufferService.cols);const w=this._bufferService.buffer,E=w.ybase+w.y,L=Math.min(w.x,U-1),P=this._optionsService.rawOptions.cursorBlink,W=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=A;j<=H;++j){const x=j+w.ydisp,C=this._rowElements[j],I=w.lines.get(x);if(!C||!I)break;C.replaceChildren(...this._rowFactory.createRow(I,x,x===E,W,$,L,P,this.dimensions.css.cell.width,this._widthCache,F?j===A?b:0:-1,F?(j===H?B:U)-1:-1))}}};r.DomRenderer=D=c([f(7,a.IInstantiationService),f(8,i.ICharSizeService),f(9,a.IOptionsService),f(10,a.IBufferService),f(11,i.ICoreBrowserService),f(12,i.IThemeService)],D)},3787:function(R,r,o){var c=this&&this.__decorate||function(u,g,h,m){var y,k=arguments.length,D=k<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,h):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(u,g,h,m);else for(var b=u.length-1;b>=0;b--)(y=u[b])&&(D=(k<3?y(D):k>3?y(g,h,D):y(g,h))||D);return k>3&&D&&Object.defineProperty(g,h,D),D},f=this&&this.__param||function(u,g){return function(h,m){g(h,m,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const n=o(2223),d=o(643),v=o(511),p=o(2585),l=o(8055),i=o(4725),s=o(4269),e=o(6171),t=o(3734);let a=r.DomRendererRowFactory=class{constructor(u,g,h,m,y,k,D){this._document=u,this._characterJoinerService=g,this._optionsService=h,this._coreBrowserService=m,this._coreService=y,this._decorationService=k,this._themeService=D,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(u,g,h){this._selectionStart=u,this._selectionEnd=g,this._columnSelectMode=h}createRow(u,g,h,m,y,k,D,b,B,A,H){const U=[],F=this._characterJoinerService.getJoinedCharacters(g),S=this._themeService.colors;let w,E=u.getNoBgTrimmedLength();h&&E0&&K===F[0][0]){X=!0;const V=F.shift();z=new s.JoinedCellData(this._workCell,u.translateToString(!0,V[0],V[1]),V[1]-V[0]),Q=V[1]-1,G=z.getWidth()}const he=this._isCellInSelection(K,g),ge=h&&K===k,me=M&&K>=A&&K<=H;let Se=!1;this._decorationService.forEachDecorationAtCell(K,g,void 0,V=>{Se=!0});let fe=z.getChars()||d.WHITESPACE_CELL_CHAR;if(fe===" "&&(z.isUnderline()||z.isOverline())&&(fe="\xA0"),O=G*b-B.get(fe,z.isBold(),z.isItalic()),w){if(L&&(he&&I||!he&&!I&&z.bg===W)&&(he&&I&&S.selectionForeground||z.fg===$)&&z.extended.ext===j&&me===x&&O===C&&!ge&&!X&&!Se){z.isInvisible()?P+=d.WHITESPACE_CELL_CHAR:P+=fe,L++;continue}L&&(w.textContent=P),w=this._document.createElement("span"),L=0,P=""}else w=this._document.createElement("span");if(W=z.bg,$=z.fg,j=z.extended.ext,x=me,C=O,I=he,X&&k>=K&&k<=Q&&(k=K),!this._coreService.isCursorHidden&&ge&&this._coreService.isCursorInitialized){if(N.push("xterm-cursor"),this._coreBrowserService.isFocused)D&&N.push("xterm-cursor-blink"),N.push(m==="bar"?"xterm-cursor-bar":m==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(y)switch(y){case"outline":N.push("xterm-cursor-outline");break;case"block":N.push("xterm-cursor-block");break;case"bar":N.push("xterm-cursor-bar");break;case"underline":N.push("xterm-cursor-underline")}}if(z.isBold()&&N.push("xterm-bold"),z.isItalic()&&N.push("xterm-italic"),z.isDim()&&N.push("xterm-dim"),P=z.isInvisible()?d.WHITESPACE_CELL_CHAR:z.getChars()||d.WHITESPACE_CELL_CHAR,z.isUnderline()&&(N.push(`xterm-underline-${z.extended.underlineStyle}`),P===" "&&(P="\xA0"),!z.isUnderlineColorDefault()))if(z.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${t.AttributeData.toColorRGB(z.getUnderlineColor()).join(",")})`;else{let V=z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&z.isBold()&&V<8&&(V+=8),w.style.textDecorationColor=S.ansi[V].css}z.isOverline()&&(N.push("xterm-overline"),P===" "&&(P="\xA0")),z.isStrikethrough()&&N.push("xterm-strikethrough"),me&&(w.style.textDecoration="underline");let ie=z.getFgColor(),le=z.getFgColorMode(),se=z.getBgColor(),ce=z.getBgColorMode();const Ce=!!z.isInverse();if(Ce){const V=ie;ie=se,se=V;const Ee=le;le=ce,ce=Ee}let ne,ve,oe,de=!1;switch(this._decorationService.forEachDecorationAtCell(K,g,void 0,V=>{V.options.layer!=="top"&&de||(V.backgroundColorRGB&&(ce=50331648,se=V.backgroundColorRGB.rgba>>8&16777215,ne=V.backgroundColorRGB),V.foregroundColorRGB&&(le=50331648,ie=V.foregroundColorRGB.rgba>>8&16777215,ve=V.foregroundColorRGB),de=V.options.layer==="top")}),!de&&he&&(ne=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,se=ne.rgba>>8&16777215,ce=50331648,de=!0,S.selectionForeground&&(le=50331648,ie=S.selectionForeground.rgba>>8&16777215,ve=S.selectionForeground)),de&&N.push("xterm-decoration-top"),ce){case 16777216:case 33554432:oe=S.ansi[se],N.push(`xterm-bg-${se}`);break;case 50331648:oe=l.channels.toColor(se>>16,se>>8&255,255&se),this._addStyle(w,`background-color:#${_((se>>>0).toString(16),"0",6)}`);break;default:Ce?(oe=S.foreground,N.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):oe=S.background}switch(ne||z.isDim()&&(ne=l.color.multiplyOpacity(oe,.5)),le){case 16777216:case 33554432:z.isBold()&&ie<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ie+=8),this._applyMinimumContrast(w,oe,S.ansi[ie],z,ne,void 0)||N.push(`xterm-fg-${ie}`);break;case 50331648:const V=l.channels.toColor(ie>>16&255,ie>>8&255,255&ie);this._applyMinimumContrast(w,oe,V,z,ne,ve)||this._addStyle(w,`color:#${_(ie.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(w,oe,S.foreground,z,ne,ve)||Ce&&N.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}N.length&&(w.className=N.join(" "),N.length=0),ge||X||Se?w.textContent=P:L++,O!==this.defaultSpacing&&(w.style.letterSpacing=`${O}px`),U.push(w),K=Q}return w&&L&&(w.textContent=P),U}_applyMinimumContrast(u,g,h,m,y,k){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(m.getCode()))return!1;const D=this._getContrastCache(m);let b;if(y||k||(b=D.getColor(g.rgba,h.rgba)),b===void 0){const B=this._optionsService.rawOptions.minimumContrastRatio/(m.isDim()?2:1);b=l.color.ensureContrastRatio(y||g,k||h,B),D.setColor((y||g).rgba,(k||h).rgba,b??null)}return!!b&&(this._addStyle(u,`color:${b.css}`),!0)}_getContrastCache(u){return u.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(u,g){u.setAttribute("style",`${u.getAttribute("style")||""}${g};`)}_isCellInSelection(u,g){const h=this._selectionStart,m=this._selectionEnd;return!(!h||!m)&&(this._columnSelectMode?h[0]<=m[0]?u>=h[0]&&g>=h[1]&&u=h[1]&&u>=m[0]&&g<=m[1]:g>h[1]&&g=h[0]&&u=h[0])}};function _(u,g,h){for(;u.length{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(o,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const f=o.createElement("span");f.classList.add("xterm-char-measure-element");const n=o.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";const d=o.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontStyle="italic";const v=o.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[f,n,d,v],this._container.appendChild(f),this._container.appendChild(n),this._container.appendChild(d),this._container.appendChild(v),c.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(o,c,f,n){o===this._font&&c===this._fontSize&&f===this._weight&&n===this._weightBold||(this._font=o,this._fontSize=c,this._weight=f,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(o,c,f){let n=0;if(!c&&!f&&o.length===1&&(n=o.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];const p=this._measure(o,0);return p>0&&(this._flat[n]=p),p}let d=o;c&&(d+="B"),f&&(d+="I");let v=this._holey.get(d);if(v===void 0){let p=0;c&&(p|=1),f&&(p|=2),v=this._measure(o,p),v>0&&this._holey.set(d,v)}return v}_measure(o,c){const f=this._measureElements[c];return f.textContent=o.repeat(32),f.offsetWidth/32}}},2223:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const c=o(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(R,r)=>{function o(f){return 57508<=f&&f<=57558}function c(f){return f>=128512&&f<=128591||f>=127744&&f<=128511||f>=128640&&f<=128767||f>=9728&&f<=9983||f>=9984&&f<=10175||f>=65024&&f<=65039||f>=129280&&f<=129535||f>=127462&&f<=127487}Object.defineProperty(r,"__esModule",{value:!0}),r.computeNextVariantOffset=r.createRenderDimensions=r.treatGlyphAsBackgroundColor=r.allowRescaling=r.isEmoji=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(f){if(!f)throw new Error("value must not be falsy");return f},r.isPowerlineGlyph=o,r.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},r.isEmoji=c,r.allowRescaling=function(f,n,d,v){return n===1&&d>Math.ceil(1.5*v)&&f!==void 0&&f>255&&!c(f)&&!o(f)&&!function(p){return 57344<=p&&p<=63743}(f)},r.treatGlyphAsBackgroundColor=function(f){return o(f)||function(n){return 9472<=n&&n<=9631}(f)},r.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},r.computeNextVariantOffset=function(f,n,d=0){return(f-(2*Math.round(n)-d))%(2*Math.round(n))}},6052:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class o{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(f,n,d,v=!1){if(this.selectionStart=n,this.selectionEnd=d,!n||!d||n[0]===d[0]&&n[1]===d[1])return void this.clear();const p=f.buffers.active.ydisp,l=n[1]-p,i=d[1]-p,s=Math.max(l,0),e=Math.min(i,f.rows-1);s>=f.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=l,this.viewportEndRow=i,this.viewportCappedStartRow=s,this.viewportCappedEndRow=e,this.startCol=n[0],this.endCol=d[0])}isCellSelected(f,n,d){return!!this.hasSelection&&(d-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&d>=this.viewportCappedStartRow&&n=this.viewportCappedStartRow&&n>=this.endCol&&d<=this.viewportCappedEndRow:d>this.viewportStartRow&&d=this.startCol&&n=this.startCol)}}r.createSelectionRenderModel=function(){return new o}},456:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(o){this._bufferService=o,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,c=this.selectionEnd;return!(!o||!c)&&(o[1]>c[1]||o[1]===c[1]&&o[0]>c[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(R,r,o){var c=this&&this.__decorate||function(e,t,a,_){var u,g=arguments.length,h=g<3?t:_===null?_=Object.getOwnPropertyDescriptor(t,a):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(e,t,a,_);else for(var m=e.length-1;m>=0;m--)(u=e[m])&&(h=(g<3?u(h):g>3?u(t,a,h):u(t,a))||h);return g>3&&h&&Object.defineProperty(t,a,h),h},f=this&&this.__param||function(e,t){return function(a,_){t(a,_,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const n=o(2585),d=o(8460),v=o(844);let p=r.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,a){super(),this._optionsService=a,this.width=0,this.height=0,this._onCharSizeChange=this.register(new d.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new s(this._optionsService))}catch{this._measureStrategy=this.register(new i(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};r.CharSizeService=p=c([f(2,n.IOptionsService)],p);class l extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,a){t!==void 0&&t>0&&a!==void 0&&a>0&&(this._result.width=t,this._result.height=a)}}class i extends l{constructor(t,a,_){super(),this._document=t,this._parentElement=a,this._optionsService=_,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class s extends l{constructor(t){super(),this._optionsService=t,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const a=this._ctx.measureText("W");if(!("width"in a&&"fontBoundingBoxAscent"in a&&"fontBoundingBoxDescent"in a))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const t=this._ctx.measureText("W");return this._validateAndSet(t.width,t.fontBoundingBoxAscent+t.fontBoundingBoxDescent),this._result}}},4269:function(R,r,o){var c=this&&this.__decorate||function(s,e,t,a){var _,u=arguments.length,g=u<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(s,e,t,a);else for(var h=s.length-1;h>=0;h--)(_=s[h])&&(g=(u<3?_(g):u>3?_(e,t,g):_(e,t))||g);return u>3&&g&&Object.defineProperty(e,t,g),g},f=this&&this.__param||function(s,e){return function(t,a){e(t,a,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const n=o(3734),d=o(643),v=o(511),p=o(2585);class l extends n.AttributeData{constructor(e,t,a){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=a}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()]}}r.JoinedCellData=l;let i=r.CharacterJoinerService=class we{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(e){const t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t1){const D=this._getJoinedRanges(_,h,g,t,u);for(let b=0;b1){const k=this._getJoinedRanges(_,h,g,t,u);for(let D=0;D{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;const c=o(844),f=o(8460),n=o(3656);class d extends c.Disposable{constructor(l,i,s){super(),this._textarea=l,this._window=i,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new f.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this.register((0,f.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(l){this._window!==l&&(this._window=l,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}}r.CoreBrowserService=d;class v extends c.Disposable{constructor(l){super(),this._parentWindow=l,this._windowResizeListener=this.register(new c.MutableDisposable),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,c.toDisposable)(()=>this.clearListener()))}setWindow(l){this._parentWindow=l,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var l;this._outerListener&&((l=this._resolutionMediaMatchList)==null||l.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;const c=o(844);class f extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(d){return this.linkProviders.push(d),{dispose:()=>{const v=this.linkProviders.indexOf(d);v!==-1&&this.linkProviders.splice(v,1)}}}}r.LinkProviderService=f},8934:function(R,r,o){var c=this&&this.__decorate||function(p,l,i,s){var e,t=arguments.length,a=t<3?l:s===null?s=Object.getOwnPropertyDescriptor(l,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(p,l,i,s);else for(var _=p.length-1;_>=0;_--)(e=p[_])&&(a=(t<3?e(a):t>3?e(l,i,a):e(l,i))||a);return t>3&&a&&Object.defineProperty(l,i,a),a},f=this&&this.__param||function(p,l){return function(i,s){l(i,s,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const n=o(4725),d=o(9806);let v=r.MouseService=class{constructor(p,l){this._renderService=p,this._charSizeService=l}getCoords(p,l,i,s,e){return(0,d.getCoords)(window,p,l,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(p,l){const i=(0,d.getCoordsRelativeToElement)(window,p,l);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};r.MouseService=v=c([f(0,n.IRenderService),f(1,n.ICharSizeService)],v)},3230:function(R,r,o){var c=this&&this.__decorate||function(e,t,a,_){var u,g=arguments.length,h=g<3?t:_===null?_=Object.getOwnPropertyDescriptor(t,a):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(e,t,a,_);else for(var m=e.length-1;m>=0;m--)(u=e[m])&&(h=(g<3?u(h):g>3?u(t,a,h):u(t,a))||h);return g>3&&h&&Object.defineProperty(t,a,h),h},f=this&&this.__param||function(e,t){return function(a,_){t(a,_,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const n=o(6193),d=o(4725),v=o(8460),p=o(844),l=o(7226),i=o(2585);let s=r.RenderService=class extends p.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,a,_,u,g,h,m){super(),this._rowCount=e,this._charSizeService=_,this._renderer=this.register(new p.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new p.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer((y,k)=>this._renderRows(y,k),h),this.register(this._renderDebouncer),this.register(h.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(g.onResize(()=>this._fullRefresh())),this.register(g.buffers.onBufferActivate(()=>{var y;return(y=this._renderer.value)==null?void 0:y.clear()})),this.register(a.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(u.onDecorationRegistered(()=>this._fullRefresh())),this.register(u.onDecorationRemoved(()=>this._fullRefresh())),this.register(a.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(g.cols,g.rows),this._fullRefresh()})),this.register(a.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(g.buffer.y,g.buffer.y,!0))),this.register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(h.window,t),this.register(h.onWindowChange(y=>this._registerIntersectionObserver(y,t)))}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){const a=new e.IntersectionObserver(_=>this._handleIntersectionChange(_[_.length-1]),{threshold:0});a.observe(t),this._observerDisposable.value=(0,p.toDisposable)(()=>a.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,a=!1){this._isPaused?this._needsFullRefresh=!0:(a||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(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 a;return(a=this._renderer.value)==null?void 0:a.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,a){var _;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=a,(_=this._renderer.value)==null||_.handleSelectionChanged(e,t,a)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};r.RenderService=s=c([f(2,i.IOptionsService),f(3,d.ICharSizeService),f(4,i.IDecorationService),f(5,i.IBufferService),f(6,d.ICoreBrowserService),f(7,d.IThemeService)],s)},9312:function(R,r,o){var c=this&&this.__decorate||function(h,m,y,k){var D,b=arguments.length,B=b<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(h,m,y,k);else for(var A=h.length-1;A>=0;A--)(D=h[A])&&(B=(b<3?D(B):b>3?D(m,y,B):D(m,y))||B);return b>3&&B&&Object.defineProperty(m,y,B),B},f=this&&this.__param||function(h,m){return function(y,k){m(y,k,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const n=o(9806),d=o(9504),v=o(456),p=o(4725),l=o(8460),i=o(844),s=o(6114),e=o(4841),t=o(511),a=o(2585),_="\xA0",u=new RegExp(_,"g");let g=r.SelectionService=class extends i.Disposable{constructor(h,m,y,k,D,b,B,A,H){super(),this._element=h,this._screenElement=m,this._linkifier=y,this._bufferService=k,this._coreService=D,this._mouseService=b,this._optionsService=B,this._renderService=A,this._coreBrowserService=H,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new t.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=U=>this._handleMouseMove(U),this._mouseUpListener=U=>this._handleMouseUp(U),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(U=>this._handleTrim(U)),this.register(this._bufferService.buffers.onBufferActivate(U=>this._handleBufferActivate(U))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const h=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!h||!m||h[0]===m[0]&&h[1]===m[1])}get selectionText(){const h=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!h||!m)return"";const y=this._bufferService.buffer,k=[];if(this._activeSelectionMode===3){if(h[0]===m[0])return"";const D=h[0]D.replace(u," ")).join(s.isWindows?`\r +`:` +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(h){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),s.isLinux&&h&&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(h){const m=this._getMouseBufferCoords(h),y=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!!(y&&k&&m)&&this._areCoordsInSelection(m,y,k)}isCellInSelection(h,m){const y=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!(!y||!k)&&this._areCoordsInSelection([h,m],y,k)}_areCoordsInSelection(h,m,y){return h[1]>m[1]&&h[1]=m[0]&&h[0]=m[0]}_selectWordAtCursor(h,m){var y,k;const D=(k=(y=this._linkifier.currentLink)==null?void 0:y.link)==null?void 0:k.range;if(D)return this._model.selectionStart=[D.start.x-1,D.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(D,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const b=this._getMouseBufferCoords(h);return!!b&&(this._selectWordAt(b,m),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(h,m){this._model.clearSelection(),h=Math.max(h,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,h],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()}_handleTrim(h){this._model.handleTrim(h)&&this.refresh()}_getMouseBufferCoords(h){const m=this._mouseService.getCoords(h,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m}_getMouseEventScrollAmount(h){let m=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,h,this._screenElement)[1];const y=this._renderService.dimensions.css.canvas.height;return m>=0&&m<=y?0:(m>y&&(m-=y),m=Math.min(Math.max(m,-50),50),m/=50,m/Math.abs(m)+Math.round(14*m))}shouldForceSelection(h){return s.isMac?h.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:h.shiftKey}handleMouseDown(h){if(this._mouseDownTimeStamp=h.timeStamp,(h.button!==2||!this.hasSelection)&&h.button===0){if(!this._enabled){if(!this.shouldForceSelection(h))return;h.stopPropagation()}h.preventDefault(),this._dragScrollAmount=0,this._enabled&&h.shiftKey?this._handleIncrementalClick(h):h.detail===1?this._handleSingleClick(h):h.detail===2?this._handleDoubleClick(h):h.detail===3&&this._handleTripleClick(h),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(h){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(h))}_handleSingleClick(h){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(h)?3:0,this._model.selectionStart=this._getMouseBufferCoords(h),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const m=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);m&&m.length!==this._model.selectionStart[0]&&m.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(h){this._selectWordAtCursor(h,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(h){const m=this._getMouseBufferCoords(h);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))}shouldColumnSelect(h){return h.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(h){if(h.stopImmediatePropagation(),!this._model.selectionStart)return;const m=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(h),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const y=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(h.ydisp+this._bufferService.rows,h.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=h.ydisp),this.refresh()}}_handleMouseUp(h){const m=h.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&h.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const y=this._mouseService.getCoords(h,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(y&&y[0]!==void 0&&y[1]!==void 0){const k=(0,d.moveToCellSequence)(y[0]-1,y[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(k,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const h=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,y=!(!h||!m||h[0]===m[0]&&h[1]===m[1]);y?h&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&h[0]===this._oldSelectionStart[0]&&h[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(h,m,y)):this._oldHasSelection&&this._fireOnSelectionChange(h,m,y)}_fireOnSelectionChange(h,m,y){this._oldSelectionStart=h,this._oldSelectionEnd=m,this._oldHasSelection=y,this._onSelectionChange.fire()}_handleBufferActivate(h){this.clearSelection(),this._trimListener.dispose(),this._trimListener=h.activeBuffer.lines.onTrim(m=>this._handleTrim(m))}_convertViewportColToCharacterIndex(h,m){let y=m;for(let k=0;m>=k;k++){const D=h.loadCell(k,this._workCell).getChars().length;this._workCell.getWidth()===0?y--:D>1&&m!==k&&(y+=D-1)}return y}setSelection(h,m,y){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[h,m],this._model.selectionStartLength=y,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(h){this._isClickInSelection(h)||(this._selectWordAtCursor(h,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(h,m,y=!0,k=!0){if(h[0]>=this._bufferService.cols)return;const D=this._bufferService.buffer,b=D.lines.get(h[1]);if(!b)return;const B=D.translateBufferLineToString(h[1],!1);let A=this._convertViewportColToCharacterIndex(b,h[0]),H=A;const U=h[0]-A;let F=0,S=0,w=0,E=0;if(B.charAt(A)===" "){for(;A>0&&B.charAt(A-1)===" ";)A--;for(;H1&&(E+=j-1,H+=j-1);W>0&&A>0&&!this._isCharWordSeparator(b.loadCell(W-1,this._workCell));){b.loadCell(W-1,this._workCell);const x=this._workCell.getChars().length;this._workCell.getWidth()===0?(F++,W--):x>1&&(w+=x-1,A-=x-1),A--,W--}for(;$1&&(E+=x-1,H+=x-1),H++,$++}}H++;let L=A+U-F+w,P=Math.min(this._bufferService.cols,H-A+F+S-w-E);if(m||B.slice(A,H).trim()!==""){if(y&&L===0&&b.getCodePoint(0)!==32){const W=D.lines.get(h[1]-1);if(W&&b.isWrapped&&W.getCodePoint(this._bufferService.cols-1)!==32){const $=this._getWordAt([this._bufferService.cols-1,h[1]-1],!1,!0,!1);if($){const j=this._bufferService.cols-$.start;L-=j,P+=j}}}if(k&&L+P===this._bufferService.cols&&b.getCodePoint(this._bufferService.cols-1)!==32){const W=D.lines.get(h[1]+1);if(W?.isWrapped&&W.getCodePoint(0)!==32){const $=this._getWordAt([0,h[1]+1],!1,!1,!0);$&&(P+=$.length)}}return{start:L,length:P}}}_selectWordAt(h,m){const y=this._getWordAt(h,m);if(y){for(;y.start<0;)y.start+=this._bufferService.cols,h[1]--;this._model.selectionStart=[y.start,h[1]],this._model.selectionStartLength=y.length}}_selectToWordAt(h){const m=this._getWordAt(h,!0);if(m){let y=h[1];for(;m.start<0;)m.start+=this._bufferService.cols,y--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,y++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,y]}}_isCharWordSeparator(h){return h.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(h.getChars())>=0}_selectLineAt(h){const m=this._bufferService.buffer.getWrappedRangeForLine(h),y={start:{x:0,y:m.first},end:{x:this._bufferService.cols-1,y:m.last}};this._model.selectionStart=[0,m.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,e.getRangeLength)(y,this._bufferService.cols)}};r.SelectionService=g=c([f(3,a.IBufferService),f(4,a.ICoreService),f(5,p.IMouseService),f(6,a.IOptionsService),f(7,p.IRenderService),f(8,p.ICoreBrowserService)],g)},4725:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ILinkProviderService=r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const c=o(8343);r.ICharSizeService=(0,c.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),r.IMouseService=(0,c.createDecorator)("MouseService"),r.IRenderService=(0,c.createDecorator)("RenderService"),r.ISelectionService=(0,c.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,c.createDecorator)("ThemeService"),r.ILinkProviderService=(0,c.createDecorator)("LinkProviderService")},6731:function(R,r,o){var c=this&&this.__decorate||function(g,h,m,y){var k,D=arguments.length,b=D<3?h:y===null?y=Object.getOwnPropertyDescriptor(h,m):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(g,h,m,y);else for(var B=g.length-1;B>=0;B--)(k=g[B])&&(b=(D<3?k(b):D>3?k(h,m,b):k(h,m))||b);return D>3&&b&&Object.defineProperty(h,m,b),b},f=this&&this.__param||function(g,h){return function(m,y){h(m,y,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const n=o(7239),d=o(8055),v=o(8460),p=o(844),l=o(2585),i=d.css.toColor("#ffffff"),s=d.css.toColor("#000000"),e=d.css.toColor("#ffffff"),t=d.css.toColor("#000000"),a={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const g=[d.css.toColor("#2e3436"),d.css.toColor("#cc0000"),d.css.toColor("#4e9a06"),d.css.toColor("#c4a000"),d.css.toColor("#3465a4"),d.css.toColor("#75507b"),d.css.toColor("#06989a"),d.css.toColor("#d3d7cf"),d.css.toColor("#555753"),d.css.toColor("#ef2929"),d.css.toColor("#8ae234"),d.css.toColor("#fce94f"),d.css.toColor("#729fcf"),d.css.toColor("#ad7fa8"),d.css.toColor("#34e2e2"),d.css.toColor("#eeeeec")],h=[0,95,135,175,215,255];for(let m=0;m<216;m++){const y=h[m/36%6|0],k=h[m/6%6|0],D=h[m%6];g.push({css:d.channels.toCss(y,k,D),rgba:d.channels.toRgba(y,k,D)})}for(let m=0;m<24;m++){const y=8+10*m;g.push({css:d.channels.toCss(y,y,y),rgba:d.channels.toRgba(y,y,y)})}return g})());let _=r.ThemeService=class extends p.Disposable{get colors(){return this._colors}constructor(g){super(),this._optionsService=g,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:s,cursor:e,cursorAccent:t,selectionForeground:void 0,selectionBackgroundTransparent:a,selectionBackgroundOpaque:d.color.blend(s,a),selectionInactiveBackgroundTransparent:a,selectionInactiveBackgroundOpaque:d.color.blend(s,a),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(g={}){const h=this._colors;if(h.foreground=u(g.foreground,i),h.background=u(g.background,s),h.cursor=u(g.cursor,e),h.cursorAccent=u(g.cursorAccent,t),h.selectionBackgroundTransparent=u(g.selectionBackground,a),h.selectionBackgroundOpaque=d.color.blend(h.background,h.selectionBackgroundTransparent),h.selectionInactiveBackgroundTransparent=u(g.selectionInactiveBackground,h.selectionBackgroundTransparent),h.selectionInactiveBackgroundOpaque=d.color.blend(h.background,h.selectionInactiveBackgroundTransparent),h.selectionForeground=g.selectionForeground?u(g.selectionForeground,d.NULL_COLOR):void 0,h.selectionForeground===d.NULL_COLOR&&(h.selectionForeground=void 0),d.color.isOpaque(h.selectionBackgroundTransparent)&&(h.selectionBackgroundTransparent=d.color.opacity(h.selectionBackgroundTransparent,.3)),d.color.isOpaque(h.selectionInactiveBackgroundTransparent)&&(h.selectionInactiveBackgroundTransparent=d.color.opacity(h.selectionInactiveBackgroundTransparent,.3)),h.ansi=r.DEFAULT_ANSI_COLORS.slice(),h.ansi[0]=u(g.black,r.DEFAULT_ANSI_COLORS[0]),h.ansi[1]=u(g.red,r.DEFAULT_ANSI_COLORS[1]),h.ansi[2]=u(g.green,r.DEFAULT_ANSI_COLORS[2]),h.ansi[3]=u(g.yellow,r.DEFAULT_ANSI_COLORS[3]),h.ansi[4]=u(g.blue,r.DEFAULT_ANSI_COLORS[4]),h.ansi[5]=u(g.magenta,r.DEFAULT_ANSI_COLORS[5]),h.ansi[6]=u(g.cyan,r.DEFAULT_ANSI_COLORS[6]),h.ansi[7]=u(g.white,r.DEFAULT_ANSI_COLORS[7]),h.ansi[8]=u(g.brightBlack,r.DEFAULT_ANSI_COLORS[8]),h.ansi[9]=u(g.brightRed,r.DEFAULT_ANSI_COLORS[9]),h.ansi[10]=u(g.brightGreen,r.DEFAULT_ANSI_COLORS[10]),h.ansi[11]=u(g.brightYellow,r.DEFAULT_ANSI_COLORS[11]),h.ansi[12]=u(g.brightBlue,r.DEFAULT_ANSI_COLORS[12]),h.ansi[13]=u(g.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),h.ansi[14]=u(g.brightCyan,r.DEFAULT_ANSI_COLORS[14]),h.ansi[15]=u(g.brightWhite,r.DEFAULT_ANSI_COLORS[15]),g.extendedAnsi){const m=Math.min(h.ansi.length-16,g.extendedAnsi.length);for(let y=0;y{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const c=o(8460),f=o(844);class n extends f.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(v){if(this._maxLength===v)return;const p=new Array(v);for(let l=0;lthis._length)for(let p=this._length;p=v;i--)this._array[this._getCyclicIndex(i+l.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;ithis._maxLength){const i=this._length+l.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=l.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,p,l){if(!(p<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+l<0)throw new Error("Cannot shift elements in list beyond index 0");if(l>0){for(let s=p-1;s>=0;s--)this.set(v+s+l,this.get(v+s));const i=v+p+l-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function o(c,f=5){if(typeof c!="object")return c;const n=Array.isArray(c)?[]:{};for(const d in c)n[d]=f<=1?c[d]:c[d]&&o(c[d],f-1);return n}},8055:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;let o=0,c=0,f=0,n=0;var d,v,p,l,i;function s(t){const a=t.toString(16);return a.length<2?"0"+a:a}function e(t,a){return t>>0},t.toColor=function(a,_,u,g){return{css:t.toCss(a,_,u,g),rgba:t.toRgba(a,_,u,g)}}}(d||(r.channels=d={})),function(t){function a(_,u){return n=Math.round(255*u),[o,c,f]=i.toChannels(_.rgba),{css:d.toCss(o,c,f,n),rgba:d.toRgba(o,c,f,n)}}t.blend=function(_,u){if(n=(255&u.rgba)/255,n===1)return{css:u.css,rgba:u.rgba};const g=u.rgba>>24&255,h=u.rgba>>16&255,m=u.rgba>>8&255,y=_.rgba>>24&255,k=_.rgba>>16&255,D=_.rgba>>8&255;return o=y+Math.round((g-y)*n),c=k+Math.round((h-k)*n),f=D+Math.round((m-D)*n),{css:d.toCss(o,c,f),rgba:d.toRgba(o,c,f)}},t.isOpaque=function(_){return(255&_.rgba)==255},t.ensureContrastRatio=function(_,u,g){const h=i.ensureContrastRatio(_.rgba,u.rgba,g);if(h)return d.toColor(h>>24&255,h>>16&255,h>>8&255)},t.opaque=function(_){const u=(255|_.rgba)>>>0;return[o,c,f]=i.toChannels(u),{css:d.toCss(o,c,f),rgba:u}},t.opacity=a,t.multiplyOpacity=function(_,u){return n=255&_.rgba,a(_,n*u/255)},t.toColorRGB=function(_){return[_.rgba>>24&255,_.rgba>>16&255,_.rgba>>8&255]}}(v||(r.color=v={})),function(t){let a,_;try{const u=document.createElement("canvas");u.width=1,u.height=1;const g=u.getContext("2d",{willReadFrequently:!0});g&&(a=g,a.globalCompositeOperation="copy",_=a.createLinearGradient(0,0,1,1))}catch{}t.toColor=function(u){if(u.match(/#[\da-f]{3,8}/i))switch(u.length){case 4:return o=parseInt(u.slice(1,2).repeat(2),16),c=parseInt(u.slice(2,3).repeat(2),16),f=parseInt(u.slice(3,4).repeat(2),16),d.toColor(o,c,f);case 5:return o=parseInt(u.slice(1,2).repeat(2),16),c=parseInt(u.slice(2,3).repeat(2),16),f=parseInt(u.slice(3,4).repeat(2),16),n=parseInt(u.slice(4,5).repeat(2),16),d.toColor(o,c,f,n);case 7:return{css:u,rgba:(parseInt(u.slice(1),16)<<8|255)>>>0};case 9:return{css:u,rgba:parseInt(u.slice(1),16)>>>0}}const g=u.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(g)return o=parseInt(g[1]),c=parseInt(g[2]),f=parseInt(g[3]),n=Math.round(255*(g[5]===void 0?1:parseFloat(g[5]))),d.toColor(o,c,f,n);if(!a||!_)throw new Error("css.toColor: Unsupported css format");if(a.fillStyle=_,a.fillStyle=u,typeof a.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(a.fillRect(0,0,1,1),[o,c,f,n]=a.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:d.toRgba(o,c,f,n),css:u}}}(p||(r.css=p={})),function(t){function a(_,u,g){const h=_/255,m=u/255,y=g/255;return .2126*(h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4))+.7152*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))+.0722*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))}t.relativeLuminance=function(_){return a(_>>16&255,_>>8&255,255&_)},t.relativeLuminance2=a}(l||(r.rgb=l={})),function(t){function a(u,g,h){const m=u>>24&255,y=u>>16&255,k=u>>8&255;let D=g>>24&255,b=g>>16&255,B=g>>8&255,A=e(l.relativeLuminance2(D,b,B),l.relativeLuminance2(m,y,k));for(;A0||b>0||B>0);)D-=Math.max(0,Math.ceil(.1*D)),b-=Math.max(0,Math.ceil(.1*b)),B-=Math.max(0,Math.ceil(.1*B)),A=e(l.relativeLuminance2(D,b,B),l.relativeLuminance2(m,y,k));return(D<<24|b<<16|B<<8|255)>>>0}function _(u,g,h){const m=u>>24&255,y=u>>16&255,k=u>>8&255;let D=g>>24&255,b=g>>16&255,B=g>>8&255,A=e(l.relativeLuminance2(D,b,B),l.relativeLuminance2(m,y,k));for(;A>>0}t.blend=function(u,g){if(n=(255&g)/255,n===1)return g;const h=g>>24&255,m=g>>16&255,y=g>>8&255,k=u>>24&255,D=u>>16&255,b=u>>8&255;return o=k+Math.round((h-k)*n),c=D+Math.round((m-D)*n),f=b+Math.round((y-b)*n),d.toRgba(o,c,f)},t.ensureContrastRatio=function(u,g,h){const m=l.relativeLuminance(u>>8),y=l.relativeLuminance(g>>8);if(e(m,y)>8));if(Be(m,l.relativeLuminance(A>>8))?b:A}return b}const k=_(u,g,h),D=e(m,l.relativeLuminance(k>>8));if(De(m,l.relativeLuminance(b>>8))?k:b}return k}},t.reduceLuminance=a,t.increaseLuminance=_,t.toChannels=function(u){return[u>>24&255,u>>16&255,u>>8&255,255&u]}}(i||(r.rgba=i={})),r.toPaddedHex=s,r.contrastRatio=e},8969:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const c=o(844),f=o(2585),n=o(4348),d=o(7866),v=o(744),p=o(7302),l=o(6975),i=o(8460),s=o(1753),e=o(1480),t=o(7994),a=o(9282),_=o(5435),u=o(5981),g=o(2660);let h=!1;class m extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event(k=>{var D;(D=this._onScrollApi)==null||D.fire(k.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(k){for(const D in k)this.optionsService.options[D]=k[D]}constructor(k){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new p.OptionsService(k)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(d.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(l.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(s.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(e.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(t.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(g.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new _.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(D=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(D=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new u.WriteBuffer((D,b)=>this._inputHandler.parse(D,b))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(k,D){this._writeBuffer.write(k,D)}writeSync(k,D){this._logService.logLevel<=f.LogLevelEnum.WARN&&!h&&(this._logService.warn("writeSync is unreliable and will be removed soon."),h=!0),this._writeBuffer.writeSync(k,D)}input(k,D=!0){this.coreService.triggerDataEvent(k,D)}resize(k,D){isNaN(k)||isNaN(D)||(k=Math.max(k,v.MINIMUM_COLS),D=Math.max(D,v.MINIMUM_ROWS),this._bufferService.resize(k,D))}scroll(k,D=!1){this._bufferService.scroll(k,D)}scrollLines(k,D,b){this._bufferService.scrollLines(k,D,b)}scrollPages(k){this.scrollLines(k*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(k){const D=k-this._bufferService.buffer.ydisp;D!==0&&this.scrollLines(D)}registerEscHandler(k,D){return this._inputHandler.registerEscHandler(k,D)}registerDcsHandler(k,D){return this._inputHandler.registerDcsHandler(k,D)}registerCsiHandler(k,D){return this._inputHandler.registerCsiHandler(k,D)}registerOscHandler(k,D){return this._inputHandler.registerOscHandler(k,D)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let k=!1;const D=this.optionsService.rawOptions.windowsPty;D&&D.buildNumber!==void 0&&D.buildNumber!==void 0?k=D.backend==="conpty"&&D.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(k=!0),k?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const k=[];k.push(this.onLineFeed(a.updateWindowsModeWrappedState.bind(null,this._bufferService))),k.push(this.registerCsiHandler({final:"H"},()=>((0,a.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)(()=>{for(const D of k)D.dispose()})}}}r.CoreTerminal=m},8460:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;cc.fire(f))},r.runAndSubscribe=function(o,c){return c(void 0),o(f=>c(f))}},5435:function(R,r,o){var c=this&&this.__decorate||function(F,S,w,E){var L,P=arguments.length,W=P<3?S:E===null?E=Object.getOwnPropertyDescriptor(S,w):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(F,S,w,E);else for(var $=F.length-1;$>=0;$--)(L=F[$])&&(W=(P<3?L(W):P>3?L(S,w,W):L(S,w))||W);return P>3&&W&&Object.defineProperty(S,w,W),W},f=this&&this.__param||function(F,S){return function(w,E){S(w,E,F)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const n=o(2584),d=o(7116),v=o(2015),p=o(844),l=o(482),i=o(8437),s=o(8460),e=o(643),t=o(511),a=o(3734),_=o(2585),u=o(1480),g=o(6242),h=o(6351),m=o(5941),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},k=131072;function D(F,S){if(F>24)return S.setWinLines||!1;switch(F){case 1:return!!S.restoreWin;case 2:return!!S.minimizeWin;case 3:return!!S.setWinPosition;case 4:return!!S.setWinSizePixels;case 5:return!!S.raiseWin;case 6:return!!S.lowerWin;case 7:return!!S.refreshWin;case 8:return!!S.setWinSizeChars;case 9:return!!S.maximizeWin;case 10:return!!S.fullscreenWin;case 11:return!!S.getWinState;case 13:return!!S.getWinPosition;case 14:return!!S.getWinSizePixels;case 15:return!!S.getScreenSizePixels;case 16:return!!S.getCellSizePixels;case 18:return!!S.getWinSizeChars;case 19:return!!S.getScreenSizeChars;case 20:return!!S.getIconTitle;case 21:return!!S.getWinTitle;case 22:return!!S.pushTitle;case 23:return!!S.popTitle;case 24:return!!S.setWinLines}return!1}var b;(function(F){F[F.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",F[F.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(b||(r.WindowsOptionsReportType=b={}));let B=0;class A extends p.Disposable{getAttrData(){return this._curAttrData}constructor(S,w,E,L,P,W,$,j,x=new v.EscapeSequenceParser){super(),this._bufferService=S,this._charsetService=w,this._coreService=E,this._logService=L,this._optionsService=P,this._oscLinkService=W,this._coreMouseService=$,this._unicodeService=j,this._parser=x,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._workCell=new t.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new s.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new s.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new s.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new s.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new s.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new s.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new s.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new s.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new s.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new s.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new s.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new s.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new H(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(C=>this._activeBuffer=C.activeBuffer)),this._parser.setCsiHandlerFallback((C,I)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(C),params:I.toArray()})}),this._parser.setEscHandlerFallback(C=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(C)})}),this._parser.setExecuteHandlerFallback(C=>{this._logService.debug("Unknown EXECUTE code: ",{code:C})}),this._parser.setOscHandlerFallback((C,I,O)=>{this._logService.debug("Unknown OSC code: ",{identifier:C,action:I,data:O})}),this._parser.setDcsHandlerFallback((C,I,O)=>{I==="HOOK"&&(O=O.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(C),action:I,payload:O})}),this._parser.setPrintHandler((C,I,O)=>this.print(C,I,O)),this._parser.registerCsiHandler({final:"@"},C=>this.insertChars(C)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},C=>this.scrollLeft(C)),this._parser.registerCsiHandler({final:"A"},C=>this.cursorUp(C)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},C=>this.scrollRight(C)),this._parser.registerCsiHandler({final:"B"},C=>this.cursorDown(C)),this._parser.registerCsiHandler({final:"C"},C=>this.cursorForward(C)),this._parser.registerCsiHandler({final:"D"},C=>this.cursorBackward(C)),this._parser.registerCsiHandler({final:"E"},C=>this.cursorNextLine(C)),this._parser.registerCsiHandler({final:"F"},C=>this.cursorPrecedingLine(C)),this._parser.registerCsiHandler({final:"G"},C=>this.cursorCharAbsolute(C)),this._parser.registerCsiHandler({final:"H"},C=>this.cursorPosition(C)),this._parser.registerCsiHandler({final:"I"},C=>this.cursorForwardTab(C)),this._parser.registerCsiHandler({final:"J"},C=>this.eraseInDisplay(C,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},C=>this.eraseInDisplay(C,!0)),this._parser.registerCsiHandler({final:"K"},C=>this.eraseInLine(C,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},C=>this.eraseInLine(C,!0)),this._parser.registerCsiHandler({final:"L"},C=>this.insertLines(C)),this._parser.registerCsiHandler({final:"M"},C=>this.deleteLines(C)),this._parser.registerCsiHandler({final:"P"},C=>this.deleteChars(C)),this._parser.registerCsiHandler({final:"S"},C=>this.scrollUp(C)),this._parser.registerCsiHandler({final:"T"},C=>this.scrollDown(C)),this._parser.registerCsiHandler({final:"X"},C=>this.eraseChars(C)),this._parser.registerCsiHandler({final:"Z"},C=>this.cursorBackwardTab(C)),this._parser.registerCsiHandler({final:"`"},C=>this.charPosAbsolute(C)),this._parser.registerCsiHandler({final:"a"},C=>this.hPositionRelative(C)),this._parser.registerCsiHandler({final:"b"},C=>this.repeatPrecedingCharacter(C)),this._parser.registerCsiHandler({final:"c"},C=>this.sendDeviceAttributesPrimary(C)),this._parser.registerCsiHandler({prefix:">",final:"c"},C=>this.sendDeviceAttributesSecondary(C)),this._parser.registerCsiHandler({final:"d"},C=>this.linePosAbsolute(C)),this._parser.registerCsiHandler({final:"e"},C=>this.vPositionRelative(C)),this._parser.registerCsiHandler({final:"f"},C=>this.hVPosition(C)),this._parser.registerCsiHandler({final:"g"},C=>this.tabClear(C)),this._parser.registerCsiHandler({final:"h"},C=>this.setMode(C)),this._parser.registerCsiHandler({prefix:"?",final:"h"},C=>this.setModePrivate(C)),this._parser.registerCsiHandler({final:"l"},C=>this.resetMode(C)),this._parser.registerCsiHandler({prefix:"?",final:"l"},C=>this.resetModePrivate(C)),this._parser.registerCsiHandler({final:"m"},C=>this.charAttributes(C)),this._parser.registerCsiHandler({final:"n"},C=>this.deviceStatus(C)),this._parser.registerCsiHandler({prefix:"?",final:"n"},C=>this.deviceStatusPrivate(C)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},C=>this.softReset(C)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},C=>this.setCursorStyle(C)),this._parser.registerCsiHandler({final:"r"},C=>this.setScrollRegion(C)),this._parser.registerCsiHandler({final:"s"},C=>this.saveCursor(C)),this._parser.registerCsiHandler({final:"t"},C=>this.windowOptions(C)),this._parser.registerCsiHandler({final:"u"},C=>this.restoreCursor(C)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},C=>this.insertColumns(C)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},C=>this.deleteColumns(C)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},C=>this.selectProtected(C)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},C=>this.requestMode(C,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},C=>this.requestMode(C,!1)),this._parser.setExecuteHandler(n.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(n.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(n.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(n.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(n.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(n.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(n.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(n.C1.IND,()=>this.index()),this._parser.setExecuteHandler(n.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(n.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new g.OscHandler(C=>(this.setTitle(C),this.setIconName(C),!0))),this._parser.registerOscHandler(1,new g.OscHandler(C=>this.setIconName(C))),this._parser.registerOscHandler(2,new g.OscHandler(C=>this.setTitle(C))),this._parser.registerOscHandler(4,new g.OscHandler(C=>this.setOrReportIndexedColor(C))),this._parser.registerOscHandler(8,new g.OscHandler(C=>this.setHyperlink(C))),this._parser.registerOscHandler(10,new g.OscHandler(C=>this.setOrReportFgColor(C))),this._parser.registerOscHandler(11,new g.OscHandler(C=>this.setOrReportBgColor(C))),this._parser.registerOscHandler(12,new g.OscHandler(C=>this.setOrReportCursorColor(C))),this._parser.registerOscHandler(104,new g.OscHandler(C=>this.restoreIndexedColor(C))),this._parser.registerOscHandler(110,new g.OscHandler(C=>this.restoreFgColor(C))),this._parser.registerOscHandler(111,new g.OscHandler(C=>this.restoreBgColor(C))),this._parser.registerOscHandler(112,new g.OscHandler(C=>this.restoreCursorColor(C))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(const C in d.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:C},()=>this.selectCharset("("+C)),this._parser.registerEscHandler({intermediates:")",final:C},()=>this.selectCharset(")"+C)),this._parser.registerEscHandler({intermediates:"*",final:C},()=>this.selectCharset("*"+C)),this._parser.registerEscHandler({intermediates:"+",final:C},()=>this.selectCharset("+"+C)),this._parser.registerEscHandler({intermediates:"-",final:C},()=>this.selectCharset("-"+C)),this._parser.registerEscHandler({intermediates:".",final:C},()=>this.selectCharset("."+C)),this._parser.registerEscHandler({intermediates:"/",final:C},()=>this.selectCharset("/"+C));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(C=>(this._logService.error("Parsing error: ",C),C)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new h.DcsHandler((C,I)=>this.requestStatusString(C,I)))}_preserveStack(S,w,E,L){this._parseStack.paused=!0,this._parseStack.cursorStartX=S,this._parseStack.cursorStartY=w,this._parseStack.decodedLength=E,this._parseStack.position=L}_logSlowResolvingAsync(S){this._logService.logLevel<=_.LogLevelEnum.WARN&&Promise.race([S,new Promise((w,E)=>setTimeout(()=>E("#SLOW_TIMEOUT"),5e3))]).catch(w=>{if(w!=="#SLOW_TIMEOUT")throw w;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(S,w){let E,L=this._activeBuffer.x,P=this._activeBuffer.y,W=0;const $=this._parseStack.paused;if($){if(E=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,w))return this._logSlowResolvingAsync(E),E;L=this._parseStack.cursorStartX,P=this._parseStack.cursorStartY,this._parseStack.paused=!1,S.length>k&&(W=this._parseStack.position+k)}if(this._logService.logLevel<=_.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof S=="string"?` "${S}"`:` "${Array.prototype.map.call(S,C=>String.fromCharCode(C)).join("")}"`),typeof S=="string"?S.split("").map(C=>C.charCodeAt(0)):S),this._parseBuffer.lengthk)for(let C=W;C0&&O.getWidth(this._activeBuffer.x-1)===2&&O.setCellFromCodepoint(this._activeBuffer.x-1,0,1,I);let N=this._parser.precedingJoinState;for(let M=w;Mj){if(x){const Q=O;let z=this._activeBuffer.x-X;for(this._activeBuffer.x=X,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),O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),X>0&&O instanceof i.BufferLine&&O.copyCellsFrom(Q,z,0,X,!1);z=0;)O.setCellFromCodepoint(this._activeBuffer.x++,0,0,I)}else if(C&&(O.insertCells(this._activeBuffer.x,P-X,this._activeBuffer.getNullCell(I)),O.getWidth(j-1)===2&&O.setCellFromCodepoint(j-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,I)),O.setCellFromCodepoint(this._activeBuffer.x++,L,P,I),P>0)for(;--P;)O.setCellFromCodepoint(this._activeBuffer.x++,0,0,I)}this._parser.precedingJoinState=N,this._activeBuffer.x0&&O.getWidth(this._activeBuffer.x)===0&&!O.hasContent(this._activeBuffer.x)&&O.setCellFromCodepoint(this._activeBuffer.x,0,1,I),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(S,w){return S.final!=="t"||S.prefix||S.intermediates?this._parser.registerCsiHandler(S,w):this._parser.registerCsiHandler(S,E=>!D(E.params[0],this._optionsService.rawOptions.windowOptions)||w(E))}registerDcsHandler(S,w){return this._parser.registerDcsHandler(S,new h.DcsHandler(w))}registerEscHandler(S,w){return this._parser.registerEscHandler(S,w)}registerOscHandler(S,w){return this._parser.registerOscHandler(S,new g.OscHandler(w))}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 S;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&&((S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&S.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);w.hasWidth(this._activeBuffer.x)&&!w.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const S=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-S),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(S=this._bufferService.cols-1){this._activeBuffer.x=Math.min(S,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(S,w){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=S,this._activeBuffer.y=this._activeBuffer.scrollTop+w):(this._activeBuffer.x=S,this._activeBuffer.y=w),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(S,w){this._restrictCursor(),this._setCursor(this._activeBuffer.x+S,this._activeBuffer.y+w)}cursorUp(S){const w=this._activeBuffer.y-this._activeBuffer.scrollTop;return w>=0?this._moveCursor(0,-Math.min(w,S.params[0]||1)):this._moveCursor(0,-(S.params[0]||1)),!0}cursorDown(S){const w=this._activeBuffer.scrollBottom-this._activeBuffer.y;return w>=0?this._moveCursor(0,Math.min(w,S.params[0]||1)):this._moveCursor(0,S.params[0]||1),!0}cursorForward(S){return this._moveCursor(S.params[0]||1,0),!0}cursorBackward(S){return this._moveCursor(-(S.params[0]||1),0),!0}cursorNextLine(S){return this.cursorDown(S),this._activeBuffer.x=0,!0}cursorPrecedingLine(S){return this.cursorUp(S),this._activeBuffer.x=0,!0}cursorCharAbsolute(S){return this._setCursor((S.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(S){return this._setCursor(S.length>=2?(S.params[1]||1)-1:0,(S.params[0]||1)-1),!0}charPosAbsolute(S){return this._setCursor((S.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(S){return this._moveCursor(S.params[0]||1,0),!0}linePosAbsolute(S){return this._setCursor(this._activeBuffer.x,(S.params[0]||1)-1),!0}vPositionRelative(S){return this._moveCursor(0,S.params[0]||1),!0}hVPosition(S){return this.cursorPosition(S),!0}tabClear(S){const w=S.params[0];return w===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:w===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let w=S.params[0]||1;for(;w--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(S){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let w=S.params[0]||1;for(;w--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(S){const w=S.params[0];return w===1&&(this._curAttrData.bg|=536870912),w!==2&&w!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(S,w,E,L=!1,P=!1){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);W.replaceCells(w,E,this._activeBuffer.getNullCell(this._eraseAttrData()),P),L&&(W.isWrapped=!1)}_resetBufferLine(S,w=!1){const E=this._activeBuffer.lines.get(this._activeBuffer.ybase+S);E&&(E.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),w),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+S),E.isWrapped=!1)}eraseInDisplay(S,w=!1){let E;switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:for(E=this._activeBuffer.y,this._dirtyRowTracker.markDirty(E),this._eraseInBufferLine(E++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,w);E=this._bufferService.cols&&(this._activeBuffer.lines.get(E+1).isWrapped=!1);E--;)this._resetBufferLine(E,w);this._dirtyRowTracker.markDirty(0);break;case 2:for(E=this._bufferService.rows,this._dirtyRowTracker.markDirty(E-1);E--;)this._resetBufferLine(E,w);this._dirtyRowTracker.markDirty(0);break;case 3:const L=this._activeBuffer.lines.length-this._bufferService.rows;L>0&&(this._activeBuffer.lines.trimStart(L),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-L,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-L,0),this._onScroll.fire(0))}return!0}eraseInLine(S,w=!1){switch(this._restrictCursor(this._bufferService.cols),S.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,w);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,w);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,w)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(S){this._restrictCursor();let w=S.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let x=j;for(let C=1;C0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(S){return S.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(S.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(S){return(this._optionsService.rawOptions.termName+"").indexOf(S)===0}setMode(S){for(let w=0;wG?1:2,N=S.params[0];return M=N,K=w?N===2?4:N===4?O(W.modes.insertMode):N===12?3:N===20?O(I.convertEol):0:N===1?O(E.applicationCursorKeys):N===3?I.windowOptions.setWinLines?j===80?2:j===132?1:0:0:N===6?O(E.origin):N===7?O(E.wraparound):N===8?3:N===9?O(L==="X10"):N===12?O(I.cursorBlink):N===25?O(!W.isCursorHidden):N===45?O(E.reverseWraparound):N===66?O(E.applicationKeypad):N===67?4:N===1e3?O(L==="VT200"):N===1002?O(L==="DRAG"):N===1003?O(L==="ANY"):N===1004?O(E.sendFocus):N===1005?4:N===1006?O(P==="SGR"):N===1015?4:N===1016?O(P==="SGR_PIXELS"):N===1048?1:N===47||N===1047||N===1049?O(x===C):N===2004?O(E.bracketedPasteMode):0,W.triggerDataEvent(`${n.C0.ESC}[${w?"":"?"}${M};${K}$y`),!0;var M,K}_updateAttrColor(S,w,E,L,P){return w===2?(S|=50331648,S&=-16777216,S|=a.AttributeData.fromColorRGB([E,L,P])):w===5&&(S&=-50331904,S|=33554432|255&E),S}_extractColor(S,w,E){const L=[0,0,-1,0,0,0];let P=0,W=0;do{if(L[W+P]=S.params[w+W],S.hasSubParams(w+W)){const $=S.getSubParams(w+W);let j=0;do L[1]===5&&(P=1),L[W+j+1+P]=$[j];while(++j<$.length&&j+W+1+P=2||L[1]===2&&W+P>=5)break;L[1]&&(P=1)}while(++W+w5)&&(S=1),w.extended.underlineStyle=S,w.fg|=268435456,S===0&&(w.fg&=-268435457),w.updateExtended()}_processSGR0(S){S.fg=i.DEFAULT_ATTR_DATA.fg,S.bg=i.DEFAULT_ATTR_DATA.bg,S.extended=S.extended.clone(),S.extended.underlineStyle=0,S.extended.underlineColor&=-67108864,S.updateExtended()}charAttributes(S){if(S.length===1&&S.params[0]===0)return this._processSGR0(this._curAttrData),!0;const w=S.length;let E;const L=this._curAttrData;for(let P=0;P=30&&E<=37?(L.fg&=-50331904,L.fg|=16777216|E-30):E>=40&&E<=47?(L.bg&=-50331904,L.bg|=16777216|E-40):E>=90&&E<=97?(L.fg&=-50331904,L.fg|=16777224|E-90):E>=100&&E<=107?(L.bg&=-50331904,L.bg|=16777224|E-100):E===0?this._processSGR0(L):E===1?L.fg|=134217728:E===3?L.bg|=67108864:E===4?(L.fg|=268435456,this._processUnderline(S.hasSubParams(P)?S.getSubParams(P)[0]:1,L)):E===5?L.fg|=536870912:E===7?L.fg|=67108864:E===8?L.fg|=1073741824:E===9?L.fg|=2147483648:E===2?L.bg|=134217728:E===21?this._processUnderline(2,L):E===22?(L.fg&=-134217729,L.bg&=-134217729):E===23?L.bg&=-67108865:E===24?(L.fg&=-268435457,this._processUnderline(0,L)):E===25?L.fg&=-536870913:E===27?L.fg&=-67108865:E===28?L.fg&=-1073741825:E===29?L.fg&=2147483647:E===39?(L.fg&=-67108864,L.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):E===49?(L.bg&=-67108864,L.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):E===38||E===48||E===58?P+=this._extractColor(S,P,L):E===53?L.bg|=1073741824:E===55?L.bg&=-1073741825:E===59?(L.extended=L.extended.clone(),L.extended.underlineColor=-1,L.updateExtended()):E===100?(L.fg&=-67108864,L.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,L.bg&=-67108864,L.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",E);return!0}deviceStatus(S){switch(S.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const w=this._activeBuffer.y+1,E=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${w};${E}R`)}return!0}deviceStatusPrivate(S){if(S.params[0]===6){const w=this._activeBuffer.y+1,E=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${w};${E}R`)}return!0}softReset(S){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(S){const w=S.params[0]||1;switch(w){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const E=w%2==1;return this._optionsService.options.cursorBlink=E,!0}setScrollRegion(S){const w=S.params[0]||1;let E;return(S.length<2||(E=S.params[1])>this._bufferService.rows||E===0)&&(E=this._bufferService.rows),E>w&&(this._activeBuffer.scrollTop=w-1,this._activeBuffer.scrollBottom=E-1,this._setCursor(0,0)),!0}windowOptions(S){if(!D(S.params[0],this._optionsService.rawOptions.windowOptions))return!0;const w=S.length>1?S.params[1]:0;switch(S.params[0]){case 14:w!==2&&this._onRequestWindowsOptionsReport.fire(b.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(b.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:w!==0&&w!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),w!==0&&w!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:w!==0&&w!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),w!==0&&w!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(S){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(S){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(S){return this._windowTitle=S,this._onTitleChange.fire(S),!0}setIconName(S){return this._iconName=S,!0}setOrReportIndexedColor(S){const w=[],E=S.split(";");for(;E.length>1;){const L=E.shift(),P=E.shift();if(/^\d+$/.exec(L)){const W=parseInt(L);if(U(W))if(P==="?")w.push({type:0,index:W});else{const $=(0,m.parseColor)(P);$&&w.push({type:1,index:W,color:$})}}}return w.length&&this._onColor.fire(w),!0}setHyperlink(S){const w=S.split(";");return!(w.length<2)&&(w[1]?this._createHyperlink(w[0],w[1]):!w[0]&&this._finishHyperlink())}_createHyperlink(S,w){this._getCurrentLinkId()&&this._finishHyperlink();const E=S.split(":");let L;const P=E.findIndex(W=>W.startsWith("id="));return P!==-1&&(L=E[P].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:L,uri:w}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(S,w){const E=S.split(";");for(let L=0;L=this._specialColors.length);++L,++w)if(E[L]==="?")this._onColor.fire([{type:0,index:this._specialColors[w]}]);else{const P=(0,m.parseColor)(E[L]);P&&this._onColor.fire([{type:1,index:this._specialColors[w],color:P}])}return!0}setOrReportFgColor(S){return this._setOrReportSpecialColor(S,0)}setOrReportBgColor(S){return this._setOrReportSpecialColor(S,1)}setOrReportCursorColor(S){return this._setOrReportSpecialColor(S,2)}restoreIndexedColor(S){if(!S)return this._onColor.fire([{type:2}]),!0;const w=[],E=S.split(";");for(let L=0;L=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const S=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,S,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=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(S){return this._charsetService.setgLevel(S),!0}screenAlignmentPattern(){const S=new t.CellData;S.content=4194373,S.fg=this._curAttrData.fg,S.bg=this._curAttrData.bg,this._setCursor(0,0);for(let w=0;w(this._coreService.triggerDataEvent(`${n.C0.ESC}${P}${n.C0.ESC}\\`),!0))(S==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:S==='"p'?'P1$r61;1"p':S==="r"?`P1$r${E.scrollTop+1};${E.scrollBottom+1}r`:S==="m"?"P1$r0m":S===" q"?`P1$r${{block:2,underline:4,bar:6}[L.cursorStyle]-(L.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(S,w){this._dirtyRowTracker.markRangeDirty(S,w)}}r.InputHandler=A;let H=class{constructor(F){this._bufferService=F,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(F){Fthis.end&&(this.end=F)}markRangeDirty(F,S){F>S&&(B=F,F=S,S=B),Fthis.end&&(this.end=S)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function U(F){return 0<=F&&F<256}H=c([f(0,_.IBufferService)],H)},844:(R,r)=>{function o(c){for(const f of c)f.dispose();c.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const f=this._disposables.indexOf(c);f!==-1&&this._disposables.splice(f,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var f;this._isDisposed||c===this._value||((f=this._value)==null||f.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},r.toDisposable=function(c){return{dispose:c}},r.disposeArray=o,r.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},1505:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(f,n,d){this._data[f]||(this._data[f]={}),this._data[f][n]=d}get(f,n){return this._data[f]?this._data[f][n]:void 0}clear(){this._data={}}}r.TwoKeyMap=o,r.FourKeyMap=class{constructor(){this._data=new o}set(c,f,n,d,v){this._data.get(c,f)||this._data.set(c,f,new o),this._data.get(c,f).set(n,d,v)}get(c,f,n,d){var v;return(v=this._data.get(c,f))==null?void 0:v.get(n,d)}clear(){this._data.clear()}}},6114:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof process<"u"&&"title"in process;const o=r.isNode?"node":navigator.userAgent,c=r.isNode?"node":navigator.platform;r.isFirefox=o.includes("Firefox"),r.isLegacyEdge=o.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(o),r.getSafariVersion=function(){if(!r.isSafari)return 0;const f=o.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),r.isIpad=c==="iPad",r.isIphone=c==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),r.isLinux=c.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(o)},6106:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let o=0;r.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(o=this._search(this._getKey(c)),this._array.splice(o,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const f=this._getKey(c);if(f===void 0||(o=this._search(f),o===-1)||this._getKey(this._array[o])!==f)return!1;do if(this._array[o]===c)return this._array.splice(o,1),!0;while(++o=this._array.length)&&this._getKey(this._array[o])===c))do yield this._array[o];while(++o=this._array.length)&&this._getKey(this._array[o])===c))do f(this._array[o]);while(++o=f;){let d=f+n>>1;const v=this._getKey(this._array[d]);if(v>c)n=d-1;else{if(!(v0&&this._getKey(this._array[d-1])===c;)d--;return d}f=d+1}}return f}}},7226:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const c=o(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._is)return i-p<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-p))}ms`),void this._start();i=s}this.clear()}}class n extends f{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const p=Date.now()+v;return{timeRemaining:()=>Math.max(0,p-Date.now())}}}r.PriorityTaskQueue=n,r.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:n,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},9282:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const c=o(643);r.updateWindowsModeWrappedState=function(f){const n=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),d=n?.get(f.cols-1),v=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);v&&d&&(v.isWrapped=d[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&d[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new o;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}r.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,d=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=d}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=c},9092:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const c=o(6349),f=o(7226),n=o(3734),d=o(8437),v=o(4634),p=o(511),l=o(643),i=o(4863),s=o(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(e,t,a){this._hasScrollback=e,this._optionsService=t,this._bufferService=a,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=d.DEFAULT_ATTR_DATA.clone(),this.savedCharset=s.DEFAULT_CHARSET,this.markers=[],this._nullCell=p.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]),this._whitespaceCell=p.CellData.fromCharData([0,l.WHITESPACE_CELL_CHAR,l.WHITESPACE_CELL_WIDTH,l.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(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 n.ExtendedAttrs),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 n.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new d.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const e=this.ybase+this.y-this.ydisp;return e>=0&&er.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=d.DEFAULT_ATTR_DATA);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 c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){const a=this.getNullCell(d.DEFAULT_ATTR_DATA);let _=0;const u=this._getCorrectBufferLength(t);if(u>this.lines.maxLength&&(this.lines.maxLength=u),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+g+1?(this.ybase--,g++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(e,a)));else for(let h=this._rows;h>t;h--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(u0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,0)),this.lines.maxLength=u}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),g&&(this.y+=g),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 g=0;g.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._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){const 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){const a=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(a.length>0){const _=(0,v.reflowLargerCreateNewLayout)(this.lines,a);(0,v.reflowLargerApplyNewLayout)(this.lines,_.layout),this._reflowLargerAdjustViewport(e,t,_.countRemoved)}}_reflowLargerAdjustViewport(e,t,a){const _=this.getNullCell(d.DEFAULT_ATTR_DATA);let u=a;for(;u-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;g--){let h=this.lines.get(g);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;const m=[h];for(;h.isWrapped&&g>0;)h=this.lines.get(--g),m.unshift(h);const y=this.ybase+this.y;if(y>=g&&y0&&(_.push({start:g+m.length+u,newLines:A}),u+=A.length),m.push(...A);let H=D.length-1,U=D[H];U===0&&(H--,U=D[H]);let F=m.length-b-1,S=k;for(;F>=0;){const E=Math.min(S,U);if(m[H]===void 0)break;if(m[H].copyCellsFrom(m[F],S-E,U-E,E,!0),U-=E,U===0&&(H--,U=D[H]),S-=E,S===0){F--;const L=Math.max(F,0);S=(0,v.getWrappedLineTrimmedLength)(m,L,this._cols)}}for(let E=0;E0;)this.ybase===0?this.y0){const g=[],h=[];for(let H=0;H=0;H--)if(D&&D.start>y+b){for(let U=D.newLines.length-1;U>=0;U--)this.lines.set(H--,D.newLines[U]);H++,g.push({index:y+1,amount:D.newLines.length}),b+=D.newLines.length,D=_[++k]}else this.lines.set(H,h[y--]);let B=0;for(let H=g.length-1;H>=0;H--)g[H].index+=B,this.lines.onInsertEmitter.fire(g[H]),B+=g[H].amount;const A=Math.max(0,m+u-this.lines.maxLength);A>0&&this.lines.onTrimEmitter.fire(A)}}translateBufferLineToString(e,t,a=0,_){const u=this.lines.get(e);return u?u.translateToString(t,a,_):""}getWrappedRangeForLine(e){let t=e,a=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;a+10;);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?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=a,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(a=>{t.line>=a.index&&(t.line+=a.amount)})),t.register(this.lines.onDelete(a=>{t.line>=a.index&&t.linea.index&&(t.line-=a.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const c=o(3734),f=o(511),n=o(643),d=o(482);r.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let v=0;class p{constructor(i,s,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);const t=s||f.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let a=0;a>22,2097152&s?this._combined[i].charCodeAt(this._combined[i].length-1):e]}set(i,s){this._data[3*i+1]=s[n.CHAR_DATA_ATTR_INDEX],s[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=s[1],this._data[3*i+0]=2097152|i|s[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=s[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){const s=this._data[3*i+0];return 2097152&s?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&s}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){const s=this._data[3*i+0];return 2097152&s?this._combined[i]:2097151&s?(0,d.stringFromCodePoint)(2097151&s):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,s){return v=3*i,s.content=this._data[v+0],s.fg=this._data[v+1],s.bg=this._data[v+2],2097152&s.content&&(s.combinedData=this._combined[i]),268435456&s.bg&&(s.extended=this._extendedAttrs[i]),s}setCell(i,s){2097152&s.content&&(this._combined[i]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[i]=s.extended),this._data[3*i+0]=s.content,this._data[3*i+1]=s.fg,this._data[3*i+2]=s.bg}setCellFromCodepoint(i,s,e,t){268435456&t.bg&&(this._extendedAttrs[i]=t.extended),this._data[3*i+0]=s|e<<22,this._data[3*i+1]=t.fg,this._data[3*i+2]=t.bg}addCodepointToCell(i,s,e){let t=this._data[3*i+0];2097152&t?this._combined[i]+=(0,d.stringFromCodePoint)(s):2097151&t?(this._combined[i]=(0,d.stringFromCodePoint)(2097151&t)+(0,d.stringFromCodePoint)(s),t&=-2097152,t|=2097152):t=s|4194304,e&&(t&=-12582913,t|=e<<22),this._data[3*i+0]=t}insertCells(i,s,e){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,e),s=0;--a)this.setCell(i+s+a,this.loadCell(i+a,t));for(let a=0;athis.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{const t=new Uint32Array(e);t.set(this._data),this._data=t}for(let t=this.length;t=i&&delete this._combined[u]}const a=Object.keys(this._extendedAttrs);for(let _=0;_=i&&delete this._extendedAttrs[u]}}return this.length=i,4*e*2=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,s,e,t,a){const _=i._data;if(a)for(let g=t-1;g>=0;g--){for(let h=0;h<3;h++)this._data[3*(e+g)+h]=_[3*(s+g)+h];268435456&_[3*(s+g)+2]&&(this._extendedAttrs[e+g]=i._extendedAttrs[s+g])}else for(let g=0;g=s&&(this._combined[h-s+e]=i._combined[h])}}translateToString(i,s,e,t){s=s??0,e=e??this.length,i&&(e=Math.min(e,this.getTrimmedLength())),t&&(t.length=0);let a="";for(;s>22||1}return t&&t.push(s),a}}r.BufferLine=p},4841:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(o,c){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return c*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(R,r)=>{function o(c,f,n){if(f===c.length-1)return c[f].getTrimmedLength();const d=!c[f].hasContent(n-1)&&c[f].getWidth(n-1)===1,v=c[f+1].getWidth(0)===2;return d&&v?n-1:n}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(c,f,n,d,v){const p=[];for(let l=0;l=l&&d0&&(h>t||e[h].getTrimmedLength()===0);h--)g++;g>0&&(p.push(l+e.length-g),p.push(g)),l+=e.length-1}return p},r.reflowLargerCreateNewLayout=function(c,f){const n=[];let d=0,v=f[d],p=0;for(let l=0;lo(c,e,f)).reduce((s,e)=>s+e);let p=0,l=0,i=0;for(;is&&(p-=s,l++);const e=c[l].getWidth(p-1)===2;e&&p--;const t=e?n-1:n;d.push(t),i+=t}return d},r.getWrappedLineTrimmedLength=o},5295:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const c=o(8460),f=o(844),n=o(9092);class d extends f.Disposable{constructor(p,l){super(),this._optionsService=p,this._bufferService=l,this._onBufferActivate=this.register(new c.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(p){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(p),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(p,l){this._normal.resize(p,l),this._alt.resize(p,l),this.setupTabStops(p)}setupTabStops(p){this._normal.setupTabStops(p),this._alt.setupTabStops(p)}}r.BufferSet=d},511:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const c=o(482),f=o(643),n=o(3734);class d extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(p){const l=new d;return l.setFromCharData(p),l}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(p){this.fg=p[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let l=!1;if(p[f.CHAR_DATA_CHAR_INDEX].length>2)l=!0;else if(p[f.CHAR_DATA_CHAR_INDEX].length===2){const i=p[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){const s=p[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|p[f.CHAR_DATA_WIDTH_INDEX]<<22:l=!0}else l=!0}else this.content=p[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[f.CHAR_DATA_WIDTH_INDEX]<<22;l&&(this.combinedData=p[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|p[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=d},643:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const c=o(8460),f=o(844);class n{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}r.Marker=n,n._nextId=1},7116:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},r.CHARSETS.A={"#":"\xA3"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},r.CHARSETS.C=r.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},r.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},r.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},r.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},r.CHARSETS.E=r.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},r.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},r.CHARSETS.H=r.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(R,r)=>{var o,c,f;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,function(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF=` +`,n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL="\x7F"}(o||(r.C0=o={})),function(n){n.PAD="\x80",n.HOP="\x81",n.BPH="\x82",n.NBH="\x83",n.IND="\x84",n.NEL="\x85",n.SSA="\x86",n.ESA="\x87",n.HTS="\x88",n.HTJ="\x89",n.VTS="\x8A",n.PLD="\x8B",n.PLU="\x8C",n.RI="\x8D",n.SS2="\x8E",n.SS3="\x8F",n.DCS="\x90",n.PU1="\x91",n.PU2="\x92",n.STS="\x93",n.CCH="\x94",n.MW="\x95",n.SPA="\x96",n.EPA="\x97",n.SOS="\x98",n.SGCI="\x99",n.SCI="\x9A",n.CSI="\x9B",n.ST="\x9C",n.OSC="\x9D",n.PM="\x9E",n.APC="\x9F"}(c||(r.C1=c={})),function(n){n.ST=`${o.ESC}\\`}(f||(r.C1_ESCAPED=f={}))},7399:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const c=o(2584),f={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:["'",'"']};r.evaluateKeyboardEvent=function(n,d,v,p){const l={type:0,cancel:!1,key:void 0},i=(n.shiftKey?1:0)|(n.altKey?2:0)|(n.ctrlKey?4:0)|(n.metaKey?8:0);switch(n.keyCode){case 0:n.key==="UIKeyInputUpArrow"?l.key=d?c.C0.ESC+"OA":c.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?l.key=d?c.C0.ESC+"OD":c.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?l.key=d?c.C0.ESC+"OC":c.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(l.key=d?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:l.key=n.ctrlKey?"\b":c.C0.DEL,n.altKey&&(l.key=c.C0.ESC+l.key);break;case 9:if(n.shiftKey){l.key=c.C0.ESC+"[Z";break}l.key=c.C0.HT,l.cancel=!0;break;case 13:l.key=n.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,l.cancel=!0;break;case 27:l.key=c.C0.ESC,n.altKey&&(l.key=c.C0.ESC+c.C0.ESC),l.cancel=!0;break;case 37:if(n.metaKey)break;i?(l.key=c.C0.ESC+"[1;"+(i+1)+"D",l.key===c.C0.ESC+"[1;3D"&&(l.key=c.C0.ESC+(v?"b":"[1;5D"))):l.key=d?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(n.metaKey)break;i?(l.key=c.C0.ESC+"[1;"+(i+1)+"C",l.key===c.C0.ESC+"[1;3C"&&(l.key=c.C0.ESC+(v?"f":"[1;5C"))):l.key=d?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(n.metaKey)break;i?(l.key=c.C0.ESC+"[1;"+(i+1)+"A",v||l.key!==c.C0.ESC+"[1;3A"||(l.key=c.C0.ESC+"[1;5A")):l.key=d?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(n.metaKey)break;i?(l.key=c.C0.ESC+"[1;"+(i+1)+"B",v||l.key!==c.C0.ESC+"[1;3B"||(l.key=c.C0.ESC+"[1;5B")):l.key=d?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(l.key=c.C0.ESC+"[2~");break;case 46:l.key=i?c.C0.ESC+"[3;"+(i+1)+"~":c.C0.ESC+"[3~";break;case 36:l.key=i?c.C0.ESC+"[1;"+(i+1)+"H":d?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:l.key=i?c.C0.ESC+"[1;"+(i+1)+"F":d?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:n.shiftKey?l.type=2:n.ctrlKey?l.key=c.C0.ESC+"[5;"+(i+1)+"~":l.key=c.C0.ESC+"[5~";break;case 34:n.shiftKey?l.type=3:n.ctrlKey?l.key=c.C0.ESC+"[6;"+(i+1)+"~":l.key=c.C0.ESC+"[6~";break;case 112:l.key=i?c.C0.ESC+"[1;"+(i+1)+"P":c.C0.ESC+"OP";break;case 113:l.key=i?c.C0.ESC+"[1;"+(i+1)+"Q":c.C0.ESC+"OQ";break;case 114:l.key=i?c.C0.ESC+"[1;"+(i+1)+"R":c.C0.ESC+"OR";break;case 115:l.key=i?c.C0.ESC+"[1;"+(i+1)+"S":c.C0.ESC+"OS";break;case 116:l.key=i?c.C0.ESC+"[15;"+(i+1)+"~":c.C0.ESC+"[15~";break;case 117:l.key=i?c.C0.ESC+"[17;"+(i+1)+"~":c.C0.ESC+"[17~";break;case 118:l.key=i?c.C0.ESC+"[18;"+(i+1)+"~":c.C0.ESC+"[18~";break;case 119:l.key=i?c.C0.ESC+"[19;"+(i+1)+"~":c.C0.ESC+"[19~";break;case 120:l.key=i?c.C0.ESC+"[20;"+(i+1)+"~":c.C0.ESC+"[20~";break;case 121:l.key=i?c.C0.ESC+"[21;"+(i+1)+"~":c.C0.ESC+"[21~";break;case 122:l.key=i?c.C0.ESC+"[23;"+(i+1)+"~":c.C0.ESC+"[23~";break;case 123:l.key=i?c.C0.ESC+"[24;"+(i+1)+"~":c.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(v&&!p||!n.altKey||n.metaKey)!v||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?l.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(l.key=c.C0.US),n.key==="@"&&(l.key=c.C0.NUL)):n.keyCode===65&&(l.type=1);else{const s=f[n.keyCode],e=s?.[n.shiftKey?1:0];if(e)l.key=c.C0.ESC+e;else if(n.keyCode>=65&&n.keyCode<=90){const t=n.ctrlKey?n.keyCode-64:n.keyCode+32;let a=String.fromCharCode(t);n.shiftKey&&(a=a.toUpperCase()),l.key=c.C0.ESC+a}else if(n.keyCode===32)l.key=c.C0.ESC+(n.ctrlKey?c.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let t=n.code.slice(3,4);n.shiftKey||(t=t.toLowerCase()),l.key=c.C0.ESC+t,l.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?l.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?l.key=c.C0.NUL:n.keyCode>=51&&n.keyCode<=55?l.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?l.key=c.C0.DEL:n.keyCode===219?l.key=c.C0.ESC:n.keyCode===220?l.key=c.C0.FS:n.keyCode===221&&(l.key=c.C0.GS)}return l}},482:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},r.utf32ToString=function(o,c=0,f=o.length){let n="";for(let d=c;d65535?(v-=65536,n+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):n+=String.fromCharCode(v)}return n},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){const f=o.length;if(!f)return 0;let n=0,d=0;if(this._interim){const v=o.charCodeAt(d++);56320<=v&&v<=57343?c[n++]=1024*(this._interim-55296)+v-56320+65536:(c[n++]=this._interim,c[n++]=v),this._interim=0}for(let v=d;v=f)return this._interim=p,n;const l=o.charCodeAt(v);56320<=l&&l<=57343?c[n++]=1024*(p-55296)+l-56320+65536:(c[n++]=p,c[n++]=l)}else p!==65279&&(c[n++]=p)}return n}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){const f=o.length;if(!f)return 0;let n,d,v,p,l=0,i=0,s=0;if(this.interim[0]){let a=!1,_=this.interim[0];_&=(224&_)==192?31:(240&_)==224?15:7;let u,g=0;for(;(u=63&this.interim[++g])&&g<4;)_<<=6,_|=u;const h=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=h-g;for(;s=f)return 0;if(u=o[s++],(192&u)!=128){s--,a=!0;break}this.interim[g++]=u,_<<=6,_|=63&u}a||(h===2?_<128?s--:c[l++]=_:h===3?_<2048||_>=55296&&_<=57343||_===65279||(c[l++]=_):_<65536||_>1114111||(c[l++]=_)),this.interim.fill(0)}const e=f-4;let t=s;for(;t=f)return this.interim[0]=n,l;if(d=o[t++],(192&d)!=128){t--;continue}if(i=(31&n)<<6|63&d,i<128){t--;continue}c[l++]=i}else if((240&n)==224){if(t>=f)return this.interim[0]=n,l;if(d=o[t++],(192&d)!=128){t--;continue}if(t>=f)return this.interim[0]=n,this.interim[1]=d,l;if(v=o[t++],(192&v)!=128){t--;continue}if(i=(15&n)<<12|(63&d)<<6|63&v,i<2048||i>=55296&&i<=57343||i===65279)continue;c[l++]=i}else if((248&n)==240){if(t>=f)return this.interim[0]=n,l;if(d=o[t++],(192&d)!=128){t--;continue}if(t>=f)return this.interim[0]=n,this.interim[1]=d,l;if(v=o[t++],(192&v)!=128){t--;continue}if(t>=f)return this.interim[0]=n,this.interim[1]=d,this.interim[2]=v,l;if(p=o[t++],(192&p)!=128){t--;continue}if(i=(7&n)<<18|(63&d)<<12|(63&v)<<6|63&p,i<65536||i>1114111)continue;c[l++]=i}}return l}}},225:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const c=o(1480),f=[[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]],n=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let d;r.UnicodeV6=class{constructor(){if(this.version="6",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160),d.fill(2,4352,4448),d[9001]=2,d[9002]=2,d.fill(2,11904,42192),d[12351]=1,d.fill(2,44032,55204),d.fill(2,63744,64256),d.fill(2,65040,65050),d.fill(2,65072,65136),d.fill(2,65280,65377),d.fill(2,65504,65511);for(let v=0;vl[e][1])return!1;for(;e>=s;)if(i=s+e>>1,p>l[i][1])s=i+1;else{if(!(p=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,p){let l=this.wcwidth(v),i=l===0&&p!==0;if(i){const s=c.UnicodeService.extractWidth(p);s===0?i=!1:s>l&&(l=s)}return c.UnicodeService.createPropertyValue(0,l,i)}}},5981:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const c=o(8460),f=o(844);class n extends f.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,p){if(p!==void 0&&this._syncCalls>p)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let l;for(this._isSyncWriting=!0;l=this._writeBuffer.shift();){this._action(l);const i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,p){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(p),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(p)}_innerWrite(v=0,p=!0){const l=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const i=this._writeBuffer[this._bufferOffset],s=this._action(i,p);if(s){const t=a=>Date.now()-l>=12?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(l,a);return void s.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(t)}const e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-l>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}r.WriteBuffer=n},5941:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const o=/^([\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})$/,c=/^[\da-f]+$/;function f(n,d){const v=n.toString(16),p=v.length<2?"0"+v:v;switch(d){case 4:return v[0];case 8:return p;case 12:return(p+p).slice(0,3);default:return p+p}}r.parseColor=function(n){if(!n)return;let d=n.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);const v=o.exec(d);if(v){const p=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/p*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/p*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/p*255)]}}else if(d.indexOf("#")===0&&(d=d.slice(1),c.exec(d)&&[3,6,9,12].includes(d.length))){const v=d.length/3,p=[0,0,0];for(let l=0;l<3;++l){const i=parseInt(d.slice(v*l,v*l+v),16);p[l]=v===1?i<<4:v===2?i:v===3?i>>4:i>>8}return p}},r.toRgbString=function(n,d=16){const[v,p,l]=n;return`rgb:${f(v,d)}/${f(p,d)}/${f(l,d)}`}},5770:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const c=o(482),f=o(8742),n=o(5770),d=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=d,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}registerHandler(p,l){this._handlers[p]===void 0&&(this._handlers[p]=[]);const i=this._handlers[p];return i.push(l),{dispose:()=>{const s=i.indexOf(l);s!==-1&&i.splice(s,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}reset(){if(this._active.length)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].unhook(!1);this._stack.paused=!1,this._active=d,this._ident=0}hook(p,l){if(this.reset(),this._ident=p,this._active=this._handlers[p]||d,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(l);else this._handlerFb(this._ident,"HOOK",l)}put(p,l,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(p,l,i);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(p,l,i))}unhook(p,l=!0){if(this._active.length){let i=!1,s=this._active.length-1,e=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=l,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;s>=0&&(i=this._active[s].unhook(p),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",p);this._active=d,this._ident=0}};const v=new f.Params;v.addParam(0),r.DcsHandler=class{constructor(p){this._handler=p,this._data="",this._params=v,this._hitLimit=!1}hook(p){this._params=p.length>1||p.params[0]?p.clone():v,this._data="",this._hitLimit=!1}put(p,l,i){this._hitLimit||(this._data+=(0,c.utf32ToString)(p,l,i),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(p){let l=!1;if(this._hitLimit)l=!1;else if(p&&(l=this._handler(this._data,this._params),l instanceof Promise))return l.then(i=>(this._params=v,this._data="",this._hitLimit=!1,i));return this._params=v,this._data="",this._hitLimit=!1,l}}},2015:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const c=o(844),f=o(8742),n=o(6242),d=o(6351);class v{constructor(s){this.table=new Uint8Array(s)}setDefault(s,e){this.table.fill(s<<4|e)}add(s,e,t,a){this.table[e<<8|s]=t<<4|a}addMany(s,e,t,a){for(let _=0;_h),e=(g,h)=>s.slice(g,h),t=e(32,127),a=e(0,24);a.push(25),a.push.apply(a,e(28,32));const _=e(0,14);let u;for(u in i.setDefault(1,0),i.addMany(t,0,2,0),_)i.addMany([24,26,153,154],u,3,0),i.addMany(e(128,144),u,3,0),i.addMany(e(144,152),u,3,0),i.add(156,u,0,0),i.add(27,u,11,1),i.add(157,u,4,8),i.addMany([152,158,159],u,0,7),i.add(155,u,11,3),i.add(144,u,11,9);return i.addMany(a,0,3,0),i.addMany(a,1,3,1),i.add(127,1,0,1),i.addMany(a,8,0,8),i.addMany(a,3,3,3),i.add(127,3,0,3),i.addMany(a,4,3,4),i.add(127,4,0,4),i.addMany(a,6,3,6),i.addMany(a,5,3,5),i.add(127,5,0,5),i.addMany(a,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(t,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(e(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(t,7,0,7),i.addMany(a,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(e(64,127),3,7,0),i.addMany(e(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(e(48,60),4,8,4),i.addMany(e(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(e(32,64),6,0,6),i.add(127,6,0,6),i.addMany(e(64,127),6,0,0),i.addMany(e(32,48),3,9,5),i.addMany(e(32,48),5,9,5),i.addMany(e(48,64),5,0,6),i.addMany(e(64,127),5,7,0),i.addMany(e(32,48),4,9,5),i.addMany(e(32,48),1,9,2),i.addMany(e(32,48),2,9,2),i.addMany(e(48,127),2,10,0),i.addMany(e(48,80),1,10,0),i.addMany(e(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(e(96,127),1,10,0),i.add(80,1,11,9),i.addMany(a,9,0,9),i.add(127,9,0,9),i.addMany(e(28,32),9,0,9),i.addMany(e(32,48),9,9,12),i.addMany(e(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(a,11,0,11),i.addMany(e(32,128),11,0,11),i.addMany(e(28,32),11,0,11),i.addMany(a,10,0,10),i.add(127,10,0,10),i.addMany(e(28,32),10,0,10),i.addMany(e(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(e(32,48),10,9,12),i.addMany(a,12,0,12),i.add(127,12,0,12),i.addMany(e(28,32),12,0,12),i.addMany(e(32,48),12,9,12),i.addMany(e(48,64),12,0,11),i.addMany(e(64,127),12,12,13),i.addMany(e(64,127),10,12,13),i.addMany(e(64,127),9,12,13),i.addMany(a,13,13,13),i.addMany(t,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(p,0,2,0),i.add(p,8,5,8),i.add(p,6,0,6),i.add(p,11,0,11),i.add(p,13,13,13),i}();class l extends c.Disposable{constructor(s=r.VT500_TRANSITION_TABLE){super(),this._transitions=s,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,a)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,c.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new n.OscParser),this._dcsParser=this.register(new d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(s,e=[64,126]){let t=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(t=s.prefix.charCodeAt(0),t&&60>t||t>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let _=0;_u||u>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");t<<=8,t|=u}}if(s.final.length!==1)throw new Error("final must be a single byte");const a=s.final.charCodeAt(0);if(e[0]>a||a>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return t<<=8,t|=a,t}identToString(s){const e=[];for(;s;)e.push(String.fromCharCode(255&s)),s>>=8;return e.reverse().join("")}setPrintHandler(s){this._printHandler=s}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(s,e){const t=this._identifier(s,[48,126]);this._escHandlers[t]===void 0&&(this._escHandlers[t]=[]);const a=this._escHandlers[t];return a.push(e),{dispose:()=>{const _=a.indexOf(e);_!==-1&&a.splice(_,1)}}}clearEscHandler(s){this._escHandlers[this._identifier(s,[48,126])]&&delete this._escHandlers[this._identifier(s,[48,126])]}setEscHandlerFallback(s){this._escHandlerFb=s}setExecuteHandler(s,e){this._executeHandlers[s.charCodeAt(0)]=e}clearExecuteHandler(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]}setExecuteHandlerFallback(s){this._executeHandlerFb=s}registerCsiHandler(s,e){const t=this._identifier(s);this._csiHandlers[t]===void 0&&(this._csiHandlers[t]=[]);const a=this._csiHandlers[t];return a.push(e),{dispose:()=>{const _=a.indexOf(e);_!==-1&&a.splice(_,1)}}}clearCsiHandler(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]}setCsiHandlerFallback(s){this._csiHandlerFb=s}registerDcsHandler(s,e){return this._dcsParser.registerHandler(this._identifier(s),e)}clearDcsHandler(s){this._dcsParser.clearHandler(this._identifier(s))}setDcsHandlerFallback(s){this._dcsParser.setHandlerFallback(s)}registerOscHandler(s,e){return this._oscParser.registerHandler(s,e)}clearOscHandler(s){this._oscParser.clearHandler(s)}setOscHandlerFallback(s){this._oscParser.setHandlerFallback(s)}setErrorHandler(s){this._errorHandler=s}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(s,e,t,a,_){this._parseStack.state=s,this._parseStack.handlers=e,this._parseStack.handlerPos=t,this._parseStack.transition=a,this._parseStack.chunkPos=_}parse(s,e,t){let a,_=0,u=0,g=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,g=this._parseStack.chunkPos+1;else{if(t===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const h=this._parseStack.handlers;let m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(t===!1&&m>-1){for(;m>=0&&(a=h[m](this._params),a!==!0);m--)if(a instanceof Promise)return this._parseStack.handlerPos=m,a}this._parseStack.handlers=[];break;case 4:if(t===!1&&m>-1){for(;m>=0&&(a=h[m](),a!==!0);m--)if(a instanceof Promise)return this._parseStack.handlerPos=m,a}this._parseStack.handlers=[];break;case 6:if(_=s[this._parseStack.chunkPos],a=this._dcsParser.unhook(_!==24&&_!==26,t),a)return a;_===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(_=s[this._parseStack.chunkPos],a=this._oscParser.end(_!==24&&_!==26,t),a)return a;_===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,g=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let h=g;h>4){case 2:for(let b=h+1;;++b){if(b>=e||(_=s[b])<32||_>126&&_=e||(_=s[b])<32||_>126&&_=e||(_=s[b])<32||_>126&&_=e||(_=s[b])<32||_>126&&_=0&&(a=m[y](this._params),a!==!0);y--)if(a instanceof Promise)return this._preserveStack(3,m,y,u,h),a;y<0&&this._csiHandlerFb(this._collect<<8|_,this._params),this.precedingJoinState=0;break;case 8:do switch(_){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(_-48)}while(++h47&&_<60);h--;break;case 9:this._collect<<=8,this._collect|=_;break;case 10:const k=this._escHandlers[this._collect<<8|_];let D=k?k.length-1:-1;for(;D>=0&&(a=k[D](),a!==!0);D--)if(a instanceof Promise)return this._preserveStack(4,k,D,u,h),a;D<0&&this._escHandlerFb(this._collect<<8|_),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|_,this._params);break;case 13:for(let b=h+1;;++b)if(b>=e||(_=s[b])===24||_===26||_===27||_>127&&_=e||(_=s[b])<32||_>127&&_{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const c=o(5770),f=o(482),n=[];r.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(d,v){this._handlers[d]===void 0&&(this._handlers[d]=[]);const p=this._handlers[d];return p.push(v),{dispose:()=>{const l=p.indexOf(v);l!==-1&&p.splice(l,1)}}}clearHandler(d){this._handlers[d]&&delete this._handlers[d]}setHandlerFallback(d){this._handlerFb=d}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(this._state===2)for(let d=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;d>=0;--d)this._active[d].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].start();else this._handlerFb(this._id,"START")}_put(d,v,p){if(this._active.length)for(let l=this._active.length-1;l>=0;l--)this._active[l].put(d,v,p);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(d,v,p))}start(){this.reset(),this._state=1}put(d,v,p){if(this._state!==3){if(this._state===1)for(;v0&&this._put(d,v,p)}}end(d,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let p=!1,l=this._active.length-1,i=!1;if(this._stack.paused&&(l=this._stack.loopPosition-1,p=v,i=this._stack.fallThrough,this._stack.paused=!1),!i&&p===!1){for(;l>=0&&(p=this._active[l].end(d),p!==!0);l--)if(p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!1,p;l--}for(;l>=0;l--)if(p=this._active[l].end(!1),p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!0,p}else this._handlerFb(this._id,"END",d);this._active=n,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(d){this._handler=d,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(d,v,p){this._hitLimit||(this._data+=(0,f.utf32ToString)(d,v,p),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(d){let v=!1;if(this._hitLimit)v=!1;else if(d&&(v=this._handler(this._data),v instanceof Promise))return v.then(p=>(this._data="",this._hitLimit=!1,p));return this._data="",this._hitLimit=!1,v}}},8742:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const o=2147483647;class c{static fromArray(n){const d=new c;if(!n.length)return d;for(let v=Array.isArray(n[0])?1:0;v256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(d),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const n=new c(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){const n=[];for(let d=0;d>8,p=255&this._subParamsIdx[d];p-v>0&&n.push(Array.prototype.slice.call(this._subParams,v,p))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>o?o:n}}addSubParam(n){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>o?o:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(255&this._subParamsIdx[n])-(this._subParamsIdx[n]>>8)>0}getSubParams(n){const d=this._subParamsIdx[n]>>8,v=255&this._subParamsIdx[n];return v-d>0?this._subParams.subarray(d,v):null}getSubParamsAll(){const n={};for(let d=0;d>8,p=255&this._subParamsIdx[d];p-v>0&&(n[d]=this._subParams.slice(v,p))}return n}addDigit(n){let d;if(this._rejectDigits||!(d=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,p=v[d-1];v[d-1]=~p?Math.min(10*p+n,o):n}}r.Params=c},5741:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,c){const f={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(f),c.dispose=()=>this._wrappedAddonDispose(f),c.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let c=-1;for(let f=0;f{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const c=o(3785),f=o(511);r.BufferApiView=class{constructor(n,d){this._buffer=n,this.type=d}init(n){return this._buffer=n,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(n){const d=this._buffer.lines.get(n);if(d)return new c.BufferLineApiView(d)}getNullCell(){return new f.CellData}}},3785:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const c=o(511);r.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,n){if(!(f<0||f>=this._line.length))return n?(this._line.loadCell(f,n),n):this._line.loadCell(f,new c.CellData)}translateToString(f,n,d){return this._line.translateToString(f,n,d)}}},8285:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const c=o(8771),f=o(8460),n=o(844);class d extends n.Disposable{constructor(p){super(),this._core=p,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}r.BufferNamespaceApi=d},7975:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,c){return this._core.registerCsiHandler(o,f=>c(f.toArray()))}addCsiHandler(o,c){return this.registerCsiHandler(o,c)}registerDcsHandler(o,c){return this._core.registerDcsHandler(o,(f,n)=>c(f,n.toArray()))}addDcsHandler(o,c){return this.registerDcsHandler(o,c)}registerEscHandler(o,c){return this._core.registerEscHandler(o,c)}addEscHandler(o,c){return this.registerEscHandler(o,c)}registerOscHandler(o,c){return this._core.registerOscHandler(o,c)}addOscHandler(o,c){return this.registerOscHandler(o,c)}}},7090:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(R,r,o){var c=this&&this.__decorate||function(i,s,e,t){var a,_=arguments.length,u=_<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,e):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,e,t);else for(var g=i.length-1;g>=0;g--)(a=i[g])&&(u=(_<3?a(u):_>3?a(s,e,u):a(s,e))||u);return _>3&&u&&Object.defineProperty(s,e,u),u},f=this&&this.__param||function(i,s){return function(e,t){s(e,t,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const n=o(8460),d=o(844),v=o(5295),p=o(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let l=r.BufferService=class extends d.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(i,this))}resize(i,s){this.cols=i,this.rows=s,this.buffers.resize(i,s),this._onResize.fire({cols:i,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,s=!1){const e=this.buffer;let t;t=this._cachedBlankLine,t&&t.length===this.cols&&t.getFg(0)===i.fg&&t.getBg(0)===i.bg||(t=e.getBlankLine(i,s),this._cachedBlankLine=t),t.isWrapped=s;const a=e.ybase+e.scrollTop,_=e.ybase+e.scrollBottom;if(e.scrollTop===0){const u=e.lines.isFull;_===e.lines.length-1?u?e.lines.recycle().copyFrom(t):e.lines.push(t.clone()):e.lines.splice(_+1,0,t.clone()),u?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{const u=_-a+1;e.lines.shiftElements(a+1,u-1,-1),e.lines.set(_,t.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(i,s,e){const t=this.buffer;if(i<0){if(t.ydisp===0)return;this.isUserScrolling=!0}else i+t.ydisp>=t.ybase&&(this.isUserScrolling=!1);const a=t.ydisp;t.ydisp=Math.max(Math.min(t.ydisp+i,t.ybase),0),a!==t.ydisp&&(s||this._onScroll.fire(t.ydisp))}};r.BufferService=l=c([f(0,p.IOptionsService)],l)},7994:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,c){this._charsets[o]=c,this.glevel===o&&(this.charset=c)}}},1753:function(R,r,o){var c=this&&this.__decorate||function(t,a,_,u){var g,h=arguments.length,m=h<3?a:u===null?u=Object.getOwnPropertyDescriptor(a,_):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(t,a,_,u);else for(var y=t.length-1;y>=0;y--)(g=t[y])&&(m=(h<3?g(m):h>3?g(a,_,m):g(a,_))||m);return h>3&&m&&Object.defineProperty(a,_,m),m},f=this&&this.__param||function(t,a){return function(_,u){a(_,u,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const n=o(2585),d=o(8460),v=o(844),p={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button!==4&&t.action===1&&(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>t.action!==32||t.button!==3},ANY:{events:31,restrict:t=>!0}};function l(t,a){let _=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(_|=64,_|=t.action):(_|=3&t.button,4&t.button&&(_|=64),8&t.button&&(_|=128),t.action===32?_|=32:t.action!==0||a||(_|=3)),_}const i=String.fromCharCode,s={DEFAULT:t=>{const a=[l(t,!1)+32,t.col+32,t.row+32];return a[0]>255||a[1]>255||a[2]>255?"":`\x1B[M${i(a[0])}${i(a[1])}${i(a[2])}`},SGR:t=>{const a=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${l(t,!0)};${t.col};${t.row}${a}`},SGR_PIXELS:t=>{const a=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${l(t,!0)};${t.x};${t.y}${a}`}};let e=r.CoreMouseService=class extends v.Disposable{constructor(t,a){super(),this._bufferService=t,this._coreService=a,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new d.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const _ of Object.keys(p))this.addProtocol(_,p[_]);for(const _ of Object.keys(s))this.addEncoding(_,s[_]);this.reset()}addProtocol(t,a){this._protocols[t]=a}addEncoding(t,a){this._encodings[t]=a}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;const a=this._encodings[this._activeEncoding](t);return a&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(a):this._coreService.triggerDataEvent(a,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(1&t),up:!!(2&t),drag:!!(4&t),move:!!(8&t),wheel:!!(16&t)}}_equalEvents(t,a,_){if(_){if(t.x!==a.x||t.y!==a.y)return!1}else if(t.col!==a.col||t.row!==a.row)return!1;return t.button===a.button&&t.action===a.action&&t.ctrl===a.ctrl&&t.alt===a.alt&&t.shift===a.shift}};r.CoreMouseService=e=c([f(0,n.IBufferService),f(1,n.ICoreService)],e)},6975:function(R,r,o){var c=this&&this.__decorate||function(e,t,a,_){var u,g=arguments.length,h=g<3?t:_===null?_=Object.getOwnPropertyDescriptor(t,a):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(e,t,a,_);else for(var m=e.length-1;m>=0;m--)(u=e[m])&&(h=(g<3?u(h):g>3?u(t,a,h):u(t,a))||h);return g>3&&h&&Object.defineProperty(t,a,h),h},f=this&&this.__param||function(e,t){return function(a,_){t(a,_,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const n=o(1439),d=o(8460),v=o(844),p=o(2585),l=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let s=r.CoreService=class extends v.Disposable{constructor(e,t,a){super(),this._bufferService=e,this._logService=t,this._optionsService=a,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new d.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new d.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(l),this.decPrivateModes=(0,n.clone)(i)}reset(){this.modes=(0,n.clone)(l),this.decPrivateModes=(0,n.clone)(i)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;const a=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&a.ybase!==a.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,()=>e.split("").map(_=>_.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};r.CoreService=s=c([f(0,p.IBufferService),f(1,p.ILogService),f(2,p.IOptionsService)],s)},9074:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const c=o(8055),f=o(8460),n=o(844),d=o(6106);let v=0,p=0;class l extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new d.SortedList(e=>e?.marker.line),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)(()=>this.reset()))}registerDecoration(e){if(e.marker.isDisposed)return;const t=new i(e);if(t){const a=t.marker.onDispose(()=>t.dispose());t.onDispose(()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),a.dispose())}),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,a){var _,u,g;let h=0,m=0;for(const y of this._decorations.getKeyIterator(t))h=(_=y.options.x)!=null?_:0,m=h+((u=y.options.width)!=null?u:1),e>=h&&e{var g,h,m;v=(g=u.options.x)!=null?g:0,p=v+((h=u.options.width)!=null?h:1),e>=v&&e{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const c=o(2585),f=o(8343);class n{constructor(...v){this._entries=new Map;for(const[p,l]of v)this.set(p,l)}set(v,p){const l=this._entries.get(v);return this._entries.set(v,p),l}forEach(v){for(const[p,l]of this._entries.entries())v(p,l)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}r.ServiceCollection=n,r.InstantiationService=class{constructor(){this._services=new n,this._services.set(c.IInstantiationService,this)}setService(d,v){this._services.set(d,v)}getService(d){return this._services.get(d)}createInstance(d,...v){const p=(0,f.getServiceDependencies)(d).sort((s,e)=>s.index-e.index),l=[];for(const s of p){const e=this._services.get(s.id);if(!e)throw new Error(`[createInstance] ${d.name} depends on UNKNOWN service ${s.id}.`);l.push(e)}const i=p.length>0?p[0].index:v.length;if(v.length!==i)throw new Error(`[createInstance] First service dependency of ${d.name} at position ${i+1} conflicts with ${v.length} static arguments`);return new d(...v,...l)}}},7866:function(R,r,o){var c=this&&this.__decorate||function(i,s,e,t){var a,_=arguments.length,u=_<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,e):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,e,t);else for(var g=i.length-1;g>=0;g--)(a=i[g])&&(u=(_<3?a(u):_>3?a(s,e,u):a(s,e))||u);return _>3&&u&&Object.defineProperty(s,e,u),u},f=this&&this.__param||function(i,s){return function(e,t){s(e,t,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const n=o(844),d=o(2585),v={trace:d.LogLevelEnum.TRACE,debug:d.LogLevelEnum.DEBUG,info:d.LogLevelEnum.INFO,warn:d.LogLevelEnum.WARN,error:d.LogLevelEnum.ERROR,off:d.LogLevelEnum.OFF};let p,l=r.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=d.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),p=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let s=0;sJSON.stringify(u)).join(", ")})`);const _=t.apply(this,a);return p.trace(`GlyphRenderer#${t.name} return`,_),_}}},7302:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const c=o(8460),f=o(844),n=o(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const d=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends f.Disposable{constructor(l){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;const i=ae({},r.DEFAULT_OPTIONS);for(const s in l)if(s in i)try{const e=l[s];i[s]=this._sanitizeAndValidateOption(s,e)}catch(e){console.error(e)}this.rawOptions=i,this.options=ae({},i),this._setupOptions(),this.register((0,f.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(l,i){return this.onOptionChange(s=>{s===l&&i(this.rawOptions[l])})}onMultipleOptionChange(l,i){return this.onOptionChange(s=>{l.indexOf(s)!==-1&&i()})}_setupOptions(){const l=s=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},i=(s,e)=>{if(!(s in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);e=this._sanitizeAndValidateOption(s,e),this.rawOptions[s]!==e&&(this.rawOptions[s]=e,this._onOptionChange.fire(s))};for(const s in this.rawOptions){const e={get:l.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this.options,s,e)}}_sanitizeAndValidateOption(l,i){switch(l){case"cursorStyle":if(i||(i=r.DEFAULT_OPTIONS[l]),!function(s){return s==="block"||s==="underline"||s==="bar"}(i))throw new Error(`"${i}" is not a valid value for ${l}`);break;case"wordSeparator":i||(i=r.DEFAULT_OPTIONS[l]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=d.includes(i)?i:r.DEFAULT_OPTIONS[l];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${l} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${l} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${l} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${l} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}r.OptionsService=v},2660:function(R,r,o){var c=this&&this.__decorate||function(v,p,l,i){var s,e=arguments.length,t=e<3?p:i===null?i=Object.getOwnPropertyDescriptor(p,l):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(v,p,l,i);else for(var a=v.length-1;a>=0;a--)(s=v[a])&&(t=(e<3?s(t):e>3?s(p,l,t):s(p,l))||t);return e>3&&t&&Object.defineProperty(p,l,t),t},f=this&&this.__param||function(v,p){return function(l,i){p(l,i,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const n=o(2585);let d=r.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const p=this._bufferService.buffer;if(v.id===void 0){const a=p.addMarker(p.ybase+p.y),_={data:v,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(_,a)),this._dataByLinkId.set(_.id,_),_.id}const l=v,i=this._getEntryIdKey(l),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,p.ybase+p.y),s.id;const e=p.addMarker(p.ybase+p.y),t={id:this._nextId++,key:this._getEntryIdKey(l),data:l,lines:[e]};return e.onDispose(()=>this._removeMarkerFromLink(t,e)),this._entriesWithId.set(t.key,t),this._dataByLinkId.set(t.id,t),t.id}addLineToLink(v,p){const l=this._dataByLinkId.get(v);if(l&&l.lines.every(i=>i.line!==p)){const i=this._bufferService.buffer.addMarker(p);l.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(l,i))}}getLinkData(v){var p;return(p=this._dataByLinkId.get(v))==null?void 0:p.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,p){const l=v.lines.indexOf(p);l!==-1&&(v.lines.splice(l,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};r.OscLinkService=d=c([f(0,n.IBufferService)],d)},8343:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const o="di$target",c="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(f){return f[c]||[]},r.createDecorator=function(f){if(r.serviceRegistry.has(f))return r.serviceRegistry.get(f);const n=function(d,v,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(l,i,s){i[o]===i?i[c].push({id:l,index:s}):(i[c]=[{id:l,index:s}],i[o]=i)})(n,d,p)};return n.toString=()=>f,r.serviceRegistry.set(f,n),n}},2585:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const c=o(8343);var f;r.IBufferService=(0,c.createDecorator)("BufferService"),r.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),r.ICoreService=(0,c.createDecorator)("CoreService"),r.ICharsetService=(0,c.createDecorator)("CharsetService"),r.IInstantiationService=(0,c.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(f||(r.LogLevelEnum=f={})),r.ILogService=(0,c.createDecorator)("LogService"),r.IOptionsService=(0,c.createDecorator)("OptionsService"),r.IOscLinkService=(0,c.createDecorator)("OscLinkService"),r.IUnicodeService=(0,c.createDecorator)("UnicodeService"),r.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const c=o(8460),f=o(225);class n{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,p,l=!1){return(16777215&v)<<3|(3&p)<<1|(l?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;const v=new f.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let p=0,l=0;const i=v.length;for(let s=0;s=i)return p+this.wcwidth(e);const _=v.charCodeAt(s);56320<=_&&_<=57343?e=1024*(e-55296)+_-56320+65536:p+=this.wcwidth(_)}const t=this.charProperties(e,l);let a=n.extractWidth(t);n.extractShouldJoin(t)&&(a-=n.extractWidth(l)),p+=a,l=t}return p}charProperties(v,p){return this._activeProvider.charProperties(v,p)}}r.UnicodeService=n}},J={};function q(R){var r=J[R];if(r!==void 0)return r.exports;var o=J[R]={exports:{}};return te[R].call(o.exports,o,o.exports,q),o.exports}var T={};return(()=>{var R=T;Object.defineProperty(R,"__esModule",{value:!0}),R.Terminal=void 0;const r=q(9042),o=q(3236),c=q(844),f=q(5741),n=q(8285),d=q(7975),v=q(7090),p=["cols","rows"];class l extends c.Disposable{constructor(s){super(),this._core=this.register(new o.Terminal(s)),this._addonManager=this.register(new f.AddonManager),this._publicOptions=ae({},this._core.options);const e=a=>this._core.options[a],t=(a,_)=>{this._checkReadonlyOptions(a),this._core.options[a]=_};for(const a in this._core.options){const _={get:e.bind(this,a),set:t.bind(this,a)};Object.defineProperty(this._publicOptions,a,_)}}_checkReadonlyOptions(s){if(p.includes(s))throw new Error(`Option "${s}" 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 d.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const s=this._core.coreService.decPrivateModes;let e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any"}return{applicationCursorKeysMode:s.applicationCursorKeys,applicationKeypadMode:s.applicationKeypad,bracketedPasteMode:s.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:s.origin,reverseWraparoundMode:s.reverseWraparound,sendFocusMode:s.sendFocus,wraparoundMode:s.wraparound}}get options(){return this._publicOptions}set options(s){for(const e in s)this._publicOptions[e]=s[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(s,e=!0){this._core.input(s,e)}resize(s,e){this._verifyIntegers(s,e),this._core.resize(s,e)}open(s){this._core.open(s)}attachCustomKeyEventHandler(s){this._core.attachCustomKeyEventHandler(s)}attachCustomWheelEventHandler(s){this._core.attachCustomWheelEventHandler(s)}registerLinkProvider(s){return this._core.registerLinkProvider(s)}registerCharacterJoiner(s){return this._checkProposedApi(),this._core.registerCharacterJoiner(s)}deregisterCharacterJoiner(s){this._checkProposedApi(),this._core.deregisterCharacterJoiner(s)}registerMarker(s=0){return this._verifyIntegers(s),this._core.registerMarker(s)}registerDecoration(s){var e,t,a;return this._checkProposedApi(),this._verifyPositiveIntegers((e=s.x)!=null?e:0,(t=s.width)!=null?t:0,(a=s.height)!=null?a:0),this._core.registerDecoration(s)}hasSelection(){return this._core.hasSelection()}select(s,e,t){this._verifyIntegers(s,e,t),this._core.select(s,e,t)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(s,e){this._verifyIntegers(s,e),this._core.selectLines(s,e)}dispose(){super.dispose()}scrollLines(s){this._verifyIntegers(s),this._core.scrollLines(s)}scrollPages(s){this._verifyIntegers(s),this._core.scrollPages(s)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(s){this._verifyIntegers(s),this._core.scrollToLine(s)}clear(){this._core.clear()}write(s,e){this._core.write(s,e)}writeln(s,e){this._core.write(s),this._core.write(`\r +`,e)}paste(s){this._core.paste(s)}refresh(s,e){this._verifyIntegers(s,e),this._core.refresh(s,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(s){this._addonManager.loadAddon(this,s)}static get strings(){return r}_verifyIntegers(...s){for(const e of s)if(e===1/0||isNaN(e)||e%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...s){for(const e of s)if(e&&(e===1/0||isNaN(e)||e%1!=0||e<0))throw new Error("This API only accepts positive integers")}}R.Terminal=l})(),T})())}},be={};function re(Y){var Z=be[Y];if(Z!==void 0)return Z.exports;var ee=be[Y]={exports:{}};return ye[Y](ee,ee.exports,re),ee.exports}re.n=Y=>{var Z=Y&&Y.__esModule?()=>Y.default:()=>Y;return re.d(Z,{a:Z}),Z},re.d=(Y,Z)=>{for(var ee in Z)re.o(Z,ee)&&!re.o(Y,ee)&&Object.defineProperty(Y,ee,{enumerable:!0,get:Z[ee]})},re.o=(Y,Z)=>Object.prototype.hasOwnProperty.call(Y,Z),(()=>{"use strict";var Y=re(591),Z=re.n(Y),ee=Object.defineProperty,_e=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,ae=(q,T,R)=>T in q?ee(q,T,{enumerable:!0,configurable:!0,writable:!0,value:R}):q[T]=R,te=(q,T)=>{for(var R in T||(T={}))pe.call(T,R)&&ae(q,R,T[R]);if(_e)for(var R of _e(T))ue.call(T,R)&&ae(q,R,T[R]);return q};class J{constructor(){this._ASSEMBLY_NAME="XtermBlazor",this._terminals=new Map,this._addonList=new Map,this.getRows=T=>this.getTerminalById(T).rows,this.getCols=T=>this.getTerminalById(T).cols,this.getOptions=T=>this.getTerminalById(T).options,this.setOptions=(T,R)=>this.getTerminalById(T).options=R,this.blur=T=>this.getTerminalById(T).blur(),this.focus=T=>this.getTerminalById(T).focus(),this.input=(T,R,r)=>this.getTerminalById(T).input(R,r),this.resize=(T,R,r)=>this.getTerminalById(T).resize(R,r),this.hasSelection=T=>this.getTerminalById(T).hasSelection(),this.getSelection=T=>this.getTerminalById(T).getSelection(),this.getSelectionPosition=T=>this.getTerminalById(T).getSelectionPosition(),this.clearSelection=T=>this.getTerminalById(T).clearSelection(),this.select=(T,R,r,o)=>this.getTerminalById(T).select(R,r,o),this.selectAll=T=>this.getTerminalById(T).selectAll(),this.selectLines=(T,R,r)=>this.getTerminalById(T).selectLines(R,r),this.scrollLines=(T,R)=>this.getTerminalById(T).scrollLines(R),this.scrollPages=(T,R)=>this.getTerminalById(T).scrollPages(R),this.scrollToTop=T=>this.getTerminalById(T).scrollToTop(),this.scrollToBottom=T=>this.getTerminalById(T).scrollToBottom(),this.scrollToLine=(T,R)=>this.getTerminalById(T).scrollToLine(R),this.clear=T=>this.getTerminalById(T).clear(),this.write=(T,R)=>this.getTerminalById(T).write(R),this.writeln=(T,R)=>this.getTerminalById(T).writeln(R),this.paste=(T,R)=>this.getTerminalById(T).paste(R),this.refresh=(T,R,r)=>this.getTerminalById(T).refresh(R,r),this.reset=T=>this.getTerminalById(T).reset()}registerTerminal(T,R,r,o){const c=new Y.Terminal(r);c.onBinary(n=>DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"OnBinary",T,n)),c.onCursorMove(()=>DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"OnCursorMove",T)),c.onData(n=>DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"OnData",T,n)),c.onKey(({key:n,domEvent:d})=>DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"OnKey",T,{Key:n,DomEvent:this.parseKeyboardEvent(d)})),c.onLineFeed(()=>DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"OnLineFeed",T)),c.onScroll(n=>DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"OnScroll",T,n)),c.onSelectionChange(()=>DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"OnSelectionChange",T)),c.onRender(n=>DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"OnRender",T,n)),c.onResize(({cols:n,rows:d})=>DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"OnResize",T,{columns:n,rows:d})),c.onTitleChange(n=>DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"OnTitleChange",T,n)),c.onBell(()=>DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"OnBell",T)),c.attachCustomKeyEventHandler(n=>{try{return DotNet.invokeMethod(this._ASSEMBLY_NAME,"AttachCustomKeyEventHandler",T,this.parseKeyboardEvent(n))}catch{return DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"AttachCustomKeyEventHandler",T,this.parseKeyboardEvent(n)),this.getTerminalObjectById(T).customKeyEventHandler(n)}}),c.attachCustomWheelEventHandler(n=>{try{return DotNet.invokeMethod(this._ASSEMBLY_NAME,"AttachCustomWheelEventHandler",T,n)}catch{return DotNet.invokeMethodAsync(this._ASSEMBLY_NAME,"AttachCustomWheelEventHandler",T,n),this.getTerminalObjectById(T).customWheelEventHandler(n)}});const f=new Map;o.forEach(n=>{const d=Object.assign(Object.create(Object.getPrototypeOf(this._addonList.get(n))),this._addonList.get(n));c.loadAddon(d),f.set(n,d)}),c.open(R),this._terminals.set(T,{terminal:c,addons:f,customKeyEventHandler:n=>!0,customWheelEventHandler:n=>!0})}registerAddon(T,R){this._addonList.set(T,R)}registerAddons(T){Object.keys(T).forEach(R=>this.registerAddon(R,T[R]))}disposeTerminal(T){var R;return(R=this._terminals.get(T))==null||R.terminal.dispose(),this._terminals.delete(T)}invokeAddonFunction(T,R,r){return this.getTerminalObjectById(T).addons.get(R)[r](...arguments[3])}getTerminalObjectById(T){const R=this._terminals.get(T);if(!R)throw new Error(`Terminal with ID "${T}" not found.`);return R}getTerminalById(T){return this.getTerminalObjectById(T).terminal}parseKeyboardEvent(T){return te(te({},Object.entries(Object.getOwnPropertyDescriptors(KeyboardEvent.prototype)).filter(([r,o])=>typeof o.get=="function").reduce((r,[o,c])=>(r[o]=T[o],r),{})),{type:T.type})}}globalThis.XtermBlazor=new J})()})(); diff --git a/MoonlightServers.Frontend/wwwroot/js/addon-fit.js b/MoonlightServers.Frontend/wwwroot/js/addon-fit.js new file mode 100644 index 0000000..0388971 --- /dev/null +++ b/MoonlightServers.Frontend/wwwroot/js/addon-fit.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FitAddon=t():e.FitAddon=t()}(self,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const 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(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const r=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(i.getPropertyValue("height")),s=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),l=o-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),a=s-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-r;return{cols:Math.max(2,Math.floor(a/t.css.cell.width)),rows:Math.max(1,Math.floor(l/t.css.cell.height))}}}})(),e})())); +//# sourceMappingURL=addon-fit.js.map \ No newline at end of file diff --git a/MoonlightServers.Frontend/wwwroot/js/moonlightServers.js b/MoonlightServers.Frontend/wwwroot/js/moonlightServers.js new file mode 100644 index 0000000..edc4412 --- /dev/null +++ b/MoonlightServers.Frontend/wwwroot/js/moonlightServers.js @@ -0,0 +1,11 @@ +window.moonlightServers = { + loadAddons: function () { + if(window.moonlightServers.consoleAddonsLoaded) + return; + + window.moonlightServers.consoleAddonsLoaded = true; + XtermBlazor.registerAddons({"addon-fit": new FitAddon.FitAddon()}); + } +} + +window.moonlightServers.consoleAddonsLoaded = false; \ No newline at end of file diff --git a/MoonlightServers.Shared/Http/Responses/Users/Servers/ServerLogsResponse.cs b/MoonlightServers.Shared/Http/Responses/Users/Servers/ServerLogsResponse.cs new file mode 100644 index 0000000..1d07fc8 --- /dev/null +++ b/MoonlightServers.Shared/Http/Responses/Users/Servers/ServerLogsResponse.cs @@ -0,0 +1,6 @@ +namespace MoonlightServers.Shared.Http.Responses.Users.Servers; + +public class ServerLogsResponse +{ + public string[] Messages { get; set; } +} \ No newline at end of file