From ce24e6ca282face6e2488bbfe05b203df5736c69 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Fri, 3 Feb 2023 12:54:30 -0700 Subject: [PATCH 01/18] Add QuickGrid source --- AspNetCore.sln | 41 ++ src/Components/Components.slnf | 4 +- ...eworkAdapterServiceCollectionExtensions.cs | 22 + .../EntityFrameworkAsyncQueryExecutor.cs | 21 + ...ts.QuickGrid.EntityFrameworkAdapter.csproj | 15 + .../Columns/Align.cs | 25 + .../Columns/ColumnBase.razor | 141 ++++++ .../Columns/ColumnBase.razor.cs | 12 + .../Columns/ColumnBase.razor.css | 30 ++ .../Columns/GridSort.cs | 184 ++++++++ .../Columns/ISortBuilderColumn.cs | 21 + .../Columns/PropertyColumn.cs | 75 +++ .../Columns/TemplateColumn.cs | 35 ++ .../GridItemsProvider.cs | 13 + .../GridItemsProviderRequest.cs | 87 ++++ .../GridItemsProviderResult.cs | 53 +++ .../AsyncQueryExecutorSupplier.cs | 55 +++ .../ColumnsCollectedNotifier.cs | 57 +++ .../Infrastructure/Defer.cs | 28 ++ .../EventCallbackSubscribable.cs | 34 ++ .../Infrastructure/EventCallbackSubscriber.cs | 44 ++ .../Infrastructure/EventHandlers.cs | 12 + .../Infrastructure/IAsyncQueryExecutor.cs | 36 ++ .../Infrastructure/InternalGridContext.cs | 17 + ...oft.AspNetCore.Components.QuickGrid.csproj | 19 + .../Pagination/PaginationState.cs | 81 ++++ .../Pagination/Paginator.razor | 27 ++ .../Pagination/Paginator.razor.cs | 52 +++ .../Pagination/Paginator.razor.css | 49 ++ .../QuickGrid.razor | 96 ++++ .../QuickGrid.razor.cs | 432 ++++++++++++++++++ .../QuickGrid.razor.css | 97 ++++ .../QuickGrid.razor.js | 97 ++++ .../SortDirection.cs | 27 ++ .../Themes/Default.css | 81 ++++ .../_Imports.razor | 5 + 36 files changed, 2124 insertions(+), 1 deletion(-) create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAdapterServiceCollectionExtensions.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAsyncQueryExecutor.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/Align.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.css create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ISortBuilderColumn.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/PropertyColumn.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/TemplateColumn.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProvider.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderRequest.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderResult.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/ColumnsCollectedNotifier.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/Defer.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscribable.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscriber.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventHandlers.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/IAsyncQueryExecutor.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/InternalGridContext.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/PaginationState.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.css create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.css create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.js create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/SortDirection.cs create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Themes/Default.css create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/_Imports.razor diff --git a/AspNetCore.sln b/AspNetCore.sln index 8320ce409030..6e03f5f9a3c1 100644 --- a/AspNetCore.sln +++ b/AspNetCore.sln @@ -1764,6 +1764,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Http.Generators", "src\Http\Http.Extensions\gen\Microsoft.AspNetCore.Http.Generators.csproj", "{4730F56D-24EF-4BB2-AA75-862E31205F3A}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Components.QuickGrid", "src\Components\QuickGrid\src\Microsoft.AspNetCore.Components.QuickGrid\Microsoft.AspNetCore.Components.QuickGrid.csproj", "{836B1CF7-58CC-4E6D-9B17-732D1AED62B9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter", "src\Components\QuickGrid\src\Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter\Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj", "{865B0D7F-48D1-4801-9343-A76308BE778C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QuickGrid", "QuickGrid", "{C406D9E0-1585-43F9-AA8F-D468AF84A996}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -10589,6 +10595,38 @@ Global {4730F56D-24EF-4BB2-AA75-862E31205F3A}.Release|x64.Build.0 = Release|Any CPU {4730F56D-24EF-4BB2-AA75-862E31205F3A}.Release|x86.ActiveCfg = Release|Any CPU {4730F56D-24EF-4BB2-AA75-862E31205F3A}.Release|x86.Build.0 = Release|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|arm64.ActiveCfg = Debug|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|arm64.Build.0 = Debug|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|x64.ActiveCfg = Debug|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|x64.Build.0 = Debug|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|x86.ActiveCfg = Debug|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|x86.Build.0 = Debug|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|Any CPU.Build.0 = Release|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|arm64.ActiveCfg = Release|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|arm64.Build.0 = Release|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|x64.ActiveCfg = Release|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|x64.Build.0 = Release|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|x86.ActiveCfg = Release|Any CPU + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|x86.Build.0 = Release|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|arm64.ActiveCfg = Debug|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|arm64.Build.0 = Debug|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|x64.ActiveCfg = Debug|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|x64.Build.0 = Debug|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|x86.ActiveCfg = Debug|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|x86.Build.0 = Debug|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|Any CPU.Build.0 = Release|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|arm64.ActiveCfg = Release|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|arm64.Build.0 = Release|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|x64.ActiveCfg = Release|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|x64.Build.0 = Release|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|x86.ActiveCfg = Release|Any CPU + {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -11460,6 +11498,9 @@ Global {10173568-A65E-44E5-8C6F-4AA49D0577A1} = {F057512B-55BF-4A8B-A027-A0505F8BA10C} {97C7D2A4-87E5-4A4A-A170-D736427D5C21} = {F057512B-55BF-4A8B-A027-A0505F8BA10C} {4730F56D-24EF-4BB2-AA75-862E31205F3A} = {225AEDCF-7162-4A86-AC74-06B84660B379} + {836B1CF7-58CC-4E6D-9B17-732D1AED62B9} = {C406D9E0-1585-43F9-AA8F-D468AF84A996} + {865B0D7F-48D1-4801-9343-A76308BE778C} = {C406D9E0-1585-43F9-AA8F-D468AF84A996} + {C406D9E0-1585-43F9-AA8F-D468AF84A996} = {60D51C98-2CC0-40DF-B338-44154EFEE2FF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3E8720B3-DBDD-498C-B383-2CC32A054E8F} diff --git a/src/Components/Components.slnf b/src/Components/Components.slnf index 46581966f1ab..e4402edb0c16 100644 --- a/src/Components/Components.slnf +++ b/src/Components/Components.slnf @@ -14,6 +14,8 @@ "src\\Components\\CustomElements\\src\\Microsoft.AspNetCore.Components.CustomElements.csproj", "src\\Components\\Forms\\src\\Microsoft.AspNetCore.Components.Forms.csproj", "src\\Components\\Forms\\test\\Microsoft.AspNetCore.Components.Forms.Tests.csproj", + "src\\Components\\QuickGrid\\src\\Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter\\Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj", + "src\\Components\\QuickGrid\\src\\Microsoft.AspNetCore.Components.QuickGrid\\Microsoft.AspNetCore.Components.QuickGrid.csproj", "src\\Components\\Samples\\BlazorServerApp\\BlazorServerApp.csproj", "src\\Components\\Server\\src\\Microsoft.AspNetCore.Components.Server.csproj", "src\\Components\\Server\\test\\Microsoft.AspNetCore.Components.Server.Tests.csproj", @@ -142,4 +144,4 @@ "src\\WebEncoders\\src\\Microsoft.Extensions.WebEncoders.csproj" ] } -} +} \ No newline at end of file diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAdapterServiceCollectionExtensions.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAdapterServiceCollectionExtensions.cs new file mode 100644 index 000000000000..a89dd48dc726 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAdapterServiceCollectionExtensions.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter; +using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; + +namespace Microsoft.Extensions.DependencyInjection; + +/// +/// Provides extension methods to configure on a . +/// +public static class EntityFrameworkAdapterServiceCollectionExtensions +{ + /// + /// Registers an Entity Framework aware implementation of . + /// + /// The . + public static void AddQuickGridEntityFrameworkAdapter(this IServiceCollection services) + { + services.AddSingleton(); + } +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAsyncQueryExecutor.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAsyncQueryExecutor.cs new file mode 100644 index 000000000000..6bc9ca68006e --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAsyncQueryExecutor.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq; +using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query; + +namespace Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter; + +internal class EntityFrameworkAsyncQueryExecutor : IAsyncQueryExecutor +{ + public bool IsSupported(IQueryable queryable) + => queryable.Provider is IAsyncQueryProvider; + + public Task CountAsync(IQueryable queryable) + => queryable.CountAsync(); + + public Task ToArrayAsync(IQueryable queryable) + => queryable.ToArrayAsync(); +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj new file mode 100644 index 000000000000..60b5fae5a8b6 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj @@ -0,0 +1,15 @@ + + + + $(DefaultNetCoreTargetFramework) + + + + + + + + + + + diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/Align.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/Align.cs new file mode 100644 index 000000000000..fa1d1974f9f5 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/Align.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// Describes alignment for a column. +/// +public enum Align +{ + /// + /// Justifies the content against the start of the container. + /// + Left, + + /// + /// Justifies the content at the center of the container. + /// + Center, + + /// + /// Justifies the content at the end of the container. + /// + Right, +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor new file mode 100644 index 000000000000..42567a30fc34 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor @@ -0,0 +1,141 @@ +@using Microsoft.AspNetCore.Components.Rendering +@namespace Microsoft.AspNetCore.Components.QuickGrid +@typeparam TGridItem +@{ + InternalGridContext.Grid.AddColumn(this, IsDefaultSort); +} +@code +{ + [CascadingParameter] internal InternalGridContext InternalGridContext { get; set; } = default!; + + /// + /// Title text for the column. This is rendered automatically if is not used. + /// + [Parameter] public string? Title { get; set; } + + /// + /// An optional CSS class name. If specified, this is included in the class attribute of table header and body cells + /// for this column. + /// + [Parameter] public string? Class { get; set; } + + /// + /// If specified, controls the justification of table header and body cells for this column. + /// + [Parameter] public Align Align { get; set; } + + /// + /// An optional template for this column's header cell. If not specified, the default header template + /// includes the along with any applicable sort indicators and options buttons. + /// + [Parameter] public RenderFragment>? HeaderTemplate { get; set; } + + /// + /// If specified, indicates that this column has this associated options UI. A button to display this + /// UI will be included in the header cell by default. + /// + /// If is used, it is left up to that template to render any relevant + /// "show options" UI and invoke the grid's ). + /// + [Parameter] public RenderFragment? ColumnOptions { get; set; } + + /// + /// Indicates whether the data should be sortable by this column. + /// + /// The default value may vary according to the column type (for example, a + /// is sortable by default if any parameter is specified). + /// + [Parameter] public bool? Sortable { get; set; } + + /// + /// If specified and not null, indicates that this column represents the initial sort order + /// for the grid. The supplied value controls the default sort direction. + /// + [Parameter] public SortDirection? IsDefaultSort { get; set; } + + /// + /// If specified, virtualized grids will use this template to render cells whose data has not yet been loaded. + /// + [Parameter] public RenderFragment? PlaceholderTemplate { get; set; } + + /// + /// Gets a reference to the enclosing . + /// + public QuickGrid Grid => InternalGridContext.Grid; + + /// + /// Overridden by derived components to provide rendering logic for the column's cells. + /// + /// The current . + /// The data for the row being rendered. + protected internal abstract void CellContent(RenderTreeBuilder builder, TGridItem item); + + /// + /// Gets or sets a that will be rendered for this column's header cell. + /// This allows derived components to change the header output. However, derived components are then + /// responsible for using within that new output if they want to continue + /// respecting that option. + /// + protected internal RenderFragment HeaderContent { get; protected set; } + + /// + /// Get a value indicating whether this column should act as sortable if no value was set for the + /// parameter. The default behavior is not to be + /// sortable unless is true. + /// + /// Derived components may override this to implement alternative default sortability rules. + /// + /// True if the column should be sortable by default, otherwise false. + protected virtual bool IsSortableByDefault() => false; + + /// + /// Constructs an instance of . + /// + public ColumnBase() + { + HeaderContent = RenderDefaultHeaderContent; + } + + private void RenderDefaultHeaderContent(RenderTreeBuilder __builder) + { + @if (HeaderTemplate is not null) + { + @HeaderTemplate(this) + } + else + { + @if (ColumnOptions is not null && Align != Align.Right) + { + + } + + if (Sortable.HasValue ? Sortable.Value : IsSortableByDefault()) + { + + } + else + { +
+
@Title
+
+ } + + @if (ColumnOptions is not null && Align == Align.Right) + { + + } + } + } + + internal void RenderPlaceholderContent(RenderTreeBuilder __builder, PlaceholderContext placeholderContext) + { + // Blank if no placeholder template was supplied, as it's enough to style with CSS by default + if (PlaceholderTemplate is not null) + { + @PlaceholderTemplate(placeholderContext) + } + } +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.cs new file mode 100644 index 000000000000..382ea01d576f --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// An abstract base class for columns in a . +/// +/// The type of data represented by each row in the grid. +public abstract partial class ColumnBase +{ +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.css b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.css new file mode 100644 index 000000000000..11477eb380d6 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.css @@ -0,0 +1,30 @@ +/* Contains the title text and sort indicator, and expands to fill as much of the col width as it can */ +.col-title { + display: flex; /* So that we can make col-title-text expand as much as possible, and still hide overflow with ellipsis */ + min-width: 0px; + flex-grow: 1; + padding: 0; +} + +/* If the column is sortable, its title is rendered as a button element for accessibility and to support navigation by tab */ +button.col-title { + border: none; + background: none; + position: relative; + cursor: pointer; +} + +.col-justify-center .col-title { + justify-content: center; +} + +.col-justify-end .col-title { + flex-direction: row-reverse; /* For end-justified cols, the sort indicator should appear before the title text */ +} + +/* We put the column title text in its own element primarily so that it can use text-overflow: ellipsis */ +.col-title-text { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs new file mode 100644 index 000000000000..218df9b6a7ed --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs @@ -0,0 +1,184 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq; +using System.Linq.Expressions; + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// Represents a sort order specification used within . +/// +/// The type of data represented by each row in the grid. +public class GridSort +{ + private const string ExpressionNotRepresentableMessage = "The supplied expression can't be represented as a property name for sorting. Only simple member expressions, such as @(x => x.SomeProperty), can be converted to property names."; + + private Func, bool, IOrderedQueryable> _first; + private List, bool, IOrderedQueryable>>? _then; + + private (LambdaExpression, bool) _firstExpression; + private List<(LambdaExpression, bool)>? _thenExpressions; + + private IReadOnlyCollection<(string PropertyName, SortDirection Direction)>? _cachedPropertyListAscending; + private IReadOnlyCollection<(string PropertyName, SortDirection Direction)>? _cachedPropertyListDescending; + + internal GridSort(Func, bool, IOrderedQueryable> first, (LambdaExpression, bool) firstExpression) + { + _first = first; + _firstExpression = firstExpression; + _then = default; + _thenExpressions = default; + } + + /// + /// Produces a instance that sorts according to the specified , ascending. + /// + /// The type of the expression's value. + /// An expression defining how a set of instances are to be sorted. + /// A instance representing the specified sorting rule. + public static GridSort ByAscending(Expression> expression) + => new GridSort((queryable, asc) => asc ? queryable.OrderBy(expression) : queryable.OrderByDescending(expression), + (expression, true)); + + /// + /// Produces a instance that sorts according to the specified , descending. + /// + /// The type of the expression's value. + /// An expression defining how a set of instances are to be sorted. + /// A instance representing the specified sorting rule. + public static GridSort ByDescending(Expression> expression) + => new GridSort((queryable, asc) => asc ? queryable.OrderByDescending(expression) : queryable.OrderBy(expression), + (expression, false)); + + /// + /// Updates a instance by appending a further sorting rule. + /// + /// The type of the expression's value. + /// An expression defining how a set of instances are to be sorted. + /// A instance representing the specified sorting rule. + public GridSort ThenAscending(Expression> expression) + { + _then ??= new(); + _thenExpressions ??= new(); + _then.Add((queryable, asc) => asc ? queryable.ThenBy(expression) : queryable.ThenByDescending(expression)); + _thenExpressions.Add((expression, true)); + _cachedPropertyListAscending = null; + _cachedPropertyListDescending = null; + return this; + } + + /// + /// Updates a instance by appending a further sorting rule. + /// + /// The type of the expression's value. + /// An expression defining how a set of instances are to be sorted. + /// A instance representing the specified sorting rule. + public GridSort ThenDescending(Expression> expression) + { + _then ??= new(); + _thenExpressions ??= new(); + _then.Add((queryable, asc) => asc ? queryable.ThenByDescending(expression) : queryable.ThenBy(expression)); + _thenExpressions.Add((expression, false)); + _cachedPropertyListAscending = null; + _cachedPropertyListDescending = null; + return this; + } + + internal IOrderedQueryable Apply(IQueryable queryable, bool ascending) + { + var orderedQueryable = _first(queryable, ascending); + + if (_then is not null) + { + foreach (var clause in _then) + { + orderedQueryable = clause(orderedQueryable, ascending); + } + } + + return orderedQueryable; + } + + internal IReadOnlyCollection<(string PropertyName, SortDirection Direction)> ToPropertyList(bool ascending) + { + if (ascending) + { + _cachedPropertyListAscending ??= BuildPropertyList(ascending: true); + return _cachedPropertyListAscending; + } + else + { + _cachedPropertyListDescending ??= BuildPropertyList(ascending: false); + return _cachedPropertyListDescending; + } + } + + private IReadOnlyCollection<(string PropertyName, SortDirection Direction)> BuildPropertyList(bool ascending) + { + var result = new List<(string, SortDirection)>(); + result.Add((ToPropertyName(_firstExpression.Item1), (_firstExpression.Item2 ^ ascending) ? SortDirection.Descending : SortDirection.Ascending)); + + if (_thenExpressions is not null) + { + foreach (var (thenLambda, thenAscending) in _thenExpressions) + { + result.Add((ToPropertyName(thenLambda), (thenAscending ^ ascending) ? SortDirection.Descending : SortDirection.Ascending)); + } + } + + return result; + } + + // Not sure we really want this level of complexity, but it converts expressions like @(c => c.Medals.Gold) to "Medals.Gold" + private static string ToPropertyName(LambdaExpression expression) + { + var body = expression.Body as MemberExpression; + if (body is null) + { + throw new ArgumentException(ExpressionNotRepresentableMessage); + } + + // Handles cases like @(x => x.Name) + if (body.Expression is ParameterExpression) + { + return body.Member.Name; + } + + // First work out the length of the string we'll need, so that we can use string.Create + var length = body.Member.Name.Length; + var node = body; + while (node.Expression is not null) + { + if (node.Expression is MemberExpression parentMember) + { + length += parentMember.Member.Name.Length + 1; + node = parentMember; + } + else if (node.Expression is ParameterExpression) + { + break; + } + else + { + throw new ArgumentException(ExpressionNotRepresentableMessage); + } + } + + // Now construct the string + return string.Create(length, body, (chars, body) => + { + var nextPos = chars.Length; + while (body is not null) + { + nextPos -= body.Member.Name.Length; + body.Member.Name.CopyTo(chars.Slice(nextPos)); + if (nextPos > 0) + { + chars[--nextPos] = '.'; + } + body = (body.Expression as MemberExpression)!; + } + }); + } +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ISortBuilderColumn.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ISortBuilderColumn.cs new file mode 100644 index 000000000000..c43216502dc6 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ISortBuilderColumn.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// An interface that, if implemented by a subclass, allows a +/// to understand the sorting rules associated with that column. +/// +/// If a subclass does not implement this, that column can still be marked as sortable and can +/// be the current sort column, but its sorting logic cannot be applied to the data queries automatically. The developer would be +/// responsible for implementing that sorting logic separately inside their . +/// +/// The type of data represented by each row in the grid. +public interface ISortBuilderColumn +{ + /// + /// Gets the sorting rules associated with the column. + /// + public GridSort? SortBuilder { get; } +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/PropertyColumn.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/PropertyColumn.cs new file mode 100644 index 000000000000..fbde7c8146ef --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/PropertyColumn.cs @@ -0,0 +1,75 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq.Expressions; +using Microsoft.AspNetCore.Components.Rendering; + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// Represents a column whose cells display a single value. +/// +/// The type of data represented by each row in the grid. +/// The type of the value being displayed in the column's cells. +public class PropertyColumn : ColumnBase, ISortBuilderColumn +{ + private Expression>? _lastAssignedProperty; + private Func? _cellTextFunc; + private GridSort? _sortBuilder; + + /// + /// Defines the value to be displayed in this column's cells. + /// + [Parameter, EditorRequired] public Expression> Property { get; set; } = default!; + + /// + /// Optionally specifies a format string for the value. + /// + /// Using this requires the type to implement . + /// + [Parameter] public string? Format { get; set; } + + GridSort? ISortBuilderColumn.SortBuilder => _sortBuilder; + + /// + protected override void OnParametersSet() + { + // We have to do a bit of pre-processing on the lambda expression. Only do that if it's new or changed. + if (_lastAssignedProperty != Property) + { + _lastAssignedProperty = Property; + var compiledPropertyExpression = Property.Compile(); + + if (!string.IsNullOrEmpty(Format)) + { + // TODO: Consider using reflection to avoid having to box every value just to call IFormattable.ToString + // For example, define a method "string Format(Func property) where U: IFormattable", and + // then construct the closed type here with U=TProp when we know TProp implements IFormattable + + // If the type is nullable, we're interested in formatting the underlying type + var nullableUnderlyingTypeOrNull = Nullable.GetUnderlyingType(typeof(TProp)); + if (!typeof(IFormattable).IsAssignableFrom(nullableUnderlyingTypeOrNull ?? typeof(TProp))) + { + throw new InvalidOperationException($"A '{nameof(Format)}' parameter was supplied, but the type '{typeof(TProp)}' does not implement '{typeof(IFormattable)}'."); + } + + _cellTextFunc = item => ((IFormattable?)compiledPropertyExpression!(item))?.ToString(Format, null); + } + else + { + _cellTextFunc = item => compiledPropertyExpression!(item)?.ToString(); + } + + _sortBuilder = GridSort.ByAscending(Property); + } + + if (Title is null && Property.Body is MemberExpression memberExpression) + { + Title = memberExpression.Member.Name; + } + } + + /// + protected internal override void CellContent(RenderTreeBuilder builder, TGridItem item) + => builder.AddContent(0, _cellTextFunc!(item)); +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/TemplateColumn.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/TemplateColumn.cs new file mode 100644 index 000000000000..80cb357ce6f7 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/TemplateColumn.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.AspNetCore.Components.Rendering; + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// Represents a column whose cells render a supplied template. +/// +/// The type of data represented by each row in the grid. +public class TemplateColumn : ColumnBase, ISortBuilderColumn +{ + private readonly static RenderFragment EmptyChildContent = _ => builder => { }; + + /// + /// Specifies the content to be rendered for each row in the table. + /// + [Parameter] public RenderFragment ChildContent { get; set; } = EmptyChildContent; + + /// + /// Optionally specifies sorting rules for this column. + /// + [Parameter] public GridSort? SortBy { get; set; } + + GridSort? ISortBuilderColumn.SortBuilder => SortBy; + + /// + protected internal override void CellContent(RenderTreeBuilder builder, TGridItem item) + => builder.AddContent(0, ChildContent(item)); + + /// + protected override bool IsSortableByDefault() + => SortBy is not null; +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProvider.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProvider.cs new file mode 100644 index 000000000000..0ae3daf6abd7 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProvider.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// A callback that provides data for a . +/// +/// The type of data represented by each row in the grid. +/// Parameters describing the data being requested. +/// A that gives the data to be displayed. +public delegate ValueTask> GridItemsProvider( + GridItemsProviderRequest request); diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderRequest.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderRequest.cs new file mode 100644 index 000000000000..2d9494a3fc10 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderRequest.cs @@ -0,0 +1,87 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq; + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// Parameters for data to be supplied by a 's . +/// +/// The type of data represented by each row in the grid. +public struct GridItemsProviderRequest +{ + /// + /// The zero-based index of the first item to be supplied. + /// + public int StartIndex { get; } + + /// + /// If set, the maximum number of items to be supplied. If not set, the maximum number is unlimited. + /// + public int? Count { get; } + + /// + /// Specifies which column represents the sort order. + /// + /// Rather than inferring the sort rules manually, you should normally call either + /// or , since they also account for and automatically. + /// + public ColumnBase? SortByColumn { get; } + + /// + /// Specifies the current sort direction. + /// + /// Rather than inferring the sort rules manually, you should normally call either + /// or , since they also account for and automatically. + /// + public bool SortByAscending { get; } + + /// + /// A token that indicates if the request should be cancelled. + /// + public CancellationToken CancellationToken { get; } + + internal GridItemsProviderRequest( + int startIndex, int? count, ColumnBase? sortByColumn, bool sortByAscending, + CancellationToken cancellationToken) + { + StartIndex = startIndex; + Count = count; + SortByColumn = sortByColumn; + SortByAscending = sortByAscending; + CancellationToken = cancellationToken; + } + + /// + /// Applies the request's sorting rules to the supplied . + /// + /// Note that this only works if the current implements , + /// otherwise it will throw. + /// + /// An . + /// A new representing the with sorting rules applied. + public IQueryable ApplySorting(IQueryable source) => SortByColumn switch + { + ISortBuilderColumn sbc => sbc.SortBuilder?.Apply(source, SortByAscending) ?? source, + null => source, + _ => throw new NotSupportedException(ColumnNotSortableMessage(SortByColumn)), + }; + + /// + /// Produces a collection of (property name, direction) pairs representing the sorting rules. + /// + /// Note that this only works if the current implements , + /// otherwise it will throw. + /// + /// A collection of (property name, direction) pairs representing the sorting rules + public IReadOnlyCollection<(string PropertyName, SortDirection Direction)> GetSortByProperties() => SortByColumn switch + { + ISortBuilderColumn sbc => sbc.SortBuilder?.ToPropertyList(SortByAscending) ?? Array.Empty<(string, SortDirection)>(), + null => Array.Empty<(string, SortDirection)>(), + _ => throw new NotSupportedException(ColumnNotSortableMessage(SortByColumn)), + }; + + private static string ColumnNotSortableMessage(ColumnBase col) + => $"The current sort column is of type '{col.GetType().FullName}', which does not implement {nameof(ISortBuilderColumn)}, so its sorting rules cannot be applied automatically."; +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderResult.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderResult.cs new file mode 100644 index 000000000000..9bdbe25d9a76 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderResult.cs @@ -0,0 +1,53 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// Holds data being supplied to a 's . +/// +/// The type of data represented by each row in the grid. +public struct GridItemsProviderResult +{ + /// + /// The items being supplied. + /// + public ICollection Items { get; set; } + + /// + /// The total number of items that may be displayed in the grid. This normally means the total number of items in the + /// underlying data source after applying any filtering that is in effect. + /// + /// If the grid is paginated, this should include all pages. If the grid is virtualized, this should include the entire scroll range. + /// + public int TotalItemCount { get; set; } + + /// + /// Constructs an instance of . + /// + /// The items being supplied. + /// The total numer of items that exist. See for details. + public GridItemsProviderResult(ICollection items, int totalItemCount) + { + Items = items; + TotalItemCount = totalItemCount; + } +} + +/// +/// Provides convenience methods for constructing instances. +/// +public static class GridItemsProviderResult +{ + // This is just to provide generic type inference, so you don't have to specify TGridItem yet again. + + /// + /// Supplies an instance of . + /// + /// The type of data represented by each row in the grid. + /// The items being supplied. + /// The total numer of items that exist. See for details. + /// An instance of . + public static GridItemsProviderResult From(ICollection items, int totalItemCount) + => new GridItemsProviderResult(items, totalItemCount); +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cs new file mode 100644 index 000000000000..9956ac61f3cd --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Concurrent; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; + +namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; + +internal static class AsyncQueryExecutorSupplier +{ + // The primary goal with this is to ensure that: + // - If you're using EF Core, then we resolve queries efficiently using its ToXyzAsync async extensions and don't + // just fall back on the synchronous IQueryable ToXyz calls + // - ... but without QuickGrid referencing Microsoft.EntityFramework directly. That's because it would bring in + // heavy dependencies you may not be using (and relying on trimming isn't enough, as it's still desirable to have + // heavy unused dependencies for Blazor Server). + // + // As a side-effect, we have an abstraction IAsyncQueryExecutor that developers could use to plug in their own + // mechanism for resolving async queries from other data sources than EF. It's not really a major goal to make this + // adapter generally useful beyond EF, but fine if people do have their own uses for it. + + private static readonly ConcurrentDictionary IsEntityFrameworkProviderTypeCache = new(); + + public static IAsyncQueryExecutor? GetAsyncQueryExecutor(IServiceProvider services, IQueryable? queryable) + { + if (queryable is not null) + { + var executor = services.GetService(); + + if (executor is null) + { + // It's useful to detect if the developer is unaware that they should be using the EF adapter, otherwise + // they will likely never notice and simply deploy an inefficient app that blocks threads on each query. + var providerType = queryable.Provider?.GetType(); + if (providerType is not null && IsEntityFrameworkProviderTypeCache.GetOrAdd(providerType, IsEntityFrameworkProviderType)) + { + throw new InvalidOperationException($"The supplied {nameof(IQueryable)} is provided by Entity Framework. To query it efficiently, you must reference the package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter and call AddQuickGridEntityFrameworkAdapter on your service collection."); + } + } + else if (executor.IsSupported(queryable)) + { + return executor; + } + } + + return null; + } + + // We have to do this via reflection because the whole point is to avoid any static dependency on EF unless you + // reference the adapter. Trimming won't cause us any problems because this is only a way of detecting misconfiguration + // so it's sufficient if it can detect the misconfiguration in development. + private static bool IsEntityFrameworkProviderType(Type queryableProviderType) + => queryableProviderType.GetInterfaces().Any(x => string.Equals(x.FullName, "Microsoft.EntityFrameworkCore.Query.IAsyncQueryProvider")) == true; +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/ColumnsCollectedNotifier.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/ColumnsCollectedNotifier.cs new file mode 100644 index 000000000000..0a13e76e0327 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/ColumnsCollectedNotifier.cs @@ -0,0 +1,57 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; + +// One awkwardness of the way QuickGrid collects its list of child columns is that, during OnParametersSetAsync, +// it only knows about the set of columns that were present on the *previous* render. If it's going to trigger a +// data load during OnParametersSetAsync, that operation can't depend on the current set of columns as it might +// have changed, or might even still be empty (i.e., on the first render). +// +// Ways this could be resolved: +// +// - In the future, we could implement the long-wanted feature of being able to query the contents of a RenderFragment +// separately from rendering. Then the whole trick of collection-during-rendering would not be needed. +// - Or, we could factor out most of QuickGrid's internals into some new component QuickGridCore. The parent component, +// QuickGrid, would then only be responsible for collecting columns followed by rendering QuickGridCore. So each time +// QuickGridCore renders, we'd already have the latest set of columns +// - Drawback: since QuickGrid has public API, it's much messier to have to forward all of that to some new child type. +// - However, this is arguably the most correct solution in general (at least until option 1 above is implemented) +// - Or, we could decide it's enough to fix this on the first render (since that's the only time we're going to guarantee +// to apply a default sort order), and then as a special case put in some extra component in the render flow that raises +// an event once the columns are first collected. +// - This is relatively simple and non-disruptive, though it doesn't cover cases where queries need to be delayed until +// after a dynamically-added column is added +// +// The final option is what's implemented here. We send the notification via EventCallbackSubscribable so that the async +// operation and re-rendering follows normal semantics without us having to call StateHasChanged or think about exceptions. + +/// +/// For internal use only. Do not use. +/// +/// For internal use only. Do not use. +public class ColumnsCollectedNotifier : IComponent +{ + private bool _isFirstRender = true; + + [CascadingParameter] internal InternalGridContext InternalGridContext { get; set; } = default!; + + public void Attach(RenderHandle renderHandle) + { + // This component never renders, so we can ignore the renderHandle + } + + public Task SetParametersAsync(ParameterView parameters) + { + if (_isFirstRender) + { + _isFirstRender = false; + parameters.SetParameterProperties(this); + return InternalGridContext.ColumnsFirstCollected.InvokeCallbacksAsync(null); + } + else + { + return Task.CompletedTask; + } + } +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/Defer.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/Defer.cs new file mode 100644 index 000000000000..9c36a5137141 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/Defer.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.AspNetCore.Components.Rendering; + +namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; + +// This is used by QuickGrid to move its body rendering to the end of the render queue so we can collect +// the list of child columns first. It has to be public only because it's used from .razor logic. + +/// +/// For internal use only. Do not use. +/// +public class Defer : ComponentBase +{ + /// + /// For internal use only. Do not use. + /// + [Parameter] public RenderFragment? ChildContent { get; set; } + + /// + /// For internal use only. Do not use. + /// + protected override void BuildRenderTree(RenderTreeBuilder builder) + { + builder.AddContent(0, ChildContent); + } +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscribable.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscribable.cs new file mode 100644 index 000000000000..179dbd55330e --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscribable.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; + +/// +/// Represents an event that you may subscribe to. This differs from normal C# events in that the handlers +/// are EventCallback, and so may have async behaviors and cause component re-rendering +/// while retaining error flow. +/// +/// A type for the eventargs. +internal class EventCallbackSubscribable +{ + private readonly Dictionary, EventCallback> _callbacks = new(); + + /// + /// Invokes all the registered callbacks sequentially, in an undefined order. + /// + public async Task InvokeCallbacksAsync(T eventArg) + { + foreach (var callback in _callbacks.Values) + { + await callback.InvokeAsync(eventArg); + } + } + + // Don't call this directly - it gets called by EventCallbackSubscription + public void Subscribe(EventCallbackSubscriber owner, EventCallback callback) + => _callbacks.Add(owner, callback); + + // Don't call this directly - it gets called by EventCallbackSubscription + public void Unsubscribe(EventCallbackSubscriber owner) + => _callbacks.Remove(owner); +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscriber.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscriber.cs new file mode 100644 index 000000000000..dc275f34d0d1 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscriber.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; + +/// +/// Represents a subscriber that may be subscribe to an . +/// The subscription can move between instances over time, +/// and automatically unsubscribes from earlier instances +/// whenever it moves to a new one. +/// +internal class EventCallbackSubscriber : IDisposable +{ + private readonly EventCallback _handler; + private EventCallbackSubscribable? _existingSubscription; + + public EventCallbackSubscriber(EventCallback handler) + { + _handler = handler; + } + + /// + /// Creates a subscription on the , or moves any existing subscription to it + /// by first unsubscribing from the previous . + /// + /// If the supplied is null, no new subscription will be created, but any + /// existing one will still be unsubscribed. + /// + /// + public void SubscribeOrMove(EventCallbackSubscribable? subscribable) + { + if (subscribable != _existingSubscription) + { + _existingSubscription?.Unsubscribe(this); + subscribable?.Subscribe(this, _handler); + _existingSubscription = subscribable; + } + } + + public void Dispose() + { + _existingSubscription?.Unsubscribe(this); + } +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventHandlers.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventHandlers.cs new file mode 100644 index 000000000000..3889406da0e7 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventHandlers.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; + +/// +/// Configures event handlers for . +/// +[EventHandler("onclosecolumnoptions", typeof(EventArgs), enableStopPropagation: true, enablePreventDefault: true)] +public static class EventHandlers +{ +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/IAsyncQueryExecutor.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/IAsyncQueryExecutor.cs new file mode 100644 index 000000000000..2ea8768f64ab --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/IAsyncQueryExecutor.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq; + +namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; + +/// +/// Provides methods for asynchronous evaluation of queries against an . +/// +public interface IAsyncQueryExecutor +{ + /// + /// Determines whether the is supported by this type. + /// + /// The data type. + /// An instance. + /// True if this instance can perform asynchronous queries for the supplied , otherwise false. + bool IsSupported(IQueryable queryable); + + /// + /// Asynchronously counts the items in the , if supported. + /// + /// The data type. + /// An instance. + /// The number of items in .. + Task CountAsync(IQueryable queryable); + + /// + /// Asynchronously materializes the as an array, if supported. + /// + /// The data type. + /// An instance. + /// The items in the .. + Task ToArrayAsync(IQueryable queryable); +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/InternalGridContext.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/InternalGridContext.cs new file mode 100644 index 000000000000..30b9bddcc4ca --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/InternalGridContext.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; + +// The grid cascades this so that descendant columns can talk back to it. It's an internal type +// so that it doesn't show up by mistake in unrelated components. +internal class InternalGridContext +{ + public QuickGrid Grid { get; } + public EventCallbackSubscribable ColumnsFirstCollected { get; } = new(); + + public InternalGridContext(QuickGrid grid) + { + Grid = grid; + } +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj new file mode 100644 index 000000000000..8450adb23f9e --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj @@ -0,0 +1,19 @@ + + + + $(DefaultNetCoreTargetFramework) + + + + + + + + <_CurrentProjectDiscoveredScopedCssFiles Include="@(ThemeCssFiles)" RelativePath="%(Identity)" BasePath="_content/$(AssemblyName)" /> + + + + + + + diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/PaginationState.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/PaginationState.cs new file mode 100644 index 000000000000..2da161a7af9a --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/PaginationState.cs @@ -0,0 +1,81 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// Holds state to represent pagination in a . +/// +public class PaginationState +{ + /// + /// Gets or sets the number of items on each page. + /// + public int ItemsPerPage { get; set; } = 10; + + /// + /// Gets the current zero-based page index. To set it, call . + /// + public int CurrentPageIndex { get; private set; } + + /// + /// Gets the total number of items across all pages, if known. The value will be null until an + /// associated assigns a value after loading data. + /// + public int? TotalItemCount { get; private set; } + + /// + /// Gets the zero-based index of the last page, if known. The value will be null until is known. + /// + public int? LastPageIndex => (TotalItemCount - 1) / ItemsPerPage; + + /// + /// An event that is raised when the total item count has changed. + /// + public event EventHandler? TotalItemCountChanged; + + internal EventCallbackSubscribable CurrentPageItemsChanged { get; } = new(); + internal EventCallbackSubscribable TotalItemCountChangedSubscribable { get; } = new(); + + /// + public override int GetHashCode() + => HashCode.Combine(ItemsPerPage, CurrentPageIndex, TotalItemCount); + + /// + /// Sets the current page index, and notifies any associated + /// to fetch and render updated data. + /// + /// The new, zero-based page index. + /// A representing the completion of the operation. + public Task SetCurrentPageIndexAsync(int pageIndex) + { + CurrentPageIndex = pageIndex; + return CurrentPageItemsChanged.InvokeCallbacksAsync(this); + } + + // Can be internal because this only needs to be called by QuickGrid itself, not any custom pagination UI components. + internal Task SetTotalItemCountAsync(int totalItemCount) + { + if (totalItemCount == TotalItemCount) + { + return Task.CompletedTask; + } + + TotalItemCount = totalItemCount; + + if (CurrentPageIndex > 0 && CurrentPageIndex > LastPageIndex) + { + // If the number of items has reduced such that the current page index is no longer valid, move + // automatically to the final valid page index and trigger a further data load. + return SetCurrentPageIndexAsync(LastPageIndex.Value); + } + else + { + // Under normal circumstances, we just want any associated pagination UI to update + TotalItemCountChanged?.Invoke(this, TotalItemCount); + return TotalItemCountChangedSubscribable.InvokeCallbacksAsync(this); + } + } +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor new file mode 100644 index 000000000000..93b85584e9e8 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor @@ -0,0 +1,27 @@ +@namespace Microsoft.AspNetCore.Components.QuickGrid + +
+ @if (Value.TotalItemCount.HasValue) + { +
+ @if (SummaryTemplate is not null) + { + @SummaryTemplate + } + else + { + @Value.TotalItemCount items + } +
+ + } +
diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs new file mode 100644 index 000000000000..8783ef6575d3 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs @@ -0,0 +1,52 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// A component that provides a user interface for . +/// +public partial class Paginator : IDisposable +{ + private readonly EventCallbackSubscriber _totalItemCountChanged; + + /// + /// Specifies the associated . This parameter is required. + /// + [Parameter, EditorRequired] public PaginationState Value { get; set; } = default!; + + /// + /// Optionally supplies a template for rendering the page count summary. + /// + [Parameter] public RenderFragment? SummaryTemplate { get; set; } + + /// + /// Constructs an instance of . + /// + public Paginator() + { + // The "total item count" handler doesn't need to do anything except cause this component to re-render + _totalItemCountChanged = new(new EventCallback(this, null)); + } + + private Task GoFirstAsync() => GoToPageAsync(0); + private Task GoPreviousAsync() => GoToPageAsync(Value.CurrentPageIndex - 1); + private Task GoNextAsync() => GoToPageAsync(Value.CurrentPageIndex + 1); + private Task GoLastAsync() => GoToPageAsync(Value.LastPageIndex.GetValueOrDefault(0)); + + private bool CanGoBack => Value.CurrentPageIndex > 0; + private bool CanGoForwards => Value.CurrentPageIndex < Value.LastPageIndex; + + private Task GoToPageAsync(int pageIndex) + => Value.SetCurrentPageIndexAsync(pageIndex); + + /// + protected override void OnParametersSet() + => _totalItemCountChanged.SubscribeOrMove(Value.TotalItemCountChangedSubscribable); + + /// + public void Dispose() + => _totalItemCountChanged.Dispose(); +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.css b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.css new file mode 100644 index 000000000000..d996a6d1beb7 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.css @@ -0,0 +1,49 @@ +.paginator { + display: flex; + border-top: 1px solid #ccc; + margin-top: 0.5rem; + padding: 0.25rem 0; + align-items: center; +} + +.pagination-text { + margin: 0 0.5rem; +} + +nav { + display: flex; + margin-left: auto; + gap: 0.5rem; + align-items: center; +} + + nav button { + border: 0; + background: none center center / 1rem no-repeat; + width: 2rem; + height: 2rem; + } + + nav button[disabled] { + opacity: 0.4; + } + + nav button:not([disabled]):hover { + background-color: #eee; + } + + nav button:not([disabled]):active { + background-color: #aaa; + } + +.go-first, .go-last { + background-image: url('data:image/svg+xml;utf8,'); +} + +.go-previous, .go-next { + background-image: url('data:image/svg+xml;utf8,'); +} + +.go-next, .go-last { + transform: scaleX(-1); +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor new file mode 100644 index 000000000000..08066a0a5e48 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor @@ -0,0 +1,96 @@ +@using Microsoft.AspNetCore.Components.Rendering +@typeparam TGridItem + + @{ StartCollectingColumns(); } + @ChildContent + + @{ FinishCollectingColumns(); } + + + + + + @_renderColumnHeaders + + + + @if (Virtualize) + { + + } + else + { + @_renderNonVirtualizedRows + } + +
+
+
+ +@code { + private void RenderNonVirtualizedRows(RenderTreeBuilder __builder) + { + var initialRowIndex = 2; // aria-rowindex is 1-based, plus the first row is the header + var rowIndex = initialRowIndex; + foreach (var item in _currentNonVirtualizedViewItems) + { + RenderRow(__builder, rowIndex++, item); + } + + // When pagination is enabled, by default ensure we render the exact number of expected rows per page, + // even if there aren't enough data items. This avoids the layout jumping on the last page. + // Consider making this optional. + if (Pagination is not null) + { + while (rowIndex++ < initialRowIndex + Pagination.ItemsPerPage) + { + + } + } + } + + private void RenderRow(RenderTreeBuilder __builder, int rowIndex, TGridItem item) + { + + @foreach (var col in _columns) + { + @{ col.CellContent(__builder, item); } + } + + } + + private void RenderPlaceholderRow(RenderTreeBuilder __builder, PlaceholderContext placeholderContext) + { + + @foreach (var col in _columns) + { + @{ col.RenderPlaceholderContent(__builder, placeholderContext); } + } + + } + + private void RenderColumnHeaders(RenderTreeBuilder __builder) + { + foreach (var col in _columns) + { + +
@col.HeaderContent
+ + @if (col == _displayOptionsForColumn) + { +
@col.ColumnOptions
+ } + + @if (ResizableColumns) + { +
+ } + + } + } +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs new file mode 100644 index 000000000000..088fe9349874 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs @@ -0,0 +1,432 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq; +using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// A component that displays a grid. +/// +/// The type of data represented by each row in the grid. +[CascadingTypeParameter(nameof(TGridItem))] +public partial class QuickGrid : IAsyncDisposable +{ + /// + /// A queryable source of data for the grid. + /// + /// This could be in-memory data converted to queryable using the + /// extension method, + /// or an EntityFramework DataSet or an derived from it. + /// + /// You should supply either or , but not both. + /// + [Parameter] public IQueryable? Items { get; set; } + + /// + /// A callback that supplies data for the rid. + /// + /// You should supply either or , but not both. + /// + [Parameter] public GridItemsProvider? ItemsProvider { get; set; } + + /// + /// An optional CSS class name. If given, this will be included in the class attribute of the rendered table. + /// + [Parameter] public string? Class { get; set; } + + /// + /// A theme name, with default value "default". This affects which styling rules match the table. + /// + [Parameter] public string? Theme { get; set; } = "default"; + + /// + /// Defines the child components of this instance. For example, you may define columns by adding + /// components derived from the base class. + /// + [Parameter] public RenderFragment? ChildContent { get; set; } + + /// + /// If true, the grid will be rendered with virtualization. This is normally used in conjunction with + /// scrolling and causes the grid to fetch and render only the data around the current scroll viewport. + /// This can greatly improve the performance when scrolling through large data sets. + /// + /// If you use , you should supply a value for and must + /// ensure that every row renders with the same constant height. + /// + /// Generally it's preferable not to use if the amount of data being rendered + /// is small or if you are using pagination. + /// + [Parameter] public bool Virtualize { get; set; } + + /// + /// This is applicable only when using . It defines an expected height in pixels for + /// each row, allowing the virtualization mechanism to fetch the correct number of items to match the display + /// size and to ensure accurate scrolling. + /// + [Parameter] public float ItemSize { get; set; } = 50; + + /// + /// If true, renders draggable handles around the column headers, allowing the user to resize the columns + /// manually. Size changes are not persisted. + /// + [Parameter] public bool ResizableColumns { get; set; } + + /// + /// Optionally defines a value for @key on each rendered row. Typically this should be used to specify a + /// unique identifier, such as a primary key value, for each data item. + /// + /// This allows the grid to preserve the association between row elements and data items based on their + /// unique identifiers, even when the instances are replaced by new copies (for + /// example, after a new query against the underlying data store). + /// + /// If not set, the @key will be the instance itself. + /// + [Parameter] public Func ItemKey { get; set; } = x => x!; + + /// + /// Optionally links this instance with a model, + /// causing the grid to fetch and render only the current page of data. + /// + /// This is normally used in conjunction with a component or some other UI logic + /// that displays and updates the supplied instance. + /// + [Parameter] public PaginationState? Pagination { get; set; } + + [Inject] private IServiceProvider Services { get; set; } = default!; + [Inject] private IJSRuntime JS { get; set; } = default!; + + private ElementReference _tableReference; + private Virtualize<(int, TGridItem)>? _virtualizeComponent; + private int _ariaBodyRowCount; + private ICollection _currentNonVirtualizedViewItems = Array.Empty(); + + // IQueryable only exposes synchronous query APIs. IAsyncQueryExecutor is an adapter that lets us invoke any + // async query APIs that might be available. We have built-in support for using EF Core's async query APIs. + private IAsyncQueryExecutor? _asyncQueryExecutor; + + // We cascade the InternalGridContext to descendants, which in turn call it to add themselves to _columns + // This happens on every render so that the column list can be updated dynamically + private InternalGridContext _internalGridContext; + private List> _columns; + private bool _collectingColumns; // Columns might re-render themselves arbitrarily. We only want to capture them at a defined time. + + // Tracking state for options and sorting + private ColumnBase? _displayOptionsForColumn; + private ColumnBase? _sortByColumn; + private bool _sortByAscending; + private bool _checkColumnOptionsPosition; + + // The associated ES6 module, which uses document-level event listeners + private IJSObjectReference? _jsModule; + private IJSObjectReference? _jsEventDisposable; + + // Caches of method->delegate conversions + private readonly RenderFragment _renderColumnHeaders; + private readonly RenderFragment _renderNonVirtualizedRows; + + // We try to minimize the number of times we query the items provider, since queries may be expensive + // We only re-query when the developer calls RefreshDataAsync, or if we know something's changed, such + // as sort order, the pagination state, or the data source itself. These fields help us detect when + // things have changed, and to discard earlier load attempts that were superseded. + private int? _lastRefreshedPaginationStateHash; + private object? _lastAssignedItemsOrProvider; + private CancellationTokenSource? _pendingDataLoadCancellationTokenSource; + + // If the PaginationState mutates, it raises this event. We use it to trigger a re-render. + private readonly EventCallbackSubscriber _currentPageItemsChanged; + + /// + /// Constructs an instance of . + /// + public QuickGrid() + { + _columns = new(); + _internalGridContext = new(this); + _currentPageItemsChanged = new(EventCallback.Factory.Create(this, RefreshDataCoreAsync)); + _renderColumnHeaders = RenderColumnHeaders; + _renderNonVirtualizedRows = RenderNonVirtualizedRows; + + // As a special case, we don't issue the first data load request until we've collected the initial set of columns + // This is so we can apply default sort order (or any future per-column options) before loading data + // We use EventCallbackSubscriber to safely hook this async operation into the synchronous rendering flow + var columnsFirstCollectedSubscriber = new EventCallbackSubscriber( + EventCallback.Factory.Create(this, RefreshDataCoreAsync)); + columnsFirstCollectedSubscriber.SubscribeOrMove(_internalGridContext.ColumnsFirstCollected); + } + + /// + protected override Task OnParametersSetAsync() + { + // The associated pagination state may have been added/removed/replaced + _currentPageItemsChanged.SubscribeOrMove(Pagination?.CurrentPageItemsChanged); + + if (Items is not null && ItemsProvider is not null) + { + throw new InvalidOperationException($"{nameof(QuickGrid)} requires one of {nameof(Items)} or {nameof(ItemsProvider)}, but both were specified."); + } + + // Perform a re-query only if the data source or something else has changed + var _newItemsOrItemsProvider = Items ?? (object?)ItemsProvider; + var dataSourceHasChanged = _newItemsOrItemsProvider != _lastAssignedItemsOrProvider; + if (dataSourceHasChanged) + { + _lastAssignedItemsOrProvider = _newItemsOrItemsProvider; + _asyncQueryExecutor = AsyncQueryExecutorSupplier.GetAsyncQueryExecutor(Services, Items); + } + + var mustRefreshData = dataSourceHasChanged + || (Pagination?.GetHashCode() != _lastRefreshedPaginationStateHash); + + // We don't want to trigger the first data load until we've collected the initial set of columns, + // because they might perform some action like setting the default sort order, so it would be wasteful + // to have to re-query immediately + return (_columns.Count > 0 && mustRefreshData) ? RefreshDataCoreAsync() : Task.CompletedTask; + } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + _jsModule = await JS.InvokeAsync("import", "./_content/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.js"); + _jsEventDisposable = await _jsModule.InvokeAsync("init", _tableReference); + } + + if (_checkColumnOptionsPosition && _displayOptionsForColumn is not null) + { + _checkColumnOptionsPosition = false; + _ = _jsModule?.InvokeVoidAsync("checkColumnOptionsPosition", _tableReference); + } + } + + // Invoked by descendant columns at a special time during rendering + internal void AddColumn(ColumnBase column, SortDirection? isDefaultSortDirection) + { + if (_collectingColumns) + { + _columns.Add(column); + + if (_sortByColumn is null && isDefaultSortDirection.HasValue) + { + _sortByColumn = column; + _sortByAscending = isDefaultSortDirection.Value != SortDirection.Descending; + } + } + } + + private void StartCollectingColumns() + { + _columns.Clear(); + _collectingColumns = true; + } + + private void FinishCollectingColumns() + { + _collectingColumns = false; + } + + /// + /// Sets the grid's current sort column to the specified . + /// + /// The column that defines the new sort order. + /// The direction of sorting. If the value is , then it will toggle the direction on each call. + /// A representing the completion of the operation. + public Task SortByColumnAsync(ColumnBase column, SortDirection direction = SortDirection.Auto) + { + _sortByAscending = direction switch + { + SortDirection.Ascending => true, + SortDirection.Descending => false, + SortDirection.Auto => _sortByColumn == column ? !_sortByAscending : true, + _ => throw new NotSupportedException($"Unknown sort direction {direction}"), + }; + + _sortByColumn = column; + + StateHasChanged(); // We want to see the updated sort order in the header, even before the data query is completed + return RefreshDataAsync(); + } + + /// + /// Displays the UI for the specified column, closing any other column + /// options UI that was previously displayed. + /// + /// The column whose options are to be displayed, if any are available. + public void ShowColumnOptions(ColumnBase column) + { + _displayOptionsForColumn = column; + _checkColumnOptionsPosition = true; // Triggers a call to JS to position the options element, apply autofocus, and any other setup + StateHasChanged(); + } + + /// + /// Instructs the grid to re-fetch and render the current data from the supplied data source + /// (either or ). + /// + /// A that represents the completion of the operation. + public async Task RefreshDataAsync() + { + await RefreshDataCoreAsync(); + StateHasChanged(); + } + + // Same as RefreshDataAsync, except without forcing a re-render. We use this from OnParametersSetAsync + // because in that case there's going to be a re-render anyway. + private async Task RefreshDataCoreAsync() + { + // Move into a "loading" state, cancelling any earlier-but-still-pending load + _pendingDataLoadCancellationTokenSource?.Cancel(); + var thisLoadCts = _pendingDataLoadCancellationTokenSource = new CancellationTokenSource(); + + if (_virtualizeComponent is not null) + { + // If we're using Virtualize, we have to go through its RefreshDataAsync API otherwise: + // (1) It won't know to update its own internal state if the provider output has changed + // (2) We won't know what slice of data to query for + await _virtualizeComponent.RefreshDataAsync(); + _pendingDataLoadCancellationTokenSource = null; + } + else + { + // If we're not using Virtualize, we build and execute a request against the items provider directly + _lastRefreshedPaginationStateHash = Pagination?.GetHashCode(); + var startIndex = Pagination is null ? 0 : (Pagination.CurrentPageIndex * Pagination.ItemsPerPage); + var request = new GridItemsProviderRequest( + startIndex, Pagination?.ItemsPerPage, _sortByColumn, _sortByAscending, thisLoadCts.Token); + var result = await ResolveItemsRequestAsync(request); + if (!thisLoadCts.IsCancellationRequested) + { + _currentNonVirtualizedViewItems = result.Items; + _ariaBodyRowCount = _currentNonVirtualizedViewItems.Count; + Pagination?.SetTotalItemCountAsync(result.TotalItemCount); + _pendingDataLoadCancellationTokenSource = null; + } + } + } + + // Gets called both by RefreshDataCoreAsync and directly by the Virtualize child component during scrolling + private async ValueTask> ProvideVirtualizedItems(ItemsProviderRequest request) + { + _lastRefreshedPaginationStateHash = Pagination?.GetHashCode(); + + // Debounce the requests. This eliminates a lot of redundant queries at the cost of slight lag after interactions. + // TODO: Consider making this configurable, or smarter (e.g., doesn't delay on first call in a batch, then the amount + // of delay increases if you rapidly issue repeated requests, such as when scrolling a long way) + await Task.Delay(100); + if (request.CancellationToken.IsCancellationRequested) + { + return default; + } + + // Combine the query parameters from Virtualize with the ones from PaginationState + var startIndex = request.StartIndex; + var count = request.Count; + if (Pagination is not null) + { + startIndex += Pagination.CurrentPageIndex * Pagination.ItemsPerPage; + count = Math.Min(request.Count, Pagination.ItemsPerPage - request.StartIndex); + } + + var providerRequest = new GridItemsProviderRequest( + startIndex, count, _sortByColumn, _sortByAscending, request.CancellationToken); + var providerResult = await ResolveItemsRequestAsync(providerRequest); + + if (!request.CancellationToken.IsCancellationRequested) + { + // ARIA's rowcount is part of the UI, so it should reflect what the human user regards as the number of rows in the table, + // not the number of physical elements. For virtualization this means what's in the entire scrollable range, not just + // the current viewport. In the case where you're also paginating then it means what's conceptually on the current page. + // TODO: This currently assumes we always want to expand the last page to have ItemsPerPage rows, but the experience might + // be better if we let the last page only be as big as its number of actual rows. + _ariaBodyRowCount = Pagination is null ? providerResult.TotalItemCount : Pagination.ItemsPerPage; + + Pagination?.SetTotalItemCountAsync(providerResult.TotalItemCount); + + // We're supplying the row index along with each row's data because we need it for aria-rowindex, and we have to account for + // the virtualized start index. It might be more performant just to have some _latestQueryRowStartIndex field, but we'd have + // to make sure it doesn't get out of sync with the rows being rendered. + return new ItemsProviderResult<(int, TGridItem)>( + items: providerResult.Items.Select((x, i) => ValueTuple.Create(i + request.StartIndex + 2, x)), + totalItemCount: _ariaBodyRowCount); + } + + return default; + } + + // Normalizes all the different ways of configuring a data source so they have common GridItemsProvider-shaped API + private async ValueTask> ResolveItemsRequestAsync(GridItemsProviderRequest request) + { + if (ItemsProvider is not null) + { + return await ItemsProvider(request); + } + else if (Items is not null) + { + var totalItemCount = _asyncQueryExecutor is null ? Items.Count() : await _asyncQueryExecutor.CountAsync(Items); + var result = request.ApplySorting(Items).Skip(request.StartIndex); + if (request.Count.HasValue) + { + result = result.Take(request.Count.Value); + } + var resultArray = _asyncQueryExecutor is null ? result.ToArray() : await _asyncQueryExecutor.ToArrayAsync(result); + return GridItemsProviderResult.From(resultArray, totalItemCount); + } + else + { + return GridItemsProviderResult.From(Array.Empty(), 0); + } + } + + private string AriaSortValue(ColumnBase column) + => _sortByColumn == column + ? (_sortByAscending ? "ascending" : "descending") + : "none"; + + private string? ColumnHeaderClass(ColumnBase column) + => _sortByColumn == column + ? $"{ColumnClass(column)} {(_sortByAscending ? "col-sort-asc" : "col-sort-desc")}" + : ColumnClass(column); + + private string GridClass() + => $"quickgrid {Class} {(_pendingDataLoadCancellationTokenSource is null ? null : "loading")}"; + + private static string? ColumnClass(ColumnBase column) => column.Align switch + { + Align.Center => $"col-justify-center {column.Class}", + Align.Right => $"col-justify-end {column.Class}", + _ => column.Class, + }; + + /// + public async ValueTask DisposeAsync() + { + _currentPageItemsChanged.Dispose(); + + try + { + if (_jsEventDisposable is not null) + { + await _jsEventDisposable.InvokeVoidAsync("stop"); + await _jsEventDisposable.DisposeAsync(); + } + + if (_jsModule is not null) + { + await _jsModule.DisposeAsync(); + } + } + catch (JSDisconnectedException) + { + // The JS side may routinely be gone already if the reason we're disposing is that + // the client disconnected. This is not an error. + } + } + + private void CloseColumnOptions() + { + _displayOptionsForColumn = null; + } +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.css b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.css new file mode 100644 index 000000000000..51ad4cdcd553 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.css @@ -0,0 +1,97 @@ +/* + TODO: Don't actually used scoped CSS for QuickGrid.razor, because it's so perf-critical we don't even want to + add the extra attributes on all the tr/td elements. We can hook everything onto the table.quickgrid class, + remembering to be specific about matching closest tr/td only, not any child tables. +*/ + +th { + position: relative; /* So that col-options appears next to it */ +} + +.col-header-content { + /* We want the th elements to be display:flex, but they also have to be display:table-cell to avoid breaking the layout. + So .col-header-content is an immediate child with display:flex. */ + position: relative; + display: flex; + align-items: center; +} + +/* Deep to make it easy for people adding a sort-indicator element in a custom HeaderTemplate */ +th ::deep .sort-indicator { + /* Preset width so the column width doen't change as the sort indicator appears/disappears */ + width: 1rem; + height: 1rem; + align-self: center; + text-align: center; +} + +.col-sort-asc ::deep .sort-indicator, .col-sort-desc ::deep .sort-indicator { + background-image: url('data:image/svg+xml;utf8,'); +} + +.col-sort-desc ::deep .sort-indicator { + transform: scaleY(-1); +} + +/* Deep to make it easy for people adding a col-options-button element in a custom HeaderTemplate */ +th ::deep .col-options-button { + border: none; + padding: 0; /* So that even if the text on the button is wide, it gets properly centered */ + width: 1rem; + align-self: stretch; + background: url('data:image/svg+xml;utf8,') center center / 1rem no-repeat; +} + +.col-options { + position: absolute; + background: white; + border: 1px solid silver; + left: 0; + padding: 1rem; + z-index: 1; +} + +.col-justify-end .col-options { + left: unset; + right: 0; +} + +.col-width-draghandle { + position: absolute; + top: 0; + bottom: 0; + right: 0rem; + cursor: ew-resize; +} + + .col-width-draghandle:after { + content: ' '; + position: absolute; + top: 0; + bottom: 0; + border-left: 1px solid black; + } + +td.col-justify-center { + text-align: center; +} + +td.col-justify-end { + text-align: right; +} + +/* Unfortunately we can't use the :dir pseudoselector due to lack of browser support. Instead we have to rely on + the developer setting to detect if we're in RTL mode. */ +html[dir=rtl] td.col-justify-end { + text-align: left; +} + +html[dir=rtl] .col-options { + left: unset; + right: 0; +} + +html[dir=rtl] .col-justify-end .col-options { + right: unset; + left: 0; +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.js b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.js new file mode 100644 index 000000000000..05d60e92a11d --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.js @@ -0,0 +1,97 @@ +export function init(tableElement) { + enableColumnResizing(tableElement); + + const bodyClickHandler = event => { + const columnOptionsElement = tableElement.tHead.querySelector('.col-options'); + if (columnOptionsElement && event.composedPath().indexOf(columnOptionsElement) < 0) { + tableElement.dispatchEvent(new CustomEvent('closecolumnoptions', { bubbles: true })); + } + }; + const keyDownHandler = event => { + const columnOptionsElement = tableElement.tHead.querySelector('.col-options'); + if (columnOptionsElement && event.key === "Escape") { + tableElement.dispatchEvent(new CustomEvent('closecolumnoptions', { bubbles: true })); + } + }; + + document.body.addEventListener('click', bodyClickHandler); + document.body.addEventListener('mousedown', bodyClickHandler); // Otherwise it seems strange that it doesn't go away until you release the mouse button + document.body.addEventListener('keydown', keyDownHandler); + + return { + stop: () => { + document.body.removeEventListener('click', bodyClickHandler); + document.body.removeEventListener('mousedown', bodyClickHandler); + document.body.removeEventListener('keydown', keyDownHandler); + } + }; +} + +export function checkColumnOptionsPosition(tableElement) { + const colOptions = tableElement.tHead && tableElement.tHead.querySelector('.col-options'); // Only match within *our* thead, not nested tables + if (colOptions) { + // We want the options popup to be positioned over the grid, not overflowing on either side, because it's possible that + // beyond either side is off-screen or outside the scroll range of an ancestor + const gridRect = tableElement.getBoundingClientRect(); + const optionsRect = colOptions.getBoundingClientRect(); + const leftOverhang = Math.max(0, gridRect.left - optionsRect.left); + const rightOverhang = Math.max(0, optionsRect.right - gridRect.right); + if (leftOverhang || rightOverhang) { + // In the unlikely event that it overhangs both sides, we'll center it + const applyOffset = leftOverhang && rightOverhang ? (leftOverhang - rightOverhang) / 2 : (leftOverhang - rightOverhang); + colOptions.style.transform = `translateX(${applyOffset}px)`; + } + + colOptions.scrollIntoViewIfNeeded(); + + const autoFocusElem = colOptions.querySelector('[autofocus]'); + if (autoFocusElem) { + autoFocusElem.focus(); + } + } +} + +function enableColumnResizing(tableElement) { + tableElement.tHead.querySelectorAll('.col-width-draghandle').forEach(handle => { + handle.addEventListener('mousedown', handleMouseDown); + if ('ontouchstart' in window) { + handle.addEventListener('touchstart', handleMouseDown); + } + + function handleMouseDown(evt) { + evt.preventDefault(); + evt.stopPropagation(); + + const th = handle.parentElement; + const startPageX = evt.touches ? evt.touches[0].pageX : evt.pageX; + const originalColumnWidth = th.offsetWidth; + const rtlMultiplier = window.getComputedStyle(th, null).getPropertyValue('direction') === 'rtl' ? -1 : 1; + let updatedColumnWidth = 0; + + function handleMouseMove(evt) { + evt.stopPropagation(); + const newPageX = evt.touches ? evt.touches[0].pageX : evt.pageX; + const nextWidth = originalColumnWidth + (newPageX - startPageX) * rtlMultiplier; + if (Math.abs(nextWidth - updatedColumnWidth) > 0) { + updatedColumnWidth = nextWidth; + th.style.width = `${updatedColumnWidth}px`; + } + } + + function handleMouseUp() { + document.body.removeEventListener('mousemove', handleMouseMove); + document.body.removeEventListener('mouseup', handleMouseUp); + document.body.removeEventListener('touchmove', handleMouseMove); + document.body.removeEventListener('touchend', handleMouseUp); + } + + if (evt instanceof TouchEvent) { + document.body.addEventListener('touchmove', handleMouseMove, { passive: true }); + document.body.addEventListener('touchend', handleMouseUp, { passive: true }); + } else { + document.body.addEventListener('mousemove', handleMouseMove, { passive: true }); + document.body.addEventListener('mouseup', handleMouseUp, { passive: true }); + } + } + }); +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/SortDirection.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/SortDirection.cs new file mode 100644 index 000000000000..93ee203a48fc --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/SortDirection.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// Describes the direction in which a column is sorted. +/// +public enum SortDirection +{ + /// + /// Ascending order. + /// + Ascending, + + /// + /// Descending order. + /// + Descending, + + /// + /// Automatic sort order. When used with , + /// the sort order will automatically toggle between and on successive calls, and + /// resets to whenever the specified column is changed. + /// + Auto, +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Themes/Default.css b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Themes/Default.css new file mode 100644 index 000000000000..e11b358f9927 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Themes/Default.css @@ -0,0 +1,81 @@ +.quickgrid[theme=default] { + --col-gap: 1rem; +} + +.quickgrid[theme=default] .col-header-content { + padding-right: var(--col-gap); +} + +.quickgrid[theme=default] > thead > tr > th { + font-weight: normal; +} + +.quickgrid[theme=default].loading > tbody { + opacity: 0.25; + transition: opacity linear 100ms; + transition-delay: 25ms; /* Don't want flicker if the queries are resolving almost immediately */ +} + +.quickgrid[theme=default] .col-title { + padding: 0.1rem 0.4rem; +} + + .quickgrid[theme=default] > tbody > tr > td { + padding: 0.1rem calc(0.4rem + var(--col-gap)) 0.1rem 0.4rem; + } + +.quickgrid[theme=default] .col-title { + gap: 0.4rem; /* Separate the sort indicator from title text */ + font-weight: bold; +} + +.quickgrid[theme=default] .sort-indicator { + opacity: 0.5; +} + +.quickgrid[theme=default] .col-options-button { + width: 1.5rem; +} + +.quickgrid[theme=default] button.col-title:hover, .quickgrid[theme=default] .col-options-button:hover { + background-color: rgba(128, 128, 128, 0.2); +} + +.quickgrid[theme=default] button.col-title:active, .quickgrid[theme=default] .col-options-button:active { + background-color: rgba(128, 128, 128, 0.5); +} + + .quickgrid[theme=default] > thead .col-width-draghandle { + width: 1rem; + right: calc(var(--col-gap)/2 - 0.5rem); + } + + .quickgrid[theme=default] > thead .col-width-draghandle:hover { + background: rgba(128, 128, 128, 0.2); + } + + .quickgrid[theme=default] > thead .col-width-draghandle:active { + background: rgba(128, 128, 128, 0.4); + } + + .quickgrid[theme=default] > thead .col-width-draghandle:hover:after, .quickgrid[theme=default] > thead .col-width-draghandle:active:after { + border-color: black; + } + + .quickgrid[theme=default] > thead .col-width-draghandle:after { + border-color: #ccc; + left: 0.5rem; + top: 5px; + bottom: 5px; + } + +.quickgrid[theme=default] .col-options { + box-shadow: 0 3px 8px 1px #aaa; + border-color: #ddd; + border-radius: 0.3rem; +} + +.quickgrid[theme=default] > tbody > tr > td.grid-cell-placeholder:after { + content: '\2026'; + opacity: 0.75; +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/_Imports.razor b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/_Imports.razor new file mode 100644 index 000000000000..5110695b1bd2 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/_Imports.razor @@ -0,0 +1,5 @@ +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.JSInterop +@using Microsoft.AspNetCore.Components.QuickGrid +@using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure From 9896766d76c5fea634bf2fb4fcbdedb9f2225033 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Mon, 6 Feb 2023 16:35:36 -0700 Subject: [PATCH 02/18] Partially fix build warnings --- .../PublicAPI.Shipped.txt | 1 + .../PublicAPI.Unshipped.txt | 3 + .../Columns/GridSort.cs | 2 +- .../Columns/TemplateColumn.cs | 2 +- .../AsyncQueryExecutorSupplier.cs | 5 +- .../EventCallbackSubscribable.cs | 2 +- .../Infrastructure/EventCallbackSubscriber.cs | 2 +- .../Infrastructure/InternalGridContext.cs | 2 +- ...oft.AspNetCore.Components.QuickGrid.csproj | 2 + .../PublicAPI.Shipped.txt | 1 + .../PublicAPI.Unshipped.txt | 112 ++++++++++++++++++ .../QuickGrid.razor.cs | 6 +- 12 files changed, 131 insertions(+), 9 deletions(-) create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/PublicAPI.Shipped.txt create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/PublicAPI.Unshipped.txt create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Shipped.txt create mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Unshipped.txt diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/PublicAPI.Shipped.txt b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/PublicAPI.Shipped.txt new file mode 100644 index 000000000000..ab058de62d44 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/PublicAPI.Unshipped.txt b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/PublicAPI.Unshipped.txt new file mode 100644 index 000000000000..3f77fefe0569 --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/PublicAPI.Unshipped.txt @@ -0,0 +1,3 @@ +#nullable enable +Microsoft.Extensions.DependencyInjection.EntityFrameworkAdapterServiceCollectionExtensions +static Microsoft.Extensions.DependencyInjection.EntityFrameworkAdapterServiceCollectionExtensions.AddQuickGridEntityFrameworkAdapter(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs index 218df9b6a7ed..5b6e9a587454 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs @@ -14,7 +14,7 @@ public class GridSort { private const string ExpressionNotRepresentableMessage = "The supplied expression can't be represented as a property name for sorting. Only simple member expressions, such as @(x => x.SomeProperty), can be converted to property names."; - private Func, bool, IOrderedQueryable> _first; + private readonly Func, bool, IOrderedQueryable> _first; private List, bool, IOrderedQueryable>>? _then; private (LambdaExpression, bool) _firstExpression; diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/TemplateColumn.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/TemplateColumn.cs index 80cb357ce6f7..0149dc0fa2cb 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/TemplateColumn.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/TemplateColumn.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Components.QuickGrid; /// The type of data represented by each row in the grid. public class TemplateColumn : ColumnBase, ISortBuilderColumn { - private readonly static RenderFragment EmptyChildContent = _ => builder => { }; + private static readonly RenderFragment EmptyChildContent = _ => builder => { }; /// /// Specifies the content to be rendered for each row in the table. diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cs index 9956ac61f3cd..2ccbf70c808e 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Concurrent; +using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.Extensions.DependencyInjection; @@ -50,6 +51,6 @@ internal static class AsyncQueryExecutorSupplier // We have to do this via reflection because the whole point is to avoid any static dependency on EF unless you // reference the adapter. Trimming won't cause us any problems because this is only a way of detecting misconfiguration // so it's sufficient if it can detect the misconfiguration in development. - private static bool IsEntityFrameworkProviderType(Type queryableProviderType) - => queryableProviderType.GetInterfaces().Any(x => string.Equals(x.FullName, "Microsoft.EntityFrameworkCore.Query.IAsyncQueryProvider")) == true; + private static bool IsEntityFrameworkProviderType([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)] Type queryableProviderType) + => queryableProviderType.GetInterfaces().Any(x => string.Equals(x.FullName, "Microsoft.EntityFrameworkCore.Query.IAsyncQueryProvider", StringComparison.Ordinal)) == true; } diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscribable.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscribable.cs index 179dbd55330e..3b0588e226c1 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscribable.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscribable.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; /// while retaining error flow. /// /// A type for the eventargs. -internal class EventCallbackSubscribable +internal sealed class EventCallbackSubscribable { private readonly Dictionary, EventCallback> _callbacks = new(); diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscriber.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscriber.cs index dc275f34d0d1..167a16f80d69 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscriber.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscriber.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; /// and automatically unsubscribes from earlier instances /// whenever it moves to a new one. /// -internal class EventCallbackSubscriber : IDisposable +internal sealed class EventCallbackSubscriber : IDisposable { private readonly EventCallback _handler; private EventCallbackSubscribable? _existingSubscription; diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/InternalGridContext.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/InternalGridContext.cs index 30b9bddcc4ca..b1e64408cedd 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/InternalGridContext.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/InternalGridContext.cs @@ -5,7 +5,7 @@ namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; // The grid cascades this so that descendant columns can talk back to it. It's an internal type // so that it doesn't show up by mistake in unrelated components. -internal class InternalGridContext +internal sealed class InternalGridContext { public QuickGrid Grid { get; } public EventCallbackSubscribable ColumnsFirstCollected { get; } = new(); diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj index 8450adb23f9e..96a59d9423b0 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj @@ -2,6 +2,8 @@ $(DefaultNetCoreTargetFramework) + Provides a simple and convenient data grid component for common grid rendering scenarios and serves as a reference architecture and performance baseline for building data grid components. + true diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Shipped.txt b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Shipped.txt new file mode 100644 index 000000000000..7dc5c58110bf --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Unshipped.txt b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Unshipped.txt new file mode 100644 index 000000000000..26376e2aa90a --- /dev/null +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Unshipped.txt @@ -0,0 +1,112 @@ +#nullable enable +Microsoft.AspNetCore.Components.QuickGrid.Align +Microsoft.AspNetCore.Components.QuickGrid.Align.Center = 1 -> Microsoft.AspNetCore.Components.QuickGrid.Align +Microsoft.AspNetCore.Components.QuickGrid.Align.Left = 0 -> Microsoft.AspNetCore.Components.QuickGrid.Align +Microsoft.AspNetCore.Components.QuickGrid.Align.Right = 2 -> Microsoft.AspNetCore.Components.QuickGrid.Align +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProvider +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderRequest +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderRequest.ApplySorting(System.Linq.IQueryable! source) -> System.Linq.IQueryable! +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderRequest.CancellationToken.get -> System.Threading.CancellationToken +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderRequest.Count.get -> int? +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderRequest.GetSortByProperties() -> System.Collections.Generic.IReadOnlyCollection<(string! PropertyName, Microsoft.AspNetCore.Components.QuickGrid.SortDirection Direction)>! +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderRequest.GridItemsProviderRequest() -> void +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderRequest.SortByAscending.get -> bool +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderRequest.SortByColumn.get -> Microsoft.AspNetCore.Components.QuickGrid.ColumnBase? +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderRequest.StartIndex.get -> int +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult.GridItemsProviderResult() -> void +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult.GridItemsProviderResult(System.Collections.Generic.ICollection! items, int totalItemCount) -> void +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult.Items.get -> System.Collections.Generic.ICollection! +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult.Items.set -> void +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult.TotalItemCount.get -> int +Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult.TotalItemCount.set -> void +Microsoft.AspNetCore.Components.QuickGrid.GridSort +Microsoft.AspNetCore.Components.QuickGrid.GridSort.ThenAscending(System.Linq.Expressions.Expression!>! expression) -> Microsoft.AspNetCore.Components.QuickGrid.GridSort! +Microsoft.AspNetCore.Components.QuickGrid.GridSort.ThenDescending(System.Linq.Expressions.Expression!>! expression) -> Microsoft.AspNetCore.Components.QuickGrid.GridSort! +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.ColumnsCollectedNotifier +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.ColumnsCollectedNotifier.Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) -> void +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.ColumnsCollectedNotifier.ColumnsCollectedNotifier() -> void +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.ColumnsCollectedNotifier.SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView parameters) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.Defer +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.Defer.ChildContent.get -> Microsoft.AspNetCore.Components.RenderFragment? +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.Defer.ChildContent.set -> void +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.Defer.Defer() -> void +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.EventHandlers +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.IAsyncQueryExecutor +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.IAsyncQueryExecutor.CountAsync(System.Linq.IQueryable! queryable) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.IAsyncQueryExecutor.IsSupported(System.Linq.IQueryable! queryable) -> bool +Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.IAsyncQueryExecutor.ToArrayAsync(System.Linq.IQueryable! queryable) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Components.QuickGrid.ISortBuilderColumn +Microsoft.AspNetCore.Components.QuickGrid.ISortBuilderColumn.SortBuilder.get -> Microsoft.AspNetCore.Components.QuickGrid.GridSort? +Microsoft.AspNetCore.Components.QuickGrid.PaginationState +Microsoft.AspNetCore.Components.QuickGrid.PaginationState.CurrentPageIndex.get -> int +Microsoft.AspNetCore.Components.QuickGrid.PaginationState.ItemsPerPage.get -> int +Microsoft.AspNetCore.Components.QuickGrid.PaginationState.ItemsPerPage.set -> void +Microsoft.AspNetCore.Components.QuickGrid.PaginationState.LastPageIndex.get -> int? +Microsoft.AspNetCore.Components.QuickGrid.PaginationState.PaginationState() -> void +Microsoft.AspNetCore.Components.QuickGrid.PaginationState.SetCurrentPageIndexAsync(int pageIndex) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Components.QuickGrid.PaginationState.TotalItemCount.get -> int? +Microsoft.AspNetCore.Components.QuickGrid.PaginationState.TotalItemCountChanged -> System.EventHandler? +Microsoft.AspNetCore.Components.QuickGrid.Paginator +Microsoft.AspNetCore.Components.QuickGrid.Paginator.Dispose() -> void +Microsoft.AspNetCore.Components.QuickGrid.Paginator.Paginator() -> void +Microsoft.AspNetCore.Components.QuickGrid.Paginator.SummaryTemplate.get -> Microsoft.AspNetCore.Components.RenderFragment? +Microsoft.AspNetCore.Components.QuickGrid.Paginator.SummaryTemplate.set -> void +Microsoft.AspNetCore.Components.QuickGrid.Paginator.Value.get -> Microsoft.AspNetCore.Components.QuickGrid.PaginationState! +Microsoft.AspNetCore.Components.QuickGrid.Paginator.Value.set -> void +Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn +Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn.Format.get -> string? +Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn.Format.set -> void +Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn.Property.get -> System.Linq.Expressions.Expression!>! +Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn.Property.set -> void +Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn.PropertyColumn() -> void +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.ChildContent.get -> Microsoft.AspNetCore.Components.RenderFragment? +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.ChildContent.set -> void +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.Class.get -> string? +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.Class.set -> void +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.DisposeAsync() -> System.Threading.Tasks.ValueTask +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.ItemKey.get -> System.Func! +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.ItemKey.set -> void +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.Items.get -> System.Linq.IQueryable? +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.Items.set -> void +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.ItemSize.get -> float +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.ItemSize.set -> void +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.ItemsProvider.get -> Microsoft.AspNetCore.Components.QuickGrid.GridItemsProvider? +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.ItemsProvider.set -> void +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.Pagination.get -> Microsoft.AspNetCore.Components.QuickGrid.PaginationState? +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.Pagination.set -> void +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.QuickGrid() -> void +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.RefreshDataAsync() -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.ResizableColumns.get -> bool +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.ResizableColumns.set -> void +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.ShowColumnOptions(Microsoft.AspNetCore.Components.QuickGrid.ColumnBase! column) -> void +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.SortByColumnAsync(Microsoft.AspNetCore.Components.QuickGrid.ColumnBase! column, Microsoft.AspNetCore.Components.QuickGrid.SortDirection direction = Microsoft.AspNetCore.Components.QuickGrid.SortDirection.Auto) -> System.Threading.Tasks.Task! +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.Theme.get -> string? +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.Theme.set -> void +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.Virtualize.get -> bool +Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.Virtualize.set -> void +Microsoft.AspNetCore.Components.QuickGrid.SortDirection +Microsoft.AspNetCore.Components.QuickGrid.SortDirection.Ascending = 0 -> Microsoft.AspNetCore.Components.QuickGrid.SortDirection +Microsoft.AspNetCore.Components.QuickGrid.SortDirection.Auto = 2 -> Microsoft.AspNetCore.Components.QuickGrid.SortDirection +Microsoft.AspNetCore.Components.QuickGrid.SortDirection.Descending = 1 -> Microsoft.AspNetCore.Components.QuickGrid.SortDirection +Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn +Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.ChildContent.get -> Microsoft.AspNetCore.Components.RenderFragment! +Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.ChildContent.set -> void +Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.SortBy.get -> Microsoft.AspNetCore.Components.QuickGrid.GridSort? +Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.SortBy.set -> void +Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.TemplateColumn() -> void +override Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.Defer.BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder! builder) -> void +override Microsoft.AspNetCore.Components.QuickGrid.PaginationState.GetHashCode() -> int +override Microsoft.AspNetCore.Components.QuickGrid.Paginator.OnParametersSet() -> void +override Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn.CellContent(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder! builder, TGridItem item) -> void +override Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn.OnParametersSet() -> void +override Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.OnAfterRenderAsync(bool firstRender) -> System.Threading.Tasks.Task! +override Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.OnParametersSetAsync() -> System.Threading.Tasks.Task! +override Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.CellContent(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder! builder, TGridItem item) -> void +override Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.IsSortableByDefault() -> bool +static Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult.From(System.Collections.Generic.ICollection! items, int totalItemCount) -> Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult +static Microsoft.AspNetCore.Components.QuickGrid.GridSort.ByAscending(System.Linq.Expressions.Expression!>! expression) -> Microsoft.AspNetCore.Components.QuickGrid.GridSort! +static Microsoft.AspNetCore.Components.QuickGrid.GridSort.ByDescending(System.Linq.Expressions.Expression!>! expression) -> Microsoft.AspNetCore.Components.QuickGrid.GridSort! diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs index 088fe9349874..6e3ca6534792 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs @@ -110,8 +110,8 @@ public partial class QuickGrid : IAsyncDisposable // We cascade the InternalGridContext to descendants, which in turn call it to add themselves to _columns // This happens on every render so that the column list can be updated dynamically - private InternalGridContext _internalGridContext; - private List> _columns; + private readonly InternalGridContext _internalGridContext; + private readonly List> _columns; private bool _collectingColumns; // Columns might re-render themselves arbitrarily. We only want to capture them at a defined time. // Tracking state for options and sorting @@ -198,7 +198,9 @@ protected override async Task OnAfterRenderAsync(bool firstRender) if (_checkColumnOptionsPosition && _displayOptionsForColumn is not null) { _checkColumnOptionsPosition = false; +#pragma warning disable CA2012 // Use ValueTasks correctly _ = _jsModule?.InvokeVoidAsync("checkColumnOptionsPosition", _tableReference); +#pragma warning restore CA2012 // Use ValueTasks correctly } } From 9cb44d7078f241f98b736a4116a46badef90a3b0 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Wed, 8 Feb 2023 17:47:49 -0700 Subject: [PATCH 03/18] stamp out last build warnings --- .../EntityFrameworkAsyncQueryExecutor.cs | 2 +- ...ts.QuickGrid.EntityFrameworkAdapter.csproj | 5 +- .../Columns/ColumnBase.razor | 94 +------------------ .../Columns/ColumnBase.razor.cs | 93 ++++++++++++++++++ ...oft.AspNetCore.Components.QuickGrid.csproj | 1 + .../Pagination/Paginator.razor | 2 +- .../PublicAPI.Unshipped.txt | 25 +++++ .../QuickGrid.razor | 2 + .../QuickGrid.razor.cs | 4 +- .../_Imports.razor | 5 - 10 files changed, 130 insertions(+), 103 deletions(-) delete mode 100644 src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/_Imports.razor diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAsyncQueryExecutor.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAsyncQueryExecutor.cs index 6bc9ca68006e..842826013dd9 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAsyncQueryExecutor.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAsyncQueryExecutor.cs @@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter; -internal class EntityFrameworkAsyncQueryExecutor : IAsyncQueryExecutor +internal sealed class EntityFrameworkAsyncQueryExecutor : IAsyncQueryExecutor { public bool IsSupported(IQueryable queryable) => queryable.Provider is IAsyncQueryProvider; diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj index 60b5fae5a8b6..ae31f58abccb 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj @@ -1,7 +1,8 @@ - + $(DefaultNetCoreTargetFramework) + enable @@ -11,5 +12,5 @@ - + diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor index 42567a30fc34..0915b8892463 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor @@ -1,101 +1,13 @@ -@using Microsoft.AspNetCore.Components.Rendering +@using Microsoft.AspNetCore.Components.Rendering +@using Microsoft.AspNetCore.Components.Web.Virtualization; @namespace Microsoft.AspNetCore.Components.QuickGrid @typeparam TGridItem @{ InternalGridContext.Grid.AddColumn(this, IsDefaultSort); } + @code { - [CascadingParameter] internal InternalGridContext InternalGridContext { get; set; } = default!; - - /// - /// Title text for the column. This is rendered automatically if is not used. - /// - [Parameter] public string? Title { get; set; } - - /// - /// An optional CSS class name. If specified, this is included in the class attribute of table header and body cells - /// for this column. - /// - [Parameter] public string? Class { get; set; } - - /// - /// If specified, controls the justification of table header and body cells for this column. - /// - [Parameter] public Align Align { get; set; } - - /// - /// An optional template for this column's header cell. If not specified, the default header template - /// includes the along with any applicable sort indicators and options buttons. - /// - [Parameter] public RenderFragment>? HeaderTemplate { get; set; } - - /// - /// If specified, indicates that this column has this associated options UI. A button to display this - /// UI will be included in the header cell by default. - /// - /// If is used, it is left up to that template to render any relevant - /// "show options" UI and invoke the grid's ). - /// - [Parameter] public RenderFragment? ColumnOptions { get; set; } - - /// - /// Indicates whether the data should be sortable by this column. - /// - /// The default value may vary according to the column type (for example, a - /// is sortable by default if any parameter is specified). - /// - [Parameter] public bool? Sortable { get; set; } - - /// - /// If specified and not null, indicates that this column represents the initial sort order - /// for the grid. The supplied value controls the default sort direction. - /// - [Parameter] public SortDirection? IsDefaultSort { get; set; } - - /// - /// If specified, virtualized grids will use this template to render cells whose data has not yet been loaded. - /// - [Parameter] public RenderFragment? PlaceholderTemplate { get; set; } - - /// - /// Gets a reference to the enclosing . - /// - public QuickGrid Grid => InternalGridContext.Grid; - - /// - /// Overridden by derived components to provide rendering logic for the column's cells. - /// - /// The current . - /// The data for the row being rendered. - protected internal abstract void CellContent(RenderTreeBuilder builder, TGridItem item); - - /// - /// Gets or sets a that will be rendered for this column's header cell. - /// This allows derived components to change the header output. However, derived components are then - /// responsible for using within that new output if they want to continue - /// respecting that option. - /// - protected internal RenderFragment HeaderContent { get; protected set; } - - /// - /// Get a value indicating whether this column should act as sortable if no value was set for the - /// parameter. The default behavior is not to be - /// sortable unless is true. - /// - /// Derived components may override this to implement alternative default sortability rules. - /// - /// True if the column should be sortable by default, otherwise false. - protected virtual bool IsSortableByDefault() => false; - - /// - /// Constructs an instance of . - /// - public ColumnBase() - { - HeaderContent = RenderDefaultHeaderContent; - } - private void RenderDefaultHeaderContent(RenderTreeBuilder __builder) { @if (HeaderTemplate is not null) diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.cs index 382ea01d576f..6854a0de0479 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.cs @@ -1,6 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; +using Microsoft.AspNetCore.Components.Rendering; +using Microsoft.AspNetCore.Components.Web.Virtualization; + namespace Microsoft.AspNetCore.Components.QuickGrid; /// @@ -9,4 +13,93 @@ namespace Microsoft.AspNetCore.Components.QuickGrid; /// The type of data represented by each row in the grid. public abstract partial class ColumnBase { + [CascadingParameter] internal InternalGridContext InternalGridContext { get; set; } = default!; + + /// + /// Title text for the column. This is rendered automatically if is not used. + /// + [Parameter] public string? Title { get; set; } + + /// + /// An optional CSS class name. If specified, this is included in the class attribute of table header and body cells + /// for this column. + /// + [Parameter] public string? Class { get; set; } + + /// + /// If specified, controls the justification of table header and body cells for this column. + /// + [Parameter] public Align Align { get; set; } + + /// + /// An optional template for this column's header cell. If not specified, the default header template + /// includes the along with any applicable sort indicators and options buttons. + /// + [Parameter] public RenderFragment>? HeaderTemplate { get; set; } + + /// + /// If specified, indicates that this column has this associated options UI. A button to display this + /// UI will be included in the header cell by default. + /// + /// If is used, it is left up to that template to render any relevant + /// "show options" UI and invoke the grid's ). + /// + [Parameter] public RenderFragment? ColumnOptions { get; set; } + + /// + /// Indicates whether the data should be sortable by this column. + /// + /// The default value may vary according to the column type (for example, a + /// is sortable by default if any parameter is specified). + /// + [Parameter] public bool? Sortable { get; set; } + + /// + /// If specified and not null, indicates that this column represents the initial sort order + /// for the grid. The supplied value controls the default sort direction. + /// + [Parameter] public SortDirection? IsDefaultSort { get; set; } + + /// + /// If specified, virtualized grids will use this template to render cells whose data has not yet been loaded. + /// + [Parameter] public RenderFragment? PlaceholderTemplate { get; set; } + + /// + /// Gets a reference to the enclosing . + /// + public QuickGrid Grid => InternalGridContext.Grid; + + /// + /// Overridden by derived components to provide rendering logic for the column's cells. + /// + /// The current . + /// The data for the row being rendered. + protected internal abstract void CellContent(RenderTreeBuilder builder, TGridItem item); + + /// + /// Gets or sets a that will be rendered for this column's header cell. + /// This allows derived components to change the header output. However, derived components are then + /// responsible for using within that new output if they want to continue + /// respecting that option. + /// + protected internal RenderFragment HeaderContent { get; protected set; } + + /// + /// Get a value indicating whether this column should act as sortable if no value was set for the + /// parameter. The default behavior is not to be + /// sortable unless is true. + /// + /// Derived components may override this to implement alternative default sortability rules. + /// + /// True if the column should be sortable by default, otherwise false. + protected virtual bool IsSortableByDefault() => false; + + /// + /// Constructs an instance of . + /// + public ColumnBase() + { + HeaderContent = RenderDefaultHeaderContent; + } } diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj index 96a59d9423b0..c488c0b573eb 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj @@ -3,6 +3,7 @@ $(DefaultNetCoreTargetFramework) Provides a simple and convenient data grid component for common grid rendering scenarios and serves as a reference architecture and performance baseline for building data grid components. + enable true diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor index 93b85584e9e8..7809f246a03d 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor @@ -1,4 +1,4 @@ -@namespace Microsoft.AspNetCore.Components.QuickGrid +@namespace Microsoft.AspNetCore.Components.QuickGrid
@if (Value.TotalItemCount.HasValue) diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Unshipped.txt b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Unshipped.txt index 26376e2aa90a..8791408e3b33 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Unshipped.txt +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Unshipped.txt @@ -1,9 +1,30 @@ #nullable enable +abstract Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.CellContent(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder! builder, TGridItem item) -> void Microsoft.AspNetCore.Components.QuickGrid.Align Microsoft.AspNetCore.Components.QuickGrid.Align.Center = 1 -> Microsoft.AspNetCore.Components.QuickGrid.Align Microsoft.AspNetCore.Components.QuickGrid.Align.Left = 0 -> Microsoft.AspNetCore.Components.QuickGrid.Align Microsoft.AspNetCore.Components.QuickGrid.Align.Right = 2 -> Microsoft.AspNetCore.Components.QuickGrid.Align Microsoft.AspNetCore.Components.QuickGrid.ColumnBase +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.Align.get -> Microsoft.AspNetCore.Components.QuickGrid.Align +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.Align.set -> void +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.Class.get -> string? +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.Class.set -> void +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.ColumnBase() -> void +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.ColumnOptions.get -> Microsoft.AspNetCore.Components.RenderFragment? +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.ColumnOptions.set -> void +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.Grid.get -> Microsoft.AspNetCore.Components.QuickGrid.QuickGrid! +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.HeaderContent.get -> Microsoft.AspNetCore.Components.RenderFragment! +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.HeaderContent.set -> void +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.HeaderTemplate.get -> Microsoft.AspNetCore.Components.RenderFragment!>? +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.HeaderTemplate.set -> void +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.IsDefaultSort.get -> Microsoft.AspNetCore.Components.QuickGrid.SortDirection? +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.IsDefaultSort.set -> void +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.PlaceholderTemplate.get -> Microsoft.AspNetCore.Components.RenderFragment? +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.PlaceholderTemplate.set -> void +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.Sortable.get -> bool? +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.Sortable.set -> void +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.Title.get -> string? +Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.Title.set -> void Microsoft.AspNetCore.Components.QuickGrid.GridItemsProvider Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderRequest Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderRequest.ApplySorting(System.Linq.IQueryable! source) -> System.Linq.IQueryable! @@ -110,3 +131,7 @@ override Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.IsS static Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult.From(System.Collections.Generic.ICollection! items, int totalItemCount) -> Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult static Microsoft.AspNetCore.Components.QuickGrid.GridSort.ByAscending(System.Linq.Expressions.Expression!>! expression) -> Microsoft.AspNetCore.Components.QuickGrid.GridSort! static Microsoft.AspNetCore.Components.QuickGrid.GridSort.ByDescending(System.Linq.Expressions.Expression!>! expression) -> Microsoft.AspNetCore.Components.QuickGrid.GridSort! +virtual Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.IsSortableByDefault() -> bool +~override Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) -> void +~override Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) -> void +~override Microsoft.AspNetCore.Components.QuickGrid.Paginator.BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) -> void diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor index 08066a0a5e48..ad8661bc90fe 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor @@ -1,4 +1,6 @@ +@using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; @using Microsoft.AspNetCore.Components.Rendering +@using Microsoft.AspNetCore.Components.Web.Virtualization; @typeparam TGridItem @{ StartCollectingColumns(); } diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs index 6e3ca6534792..8374b645a942 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs @@ -198,9 +198,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender) if (_checkColumnOptionsPosition && _displayOptionsForColumn is not null) { _checkColumnOptionsPosition = false; -#pragma warning disable CA2012 // Use ValueTasks correctly - _ = _jsModule?.InvokeVoidAsync("checkColumnOptionsPosition", _tableReference); -#pragma warning restore CA2012 // Use ValueTasks correctly + _ = _jsModule?.InvokeVoidAsync("checkColumnOptionsPosition", _tableReference).AsTask(); } } diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/_Imports.razor b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/_Imports.razor deleted file mode 100644 index 5110695b1bd2..000000000000 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/_Imports.razor +++ /dev/null @@ -1,5 +0,0 @@ -@using Microsoft.AspNetCore.Components.Web -@using Microsoft.AspNetCore.Components.Web.Virtualization -@using Microsoft.JSInterop -@using Microsoft.AspNetCore.Components.QuickGrid -@using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure From 221552474751f748589b6f5e7dc6b04146935879 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Thu, 9 Feb 2023 11:00:48 -0700 Subject: [PATCH 04/18] Appease invalid IDE0051 errors --- .../Pagination/Paginator.razor | 8 ++++++++ .../Pagination/Paginator.razor.cs | 5 ----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor index 7809f246a03d..294e02cc1cd5 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor @@ -25,3 +25,11 @@ }
+ +@code +{ + private Task GoFirstAsync() => GoToPageAsync(0); + private Task GoPreviousAsync() => GoToPageAsync(Value.CurrentPageIndex - 1); + private Task GoNextAsync() => GoToPageAsync(Value.CurrentPageIndex + 1); + private Task GoLastAsync() => GoToPageAsync(Value.LastPageIndex.GetValueOrDefault(0)); +} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs index 8783ef6575d3..afdfe9d7e763 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs @@ -31,11 +31,6 @@ public Paginator() _totalItemCountChanged = new(new EventCallback(this, null)); } - private Task GoFirstAsync() => GoToPageAsync(0); - private Task GoPreviousAsync() => GoToPageAsync(Value.CurrentPageIndex - 1); - private Task GoNextAsync() => GoToPageAsync(Value.CurrentPageIndex + 1); - private Task GoLastAsync() => GoToPageAsync(Value.LastPageIndex.GetValueOrDefault(0)); - private bool CanGoBack => Value.CurrentPageIndex > 0; private bool CanGoForwards => Value.CurrentPageIndex < Value.LastPageIndex; From 5d5f38ab601e8ba2ee66a75875ec48c52f147722 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Thu, 9 Feb 2023 11:15:49 -0700 Subject: [PATCH 05/18] Implement IDE suggestions for perf and simplicity --- .../Columns/GridSort.cs | 17 +++++++++-------- .../GridItemsProviderRequest.cs | 2 +- .../GridItemsProviderResult.cs | 2 +- .../QuickGrid.razor.cs | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs index 5b6e9a587454..2c7f2a845c50 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs @@ -38,7 +38,7 @@ internal GridSort(Func, bool, IOrderedQueryable /// An expression defining how a set of instances are to be sorted. /// A instance representing the specified sorting rule. public static GridSort ByAscending(Expression> expression) - => new GridSort((queryable, asc) => asc ? queryable.OrderBy(expression) : queryable.OrderByDescending(expression), + => new((queryable, asc) => asc ? queryable.OrderBy(expression) : queryable.OrderByDescending(expression), (expression, true)); /// @@ -48,7 +48,7 @@ public static GridSort ByAscending(Expression> /// An expression defining how a set of instances are to be sorted. /// A instance representing the specified sorting rule. public static GridSort ByDescending(Expression> expression) - => new GridSort((queryable, asc) => asc ? queryable.OrderByDescending(expression) : queryable.OrderBy(expression), + => new((queryable, asc) => asc ? queryable.OrderByDescending(expression) : queryable.OrderBy(expression), (expression, false)); /// @@ -114,10 +114,12 @@ internal IOrderedQueryable Apply(IQueryable queryable, boo } } - private IReadOnlyCollection<(string PropertyName, SortDirection Direction)> BuildPropertyList(bool ascending) + private List<(string PropertyName, SortDirection Direction)> BuildPropertyList(bool ascending) { - var result = new List<(string, SortDirection)>(); - result.Add((ToPropertyName(_firstExpression.Item1), (_firstExpression.Item2 ^ ascending) ? SortDirection.Descending : SortDirection.Ascending)); + var result = new List<(string, SortDirection)> + { + (ToPropertyName(_firstExpression.Item1), (_firstExpression.Item2 ^ ascending) ? SortDirection.Descending : SortDirection.Ascending) + }; if (_thenExpressions is not null) { @@ -133,8 +135,7 @@ internal IOrderedQueryable Apply(IQueryable queryable, boo // Not sure we really want this level of complexity, but it converts expressions like @(c => c.Medals.Gold) to "Medals.Gold" private static string ToPropertyName(LambdaExpression expression) { - var body = expression.Body as MemberExpression; - if (body is null) + if (expression.Body is not MemberExpression body) { throw new ArgumentException(ExpressionNotRepresentableMessage); } @@ -172,7 +173,7 @@ private static string ToPropertyName(LambdaExpression expression) while (body is not null) { nextPos -= body.Member.Name.Length; - body.Member.Name.CopyTo(chars.Slice(nextPos)); + body.Member.Name.CopyTo(chars[nextPos..]); if (nextPos > 0) { chars[--nextPos] = '.'; diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderRequest.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderRequest.cs index 2d9494a3fc10..748121ebdef3 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderRequest.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderRequest.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Components.QuickGrid; /// Parameters for data to be supplied by a 's . /// /// The type of data represented by each row in the grid. -public struct GridItemsProviderRequest +public readonly struct GridItemsProviderRequest { /// /// The zero-based index of the first item to be supplied. diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderResult.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderResult.cs index 9bdbe25d9a76..7732a6360a44 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderResult.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderResult.cs @@ -49,5 +49,5 @@ public static class GridItemsProviderResult /// The total numer of items that exist. See for details. /// An instance of . public static GridItemsProviderResult From(ICollection items, int totalItemCount) - => new GridItemsProviderResult(items, totalItemCount); + => new(items, totalItemCount); } diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs index 8374b645a942..add86377ad64 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs @@ -240,7 +240,7 @@ public Task SortByColumnAsync(ColumnBase column, SortDirection direct { SortDirection.Ascending => true, SortDirection.Descending => false, - SortDirection.Auto => _sortByColumn == column ? !_sortByAscending : true, + SortDirection.Auto => _sortByColumn != column || !_sortByAscending, _ => throw new NotSupportedException($"Unknown sort direction {direction}"), }; From ce7dfecd7481657a64eb6e02c594e067edc4e53a Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Fri, 10 Feb 2023 11:21:04 -0700 Subject: [PATCH 06/18] Resolve missing references and manually validate basic example --- eng/ProjectReferences.props | 2 ++ eng/TrimmableProjects.props | 2 ++ ...ts.QuickGrid.EntityFrameworkAdapter.csproj | 6 ++--- .../Columns/ColumnBase.razor | 3 ++- .../Pagination/Paginator.razor | 11 ++------ .../Pagination/Paginator.razor.cs | 5 ++++ .../QuickGrid.razor | 5 ++-- .../Web.JS/dist/Release/blazor.server.js | 2 +- .../BasicTestApp/BasicTestApp.csproj | 1 + .../test/testassets/BasicTestApp/Index.razor | 1 + .../SimpleQuickGridComponent.razor | 25 +++++++++++++++++++ 11 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 src/Components/test/testassets/BasicTestApp/QuickGridTest/SimpleQuickGridComponent.razor diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props index 34e46979bfb2..ccfa53236766 100644 --- a/eng/ProjectReferences.props +++ b/eng/ProjectReferences.props @@ -141,6 +141,8 @@ + + diff --git a/eng/TrimmableProjects.props b/eng/TrimmableProjects.props index de2fe7826834..e382bf646815 100644 --- a/eng/TrimmableProjects.props +++ b/eng/TrimmableProjects.props @@ -88,6 +88,8 @@ + + diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj index ae31f58abccb..32842be5aab9 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj @@ -3,14 +3,12 @@ $(DefaultNetCoreTargetFramework) enable + true - - - - + diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor index 0915b8892463..0d8023a5db29 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor @@ -1,5 +1,6 @@ @using Microsoft.AspNetCore.Components.Rendering -@using Microsoft.AspNetCore.Components.Web.Virtualization; +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.Web.Virtualization @namespace Microsoft.AspNetCore.Components.QuickGrid @typeparam TGridItem @{ diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor index 294e02cc1cd5..a196ea0465e9 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor @@ -1,4 +1,5 @@ -@namespace Microsoft.AspNetCore.Components.QuickGrid +@using Microsoft.AspNetCore.Components.Web +@namespace Microsoft.AspNetCore.Components.QuickGrid
@if (Value.TotalItemCount.HasValue) @@ -25,11 +26,3 @@ }
- -@code -{ - private Task GoFirstAsync() => GoToPageAsync(0); - private Task GoPreviousAsync() => GoToPageAsync(Value.CurrentPageIndex - 1); - private Task GoNextAsync() => GoToPageAsync(Value.CurrentPageIndex + 1); - private Task GoLastAsync() => GoToPageAsync(Value.LastPageIndex.GetValueOrDefault(0)); -} diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs index afdfe9d7e763..8783ef6575d3 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs @@ -31,6 +31,11 @@ public Paginator() _totalItemCountChanged = new(new EventCallback(this, null)); } + private Task GoFirstAsync() => GoToPageAsync(0); + private Task GoPreviousAsync() => GoToPageAsync(Value.CurrentPageIndex - 1); + private Task GoNextAsync() => GoToPageAsync(Value.CurrentPageIndex + 1); + private Task GoLastAsync() => GoToPageAsync(Value.LastPageIndex.GetValueOrDefault(0)); + private bool CanGoBack => Value.CurrentPageIndex > 0; private bool CanGoForwards => Value.CurrentPageIndex < Value.LastPageIndex; diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor index ad8661bc90fe..3f59e7f07949 100644 --- a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor +++ b/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor @@ -1,6 +1,7 @@ -@using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; +@using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure @using Microsoft.AspNetCore.Components.Rendering -@using Microsoft.AspNetCore.Components.Web.Virtualization; +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.Web.Virtualization @typeparam TGridItem @{ StartCollectingColumns(); } diff --git a/src/Components/Web.JS/dist/Release/blazor.server.js b/src/Components/Web.JS/dist/Release/blazor.server.js index 561db21ea0e2..26aba76edb44 100644 --- a/src/Components/Web.JS/dist/Release/blazor.server.js +++ b/src/Components/Web.JS/dist/Release/blazor.server.js @@ -1 +1 @@ -(()=>{"use strict";var e,t,n,r={};r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),function(e){window.DotNet=e;const t=[],n=new Map,r=new Map,o="__jsObjectId",i="__byte[]";class s{constructor(e){this._jsObject=e,this._cachedFunctions=new Map}findFunction(e){const t=this._cachedFunctions.get(e);if(t)return t;let n,r=this._jsObject;if(e.split(".").forEach((t=>{if(!(t in r))throw new Error(`Could not find '${e}' ('${t}' was undefined).`);n=r,r=r[t]})),r instanceof Function)return r=r.bind(n),this._cachedFunctions.set(e,r),r;throw new Error(`The value '${e}' is not a function.`)}getWrappedObject(){return this._jsObject}}const a={},c={0:new s(window)};c[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let l,h=1,u=1,d=null;function p(e){t.push(e)}function f(e){if(e&&"object"==typeof e){c[u]=new s(e);const t={[o]:u};return u++,t}throw new Error(`Cannot create a JSObjectReference from the value '${e}'.`)}function g(e){let t=-1;if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Blob)t=e.size;else{if(!(e.buffer instanceof ArrayBuffer))throw new Error("Supplied value is not a typed array or blob.");if(void 0===e.byteLength)throw new Error(`Cannot create a JSStreamReference from the value '${e}' as it doesn't have a byteLength.`);t=e.byteLength}const n={__jsStreamReferenceLength:t};try{const t=f(e);n.__jsObjectId=t.__jsObjectId}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return n}function m(e){return e?JSON.parse(e,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null}function y(e,t,n,r){const o=v();if(o.invokeDotNetFromJS){const i=D(r),s=o.invokeDotNetFromJS(e,t,n,i);return s?m(s):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeMethodAsync instead.")}function w(e,t,n,r){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const o=h++,i=new Promise(((e,t)=>{a[o]={resolve:e,reject:t}}));try{const i=D(r);v().beginInvokeDotNetFromJS(o,e,t,n,i)}catch(e){b(o,!1,e)}return i}function v(){if(null!==d)return d;throw new Error("No .NET call dispatcher has been set.")}function b(e,t,n){if(!a.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const r=a[e];delete a[e],t?r.resolve(n):r.reject(n)}function _(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function E(e,t){const n=c[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function S(e){delete c[e]}e.attachDispatcher=function(e){d=e},e.attachReviver=p,e.invokeMethod=function(e,t,...n){return y(e,t,null,n)},e.invokeMethodAsync=function(e,t,...n){return w(e,t,null,n)},e.createJSObjectReference=f,e.createJSStreamReference=g,e.disposeJSObjectReference=function(e){const t=e&&e.__jsObjectId;"number"==typeof t&&S(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(l=e.JSCallResultType||(e.JSCallResultType={})),e.jsCallDispatcher={findJSFunction:E,disposeJSObjectReferenceById:S,invokeJSFromDotNet:(e,t,n,r)=>{const o=T(E(e,r).apply(null,m(t)),n);return null==o?null:D(o)},beginInvokeJSFromDotNet:(e,t,n,r,o)=>{const i=new Promise((e=>{e(E(t,o).apply(null,m(n)))}));e&&i.then((t=>D([e,!0,T(t,r)]))).then((t=>v().endInvokeJSFromDotNet(e,!0,t)),(t=>v().endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,_(t)]))))},endInvokeDotNetFromJS:(e,t,n)=>{const r=t?m(n):new Error(n);b(parseInt(e,10),t,r)},receiveByteArray:(e,t)=>{n.set(e,t)},supplyDotNetStream:(e,t)=>{if(r.has(e)){const n=r.get(e);r.delete(e),n.resolve(t)}else{const n=new k;n.resolve(t),r.set(e,n)}}};class C{constructor(e){this._id=e}invokeMethod(e,...t){return y(null,e,this._id,t)}invokeMethodAsync(e,...t){return w(null,e,this._id,t)}dispose(){w(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{__dotNetObject:this._id}}}e.DotNetObject=C,p((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty("__dotNetObject"))return new C(t.__dotNetObject);if(t.hasOwnProperty(o)){const e=t.__jsObjectId,n=c[e];if(n)return n.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(i)){const e=t["__byte[]"],r=n.get(e);if(void 0===r)throw new Error(`Byte array index '${e}' does not exist.`);return n.delete(e),r}if(t.hasOwnProperty("__dotNetStream"))return new I(t.__dotNetStream)}return t}));class I{constructor(e){if(r.has(e))this._streamPromise=r.get(e).streamPromise,r.delete(e);else{const t=new k;r.set(e,t),this._streamPromise=t.streamPromise}}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class k{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function T(e,t){switch(t){case l.Default:return e;case l.JSObjectReference:return f(e);case l.JSStreamReference:return g(e);case l.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let x=0;function D(e){return x=0,JSON.stringify(e,R)}function R(e,t){if(t instanceof C)return t.serializeAsArg();if(t instanceof Uint8Array){d.sendByteArray(x,t);const e={[i]:x};return x++,e}return t}}(e||(e={})),function(e){e[e.prependFrame=1]="prependFrame",e[e.removeFrame=2]="removeFrame",e[e.setAttribute=3]="setAttribute",e[e.removeAttribute=4]="removeAttribute",e[e.updateText=5]="updateText",e[e.stepIn=6]="stepIn",e[e.stepOut=7]="stepOut",e[e.updateMarkup=8]="updateMarkup",e[e.permutationListEntry=9]="permutationListEntry",e[e.permutationListEnd=10]="permutationListEnd"}(t||(t={})),function(e){e[e.element=1]="element",e[e.text=2]="text",e[e.attribute=3]="attribute",e[e.component=4]="component",e[e.region=5]="region",e[e.elementReferenceCapture=6]="elementReferenceCapture",e[e.markup=8]="markup"}(n||(n={}));class o{constructor(e,t){this.componentId=e,this.fieldValue=t}static fromEvent(e,t){const n=t.target;if(n instanceof Element){const t=function(e){return e instanceof HTMLInputElement?e.type&&"checkbox"===e.type.toLowerCase()?{value:e.checked}:{value:e.value}:e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement?{value:e.value}:null}(n);if(t)return new o(e,t.value)}return null}}const i=new Map,s=new Map,a=[];function c(e){return i.get(e)}function l(e){const t=i.get(e);return(null==t?void 0:t.browserEventName)||e}function h(e,t){e.forEach((e=>i.set(e,t)))}function u(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}{const e=function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t);return{value:e?!!t.checked:t.value}}}}),h(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),h(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...d(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),h(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),h(["keydown","keyup","keypress"],{createEventArgs:e=>{return{key:(t=e).key,code:t.code,location:t.location,repeat:t.repeat,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),h(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>d(e)}),h(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno,type:t.type};var t}}),h(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total,type:t.type};var t}}),h(["touchcancel","touchend","touchmove","touchenter","touchleave","touchstart"],{createEventArgs:e=>{return{detail:(t=e).detail,touches:u(t.touches),targetTouches:u(t.targetTouches),changedTouches:u(t.changedTouches),ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),h(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...d(t=e),pointerId:t.pointerId,width:t.width,height:t.height,pressure:t.pressure,tiltX:t.tiltX,tiltY:t.tiltY,pointerType:t.pointerType,isPrimary:t.isPrimary};var t}}),h(["wheel","mousewheel"],{createEventArgs:e=>{return{...d(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),h(["toggle"],{createEventArgs:()=>({})});const p=["date","datetime-local","month","time","week"],f=new Map;let g,m,y=0;const w={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const r="__bl-dynamic-root:"+(++y).toString();f.set(r,e);const o=await _().invokeMethodAsync("AddRootComponent",t,r),i=new b(o,m[t]);return await i.setParameters(n),i}};class v{invoke(e){return this._callback(e)}setCallback(t){this._selfJSObjectReference||(this._selfJSObjectReference=e.createJSObjectReference(this)),this._callback=t}getJSObjectReference(){return this._selfJSObjectReference}dispose(){this._selfJSObjectReference&&e.disposeJSObjectReference(this._selfJSObjectReference)}}class b{constructor(e,t){this._jsEventCallbackWrappers=new Map,this._componentId=e;for(const e of t)"eventcallback"===e.type&&this._jsEventCallbackWrappers.set(e.name.toLowerCase(),new v)}setParameters(e){const t={},n=Object.entries(e||{}),r=n.length;for(const[e,r]of n){const n=this._jsEventCallbackWrappers.get(e.toLowerCase());n&&r?(n.setCallback(r),t[e]=n.getJSObjectReference()):t[e]=r}return _().invokeMethodAsync("SetRootComponentParameters",this._componentId,r,t)}async dispose(){if(null!==this._componentId){await _().invokeMethodAsync("RemoveRootComponent",this._componentId),this._componentId=null;for(const e of this._jsEventCallbackWrappers.values())e.dispose()}}}function _(){if(!g)throw new Error("Dynamic root components have not been enabled in this application.");return g}const E=new Map;let S;const C=new Promise((e=>{S=e}));function I(e,t,n){return T(e,t.eventHandlerId,(()=>k(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function k(e){const t=E.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let T=(e,t,n)=>n();const x=N(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),D={submit:!0},R=N(["click","dblclick","mousedown","mousemove","mouseup"]);class P{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++P.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new U(this.onGlobalEvent.bind(this))}setListener(e,t,n,r){const o=this.getEventHandlerInfosForElement(e,!0),i=o.getHandler(t);if(i)this.eventInfoStore.update(i.eventHandlerId,n);else{const i={element:e,eventName:t,eventHandlerId:n,renderingComponentId:r};this.eventInfoStore.add(i),o.setHandler(t,i)}}getHandler(e){return this.eventInfoStore.get(e)}removeListener(e){const t=this.eventInfoStore.remove(e);if(t){const e=t.element,n=this.getEventHandlerInfosForElement(e,!1);n&&n.removeHandler(t.eventName)}}notifyAfterClick(e){this.afterClickCallbacks.push(e),this.eventInfoStore.addGlobalListener("click")}setStopPropagation(e,t,n){this.getEventHandlerInfosForElement(e,!0).stopPropagation(t,n)}setPreventDefault(e,t,n){this.getEventHandlerInfosForElement(e,!0).preventDefault(t,n)}onGlobalEvent(e){if(!(e.target instanceof Element))return;this.dispatchGlobalEventToAllElements(e.type,e);const t=(n=e.type,s.get(n));var n;t&&t.forEach((t=>this.dispatchGlobalEventToAllElements(t,e))),"click"===e.type&&this.afterClickCallbacks.forEach((t=>t(e)))}dispatchGlobalEventToAllElements(e,t){const n=t.composedPath();let r=n.shift(),i=null,s=!1;const a=Object.prototype.hasOwnProperty.call(x,e);let l=!1;for(;r;){const d=r,p=this.getEventHandlerInfosForElement(d,!1);if(p){const n=p.getHandler(e);if(n&&(h=d,u=t.type,!((h instanceof HTMLButtonElement||h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(R,u)&&h.disabled))){if(!s){const n=c(e);i=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(D,t.type)&&t.preventDefault(),I(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},i)}p.stopPropagation(e)&&(l=!0),p.preventDefault(e)&&t.preventDefault()}r=a||l?void 0:n.shift()}var h,u}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new A:null}}P.nextEventDelegatorId=0;class U{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},a.push(this.handleEventNameAliasAdded.bind(this))}add(e){if(this.infosByEventHandlerId[e.eventHandlerId])throw new Error(`Event ${e.eventHandlerId} is already tracked`);this.infosByEventHandlerId[e.eventHandlerId]=e,this.addGlobalListener(e.eventName)}get(e){return this.infosByEventHandlerId[e]}addGlobalListener(e){if(e=l(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(x,e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(Object.prototype.hasOwnProperty.call(this.infosByEventHandlerId,t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=l(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(Object.prototype.hasOwnProperty.call(this.countByEventName,e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class A{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return Object.prototype.hasOwnProperty.call(this.handlers,e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function N(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const L=G("_blazorLogicalChildren"),$=G("_blazorLogicalParent"),B=G("_blazorLogicalEnd");function M(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return L in e||(e[L]=[]),e}function O(e,t){const n=document.createComment("!");return F(n,e,t),n}function F(e,t,n){const r=e;if(e instanceof Comment&&J(r)&&J(r).length>0)throw new Error("Not implemented: inserting non-empty logical container");if(H(r))throw new Error("Not implemented: moving existing logical children");const o=J(t);if(n0;)j(n,0)}const r=n;r.parentNode.removeChild(r)}function H(e){return e[$]||null}function W(e,t){return J(e)[t]}function z(e){const t=V(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function J(e){return e[L]}function q(e,t){const n=J(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=Y(e.moveRangeStart)})),t.forEach((t=>{const r=document.createComment("marker");t.moveToBeforeMarker=r;const o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):X(r,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd;let i=r;for(;i;){const e=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=e}n.removeChild(t)})),t.forEach((e=>{n[e.toSiblingIndex]=e.moveRangeStart}))}function V(e){if(e instanceof Element||e instanceof DocumentFragment)return e;if(e instanceof Comment)return e.parentNode;throw new Error("Not a valid logical element")}function K(e){const t=J(H(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function X(e,t){if(t instanceof Element||t instanceof DocumentFragment)t.appendChild(e);else{if(!(t instanceof Comment))throw new Error(`Cannot append node because the parent is not a valid logical element. Parent: ${t}`);{const n=K(t);n?n.parentNode.insertBefore(e,n):X(e,H(t))}}}function Y(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=K(e);if(t)return t.previousSibling;{const t=H(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:Y(t)}}function G(e){return"function"==typeof Symbol?Symbol():e}function Q(e){return`_bl_${e}`}e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"__internalId")&&"string"==typeof t.__internalId?function(e){const t=`[${Q(e)}]`;return document.querySelector(t)}(t.__internalId):t));const Z="_blazorDeferredValue",ee=document.createElement("template"),te=document.createElementNS("http://www.w3.org/2000/svg","g"),ne={},re="__internal_",oe="preventDefault_",ie="stopPropagation_";class se{constructor(e){this.rootComponentIds=new Set,this.childComponentLocations={},this.eventDelegator=new P(e),this.eventDelegator.notifyAfterClick((e=>{if(!fe)return;if(0!==e.button||function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e))return;if(e.defaultPrevented)return;const t=function(e){const t=!window._blazorDisableComposedPath&&e.composedPath&&e.composedPath();if(t){for(let e=0;edocument.baseURI,getLocationHref:()=>location.href};function Ce(e,t,n=!1){const r=Ue(e);!t.forceLoad&&Ne(r)?Ie(r,!1,t.replaceHistoryEntry,t.historyEntryState,n):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Ie(e,t,n,r,o=!1){Te(),(o||!me||await xe(e,r,t))&&(pe=!0,n?history.replaceState({userState:r,_index:ye},"",e):(ye++,history.pushState({userState:r,_index:ye},"",e)),await De(t))}function ke(e){return new Promise((t=>{const n=_e;_e=()=>{_e=n,t()},history.go(e)}))}function Te(){Ee&&(Ee(!1),Ee=null)}function xe(e,t,n){return new Promise((r=>{Te(),be?(we++,Ee=r,be(we,e,t,n)):r(!1)}))}async function De(e){var t;ve&&await ve(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function Re(e){var t,n;_e&&await _e(e),ye=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}let Pe;function Ue(e){return Pe=Pe||document.createElement("a"),Pe.href=e,Pe.href}function Ae(e,t){return e?e.tagName===t?e:Ae(e.parentElement,t):null}function Ne(e){const t=(n=document.baseURI).substring(0,n.lastIndexOf("/"));var n;const r=e.charAt(t.length);return e.startsWith(t)&&(""===r||"/"===r||"?"===r||"#"===r)}const Le={focus:function(e,t){if(e instanceof HTMLElement)e.focus({preventScroll:t});else{if(!(e instanceof SVGElement))throw new Error("Unable to focus an invalid element.");if(!e.hasAttribute("tabindex"))throw new Error("Unable to focus an SVG element that does not have a tabindex.");e.focus({preventScroll:t})}},focusBySelector:function(e){const t=document.querySelector(e);t&&(t.hasAttribute("tabindex")||(t.tabIndex=-1),t.focus())}},$e={init:function(e,t,n,r=50){const o=Me(t);(o||document.documentElement).style.overflowAnchor="none";const i=document.createRange();h(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(r){r.forEach((r=>{var o;if(!r.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const s=i.getBoundingClientRect().height,a=null===(o=r.rootBounds)||void 0===o?void 0:o.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,s,a):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,s,a)}))}),{root:o,rootMargin:`${r}px`});s.observe(t),s.observe(n);const a=l(t),c=l(n);function l(e){const t={attributes:!0},n=new MutationObserver(((n,r)=>{h(e.parentElement)&&(r.disconnect(),e.style.display="table-row",r.observe(e,t)),s.unobserve(e),s.observe(e)}));return n.observe(e,t),n}function h(e){return null!==e&&(e instanceof HTMLTableElement&&""===e.style.display||"table"===e.style.display||e instanceof HTMLTableSectionElement&&""===e.style.display||"table-row-group"===e.style.display)}Be[e._id]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const t=Be[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete Be[e._id])}},Be={};function Me(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:Me(e.parentElement):null}const Oe={getAndRemoveExistingTitle:function(){var e;const t=document.head?document.head.getElementsByTagName("title"):[];if(0===t.length)return null;let n=null;for(let r=t.length-1;r>=0;r--){const o=t[r],i=o.previousSibling;i instanceof Comment&&null!==H(i)||(null===n&&(n=o.textContent),null===(e=o.parentNode)||void 0===e||e.removeChild(o))}return n}},Fe={init:function(e,t){t._blazorInputFileNextFileId=0,t.addEventListener("click",(function(){t.value=""})),t.addEventListener("change",(function(){t._blazorFilesById={};const n=Array.prototype.map.call(t.files,(function(e){const n={id:++t._blazorInputFileNextFileId,lastModified:new Date(e.lastModified).toISOString(),name:e.name,size:e.size,contentType:e.type,readPromise:void 0,arrayBuffer:void 0,blob:e};return t._blazorFilesById[n.id]=n,n}));e.invokeMethodAsync("NotifyChange",n)}))},toImageFile:async function(e,t,n,r,o){const i=je(e,t),s=await new Promise((function(e){const t=new Image;t.onload=function(){URL.revokeObjectURL(t.src),e(t)},t.onerror=function(){t.onerror=null,URL.revokeObjectURL(t.src)},t.src=URL.createObjectURL(i.blob)})),a=await new Promise((function(e){var t;const i=Math.min(1,r/s.width),a=Math.min(1,o/s.height),c=Math.min(i,a),l=document.createElement("canvas");l.width=Math.round(s.width*c),l.height=Math.round(s.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(s,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return je(e,t).blob}};function je(e,t){const n=e._blazorFilesById[t];if(!n)throw new Error(`There is no file with ID ${t}. The file list may have changed. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.`);return n}const He=new Set,We={enableNavigationPrompt:function(e){0===He.size&&window.addEventListener("beforeunload",ze),He.add(e)},disableNavigationPrompt:function(e){He.delete(e),0===He.size&&window.removeEventListener("beforeunload",ze)}};function ze(e){e.preventDefault(),e.returnValue=!0}async function Je(e,t,n){return e instanceof Blob?await async function(e,t,n){const r=e.slice(t,t+n),o=await r.arrayBuffer();return new Uint8Array(o)}(e,t,n):function(e,t,n){return new Uint8Array(e.buffer,e.byteOffset+t,n)}(e,t,n)}const qe=new Map,Ve={navigateTo:function(e,t,n=!1){Ce(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(i.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=s.get(t.browserEventName);n?n.push(e):s.set(t.browserEventName,[e]),a.forEach((n=>n(e,t.browserEventName)))}i.set(e,t)},rootComponents:w,_internal:{navigationManager:Se,domWrapper:Le,Virtualize:$e,PageTitle:Oe,InputFile:Fe,NavigationLock:We,getJSDataStreamChunk:Je,receiveDotNetDataStream:function(t,n,r,o){let i=qe.get(t);if(!i){const n=new ReadableStream({start(e){qe.set(t,e),i=e}});e.jsCallDispatcher.supplyDotNetStream(t,n)}o?(i.error(o),qe.delete(t)):0===r?(i.close(),qe.delete(t)):i.enqueue(n.length===r?n:n.subarray(0,r))},attachWebRendererInterop:function(t,n,r,o){if(E.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);E.set(t,n),Object.keys(r).length>0&&function(t,n,r){if(g)throw new Error("Dynamic root components have already been enabled.");g=t,m=n;for(const[t,o]of Object.entries(r)){const r=e.jsCallDispatcher.findJSFunction(t,0);for(const e of o)r(e,n[e])}}(k(t),r,o),S()}}};window.Blazor=Ve;const Ke=[0,2e3,1e4,3e4,null];class Xe{constructor(e){this._retryDelays=void 0!==e?[...e,null]:Ke}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class Ye{}Ye.Authorization="Authorization",Ye.Cookie="Cookie";class Ge{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class Qe{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}class Ze extends Qe{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&401===n.statusCode&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[Ye.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[Ye.Authorization]&&delete e.headers[Ye.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}class et extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class tt extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class nt extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class rt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class ot extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class it extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class st extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class at extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}var ct,lt,ht,ut,dt;!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(ct||(ct={}));class pt{constructor(){}log(e,t){}}pt.instance=new pt;class ft{static isRequired(e,t){if(null==e)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,n){if(!(e in t))throw new Error(`Unknown ${n} value: ${e}.`)}}class gt{static get isBrowser(){return"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isReactNative(){return"object"==typeof window&&void 0===window.document}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}}function mt(e,t){let n="";return yt(e)?(n=`Binary data of length ${e.byteLength}`,t&&(n+=`. Content: '${function(e){const t=new Uint8Array(e);let n="";return t.forEach((e=>{n+=`0x${e<16?"0":""}${e.toString(16)} `})),n.substr(0,n.length-1)}(e)}'`)):"string"==typeof e&&(n=`String data of length ${e.length}`,t&&(n+=`. Content: '${e}'`)),n}function yt(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function wt(e,t,n,r,o,i){const s={},[a,c]=_t();s[a]=c,e.log(ct.Trace,`(${t} transport) sending data. ${mt(o,i.logMessageContent)}.`);const l=yt(o)?"arraybuffer":"text",h=await n.post(r,{content:o,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(ct.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class vt{constructor(e,t){this._subject=e,this._observer=t}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),0===this._subject.observers.length&&this._subject.cancelCallback&&this._subject.cancelCallback().catch((e=>{}))}}class bt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${ct[e]}: ${t}`;switch(e){case ct.Critical:case ct.Error:this.out.error(n);break;case ct.Warning:this.out.warn(n);break;case ct.Information:this.out.info(n);break;default:this.out.log(n)}}}}function _t(){let e="X-SignalR-User-Agent";return gt.isNode&&(e="User-Agent"),[e,Et("0.0.0-DEV_BUILD",St(),gt.isNode?"NodeJS":"Browser",Ct())]}function Et(e,t,n,r){let o="Microsoft SignalR/";const i=e.split(".");return o+=`${i[0]}.${i[1]}`,o+=` (${e}; `,o+=t&&""!==t?`${t}; `:"Unknown OS; ",o+=`${n}`,o+=r?`; ${r}`:"; Unknown Runtime Version",o+=")",o}function St(){if(!gt.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function Ct(){if(gt.isNode)return process.versions.node}function It(e){return e.stack?e.stack:e.message?e.message:`${e}`}class kt extends Qe{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e=require;this._jar=new(e("tough-cookie").CookieJar),this._fetchType=e("node-fetch"),this._fetchType=e("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("could not find global")}());if("undefined"==typeof AbortController){const e=require;this._abortControllerType=e("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new nt;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const t=new this._abortControllerType;let n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new nt});let r,o=null;if(e.timeout){const r=e.timeout;o=setTimeout((()=>{t.abort(),this._logger.log(ct.Warning,"Timeout from HTTP request."),n=new tt}),r)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},yt(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");try{r=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:!0===e.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(e){if(n)throw n;throw this._logger.log(ct.Warning,`Error from HTTP request. ${e}.`),e}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!r.ok){const e=await Tt(r,"text");throw new et(e||r.statusText,r.status)}const i=Tt(r,e.responseType),s=await i;return new Ge(r.status,r.statusText,s)}getCookieString(e){return""}}function Tt(e,t){let n;switch(t){case"arraybuffer":n=e.arrayBuffer();break;case"text":default:n=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`)}return n}class xt extends Qe{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new nt):e.method?e.url?new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),r.withCredentials=void 0===e.withCredentials||e.withCredentials,r.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===e.content&&(e.content=void 0),e.content&&(yt(e.content)?r.setRequestHeader("Content-Type","application/octet-stream"):r.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach((e=>{r.setRequestHeader(e,o[e])})),e.responseType&&(r.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{r.abort(),n(new nt)}),e.timeout&&(r.timeout=e.timeout),r.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),r.status>=200&&r.status<300?t(new Ge(r.status,r.statusText,r.response||r.responseText)):n(new et(r.response||r.responseText||r.statusText,r.status))},r.onerror=()=>{this._logger.log(ct.Warning,`Error from HTTP request. ${r.status}: ${r.statusText}.`),n(new et(r.statusText,r.status))},r.ontimeout=()=>{this._logger.log(ct.Warning,"Timeout from HTTP request."),n(new tt)},r.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Dt extends Qe{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new kt(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new xt(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new nt):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(lt||(lt={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(ht||(ht={}));class Rt{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}}class Pt{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new Rt,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(ft.isRequired(e,"url"),ft.isRequired(t,"transferFormat"),ft.isIn(t,ht,"transferFormat"),this._url=e,this._logger.log(ct.Trace,"(LongPolling transport) Connecting."),t===ht.Binary&&"undefined"!=typeof XMLHttpRequest&&"string"!=typeof(new XMLHttpRequest).responseType)throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,r]=_t(),o={[n]:r,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===ht.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(ct.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(ct.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new et(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(ct.Trace,`(LongPolling transport) polling: ${n}.`);const r=await this._httpClient.get(n,t);204===r.statusCode?(this._logger.log(ct.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==r.statusCode?(this._logger.log(ct.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this._closeError=new et(r.statusText||"",r.statusCode),this._running=!1):r.content?(this._logger.log(ct.Trace,`(LongPolling transport) data received. ${mt(r.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this._logger.log(ct.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof tt?this._logger.log(ct.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(ct.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(ct.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?wt(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(ct.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(ct.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=_t();e[t]=n;const r={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};await this._httpClient.delete(this._url,r),this._logger.log(ct.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(ct.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(ct.Trace,e),this.onclose(this._closeError)}}}class Ut{constructor(e,t,n,r){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=r,this.onreceive=null,this.onclose=null}async connect(e,t){return ft.isRequired(e,"url"),ft.isRequired(t,"transferFormat"),ft.isIn(t,ht,"transferFormat"),this._logger.log(ct.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,r)=>{let o,i=!1;if(t===ht.Text){if(gt.isBrowser||gt.isWebWorker)o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const t=this._httpClient.getCookieString(e),n={};n.Cookie=t;const[r,i]=_t();n[r]=i,o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...n,...this._options.headers}})}try{o.onmessage=e=>{if(this.onreceive)try{this._logger.log(ct.Trace,`(SSE transport) data received. ${mt(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},o.onerror=e=>{i?this._close():r(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},o.onopen=()=>{this._logger.log(ct.Information,`SSE connected to ${this._url}`),this._eventSource=o,i=!0,n()}}catch(e){return void r(e)}}else r(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(e){return this._eventSource?wt(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class At{constructor(e,t,n,r,o,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=r,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){let n;return ft.isRequired(e,"url"),ft.isRequired(t,"transferFormat"),ft.isIn(t,ht,"transferFormat"),this._logger.log(ct.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((r,o)=>{let i;e=e.replace(/^http/,"ws");const s=this._httpClient.getCookieString(e);let a=!1;if(gt.isReactNative){const t={},[r,o]=_t();t[r]=o,n&&(t[Ye.Authorization]=`Bearer ${n}`),s&&(t[Ye.Cookie]=s),i=new this._webSocketConstructor(e,void 0,{headers:{...t,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===ht.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(ct.Information,`WebSocket connected to ${e}.`),this._webSocket=i,a=!0,r()},i.onerror=e=>{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"There was an error with the transport",this._logger.log(ct.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(ct.Trace,`(WebSockets transport) data received. ${mt(e.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(e.data)}catch(e){return void this._close(e)}},i.onclose=e=>{if(a)this._close(e);else{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(ct.Trace,`(WebSockets transport) sending data. ${mt(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(ct.Trace,"(WebSockets transport) socket closed."),this.onclose&&(!this._isCloseEvent(e)||!1!==e.wasClean&&1e3===e.code?e instanceof Error?this.onclose(e):this.onclose():this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)))}_isCloseEvent(e){return e&&"boolean"==typeof e.wasClean&&"number"==typeof e.code}}class Nt{constructor(e,t={}){var n;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,ft.isRequired(e,"url"),this._logger=void 0===(n=t.logger)?new bt(ct.Information):null===n?pt.instance:void 0!==n.log?n:new bt(n),this.baseUrl=this._resolveUrl(e),(t=t||{}).logMessageContent=void 0!==t.logMessageContent&&t.logMessageContent,"boolean"!=typeof t.withCredentials&&void 0!==t.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.withCredentials=void 0===t.withCredentials||t.withCredentials,t.timeout=void 0===t.timeout?1e5:t.timeout,"undefined"==typeof WebSocket||t.WebSocket||(t.WebSocket=WebSocket),"undefined"==typeof EventSource||t.EventSource||(t.EventSource=EventSource),this._httpClient=new Ze(t.httpClient||new Dt(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||ht.Binary,ft.isIn(e,ht,"transferFormat"),this._logger.log(ct.Debug,`Starting connection with transfer format '${ht[e]}'.`),"Disconnected"!==this._connectionState)return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,"Disconnecting"===this._connectionState){const e="Failed to start the HttpConnection before stop() was called.";return this._logger.log(ct.Error,e),await this._stopPromise,Promise.reject(new nt(e))}if("Connected"!==this._connectionState){const e="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(ct.Error,e),Promise.reject(new nt(e))}this._connectionStarted=!0}send(e){return"Connected"!==this._connectionState?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Lt(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(ct.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(ct.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState="Disconnecting",this._stopPromise=new Promise((e=>{this._stopPromiseResolver=e})),await this._stopInternal(e),void await this._stopPromise)}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch(e){}if(this.transport){try{await this.transport.stop()}catch(e){this._logger.log(ct.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(ct.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport!==lt.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(lt.WebSockets),await this._startTransport(t,e)}else{let n=null,r=0;do{if(n=await this._getNegotiationResponse(t),"Disconnecting"===this._connectionState||"Disconnected"===this._connectionState)throw new nt("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const e=n.accessToken;this._accessTokenFactory=()=>e,this._httpClient._accessToken=e,this._httpClient._accessTokenFactory=void 0}r++}while(n.url&&r<100);if(100===r&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof Pt&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(ct.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(ct.Error,"Failed to start the connection: "+e),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(e)}}async _getNegotiationResponse(e){const t={},[n,r]=_t();t[n]=r;const o=this._resolveNegotiateUrl(e);this._logger.log(ct.Debug,`Sending negotiation request: ${o}.`);try{const e=await this._httpClient.post(o,{content:"",headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(200!==e.statusCode)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${e.statusCode}'`));const n=JSON.parse(e.content);return(!n.negotiateVersion||n.negotiateVersion<1)&&(n.connectionToken=n.connectionId),n}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof et&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(ct.Error,t),Promise.reject(new st(t))}}_createConnectUrl(e,t){return t?e+(-1===e.indexOf("?")?"?":"&")+`id=${t}`:e}async _createTransport(e,t,n,r){let o=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t))return this._logger.log(ct.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(o,r),void(this.connectionId=n.connectionId);const i=[],s=n.availableTransports||[];let a=n;for(const n of s){const s=this._resolveTransportOrError(n,t,r);if(s instanceof Error)i.push(`${n.transport} failed:`),i.push(s);else if(this._isITransport(s)){if(this.transport=s,!a){try{a=await this._getNegotiationResponse(e)}catch(e){return Promise.reject(e)}o=this._createConnectUrl(e,a.connectionToken)}try{return await this._startTransport(o,r),void(this.connectionId=a.connectionId)}catch(e){if(this._logger.log(ct.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new it(`${n.transport} failed: ${e}`,lt[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(ct.Debug,e),Promise.reject(new nt(e))}}}}return i.length>0?Promise.reject(new at(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case lt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new At(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case lt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Ut(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case lt.LongPolling:return new Pt(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n){const r=lt[e.transport];if(null==r)return this._logger.log(ct.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(!function(e,t){return!e||0!=(t&e)}(t,r))return this._logger.log(ct.Debug,`Skipping transport '${lt[r]}' because it was disabled by the client.`),new ot(`'${lt[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>ht[e])).indexOf(n)>=0))return this._logger.log(ct.Debug,`Skipping transport '${lt[r]}' because it does not support the requested transfer format '${ht[n]}'.`),new Error(`'${lt[r]}' does not support ${ht[n]}.`);if(r===lt.WebSockets&&!this._options.WebSocket||r===lt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(ct.Debug,`Skipping transport '${lt[r]}' because it is not supported in your environment.'`),new rt(`'${lt[r]}' is not supported in your environment.`,r);this._logger.log(ct.Debug,`Selecting transport '${lt[r]}'.`);try{return this._constructTransport(r)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(ct.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,"Disconnected"!==this._connectionState){if("Connecting"===this._connectionState)throw this._logger.log(ct.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if("Disconnecting"===this._connectionState&&this._stopPromiseResolver(),e?this._logger.log(ct.Error,`Connection disconnected with error '${e}'.`):this._logger.log(ct.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(ct.Error,`TransportSendQueue.stop() threw error '${e}'.`)})),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(ct.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(ct.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`)}_resolveUrl(e){if(0===e.lastIndexOf("https://",0)||0===e.lastIndexOf("http://",0))return e;if(!gt.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(ct.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=e.indexOf("?");let n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",n+=-1===t?"":e.substring(t),-1===n.indexOf("negotiateVersion")&&(n+=-1===t?"?":"&",n+="negotiateVersion="+this._negotiateVersion),n}}class Lt{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new $t,this._transportResult=new $t,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new $t),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new $t;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):Lt._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(t),e.resolve()}catch(t){e.reject(t)}}}static _concatBuffers(e){const t=e.map((e=>e.byteLength)).reduce(((e,t)=>e+t)),n=new Uint8Array(t);let r=0;for(const t of e)n.set(new Uint8Array(t),r),r+=t.byteLength;return n.buffer}}class $t{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class Bt{static write(e){return`${e}${Bt.RecordSeparator}`}static parse(e){if(e[e.length-1]!==Bt.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(Bt.RecordSeparator);return t.pop(),t}}Bt.RecordSeparatorCode=30,Bt.RecordSeparator=String.fromCharCode(Bt.RecordSeparatorCode);class Mt{writeHandshakeRequest(e){return Bt.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(yt(e)){const r=new Uint8Array(e),o=r.indexOf(Bt.RecordSeparatorCode);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(r.slice(0,i))),n=r.byteLength>i?r.slice(i).buffer:null}else{const r=e,o=r.indexOf(Bt.RecordSeparator);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=r.substring(0,i),n=r.length>i?r.substring(i):null}const r=Bt.parse(t),o=JSON.parse(r[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[n,o]}}!function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close"}(ut||(ut={}));class Ot{constructor(){this.observers=[]}next(e){for(const t of this.observers)t.next(e)}error(e){for(const t of this.observers)t.error&&t.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new vt(this,e)}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(dt||(dt={}));class Ft{static create(e,t,n,r){return new Ft(e,t,n,r)}constructor(e,t,n,r){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(ct.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},ft.isRequired(e,"connection"),ft.isRequired(t,"logger"),ft.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=3e4,this.keepAliveIntervalInMilliseconds=15e3,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=r,this._handshakeProtocol=new Mt,this.connection.onreceive=e=>this._processIncomingData(e),this.connection.onclose=e=>this._connectionClosed(e),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=dt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:ut.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==dt.Disconnected&&this._connectionState!==dt.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==dt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=dt.Connecting,this._logger.log(ct.Debug,"Starting HubConnection.");try{await this._startInternal(),gt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=dt.Connected,this._connectionStarted=!0,this._logger.log(ct.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=dt.Disconnected,this._logger.log(ct.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise(((e,t)=>{this._handshakeResolver=e,this._handshakeRejecter=t}));await this.connection.start(this._protocol.transferFormat);try{const t={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(ct.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(ct.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(ct.Debug,`Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(e),e}}async stop(){const e=this._startPromise;this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){return this._connectionState===dt.Disconnected?(this._logger.log(ct.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===dt.Disconnecting?(this._logger.log(ct.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=dt.Disconnecting,this._logger.log(ct.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(ct.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new nt("The connection was stopped before the hub handshake could complete."),this.connection.stop(e)))}stream(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createStreamInvocation(e,t,r);let i;const s=new Ot;return s.cancelCallback=()=>{const e=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then((()=>this._sendWithProtocol(e)))},this._callbacks[o.invocationId]=(e,t)=>{t?s.error(t):e&&(e.type===ut.Completion?e.error?s.error(new Error(e.error)):s.complete():s.next(e.item))},i=this._sendWithProtocol(o).catch((e=>{s.error(e),delete this._callbacks[o.invocationId]})),this._launchStreams(n,i),s}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._sendWithProtocol(this._createInvocation(e,t,!0,r));return this._launchStreams(n,o),o}invoke(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createInvocation(e,t,!1,r);return new Promise(((e,t)=>{this._callbacks[o.invocationId]=(n,r)=>{r?t(r):n&&(n.type===ut.Completion?n.error?t(new Error(n.error)):e(n.result):t(new Error(`Unexpected message type: ${n.type}`)))};const r=this._sendWithProtocol(o).catch((e=>{t(e),delete this._callbacks[o.invocationId]}));this._launchStreams(n,r)}))}on(e,t){e&&t&&(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),-1===this._methods[e].indexOf(t)&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();const n=this._methods[e];if(n)if(t){const r=n.indexOf(t);-1!==r&&(n.splice(r,1),0===n.length&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){const t=this._protocol.parseMessages(e,this._logger);for(const e of t)switch(e.type){case ut.Invocation:this._invokeClientMethod(e);break;case ut.StreamItem:case ut.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===ut.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(ct.Error,`Stream callback threw error: ${It(e)}`)}}break}case ut.Ping:break;case ut.Close:{this._logger.log(ct.Information,"Close message received from server.");const t=e.error?new Error("Server returned an error on close: "+e.error):void 0;!0===e.allowReconnect?this.connection.stop(t):this._stopPromise=this._stopInternal(t);break}default:this._logger.log(ct.Warning,`Invalid message type: ${e.type}.`)}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(e){const t="Error parsing handshake response: "+e;this._logger.log(ct.Error,t);const n=new Error(t);throw this._handshakeRejecter(n),n}if(t.error){const e="Server returned handshake error: "+t.error;this._logger.log(ct.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(ct.Debug,"Server handshake complete."),this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=(new Date).getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!(this.connection.features&&this.connection.features.inherentKeepAlive||(this._timeoutHandle=setTimeout((()=>this.serverTimeout()),this.serverTimeoutInMilliseconds),void 0!==this._pingServerHandle))){let e=this._nextKeepAlive-(new Date).getTime();e<0&&(e=0),this._pingServerHandle=setTimeout((async()=>{if(this._connectionState===dt.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n)return this._logger.log(ct.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(ct.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null))));const r=n.slice(),o=!!e.invocationId;let i,s,a;for(const n of r)try{const r=i;i=await n.apply(this,e.arguments),o&&i&&r&&(this._logger.log(ct.Error,`Multiple results provided for '${t}'. Sending error to server.`),a=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),s=void 0}catch(e){s=e,this._logger.log(ct.Error,`A callback for the method '${t}' threw error '${e}'.`)}a?await this._sendWithProtocol(a):o?(s?a=this._createCompletionMessage(e.invocationId,`${s}`,null):void 0!==i?a=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(ct.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),a=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(a)):i&&this._logger.log(ct.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(ct.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new nt("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===dt.Disconnecting?this._completeClose(e):this._connectionState===dt.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===dt.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=dt.Disconnected,this._connectionStarted=!1,gt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(ct.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}async _reconnect(e){const t=Date.now();let n=0,r=void 0!==e?e:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(n++,0,r);if(null===o)return this._logger.log(ct.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=dt.Reconnecting,e?this._logger.log(ct.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(ct.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(ct.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==dt.Reconnecting)return void this._logger.log(ct.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==o;){if(this._logger.log(ct.Information,`Reconnect attempt number ${n} will start in ${o} ms.`),await new Promise((e=>{this._reconnectDelayHandle=setTimeout(e,o)})),this._reconnectDelayHandle=void 0,this._connectionState!==dt.Reconnecting)return void this._logger.log(ct.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=dt.Connected,this._logger.log(ct.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(ct.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(ct.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==dt.Reconnecting)return this._logger.log(ct.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===dt.Disconnecting&&this._completeClose());r=e instanceof Error?e:new Error(e.toString()),o=this._getNextRetryDelay(n++,Date.now()-t,r)}}this._logger.log(ct.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(n){return this._logger.log(ct.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach((n=>{const r=t[n];try{r(null,e)}catch(t){this._logger.log(ct.Error,`Stream 'error' callback called with '${e}' threw error: ${It(t)}`)}}))}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,r){if(n)return 0!==r.length?{arguments:t,streamIds:r,target:e,type:ut.Invocation}:{arguments:t,target:e,type:ut.Invocation};{const n=this._invocationId;return this._invocationId++,0!==r.length?{arguments:t,invocationId:n.toString(),streamIds:r,target:e,type:ut.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:ut.Invocation}}}_launchStreams(e,t){if(0!==e.length){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n))))},error:e=>{let r;r=e instanceof Error?e.message:e&&e.toString?e.toString():"Unknown error",t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n,r))))},next:e=>{t=t.then((()=>this._sendWithProtocol(this._createStreamItemMessage(n,e))))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let r=0;r=55296&&o<=56319&&r65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h)}else i.push(a);i.length>=4096&&(s+=String.fromCharCode.apply(String,i),i.length=0)}return i.length>0&&(s+=String.fromCharCode.apply(String,i)),s}var nn,rn=Yt?new TextDecoder:null,on=Yt?"undefined"!=typeof process&&"force"!==(null===(qt=null===process||void 0===process?void 0:process.env)||void 0===qt?void 0:qt.TEXT_DECODER)?200:0:Vt,sn=function(e,t){this.type=e,this.data=t},an=(nn=function(e,t){return nn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},nn(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}nn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),cn=function(e){function t(n){var r=e.call(this,n)||this,o=Object.create(t.prototype);return Object.setPrototypeOf(r,o),Object.defineProperty(r,"name",{configurable:!0,enumerable:!1,value:t.name}),r}return an(t,e),t}(Error),ln={type:-1,encode:function(e){var t,n,r,o;return e instanceof Date?function(e){var t,n=e.sec,r=e.nsec;if(n>=0&&r>=0&&n<=17179869183){if(0===r&&n<=4294967295){var o=new Uint8Array(4);return(t=new DataView(o.buffer)).setUint32(0,n),o}var i=n/4294967296,s=4294967295&n;return o=new Uint8Array(8),(t=new DataView(o.buffer)).setUint32(0,r<<2|3&i),t.setUint32(4,s),o}return o=new Uint8Array(12),(t=new DataView(o.buffer)).setUint32(0,r),Kt(t,4,n),o}((r=1e6*((t=e.getTime())-1e3*(n=Math.floor(t/1e3))),{sec:n+(o=Math.floor(r/1e9)),nsec:r-1e9*o})):null},decode:function(e){var t=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:var n=t.getUint32(0);return{sec:4294967296*(3&n)+t.getUint32(4),nsec:n>>>2};case 12:return{sec:Xt(t,4),nsec:t.getUint32(0)};default:throw new cn("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},hn=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(ln)}return e.prototype.register=function(e){var t=e.type,n=e.encode,r=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=r;else{var o=1+t;this.builtInEncoders[o]=n,this.builtInDecoders[o]=r}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>Zt){var t=Gt(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),en(e,this.bytes,this.pos),this.pos+=t}else t=Gt(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var r=e.length,o=n,i=0;i>6&31|192;else{if(s>=55296&&s<=56319&&i>12&15|224,t[o++]=s>>6&63|128):(t[o++]=s>>18&7|240,t[o++]=s>>12&63|128,t[o++]=s>>6&63|128)}t[o++]=63&s|128}else t[o++]=s}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=un(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var r=0,o=e;r0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var r=0,o=this.caches[n-1];r=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)},e.prototype.decode=function(e,t,n){var r=this.find(e,t,n);if(null!=r)return this.hit++,r;this.miss++;var o=tn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,o),o},e}(),gn=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]1||a(e,t)}))})}function a(e,t){try{(n=o[e](t)).value instanceof yn?Promise.resolve(n.value.v).then(c,l):h(i[0][2],n)}catch(e){h(i[0][3],e)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function h(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}},vn=new DataView(new ArrayBuffer(0)),bn=new Uint8Array(vn.buffer),_n=function(){try{vn.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),En=new _n("Insufficient data"),Sn=new fn,Cn=function(){function e(e,t,n,r,o,i,s,a){void 0===e&&(e=hn.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=Vt),void 0===r&&(r=Vt),void 0===o&&(o=Vt),void 0===i&&(i=Vt),void 0===s&&(s=Vt),void 0===a&&(a=Sn),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=r,this.maxArrayLength=o,this.maxMapLength=i,this.maxExtLength=s,this.keyDecoder=a,this.totalPos=0,this.pos=0,this.view=vn,this.bytes=bn,this.headByte=-1,this.stack=[]}return e.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},e.prototype.setBuffer=function(e){this.bytes=un(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=un(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0},e.prototype.appendBuffer=function(e){if(-1!==this.headByte||this.hasRemaining(1)){var t=this.bytes.subarray(this.pos),n=un(e),r=new Uint8Array(t.length+n.length);r.set(t),r.set(n,t.length),this.setBuffer(r)}else this.setBuffer(e)},e.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return gn(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,n,r,o,i,s,a;return i=this,void 0,a=function(){var i,s,a,c,l,h,u,d;return gn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=mn(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),i=!0}catch(e){if(!(e instanceof _n))throw e}this.totalPos+=this.pos,p.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return c=p.sent(),r={error:c},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,s]}throw h=(l=this).headByte,u=l.pos,d=l.totalPos,new RangeError("Insufficient data in parsing ".concat(pn(h)," at ").concat(d," (").concat(u," in the current buffer)"))}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{o(a.next(e))}catch(e){t(e)}}function r(e){try{o(a.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}o((a=a.apply(i,[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return wn(this,arguments,(function(){var n,r,o,i,s,a,c,l,h;return gn(this,(function(u){switch(u.label){case 0:n=t,r=-1,u.label=1;case 1:u.trys.push([1,13,14,19]),o=mn(e),u.label=2;case 2:return[4,yn(o.next())];case 3:if((i=u.sent()).done)return[3,12];if(s=i.value,t&&0===r)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(r=this.readArraySize(),n=!1,this.complete()),u.label=4;case 4:u.trys.push([4,9,,10]),u.label=5;case 5:return[4,yn(this.doDecodeSync())];case 6:return[4,u.sent()];case 7:return u.sent(),0==--r?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=u.sent())instanceof _n))throw a;return[3,10];case 10:this.totalPos+=this.pos,u.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=u.sent(),l={error:c},[3,19];case 14:return u.trys.push([14,,17,18]),i&&!i.done&&(h=o.return)?[4,yn(h.call(o))]:[3,16];case 15:u.sent(),u.label=16;case 16:return[3,18];case 17:if(l)throw l.error;return[7];case 18:return[7];case 19:return[2]}}))}))},e.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){if(0!=(r=e-128)){this.pushMapState(r),this.complete();continue e}t={}}else if(e<160){if(0!=(r=e-144)){this.pushArrayState(r),this.complete();continue e}t=[]}else{var n=e-160;t=this.decodeUtf8String(n,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e)n=this.lookU8(),t=this.decodeUtf8String(n,1);else if(218===e)n=this.lookU16(),t=this.decodeUtf8String(n,2);else if(219===e)n=this.lookU32(),t=this.decodeUtf8String(n,4);else if(220===e){if(0!==(r=this.readU16())){this.pushArrayState(r),this.complete();continue e}t=[]}else if(221===e){if(0!==(r=this.readU32())){this.pushArrayState(r),this.complete();continue e}t=[]}else if(222===e){if(0!==(r=this.readU16())){this.pushMapState(r),this.complete();continue e}t={}}else if(223===e){if(0!==(r=this.readU32())){this.pushMapState(r),this.complete();continue e}t={}}else if(196===e){var r=this.lookU8();t=this.decodeBinary(r,1)}else if(197===e)r=this.lookU16(),t=this.decodeBinary(r,2);else if(198===e)r=this.lookU32(),t=this.decodeBinary(r,4);else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e)r=this.lookU8(),t=this.decodeExtension(r,1);else if(200===e)r=this.lookU16(),t=this.decodeExtension(r,2);else{if(201!==e)throw new cn("Unrecognized type byte: ".concat(pn(e)));r=this.lookU32(),t=this.decodeExtension(r,4)}this.complete();for(var o=this.stack;o.length>0;){var i=o[o.length-1];if(0===i.type){if(i.array[i.position]=t,i.position++,i.position!==i.size)continue e;o.pop(),t=i.array}else{if(1===i.type){if("string"!=(s=typeof t)&&"number"!==s)throw new cn("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new cn("The key __proto__ is not allowed");i.key=t,i.type=2;continue e}if(i.map[i.key]=t,i.readCount++,i.readCount!==i.size){i.key=null,i.type=1;continue e}o.pop(),t=i.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new cn("Unrecognized array type byte: ".concat(pn(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new cn("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new cn("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new cn("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthon?function(e,t,n){var r=e.subarray(t,t+n);return rn.decode(r)}(this.bytes,o,e):tn(this.bytes,o,e),this.pos+=t+e,r},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},e.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new cn("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw En;var n=this.pos+t,r=this.bytes.subarray(n,n+e);return this.pos+=t+e,r},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new cn("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,n,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,n},e.prototype.readI64=function(){var e=Xt(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}();class In{static write(e){let t=e.byteLength||e.length;const n=[];do{let e=127&t;t>>=7,t>0&&(e|=128),n.push(e)}while(t>0);t=e.byteLength||e.length;const r=new Uint8Array(n.length+t);return r.set(n,0),r.set(e,n.length),r.buffer}static parse(e){const t=[],n=new Uint8Array(e),r=[0,7,14,21,28];for(let o=0;o7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+s+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+s,o+s+a):n.subarray(o+s,o+s+a)),o=o+s+a}return t}}const kn=new Uint8Array([145,ut.Ping]);class Tn{constructor(e){this.name="messagepack",this.version=1,this.transferFormat=ht.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new dn(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new Cn(e.extensionCodec,e.context,e.maxStrLength,e.maxBinLength,e.maxArrayLength,e.maxMapLength,e.maxExtLength)}parseMessages(e,t){if(!(n=e)||"undefined"==typeof ArrayBuffer||!(n instanceof ArrayBuffer||n.constructor&&"ArrayBuffer"===n.constructor.name))throw new Error("Invalid input for MessagePack hub protocol. Expected an ArrayBuffer.");var n;null===t&&(t=pt.instance);const r=In.parse(e),o=[];for(const e of r){const n=this._parseMessage(e,t);n&&o.push(n)}return o}writeMessage(e){switch(e.type){case ut.Invocation:return this._writeInvocation(e);case ut.StreamInvocation:return this._writeStreamInvocation(e);case ut.StreamItem:return this._writeStreamItem(e);case ut.Completion:return this._writeCompletion(e);case ut.Ping:return In.write(kn);case ut.CancelInvocation:return this._writeCancelInvocation(e);default:throw new Error("Invalid message type.")}}_parseMessage(e,t){if(0===e.length)throw new Error("Invalid payload.");const n=this._decoder.decode(e);if(0===n.length||!(n instanceof Array))throw new Error("Invalid payload.");const r=n[0];switch(r){case ut.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case ut.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case ut.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case ut.Ping:return this._createPingMessage(n);case ut.Close:return this._createCloseMessage(n);default:return t.log(ct.Information,"Unknown message type '"+r+"' ignored."),null}}_createCloseMessage(e){if(e.length<2)throw new Error("Invalid payload for Close message.");return{allowReconnect:e.length>=3?e[2]:void 0,error:e[1],type:ut.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:ut.Ping}}_createInvocationMessage(e,t){if(t.length<5)throw new Error("Invalid payload for Invocation message.");const n=t[2];return n?{arguments:t[4],headers:e,invocationId:n,streamIds:[],target:t[3],type:ut.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:ut.Invocation}}_createStreamItemMessage(e,t){if(t.length<4)throw new Error("Invalid payload for StreamItem message.");return{headers:e,invocationId:t[2],item:t[3],type:ut.StreamItem}}_createCompletionMessage(e,t){if(t.length<4)throw new Error("Invalid payload for Completion message.");const n=t[3];if(n!==this._voidResult&&t.length<5)throw new Error("Invalid payload for Completion message.");let r,o;switch(n){case this._errorResult:r=t[4];break;case this._nonVoidResult:o=t[4]}return{error:r,headers:e,invocationId:t[2],result:o,type:ut.Completion}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([ut.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([ut.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),In.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([ut.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([ut.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),In.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([ut.StreamItem,e.headers||{},e.invocationId,e.item]);return In.write(t.slice())}_writeCompletion(e){const t=e.error?this._errorResult:void 0!==e.result?this._nonVoidResult:this._voidResult;let n;switch(t){case this._errorResult:n=this._encoder.encode([ut.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([ut.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([ut.Completion,e.headers||{},e.invocationId,t,e.result])}return In.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([ut.CancelInvocation,e.headers||{},e.invocationId]);return In.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}let xn=!1;function Dn(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),xn||(xn=!0,document.querySelectorAll("#blazor-error-ui .reload").forEach((e=>{e.onclick=function(e){location.reload(),e.preventDefault()}})),document.querySelectorAll("#blazor-error-ui .dismiss").forEach((e=>{e.onclick=function(e){const t=document.querySelector("#blazor-error-ui");t&&(t.style.display="none"),e.preventDefault()}})))}const Rn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Pn=Rn?Rn.decode.bind(Rn):function(e){let t=0;const n=e.length,r=[],o=[];for(;t65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o)}r.length>1024&&(o.push(String.fromCharCode.apply(null,r)),r.length=0)}return o.push(String.fromCharCode.apply(null,r)),o.join("")},Un=Math.pow(2,32),An=Math.pow(2,21)-1;function Nn(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Ln(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function $n(e,t){const n=Ln(e,t+4);if(n>An)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Un+Ln(e,t)}class Bn{constructor(e){this.batchData=e;const t=new jn(e);this.arrayRangeReader=new Hn(e),this.arrayBuilderSegmentReader=new Wn(e),this.diffReader=new Mn(e),this.editReader=new On(e,t),this.frameReader=new Fn(e,t)}updatedComponents(){return Nn(this.batchData,this.batchData.length-20)}referenceFrames(){return Nn(this.batchData,this.batchData.length-16)}disposedComponentIds(){return Nn(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return Nn(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return Nn(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return Nn(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return $n(this.batchData,n)}}class Mn{constructor(e){this.batchDataUint8=e}componentId(e){return Nn(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class On{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return Nn(this.batchDataUint8,e)}siblingIndex(e){return Nn(this.batchDataUint8,e+4)}newTreeIndex(e){return Nn(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return Nn(this.batchDataUint8,e+8)}removedAttributeName(e){const t=Nn(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class Fn{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return Nn(this.batchDataUint8,e)}subtreeLength(e){return Nn(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=Nn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return Nn(this.batchDataUint8,e+8)}elementName(e){const t=Nn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=Nn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=Nn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=Nn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=Nn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return $n(this.batchDataUint8,e+12)}}class jn{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=Nn(e,e.length-4)}readString(e){if(-1===e)return null;{const n=Nn(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const i=e[t+o];if(n|=(127&i)<this.nextBatchId)return this.fatalError?(this.logger.log(zn.Debug,`Received a new batch ${e} but errored out on a previous batch ${this.nextBatchId-1}`),void await n.send("OnRenderCompleted",this.nextBatchId-1,this.fatalError.toString())):void this.logger.log(zn.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(zn.Debug,`Applying batch ${e}.`),function(e,t){const n=de[e];if(!n)throw new Error(`There is no browser renderer with ID ${e}.`);const r=t.arrayRangeReader,o=t.updatedComponents(),i=r.values(o),s=r.count(o),a=t.referenceFrames(),c=r.values(a),l=t.diffReader;for(let e=0;e=this.minLevel){const n=`[${(new Date).toISOString()}] ${zn[e]}: ${t}`;switch(e){case zn.Critical:case zn.Error:console.error(n);break;case zn.Warning:console.warn(n);break;case zn.Information:console.info(n);break;default:console.log(n)}}}}class Kn{constructor(e,t){this.circuitId=void 0,this.components=e,this.applicationState=t}reconnect(e){if(!this.circuitId)throw new Error("Circuit host not initialized.");return e.state!==dt.Connected?Promise.resolve(!1):e.invoke("ConnectCircuit",this.circuitId)}initialize(e){if(this.circuitId)throw new Error(`Circuit host '${this.circuitId}' already initialized.`);this.circuitId=e}async startCircuit(e){if(e.state!==dt.Connected)return!1;const t=await e.invoke("StartCircuit",Se.getBaseURI(),Se.getLocationHref(),JSON.stringify(this.components.map((e=>e.toRecord()))),this.applicationState||"");return!!t&&(this.initialize(t),!0)}resolveElement(e){const t=function(e){const t=f.get(e);if(t)return f.delete(e),t}(e);if(t)return M(t,!0);const n=Number.parseInt(e);if(!Number.isNaN(n))return function(e,t){if(!e.parentNode)throw new Error(`Comment not connected to the DOM ${e.textContent}`);const n=e.parentNode,r=M(n,!0),o=J(r);return Array.from(n.childNodes).forEach((e=>o.push(e))),e[$]=r,t&&(e[B]=t,M(t)),M(e)}(this.components[n].start,this.components[n].end);throw new Error(`Invalid sequence number or identifier '${e}'.`)}}const Xn={configureSignalR:e=>{},logLevel:zn.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class Yn{constructor(e,t,n,r){this.maxRetries=t,this.document=n,this.logger=r,this.addedToDom=!1,this.modal=this.document.createElement("div"),this.modal.id=e,this.maxRetries=t,this.modal.style.cssText=["position: fixed","top: 0","right: 0","bottom: 0","left: 0","z-index: 1050","display: none","overflow: hidden","background-color: #fff","opacity: 0.8","text-align: center","font-weight: bold","transition: visibility 0s linear 500ms"].join(";"),this.message=this.document.createElement("h5"),this.message.style.cssText="margin-top: 20px",this.button=this.document.createElement("button"),this.button.style.cssText="margin:5px auto 5px",this.button.textContent="Retry";const o=this.document.createElement("a");o.addEventListener("click",(()=>location.reload())),o.textContent="reload",this.reloadParagraph=this.document.createElement("p"),this.reloadParagraph.textContent="Alternatively, ",this.reloadParagraph.appendChild(o),this.modal.appendChild(this.message),this.modal.appendChild(this.button),this.modal.appendChild(this.reloadParagraph),this.loader=this.getLoader(),this.message.after(this.loader),this.button.addEventListener("click",(async()=>{this.show();try{await Ve.reconnect()||this.rejected()}catch(e){this.logger.log(zn.Error,e),this.failed()}}))}show(){this.addedToDom||(this.addedToDom=!0,this.document.body.appendChild(this.modal)),this.modal.style.display="block",this.loader.style.display="inline-block",this.button.style.display="none",this.reloadParagraph.style.display="none",this.message.textContent="Attempting to reconnect to the server...",this.modal.style.visibility="hidden",setTimeout((()=>{this.modal.style.visibility="visible"}),0)}update(e){this.message.textContent=`Attempting to reconnect to the server: ${e} of ${this.maxRetries}`}hide(){this.modal.style.display="none"}failed(){this.button.style.display="block",this.reloadParagraph.style.display="none",this.loader.style.display="none";const e=this.document.createTextNode("Reconnection failed. Try "),t=this.document.createElement("a");t.textContent="reloading",t.setAttribute("href",""),t.addEventListener("click",(()=>location.reload()));const n=this.document.createTextNode(" the page if you're unable to reconnect.");this.message.replaceChildren(e,t,n)}rejected(){this.button.style.display="none",this.reloadParagraph.style.display="none",this.loader.style.display="none";const e=this.document.createTextNode("Could not reconnect to the server. "),t=this.document.createElement("a");t.textContent="Reload",t.setAttribute("href",""),t.addEventListener("click",(()=>location.reload()));const n=this.document.createTextNode(" the page to restore functionality.");this.message.replaceChildren(e,t,n)}getLoader(){const e=this.document.createElement("div");return e.style.cssText=["border: 0.3em solid #f3f3f3","border-top: 0.3em solid #3498db","border-radius: 50%","width: 2em","height: 2em","display: inline-block"].join(";"),e.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:2e3,iterations:1/0}),e}}class Gn{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const r=this.document.getElementById(Gn.MaxRetriesId);r&&(r.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(Gn.ShowClassName)}update(e){const t=this.document.getElementById(Gn.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Gn.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Gn.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Gn.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Gn.ShowClassName,Gn.HideClassName,Gn.FailedClassName,Gn.RejectedClassName)}}Gn.ShowClassName="components-reconnect-show",Gn.HideClassName="components-reconnect-hide",Gn.FailedClassName="components-reconnect-failed",Gn.RejectedClassName="components-reconnect-rejected",Gn.MaxRetriesId="components-reconnect-max-retries",Gn.CurrentAttemptId="components-reconnect-current-attempt";class Qn{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||Ve.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new Gn(t,e.maxRetries,document):new Yn(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new Zn(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class Zn{constructor(e,t,n,r){this.logger=t,this.reconnectCallback=n,this.isDisposed=!1,this.reconnectDisplay=r,this.reconnectDisplay.show(),this.attemptPeriodicReconnection(e)}dispose(){this.isDisposed=!0,this.reconnectDisplay.hide()}async attemptPeriodicReconnection(e){for(let t=0;tZn.MaximumFirstRetryInterval?Zn.MaximumFirstRetryInterval:e.retryIntervalMilliseconds;if(await this.delay(n),this.isDisposed)break;try{return await this.reconnectCallback()?void 0:void this.reconnectDisplay.rejected()}catch(e){this.logger.log(zn.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise((t=>setTimeout(t,e)))}}Zn.MaximumFirstRetryInterval=3e3;const er=/^\s*Blazor-Component-State:(?[a-zA-Z0-9+/=]+)$/;function tr(e){var t;if(e.nodeType===Node.COMMENT_NODE){const n=e.textContent||"",r=er.exec(n),o=r&&r.groups&&r.groups.state;return o&&(null===(t=e.parentNode)||void 0===t||t.removeChild(e)),o}if(!e.hasChildNodes())return;const n=e.childNodes;for(let e=0;e.*)$/);function or(e,t){const n=e.currentElement;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const r=rr.exec(n.textContent),o=r&&r.groups&&r.groups.descriptor;if(!o)return;try{const r=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(o);switch(t){case"webassembly":return function(e,t,n){const{type:r,assembly:o,typeName:i,parameterDefinitions:s,parameterValues:a,prerenderId:c}=e;if("webassembly"===r){if(!o)throw new Error("assembly must be defined when using a descriptor.");if(!i)throw new Error("typeName must be defined when using a descriptor.");if(c){const e=ir(c,n);if(!e)throw new Error(`Could not find an end component comment for '${t}'`);return{type:r,assembly:o,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:a&&atob(a),start:t,prerenderId:c,end:e}}return{type:r,assembly:o,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:a&&atob(a),start:t}}}(r,n,e);case"server":return function(e,t,n){const{type:r,descriptor:o,sequence:i,prerenderId:s}=e;if("server"===r){if(!o)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===i)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(i))throw new Error(`Error parsing the sequence '${i}' for component '${JSON.stringify(e)}'`);if(s){const e=ir(s,n);if(!e)throw new Error(`Could not find an end component comment for '${t}'`);return{type:r,sequence:i,descriptor:o,start:t,prerenderId:s,end:e}}return{type:r,sequence:i,descriptor:o,start:t}}}(r,n,e)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}function ir(e,t){for(;t.next()&&t.currentElement;){const n=t.currentElement;if(n.nodeType!==Node.COMMENT_NODE)continue;if(!n.textContent)continue;const r=rr.exec(n.textContent),o=r&&r[1];if(o)return sr(o,e),n}}function sr(e,t){const n=JSON.parse(e);if(1!==Object.keys(n).length)throw new Error(`Invalid end of component comment: '${e}'`);const r=n.prerenderId;if(!r)throw new Error(`End of component comment must have a value for the prerendered property: '${e}'`);if(r!==t)throw new Error(`End of component comment prerendered property must match the start comment prerender id: '${t}', '${r}'`)}class ar{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndexasync function(e,n){const r=function(e){const t=document.baseURI;return t.endsWith("/")?`${t}${e}`:`${t}/${e}`}(n),o=await import(r);if(void 0===o)return;const{beforeStart:i,afterStarted:s}=o;return s&&e.afterStartedCallbacks.push(s),i?i(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await C,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let ur,dr=!1,pr=!1;async function fr(e){if(pr)throw new Error("Blazor has already started.");pr=!0;const t=function(e){const t={...Xn,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...Xn.reconnectionOptions,...e.reconnectionOptions}),t}(e),n=await async function(e){const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),r=new hr;return await r.importInitializersAsync(n,[e]),r}(t),r=new Vn(t.logLevel);Ve.reconnect=async e=>{if(dr)return!1;const n=e||await gr(t,r,s);return await s.reconnect(n)?(t.reconnectionHandler.onConnectionUp(),!0):(r.log(zn.Information,"Reconnection attempt to the circuit was rejected by the server. This may indicate that the associated state is no longer available on the server."),!1)},Ve.defaultReconnectionHandler=new Qn(r),t.reconnectionHandler=t.reconnectionHandler||Ve.defaultReconnectionHandler,r.log(zn.Information,"Starting up Blazor server-side application.");const o=function(e,t){return function(e){const t=nr(e,"server"),n=[];for(let e=0;ee.sequence-t.sequence))}(e)}(document),i=tr(document),s=new Kn(o,i||"");Ve._internal.navigationManager.listenForNavigationEvents(((e,t,n)=>ur.send("OnLocationChanged",e,t,n)),((e,t,n,r)=>ur.send("OnLocationChanging",e,t,n,r))),Ve._internal.forceCloseConnection=()=>ur.stop(),Ve._internal.sendJSDataStream=(e,t,n)=>function(e,t,n,r){setTimeout((async()=>{let o=5,i=(new Date).valueOf();try{const s=t instanceof Blob?t.size:t.byteLength;let a=0,c=0;for(;a1)await e.send("ReceiveJSDataChunk",n,c,h,null);else{if(!await e.invoke("ReceiveJSDataChunk",n,c,h,null))break;const t=(new Date).valueOf(),r=t-i;i=t,o=Math.max(1,Math.round(500/Math.max(1,r)))}a+=l,c++}}catch(t){await e.send("ReceiveJSDataChunk",n,-1,null,t.toString())}}),0)}(ur,e,t,n);const a=await gr(t,r,s);if(!await s.startCircuit(a))return void r.log(zn.Error,"Failed to start the circuit.");let c=!1;const l=()=>{if(!c){const e=new FormData,t=s.circuitId;e.append("circuitId",t),c=navigator.sendBeacon("_blazor/disconnect",e)}};Ve.disconnect=l,window.addEventListener("unload",l,{capture:!1,once:!0}),r.log(zn.Information,"Blazor server-side application started."),n.invokeAfterStartedCallbacks(Ve)}async function gr(t,n,r){var o,i;const s=new Tn;s.name="blazorpack";const a=(new Wt).withUrl("_blazor").withHubProtocol(s);t.configureSignalR(a);const c=a.build();c.on("JS.AttachComponent",((e,t)=>function(e,t,n,r){let o=de[0];o||(o=new se(0),de[0]=o),o.attachRootComponentToLogicalElement(n,t,!1)}(0,r.resolveElement(t),e))),c.on("JS.BeginInvokeJS",e.jsCallDispatcher.beginInvokeJSFromDotNet),c.on("JS.EndInvokeDotNet",e.jsCallDispatcher.endInvokeDotNetFromJS),c.on("JS.ReceiveByteArray",e.jsCallDispatcher.receiveByteArray),c.on("JS.BeginTransmitStream",(t=>{const n=new ReadableStream({start(e){c.stream("SendDotNetStreamToJS",t).subscribe({next:t=>e.enqueue(t),complete:()=>e.close(),error:t=>e.error(t)})}});e.jsCallDispatcher.supplyDotNetStream(t,n)}));const l=Jn.getOrCreate(n);c.on("JS.RenderBatch",((e,t)=>{n.log(zn.Debug,`Received render batch with id ${e} and ${t.byteLength} bytes.`),l.processBatch(e,t,c)})),c.on("JS.EndLocationChanging",Ve._internal.navigationManager.endLocationChanging),c.onclose((e=>!dr&&t.reconnectionHandler.onConnectionDown(t.reconnectionOptions,e))),c.on("JS.Error",(e=>{dr=!0,mr(c,e,n),Dn()}));try{await c.start(),ur=c}catch(e){if(mr(c,e,n),"FailedToNegotiateWithServerError"===e.errorType)throw e;Dn(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===lt.WebSockets))?n.log(zn.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===lt.WebSockets))?n.log(zn.Error,"Unable to connect, please ensure WebSockets are available. A VPN or proxy may be blocking the connection."):e.innerErrors.some((e=>"DisabledTransportError"===e.errorType&&e.transport===lt.LongPolling))&&n.log(zn.Error,"Unable to initiate a SignalR connection to the server. This might be because the server is not configured to support WebSockets. For additional details, visit https://aka.ms/blazor-server-websockets-error."))}return(null===(i=null===(o=c.connection)||void 0===o?void 0:o.features)||void 0===i?void 0:i.inherentKeepAlive)&&n.log(zn.Warning,"Failed to connect via WebSockets, using the Long Polling fallback transport. This may be due to a VPN or proxy blocking the connection. To troubleshoot this, visit https://aka.ms/blazor-server-using-fallback-long-polling."),e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{c.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,r||0,o)},endInvokeJSFromDotNet:(e,t,n)=>{c.send("EndInvokeJSFromDotNet",e,t,n)},sendByteArray:(e,t)=>{c.send("ReceiveByteArray",e,t)}}),c}function mr(e,t,n){n.log(zn.Error,t),e&&e.stop()}Ve.start=fr,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&fr()})(); \ No newline at end of file +(()=>{"use strict";var e,t,n,r={};r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),function(e){window.DotNet=e;const t=[],n=new Map,r=new Map,o="__jsObjectId",i="__byte[]";class s{constructor(e){this._jsObject=e,this._cachedFunctions=new Map}findFunction(e){const t=this._cachedFunctions.get(e);if(t)return t;let n,r=this._jsObject;if(e.split(".").forEach((t=>{if(!(t in r))throw new Error(`Could not find '${e}' ('${t}' was undefined).`);n=r,r=r[t]})),r instanceof Function)return r=r.bind(n),this._cachedFunctions.set(e,r),r;throw new Error(`The value '${e}' is not a function.`)}getWrappedObject(){return this._jsObject}}const a={},c={0:new s(window)};c[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let l,h=1,u=1,d=null;function p(e){t.push(e)}function f(e){if(e&&"object"==typeof e){c[u]=new s(e);const t={[o]:u};return u++,t}throw new Error(`Cannot create a JSObjectReference from the value '${e}'.`)}function g(e){let t=-1;if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Blob)t=e.size;else{if(!(e.buffer instanceof ArrayBuffer))throw new Error("Supplied value is not a typed array or blob.");if(void 0===e.byteLength)throw new Error(`Cannot create a JSStreamReference from the value '${e}' as it doesn't have a byteLength.`);t=e.byteLength}const n={__jsStreamReferenceLength:t};try{const t=f(e);n.__jsObjectId=t.__jsObjectId}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return n}function m(e){return e?JSON.parse(e,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null}function y(e,t,n,r){const o=v();if(o.invokeDotNetFromJS){const i=D(r),s=o.invokeDotNetFromJS(e,t,n,i);return s?m(s):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeMethodAsync instead.")}function w(e,t,n,r){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const o=h++,i=new Promise(((e,t)=>{a[o]={resolve:e,reject:t}}));try{const i=D(r);v().beginInvokeDotNetFromJS(o,e,t,n,i)}catch(e){b(o,!1,e)}return i}function v(){if(null!==d)return d;throw new Error("No .NET call dispatcher has been set.")}function b(e,t,n){if(!a.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const r=a[e];delete a[e],t?r.resolve(n):r.reject(n)}function _(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function E(e,t){const n=c[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function S(e){delete c[e]}e.attachDispatcher=function(e){d=e},e.attachReviver=p,e.invokeMethod=function(e,t,...n){return y(e,t,null,n)},e.invokeMethodAsync=function(e,t,...n){return w(e,t,null,n)},e.createJSObjectReference=f,e.createJSStreamReference=g,e.disposeJSObjectReference=function(e){const t=e&&e.__jsObjectId;"number"==typeof t&&S(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(l=e.JSCallResultType||(e.JSCallResultType={})),e.jsCallDispatcher={findJSFunction:E,disposeJSObjectReferenceById:S,invokeJSFromDotNet:(e,t,n,r)=>{const o=T(E(e,r).apply(null,m(t)),n);return null==o?null:D(o)},beginInvokeJSFromDotNet:(e,t,n,r,o)=>{const i=new Promise((e=>{e(E(t,o).apply(null,m(n)))}));e&&i.then((t=>D([e,!0,T(t,r)]))).then((t=>v().endInvokeJSFromDotNet(e,!0,t)),(t=>v().endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,_(t)]))))},endInvokeDotNetFromJS:(e,t,n)=>{const r=t?m(n):new Error(n);b(parseInt(e,10),t,r)},receiveByteArray:(e,t)=>{n.set(e,t)},supplyDotNetStream:(e,t)=>{if(r.has(e)){const n=r.get(e);r.delete(e),n.resolve(t)}else{const n=new k;n.resolve(t),r.set(e,n)}}};class C{constructor(e){this._id=e}invokeMethod(e,...t){return y(null,e,this._id,t)}invokeMethodAsync(e,...t){return w(null,e,this._id,t)}dispose(){w(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{__dotNetObject:this._id}}}e.DotNetObject=C,p((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty("__dotNetObject"))return new C(t.__dotNetObject);if(t.hasOwnProperty(o)){const e=t.__jsObjectId,n=c[e];if(n)return n.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(i)){const e=t["__byte[]"],r=n.get(e);if(void 0===r)throw new Error(`Byte array index '${e}' does not exist.`);return n.delete(e),r}if(t.hasOwnProperty("__dotNetStream"))return new I(t.__dotNetStream)}return t}));class I{constructor(e){if(r.has(e))this._streamPromise=r.get(e).streamPromise,r.delete(e);else{const t=new k;r.set(e,t),this._streamPromise=t.streamPromise}}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class k{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function T(e,t){switch(t){case l.Default:return e;case l.JSObjectReference:return f(e);case l.JSStreamReference:return g(e);case l.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let x=0;function D(e){return x=0,JSON.stringify(e,R)}function R(e,t){if(t instanceof C)return t.serializeAsArg();if(t instanceof Uint8Array){d.sendByteArray(x,t);const e={[i]:x};return x++,e}return t}}(e||(e={})),function(e){e[e.prependFrame=1]="prependFrame",e[e.removeFrame=2]="removeFrame",e[e.setAttribute=3]="setAttribute",e[e.removeAttribute=4]="removeAttribute",e[e.updateText=5]="updateText",e[e.stepIn=6]="stepIn",e[e.stepOut=7]="stepOut",e[e.updateMarkup=8]="updateMarkup",e[e.permutationListEntry=9]="permutationListEntry",e[e.permutationListEnd=10]="permutationListEnd"}(t||(t={})),function(e){e[e.element=1]="element",e[e.text=2]="text",e[e.attribute=3]="attribute",e[e.component=4]="component",e[e.region=5]="region",e[e.elementReferenceCapture=6]="elementReferenceCapture",e[e.markup=8]="markup"}(n||(n={}));class o{constructor(e,t){this.componentId=e,this.fieldValue=t}static fromEvent(e,t){const n=t.target;if(n instanceof Element){const t=function(e){return e instanceof HTMLInputElement?e.type&&"checkbox"===e.type.toLowerCase()?{value:e.checked}:{value:e.value}:e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement?{value:e.value}:null}(n);if(t)return new o(e,t.value)}return null}}const i=new Map,s=new Map,a=[];function c(e){return i.get(e)}function l(e){const t=i.get(e);return(null==t?void 0:t.browserEventName)||e}function h(e,t){e.forEach((e=>i.set(e,t)))}function u(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}{const e=function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t);return{value:e?!!t.checked:t.value}}}}),h(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),h(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...d(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),h(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),h(["keydown","keyup","keypress"],{createEventArgs:e=>{return{key:(t=e).key,code:t.code,location:t.location,repeat:t.repeat,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),h(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>d(e)}),h(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno,type:t.type};var t}}),h(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total,type:t.type};var t}}),h(["touchcancel","touchend","touchmove","touchenter","touchleave","touchstart"],{createEventArgs:e=>{return{detail:(t=e).detail,touches:u(t.touches),targetTouches:u(t.targetTouches),changedTouches:u(t.changedTouches),ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),h(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...d(t=e),pointerId:t.pointerId,width:t.width,height:t.height,pressure:t.pressure,tiltX:t.tiltX,tiltY:t.tiltY,pointerType:t.pointerType,isPrimary:t.isPrimary};var t}}),h(["wheel","mousewheel"],{createEventArgs:e=>{return{...d(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),h(["toggle"],{createEventArgs:()=>({})});const p=["date","datetime-local","month","time","week"],f=new Map;let g,m,y=0;const w={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const r="__bl-dynamic-root:"+(++y).toString();f.set(r,e);const o=await _().invokeMethodAsync("AddRootComponent",t,r),i=new b(o,m[t]);return await i.setParameters(n),i}};class v{invoke(e){return this._callback(e)}setCallback(t){this._selfJSObjectReference||(this._selfJSObjectReference=e.createJSObjectReference(this)),this._callback=t}getJSObjectReference(){return this._selfJSObjectReference}dispose(){this._selfJSObjectReference&&e.disposeJSObjectReference(this._selfJSObjectReference)}}class b{constructor(e,t){this._jsEventCallbackWrappers=new Map,this._componentId=e;for(const e of t)"eventcallback"===e.type&&this._jsEventCallbackWrappers.set(e.name.toLowerCase(),new v)}setParameters(e){const t={},n=Object.entries(e||{}),r=n.length;for(const[e,r]of n){const n=this._jsEventCallbackWrappers.get(e.toLowerCase());n&&r?(n.setCallback(r),t[e]=n.getJSObjectReference()):t[e]=r}return _().invokeMethodAsync("SetRootComponentParameters",this._componentId,r,t)}async dispose(){if(null!==this._componentId){await _().invokeMethodAsync("RemoveRootComponent",this._componentId),this._componentId=null;for(const e of this._jsEventCallbackWrappers.values())e.dispose()}}}function _(){if(!g)throw new Error("Dynamic root components have not been enabled in this application.");return g}const E=new Map;let S;const C=new Promise((e=>{S=e}));function I(e,t,n){return T(e,t.eventHandlerId,(()=>k(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function k(e){const t=E.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let T=(e,t,n)=>n();const x=N(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),D={submit:!0},R=N(["click","dblclick","mousedown","mousemove","mouseup"]);class P{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++P.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new U(this.onGlobalEvent.bind(this))}setListener(e,t,n,r){const o=this.getEventHandlerInfosForElement(e,!0),i=o.getHandler(t);if(i)this.eventInfoStore.update(i.eventHandlerId,n);else{const i={element:e,eventName:t,eventHandlerId:n,renderingComponentId:r};this.eventInfoStore.add(i),o.setHandler(t,i)}}getHandler(e){return this.eventInfoStore.get(e)}removeListener(e){const t=this.eventInfoStore.remove(e);if(t){const e=t.element,n=this.getEventHandlerInfosForElement(e,!1);n&&n.removeHandler(t.eventName)}}notifyAfterClick(e){this.afterClickCallbacks.push(e),this.eventInfoStore.addGlobalListener("click")}setStopPropagation(e,t,n){this.getEventHandlerInfosForElement(e,!0).stopPropagation(t,n)}setPreventDefault(e,t,n){this.getEventHandlerInfosForElement(e,!0).preventDefault(t,n)}onGlobalEvent(e){if(!(e.target instanceof Element))return;this.dispatchGlobalEventToAllElements(e.type,e);const t=(n=e.type,s.get(n));var n;t&&t.forEach((t=>this.dispatchGlobalEventToAllElements(t,e))),"click"===e.type&&this.afterClickCallbacks.forEach((t=>t(e)))}dispatchGlobalEventToAllElements(e,t){const n=t.composedPath();let r=n.shift(),i=null,s=!1;const a=Object.prototype.hasOwnProperty.call(x,e);let l=!1;for(;r;){const d=r,p=this.getEventHandlerInfosForElement(d,!1);if(p){const n=p.getHandler(e);if(n&&(h=d,u=t.type,!((h instanceof HTMLButtonElement||h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(R,u)&&h.disabled))){if(!s){const n=c(e);i=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(D,t.type)&&t.preventDefault(),I(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},i)}p.stopPropagation(e)&&(l=!0),p.preventDefault(e)&&t.preventDefault()}r=a||l?void 0:n.shift()}var h,u}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new A:null}}P.nextEventDelegatorId=0;class U{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},a.push(this.handleEventNameAliasAdded.bind(this))}add(e){if(this.infosByEventHandlerId[e.eventHandlerId])throw new Error(`Event ${e.eventHandlerId} is already tracked`);this.infosByEventHandlerId[e.eventHandlerId]=e,this.addGlobalListener(e.eventName)}get(e){return this.infosByEventHandlerId[e]}addGlobalListener(e){if(e=l(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(x,e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(Object.prototype.hasOwnProperty.call(this.infosByEventHandlerId,t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=l(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(Object.prototype.hasOwnProperty.call(this.countByEventName,e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class A{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return Object.prototype.hasOwnProperty.call(this.handlers,e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function N(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const L=G("_blazorLogicalChildren"),$=G("_blazorLogicalParent"),M=G("_blazorLogicalEnd");function B(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return L in e||(e[L]=[]),e}function O(e,t){const n=document.createComment("!");return F(n,e,t),n}function F(e,t,n){const r=e;if(e instanceof Comment&&J(r)&&J(r).length>0)throw new Error("Not implemented: inserting non-empty logical container");if(H(r))throw new Error("Not implemented: moving existing logical children");const o=J(t);if(n0;)j(n,0)}const r=n;r.parentNode.removeChild(r)}function H(e){return e[$]||null}function W(e,t){return J(e)[t]}function z(e){const t=V(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function J(e){return e[L]}function q(e,t){const n=J(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=Y(e.moveRangeStart)})),t.forEach((t=>{const r=document.createComment("marker");t.moveToBeforeMarker=r;const o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):X(r,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd;let i=r;for(;i;){const e=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=e}n.removeChild(t)})),t.forEach((e=>{n[e.toSiblingIndex]=e.moveRangeStart}))}function V(e){if(e instanceof Element||e instanceof DocumentFragment)return e;if(e instanceof Comment)return e.parentNode;throw new Error("Not a valid logical element")}function K(e){const t=J(H(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function X(e,t){if(t instanceof Element||t instanceof DocumentFragment)t.appendChild(e);else{if(!(t instanceof Comment))throw new Error(`Cannot append node because the parent is not a valid logical element. Parent: ${t}`);{const n=K(t);n?n.parentNode.insertBefore(e,n):X(e,H(t))}}}function Y(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=K(e);if(t)return t.previousSibling;{const t=H(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:Y(t)}}function G(e){return"function"==typeof Symbol?Symbol():e}function Q(e){return`_bl_${e}`}e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"__internalId")&&"string"==typeof t.__internalId?function(e){const t=`[${Q(e)}]`;return document.querySelector(t)}(t.__internalId):t));const Z="_blazorDeferredValue",ee=document.createElement("template"),te=document.createElementNS("http://www.w3.org/2000/svg","g"),ne={},re="__internal_",oe="preventDefault_",ie="stopPropagation_";class se{constructor(e){this.rootComponentIds=new Set,this.childComponentLocations={},this.eventDelegator=new P(e),this.eventDelegator.notifyAfterClick((e=>{if(!fe)return;if(0!==e.button||function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e))return;if(e.defaultPrevented)return;const t=function(e){const t=!window._blazorDisableComposedPath&&e.composedPath&&e.composedPath();if(t){for(let e=0;edocument.baseURI,getLocationHref:()=>location.href};function Ce(e,t,n=!1){const r=Ue(e);!t.forceLoad&&Ne(r)?Ie(r,!1,t.replaceHistoryEntry,t.historyEntryState,n):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Ie(e,t,n,r,o=!1){Te(),(o||!me||await xe(e,r,t))&&(pe=!0,n?history.replaceState({userState:r,_index:ye},"",e):(ye++,history.pushState({userState:r,_index:ye},"",e)),await De(t))}function ke(e){return new Promise((t=>{const n=_e;_e=()=>{_e=n,t()},history.go(e)}))}function Te(){Ee&&(Ee(!1),Ee=null)}function xe(e,t,n){return new Promise((r=>{Te(),be?(we++,Ee=r,be(we,e,t,n)):r(!1)}))}async function De(e){var t;ve&&await ve(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function Re(e){var t,n;_e&&await _e(e),ye=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}let Pe;function Ue(e){return Pe=Pe||document.createElement("a"),Pe.href=e,Pe.href}function Ae(e,t){return e?e.tagName===t?e:Ae(e.parentElement,t):null}function Ne(e){const t=(n=document.baseURI).substring(0,n.lastIndexOf("/"));var n;const r=e.charAt(t.length);return e.startsWith(t)&&(""===r||"/"===r||"?"===r||"#"===r)}const Le={focus:function(e,t){if(e instanceof HTMLElement)e.focus({preventScroll:t});else{if(!(e instanceof SVGElement))throw new Error("Unable to focus an invalid element.");if(!e.hasAttribute("tabindex"))throw new Error("Unable to focus an SVG element that does not have a tabindex.");e.focus({preventScroll:t})}},focusBySelector:function(e){const t=document.querySelector(e);t&&(t.hasAttribute("tabindex")||(t.tabIndex=-1),t.focus())}},$e={init:function(e,t,n,r=50){const o=Be(t);(o||document.documentElement).style.overflowAnchor="none";const i=document.createRange();h(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(r){r.forEach((r=>{var o;if(!r.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const s=i.getBoundingClientRect().height,a=null===(o=r.rootBounds)||void 0===o?void 0:o.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,s,a):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,s,a)}))}),{root:o,rootMargin:`${r}px`});s.observe(t),s.observe(n);const a=l(t),c=l(n);function l(e){const t={attributes:!0},n=new MutationObserver(((n,r)=>{h(e.parentElement)&&(r.disconnect(),e.style.display="table-row",r.observe(e,t)),s.unobserve(e),s.observe(e)}));return n.observe(e,t),n}function h(e){return null!==e&&(e instanceof HTMLTableElement&&""===e.style.display||"table"===e.style.display||e instanceof HTMLTableSectionElement&&""===e.style.display||"table-row-group"===e.style.display)}Me[e._id]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const t=Me[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete Me[e._id])}},Me={};function Be(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:Be(e.parentElement):null}const Oe={getAndRemoveExistingTitle:function(){var e;const t=document.head?document.head.getElementsByTagName("title"):[];if(0===t.length)return null;let n=null;for(let r=t.length-1;r>=0;r--){const o=t[r],i=o.previousSibling;i instanceof Comment&&null!==H(i)||(null===n&&(n=o.textContent),null===(e=o.parentNode)||void 0===e||e.removeChild(o))}return n}},Fe={init:function(e,t){t._blazorInputFileNextFileId=0,t.addEventListener("click",(function(){t.value=""})),t.addEventListener("change",(function(){t._blazorFilesById={};const n=Array.prototype.map.call(t.files,(function(e){const n={id:++t._blazorInputFileNextFileId,lastModified:new Date(e.lastModified).toISOString(),name:e.name,size:e.size,contentType:e.type,readPromise:void 0,arrayBuffer:void 0,blob:e};return t._blazorFilesById[n.id]=n,n}));e.invokeMethodAsync("NotifyChange",n)}))},toImageFile:async function(e,t,n,r,o){const i=je(e,t),s=await new Promise((function(e){const t=new Image;t.onload=function(){URL.revokeObjectURL(t.src),e(t)},t.onerror=function(){t.onerror=null,URL.revokeObjectURL(t.src)},t.src=URL.createObjectURL(i.blob)})),a=await new Promise((function(e){var t;const i=Math.min(1,r/s.width),a=Math.min(1,o/s.height),c=Math.min(i,a),l=document.createElement("canvas");l.width=Math.round(s.width*c),l.height=Math.round(s.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(s,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return je(e,t).blob}};function je(e,t){const n=e._blazorFilesById[t];if(!n)throw new Error(`There is no file with ID ${t}. The file list may have changed. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.`);return n}const He=new Set,We={enableNavigationPrompt:function(e){0===He.size&&window.addEventListener("beforeunload",ze),He.add(e)},disableNavigationPrompt:function(e){He.delete(e),0===He.size&&window.removeEventListener("beforeunload",ze)}};function ze(e){e.preventDefault(),e.returnValue=!0}async function Je(e,t,n){return e instanceof Blob?await async function(e,t,n){const r=e.slice(t,t+n),o=await r.arrayBuffer();return new Uint8Array(o)}(e,t,n):function(e,t,n){return new Uint8Array(e.buffer,e.byteOffset+t,n)}(e,t,n)}const qe=new Map,Ve={navigateTo:function(e,t,n=!1){Ce(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(i.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=s.get(t.browserEventName);n?n.push(e):s.set(t.browserEventName,[e]),a.forEach((n=>n(e,t.browserEventName)))}i.set(e,t)},rootComponents:w,_internal:{navigationManager:Se,domWrapper:Le,Virtualize:$e,PageTitle:Oe,InputFile:Fe,NavigationLock:We,getJSDataStreamChunk:Je,receiveDotNetDataStream:function(t,n,r,o){let i=qe.get(t);if(!i){const n=new ReadableStream({start(e){qe.set(t,e),i=e}});e.jsCallDispatcher.supplyDotNetStream(t,n)}o?(i.error(o),qe.delete(t)):0===r?(i.close(),qe.delete(t)):i.enqueue(n.length===r?n:n.subarray(0,r))},attachWebRendererInterop:function(t,n,r,o){if(E.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);E.set(t,n),Object.keys(r).length>0&&function(t,n,r){if(g)throw new Error("Dynamic root components have already been enabled.");g=t,m=n;for(const[t,o]of Object.entries(r)){const r=e.jsCallDispatcher.findJSFunction(t,0);for(const e of o)r(e,n[e])}}(k(t),r,o),S()}}};window.Blazor=Ve;const Ke=[0,2e3,1e4,3e4,null];class Xe{constructor(e){this._retryDelays=void 0!==e?[...e,null]:Ke}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class Ye{}Ye.Authorization="Authorization",Ye.Cookie="Cookie";class Ge{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class Qe{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}class Ze extends Qe{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&401===n.statusCode&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[Ye.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[Ye.Authorization]&&delete e.headers[Ye.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}class et extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class tt extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class nt extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class rt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class ot extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class it extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class st extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class at extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}var ct,lt,ht,ut,dt;!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(ct||(ct={}));class pt{constructor(){}log(e,t){}}pt.instance=new pt;class ft{static isRequired(e,t){if(null==e)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,n){if(!(e in t))throw new Error(`Unknown ${n} value: ${e}.`)}}class gt{static get isBrowser(){return"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isReactNative(){return"object"==typeof window&&void 0===window.document}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}}function mt(e,t){let n="";return yt(e)?(n=`Binary data of length ${e.byteLength}`,t&&(n+=`. Content: '${function(e){const t=new Uint8Array(e);let n="";return t.forEach((e=>{n+=`0x${e<16?"0":""}${e.toString(16)} `})),n.substr(0,n.length-1)}(e)}'`)):"string"==typeof e&&(n=`String data of length ${e.length}`,t&&(n+=`. Content: '${e}'`)),n}function yt(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function wt(e,t,n,r,o,i){const s={},[a,c]=_t();s[a]=c,e.log(ct.Trace,`(${t} transport) sending data. ${mt(o,i.logMessageContent)}.`);const l=yt(o)?"arraybuffer":"text",h=await n.post(r,{content:o,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(ct.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class vt{constructor(e,t){this._subject=e,this._observer=t}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),0===this._subject.observers.length&&this._subject.cancelCallback&&this._subject.cancelCallback().catch((e=>{}))}}class bt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${ct[e]}: ${t}`;switch(e){case ct.Critical:case ct.Error:this.out.error(n);break;case ct.Warning:this.out.warn(n);break;case ct.Information:this.out.info(n);break;default:this.out.log(n)}}}}function _t(){let e="X-SignalR-User-Agent";return gt.isNode&&(e="User-Agent"),[e,Et("0.0.0-DEV_BUILD",St(),gt.isNode?"NodeJS":"Browser",Ct())]}function Et(e,t,n,r){let o="Microsoft SignalR/";const i=e.split(".");return o+=`${i[0]}.${i[1]}`,o+=` (${e}; `,o+=t&&""!==t?`${t}; `:"Unknown OS; ",o+=`${n}`,o+=r?`; ${r}`:"; Unknown Runtime Version",o+=")",o}function St(){if(!gt.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function Ct(){if(gt.isNode)return process.versions.node}function It(e){return e.stack?e.stack:e.message?e.message:`${e}`}class kt extends Qe{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e=require;this._jar=new(e("tough-cookie").CookieJar),this._fetchType=e("node-fetch"),this._fetchType=e("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("could not find global")}());if("undefined"==typeof AbortController){const e=require;this._abortControllerType=e("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new nt;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const t=new this._abortControllerType;let n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new nt});let r,o=null;if(e.timeout){const r=e.timeout;o=setTimeout((()=>{t.abort(),this._logger.log(ct.Warning,"Timeout from HTTP request."),n=new tt}),r)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},yt(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");try{r=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:!0===e.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(e){if(n)throw n;throw this._logger.log(ct.Warning,`Error from HTTP request. ${e}.`),e}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!r.ok){const e=await Tt(r,"text");throw new et(e||r.statusText,r.status)}const i=Tt(r,e.responseType),s=await i;return new Ge(r.status,r.statusText,s)}getCookieString(e){return""}}function Tt(e,t){let n;switch(t){case"arraybuffer":n=e.arrayBuffer();break;case"text":default:n=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`)}return n}class xt extends Qe{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new nt):e.method?e.url?new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),r.withCredentials=void 0===e.withCredentials||e.withCredentials,r.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===e.content&&(e.content=void 0),e.content&&(yt(e.content)?r.setRequestHeader("Content-Type","application/octet-stream"):r.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach((e=>{r.setRequestHeader(e,o[e])})),e.responseType&&(r.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{r.abort(),n(new nt)}),e.timeout&&(r.timeout=e.timeout),r.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),r.status>=200&&r.status<300?t(new Ge(r.status,r.statusText,r.response||r.responseText)):n(new et(r.response||r.responseText||r.statusText,r.status))},r.onerror=()=>{this._logger.log(ct.Warning,`Error from HTTP request. ${r.status}: ${r.statusText}.`),n(new et(r.statusText,r.status))},r.ontimeout=()=>{this._logger.log(ct.Warning,"Timeout from HTTP request."),n(new tt)},r.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Dt extends Qe{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new kt(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new xt(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new nt):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(lt||(lt={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(ht||(ht={}));class Rt{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}}class Pt{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new Rt,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(ft.isRequired(e,"url"),ft.isRequired(t,"transferFormat"),ft.isIn(t,ht,"transferFormat"),this._url=e,this._logger.log(ct.Trace,"(LongPolling transport) Connecting."),t===ht.Binary&&"undefined"!=typeof XMLHttpRequest&&"string"!=typeof(new XMLHttpRequest).responseType)throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,r]=_t(),o={[n]:r,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===ht.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(ct.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(ct.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new et(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(ct.Trace,`(LongPolling transport) polling: ${n}.`);const r=await this._httpClient.get(n,t);204===r.statusCode?(this._logger.log(ct.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==r.statusCode?(this._logger.log(ct.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this._closeError=new et(r.statusText||"",r.statusCode),this._running=!1):r.content?(this._logger.log(ct.Trace,`(LongPolling transport) data received. ${mt(r.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this._logger.log(ct.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof tt?this._logger.log(ct.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(ct.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(ct.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?wt(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(ct.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(ct.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=_t();e[t]=n;const r={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};await this._httpClient.delete(this._url,r),this._logger.log(ct.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(ct.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(ct.Trace,e),this.onclose(this._closeError)}}}class Ut{constructor(e,t,n,r){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=r,this.onreceive=null,this.onclose=null}async connect(e,t){return ft.isRequired(e,"url"),ft.isRequired(t,"transferFormat"),ft.isIn(t,ht,"transferFormat"),this._logger.log(ct.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,r)=>{let o,i=!1;if(t===ht.Text){if(gt.isBrowser||gt.isWebWorker)o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const t=this._httpClient.getCookieString(e),n={};n.Cookie=t;const[r,i]=_t();n[r]=i,o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...n,...this._options.headers}})}try{o.onmessage=e=>{if(this.onreceive)try{this._logger.log(ct.Trace,`(SSE transport) data received. ${mt(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},o.onerror=e=>{i?this._close():r(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},o.onopen=()=>{this._logger.log(ct.Information,`SSE connected to ${this._url}`),this._eventSource=o,i=!0,n()}}catch(e){return void r(e)}}else r(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(e){return this._eventSource?wt(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class At{constructor(e,t,n,r,o,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=r,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){let n;return ft.isRequired(e,"url"),ft.isRequired(t,"transferFormat"),ft.isIn(t,ht,"transferFormat"),this._logger.log(ct.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((r,o)=>{let i;e=e.replace(/^http/,"ws");const s=this._httpClient.getCookieString(e);let a=!1;if(gt.isReactNative){const t={},[r,o]=_t();t[r]=o,n&&(t[Ye.Authorization]=`Bearer ${n}`),s&&(t[Ye.Cookie]=s),i=new this._webSocketConstructor(e,void 0,{headers:{...t,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===ht.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(ct.Information,`WebSocket connected to ${e}.`),this._webSocket=i,a=!0,r()},i.onerror=e=>{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"There was an error with the transport",this._logger.log(ct.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(ct.Trace,`(WebSockets transport) data received. ${mt(e.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(e.data)}catch(e){return void this._close(e)}},i.onclose=e=>{if(a)this._close(e);else{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(ct.Trace,`(WebSockets transport) sending data. ${mt(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(ct.Trace,"(WebSockets transport) socket closed."),this.onclose&&(!this._isCloseEvent(e)||!1!==e.wasClean&&1e3===e.code?e instanceof Error?this.onclose(e):this.onclose():this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)))}_isCloseEvent(e){return e&&"boolean"==typeof e.wasClean&&"number"==typeof e.code}}class Nt{constructor(e,t={}){var n;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,ft.isRequired(e,"url"),this._logger=void 0===(n=t.logger)?new bt(ct.Information):null===n?pt.instance:void 0!==n.log?n:new bt(n),this.baseUrl=this._resolveUrl(e),(t=t||{}).logMessageContent=void 0!==t.logMessageContent&&t.logMessageContent,"boolean"!=typeof t.withCredentials&&void 0!==t.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.withCredentials=void 0===t.withCredentials||t.withCredentials,t.timeout=void 0===t.timeout?1e5:t.timeout,"undefined"==typeof WebSocket||t.WebSocket||(t.WebSocket=WebSocket),"undefined"==typeof EventSource||t.EventSource||(t.EventSource=EventSource),this._httpClient=new Ze(t.httpClient||new Dt(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||ht.Binary,ft.isIn(e,ht,"transferFormat"),this._logger.log(ct.Debug,`Starting connection with transfer format '${ht[e]}'.`),"Disconnected"!==this._connectionState)return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,"Disconnecting"===this._connectionState){const e="Failed to start the HttpConnection before stop() was called.";return this._logger.log(ct.Error,e),await this._stopPromise,Promise.reject(new nt(e))}if("Connected"!==this._connectionState){const e="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(ct.Error,e),Promise.reject(new nt(e))}this._connectionStarted=!0}send(e){return"Connected"!==this._connectionState?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Lt(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(ct.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(ct.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState="Disconnecting",this._stopPromise=new Promise((e=>{this._stopPromiseResolver=e})),await this._stopInternal(e),void await this._stopPromise)}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch(e){}if(this.transport){try{await this.transport.stop()}catch(e){this._logger.log(ct.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(ct.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport!==lt.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(lt.WebSockets),await this._startTransport(t,e)}else{let n=null,r=0;do{if(n=await this._getNegotiationResponse(t),"Disconnecting"===this._connectionState||"Disconnected"===this._connectionState)throw new nt("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const e=n.accessToken;this._accessTokenFactory=()=>e,this._httpClient._accessToken=e,this._httpClient._accessTokenFactory=void 0}r++}while(n.url&&r<100);if(100===r&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof Pt&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(ct.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(ct.Error,"Failed to start the connection: "+e),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(e)}}async _getNegotiationResponse(e){const t={},[n,r]=_t();t[n]=r;const o=this._resolveNegotiateUrl(e);this._logger.log(ct.Debug,`Sending negotiation request: ${o}.`);try{const e=await this._httpClient.post(o,{content:"",headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(200!==e.statusCode)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${e.statusCode}'`));const n=JSON.parse(e.content);return(!n.negotiateVersion||n.negotiateVersion<1)&&(n.connectionToken=n.connectionId),n}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof et&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(ct.Error,t),Promise.reject(new st(t))}}_createConnectUrl(e,t){return t?e+(-1===e.indexOf("?")?"?":"&")+`id=${t}`:e}async _createTransport(e,t,n,r){let o=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t))return this._logger.log(ct.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(o,r),void(this.connectionId=n.connectionId);const i=[],s=n.availableTransports||[];let a=n;for(const n of s){const s=this._resolveTransportOrError(n,t,r);if(s instanceof Error)i.push(`${n.transport} failed:`),i.push(s);else if(this._isITransport(s)){if(this.transport=s,!a){try{a=await this._getNegotiationResponse(e)}catch(e){return Promise.reject(e)}o=this._createConnectUrl(e,a.connectionToken)}try{return await this._startTransport(o,r),void(this.connectionId=a.connectionId)}catch(e){if(this._logger.log(ct.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new it(`${n.transport} failed: ${e}`,lt[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(ct.Debug,e),Promise.reject(new nt(e))}}}}return i.length>0?Promise.reject(new at(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case lt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new At(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case lt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Ut(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case lt.LongPolling:return new Pt(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n){const r=lt[e.transport];if(null==r)return this._logger.log(ct.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(!function(e,t){return!e||0!=(t&e)}(t,r))return this._logger.log(ct.Debug,`Skipping transport '${lt[r]}' because it was disabled by the client.`),new ot(`'${lt[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>ht[e])).indexOf(n)>=0))return this._logger.log(ct.Debug,`Skipping transport '${lt[r]}' because it does not support the requested transfer format '${ht[n]}'.`),new Error(`'${lt[r]}' does not support ${ht[n]}.`);if(r===lt.WebSockets&&!this._options.WebSocket||r===lt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(ct.Debug,`Skipping transport '${lt[r]}' because it is not supported in your environment.'`),new rt(`'${lt[r]}' is not supported in your environment.`,r);this._logger.log(ct.Debug,`Selecting transport '${lt[r]}'.`);try{return this._constructTransport(r)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(ct.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,"Disconnected"!==this._connectionState){if("Connecting"===this._connectionState)throw this._logger.log(ct.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if("Disconnecting"===this._connectionState&&this._stopPromiseResolver(),e?this._logger.log(ct.Error,`Connection disconnected with error '${e}'.`):this._logger.log(ct.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(ct.Error,`TransportSendQueue.stop() threw error '${e}'.`)})),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(ct.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(ct.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`)}_resolveUrl(e){if(0===e.lastIndexOf("https://",0)||0===e.lastIndexOf("http://",0))return e;if(!gt.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(ct.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=e.indexOf("?");let n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",n+=-1===t?"":e.substring(t),-1===n.indexOf("negotiateVersion")&&(n+=-1===t?"?":"&",n+="negotiateVersion="+this._negotiateVersion),n}}class Lt{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new $t,this._transportResult=new $t,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new $t),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new $t;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):Lt._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(t),e.resolve()}catch(t){e.reject(t)}}}static _concatBuffers(e){const t=e.map((e=>e.byteLength)).reduce(((e,t)=>e+t)),n=new Uint8Array(t);let r=0;for(const t of e)n.set(new Uint8Array(t),r),r+=t.byteLength;return n.buffer}}class $t{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class Mt{static write(e){return`${e}${Mt.RecordSeparator}`}static parse(e){if(e[e.length-1]!==Mt.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(Mt.RecordSeparator);return t.pop(),t}}Mt.RecordSeparatorCode=30,Mt.RecordSeparator=String.fromCharCode(Mt.RecordSeparatorCode);class Bt{writeHandshakeRequest(e){return Mt.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(yt(e)){const r=new Uint8Array(e),o=r.indexOf(Mt.RecordSeparatorCode);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(r.slice(0,i))),n=r.byteLength>i?r.slice(i).buffer:null}else{const r=e,o=r.indexOf(Mt.RecordSeparator);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=r.substring(0,i),n=r.length>i?r.substring(i):null}const r=Mt.parse(t),o=JSON.parse(r[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[n,o]}}!function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close"}(ut||(ut={}));class Ot{constructor(){this.observers=[]}next(e){for(const t of this.observers)t.next(e)}error(e){for(const t of this.observers)t.error&&t.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new vt(this,e)}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(dt||(dt={}));class Ft{static create(e,t,n,r,o,i){return new Ft(e,t,n,r,o,i)}constructor(e,t,n,r,o,i){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(ct.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},ft.isRequired(e,"connection"),ft.isRequired(t,"logger"),ft.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=o?o:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=r,this._handshakeProtocol=new Bt,this.connection.onreceive=e=>this._processIncomingData(e),this.connection.onclose=e=>this._connectionClosed(e),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=dt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:ut.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==dt.Disconnected&&this._connectionState!==dt.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==dt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=dt.Connecting,this._logger.log(ct.Debug,"Starting HubConnection.");try{await this._startInternal(),gt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=dt.Connected,this._connectionStarted=!0,this._logger.log(ct.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=dt.Disconnected,this._logger.log(ct.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise(((e,t)=>{this._handshakeResolver=e,this._handshakeRejecter=t}));await this.connection.start(this._protocol.transferFormat);try{const t={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(ct.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(ct.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(ct.Debug,`Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(e),e}}async stop(){const e=this._startPromise;this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){return this._connectionState===dt.Disconnected?(this._logger.log(ct.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===dt.Disconnecting?(this._logger.log(ct.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=dt.Disconnecting,this._logger.log(ct.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(ct.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new nt("The connection was stopped before the hub handshake could complete."),this.connection.stop(e)))}stream(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createStreamInvocation(e,t,r);let i;const s=new Ot;return s.cancelCallback=()=>{const e=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then((()=>this._sendWithProtocol(e)))},this._callbacks[o.invocationId]=(e,t)=>{t?s.error(t):e&&(e.type===ut.Completion?e.error?s.error(new Error(e.error)):s.complete():s.next(e.item))},i=this._sendWithProtocol(o).catch((e=>{s.error(e),delete this._callbacks[o.invocationId]})),this._launchStreams(n,i),s}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._sendWithProtocol(this._createInvocation(e,t,!0,r));return this._launchStreams(n,o),o}invoke(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createInvocation(e,t,!1,r);return new Promise(((e,t)=>{this._callbacks[o.invocationId]=(n,r)=>{r?t(r):n&&(n.type===ut.Completion?n.error?t(new Error(n.error)):e(n.result):t(new Error(`Unexpected message type: ${n.type}`)))};const r=this._sendWithProtocol(o).catch((e=>{t(e),delete this._callbacks[o.invocationId]}));this._launchStreams(n,r)}))}on(e,t){e&&t&&(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),-1===this._methods[e].indexOf(t)&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();const n=this._methods[e];if(n)if(t){const r=n.indexOf(t);-1!==r&&(n.splice(r,1),0===n.length&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){const t=this._protocol.parseMessages(e,this._logger);for(const e of t)switch(e.type){case ut.Invocation:this._invokeClientMethod(e);break;case ut.StreamItem:case ut.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===ut.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(ct.Error,`Stream callback threw error: ${It(e)}`)}}break}case ut.Ping:break;case ut.Close:{this._logger.log(ct.Information,"Close message received from server.");const t=e.error?new Error("Server returned an error on close: "+e.error):void 0;!0===e.allowReconnect?this.connection.stop(t):this._stopPromise=this._stopInternal(t);break}default:this._logger.log(ct.Warning,`Invalid message type: ${e.type}.`)}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(e){const t="Error parsing handshake response: "+e;this._logger.log(ct.Error,t);const n=new Error(t);throw this._handshakeRejecter(n),n}if(t.error){const e="Server returned handshake error: "+t.error;this._logger.log(ct.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(ct.Debug,"Server handshake complete."),this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=(new Date).getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!(this.connection.features&&this.connection.features.inherentKeepAlive||(this._timeoutHandle=setTimeout((()=>this.serverTimeout()),this.serverTimeoutInMilliseconds),void 0!==this._pingServerHandle))){let e=this._nextKeepAlive-(new Date).getTime();e<0&&(e=0),this._pingServerHandle=setTimeout((async()=>{if(this._connectionState===dt.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n)return this._logger.log(ct.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(ct.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null))));const r=n.slice(),o=!!e.invocationId;let i,s,a;for(const n of r)try{const r=i;i=await n.apply(this,e.arguments),o&&i&&r&&(this._logger.log(ct.Error,`Multiple results provided for '${t}'. Sending error to server.`),a=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),s=void 0}catch(e){s=e,this._logger.log(ct.Error,`A callback for the method '${t}' threw error '${e}'.`)}a?await this._sendWithProtocol(a):o?(s?a=this._createCompletionMessage(e.invocationId,`${s}`,null):void 0!==i?a=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(ct.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),a=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(a)):i&&this._logger.log(ct.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(ct.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new nt("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===dt.Disconnecting?this._completeClose(e):this._connectionState===dt.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===dt.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=dt.Disconnected,this._connectionStarted=!1,gt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(ct.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}async _reconnect(e){const t=Date.now();let n=0,r=void 0!==e?e:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(n++,0,r);if(null===o)return this._logger.log(ct.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=dt.Reconnecting,e?this._logger.log(ct.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(ct.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(ct.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==dt.Reconnecting)return void this._logger.log(ct.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==o;){if(this._logger.log(ct.Information,`Reconnect attempt number ${n} will start in ${o} ms.`),await new Promise((e=>{this._reconnectDelayHandle=setTimeout(e,o)})),this._reconnectDelayHandle=void 0,this._connectionState!==dt.Reconnecting)return void this._logger.log(ct.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=dt.Connected,this._logger.log(ct.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(ct.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(ct.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==dt.Reconnecting)return this._logger.log(ct.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===dt.Disconnecting&&this._completeClose());r=e instanceof Error?e:new Error(e.toString()),o=this._getNextRetryDelay(n++,Date.now()-t,r)}}this._logger.log(ct.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(n){return this._logger.log(ct.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach((n=>{const r=t[n];try{r(null,e)}catch(t){this._logger.log(ct.Error,`Stream 'error' callback called with '${e}' threw error: ${It(t)}`)}}))}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,r){if(n)return 0!==r.length?{arguments:t,streamIds:r,target:e,type:ut.Invocation}:{arguments:t,target:e,type:ut.Invocation};{const n=this._invocationId;return this._invocationId++,0!==r.length?{arguments:t,invocationId:n.toString(),streamIds:r,target:e,type:ut.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:ut.Invocation}}}_launchStreams(e,t){if(0!==e.length){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n))))},error:e=>{let r;r=e instanceof Error?e.message:e&&e.toString?e.toString():"Unknown error",t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n,r))))},next:e=>{t=t.then((()=>this._sendWithProtocol(this._createStreamItemMessage(n,e))))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let r=0;r=55296&&o<=56319&&r65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h)}else i.push(a);i.length>=4096&&(s+=String.fromCharCode.apply(String,i),i.length=0)}return i.length>0&&(s+=String.fromCharCode.apply(String,i)),s}var nn,rn=Yt?new TextDecoder:null,on=Yt?"undefined"!=typeof process&&"force"!==(null===(qt=null===process||void 0===process?void 0:process.env)||void 0===qt?void 0:qt.TEXT_DECODER)?200:0:Vt,sn=function(e,t){this.type=e,this.data=t},an=(nn=function(e,t){return nn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},nn(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}nn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),cn=function(e){function t(n){var r=e.call(this,n)||this,o=Object.create(t.prototype);return Object.setPrototypeOf(r,o),Object.defineProperty(r,"name",{configurable:!0,enumerable:!1,value:t.name}),r}return an(t,e),t}(Error),ln={type:-1,encode:function(e){var t,n,r,o;return e instanceof Date?function(e){var t,n=e.sec,r=e.nsec;if(n>=0&&r>=0&&n<=17179869183){if(0===r&&n<=4294967295){var o=new Uint8Array(4);return(t=new DataView(o.buffer)).setUint32(0,n),o}var i=n/4294967296,s=4294967295&n;return o=new Uint8Array(8),(t=new DataView(o.buffer)).setUint32(0,r<<2|3&i),t.setUint32(4,s),o}return o=new Uint8Array(12),(t=new DataView(o.buffer)).setUint32(0,r),Kt(t,4,n),o}((r=1e6*((t=e.getTime())-1e3*(n=Math.floor(t/1e3))),{sec:n+(o=Math.floor(r/1e9)),nsec:r-1e9*o})):null},decode:function(e){var t=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:var n=t.getUint32(0);return{sec:4294967296*(3&n)+t.getUint32(4),nsec:n>>>2};case 12:return{sec:Xt(t,4),nsec:t.getUint32(0)};default:throw new cn("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},hn=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(ln)}return e.prototype.register=function(e){var t=e.type,n=e.encode,r=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=r;else{var o=1+t;this.builtInEncoders[o]=n,this.builtInDecoders[o]=r}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>Zt){var t=Gt(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),en(e,this.bytes,this.pos),this.pos+=t}else t=Gt(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var r=e.length,o=n,i=0;i>6&31|192;else{if(s>=55296&&s<=56319&&i>12&15|224,t[o++]=s>>6&63|128):(t[o++]=s>>18&7|240,t[o++]=s>>12&63|128,t[o++]=s>>6&63|128)}t[o++]=63&s|128}else t[o++]=s}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=un(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var r=0,o=e;r0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var r=0,o=this.caches[n-1];r=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)},e.prototype.decode=function(e,t,n){var r=this.find(e,t,n);if(null!=r)return this.hit++,r;this.miss++;var o=tn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,o),o},e}(),gn=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]1||a(e,t)}))})}function a(e,t){try{(n=o[e](t)).value instanceof yn?Promise.resolve(n.value.v).then(c,l):h(i[0][2],n)}catch(e){h(i[0][3],e)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function h(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}},vn=new DataView(new ArrayBuffer(0)),bn=new Uint8Array(vn.buffer),_n=function(){try{vn.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),En=new _n("Insufficient data"),Sn=new fn,Cn=function(){function e(e,t,n,r,o,i,s,a){void 0===e&&(e=hn.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=Vt),void 0===r&&(r=Vt),void 0===o&&(o=Vt),void 0===i&&(i=Vt),void 0===s&&(s=Vt),void 0===a&&(a=Sn),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=r,this.maxArrayLength=o,this.maxMapLength=i,this.maxExtLength=s,this.keyDecoder=a,this.totalPos=0,this.pos=0,this.view=vn,this.bytes=bn,this.headByte=-1,this.stack=[]}return e.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},e.prototype.setBuffer=function(e){this.bytes=un(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=un(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0},e.prototype.appendBuffer=function(e){if(-1!==this.headByte||this.hasRemaining(1)){var t=this.bytes.subarray(this.pos),n=un(e),r=new Uint8Array(t.length+n.length);r.set(t),r.set(n,t.length),this.setBuffer(r)}else this.setBuffer(e)},e.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return gn(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,n,r,o,i,s,a;return i=this,void 0,a=function(){var i,s,a,c,l,h,u,d;return gn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=mn(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),i=!0}catch(e){if(!(e instanceof _n))throw e}this.totalPos+=this.pos,p.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return c=p.sent(),r={error:c},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,s]}throw h=(l=this).headByte,u=l.pos,d=l.totalPos,new RangeError("Insufficient data in parsing ".concat(pn(h)," at ").concat(d," (").concat(u," in the current buffer)"))}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{o(a.next(e))}catch(e){t(e)}}function r(e){try{o(a.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}o((a=a.apply(i,[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return wn(this,arguments,(function(){var n,r,o,i,s,a,c,l,h;return gn(this,(function(u){switch(u.label){case 0:n=t,r=-1,u.label=1;case 1:u.trys.push([1,13,14,19]),o=mn(e),u.label=2;case 2:return[4,yn(o.next())];case 3:if((i=u.sent()).done)return[3,12];if(s=i.value,t&&0===r)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(r=this.readArraySize(),n=!1,this.complete()),u.label=4;case 4:u.trys.push([4,9,,10]),u.label=5;case 5:return[4,yn(this.doDecodeSync())];case 6:return[4,u.sent()];case 7:return u.sent(),0==--r?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=u.sent())instanceof _n))throw a;return[3,10];case 10:this.totalPos+=this.pos,u.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=u.sent(),l={error:c},[3,19];case 14:return u.trys.push([14,,17,18]),i&&!i.done&&(h=o.return)?[4,yn(h.call(o))]:[3,16];case 15:u.sent(),u.label=16;case 16:return[3,18];case 17:if(l)throw l.error;return[7];case 18:return[7];case 19:return[2]}}))}))},e.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){if(0!=(r=e-128)){this.pushMapState(r),this.complete();continue e}t={}}else if(e<160){if(0!=(r=e-144)){this.pushArrayState(r),this.complete();continue e}t=[]}else{var n=e-160;t=this.decodeUtf8String(n,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e)n=this.lookU8(),t=this.decodeUtf8String(n,1);else if(218===e)n=this.lookU16(),t=this.decodeUtf8String(n,2);else if(219===e)n=this.lookU32(),t=this.decodeUtf8String(n,4);else if(220===e){if(0!==(r=this.readU16())){this.pushArrayState(r),this.complete();continue e}t=[]}else if(221===e){if(0!==(r=this.readU32())){this.pushArrayState(r),this.complete();continue e}t=[]}else if(222===e){if(0!==(r=this.readU16())){this.pushMapState(r),this.complete();continue e}t={}}else if(223===e){if(0!==(r=this.readU32())){this.pushMapState(r),this.complete();continue e}t={}}else if(196===e){var r=this.lookU8();t=this.decodeBinary(r,1)}else if(197===e)r=this.lookU16(),t=this.decodeBinary(r,2);else if(198===e)r=this.lookU32(),t=this.decodeBinary(r,4);else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e)r=this.lookU8(),t=this.decodeExtension(r,1);else if(200===e)r=this.lookU16(),t=this.decodeExtension(r,2);else{if(201!==e)throw new cn("Unrecognized type byte: ".concat(pn(e)));r=this.lookU32(),t=this.decodeExtension(r,4)}this.complete();for(var o=this.stack;o.length>0;){var i=o[o.length-1];if(0===i.type){if(i.array[i.position]=t,i.position++,i.position!==i.size)continue e;o.pop(),t=i.array}else{if(1===i.type){if("string"!=(s=typeof t)&&"number"!==s)throw new cn("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new cn("The key __proto__ is not allowed");i.key=t,i.type=2;continue e}if(i.map[i.key]=t,i.readCount++,i.readCount!==i.size){i.key=null,i.type=1;continue e}o.pop(),t=i.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new cn("Unrecognized array type byte: ".concat(pn(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new cn("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new cn("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new cn("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthon?function(e,t,n){var r=e.subarray(t,t+n);return rn.decode(r)}(this.bytes,o,e):tn(this.bytes,o,e),this.pos+=t+e,r},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},e.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new cn("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw En;var n=this.pos+t,r=this.bytes.subarray(n,n+e);return this.pos+=t+e,r},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new cn("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,n,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,n},e.prototype.readI64=function(){var e=Xt(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}();class In{static write(e){let t=e.byteLength||e.length;const n=[];do{let e=127&t;t>>=7,t>0&&(e|=128),n.push(e)}while(t>0);t=e.byteLength||e.length;const r=new Uint8Array(n.length+t);return r.set(n,0),r.set(e,n.length),r.buffer}static parse(e){const t=[],n=new Uint8Array(e),r=[0,7,14,21,28];for(let o=0;o7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+s+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+s,o+s+a):n.subarray(o+s,o+s+a)),o=o+s+a}return t}}const kn=new Uint8Array([145,ut.Ping]);class Tn{constructor(e){this.name="messagepack",this.version=1,this.transferFormat=ht.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new dn(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new Cn(e.extensionCodec,e.context,e.maxStrLength,e.maxBinLength,e.maxArrayLength,e.maxMapLength,e.maxExtLength)}parseMessages(e,t){if(!(n=e)||"undefined"==typeof ArrayBuffer||!(n instanceof ArrayBuffer||n.constructor&&"ArrayBuffer"===n.constructor.name))throw new Error("Invalid input for MessagePack hub protocol. Expected an ArrayBuffer.");var n;null===t&&(t=pt.instance);const r=In.parse(e),o=[];for(const e of r){const n=this._parseMessage(e,t);n&&o.push(n)}return o}writeMessage(e){switch(e.type){case ut.Invocation:return this._writeInvocation(e);case ut.StreamInvocation:return this._writeStreamInvocation(e);case ut.StreamItem:return this._writeStreamItem(e);case ut.Completion:return this._writeCompletion(e);case ut.Ping:return In.write(kn);case ut.CancelInvocation:return this._writeCancelInvocation(e);default:throw new Error("Invalid message type.")}}_parseMessage(e,t){if(0===e.length)throw new Error("Invalid payload.");const n=this._decoder.decode(e);if(0===n.length||!(n instanceof Array))throw new Error("Invalid payload.");const r=n[0];switch(r){case ut.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case ut.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case ut.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case ut.Ping:return this._createPingMessage(n);case ut.Close:return this._createCloseMessage(n);default:return t.log(ct.Information,"Unknown message type '"+r+"' ignored."),null}}_createCloseMessage(e){if(e.length<2)throw new Error("Invalid payload for Close message.");return{allowReconnect:e.length>=3?e[2]:void 0,error:e[1],type:ut.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:ut.Ping}}_createInvocationMessage(e,t){if(t.length<5)throw new Error("Invalid payload for Invocation message.");const n=t[2];return n?{arguments:t[4],headers:e,invocationId:n,streamIds:[],target:t[3],type:ut.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:ut.Invocation}}_createStreamItemMessage(e,t){if(t.length<4)throw new Error("Invalid payload for StreamItem message.");return{headers:e,invocationId:t[2],item:t[3],type:ut.StreamItem}}_createCompletionMessage(e,t){if(t.length<4)throw new Error("Invalid payload for Completion message.");const n=t[3];if(n!==this._voidResult&&t.length<5)throw new Error("Invalid payload for Completion message.");let r,o;switch(n){case this._errorResult:r=t[4];break;case this._nonVoidResult:o=t[4]}return{error:r,headers:e,invocationId:t[2],result:o,type:ut.Completion}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([ut.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([ut.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),In.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([ut.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([ut.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),In.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([ut.StreamItem,e.headers||{},e.invocationId,e.item]);return In.write(t.slice())}_writeCompletion(e){const t=e.error?this._errorResult:void 0!==e.result?this._nonVoidResult:this._voidResult;let n;switch(t){case this._errorResult:n=this._encoder.encode([ut.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([ut.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([ut.Completion,e.headers||{},e.invocationId,t,e.result])}return In.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([ut.CancelInvocation,e.headers||{},e.invocationId]);return In.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}let xn=!1;function Dn(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),xn||(xn=!0,document.querySelectorAll("#blazor-error-ui .reload").forEach((e=>{e.onclick=function(e){location.reload(),e.preventDefault()}})),document.querySelectorAll("#blazor-error-ui .dismiss").forEach((e=>{e.onclick=function(e){const t=document.querySelector("#blazor-error-ui");t&&(t.style.display="none"),e.preventDefault()}})))}const Rn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Pn=Rn?Rn.decode.bind(Rn):function(e){let t=0;const n=e.length,r=[],o=[];for(;t65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o)}r.length>1024&&(o.push(String.fromCharCode.apply(null,r)),r.length=0)}return o.push(String.fromCharCode.apply(null,r)),o.join("")},Un=Math.pow(2,32),An=Math.pow(2,21)-1;function Nn(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Ln(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function $n(e,t){const n=Ln(e,t+4);if(n>An)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Un+Ln(e,t)}class Mn{constructor(e){this.batchData=e;const t=new jn(e);this.arrayRangeReader=new Hn(e),this.arrayBuilderSegmentReader=new Wn(e),this.diffReader=new Bn(e),this.editReader=new On(e,t),this.frameReader=new Fn(e,t)}updatedComponents(){return Nn(this.batchData,this.batchData.length-20)}referenceFrames(){return Nn(this.batchData,this.batchData.length-16)}disposedComponentIds(){return Nn(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return Nn(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return Nn(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return Nn(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return $n(this.batchData,n)}}class Bn{constructor(e){this.batchDataUint8=e}componentId(e){return Nn(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class On{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return Nn(this.batchDataUint8,e)}siblingIndex(e){return Nn(this.batchDataUint8,e+4)}newTreeIndex(e){return Nn(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return Nn(this.batchDataUint8,e+8)}removedAttributeName(e){const t=Nn(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class Fn{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return Nn(this.batchDataUint8,e)}subtreeLength(e){return Nn(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=Nn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return Nn(this.batchDataUint8,e+8)}elementName(e){const t=Nn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=Nn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=Nn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=Nn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=Nn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return $n(this.batchDataUint8,e+12)}}class jn{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=Nn(e,e.length-4)}readString(e){if(-1===e)return null;{const n=Nn(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const i=e[t+o];if(n|=(127&i)<this.nextBatchId)return this.fatalError?(this.logger.log(zn.Debug,`Received a new batch ${e} but errored out on a previous batch ${this.nextBatchId-1}`),void await n.send("OnRenderCompleted",this.nextBatchId-1,this.fatalError.toString())):void this.logger.log(zn.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(zn.Debug,`Applying batch ${e}.`),function(e,t){const n=de[e];if(!n)throw new Error(`There is no browser renderer with ID ${e}.`);const r=t.arrayRangeReader,o=t.updatedComponents(),i=r.values(o),s=r.count(o),a=t.referenceFrames(),c=r.values(a),l=t.diffReader;for(let e=0;e=this.minLevel){const n=`[${(new Date).toISOString()}] ${zn[e]}: ${t}`;switch(e){case zn.Critical:case zn.Error:console.error(n);break;case zn.Warning:console.warn(n);break;case zn.Information:console.info(n);break;default:console.log(n)}}}}class Kn{constructor(e,t){this.circuitId=void 0,this.components=e,this.applicationState=t}reconnect(e){if(!this.circuitId)throw new Error("Circuit host not initialized.");return e.state!==dt.Connected?Promise.resolve(!1):e.invoke("ConnectCircuit",this.circuitId)}initialize(e){if(this.circuitId)throw new Error(`Circuit host '${this.circuitId}' already initialized.`);this.circuitId=e}async startCircuit(e){if(e.state!==dt.Connected)return!1;const t=await e.invoke("StartCircuit",Se.getBaseURI(),Se.getLocationHref(),JSON.stringify(this.components.map((e=>e.toRecord()))),this.applicationState||"");return!!t&&(this.initialize(t),!0)}resolveElement(e){const t=function(e){const t=f.get(e);if(t)return f.delete(e),t}(e);if(t)return B(t,!0);const n=Number.parseInt(e);if(!Number.isNaN(n))return function(e,t){if(!e.parentNode)throw new Error(`Comment not connected to the DOM ${e.textContent}`);const n=e.parentNode,r=B(n,!0),o=J(r);return Array.from(n.childNodes).forEach((e=>o.push(e))),e[$]=r,t&&(e[M]=t,B(t)),B(e)}(this.components[n].start,this.components[n].end);throw new Error(`Invalid sequence number or identifier '${e}'.`)}}const Xn={configureSignalR:e=>{},logLevel:zn.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class Yn{constructor(e,t,n,r){this.maxRetries=t,this.document=n,this.logger=r,this.addedToDom=!1,this.modal=this.document.createElement("div"),this.modal.id=e,this.maxRetries=t,this.modal.style.cssText=["position: fixed","top: 0","right: 0","bottom: 0","left: 0","z-index: 1050","display: none","overflow: hidden","background-color: #fff","opacity: 0.8","text-align: center","font-weight: bold","transition: visibility 0s linear 500ms"].join(";"),this.message=this.document.createElement("h5"),this.message.style.cssText="margin-top: 20px",this.button=this.document.createElement("button"),this.button.style.cssText="margin:5px auto 5px",this.button.textContent="Retry";const o=this.document.createElement("a");o.addEventListener("click",(()=>location.reload())),o.textContent="reload",this.reloadParagraph=this.document.createElement("p"),this.reloadParagraph.textContent="Alternatively, ",this.reloadParagraph.appendChild(o),this.modal.appendChild(this.message),this.modal.appendChild(this.button),this.modal.appendChild(this.reloadParagraph),this.loader=this.getLoader(),this.message.after(this.loader),this.button.addEventListener("click",(async()=>{this.show();try{await Ve.reconnect()||this.rejected()}catch(e){this.logger.log(zn.Error,e),this.failed()}}))}show(){this.addedToDom||(this.addedToDom=!0,this.document.body.appendChild(this.modal)),this.modal.style.display="block",this.loader.style.display="inline-block",this.button.style.display="none",this.reloadParagraph.style.display="none",this.message.textContent="Attempting to reconnect to the server...",this.modal.style.visibility="hidden",setTimeout((()=>{this.modal.style.visibility="visible"}),0)}update(e){this.message.textContent=`Attempting to reconnect to the server: ${e} of ${this.maxRetries}`}hide(){this.modal.style.display="none"}failed(){this.button.style.display="block",this.reloadParagraph.style.display="none",this.loader.style.display="none";const e=this.document.createTextNode("Reconnection failed. Try "),t=this.document.createElement("a");t.textContent="reloading",t.setAttribute("href",""),t.addEventListener("click",(()=>location.reload()));const n=this.document.createTextNode(" the page if you're unable to reconnect.");this.message.replaceChildren(e,t,n)}rejected(){this.button.style.display="none",this.reloadParagraph.style.display="none",this.loader.style.display="none";const e=this.document.createTextNode("Could not reconnect to the server. "),t=this.document.createElement("a");t.textContent="Reload",t.setAttribute("href",""),t.addEventListener("click",(()=>location.reload()));const n=this.document.createTextNode(" the page to restore functionality.");this.message.replaceChildren(e,t,n)}getLoader(){const e=this.document.createElement("div");return e.style.cssText=["border: 0.3em solid #f3f3f3","border-top: 0.3em solid #3498db","border-radius: 50%","width: 2em","height: 2em","display: inline-block"].join(";"),e.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:2e3,iterations:1/0}),e}}class Gn{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const r=this.document.getElementById(Gn.MaxRetriesId);r&&(r.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(Gn.ShowClassName)}update(e){const t=this.document.getElementById(Gn.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Gn.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Gn.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Gn.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Gn.ShowClassName,Gn.HideClassName,Gn.FailedClassName,Gn.RejectedClassName)}}Gn.ShowClassName="components-reconnect-show",Gn.HideClassName="components-reconnect-hide",Gn.FailedClassName="components-reconnect-failed",Gn.RejectedClassName="components-reconnect-rejected",Gn.MaxRetriesId="components-reconnect-max-retries",Gn.CurrentAttemptId="components-reconnect-current-attempt";class Qn{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||Ve.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new Gn(t,e.maxRetries,document):new Yn(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new Zn(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class Zn{constructor(e,t,n,r){this.logger=t,this.reconnectCallback=n,this.isDisposed=!1,this.reconnectDisplay=r,this.reconnectDisplay.show(),this.attemptPeriodicReconnection(e)}dispose(){this.isDisposed=!0,this.reconnectDisplay.hide()}async attemptPeriodicReconnection(e){for(let t=0;tZn.MaximumFirstRetryInterval?Zn.MaximumFirstRetryInterval:e.retryIntervalMilliseconds;if(await this.delay(n),this.isDisposed)break;try{return await this.reconnectCallback()?void 0:void this.reconnectDisplay.rejected()}catch(e){this.logger.log(zn.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise((t=>setTimeout(t,e)))}}Zn.MaximumFirstRetryInterval=3e3;const er=/^\s*Blazor-Component-State:(?[a-zA-Z0-9+/=]+)$/;function tr(e){var t;if(e.nodeType===Node.COMMENT_NODE){const n=e.textContent||"",r=er.exec(n),o=r&&r.groups&&r.groups.state;return o&&(null===(t=e.parentNode)||void 0===t||t.removeChild(e)),o}if(!e.hasChildNodes())return;const n=e.childNodes;for(let e=0;e.*)$/);function or(e,t){const n=e.currentElement;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const r=rr.exec(n.textContent),o=r&&r.groups&&r.groups.descriptor;if(!o)return;try{const r=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(o);switch(t){case"webassembly":return function(e,t,n){const{type:r,assembly:o,typeName:i,parameterDefinitions:s,parameterValues:a,prerenderId:c}=e;if("webassembly"===r){if(!o)throw new Error("assembly must be defined when using a descriptor.");if(!i)throw new Error("typeName must be defined when using a descriptor.");if(c){const e=ir(c,n);if(!e)throw new Error(`Could not find an end component comment for '${t}'`);return{type:r,assembly:o,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:a&&atob(a),start:t,prerenderId:c,end:e}}return{type:r,assembly:o,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:a&&atob(a),start:t}}}(r,n,e);case"server":return function(e,t,n){const{type:r,descriptor:o,sequence:i,prerenderId:s}=e;if("server"===r){if(!o)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===i)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(i))throw new Error(`Error parsing the sequence '${i}' for component '${JSON.stringify(e)}'`);if(s){const e=ir(s,n);if(!e)throw new Error(`Could not find an end component comment for '${t}'`);return{type:r,sequence:i,descriptor:o,start:t,prerenderId:s,end:e}}return{type:r,sequence:i,descriptor:o,start:t}}}(r,n,e)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}function ir(e,t){for(;t.next()&&t.currentElement;){const n=t.currentElement;if(n.nodeType!==Node.COMMENT_NODE)continue;if(!n.textContent)continue;const r=rr.exec(n.textContent),o=r&&r[1];if(o)return sr(o,e),n}}function sr(e,t){const n=JSON.parse(e);if(1!==Object.keys(n).length)throw new Error(`Invalid end of component comment: '${e}'`);const r=n.prerenderId;if(!r)throw new Error(`End of component comment must have a value for the prerendered property: '${e}'`);if(r!==t)throw new Error(`End of component comment prerendered property must match the start comment prerender id: '${t}', '${r}'`)}class ar{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndexasync function(e,n){const r=function(e){const t=document.baseURI;return t.endsWith("/")?`${t}${e}`:`${t}/${e}`}(n),o=await import(r);if(void 0===o)return;const{beforeStart:i,afterStarted:s}=o;return s&&e.afterStartedCallbacks.push(s),i?i(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await C,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let ur,dr=!1,pr=!1;async function fr(e){if(pr)throw new Error("Blazor has already started.");pr=!0;const t=function(e){const t={...Xn,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...Xn.reconnectionOptions,...e.reconnectionOptions}),t}(e),n=await async function(e){const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),r=new hr;return await r.importInitializersAsync(n,[e]),r}(t),r=new Vn(t.logLevel);Ve.reconnect=async e=>{if(dr)return!1;const n=e||await gr(t,r,s);return await s.reconnect(n)?(t.reconnectionHandler.onConnectionUp(),!0):(r.log(zn.Information,"Reconnection attempt to the circuit was rejected by the server. This may indicate that the associated state is no longer available on the server."),!1)},Ve.defaultReconnectionHandler=new Qn(r),t.reconnectionHandler=t.reconnectionHandler||Ve.defaultReconnectionHandler,r.log(zn.Information,"Starting up Blazor server-side application.");const o=function(e,t){return function(e){const t=nr(e,"server"),n=[];for(let e=0;ee.sequence-t.sequence))}(e)}(document),i=tr(document),s=new Kn(o,i||"");Ve._internal.navigationManager.listenForNavigationEvents(((e,t,n)=>ur.send("OnLocationChanged",e,t,n)),((e,t,n,r)=>ur.send("OnLocationChanging",e,t,n,r))),Ve._internal.forceCloseConnection=()=>ur.stop(),Ve._internal.sendJSDataStream=(e,t,n)=>function(e,t,n,r){setTimeout((async()=>{let o=5,i=(new Date).valueOf();try{const s=t instanceof Blob?t.size:t.byteLength;let a=0,c=0;for(;a1)await e.send("ReceiveJSDataChunk",n,c,h,null);else{if(!await e.invoke("ReceiveJSDataChunk",n,c,h,null))break;const t=(new Date).valueOf(),r=t-i;i=t,o=Math.max(1,Math.round(500/Math.max(1,r)))}a+=l,c++}}catch(t){await e.send("ReceiveJSDataChunk",n,-1,null,t.toString())}}),0)}(ur,e,t,n);const a=await gr(t,r,s);if(!await s.startCircuit(a))return void r.log(zn.Error,"Failed to start the circuit.");let c=!1;const l=()=>{if(!c){const e=new FormData,t=s.circuitId;e.append("circuitId",t),c=navigator.sendBeacon("_blazor/disconnect",e)}};Ve.disconnect=l,window.addEventListener("unload",l,{capture:!1,once:!0}),r.log(zn.Information,"Blazor server-side application started."),n.invokeAfterStartedCallbacks(Ve)}async function gr(t,n,r){var o,i;const s=new Tn;s.name="blazorpack";const a=(new Wt).withUrl("_blazor").withHubProtocol(s);t.configureSignalR(a);const c=a.build();c.on("JS.AttachComponent",((e,t)=>function(e,t,n,r){let o=de[0];o||(o=new se(0),de[0]=o),o.attachRootComponentToLogicalElement(n,t,!1)}(0,r.resolveElement(t),e))),c.on("JS.BeginInvokeJS",e.jsCallDispatcher.beginInvokeJSFromDotNet),c.on("JS.EndInvokeDotNet",e.jsCallDispatcher.endInvokeDotNetFromJS),c.on("JS.ReceiveByteArray",e.jsCallDispatcher.receiveByteArray),c.on("JS.BeginTransmitStream",(t=>{const n=new ReadableStream({start(e){c.stream("SendDotNetStreamToJS",t).subscribe({next:t=>e.enqueue(t),complete:()=>e.close(),error:t=>e.error(t)})}});e.jsCallDispatcher.supplyDotNetStream(t,n)}));const l=Jn.getOrCreate(n);c.on("JS.RenderBatch",((e,t)=>{n.log(zn.Debug,`Received render batch with id ${e} and ${t.byteLength} bytes.`),l.processBatch(e,t,c)})),c.on("JS.EndLocationChanging",Ve._internal.navigationManager.endLocationChanging),c.onclose((e=>!dr&&t.reconnectionHandler.onConnectionDown(t.reconnectionOptions,e))),c.on("JS.Error",(e=>{dr=!0,mr(c,e,n),Dn()}));try{await c.start(),ur=c}catch(e){if(mr(c,e,n),"FailedToNegotiateWithServerError"===e.errorType)throw e;Dn(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===lt.WebSockets))?n.log(zn.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===lt.WebSockets))?n.log(zn.Error,"Unable to connect, please ensure WebSockets are available. A VPN or proxy may be blocking the connection."):e.innerErrors.some((e=>"DisabledTransportError"===e.errorType&&e.transport===lt.LongPolling))&&n.log(zn.Error,"Unable to initiate a SignalR connection to the server. This might be because the server is not configured to support WebSockets. For additional details, visit https://aka.ms/blazor-server-websockets-error."))}return(null===(i=null===(o=c.connection)||void 0===o?void 0:o.features)||void 0===i?void 0:i.inherentKeepAlive)&&n.log(zn.Warning,"Failed to connect via WebSockets, using the Long Polling fallback transport. This may be due to a VPN or proxy blocking the connection. To troubleshoot this, visit https://aka.ms/blazor-server-using-fallback-long-polling."),e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{c.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,r||0,o)},endInvokeJSFromDotNet:(e,t,n)=>{c.send("EndInvokeJSFromDotNet",e,t,n)},sendByteArray:(e,t)=>{c.send("ReceiveByteArray",e,t)}}),c}function mr(e,t,n){n.log(zn.Error,t),e&&e.stop()}Ve.start=fr,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&fr()})(); \ No newline at end of file diff --git a/src/Components/test/testassets/BasicTestApp/BasicTestApp.csproj b/src/Components/test/testassets/BasicTestApp/BasicTestApp.csproj index bc6052a3bcdf..26ecf2993b52 100644 --- a/src/Components/test/testassets/BasicTestApp/BasicTestApp.csproj +++ b/src/Components/test/testassets/BasicTestApp/BasicTestApp.csproj @@ -24,6 +24,7 @@ + diff --git a/src/Components/test/testassets/BasicTestApp/Index.razor b/src/Components/test/testassets/BasicTestApp/Index.razor index 5cd0688202a8..86697958187b 100644 --- a/src/Components/test/testassets/BasicTestApp/Index.razor +++ b/src/Components/test/testassets/BasicTestApp/Index.razor @@ -79,6 +79,7 @@ + diff --git a/src/Components/test/testassets/BasicTestApp/QuickGridTest/SimpleQuickGridComponent.razor b/src/Components/test/testassets/BasicTestApp/QuickGridTest/SimpleQuickGridComponent.razor new file mode 100644 index 000000000000..effd2c66d958 --- /dev/null +++ b/src/Components/test/testassets/BasicTestApp/QuickGridTest/SimpleQuickGridComponent.razor @@ -0,0 +1,25 @@ +@using Microsoft.AspNetCore.Components.QuickGrid + +

SimpleQuickGridComponent

+ +

+ + + + + + + +@code { + record Person(int PersonId, string Name, DateOnly BirthDate); + + IQueryable people = new[] + { + new Person(10895, "Jean Martin", new DateOnly(1985, 3, 16)), + new Person(10944, "António Langa", new DateOnly(1991, 12, 1)), + new Person(11203, "Julie Smith", new DateOnly(1958, 10, 10)), + new Person(11205, "Nur Sari", new DateOnly(1922, 4, 27)), + new Person(11898, "Jose Hernandez", new DateOnly(2011, 5, 3)), + new Person(12130, "Kenji Sato", new DateOnly(2004, 1, 9)), + }.AsQueryable(); +} From baa07bfe89bd14a55b41d27caa5b257c99ef87f7 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Fri, 10 Feb 2023 12:11:15 -0700 Subject: [PATCH 07/18] Resolve incorrect project ref path --- eng/ProjectReferences.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props index ccfa53236766..b9b1dad65098 100644 --- a/eng/ProjectReferences.props +++ b/eng/ProjectReferences.props @@ -142,7 +142,7 @@ - + From 2034bbc0144dd69ec9b189b95298c323a1914789 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Fri, 17 Feb 2023 10:51:32 -0700 Subject: [PATCH 08/18] Fix project structure --- AspNetCore.sln | 74 +++++++++---------- eng/ProjectReferences.props | 4 +- eng/TrimmableProjects.props | 2 +- src/Components/Components.slnf | 4 +- ...eworkAdapterServiceCollectionExtensions.cs | 0 .../src}/EntityFrameworkAsyncQueryExecutor.cs | 0 ...ts.QuickGrid.EntityFrameworkAdapter.csproj | 0 .../src}/PublicAPI.Shipped.txt | 0 .../src}/PublicAPI.Unshipped.txt | 0 .../src}/Columns/Align.cs | 0 .../src}/Columns/ColumnBase.razor | 0 .../src}/Columns/ColumnBase.razor.cs | 0 .../src}/Columns/ColumnBase.razor.css | 0 .../src}/Columns/GridSort.cs | 0 .../src}/Columns/ISortBuilderColumn.cs | 0 .../src}/Columns/PropertyColumn.cs | 0 .../src}/Columns/TemplateColumn.cs | 0 .../src}/GridItemsProvider.cs | 0 .../src}/GridItemsProviderRequest.cs | 0 .../src}/GridItemsProviderResult.cs | 0 .../AsyncQueryExecutorSupplier.cs | 0 .../ColumnsCollectedNotifier.cs | 0 .../src}/Infrastructure/Defer.cs | 0 .../EventCallbackSubscribable.cs | 0 .../Infrastructure/EventCallbackSubscriber.cs | 0 .../src}/Infrastructure/EventHandlers.cs | 0 .../Infrastructure/IAsyncQueryExecutor.cs | 0 .../Infrastructure/InternalGridContext.cs | 0 ...oft.AspNetCore.Components.QuickGrid.csproj | 0 .../src}/Pagination/PaginationState.cs | 0 .../src}/Pagination/Paginator.razor | 0 .../src}/Pagination/Paginator.razor.cs | 0 .../src}/Pagination/Paginator.razor.css | 0 .../src}/PublicAPI.Shipped.txt | 0 .../src}/PublicAPI.Unshipped.txt | 0 .../src}/QuickGrid.razor | 0 .../src}/QuickGrid.razor.cs | 0 .../src}/QuickGrid.razor.css | 0 .../src}/QuickGrid.razor.js | 0 .../src}/SortDirection.cs | 0 .../src}/Themes/Default.css | 0 41 files changed, 42 insertions(+), 42 deletions(-) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter => Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src}/EntityFrameworkAdapterServiceCollectionExtensions.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter => Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src}/EntityFrameworkAsyncQueryExecutor.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter => Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src}/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter => Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src}/PublicAPI.Shipped.txt (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter => Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src}/PublicAPI.Unshipped.txt (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Columns/Align.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Columns/ColumnBase.razor (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Columns/ColumnBase.razor.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Columns/ColumnBase.razor.css (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Columns/GridSort.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Columns/ISortBuilderColumn.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Columns/PropertyColumn.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Columns/TemplateColumn.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/GridItemsProvider.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/GridItemsProviderRequest.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/GridItemsProviderResult.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Infrastructure/AsyncQueryExecutorSupplier.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Infrastructure/ColumnsCollectedNotifier.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Infrastructure/Defer.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Infrastructure/EventCallbackSubscribable.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Infrastructure/EventCallbackSubscriber.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Infrastructure/EventHandlers.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Infrastructure/IAsyncQueryExecutor.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Infrastructure/InternalGridContext.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Microsoft.AspNetCore.Components.QuickGrid.csproj (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Pagination/PaginationState.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Pagination/Paginator.razor (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Pagination/Paginator.razor.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Pagination/Paginator.razor.css (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/PublicAPI.Shipped.txt (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/PublicAPI.Unshipped.txt (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/QuickGrid.razor (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/QuickGrid.razor.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/QuickGrid.razor.css (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/QuickGrid.razor.js (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/SortDirection.cs (100%) rename src/Components/QuickGrid/{src/Microsoft.AspNetCore.Components.QuickGrid => Microsoft.AspNetCore.Components.QuickGrid/src}/Themes/Default.css (100%) diff --git a/AspNetCore.sln b/AspNetCore.sln index 6e03f5f9a3c1..6bd60d448dbe 100644 --- a/AspNetCore.sln +++ b/AspNetCore.sln @@ -1764,11 +1764,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Http.Generators", "src\Http\Http.Extensions\gen\Microsoft.AspNetCore.Http.Generators.csproj", "{4730F56D-24EF-4BB2-AA75-862E31205F3A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Components.QuickGrid", "src\Components\QuickGrid\src\Microsoft.AspNetCore.Components.QuickGrid\Microsoft.AspNetCore.Components.QuickGrid.csproj", "{836B1CF7-58CC-4E6D-9B17-732D1AED62B9}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QuickGrid", "QuickGrid", "{C406D9E0-1585-43F9-AA8F-D468AF84A996}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter", "src\Components\QuickGrid\src\Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter\Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj", "{865B0D7F-48D1-4801-9343-A76308BE778C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Components.QuickGrid", "src\Components\QuickGrid\Microsoft.AspNetCore.Components.QuickGrid\src\Microsoft.AspNetCore.Components.QuickGrid.csproj", "{7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QuickGrid", "QuickGrid", "{C406D9E0-1585-43F9-AA8F-D468AF84A996}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter", "src\Components\QuickGrid\Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter\src\Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj", "{F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -10595,38 +10595,38 @@ Global {4730F56D-24EF-4BB2-AA75-862E31205F3A}.Release|x64.Build.0 = Release|Any CPU {4730F56D-24EF-4BB2-AA75-862E31205F3A}.Release|x86.ActiveCfg = Release|Any CPU {4730F56D-24EF-4BB2-AA75-862E31205F3A}.Release|x86.Build.0 = Release|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|arm64.ActiveCfg = Debug|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|arm64.Build.0 = Debug|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|x64.ActiveCfg = Debug|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|x64.Build.0 = Debug|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|x86.ActiveCfg = Debug|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Debug|x86.Build.0 = Debug|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|Any CPU.Build.0 = Release|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|arm64.ActiveCfg = Release|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|arm64.Build.0 = Release|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|x64.ActiveCfg = Release|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|x64.Build.0 = Release|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|x86.ActiveCfg = Release|Any CPU - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9}.Release|x86.Build.0 = Release|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|arm64.ActiveCfg = Debug|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|arm64.Build.0 = Debug|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|x64.ActiveCfg = Debug|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|x64.Build.0 = Debug|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|x86.ActiveCfg = Debug|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Debug|x86.Build.0 = Debug|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|Any CPU.Build.0 = Release|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|arm64.ActiveCfg = Release|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|arm64.Build.0 = Release|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|x64.ActiveCfg = Release|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|x64.Build.0 = Release|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|x86.ActiveCfg = Release|Any CPU - {865B0D7F-48D1-4801-9343-A76308BE778C}.Release|x86.Build.0 = Release|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Debug|arm64.ActiveCfg = Debug|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Debug|arm64.Build.0 = Debug|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Debug|x64.ActiveCfg = Debug|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Debug|x64.Build.0 = Debug|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Debug|x86.ActiveCfg = Debug|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Debug|x86.Build.0 = Debug|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Release|Any CPU.Build.0 = Release|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Release|arm64.ActiveCfg = Release|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Release|arm64.Build.0 = Release|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Release|x64.ActiveCfg = Release|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Release|x64.Build.0 = Release|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Release|x86.ActiveCfg = Release|Any CPU + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2}.Release|x86.Build.0 = Release|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Debug|arm64.ActiveCfg = Debug|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Debug|arm64.Build.0 = Debug|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Debug|x64.ActiveCfg = Debug|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Debug|x64.Build.0 = Debug|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Debug|x86.ActiveCfg = Debug|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Debug|x86.Build.0 = Debug|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Release|Any CPU.Build.0 = Release|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Release|arm64.ActiveCfg = Release|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Release|arm64.Build.0 = Release|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Release|x64.ActiveCfg = Release|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Release|x64.Build.0 = Release|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Release|x86.ActiveCfg = Release|Any CPU + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -11498,9 +11498,9 @@ Global {10173568-A65E-44E5-8C6F-4AA49D0577A1} = {F057512B-55BF-4A8B-A027-A0505F8BA10C} {97C7D2A4-87E5-4A4A-A170-D736427D5C21} = {F057512B-55BF-4A8B-A027-A0505F8BA10C} {4730F56D-24EF-4BB2-AA75-862E31205F3A} = {225AEDCF-7162-4A86-AC74-06B84660B379} - {836B1CF7-58CC-4E6D-9B17-732D1AED62B9} = {C406D9E0-1585-43F9-AA8F-D468AF84A996} - {865B0D7F-48D1-4801-9343-A76308BE778C} = {C406D9E0-1585-43F9-AA8F-D468AF84A996} {C406D9E0-1585-43F9-AA8F-D468AF84A996} = {60D51C98-2CC0-40DF-B338-44154EFEE2FF} + {7757E360-40F5-4C90-9D7F-E6B0E62BA9E2} = {C406D9E0-1585-43F9-AA8F-D468AF84A996} + {F0BF2260-5AE2-4248-81DE-AC5B9FC6A931} = {C406D9E0-1585-43F9-AA8F-D468AF84A996} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3E8720B3-DBDD-498C-B383-2CC32A054E8F} diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props index b9b1dad65098..8a5d12e87b90 100644 --- a/eng/ProjectReferences.props +++ b/eng/ProjectReferences.props @@ -141,8 +141,8 @@ - - + + diff --git a/eng/TrimmableProjects.props b/eng/TrimmableProjects.props index e382bf646815..b62fb3fdb69b 100644 --- a/eng/TrimmableProjects.props +++ b/eng/TrimmableProjects.props @@ -88,8 +88,8 @@ - + diff --git a/src/Components/Components.slnf b/src/Components/Components.slnf index e4402edb0c16..28019dfe2494 100644 --- a/src/Components/Components.slnf +++ b/src/Components/Components.slnf @@ -14,8 +14,8 @@ "src\\Components\\CustomElements\\src\\Microsoft.AspNetCore.Components.CustomElements.csproj", "src\\Components\\Forms\\src\\Microsoft.AspNetCore.Components.Forms.csproj", "src\\Components\\Forms\\test\\Microsoft.AspNetCore.Components.Forms.Tests.csproj", - "src\\Components\\QuickGrid\\src\\Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter\\Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj", - "src\\Components\\QuickGrid\\src\\Microsoft.AspNetCore.Components.QuickGrid\\Microsoft.AspNetCore.Components.QuickGrid.csproj", + "src\\Components\\QuickGrid\\Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter\\src\\Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj", + "src\\Components\\QuickGrid\\Microsoft.AspNetCore.Components.QuickGrid\\src\\Microsoft.AspNetCore.Components.QuickGrid.csproj", "src\\Components\\Samples\\BlazorServerApp\\BlazorServerApp.csproj", "src\\Components\\Server\\src\\Microsoft.AspNetCore.Components.Server.csproj", "src\\Components\\Server\\test\\Microsoft.AspNetCore.Components.Server.Tests.csproj", diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAdapterServiceCollectionExtensions.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/EntityFrameworkAdapterServiceCollectionExtensions.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAdapterServiceCollectionExtensions.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/EntityFrameworkAdapterServiceCollectionExtensions.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAsyncQueryExecutor.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/EntityFrameworkAsyncQueryExecutor.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/EntityFrameworkAsyncQueryExecutor.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/EntityFrameworkAsyncQueryExecutor.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/PublicAPI.Shipped.txt b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/PublicAPI.Shipped.txt similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/PublicAPI.Shipped.txt rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/PublicAPI.Shipped.txt diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/PublicAPI.Unshipped.txt b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/PublicAPI.Unshipped.txt similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/PublicAPI.Unshipped.txt rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/PublicAPI.Unshipped.txt diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/Align.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/Align.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/Align.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/Align.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.css b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.css similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ColumnBase.razor.css rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.css diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/GridSort.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/GridSort.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/GridSort.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ISortBuilderColumn.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ISortBuilderColumn.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/ISortBuilderColumn.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ISortBuilderColumn.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/PropertyColumn.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/PropertyColumn.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/PropertyColumn.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/PropertyColumn.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/TemplateColumn.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/TemplateColumn.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Columns/TemplateColumn.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/TemplateColumn.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProvider.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProvider.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProvider.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProvider.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderRequest.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderRequest.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderResult.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderResult.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/GridItemsProviderResult.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderResult.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/AsyncQueryExecutorSupplier.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/ColumnsCollectedNotifier.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/ColumnsCollectedNotifier.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/ColumnsCollectedNotifier.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/ColumnsCollectedNotifier.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/Defer.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/Defer.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/Defer.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/Defer.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscribable.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/EventCallbackSubscribable.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscribable.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/EventCallbackSubscribable.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscriber.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/EventCallbackSubscriber.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventCallbackSubscriber.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/EventCallbackSubscriber.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventHandlers.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/EventHandlers.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/EventHandlers.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/EventHandlers.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/IAsyncQueryExecutor.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/IAsyncQueryExecutor.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/IAsyncQueryExecutor.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/IAsyncQueryExecutor.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/InternalGridContext.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/InternalGridContext.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Infrastructure/InternalGridContext.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/InternalGridContext.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.csproj similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.csproj rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.csproj diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/PaginationState.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/PaginationState.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/PaginationState.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/PaginationState.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/Paginator.razor similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/Paginator.razor diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/Paginator.razor.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/Paginator.razor.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.css b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/Paginator.razor.css similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Pagination/Paginator.razor.css rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/Paginator.razor.css diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Shipped.txt b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Shipped.txt similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Shipped.txt rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Shipped.txt diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Unshipped.txt b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Unshipped.txt similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/PublicAPI.Unshipped.txt rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Unshipped.txt diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.css b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.css similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.css rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.css diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.js b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.js similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/QuickGrid.razor.js rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.js diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/SortDirection.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/SortDirection.cs similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/SortDirection.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/SortDirection.cs diff --git a/src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Themes/Default.css b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Themes/Default.css similarity index 100% rename from src/Components/QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid/Themes/Default.css rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Themes/Default.css From ee5a838b4a442decaed97b44f3c3ecac02e8c3cb Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Tue, 21 Feb 2023 14:14:01 -0700 Subject: [PATCH 09/18] Add E2E Tests --- .../test/E2ETest/Tests/QuickGridTest.cs | 119 ++++++++++++++++++ .../test/testassets/BasicTestApp/Index.razor | 2 +- .../SampleQuickGridComponent.razor | 93 ++++++++++++++ .../SimpleQuickGridComponent.razor | 25 ---- 4 files changed, 213 insertions(+), 26 deletions(-) create mode 100644 src/Components/test/E2ETest/Tests/QuickGridTest.cs create mode 100644 src/Components/test/testassets/BasicTestApp/QuickGridTest/SampleQuickGridComponent.razor delete mode 100644 src/Components/test/testassets/BasicTestApp/QuickGridTest/SimpleQuickGridComponent.razor diff --git a/src/Components/test/E2ETest/Tests/QuickGridTest.cs b/src/Components/test/E2ETest/Tests/QuickGridTest.cs new file mode 100644 index 000000000000..49b1a75aa8f4 --- /dev/null +++ b/src/Components/test/E2ETest/Tests/QuickGridTest.cs @@ -0,0 +1,119 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using BasicTestApp; +using BasicTestApp.QuickGridTest; +using Microsoft.AspNetCore.Components.E2ETest; +using Microsoft.AspNetCore.Components.E2ETest.Infrastructure; +using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures; +using Microsoft.AspNetCore.E2ETesting; +using OpenQA.Selenium; +using Xunit.Abstractions; + +namespace Microsoft.AspNetCore.Components.E2ETests.Tests; + +public class QuickGridTest : ServerTestBase> +{ + protected IWebElement app; + + public QuickGridTest( + BrowserFixture browserFixture, + ToggleExecutionModeServerFixture serverFixture, + ITestOutputHelper output) + : base(browserFixture, serverFixture, output) + { + } + + protected override void InitializeAsyncCore() + { + Navigate(ServerPathBase); + app = Browser.MountTestComponent(); + } + + [Fact] + public void CanColumnSortByInt() + { + var grid = app.FindElement(By.CssSelector("#grid > table")); + var idColumnSortButton = grid.FindElement(By.CssSelector("thead > tr > th:nth-child(1) > div > button")); + + // Click twice to sort by descending + idColumnSortButton.Click(); + idColumnSortButton.Click(); + + var firstRow = grid.FindElement(By.CssSelector("tbody > tr:nth-child(1)")); + + //Compare first row to expected result + Assert.Equal("12381", firstRow.FindElement(By.CssSelector("td:nth-child(1)")).Text); + Assert.Equal("Matti", firstRow.FindElement(By.CssSelector("td:nth-child(2)")).Text); + Assert.Equal("Karttunen", firstRow.FindElement(By.CssSelector("td:nth-child(3)")).Text); + Assert.Equal("1981-06-04", firstRow.FindElement(By.CssSelector("td:nth-child(4)")).Text); + Assert.Equal("41", firstRow.FindElement(By.CssSelector("td:nth-child(5)")).Text); + } + + [Fact] + public void CanColumnSortByString() + { + var grid = app.FindElement(By.CssSelector("#grid > table")); + var firstNameColumnSortButton = grid.FindElement(By.CssSelector("thead > tr > th:nth-child(2) > div > button.col-title")); + + // Click twice to sort by descending + firstNameColumnSortButton.Click(); + firstNameColumnSortButton.Click(); + + var firstRow = grid.FindElement(By.CssSelector("tbody > tr:nth-child(1)")); + + //Compare first row to expected result + Assert.Equal("12379", firstRow.FindElement(By.CssSelector("td:nth-child(1)")).Text); + Assert.Equal("Zbyszek", firstRow.FindElement(By.CssSelector("td:nth-child(2)")).Text); + Assert.Equal("Piestrzeniewicz", firstRow.FindElement(By.CssSelector("td:nth-child(3)")).Text); + Assert.Equal("1981-04-02", firstRow.FindElement(By.CssSelector("td:nth-child(4)")).Text); + Assert.Equal("41", firstRow.FindElement(By.CssSelector("td:nth-child(5)")).Text); + } + + [Fact] + public void CanColumnSortByDateOnly() + { + var grid = app.FindElement(By.CssSelector("#grid > table")); + var birthDateColumnSortButton = grid.FindElement(By.CssSelector("thead > tr > th:nth-child(4) > div > button")); + + // Click twice to sort by descending + birthDateColumnSortButton.Click(); + birthDateColumnSortButton.Click(); + + var firstRow = grid.FindElement(By.CssSelector("tbody > tr:nth-child(1)")); + + //Compare first row to expected result + Assert.Equal("12364", firstRow.FindElement(By.CssSelector("td:nth-child(1)")).Text); + Assert.Equal("Paolo", firstRow.FindElement(By.CssSelector("td:nth-child(2)")).Text); + Assert.Equal("Accorti", firstRow.FindElement(By.CssSelector("td:nth-child(3)")).Text); + Assert.Equal("2018-05-18", firstRow.FindElement(By.CssSelector("td:nth-child(4)")).Text); + Assert.Equal("4", firstRow.FindElement(By.CssSelector("td:nth-child(5)")).Text); + } + + [Fact] + public void PaginatorCorrectItemsPerPage() + { + var grid = app.FindElement(By.ClassName("quickgrid")); + var rowCount = grid.FindElements(By.CssSelector("tbody > tr")).Count; + Assert.Equal(10, rowCount); + + app.FindElement(By.ClassName("go-next")).Click(); + + rowCount = grid.FindElements(By.CssSelector("tbody > tr")).Count; + Assert.Equal(10, rowCount); + } + + [Fact] + public void PaginatorDisplaysCorrectItemCount() + { + var paginator = app.FindElement(By.ClassName("paginator")); + + var paginatorCount = paginator.FindElement(By.CssSelector("div > strong")).Text; + var currentPageNumber = paginator.FindElement(By.CssSelector("nav > div > strong:nth-child(1)")).Text; + var totalPageNumber = paginator.FindElement(By.CssSelector("nav > div > strong:nth-child(2)")).Text; + + Assert.Equal("43", paginatorCount); + Assert.Equal("1", currentPageNumber); + Assert.Equal("5", totalPageNumber); + } +} diff --git a/src/Components/test/testassets/BasicTestApp/Index.razor b/src/Components/test/testassets/BasicTestApp/Index.razor index 86697958187b..3b98a1aab200 100644 --- a/src/Components/test/testassets/BasicTestApp/Index.razor +++ b/src/Components/test/testassets/BasicTestApp/Index.razor @@ -79,7 +79,7 @@ - + diff --git a/src/Components/test/testassets/BasicTestApp/QuickGridTest/SampleQuickGridComponent.razor b/src/Components/test/testassets/BasicTestApp/QuickGridTest/SampleQuickGridComponent.razor new file mode 100644 index 000000000000..a90f2160e54e --- /dev/null +++ b/src/Components/test/testassets/BasicTestApp/QuickGridTest/SampleQuickGridComponent.razor @@ -0,0 +1,93 @@ +@using Microsoft.AspNetCore.Components.QuickGrid + +

Sample QuickGrid Component

+ +
+ + + + + + + + + + + +
+ + +@code { + record Person(int PersonId, string firstName, string lastName, DateOnly BirthDate); + PaginationState pagination = new PaginationState { ItemsPerPage = 10 }; + string firstNameFilter; + + int ComputeAge(DateOnly birthDate) + => DateTime.Now.Year - birthDate.Year - (birthDate.DayOfYear < DateTime.Now.DayOfYear ? 0 : 1); + + IQueryable FilteredPeople + { + get + { + var result = people; + + if (!string.IsNullOrEmpty(firstNameFilter)) + { + result = result.Where(p => p.firstName.Contains(firstNameFilter, StringComparison.CurrentCultureIgnoreCase)); + } + + return result; + } + } + + // Changes to this list affect the E2E tests. + // If you change this list, you must also update the E2E tests. + IQueryable people = new[] + { + new Person(11203, "Julie", "Smith", new DateOnly(1958, 10, 10)), + new Person(11205, "Nur", "Sari", new DateOnly(1922, 4, 27)), + new Person(11898, "Jose", "Hernandez", new DateOnly(2011, 5, 3)), + new Person(10895, "Jean", "Martin", new DateOnly(1985, 3, 16)), + new Person(10944, "António", "Langa", new DateOnly(1991, 12, 1)), + new Person(12130, "Kenji", "Sato", new DateOnly(2004, 1, 9)), + new Person(12238, "Sven", "Ottlieb", new DateOnly(1973, 11, 15)), + new Person(12345, "Liu", "Wang", new DateOnly(1999, 6, 30)), + new Person(12346, "Giovanni", "Rovelli", new DateOnly(2000, 7, 31)), + new Person(12347, "Eduardo", "Martins", new DateOnly(2001, 8, 1)), + new Person(12348, "Martín", "Sommer", new DateOnly(2002, 9, 2)), + new Person(12349, "Victoria", "Ashworth", new DateOnly(2003, 10, 3)), + new Person(12350, "Hannah", "Moos", new DateOnly(2004, 11, 4)), + new Person(12351, "Palle", "Ibsen", new DateOnly(2005, 12, 5)), + new Person(12352, "Lúcia", "Carvalho", new DateOnly(2006, 1, 6)), + new Person(12353, "Horst", "Kloss", new DateOnly(2007, 2, 7)), + new Person(12354, "Sergio", "Gutiérrez", new DateOnly(2008, 3, 8)), + new Person(12355, "Janine", "Labrune", new DateOnly(2009, 4, 9)), + new Person(12356, "Ann", "Devon", new DateOnly(2010, 5, 10)), + new Person(12357, "Roland", "Mendel", new DateOnly(2011, 6, 11)), + new Person(12358, "Aria", "Cruz", new DateOnly(2012, 7, 12)), + new Person(12359, "Diego", "Roel", new DateOnly(2001, 8, 13)), + new Person(12360, "Martine", "Rancé", new DateOnly(2005, 9, 14)), + new Person(12361, "Maria", "Larsson", new DateOnly(1998, 10, 15)), + new Person(12362, "Peter", "Lewis", new DateOnly(2016, 11, 16)), + new Person(12363, "Carine", "Schmitt", new DateOnly(2017, 12, 13)), + new Person(12364, "Paolo", "Accorti", new DateOnly(2018, 5, 18)), + new Person(12365, "Lino", "Rodriguez", new DateOnly(1980, 2, 19)), + new Person(12367, "Bernardo", "Batista", new DateOnly(1979, 4, 21)), + new Person(12368, "Lúcia", "Carvalho", new DateOnly(1976, 5, 22)), + new Person(12369, "Guillermo", "Fernández", new DateOnly(1983, 6, 23)), + new Person(12370, "Georg", "Pipps", new DateOnly(1982, 7, 24)), + new Person(12371, "Mario", "Pontes", new DateOnly(1981, 8, 25)), + new Person(12372, "Anabela", "Camino", new DateOnly(1980, 9, 26)), + new Person(12380, "Karl", "Jablonski", new DateOnly(1981, 5, 3)), + new Person(12381, "Matti", "Karttunen", new DateOnly(1981, 6, 4)), + new Person(12373, "Helvetius", "Nagy", new DateOnly(1980, 10, 27)), + new Person(12374, "Rita", "Müller", new DateOnly(1980, 11, 28)), + new Person(12375, "Pirkko", "Koskitalo", new DateOnly(1980, 12, 29)), + new Person(12376, "Paula", "Parente", new DateOnly(1981, 1, 30)), + new Person(12377, "Karl", "Jablonski", new DateOnly(1981, 2, 10)), + new Person(12378, "Matti", "Karttunen", new DateOnly(1981, 3, 1)), + new Person(12379, "Zbyszek", "Piestrzeniewicz", new DateOnly(1981, 4, 2)), + }.AsQueryable(); +} diff --git a/src/Components/test/testassets/BasicTestApp/QuickGridTest/SimpleQuickGridComponent.razor b/src/Components/test/testassets/BasicTestApp/QuickGridTest/SimpleQuickGridComponent.razor deleted file mode 100644 index effd2c66d958..000000000000 --- a/src/Components/test/testassets/BasicTestApp/QuickGridTest/SimpleQuickGridComponent.razor +++ /dev/null @@ -1,25 +0,0 @@ -@using Microsoft.AspNetCore.Components.QuickGrid - -

SimpleQuickGridComponent

- -

- - - - - - - -@code { - record Person(int PersonId, string Name, DateOnly BirthDate); - - IQueryable people = new[] - { - new Person(10895, "Jean Martin", new DateOnly(1985, 3, 16)), - new Person(10944, "António Langa", new DateOnly(1991, 12, 1)), - new Person(11203, "Julie Smith", new DateOnly(1958, 10, 10)), - new Person(11205, "Nur Sari", new DateOnly(1922, 4, 27)), - new Person(11898, "Jose Hernandez", new DateOnly(2011, 5, 3)), - new Person(12130, "Kenji Sato", new DateOnly(2004, 1, 9)), - }.AsQueryable(); -} From fab0dbf94487eff76b83428eee95f7e119aadd18 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Thu, 23 Feb 2023 10:03:26 -0700 Subject: [PATCH 10/18] Add error suppression --- .../src/Infrastructure/AsyncQueryExecutorSupplier.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs index 2ccbf70c808e..8cdd013e1123 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs @@ -23,6 +23,9 @@ internal static class AsyncQueryExecutorSupplier private static readonly ConcurrentDictionary IsEntityFrameworkProviderTypeCache = new(); + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2111", + Justification = "In the unlikely case a necessary interface is trimmed away and the error wasn't caught in developnent," + + " the developer only risks not noticing an oppurtunity to improve performance.")] public static IAsyncQueryExecutor? GetAsyncQueryExecutor(IServiceProvider services, IQueryable? queryable) { if (queryable is not null) From f000993e7345c9edbe0faba6f7f135786c1a45b2 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Thu, 23 Feb 2023 13:47:07 -0700 Subject: [PATCH 11/18] Seal what can be sealed. Add EditorBrowsable attributes to infra classes --- .../src/Columns/GridSort.cs | 2 +- .../src/Infrastructure/ColumnsCollectedNotifier.cs | 5 ++++- .../src/Infrastructure/Defer.cs | 4 +++- .../src/PublicAPI.Unshipped.txt | 1 - 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/GridSort.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/GridSort.cs index 2c7f2a845c50..68398c7f847a 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/GridSort.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/GridSort.cs @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Components.QuickGrid; /// Represents a sort order specification used within . ///
/// The type of data represented by each row in the grid. -public class GridSort +public sealed class GridSort { private const string ExpressionNotRepresentableMessage = "The supplied expression can't be represented as a property name for sorting. Only simple member expressions, such as @(x => x.SomeProperty), can be converted to property names."; diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/ColumnsCollectedNotifier.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/ColumnsCollectedNotifier.cs index 0a13e76e0327..ab58090d52cc 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/ColumnsCollectedNotifier.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/ColumnsCollectedNotifier.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.ComponentModel; + namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; // One awkwardness of the way QuickGrid collects its list of child columns is that, during OnParametersSetAsync, @@ -30,7 +32,8 @@ namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; /// For internal use only. Do not use. ///
/// For internal use only. Do not use. -public class ColumnsCollectedNotifier : IComponent +[EditorBrowsable(EditorBrowsableState.Never)] +public sealed class ColumnsCollectedNotifier : IComponent { private bool _isFirstRender = true; diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/Defer.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/Defer.cs index 9c36a5137141..c839be90d172 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/Defer.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/Defer.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.ComponentModel; using Microsoft.AspNetCore.Components.Rendering; namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; @@ -11,7 +12,8 @@ namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; /// /// For internal use only. Do not use. /// -public class Defer : ComponentBase +[EditorBrowsable(EditorBrowsableState.Never)] +public sealed class Defer : ComponentBase { /// /// For internal use only. Do not use. diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Unshipped.txt b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Unshipped.txt index 8791408e3b33..8330567ea3e0 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Unshipped.txt +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Unshipped.txt @@ -119,7 +119,6 @@ Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.ChildContent Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.SortBy.get -> Microsoft.AspNetCore.Components.QuickGrid.GridSort? Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.SortBy.set -> void Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.TemplateColumn() -> void -override Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.Defer.BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder! builder) -> void override Microsoft.AspNetCore.Components.QuickGrid.PaginationState.GetHashCode() -> int override Microsoft.AspNetCore.Components.QuickGrid.Paginator.OnParametersSet() -> void override Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn.CellContent(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder! builder, TGridItem item) -> void From 0c09e02e6875896383f7f84855e7fa25fcc3c7ba Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Mon, 27 Feb 2023 17:28:27 -0700 Subject: [PATCH 12/18] Address (most of) API feedback --- ...eworkAdapterServiceCollectionExtensions.cs | 2 +- .../src/EntityFrameworkAsyncQueryExecutor.cs | 1 - .../src/Columns/Align.cs | 16 ++++-- .../src/Columns/ColumnBase.razor | 10 ++-- .../src/Columns/ColumnBase.razor.cs | 13 +++-- .../src/Columns/GridSort.cs | 14 ++--- .../src/Columns/SortedProperty.cs | 9 ++++ .../src/GridItemsProviderRequest.cs | 16 +++--- .../src/GridItemsProviderResult.cs | 19 ++----- .../IAsyncQueryExecutor.cs | 2 +- .../src/Pagination/Paginator.razor | 8 +-- .../src/Pagination/Paginator.razor.cs | 16 +++--- .../src/PublicAPI.Unshipped.txt | 52 ++++++++++++------- .../src/QuickGrid.razor | 5 -- .../src/QuickGrid.razor.cs | 20 ++++--- .../src/QuickGrid.razor.css | 4 +- .../src/QuickGrid.razor.js | 45 ---------------- .../src/SortDirection.cs | 14 ++--- .../SampleQuickGridComponent.razor | 2 +- 19 files changed, 120 insertions(+), 148 deletions(-) create mode 100644 src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs rename src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/{Infrastructure => }/IAsyncQueryExecutor.cs (96%) diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/EntityFrameworkAdapterServiceCollectionExtensions.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/EntityFrameworkAdapterServiceCollectionExtensions.cs index a89dd48dc726..05fdc31dc47a 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/EntityFrameworkAdapterServiceCollectionExtensions.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/EntityFrameworkAdapterServiceCollectionExtensions.cs @@ -1,8 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Microsoft.AspNetCore.Components.QuickGrid; using Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter; -using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; namespace Microsoft.Extensions.DependencyInjection; diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/EntityFrameworkAsyncQueryExecutor.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/EntityFrameworkAsyncQueryExecutor.cs index 842826013dd9..7b8bc97a24c6 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/EntityFrameworkAsyncQueryExecutor.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/EntityFrameworkAsyncQueryExecutor.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Linq; -using Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/Align.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/Align.cs index fa1d1974f9f5..7676254c59d9 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/Align.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/Align.cs @@ -9,9 +9,9 @@ namespace Microsoft.AspNetCore.Components.QuickGrid; public enum Align { /// - /// Justifies the content against the start of the container. + /// Justifies the content against the start of the container /// - Left, + Start, /// /// Justifies the content at the center of the container. @@ -19,7 +19,17 @@ public enum Align Center, /// - /// Justifies the content at the end of the container. + /// Justifies the content at the end of the container + /// + End, + + /// + /// Justifies the content against the left of the container. + /// + Left, + + /// + /// Justifies the content at the right of the container. /// Right, } diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor index 0d8023a5db29..0817f7124a39 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor @@ -4,7 +4,7 @@ @namespace Microsoft.AspNetCore.Components.QuickGrid @typeparam TGridItem @{ - InternalGridContext.Grid.AddColumn(this, IsDefaultSort); + InternalGridContext.Grid.AddColumn(this, InitialSortDirection, IsDefaultSortColumn); } @code @@ -17,9 +17,9 @@ } else { - @if (ColumnOptions is not null && Align != Align.Right) + @if (ColumnOptions is not null && (Align != Align.Right || Align != Align.End)) { - + } if (Sortable.HasValue ? Sortable.Value : IsSortableByDefault()) @@ -36,9 +36,9 @@ } - @if (ColumnOptions is not null && Align == Align.Right) + @if (ColumnOptions is not null && (Align == Align.Right || Align == Align.End)) { - + } } } diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.cs index 6854a0de0479..0278a628c1c6 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.cs @@ -42,7 +42,7 @@ public abstract partial class ColumnBase /// UI will be included in the header cell by default. /// /// If is used, it is left up to that template to render any relevant - /// "show options" UI and invoke the grid's ). + /// "show options" UI and invoke the grid's ). /// [Parameter] public RenderFragment? ColumnOptions { get; set; } @@ -55,10 +55,15 @@ public abstract partial class ColumnBase [Parameter] public bool? Sortable { get; set; } /// - /// If specified and not null, indicates that this column represents the initial sort order - /// for the grid. The supplied value controls the default sort direction. + /// Indicates which direction to sort in + /// if is true. /// - [Parameter] public SortDirection? IsDefaultSort { get; set; } + [Parameter] public SortDirection InitialSortDirection { get; set; } = default; + + /// + /// Indicates whether this column should be sorted by default. + /// + [Parameter] public bool IsDefaultSortColumn { get; set; } = false; /// /// If specified, virtualized grids will use this template to render cells whose data has not yet been loaded. diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/GridSort.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/GridSort.cs index 68398c7f847a..0e891b2e206f 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/GridSort.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/GridSort.cs @@ -20,8 +20,8 @@ public sealed class GridSort private (LambdaExpression, bool) _firstExpression; private List<(LambdaExpression, bool)>? _thenExpressions; - private IReadOnlyCollection<(string PropertyName, SortDirection Direction)>? _cachedPropertyListAscending; - private IReadOnlyCollection<(string PropertyName, SortDirection Direction)>? _cachedPropertyListDescending; + private IReadOnlyCollection? _cachedPropertyListAscending; + private IReadOnlyCollection? _cachedPropertyListDescending; internal GridSort(Func, bool, IOrderedQueryable> first, (LambdaExpression, bool) firstExpression) { @@ -100,7 +100,7 @@ internal IOrderedQueryable Apply(IQueryable queryable, boo return orderedQueryable; } - internal IReadOnlyCollection<(string PropertyName, SortDirection Direction)> ToPropertyList(bool ascending) + internal IReadOnlyCollection ToPropertyList(bool ascending) { if (ascending) { @@ -114,18 +114,18 @@ internal IOrderedQueryable Apply(IQueryable queryable, boo } } - private List<(string PropertyName, SortDirection Direction)> BuildPropertyList(bool ascending) + private List BuildPropertyList(bool ascending) { - var result = new List<(string, SortDirection)> + var result = new List { - (ToPropertyName(_firstExpression.Item1), (_firstExpression.Item2 ^ ascending) ? SortDirection.Descending : SortDirection.Ascending) + new SortedProperty { PropertyName = ToPropertyName(_firstExpression.Item1), Direction = (_firstExpression.Item2 ^ ascending) ? SortDirection.Descending : SortDirection.Ascending } }; if (_thenExpressions is not null) { foreach (var (thenLambda, thenAscending) in _thenExpressions) { - result.Add((ToPropertyName(thenLambda), (thenAscending ^ ascending) ? SortDirection.Descending : SortDirection.Ascending)); + result.Add(new SortedProperty { PropertyName = ToPropertyName(thenLambda), Direction = (thenAscending ^ ascending) ? SortDirection.Descending : SortDirection.Ascending }); } } diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs new file mode 100644 index 000000000000..026565652b46 --- /dev/null +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs @@ -0,0 +1,9 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Components.QuickGrid; +public readonly struct SortedProperty +{ + public required string PropertyName { get; init; } + public SortDirection Direction { get; init; } +} diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs index 748121ebdef3..648dd2656416 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs @@ -14,12 +14,12 @@ public readonly struct GridItemsProviderRequest /// /// The zero-based index of the first item to be supplied. /// - public int StartIndex { get; } + public int StartIndex { get; init; } /// /// If set, the maximum number of items to be supplied. If not set, the maximum number is unlimited. /// - public int? Count { get; } + public int? Count { get; init; } /// /// Specifies which column represents the sort order. @@ -27,7 +27,7 @@ public readonly struct GridItemsProviderRequest /// Rather than inferring the sort rules manually, you should normally call either /// or , since they also account for and automatically. /// - public ColumnBase? SortByColumn { get; } + public ColumnBase? SortByColumn { get; init; } /// /// Specifies the current sort direction. @@ -35,12 +35,12 @@ public readonly struct GridItemsProviderRequest /// Rather than inferring the sort rules manually, you should normally call either /// or , since they also account for and automatically. /// - public bool SortByAscending { get; } + public bool SortByAscending { get; init; } /// /// A token that indicates if the request should be cancelled. /// - public CancellationToken CancellationToken { get; } + public CancellationToken CancellationToken { get; init; } internal GridItemsProviderRequest( int startIndex, int? count, ColumnBase? sortByColumn, bool sortByAscending, @@ -75,10 +75,10 @@ internal GridItemsProviderRequest( /// otherwise it will throw. /// /// A collection of (property name, direction) pairs representing the sorting rules - public IReadOnlyCollection<(string PropertyName, SortDirection Direction)> GetSortByProperties() => SortByColumn switch + public IReadOnlyCollection GetSortByProperties() => SortByColumn switch { - ISortBuilderColumn sbc => sbc.SortBuilder?.ToPropertyList(SortByAscending) ?? Array.Empty<(string, SortDirection)>(), - null => Array.Empty<(string, SortDirection)>(), + ISortBuilderColumn sbc => sbc.SortBuilder?.ToPropertyList(SortByAscending) ?? Array.Empty(), + null => Array.Empty(), _ => throw new NotSupportedException(ColumnNotSortableMessage(SortByColumn)), }; diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderResult.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderResult.cs index 7732a6360a44..ab3064fb9b04 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderResult.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderResult.cs @@ -7,12 +7,12 @@ namespace Microsoft.AspNetCore.Components.QuickGrid; /// Holds data being supplied to a 's . /// /// The type of data represented by each row in the grid. -public struct GridItemsProviderResult +public readonly struct GridItemsProviderResult { /// /// The items being supplied. /// - public ICollection Items { get; set; } + public required ICollection Items { get; init; } /// /// The total number of items that may be displayed in the grid. This normally means the total number of items in the @@ -20,18 +20,7 @@ public struct GridItemsProviderResult /// /// If the grid is paginated, this should include all pages. If the grid is virtualized, this should include the entire scroll range. /// - public int TotalItemCount { get; set; } - - /// - /// Constructs an instance of . - /// - /// The items being supplied. - /// The total numer of items that exist. See for details. - public GridItemsProviderResult(ICollection items, int totalItemCount) - { - Items = items; - TotalItemCount = totalItemCount; - } + public int TotalItemCount { get; init; } } /// @@ -49,5 +38,5 @@ public static class GridItemsProviderResult /// The total numer of items that exist. See for details. /// An instance of . public static GridItemsProviderResult From(ICollection items, int totalItemCount) - => new(items, totalItemCount); + => new() { Items = items, TotalItemCount = totalItemCount }; } diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/IAsyncQueryExecutor.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/IAsyncQueryExecutor.cs similarity index 96% rename from src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/IAsyncQueryExecutor.cs rename to src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/IAsyncQueryExecutor.cs index 2ea8768f64ab..f8b23f393196 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/IAsyncQueryExecutor.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/IAsyncQueryExecutor.cs @@ -3,7 +3,7 @@ using System.Linq; -namespace Microsoft.AspNetCore.Components.QuickGrid.Infrastructure; +namespace Microsoft.AspNetCore.Components.QuickGrid; /// /// Provides methods for asynchronous evaluation of queries against an . diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/Paginator.razor b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/Paginator.razor index a196ea0465e9..99126355a585 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/Paginator.razor +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Pagination/Paginator.razor @@ -2,7 +2,7 @@ @namespace Microsoft.AspNetCore.Components.QuickGrid
- @if (Value.TotalItemCount.HasValue) + @if (State.TotalItemCount.HasValue) {
@if (SummaryTemplate is not null) @@ -11,15 +11,15 @@ } else { - @Value.TotalItemCount items + @State.TotalItemCount items }
Descending, - - /// - /// Automatic sort order. When used with , - /// the sort order will automatically toggle between and on successive calls, and - /// resets to whenever the specified column is changed. - /// - Auto, } diff --git a/src/Components/test/testassets/BasicTestApp/QuickGridTest/SampleQuickGridComponent.razor b/src/Components/test/testassets/BasicTestApp/QuickGridTest/SampleQuickGridComponent.razor index a90f2160e54e..ba03a7da5525 100644 --- a/src/Components/test/testassets/BasicTestApp/QuickGridTest/SampleQuickGridComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/QuickGridTest/SampleQuickGridComponent.razor @@ -17,7 +17,7 @@ - + @code { record Person(int PersonId, string firstName, string lastName, DateOnly BirthDate); From b50de621677db9bf3e9c9e059b72a86da2c28b81 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Tue, 28 Feb 2023 12:55:17 -0700 Subject: [PATCH 13/18] Address aspnet-build feedback --- ...Components.QuickGrid.EntityFrameworkAdapter.csproj | 3 ++- .../src/Columns/SortedProperty.cs | 11 +++++++++++ .../src/GridItemsProvider.cs | 2 +- .../src/GridItemsProviderResult.cs | 2 +- .../src/Infrastructure/ColumnsCollectedNotifier.cs | 2 ++ .../Microsoft.AspNetCore.Components.QuickGrid.csproj | 6 ++++-- .../src/QuickGrid.razor.cs | 5 +++-- 7 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj index 32842be5aab9..c44db04db37c 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter/src/Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter.csproj @@ -2,7 +2,8 @@ $(DefaultNetCoreTargetFramework) - enable + Provides an Entity Framework Core adapter for the Microsoft.AspNetCore.Components.QuickGrid package. + true true diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs index 026565652b46..3c7227076a93 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs @@ -2,8 +2,19 @@ // The .NET Foundation licenses this file to you under the MIT license. namespace Microsoft.AspNetCore.Components.QuickGrid; + +/// +/// A ValueTuple that holds the name of a property and the direction to sort by. +/// public readonly struct SortedProperty { + /// + /// The property name for the sorting rule. + /// public required string PropertyName { get; init; } + + /// + /// The direction to sort by. + /// public SortDirection Direction { get; init; } } diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProvider.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProvider.cs index 0ae3daf6abd7..eaf5fd3899a6 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProvider.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProvider.cs @@ -8,6 +8,6 @@ namespace Microsoft.AspNetCore.Components.QuickGrid; ///
/// The type of data represented by each row in the grid. /// Parameters describing the data being requested. -/// A that gives the data to be displayed. +/// A that gives the data to be displayed. public delegate ValueTask> GridItemsProvider( GridItemsProviderRequest request); diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderResult.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderResult.cs index ab3064fb9b04..1688c87c0224 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderResult.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderResult.cs @@ -35,7 +35,7 @@ public static class GridItemsProviderResult ///
/// The type of data represented by each row in the grid. /// The items being supplied. - /// The total numer of items that exist. See for details. + /// The total numer of items that exist. See for details. /// An instance of . public static GridItemsProviderResult From(ICollection items, int totalItemCount) => new() { Items = items, TotalItemCount = totalItemCount }; diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/ColumnsCollectedNotifier.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/ColumnsCollectedNotifier.cs index ab58090d52cc..bc2b1b2846d9 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/ColumnsCollectedNotifier.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/ColumnsCollectedNotifier.cs @@ -39,11 +39,13 @@ public sealed class ColumnsCollectedNotifier : IComponent [CascadingParameter] internal InternalGridContext InternalGridContext { get; set; } = default!; + /// public void Attach(RenderHandle renderHandle) { // This component never renders, so we can ignore the renderHandle } + /// public Task SetParametersAsync(ParameterView parameters) { if (_isFirstRender) diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.csproj b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.csproj index c488c0b573eb..301d6b95453e 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.csproj +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Microsoft.AspNetCore.Components.QuickGrid.csproj @@ -2,8 +2,10 @@ $(DefaultNetCoreTargetFramework) - Provides a simple and convenient data grid component for common grid rendering scenarios and serves as a reference architecture and performance baseline for building data grid components. - enable + Provides a simple and convenient data grid component for common grid rendering scenarios and serves as a reference architecture and performance baseline for building data grid components. + If you're using Entity Framework Core for your grid IQueryables, consider using the Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter package. + + true true diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs index 9dd8614f41d8..c4d5e8e08e6c 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs @@ -74,10 +74,10 @@ public partial class QuickGrid : IAsyncDisposable /// unique identifier, such as a primary key value, for each data item. /// /// This allows the grid to preserve the association between row elements and data items based on their - /// unique identifiers, even when the instances are replaced by new copies (for + /// unique identifiers, even when the TGridItem instances are replaced by new copies (for /// example, after a new query against the underlying data store). /// - /// If not set, the @key will be the instance itself. + /// If not set, the @key will be the TGridItem instance itself. /// [Parameter] public Func ItemKey { get; set; } = x => x!; @@ -181,6 +181,7 @@ protected override Task OnParametersSetAsync() return (_columns.Count > 0 && mustRefreshData) ? RefreshDataCoreAsync() : Task.CompletedTask; } + /// protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) From a4dae273256e7a98ec65394fa93cb6ca30bf8bb6 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Tue, 28 Feb 2023 15:24:00 -0700 Subject: [PATCH 14/18] Remove ISortBuilderColumn --- .../src/Columns/ColumnBase.razor.cs | 5 +++++ .../src/Columns/ISortBuilderColumn.cs | 21 ------------------- .../src/Columns/PropertyColumn.cs | 9 ++++++-- .../src/Columns/TemplateColumn.cs | 10 +++------ .../src/GridItemsProviderRequest.cs | 15 ++----------- .../src/PublicAPI.Unshipped.txt | 10 +++++---- 6 files changed, 23 insertions(+), 47 deletions(-) delete mode 100644 src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ISortBuilderColumn.cs diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.cs index 0278a628c1c6..fec920a2c092 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ColumnBase.razor.cs @@ -54,6 +54,11 @@ public abstract partial class ColumnBase /// [Parameter] public bool? Sortable { get; set; } + /// + /// Specifies sorting rules for a column. + /// + public abstract GridSort? SortBy { get; set; } + /// /// Indicates which direction to sort in /// if is true. diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ISortBuilderColumn.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ISortBuilderColumn.cs deleted file mode 100644 index c43216502dc6..000000000000 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/ISortBuilderColumn.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace Microsoft.AspNetCore.Components.QuickGrid; - -/// -/// An interface that, if implemented by a subclass, allows a -/// to understand the sorting rules associated with that column. -/// -/// If a subclass does not implement this, that column can still be marked as sortable and can -/// be the current sort column, but its sorting logic cannot be applied to the data queries automatically. The developer would be -/// responsible for implementing that sorting logic separately inside their . -/// -/// The type of data represented by each row in the grid. -public interface ISortBuilderColumn -{ - /// - /// Gets the sorting rules associated with the column. - /// - public GridSort? SortBuilder { get; } -} diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/PropertyColumn.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/PropertyColumn.cs index fbde7c8146ef..7d68a9af1b3c 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/PropertyColumn.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/PropertyColumn.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Components.QuickGrid; /// /// The type of data represented by each row in the grid. /// The type of the value being displayed in the column's cells. -public class PropertyColumn : ColumnBase, ISortBuilderColumn +public class PropertyColumn : ColumnBase { private Expression>? _lastAssignedProperty; private Func? _cellTextFunc; @@ -29,7 +29,12 @@ public class PropertyColumn : ColumnBase, ISortBuil /// [Parameter] public string? Format { get; set; } - GridSort? ISortBuilderColumn.SortBuilder => _sortBuilder; + /// + public override GridSort? SortBy + { + get => _sortBuilder; + set => throw new NotSupportedException($"PropertyColumn generates this member internally. For custom sorting rules, see '{typeof(TemplateColumn)}'."); + } /// protected override void OnParametersSet() diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/TemplateColumn.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/TemplateColumn.cs index 0149dc0fa2cb..fd4da8bd42c0 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/TemplateColumn.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/TemplateColumn.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Components.QuickGrid; /// Represents a column whose cells render a supplied template. /// /// The type of data represented by each row in the grid. -public class TemplateColumn : ColumnBase, ISortBuilderColumn +public class TemplateColumn : ColumnBase { private static readonly RenderFragment EmptyChildContent = _ => builder => { }; @@ -18,12 +18,8 @@ public class TemplateColumn : ColumnBase, ISortBuilderColu /// [Parameter] public RenderFragment ChildContent { get; set; } = EmptyChildContent; - /// - /// Optionally specifies sorting rules for this column. - /// - [Parameter] public GridSort? SortBy { get; set; } - - GridSort? ISortBuilderColumn.SortBuilder => SortBy; + /// + [Parameter] public override GridSort? SortBy { get; set; } /// protected internal override void CellContent(RenderTreeBuilder builder, TGridItem item) diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs index 648dd2656416..3a951c89dcf4 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs @@ -55,33 +55,22 @@ internal GridItemsProviderRequest( /// /// Applies the request's sorting rules to the supplied . - /// - /// Note that this only works if the current implements , - /// otherwise it will throw. /// /// An . /// A new representing the with sorting rules applied. public IQueryable ApplySorting(IQueryable source) => SortByColumn switch { - ISortBuilderColumn sbc => sbc.SortBuilder?.Apply(source, SortByAscending) ?? source, + ColumnBase sbc => sbc.SortBy?.Apply(source, SortByAscending) ?? source, null => source, - _ => throw new NotSupportedException(ColumnNotSortableMessage(SortByColumn)), }; /// /// Produces a collection of (property name, direction) pairs representing the sorting rules. - /// - /// Note that this only works if the current implements , - /// otherwise it will throw. /// /// A collection of (property name, direction) pairs representing the sorting rules public IReadOnlyCollection GetSortByProperties() => SortByColumn switch { - ISortBuilderColumn sbc => sbc.SortBuilder?.ToPropertyList(SortByAscending) ?? Array.Empty(), + ColumnBase sbc => sbc.SortBy?.ToPropertyList(SortByAscending) ?? Array.Empty(), null => Array.Empty(), - _ => throw new NotSupportedException(ColumnNotSortableMessage(SortByColumn)), }; - - private static string ColumnNotSortableMessage(ColumnBase col) - => $"The current sort column is of type '{col.GetType().FullName}', which does not implement {nameof(ISortBuilderColumn)}, so its sorting rules cannot be applied automatically."; } diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Unshipped.txt b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Unshipped.txt index 3f1ecc522704..591a6be48351 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Unshipped.txt +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Unshipped.txt @@ -1,5 +1,7 @@ #nullable enable abstract Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.CellContent(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder! builder, TGridItem item) -> void +abstract Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.SortBy.get -> Microsoft.AspNetCore.Components.QuickGrid.GridSort? +abstract Microsoft.AspNetCore.Components.QuickGrid.ColumnBase.SortBy.set -> void Microsoft.AspNetCore.Components.QuickGrid.Align Microsoft.AspNetCore.Components.QuickGrid.Align.Center = 1 -> Microsoft.AspNetCore.Components.QuickGrid.Align Microsoft.AspNetCore.Components.QuickGrid.Align.End = 2 -> Microsoft.AspNetCore.Components.QuickGrid.Align @@ -67,8 +69,6 @@ Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.Defer.ChildContent.get Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.Defer.ChildContent.set -> void Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.Defer.Defer() -> void Microsoft.AspNetCore.Components.QuickGrid.Infrastructure.EventHandlers -Microsoft.AspNetCore.Components.QuickGrid.ISortBuilderColumn -Microsoft.AspNetCore.Components.QuickGrid.ISortBuilderColumn.SortBuilder.get -> Microsoft.AspNetCore.Components.QuickGrid.GridSort? Microsoft.AspNetCore.Components.QuickGrid.PaginationState Microsoft.AspNetCore.Components.QuickGrid.PaginationState.CurrentPageIndex.get -> int Microsoft.AspNetCore.Components.QuickGrid.PaginationState.ItemsPerPage.get -> int @@ -128,17 +128,19 @@ Microsoft.AspNetCore.Components.QuickGrid.SortedProperty.SortedProperty() -> voi Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.ChildContent.get -> Microsoft.AspNetCore.Components.RenderFragment! Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.ChildContent.set -> void -Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.SortBy.get -> Microsoft.AspNetCore.Components.QuickGrid.GridSort? -Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.SortBy.set -> void Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.TemplateColumn() -> void override Microsoft.AspNetCore.Components.QuickGrid.PaginationState.GetHashCode() -> int override Microsoft.AspNetCore.Components.QuickGrid.Paginator.OnParametersSet() -> void override Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn.CellContent(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder! builder, TGridItem item) -> void override Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn.OnParametersSet() -> void +override Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn.SortBy.get -> Microsoft.AspNetCore.Components.QuickGrid.GridSort? +override Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn.SortBy.set -> void override Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.OnAfterRenderAsync(bool firstRender) -> System.Threading.Tasks.Task! override Microsoft.AspNetCore.Components.QuickGrid.QuickGrid.OnParametersSetAsync() -> System.Threading.Tasks.Task! override Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.CellContent(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder! builder, TGridItem item) -> void override Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.IsSortableByDefault() -> bool +override Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.SortBy.get -> Microsoft.AspNetCore.Components.QuickGrid.GridSort? +override Microsoft.AspNetCore.Components.QuickGrid.TemplateColumn.SortBy.set -> void static Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult.From(System.Collections.Generic.ICollection! items, int totalItemCount) -> Microsoft.AspNetCore.Components.QuickGrid.GridItemsProviderResult static Microsoft.AspNetCore.Components.QuickGrid.GridSort.ByAscending(System.Linq.Expressions.Expression!>! expression) -> Microsoft.AspNetCore.Components.QuickGrid.GridSort! static Microsoft.AspNetCore.Components.QuickGrid.GridSort.ByDescending(System.Linq.Expressions.Expression!>! expression) -> Microsoft.AspNetCore.Components.QuickGrid.GridSort! From b9d762a45a4e8f2b48d821e121d5e35521e1adcf Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Tue, 28 Feb 2023 15:33:48 -0700 Subject: [PATCH 15/18] Update src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs Co-authored-by: Stephen Halter --- .../src/Infrastructure/AsyncQueryExecutorSupplier.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs index 8cdd013e1123..418001188673 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs @@ -24,8 +24,7 @@ internal static class AsyncQueryExecutorSupplier private static readonly ConcurrentDictionary IsEntityFrameworkProviderTypeCache = new(); [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2111", - Justification = "In the unlikely case a necessary interface is trimmed away and the error wasn't caught in developnent," + - " the developer only risks not noticing an oppurtunity to improve performance.")] + Justification = "The reflection is a best effort to warn developers about sync-over-async behavior which can cause thread pool starvation.")] public static IAsyncQueryExecutor? GetAsyncQueryExecutor(IServiceProvider services, IQueryable? queryable) { if (queryable is not null) From 59cbe1533cc162d1e611f30b9e7a9a21d725bf77 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Tue, 28 Feb 2023 16:01:59 -0700 Subject: [PATCH 16/18] Simplify ApplySorting, GetSortByProperties Co-authored-by: Stephen Halter --- .../src/GridItemsProviderRequest.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs index 3a951c89dcf4..5c634a28ce0b 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/GridItemsProviderRequest.cs @@ -58,19 +58,13 @@ internal GridItemsProviderRequest( /// /// An . /// A new representing the with sorting rules applied. - public IQueryable ApplySorting(IQueryable source) => SortByColumn switch - { - ColumnBase sbc => sbc.SortBy?.Apply(source, SortByAscending) ?? source, - null => source, - }; + public IQueryable ApplySorting(IQueryable source) => + SortByColumn?.SortBy?.Apply(source, SortByAscending) ?? source; /// /// Produces a collection of (property name, direction) pairs representing the sorting rules. /// /// A collection of (property name, direction) pairs representing the sorting rules - public IReadOnlyCollection GetSortByProperties() => SortByColumn switch - { - ColumnBase sbc => sbc.SortBy?.ToPropertyList(SortByAscending) ?? Array.Empty(), - null => Array.Empty(), - }; + public IReadOnlyCollection GetSortByProperties() => + SortByColumn?.SortBy?.ToPropertyList(SortByAscending) ?? Array.Empty(); } From 3b3ee0626878bda1093061f3508a2a2d225d2854 Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Tue, 28 Feb 2023 16:16:48 -0700 Subject: [PATCH 17/18] Update Align.cs --- .../src/Columns/Align.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/Align.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/Align.cs index 7676254c59d9..1707c98b876b 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/Align.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/Align.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Components.QuickGrid; public enum Align { /// - /// Justifies the content against the start of the container + /// Justifies the content against the start of the container. /// Start, @@ -19,7 +19,7 @@ public enum Align Center, /// - /// Justifies the content at the end of the container + /// Justifies the content at the end of the container. /// End, From 482fcbbfa194811a5cccb2005fd1127c5dfde3fe Mon Sep 17 00:00:00 2001 From: Nick Stanton Date: Tue, 28 Feb 2023 16:17:07 -0700 Subject: [PATCH 18/18] Update src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs Co-authored-by: Mackinnon Buck --- .../src/Columns/SortedProperty.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs index 3c7227076a93..7ce2867e7863 100644 --- a/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs +++ b/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Columns/SortedProperty.cs @@ -4,7 +4,7 @@ namespace Microsoft.AspNetCore.Components.QuickGrid; /// -/// A ValueTuple that holds the name of a property and the direction to sort by. +/// Holds the name of a property and the direction to sort by. /// public readonly struct SortedProperty {