diff --git a/.azure/pipelines/benchmarks.yml b/.azure/pipelines/benchmarks.yml index 6f52332c004a..e17144725015 100644 --- a/.azure/pipelines/benchmarks.yml +++ b/.azure/pipelines/benchmarks.yml @@ -10,7 +10,7 @@ jobs: - template: jobs/default-build.yml parameters: jobName: Windows_Build - jobDisplayName: "Build only : Windows" + jobDisplayName: "Build: Windows" agentOs: Windows buildArgs: -all -pack artifacts: diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index a8e60823c009..b2146de54a72 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -93,17 +93,17 @@ variables: - name: _InternalRuntimeDownloadCodeSignArgs value: '' - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - group: DotNet-MSRC-Storage + - group: DotNetBuilds storage account read tokens - name: _InternalRuntimeDownloadArgs - value: -RuntimeSourceFeed https://dotnetclimsrc.blob.core.windows.net/dotnet - -RuntimeSourceFeedKey $(dotnetclimsrc-read-sas-token-base64) - /p:DotNetAssetRootAccessTokenSuffix='$(dotnetclimsrc-read-sas-token-base64)' + value: -RuntimeSourceFeed https://dotnetbuilds.blob.core.windows.net/internal + -RuntimeSourceFeedKey $(dotnetbuilds-internal-container-read-token-base64) + /p:DotNetAssetRootAccessTokenSuffix='$(dotnetbuilds-internal-container-read-token-base64)' # The code signing doesn't use the aspnet build scripts, so the msbuild parameters have to be passed directly. This # is awkward but necessary because the eng/common/ build scripts don't add the msbuild properties automatically. - name: _InternalRuntimeDownloadCodeSignArgs value: $(_InternalRuntimeDownloadArgs) - /p:DotNetRuntimeSourceFeed=https://dotnetclimsrc.blob.core.windows.net/dotnet - /p:DotNetRuntimeSourceFeedKey=$(dotnetclimsrc-read-sas-token-base64) + /p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal + /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) - group: DotNet-HelixApi-Access - name: _UseHelixOpenQueues value: 'false' @@ -528,7 +528,7 @@ stages: jobName: Linux_musl_x64_build jobDisplayName: "Build: Linux Musl x64" agentOs: Linux - container: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.9-WithNode-0fc54a3-20190918214015 + container: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.14-WithNode-20210910135833-c401c85 buildArgs: --arch x64 --os-name linux-musl @@ -564,7 +564,7 @@ stages: jobDisplayName: "Build: Linux Musl ARM" agentOs: Linux useHostedUbuntu: false - container: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-cross-arm-alpine-20210409142425-044d5b9 + container: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-cross-arm-alpine-20211022152824-78f7860 buildArgs: --arch arm --os-name linux-musl @@ -599,7 +599,7 @@ stages: jobDisplayName: "Build: Linux Musl ARM64" agentOs: Linux useHostedUbuntu: false - container: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-cross-arm64-alpine-20210409142425-b2c2436 + container: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-cross-arm64-alpine-20211022152824-538077f buildArgs: --arch arm64 --os-name linux-musl @@ -633,7 +633,7 @@ stages: parameters: condition: ne(variables['SkipTests'], 'true') jobName: Windows_Test - jobDisplayName: "Test: Windows Server 2016 x64" + jobDisplayName: "Test: Windows Server x64" agentOs: Windows isTestingJob: true # Just uploading artifacts/logs/ files can take 15 minutes. Doubling the cancel timeout for this job. @@ -659,7 +659,7 @@ stages: parameters: condition: ne(variables['SkipTests'], 'true') jobName: MacOS_Test - jobDisplayName: "Test: macOS 10.15" + jobDisplayName: "Test: macOS" agentOs: macOS timeoutInMinutes: 240 isTestingJob: true @@ -681,7 +681,7 @@ stages: parameters: condition: ne(variables['SkipTests'], 'true') jobName: Linux_Test - jobDisplayName: "Test: Ubuntu 18.04 x64" + jobDisplayName: "Test: Ubuntu x64" agentOs: Linux isTestingJob: true useHostedUbuntu: false @@ -735,8 +735,8 @@ stages: parameters: platform: name: 'Managed' - container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-f39df28-20191023143754' - buildScript: './eng/build.sh $(_PublishArgs) --no-build-repo-tasks' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-20210714125435-9b5bbc2' + buildScript: './eng/build.sh $(_PublishArgs) --no-build-repo-tasks $(_InternalRuntimeDownloadArgs)' skipPublishValidation: true # Publish to the BAR @@ -768,7 +768,7 @@ stages: # In addition to the dependencies above, ensure the build was successful overall. - Source_Build_Managed pool: - vmImage: vs2017-win2016 + vmImage: windows-latest publishUsingPipelines: ${{ variables._PublishUsingPipelines }} enablePublishBuildArtifacts: true # publish artifacts/log files diff --git a/.azure/pipelines/components-e2e-tests.yml b/.azure/pipelines/components-e2e-tests.yml index 734b7a2ac8e4..057a64027727 100644 --- a/.azure/pipelines/components-e2e-tests.yml +++ b/.azure/pipelines/components-e2e-tests.yml @@ -43,17 +43,36 @@ jobs: displayName: NPM install - script: .dotnet/dotnet build ./src/Components/test/E2ETest -c $(BuildConfiguration) --no-restore displayName: Build - - script: .dotnet/dotnet test ./src/Components/test/E2ETest -c $(BuildConfiguration) --no-build --logger trx + - script: .dotnet/dotnet test ./src/Components/test/E2ETest -c $(BuildConfiguration) --no-build --filter 'Quarantined!=true|Quarantined=false' + --logger:"trx%3BLogFileName=Microsoft.AspNetCore.Components.E2ETests.trx" + --logger:"html%3BLogFileName=Microsoft.AspNetCore.Components.E2ETests.html" + --results-directory $(Build.SourcesDirectory)/artifacts/TestResults/$(BuildConfiguration)/Unquarantined displayName: Run E2E tests + - script: .dotnet/dotnet test ./src/Components/test/E2ETest -c $(BuildConfiguration) --no-build --filter 'Quarantined=true' -p:RunQuarantinedTests=true + --logger:"trx%3BLogFileName=Microsoft.AspNetCore.Components.E2ETests.trx" + --logger:"html%3BLogFileName=Microsoft.AspNetCore.Components.E2ETests.html" + --results-directory $(Build.SourcesDirectory)/artifacts/TestResults/$(BuildConfiguration)/Quarantined + displayName: Run Quarantined E2E tests + continueOnError: true - task: PublishTestResults@2 displayName: Publish E2E Test Results inputs: testResultsFormat: 'VSTest' testResultsFiles: '*.trx' - searchFolder: '$(Build.SourcesDirectory)/src/Components/test/E2ETest/TestResults' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(BuildConfiguration)/Unquarantined' testRunTitle: ComponentsE2E-$(AgentOsName)-$(BuildConfiguration)-xunit condition: always() + - task: PublishTestResults@2 + displayName: Publish Quarantined E2E Test Results + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '*.trx' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(BuildConfiguration)/Quarantined' + testRunTitle: Quarantine-$(AgentOsName)-$(BuildConfiguration)-xunit + mergeTestResults: true + condition: always() + artifacts: - name: Components_E2E_Test_Logs - path: ./src/Components/test/E2ETest/TestResults + path: '$(Build.SourcesDirectory)/artifacts/TestResults/$(BuildConfiguration)' publishOnError: true diff --git a/.azure/pipelines/jobs/default-build.yml b/.azure/pipelines/jobs/default-build.yml index c990fadd726d..75b8db0262cb 100644 --- a/.azure/pipelines/jobs/default-build.yml +++ b/.azure/pipelines/jobs/default-build.yml @@ -220,6 +220,7 @@ jobs: # Include the variables we always want. COMPlus_DbgEnableMiniDump: 1 COMPlus_DbgMiniDumpName: "$(System.DefaultWorkingDirectory)/dotnet-%d.%t.core" + DotNetBuildsInternalReadSasToken: $(dotnetbuilds-internal-container-read-token) # Expand provided `env:` properties, if any. ${{ if step.env }}: ${{ step.env }} @@ -230,12 +231,14 @@ jobs: env: COMPlus_DbgEnableMiniDump: 1 COMPlus_DbgMiniDumpName: "$(System.DefaultWorkingDirectory)/dotnet-%d.%t.core" + DotNetBuildsInternalReadSasToken: $(dotnetbuilds-internal-container-read-token) - ${{ if ne(parameters.agentOs, 'Windows') }}: - script: $(BuildDirectory)/build.sh --ci --nobl --configuration $(BuildConfiguration) $(BuildScriptArgs) displayName: Run build.sh env: COMPlus_DbgEnableMiniDump: 1 COMPlus_DbgMiniDumpName: "$(System.DefaultWorkingDirectory)/dotnet-%d.%t.core" + DotNetBuildsInternalReadSasToken: $(dotnetbuilds-internal-container-read-token) - ${{ parameters.afterBuild }} diff --git a/.azure/pipelines/quarantined-pr.yml b/.azure/pipelines/quarantined-pr.yml index 271bde7848b0..f1415d04c3df 100644 --- a/.azure/pipelines/quarantined-pr.yml +++ b/.azure/pipelines/quarantined-pr.yml @@ -112,7 +112,7 @@ jobs: - template: jobs/default-build.yml parameters: jobName: MacOS_Quarantined_Test - jobDisplayName: "Tests: macOS 10.14" + jobDisplayName: "Tests: macOS" agentOs: macOS timeoutInMinutes: 120 isTestingJob: true @@ -144,7 +144,7 @@ jobs: - template: jobs/default-build.yml parameters: jobName: Linux_Quarantined_Test - jobDisplayName: "Tests: Ubuntu 18.04 x64" + jobDisplayName: "Tests: Ubuntu x64" agentOs: Linux timeoutInMinutes: 60 isTestingJob: true diff --git a/.gitignore b/.gitignore index 9868dcd32900..25e7ded85610 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,4 @@ UpgradeLog.htm .idea *.svclog mono_crash.*.json +mono_crash.*.blob diff --git a/Directory.Build.props b/Directory.Build.props index 94df1c1d9511..26dd4d70ad13 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -141,9 +141,9 @@ aspnetcore-runtime aspnetcore-targeting-pack - + false + Condition=" '$(IsTargetingPackBuilding)' == '' AND '$(AspNetCorePatchVersion)' != '2' ">false true - + - + @@ -27,10 +27,10 @@ - + - + diff --git a/docs/Helix.md b/docs/Helix.md index c55841256775..4265628ba7b8 100644 --- a/docs/Helix.md +++ b/docs/Helix.md @@ -2,7 +2,7 @@ Helix is the distributed test platform that we use to run tests. We build a helix payload that contains the publish directory of every test project that we want to test send a job with with this payload to a set of queues for the various combinations of OS that we want to test -for example: `Windows.10.Amd64.ClientRS4.VS2017.Open`, `OSX.1012.Amd64.Open`, `Ubuntu.1804.Amd64.Open`. Helix takes care of unzipping, running the job, and reporting results. +for example: `Windows.10.Amd64.ClientRS4.VS2017.Open`, `OSX.1100.Amd64.Open`, `Ubuntu.1804.Amd64.Open`. Helix takes care of unzipping, running the job, and reporting results. For more info about helix see: [SDK](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.Helix/Sdk/Readme.md), [JobSender](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.Helix/Sdk/Readme.md) @@ -19,7 +19,7 @@ This will restore, and then publish all the test project including some bootstra ## Overview of the helix usage in our pipelines - Required queues: Windows10, OSX, Ubuntu1804 -- Full queue matrix: Windows[7, 81, 10], Ubuntu[1804, 2004], Debian9, Redhat7, Arm64 (Win10, Debian9) +- Full queue matrix: Windows[10, 11], Ubuntu[1804, 2004], Debian11, Redhat7, Arm64 (Win10, Debian11) - The queues are defined in [Helix.Common.props](https://github.com/dotnet/aspnetcore/blob/main/eng/targets/Helix.Common.props) [aspnetcore-ci](https://dev.azure.com/dnceng/public/_build?definitionId=278) runs non quarantined tests against the required helix queues as a required PR check and all builds on all branches. @@ -47,31 +47,25 @@ You can also drill down into the helix web apis if you take the HelixJobId from There's also a link embedded in the build.cmd log of the Tests: Helix x64 job on Azure Pipelines, near the bottom right that will look something like this: ``` text -Uploading payloads for Job on Ubuntu.1604.Amd64.Open... - Finished uploading payloads for Job on Ubuntu.1604.Amd64.Open... - Sending Job to Ubuntu.1604.Amd64.Open... - Sent Helix Job a5cbf405-1363-452f-af4b-de5b2a61c8cf - Uploading payloads for Job on Windows.10.Amd64.Open... - Finished uploading payloads for Job on Windows.10.Amd64.Open... - Sending Job to Windows.10.Amd64.Open... - Sent Helix Job cbec3697-c298-412a-953a-e375e49d1fe0 - Uploading payloads for Job on OSX.1014.Amd64.Open... - Finished uploading payloads for Job on OSX.1014.Amd64.Open... + Sending Job to Ubuntu.1804.Amd64.Open... + Sent Helix Job; see work items at https://helix.dot.net/api/jobs/c1b425c8-0fef-4cba-9dee-29344d7a61b8/workitems?api-version=2019-06-17 + Sending Job to Windows.11.Amd64.ClientPre.Open... + Sent Helix Job; see work items at https://helix.dot.net/api/jobs/1fc117ce-d52a-4ea4-8896-3c289fdf8e17/workitems?api-version=2019-06-17 Sending Job to OSX.1014.Amd64.Open... - Sent Helix Job a54359cf-f74d-4d02-9faf-07e0a8380995 - Waiting for completion of job cbec3697-c298-412a-953a-e375e49d1fe0 - Waiting for completion of job a54359cf-f74d-4d02-9faf-07e0a8380995 - Waiting for completion of job a5cbf405-1363-452f-af4b-de5b2a61c8cf - Job a54359cf-f74d-4d02-9faf-07e0a8380995 is completed with 136 finished work items. - Job cbec3697-c298-412a-953a-e375e49d1fe0 is completed with 156 finished work items. - Job a5cbf405-1363-452f-af4b-de5b2a61c8cf is completed with 136 finished work items. - Stopping Azure Pipelines Test Run Ubuntu.1604.Amd64.Open - Stopping Azure Pipelines Test Run Windows.10.Amd64.Open + Sent Helix Job; see work items at https://helix.dot.net/api/jobs/53e2ca23-9efd-4299-8a8f-d9271265aeaa/workitems?api-version=2019-06-17 + Waiting for completion of job 1fc117ce-d52a-4ea4-8896-3c289fdf8e17 on Windows.11.Amd64.ClientPre.Open + Waiting for completion of job c1b425c8-0fef-4cba-9dee-29344d7a61b8 on Ubuntu.1804.Amd64.Open + Waiting for completion of job 53e2ca23-9efd-4299-8a8f-d9271265aeaa on OSX.1014.Amd64.Open + Job 53e2ca23-9efd-4299-8a8f-d9271265aeaa on OSX.1014.Amd64.Open is completed with 139 finished work items. + Job c1b425c8-0fef-4cba-9dee-29344d7a61b8 on Ubuntu.1804.Amd64.Open is completed with 138 finished work items. + Job 1fc117ce-d52a-4ea4-8896-3c289fdf8e17 on Windows.11.Amd64.ClientPre.Open is completed with 170 finished work items. + Stopping Azure Pipelines Test Run Ubuntu.1804.Amd64.Open + Stopping Azure Pipelines Test Run Windows.11.Amd64.ClientPre.Open Stopping Azure Pipelines Test Run OSX.1014.Amd64.Open -F:\workspace\_work\1\s\.packages\microsoft.dotnet.helix.sdk\5.0.0-beta.20280.1\tools\Microsoft.DotNet.Helix.Sdk.MultiQueue.targets(76,5): error : Work item a5cbf405-1363-452f-af4b-de5b2a61c8cf/Microsoft.AspNetCore.Authentication.Test--net5.0 in job a5cbf405-1363-452f-af4b-de5b2a61c8cf has failed. [F:\workspace\_work\1\s\eng\helix\helix.proj] -F:\workspace\_work\1\s\.packages\microsoft.dotnet.helix.sdk\5.0.0-beta.20280.1\tools\Microsoft.DotNet.Helix.Sdk.MultiQueue.targets(76,5): error : Failure log: https://helix.dot.net/api/2019-06-17/jobs/a5cbf405-1363-452f-af4b-de5b2a61c8cf/workitems/Microsoft.AspNetCore.Authentication.Test--net5.0/console [F:\workspace\_work\1\s\eng\helix\helix.proj] -##[error].packages\microsoft.dotnet.helix.sdk\5.0.0-beta.20280.1\tools\Microsoft.DotNet.Helix.Sdk.MultiQueue.targets(76,5): error : (NETCORE_ENGINEERING_TELEMETRY=Test) Work item a5cbf405-1363-452f-af4b-de5b2a61c8cf/Microsoft.AspNetCore.Authentication.Test--net5.0 in job a5cbf405-1363-452f-af4b-de5b2a61c8cf has failed. -Failure log: https://helix.dot.net/api/2019-06-17/jobs/a5cbf405-1363-452f-af4b-de5b2a61c8cf/workitems/Microsoft.AspNetCore.Authentication.Test--net5.0/console +D:\a\_work\1\s\.packages\microsoft.dotnet.helix.sdk\7.0.0-beta.21559.3\tools\Microsoft.DotNet.Helix.Sdk.MultiQueue.targets(78,5): error : Work item Microsoft.AspNetCore.Identity.Test--net7.0 in job 53e2ca23-9efd-4299-8a8f-d9271265aeaa has failed. [D:\a\_work\1\s\eng\helix\helix.proj] +D:\a\_work\1\s\.packages\microsoft.dotnet.helix.sdk\7.0.0-beta.21559.3\tools\Microsoft.DotNet.Helix.Sdk.MultiQueue.targets(78,5): error : Failure log: https://helix.dot.net/api/2019-06-17/jobs/53e2ca23-9efd-4299-8a8f-d9271265aeaa/workitems/Microsoft.AspNetCore.Identity.Test--net7.0/console [D:\a\_work\1\s\eng\helix\helix.proj] +##[error].packages\microsoft.dotnet.helix.sdk\7.0.0-beta.21559.3\tools\Microsoft.DotNet.Helix.Sdk.MultiQueue.targets(78,5): error : (NETCORE_ENGINEERING_TELEMETRY=Test) Work item Microsoft.AspNetCore.Identity.Test--net7.0 in job 53e2ca23-9efd-4299-8a8f-d9271265aeaa has failed. +Failure log: https://helix.dot.net/api/2019-06-17/jobs/53e2ca23-9efd-4299-8a8f-d9271265aeaa/workitems/Microsoft.AspNetCore.Identity.Test--net7.0/console ``` The https://helix.dot.net/ home page displays information about the available public queues (nothing about the related BYOC pools and queues or the internal Helix queues) diff --git a/eng/Baseline.Designer.props b/eng/Baseline.Designer.props index bd11897b76a6..7da0830be28e 100644 --- a/eng/Baseline.Designer.props +++ b/eng/Baseline.Designer.props @@ -2,28 +2,28 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - - - + + + @@ -38,116 +38,116 @@ - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - - + + - 6.0.0 + 6.0.1 - - + + - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - + - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 @@ -155,114 +155,114 @@ - 6.0.0 + 6.0.1 - + - + - + - 6.0.0 + 6.0.1 - + - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - + - 6.0.0 + 6.0.1 - - + + - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - - + + - 6.0.0 + 6.0.1 - + - 6.0.0 + 6.0.1 - - - + + + - + - 6.0.0 + 6.0.1 - - + + - 6.0.0 + 6.0.1 - - + + - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - - + + @@ -270,7 +270,7 @@ - 6.0.0 + 6.0.1 @@ -278,50 +278,50 @@ - 6.0.0 + 6.0.1 - + - + - - + + - + - + - - + + - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - + - + - + - 6.0.0 + 6.0.1 - - + + @@ -331,8 +331,8 @@ - - + + @@ -340,8 +340,8 @@ - - + + @@ -352,58 +352,58 @@ - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - - + + - 6.0.0 + 6.0.1 - + - + - + - 6.0.0 + 6.0.1 - + - + - + - 6.0.0 + 6.0.1 - + - 6.0.0 + 6.0.1 @@ -411,71 +411,71 @@ - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - + - + - + - + - 6.0.0 + 6.0.1 - - + + - + - - + + - 6.0.0 + 6.0.1 - - + + - 6.0.0 + 6.0.1 - - + + - 6.0.0 + 6.0.1 @@ -491,195 +491,195 @@ - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - + - 6.0.0 + 6.0.1 - - + + - 6.0.0 + 6.0.1 - - + + - 6.0.0 + 6.0.1 - + - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - + - 6.0.0 + 6.0.1 - - + + - - + + - - + + - 6.0.0 + 6.0.1 - - + + - - + + - - + + - - + + - 6.0.0 + 6.0.1 - + - + - + - + - + - 6.0.0 + 6.0.1 - + - + - + - 6.0.0 + 6.0.1 - + - + - + - 6.0.0 + 6.0.1 - + - + - + - 6.0.0 + 6.0.1 - - - - + + + + - 6.0.0 + 6.0.1 @@ -688,69 +688,69 @@ - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - + - 6.0.0 + 6.0.1 - + - 6.0.0 + 6.0.1 - + - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 @@ -769,7 +769,7 @@ - 6.0.0 + 6.0.1 @@ -788,7 +788,7 @@ - 6.0.0 + 6.0.1 @@ -804,46 +804,46 @@ - 6.0.0 + 6.0.1 - + - + - + - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - - - + + + - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 @@ -853,7 +853,7 @@ - 6.0.0 + 6.0.1 @@ -862,73 +862,73 @@ - 6.0.0 + 6.0.1 - + - + - + - 6.0.0 + 6.0.1 - + - + - + - 6.0.0 + 6.0.1 - + - + - + - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 @@ -957,11 +957,11 @@ - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 @@ -979,13 +979,13 @@ - 6.0.0 + 6.0.1 - 6.0.0 + 6.0.1 - + \ No newline at end of file diff --git a/eng/Baseline.xml b/eng/Baseline.xml index afdf976591a5..6a0991dc7477 100644 --- a/eng/Baseline.xml +++ b/eng/Baseline.xml @@ -4,111 +4,111 @@ This file contains a list of all the packages and their versions which were rele Update this list when preparing for a new patch. --> - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6b6b837c3dd4..5650cb1bb795 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -9,45 +9,45 @@ --> - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 41e6aaaf6216de904530de11b0bfd4af43fb13f7 + d93f389536054e13de2f820fe89197aa374c01eb - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 41e6aaaf6216de904530de11b0bfd4af43fb13f7 + d93f389536054e13de2f820fe89197aa374c01eb - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 41e6aaaf6216de904530de11b0bfd4af43fb13f7 + d93f389536054e13de2f820fe89197aa374c01eb - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 41e6aaaf6216de904530de11b0bfd4af43fb13f7 + d93f389536054e13de2f820fe89197aa374c01eb - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 41e6aaaf6216de904530de11b0bfd4af43fb13f7 + d93f389536054e13de2f820fe89197aa374c01eb - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 41e6aaaf6216de904530de11b0bfd4af43fb13f7 + d93f389536054e13de2f820fe89197aa374c01eb - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 41e6aaaf6216de904530de11b0bfd4af43fb13f7 + d93f389536054e13de2f820fe89197aa374c01eb - + https://dev.azure.com/dnceng/internal/_git/dotnet-efcore - 41e6aaaf6216de904530de11b0bfd4af43fb13f7 + d93f389536054e13de2f820fe89197aa374c01eb https://github.com/dotnet/runtime 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 - - https://github.com/dotnet/runtime - 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 + + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 https://github.com/dotnet/runtime @@ -61,9 +61,9 @@ https://github.com/dotnet/runtime 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 - - https://github.com/dotnet/runtime - 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 + + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 https://github.com/dotnet/runtime @@ -77,9 +77,9 @@ https://github.com/dotnet/runtime 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 - - https://github.com/dotnet/runtime - 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 + + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 https://github.com/dotnet/runtime @@ -121,9 +121,9 @@ https://github.com/dotnet/runtime 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 - - https://github.com/dotnet/runtime - 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 + + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 https://github.com/dotnet/runtime @@ -177,9 +177,9 @@ https://github.com/dotnet/runtime 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3a25a7f1cc446b60678ed25c9d829420d6321eba + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 https://github.com/dotnet/runtime @@ -189,13 +189,13 @@ https://github.com/dotnet/runtime 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 - - https://github.com/dotnet/runtime - 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 + + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3a25a7f1cc446b60678ed25c9d829420d6321eba + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 https://github.com/dotnet/runtime @@ -233,9 +233,9 @@ https://github.com/dotnet/runtime 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3a25a7f1cc446b60678ed25c9d829420d6321eba + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 https://github.com/dotnet/runtime @@ -245,33 +245,33 @@ https://github.com/dotnet/runtime 4822e3c3aa77eb82b2fb33c9321f923cf11ddde6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3a25a7f1cc446b60678ed25c9d829420d6321eba + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3a25a7f1cc446b60678ed25c9d829420d6321eba + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3a25a7f1cc446b60678ed25c9d829420d6321eba + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3a25a7f1cc446b60678ed25c9d829420d6321eba + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3a25a7f1cc446b60678ed25c9d829420d6321eba + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - 3a25a7f1cc446b60678ed25c9d829420d6321eba + 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 @@ -280,22 +280,22 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - ee9b7f19853685805c612103282c8d9486c7db86 + 7421b55f46aff8373764016d942b23cbf87c75cb - + https://github.com/dotnet/arcade - ee9b7f19853685805c612103282c8d9486c7db86 + 7421b55f46aff8373764016d942b23cbf87c75cb - + https://github.com/dotnet/arcade - ee9b7f19853685805c612103282c8d9486c7db86 + 7421b55f46aff8373764016d942b23cbf87c75cb - + https://github.com/dotnet/arcade - ee9b7f19853685805c612103282c8d9486c7db86 + 7421b55f46aff8373764016d942b23cbf87c75cb diff --git a/eng/Versions.props b/eng/Versions.props index 8b1e3ae65799..b5aa79c0c3a8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ 6 0 - 1 + 2 true $(VersionPrefix) - $(AspNetCoreMajorMinorVersion).0 + $(AspNetCoreMajorMinorVersion).2 0.3.$(AspNetCorePatchVersion) $([MSBuild]::Add(10, $(AspNetCoreMajorVersion))) @@ -65,23 +65,23 @@ 6.0.0 - 6.0.1 - 6.0.1 - 6.0.1 - 6.0.1 - 6.0.1 - 6.0.1-servicing.21567.5 + 6.0.2 + 6.0.2 + 6.0.2 + 6.0.2 + 6.0.2 + 6.0.2-servicing.22064.6 6.0.0 - 6.0.0 + 6.0.1 6.0.0 6.0.0 6.0.0 - 6.0.0 + 6.0.1 6.0.0 6.0.0 6.0.0 6.0.0 - 6.0.0 + 6.0.1 6.0.0 6.0.0 6.0.0 @@ -91,7 +91,7 @@ 6.0.0 6.0.1-servicing.21567.5 6.0.0 - 6.0.0 + 6.0.1 6.0.0 6.0.0 6.0.0 @@ -105,11 +105,11 @@ 6.0.0 6.0.0 6.0.0 - 6.0.1-servicing.21567.5 + 6.0.2-servicing.22064.6 6.0.0 6.0.0 - 6.0.0 - 6.0.1 + 6.0.1 + 6.0.2 6.0.0 6.0.0 6.0.0 @@ -119,22 +119,22 @@ 6.0.0 6.0.0 6.0.0 - 6.0.1 + 6.0.2 6.0.0 6.0.1 - 6.0.1 - 6.0.1 - 6.0.1 - 6.0.1 - 6.0.1 - 6.0.1 - 6.0.1 - 6.0.1 + 6.0.2 + 6.0.2 + 6.0.2 + 6.0.2 + 6.0.2 + 6.0.2 + 6.0.2 + 6.0.2 - 6.0.0-beta.21560.2 - 6.0.0-beta.21560.2 + 6.0.0-beta.21609.4 + 6.0.0-beta.21609.4 1.10.0 @@ -214,10 +214,10 @@ 2.1.1 2.2.0 - 3.1.21-servicing-21523-9 + 3.1.22-servicing-21579-4 $(MicrosoftAspNetCoreAzureAppServicesSiteExtension31Version) $(MicrosoftAspNetCoreAzureAppServicesSiteExtension31Version) - 5.0.12-servicing-21524-1 + 5.0.13-servicing-21572-2 $(MicrosoftAspNetCoreAzureAppServicesSiteExtension50Version) $(MicrosoftAspNetCoreAzureAppServicesSiteExtension50Version) @@ -225,7 +225,7 @@ 0.13.0 4.2.1 2.3.0 - 4.2.1 + 6.0.0 3.18.0 2.40.0 2.40.0 @@ -250,13 +250,13 @@ 0.192.0 3.0.0 7.2.2 - 4.0.0 - 95.0.4638.1700 - 4.0.0 + 4.1.0 + 97.0.4692.7100 + 4.1.0 1.4.0 4.0.0 2.2.4 - 3.1.1 + 5.0.0 6.2.3 2.0.3 0.10.0 @@ -271,7 +271,7 @@ - https://dotnetcli.blob.core.windows.net/dotnet/ - https://dotnetclimsrc.blob.core.windows.net/dotnet/ + https://dotnetcli.azureedge.net/dotnet/ + https://dotnetbuilds.azureedge.net/internal/ diff --git a/eng/common/build.sh b/eng/common/build.sh index bc07a1c68482..a16e18b174a7 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -188,9 +188,6 @@ function InitializeCustomToolset { function Build { - if [[ "$ci" == true ]]; then - TryLogClientIpAddress - fi InitializeToolset InitializeCustomToolset diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index 7ab9baac5c8d..b1bca63ab1d8 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -83,9 +83,6 @@ try { } if ($restore) { - if ($ci) { - Try-LogClientIpAddress - } Build 'Restore' } diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml index 2b55a567f82a..069098b0a066 100644 --- a/eng/common/templates/job/onelocbuild.yml +++ b/eng/common/templates/job/onelocbuild.yml @@ -12,6 +12,7 @@ parameters: SourcesDirectory: $(Build.SourcesDirectory) CreatePr: true AutoCompletePr: false + ReusePr: true UseLfLineEndings: true UseCheckedInLocProjectJson: false LanguageSet: VS_Main_Languages @@ -64,6 +65,8 @@ jobs: ${{ if eq(parameters.CreatePr, true) }}: isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }} isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }} + ${{ if eq(parameters.RepoType, 'gitHub') }}: + isShouldReusePrSelected: ${{ parameters.ReusePr }} packageSourceAuth: patAuth patVariable: ${{ parameters.CeapexPat }} ${{ if eq(parameters.RepoType, 'gitHub') }}: diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 44484289943e..f1e1cb53953b 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -163,9 +163,6 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { # Disable telemetry on CI. if ($ci) { $env:DOTNET_CLI_TELEMETRY_OPTOUT=1 - - # In case of network error, try to log the current IP for reference - Try-LogClientIpAddress } # Source Build uses DotNetCoreSdkDir variable @@ -301,32 +298,45 @@ function InstallDotNet([string] $dotnetRoot, if ($skipNonVersionedFiles) { $installParameters.SkipNonVersionedFiles = $skipNonVersionedFiles } if ($noPath) { $installParameters.NoPath = $True } - try { - & $installScript @installParameters - } - catch { - if ($runtimeSourceFeed -or $runtimeSourceFeedKey) { - Write-Host "Failed to install dotnet from public location. Trying from '$runtimeSourceFeed'" - if ($runtimeSourceFeed) { $installParameters.AzureFeed = $runtimeSourceFeed } + $variations = @() + $variations += @($installParameters) - if ($runtimeSourceFeedKey) { - $decodedBytes = [System.Convert]::FromBase64String($runtimeSourceFeedKey) - $decodedString = [System.Text.Encoding]::UTF8.GetString($decodedBytes) - $installParameters.FeedCredential = $decodedString - } + $dotnetBuilds = $installParameters.Clone() + $dotnetbuilds.AzureFeed = "https://dotnetbuilds.azureedge.net/public" + $variations += @($dotnetBuilds) - try { - & $installScript @installParameters - } - catch { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet from custom location '$runtimeSourceFeed'." - ExitWithExitCode 1 - } + if ($runtimeSourceFeed) { + $runtimeSource = $installParameters.Clone() + $runtimeSource.AzureFeed = $runtimeSourceFeed + if ($runtimeSourceFeedKey) { + $decodedBytes = [System.Convert]::FromBase64String($runtimeSourceFeedKey) + $decodedString = [System.Text.Encoding]::UTF8.GetString($decodedBytes) + $runtimeSource.FeedCredential = $decodedString + } + $variations += @($runtimeSource) + } + + $installSuccess = $false + foreach ($variation in $variations) { + if ($variation | Get-Member AzureFeed) { + $location = $variation.AzureFeed } else { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet from public location." - ExitWithExitCode 1 + $location = "public location"; + } + Write-Host "Attempting to install dotnet from $location." + try { + & $installScript @variation + $installSuccess = $true + break + } + catch { + Write-Host "Failed to install dotnet from $location." } } + if (-not $installSuccess) { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet from any of the specified locations." + ExitWithExitCode 1 + } } # @@ -882,24 +892,6 @@ if (!$disableConfigureToolsetImport) { } } -function Try-LogClientIpAddress() -{ - Write-Host "Attempting to log this client's IP for Azure Package feed telemetry purposes" - try - { - $result = Invoke-WebRequest -Uri "http://co1.msedge.net/fdv2/diagnostics.aspx" -UseBasicParsing - $lines = $result.Content.Split([Environment]::NewLine) - $socketIp = $lines | Select-String -Pattern "^Socket IP:.*" - Write-Host $socketIp - $clientIp = $lines | Select-String -Pattern "^Client IP:.*" - Write-Host $clientIp - } - catch - { - Write-Host "Unable to get this machine's effective IP address for logging: $_" - } -} - # # If $ci flag is set, turn on (and log that we did) special environment variables for improved Nuget client retry logic. # diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 6a4871ef72b7..e555c34269f6 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -188,28 +188,29 @@ function InstallDotNet { GetDotNetInstallScript "$root" local install_script=$_GetDotNetInstallScript - local archArg='' + local installParameters=(--version $version --install-dir "$root") + if [[ -n "${3:-}" ]] && [ "$3" != 'unset' ]; then - archArg="--architecture $3" + installParameters+=(--architecture $3) fi - local runtimeArg='' if [[ -n "${4:-}" ]] && [ "$4" != 'sdk' ]; then - runtimeArg="--runtime $4" + installParameters+=(--runtime $4) fi - local skipNonVersionedFilesArg="" if [[ "$#" -ge "5" ]] && [[ "$5" != 'false' ]]; then - skipNonVersionedFilesArg="--skip-non-versioned-files" + installParameters+=(--skip-non-versioned-files) fi - bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg || { - local exit_code=$? - echo "Failed to install dotnet SDK from public location (exit code '$exit_code')." - local runtimeSourceFeed='' - if [[ -n "${6:-}" ]]; then - runtimeSourceFeed="--azure-feed $6" - fi + local variations=() # list of variable names with parameter arrays in them + + local public_location=("${installParameters[@]}") + variations+=(public_location) - local runtimeSourceFeedKey='' + local dotnetbuilds=("${installParameters[@]}" --azure-feed "https://dotnetbuilds.azureedge.net/public") + variations+=(dotnetbuilds) + + if [[ -n "${6:-}" ]]; then + variations+=(private_feed) + local private_feed=("${installParameters[@]}" --azure-feed $6) if [[ -n "${7:-}" ]]; then # The 'base64' binary on alpine uses '-d' and doesn't support '--decode' # '-d'. To work around this, do a simple detection and switch the parameter @@ -219,22 +220,27 @@ function InstallDotNet { decodeArg="-d" fi decodedFeedKey=`echo $7 | base64 $decodeArg` - runtimeSourceFeedKey="--feed-credential $decodedFeedKey" + private_feed+=(--feed-credential $decodedFeedKey) fi + fi - if [[ -n "$runtimeSourceFeed" || -n "$runtimeSourceFeedKey" ]]; then - bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg $runtimeSourceFeed $runtimeSourceFeedKey || { - local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from custom location '$runtimeSourceFeed' (exit code '$exit_code')." - ExitWithExitCode $exit_code - } - else - if [[ $exit_code != 0 ]]; then - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from public location (exit code '$exit_code')." - fi - ExitWithExitCode $exit_code + local installSuccess=0 + for variationName in "${variations[@]}"; do + local name="$variationName[@]" + local variation=("${!name}") + echo "Attempting to install dotnet from $variationName." + bash "$install_script" "${variation[@]}" && installSuccess=1 + if [[ "$installSuccess" -eq 1 ]]; then + break fi - } + + echo "Failed to install dotnet from $variationName." + done + + if [[ "$installSuccess" -eq 0 ]]; then + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from any of the specified locations." + ExitWithExitCode 1 + fi } function with_retries { @@ -399,13 +405,6 @@ function StopProcesses { return 0 } -function TryLogClientIpAddress () { - echo 'Attempting to log this client''s IP for Azure Package feed telemetry purposes' - if command -v curl > /dev/null; then - curl -s 'http://co1.msedge.net/fdv2/diagnostics.aspx' | grep ' IP: ' || true - fi -} - function MSBuild { local args=$@ if [[ "$pipelines_log" == true ]]; then diff --git a/eng/helix/helix.proj b/eng/helix/helix.proj index 392c90bd1e07..56ecf5c1fbdd 100644 --- a/eng/helix/helix.proj +++ b/eng/helix/helix.proj @@ -29,6 +29,9 @@ $(NETCoreSdkVersion) Current + .tar.gz + .zip + $(RepoRoot)artifacts\bin\$(MSBuildProjectName)\ @@ -37,10 +40,11 @@ - - runtime - + diff --git a/eng/scripts/RunHelix.ps1 b/eng/scripts/RunHelix.ps1 index 92e8690e3cb5..e8734f7aeb6c 100644 --- a/eng/scripts/RunHelix.ps1 +++ b/eng/scripts/RunHelix.ps1 @@ -8,14 +8,16 @@ .PARAMETER HelixQueues Set the Helix queues to use. The list is '+' or ';'-separated. Some supported queues: + Debian.11.Amd64.Open + Mariner + Redhat.7.Amd64.Open Ubuntu.1804.Amd64.Open Ubuntu.2004.Amd64.Open + OSX.1015.Amd64.Open + OSX.1100.Amd64.Open Windows.10.Amd64.Server20H2.Open - Windows.81.Amd64.Open - Windows.7.Amd64.Open - OSX.1014.Amd64.Open - Debian.9.Amd64.Open - Redhat.7.Amd64.Open + Windows.11.Amd64.ClientPre.Open + Windows.Amd64.Server2022.Open .PARAMETER RunQuarantinedTests By default quarantined tests are not run. Set this to $true to run only the quarantined tests. .PARAMETER TargetArchitecture diff --git a/eng/targets/Helix.Common.props b/eng/targets/Helix.Common.props index b3584642a404..f17314b89e81 100644 --- a/eng/targets/Helix.Common.props +++ b/eng/targets/Helix.Common.props @@ -1,5 +1,13 @@ + + (Alpine.314.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.14-helix-amd64-20210910135833-1848e19 + (Debian.11.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64-20211001171307-0ece9b3 + (Fedora.34.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20210924174119-4f64125 + (Mariner)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-1.0-helix-20210528192219-92bf620 + (Debian.11.Arm64.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-arm64v8-20211001171229-97d8652 + + @@ -13,37 +21,29 @@ - - - - - - - + + - - - - + - - - + + + + - @@ -55,11 +55,18 @@ - + + + + false + true + false + true + diff --git a/eng/targets/Helix.props b/eng/targets/Helix.props index bc0dfe046eae..dc2bad9552b9 100644 --- a/eng/targets/Helix.props +++ b/eng/targets/Helix.props @@ -14,10 +14,6 @@ 00:30:00 00:40:00 false - false - true - false - true $(MSBuildProjectName)--$(TargetFramework) false 14.17.6 diff --git a/eng/targets/Helix.targets b/eng/targets/Helix.targets index b966249dbca3..b1f5566ae767 100644 --- a/eng/targets/Helix.targets +++ b/eng/targets/Helix.targets @@ -10,14 +10,12 @@ - (Alpine.312.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.12-helix-20200908125345-56c6673; - (Fedora.34.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20210728124700-4f64125; - (Mariner)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-1.0-helix-20210528192219-92bf620; - Debian.9.Amd64.Open; + $(HelixQueueAlpine314); + $(HelixQueueDebian11); + $(HelixQueueFedora34); + $(HelixQueueMariner); Redhat.7.Amd64.Open; Ubuntu.2004.Amd64.Open; - Windows.7.Amd64.Open; - Windows.81.Amd64.Open; true @@ -63,10 +61,10 @@ - - - - + + + + diff --git a/eng/tools/RepoTasks/DownloadFile.cs b/eng/tools/RepoTasks/DownloadFile.cs index bb0f433c1767..b973a4cef0b4 100644 --- a/eng/tools/RepoTasks/DownloadFile.cs +++ b/eng/tools/RepoTasks/DownloadFile.cs @@ -100,7 +100,7 @@ private async System.Threading.Tasks.Task ExecuteAsync() Log.LogMessage(MessageImportance.High, $"Attempting download '{source}' to '{target}'"); - using (var httpClient = new HttpClient { Timeout = TimeSpan.FromMinutes(5) }) + using (var httpClient = new HttpClient { Timeout = TimeSpan.FromMinutes(7.5) }) { for (int retryNumber = 0; retryNumber < MaxRetries; retryNumber++) { diff --git a/global.json b/global.json index 5150f5380ea0..26e4a8d02c33 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "6.0.100" + "version": "6.0.101" }, "tools": { - "dotnet": "6.0.100", + "dotnet": "6.0.101", "runtimes": { "dotnet/x64": [ "2.1.30", @@ -13,7 +13,7 @@ "$(MicrosoftNETCoreBrowserDebugHostTransportVersion)" ], "aspnetcore/x64": [ - "3.1.21" + "3.1.22" ] }, "Git": "2.22.0", @@ -29,7 +29,7 @@ }, "msbuild-sdks": { "Yarn.MSBuild": "1.22.10", - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21560.2", - "Microsoft.DotNet.Helix.Sdk": "6.0.0-beta.21560.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21609.4", + "Microsoft.DotNet.Helix.Sdk": "6.0.0-beta.21609.4" } } diff --git a/src/Caching/StackExchangeRedis/src/RedisCache.cs b/src/Caching/StackExchangeRedis/src/RedisCache.cs index 5440c0ba5860..f3c42de17733 100644 --- a/src/Caching/StackExchangeRedis/src/RedisCache.cs +++ b/src/Caching/StackExchangeRedis/src/RedisCache.cs @@ -16,6 +16,14 @@ namespace Microsoft.Extensions.Caching.StackExchangeRedis /// public class RedisCache : IDistributedCache, IDisposable { + // -- Explanation of why two kinds of SetScript are used -- + // * Redis 2.0 had HSET key field value for setting individual hash fields, + // and HMSET key field value [field value ...] for setting multiple hash fields (against the same key). + // * Redis 4.0 added HSET key field value [field value ...] and deprecated HMSET. + // + // On Redis versions that don't have the newer HSET variant, we use SetScriptPreExtendedSetCommand + // which uses the (now deprecated) HMSET. + // KEYS[1] = = key // ARGV[1] = absolute-expiration - ticks as long (-1 for none) // ARGV[2] = sliding-expiration - ticks as long (-1 for none) @@ -28,14 +36,22 @@ public class RedisCache : IDistributedCache, IDisposable redis.call('EXPIRE', KEYS[1], ARGV[3]) end return 1"); + private const string SetScriptPreExtendedSetCommand = (@" + redis.call('HMSET', KEYS[1], 'absexp', ARGV[1], 'sldexp', ARGV[2], 'data', ARGV[4]) + if ARGV[3] ~= '-1' then + redis.call('EXPIRE', KEYS[1], ARGV[3]) + end + return 1"); private const string AbsoluteExpirationKey = "absexp"; private const string SlidingExpirationKey = "sldexp"; private const string DataKey = "data"; private const long NotPresent = -1; + private static readonly Version ServerVersionWithExtendedSetCommand = new Version(4, 0, 0); private volatile IConnectionMultiplexer _connection; private IDatabase _cache; private bool _disposed; + private string _setScript = SetScript; private readonly RedisCacheOptions _options; private readonly string _instance; @@ -107,7 +123,7 @@ public void Set(string key, byte[] value, DistributedCacheEntryOptions options) var absoluteExpiration = GetAbsoluteExpiration(creationTime, options); - var result = _cache.ScriptEvaluate(SetScript, new RedisKey[] { _instance + key }, + var result = _cache.ScriptEvaluate(_setScript, new RedisKey[] { _instance + key }, new RedisValue[] { absoluteExpiration?.Ticks ?? NotPresent, @@ -143,7 +159,7 @@ public void Set(string key, byte[] value, DistributedCacheEntryOptions options) var absoluteExpiration = GetAbsoluteExpiration(creationTime, options); - await _cache.ScriptEvaluateAsync(SetScript, new RedisKey[] { _instance + key }, + await _cache.ScriptEvaluateAsync(_setScript, new RedisKey[] { _instance + key }, new RedisValue[] { absoluteExpiration?.Ticks ?? NotPresent, @@ -206,7 +222,7 @@ private void Connect() _connection = _options.ConnectionMultiplexerFactory().GetAwaiter().GetResult(); } - TryRegisterProfiler(); + PrepareConnection(); _cache = _connection.GetDatabase(); } } @@ -247,7 +263,7 @@ private void Connect() _connection = await _options.ConnectionMultiplexerFactory(); } - TryRegisterProfiler(); + PrepareConnection(); _cache = _connection.GetDatabase(); } } @@ -257,9 +273,31 @@ private void Connect() } } + private void PrepareConnection() + { + ValidateServerFeatures(); + TryRegisterProfiler(); + } + + private void ValidateServerFeatures() + { + _ = _connection ?? throw new InvalidOperationException($"{nameof(_connection)} cannot be null."); + + foreach (var endPoint in _connection.GetEndPoints()) + { + if (_connection.GetServer(endPoint).Version < ServerVersionWithExtendedSetCommand) + { + _setScript = SetScriptPreExtendedSetCommand; + return; + } + } + } + private void TryRegisterProfiler() { - if (_connection != null && _options.ProfilingSession != null) + _ = _connection ?? throw new InvalidOperationException($"{nameof(_connection)} cannot be null."); + + if (_options.ProfilingSession != null) { _connection.RegisterProfiler(_options.ProfilingSession); } diff --git a/src/Components/Web.JS/dist/Release/blazor.server.js b/src/Components/Web.JS/dist/Release/blazor.server.js index 1b4e2780a0e6..6478b77bdf2b 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",s="__byte[]";class i{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 i(window)};c[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=document.baseURI+e.substr(2)),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 i(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{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 s=D(r),i=o.invokeDotNetFromJS(e,t,n,s);return i?m(i):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++,s=new Promise(((e,t)=>{a[o]={resolve:e,reject:t}}));try{const s=D(r);v().beginInvokeDotNetFromJS(o,e,t,n,s)}catch(e){b(o,!1,e)}return s}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){let 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 s=new Promise((e=>{e(E(t,o).apply(null,m(n)))}));e&&s.then((t=>v().endInvokeJSFromDotNet(e,!0,D([e,!0,T(t,r)]))),(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),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(s)){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){var t;if(r.has(e))this._streamPromise=null===(t=r.get(e))||void 0===t?void 0:t.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={[s]: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 s=new Map,i=new Map,a={createEventArgs:()=>({})},c=[];function l(e){return s.get(e)}function h(e){const t=s.get(e);return(null==t?void 0:t.browserEventName)||e}function u(e,t){e.forEach((e=>s.set(e,t)))}function d(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}return{value:function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t)?!!t.checked:t.value}}}),u(["copy","cut","paste"],a),u(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...p(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}}),u(["focus","blur","focusin","focusout"],a),u(["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};var t}}),u(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","dblclick"],{createEventArgs:e=>p(e)}),u(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno};var t}}),u(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total};var t}}),u(["touchcancel","touchend","touchmove","touchenter","touchleave","touchstart"],{createEventArgs:e=>{return{detail:(t=e).detail,touches:d(t.touches),targetTouches:d(t.targetTouches),changedTouches:d(t.changedTouches),ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),u(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...p(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}}),u(["wheel","mousewheel"],{createEventArgs:e=>{return{...p(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),u(["toggle"],a);const f=["date","datetime-local","month","time","week"],g=new Map;let m,y,w=0;const v={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const r="__bl-dynamic-root:"+(++w).toString();g.set(r,e);const o=await E().invokeMethodAsync("AddRootComponent",t,r),s=new _(o,y[t]);return await s.setParameters(n),s}};class b{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 _{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 b)}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 E().invokeMethodAsync("SetRootComponentParameters",this._componentId,r,t)}async dispose(){if(null!==this._componentId){await E().invokeMethodAsync("RemoveRootComponent",this._componentId),this._componentId=null;for(const e of this._jsEventCallbackWrappers.values())e.dispose()}}}function E(){if(!m)throw new Error("Dynamic root components have not been enabled in this application.");return m}const S=new Map;let C;const I=new Promise((e=>{C=e}));function k(e,t,n){return x(e,t.eventHandlerId,(()=>T(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function T(e){const t=S.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let x=(e,t,n)=>n();const D=$(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),R={submit:!0},P=$(["click","dblclick","mousedown","mousemove","mouseup"]);class U{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++U.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new A(this.onGlobalEvent.bind(this))}setListener(e,t,n,r){const o=this.getEventHandlerInfosForElement(e,!0),s=o.getHandler(t);if(s)this.eventInfoStore.update(s.eventHandlerId,n);else{const s={element:e,eventName:t,eventHandlerId:n,renderingComponentId:r};this.eventInfoStore.add(s),o.setHandler(t,s)}}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,i.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(),s=null,i=!1;const a=D.hasOwnProperty(e);let c=!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)&&P.hasOwnProperty(u)&&h.disabled))){if(!i){const n=l(e);s=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},i=!0}R.hasOwnProperty(t.type)&&t.preventDefault(),k(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},s)}p.stopPropagation(e)&&(c=!0),p.preventDefault(e)&&t.preventDefault()}r=a||c?void 0:n.shift()}var h,u}getEventHandlerInfosForElement(e,t){return e.hasOwnProperty(this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new N:null}}U.nextEventDelegatorId=0;class A{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},c.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=h(e),this.countByEventName.hasOwnProperty(e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=D.hasOwnProperty(e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(this.infosByEventHandlerId.hasOwnProperty(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=h(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(this.countByEventName.hasOwnProperty(e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class N{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return this.handlers.hasOwnProperty(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 $(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const B=Q("_blazorLogicalChildren"),L=Q("_blazorLogicalParent"),M=Q("_blazorLogicalEnd");function O(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return B in e||(e[B]=[]),e}function F(e,t){const n=document.createComment("!");return H(n,e,t),n}function H(e,t,n){const r=e;if(e instanceof Comment&&q(r)&&q(r).length>0)throw new Error("Not implemented: inserting non-empty logical container");if(W(r))throw new Error("Not implemented: moving existing logical children");const o=q(t);if(n0;)j(n,0)}const r=n;r.parentNode.removeChild(r)}function W(e){return e[L]||null}function z(e,t){return q(e)[t]}function J(e){var t=K(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function q(e){return e[B]}function V(e,t){const n=q(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=G(e.moveRangeStart)})),t.forEach((t=>{const r=t.moveToBeforeMarker=document.createComment("marker"),o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):Y(r,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd;let s=r;for(;s;){const e=s.nextSibling;if(n.insertBefore(s,t),s===o)break;s=e}n.removeChild(t)})),t.forEach((e=>{n[e.toSiblingIndex]=e.moveRangeStart}))}function K(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 X(e){const t=q(W(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function Y(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=X(t);n?n.parentNode.insertBefore(e,n):Y(e,W(t))}}}function G(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=X(e);if(t)return t.previousSibling;{const t=W(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:G(t)}}function Q(e){return"function"==typeof Symbol?Symbol():e}function Z(e){return`_bl_${e}`}e.attachReviver(((e,t)=>t&&"object"==typeof t&&t.hasOwnProperty("__internalId")&&"string"==typeof t.__internalId?function(e){const t=`[${Z(e)}]`;return document.querySelector(t)}(t.__internalId):t));const ee="_blazorDeferredValue",te=document.createElement("template"),ne=document.createElementNS("http://www.w3.org/2000/svg","g"),re={},oe="__internal_",se="preventDefault_",ie="stopPropagation_";class ae{constructor(e){this.rootComponentIds=new Set,this.childComponentLocations={},this.eventDelegator=new U(e),this.eventDelegator.notifyAfterClick((e=>{if(!ge)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;e_e(!1))))},enableNavigationInterception:function(){ge=!0},navigateTo:ve,getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href};function ve(e,t,n=!1){const r=Se(e),o=t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n};!o.forceLoad&&Ie(r)?be(r,!1,o.replaceHistoryEntry):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,o.replaceHistoryEntry)}function be(e,t,n){fe=!0,n?history.replaceState(null,"",e):history.pushState(null,"",e),_e(t)}async function _e(e){ye&&await ye(location.href,e)}let Ee;function Se(e){return Ee=Ee||document.createElement("a"),Ee.href=e,Ee.href}function Ce(e,t){return e?e.tagName===t?e:Ce(e.parentElement,t):null}function Ie(e){const t=(n=document.baseURI).substr(0,n.lastIndexOf("/")+1);var n;return e.startsWith(t)}const ke={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())}},Te={init:function(e,t,n,r=50){const o=De(t);(o||document.documentElement).style.overflowAnchor="none";const s=document.createRange();h(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const i=new IntersectionObserver((function(r){r.forEach((r=>{var o;if(!r.isIntersecting)return;s.setStartAfter(t),s.setEndBefore(n);const i=s.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,i,a):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,i,a)}))}),{root:o,rootMargin:`${r}px`});i.observe(t),i.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)),i.unobserve(e),i.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)}xe[e._id]={intersectionObserver:i,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const t=xe[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete xe[e._id])}},xe={};function De(e){return e?"visible"!==getComputedStyle(e).overflowY?e:De(e.parentElement):null}const Re={getAndRemoveExistingTitle:function(){var e;const t=document.getElementsByTagName("title");if(0===t.length)return null;let n=null;for(let r=t.length-1;r>=0;r--){const o=t[r],s=o.previousSibling;s instanceof Comment&&null!==W(s)||(null===n&&(n=o.textContent),null===(e=o.parentNode)||void 0===e||e.removeChild(o))}return n}},Pe={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 s=Ue(e,t),i=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(s.blob)})),a=await new Promise((function(e){var t;const s=Math.min(1,r/i.width),a=Math.min(1,o/i.height),c=Math.min(s,a),l=document.createElement("canvas");l.width=Math.round(i.width*c),l.height=Math.round(i.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(i,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:s.lastModified,name:s.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||s.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return Ue(e,t).blob}};function Ue(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.`);return n}async function Ae(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 Ne=new Map,$e={navigateTo:ve,registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(s.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=i.get(t.browserEventName);n?n.push(e):i.set(t.browserEventName,[e]),c.forEach((n=>n(e,t.browserEventName)))}s.set(e,t)},rootComponents:v,_internal:{navigationManager:we,domWrapper:ke,Virtualize:Te,PageTitle:Re,InputFile:Pe,getJSDataStreamChunk:Ae,receiveDotNetDataStream:function(t,n,r,o){let s=Ne.get(t);if(!s){const n=new ReadableStream({start(e){Ne.set(t,e),s=e}});e.jsCallDispatcher.supplyDotNetStream(t,n)}o?(s.error(o),Ne.delete(t)):0===r?(s.close(),Ne.delete(t)):s.enqueue(n.length===r?n:n.subarray(0,r))},attachWebRendererInterop:function(t,n,r,o){if(S.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);S.set(t,n),Object.keys(r).length>0&&function(t,n,r){if(m)throw new Error("Dynamic root components have already been enabled.");m=t,y=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])}}(T(t),r,o),C()}}};window.Blazor=$e;const Be=[0,2e3,1e4,3e4,null];class Le{constructor(e){this._retryDelays=void 0!==e?[...e,null]:Be}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class Me extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class Oe extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class Fe extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class He extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class je extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class We extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class ze extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class Je extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}class qe{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class Ve{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""}}var Ke,Xe,Ye,Ge,Qe;!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"}(Ke||(Ke={}));class Ze{constructor(){}log(e,t){}}Ze.instance=new Ze;class et{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 tt{static get isBrowser(){return"object"==typeof window}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isNode(){return!this.isBrowser&&!this.isWebWorker}}function nt(e,t){let n="";return rt(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 rt(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function ot(e,t,n,r,o,s,i){let a={};if(o){const e=await o();e&&(a={Authorization:`Bearer ${e}`})}const[c,l]=at();a[c]=l,e.log(Ke.Trace,`(${t} transport) sending data. ${nt(s,i.logMessageContent)}.`);const h=rt(s)?"arraybuffer":"text",u=await n.post(r,{content:s,headers:{...a,...i.headers},responseType:h,timeout:i.timeout,withCredentials:i.withCredentials});e.log(Ke.Trace,`(${t} transport) request complete. Response status: ${u.statusCode}.`)}class st{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 it{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${Ke[e]}: ${t}`;switch(e){case Ke.Critical:case Ke.Error:this.out.error(n);break;case Ke.Warning:this.out.warn(n);break;case Ke.Information:this.out.info(n);break;default:this.out.log(n)}}}}function at(){let e="X-SignalR-User-Agent";return tt.isNode&&(e="User-Agent"),[e,ct("0.0.0-DEV_BUILD",lt(),tt.isNode?"NodeJS":"Browser",ht())]}function ct(e,t,n,r){let o="Microsoft SignalR/";const s=e.split(".");return o+=`${s[0]}.${s[1]}`,o+=` (${e}; `,o+=t&&""!==t?`${t}; `:"Unknown OS; ",o+=`${n}`,o+=r?`; ${r}`:"; Unknown Runtime Version",o+=")",o}function lt(){if(!tt.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function ht(){if(tt.isNode)return process.versions.node}function ut(e){return e.stack?e.stack:e.message?e.message:`${e}`}class dt extends Ve{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 Fe;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 Fe});let r,o=null;if(e.timeout){const r=e.timeout;o=setTimeout((()=>{t.abort(),this._logger.log(Ke.Warning,"Timeout from HTTP request."),n=new Oe}),r)}try{r=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:!0===e.withCredentials?"include":"same-origin",headers:{"Content-Type":"text/plain;charset=UTF-8","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(Ke.Warning,`Error from HTTP request. ${e}.`),e}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!r.ok){const e=await pt(r,"text");throw new Me(e||r.statusText,r.status)}const s=pt(r,e.responseType),i=await s;return new qe(r.status,r.statusText,i)}getCookieString(e){return""}}function pt(e,t){let n;switch(t){case"arraybuffer":n=e.arrayBuffer();break;case"text":n=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`);default:n=e.text()}return n}class ft extends Ve{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Fe):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"),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 Fe)}),e.timeout&&(r.timeout=e.timeout),r.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),r.status>=200&&r.status<300?t(new qe(r.status,r.statusText,r.response||r.responseText)):n(new Me(r.response||r.responseText||r.statusText,r.status))},r.onerror=()=>{this._logger.log(Ke.Warning,`Error from HTTP request. ${r.status}: ${r.statusText}.`),n(new Me(r.statusText,r.status))},r.ontimeout=()=>{this._logger.log(Ke.Warning,"Timeout from HTTP request."),n(new Oe)},r.send(e.content||"")})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class gt extends Ve{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new dt(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new ft(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Fe):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)}}class mt{}mt.Authorization="Authorization",mt.Cookie="Cookie",function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(Xe||(Xe={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Ye||(Ye={}));class yt{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 wt{constructor(e,t,n,r){this._httpClient=e,this._accessTokenFactory=t,this._logger=n,this._pollAbort=new yt,this._options=r,this._running=!1,this.onreceive=null,this.onclose=null}get pollAborted(){return this._pollAbort.aborted}async connect(e,t){if(et.isRequired(e,"url"),et.isRequired(t,"transferFormat"),et.isIn(t,Ye,"transferFormat"),this._url=e,this._logger.log(Ke.Trace,"(LongPolling transport) Connecting."),t===Ye.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]=at(),o={[n]:r,...this._options.headers},s={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===Ye.Binary&&(s.responseType="arraybuffer");const i=await this._getAccessToken();this._updateHeaderToken(s,i);const a=`${e}&_=${Date.now()}`;this._logger.log(Ke.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,s);200!==c.statusCode?(this._logger.log(Ke.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new Me(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,s)}async _getAccessToken(){return this._accessTokenFactory?await this._accessTokenFactory():null}_updateHeaderToken(e,t){e.headers||(e.headers={}),t?e.headers[mt.Authorization]=`Bearer ${t}`:e.headers[mt.Authorization]&&delete e.headers[mt.Authorization]}async _poll(e,t){try{for(;this._running;){const n=await this._getAccessToken();this._updateHeaderToken(t,n);try{const n=`${e}&_=${Date.now()}`;this._logger.log(Ke.Trace,`(LongPolling transport) polling: ${n}.`);const r=await this._httpClient.get(n,t);204===r.statusCode?(this._logger.log(Ke.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==r.statusCode?(this._logger.log(Ke.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this._closeError=new Me(r.statusText||"",r.statusCode),this._running=!1):r.content?(this._logger.log(Ke.Trace,`(LongPolling transport) data received. ${nt(r.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this._logger.log(Ke.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof Oe?this._logger.log(Ke.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(Ke.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}}finally{this._logger.log(Ke.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?ot(this._logger,"LongPolling",this._httpClient,this._url,this._accessTokenFactory,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(Ke.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(Ke.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=at();e[t]=n;const r={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials},o=await this._getAccessToken();this._updateHeaderToken(r,o),await this._httpClient.delete(this._url,r),this._logger.log(Ke.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(Ke.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(Ke.Trace,e),this.onclose(this._closeError)}}}class vt{constructor(e,t,n,r){this._httpClient=e,this._accessTokenFactory=t,this._logger=n,this._options=r,this.onreceive=null,this.onclose=null}async connect(e,t){if(et.isRequired(e,"url"),et.isRequired(t,"transferFormat"),et.isIn(t,Ye,"transferFormat"),this._logger.log(Ke.Trace,"(SSE transport) Connecting."),this._url=e,this._accessTokenFactory){const t=await this._accessTokenFactory();t&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(t)}`)}return new Promise(((n,r)=>{let o,s=!1;if(t===Ye.Text){if(tt.isBrowser||tt.isWebWorker)o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const t=this._httpClient.getCookieString(e),n={};n.Cookie=t;const[r,s]=at();n[r]=s,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(Ke.Trace,`(SSE transport) data received. ${nt(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},o.onerror=e=>{s?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(Ke.Information,`SSE connected to ${this._url}`),this._eventSource=o,s=!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?ot(this._logger,"SSE",this._httpClient,this._url,this._accessTokenFactory,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 bt{constructor(e,t,n,r,o,s){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=r,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=s}async connect(e,t){if(et.isRequired(e,"url"),et.isRequired(t,"transferFormat"),et.isIn(t,Ye,"transferFormat"),this._logger.log(Ke.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory){const t=await this._accessTokenFactory();t&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(t)}`)}return new Promise(((n,r)=>{let o;e=e.replace(/^http/,"ws"),this._httpClient.getCookieString(e);let s=!1;o||(o=new this._webSocketConstructor(e)),t===Ye.Binary&&(o.binaryType="arraybuffer"),o.onopen=t=>{this._logger.log(Ke.Information,`WebSocket connected to ${e}.`),this._webSocket=o,s=!0,n()},o.onerror=e=>{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"There was an error with the transport",this._logger.log(Ke.Information,`(WebSockets transport) ${t}.`)},o.onmessage=e=>{if(this._logger.log(Ke.Trace,`(WebSockets transport) data received. ${nt(e.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(e.data)}catch(e){return void this._close(e)}},o.onclose=e=>{if(s)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.",r(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(Ke.Trace,`(WebSockets transport) sending data. ${nt(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(Ke.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 _t{constructor(e,t={}){var n;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,et.isRequired(e,"url"),this._logger=void 0===(n=t.logger)?new it(Ke.Information):null===n?Ze.instance:void 0!==n.log?n:new it(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=t.httpClient||new gt(this._logger),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Ye.Binary,et.isIn(e,Ye,"transferFormat"),this._logger.log(Ke.Debug,`Starting connection with transfer format '${Ye[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(Ke.Error,e),await this._stopPromise,Promise.reject(new Error(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(Ke.Error,e),Promise.reject(new Error(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 Et(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(Ke.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(Ke.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(Ke.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(Ke.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport!==Xe.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(Xe.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 Error("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}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 wt&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(Ke.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(Ke.Error,"Failed to start the connection: "+e),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(e)}}async _getNegotiationResponse(e){const t={};if(this._accessTokenFactory){const e=await this._accessTokenFactory();e&&(t[mt.Authorization]=`Bearer ${e}`)}const[n,r]=at();t[n]=r;const o=this._resolveNegotiateUrl(e);this._logger.log(Ke.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 Me&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(Ke.Error,t),Promise.reject(new ze(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(Ke.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 s=[],i=n.availableTransports||[];let a=n;for(const n of i){const i=this._resolveTransportOrError(n,t,r);if(i instanceof Error)s.push(`${n.transport} failed:`),s.push(i);else if(this._isITransport(i)){if(this.transport=i,!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(Ke.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,s.push(new We(`${n.transport} failed: ${e}`,Xe[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(Ke.Debug,e),Promise.reject(new Error(e))}}}}return s.length>0?Promise.reject(new Je(`Unable to connect to the server with any of the available transports. ${s.join(" ")}`,s)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case Xe.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new bt(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Xe.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new vt(this._httpClient,this._accessTokenFactory,this._logger,this._options);case Xe.LongPolling:return new wt(this._httpClient,this._accessTokenFactory,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=Xe[e.transport];if(null==r)return this._logger.log(Ke.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(Ke.Debug,`Skipping transport '${Xe[r]}' because it was disabled by the client.`),new je(`'${Xe[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>Ye[e])).indexOf(n)>=0))return this._logger.log(Ke.Debug,`Skipping transport '${Xe[r]}' because it does not support the requested transfer format '${Ye[n]}'.`),new Error(`'${Xe[r]}' does not support ${Ye[n]}.`);if(r===Xe.WebSockets&&!this._options.WebSocket||r===Xe.ServerSentEvents&&!this._options.EventSource)return this._logger.log(Ke.Debug,`Skipping transport '${Xe[r]}' because it is not supported in your environment.'`),new He(`'${Xe[r]}' is not supported in your environment.`,r);this._logger.log(Ke.Debug,`Selecting transport '${Xe[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(Ke.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(Ke.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(Ke.Error,`Connection disconnected with error '${e}'.`):this._logger.log(Ke.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(Ke.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(Ke.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(Ke.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(!tt.isBrowser||!window.document)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(Ke.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 Et{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new St,this._transportResult=new St,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new St),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 St;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):Et._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 St{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class Ct{static write(e){return`${e}${Ct.RecordSeparator}`}static parse(e){if(e[e.length-1]!==Ct.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(Ct.RecordSeparator);return t.pop(),t}}Ct.RecordSeparatorCode=30,Ct.RecordSeparator=String.fromCharCode(Ct.RecordSeparatorCode);class It{writeHandshakeRequest(e){return Ct.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(rt(e)){const r=new Uint8Array(e),o=r.indexOf(Ct.RecordSeparatorCode);if(-1===o)throw new Error("Message is incomplete.");const s=o+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(r.slice(0,s))),n=r.byteLength>s?r.slice(s).buffer:null}else{const r=e,o=r.indexOf(Ct.RecordSeparator);if(-1===o)throw new Error("Message is incomplete.");const s=o+1;t=r.substring(0,s),n=r.length>s?r.substring(s):null}const r=Ct.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"}(Ge||(Ge={}));class kt{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 st(this,e)}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(Qe||(Qe={}));class Tt{constructor(e,t,n,r){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(Ke.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://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},et.isRequired(e,"connection"),et.isRequired(t,"logger"),et.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=3e4,this.keepAliveIntervalInMilliseconds=15e3,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=r,this._handshakeProtocol=new It,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=Qe.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Ge.Ping})}static create(e,t,n,r){return new Tt(e,t,n,r)}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!==Qe.Disconnected&&this._connectionState!==Qe.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!==Qe.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Qe.Connecting,this._logger.log(Ke.Debug,"Starting HubConnection.");try{await this._startInternal(),tt.isBrowser&&document&&document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Qe.Connected,this._connectionStarted=!0,this._logger.log(Ke.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=Qe.Disconnected,this._logger.log(Ke.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(Ke.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(Ke.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError}catch(e){throw this._logger.log(Ke.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===Qe.Disconnected?(this._logger.log(Ke.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===Qe.Disconnecting?(this._logger.log(Ke.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=Qe.Disconnecting,this._logger.log(Ke.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(Ke.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 Error("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 s;const i=new kt;return i.cancelCallback=()=>{const e=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],s.then((()=>this._sendWithProtocol(e)))},this._callbacks[o.invocationId]=(e,t)=>{t?i.error(t):e&&(e.type===Ge.Completion?e.error?i.error(new Error(e.error)):i.complete():i.next(e.item))},s=this._sendWithProtocol(o).catch((e=>{i.error(e),delete this._callbacks[o.invocationId]})),this._launchStreams(n,s),i}_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===Ge.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 Ge.Invocation:this._invokeClientMethod(e);break;case Ge.StreamItem:case Ge.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===Ge.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(Ke.Error,`Stream callback threw error: ${ut(e)}`)}}break}case Ge.Ping:break;case Ge.Close:{this._logger.log(Ke.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(Ke.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(Ke.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(Ke.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(Ke.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===Qe.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."))}_invokeClientMethod(e){const t=this._methods[e.target.toLowerCase()];if(t){try{t.forEach((t=>t.apply(this,e.arguments)))}catch(t){this._logger.log(Ke.Error,`A callback for the method ${e.target.toLowerCase()} threw error '${t}'.`)}if(e.invocationId){const e="Server requested a response, which is not supported in this version of the client.";this._logger.log(Ke.Error,e),this._stopPromise=this._stopInternal(new Error(e))}}else this._logger.log(Ke.Warning,`No client method with the name '${e.target}' found.`)}_connectionClosed(e){this._logger.log(Ke.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new Error("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===Qe.Disconnecting?this._completeClose(e):this._connectionState===Qe.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===Qe.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=Qe.Disconnected,this._connectionStarted=!1,tt.isBrowser&&document&&document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Ke.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(Ke.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=Qe.Reconnecting,e?this._logger.log(Ke.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(Ke.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Ke.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==Qe.Reconnecting)return void this._logger.log(Ke.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==o;){if(this._logger.log(Ke.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!==Qe.Reconnecting)return void this._logger.log(Ke.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=Qe.Connected,this._logger.log(Ke.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(Ke.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(Ke.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==Qe.Reconnecting)return this._logger.log(Ke.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===Qe.Disconnecting&&this._completeClose());r=e instanceof Error?e:new Error(e.toString()),o=this._getNextRetryDelay(n++,Date.now()-t,r)}}this._logger.log(Ke.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(Ke.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(Ke.Error,`Stream 'error' callback called with '${e}' threw error: ${ut(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:Ge.Invocation}:{arguments:t,target:e,type:Ge.Invocation};{const n=this._invocationId;return this._invocationId++,0!==r.length?{arguments:t,invocationId:n.toString(),streamIds:r,target:e,type:Ge.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:Ge.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,s.push(h>>>10&1023|55296),h=56320|1023&h),s.push(h)}else s.push(a);s.length>=4096&&(i+=String.fromCharCode.apply(String,s),s.length=0)}return s.length>0&&(i+=String.fromCharCode.apply(String,s)),i}var Ft,Ht=Nt?new TextDecoder:null,jt=Nt?"undefined"!=typeof process&&"force"!==process.env.TEXT_DECODER?200:0:Pt,Wt=function(e,t){this.type=e,this.data=t},zt=(Ft=function(e,t){return(Ft=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])})(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}Ft(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Jt=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 zt(t,e),t}(Error),qt={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 s=n/4294967296,i=4294967295&n;return o=new Uint8Array(8),(t=new DataView(o.buffer)).setUint32(0,r<<2|3&s),t.setUint32(4,i),o}return o=new Uint8Array(12),(t=new DataView(o.buffer)).setUint32(0,r),Ut(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:At(t,4),nsec:t.getUint32(0)};default:throw new Jt("Unrecognized data size for timestamp (expected 4, 8, or 12): "+e.length)}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},Vt=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(qt)}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 "+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: "+e+" bytes in UTF-8");this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>Lt){var t=$t(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),Mt(e,this.bytes,this.pos),this.pos+=t}else t=$t(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var r=e.length,o=n,s=0;s>6&31|192;else{if(i>=55296&&i<=56319&&s>12&15|224,t[o++]=i>>6&63|128):(t[o++]=i>>18&7|240,t[o++]=i>>12&63|128,t[o++]=i>>6&63|128)}t[o++]=63&i|128}else t[o++]=i}}(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: "+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: "+t);this.writeU8(198),this.writeU32(t)}var n=Kt(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: "+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=Ot(e,t,n),s=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(s,o),o},e}(),Qt=function(e,t){var n,r,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]1||a(e,t)}))})}function a(e,t){try{(n=o[e](t)).value instanceof en?Promise.resolve(n.value.v).then(c,l):h(s[0][2],n)}catch(e){h(s[0][3],e)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},nn=new DataView(new ArrayBuffer(0)),rn=new Uint8Array(nn.buffer),on=function(){try{nn.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),sn=new on("Insufficient data"),an=new Gt,cn=function(){function e(e,t,n,r,o,s,i,a){void 0===e&&(e=Vt.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=Pt),void 0===r&&(r=Pt),void 0===o&&(o=Pt),void 0===s&&(s=Pt),void 0===i&&(i=Pt),void 0===a&&(a=an),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=r,this.maxArrayLength=o,this.maxMapLength=s,this.maxExtLength=i,this.keyDecoder=a,this.totalPos=0,this.pos=0,this.view=nn,this.bytes=rn,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=Kt(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=Kt(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=Kt(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 "+(t.byteLength-n)+" of "+t.byteLength+" byte(s) found at buffer["+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 Qt(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,s,i,a;return s=this,void 0,a=function(){var s,i,a,c,l,h,u,d;return Qt(this,(function(p){switch(p.label){case 0:s=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=Zt(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,s)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{i=this.doDecodeSync(),s=!0}catch(e){if(!(e instanceof on))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(s){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,i]}throw h=(l=this).headByte,u=l.pos,d=l.totalPos,new RangeError("Insufficient data in parsing "+Yt(h)+" at "+d+" ("+u+" in the current buffer)")}}))},new((i=void 0)||(i=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 i?o:new i((function(e){e(o)}))).then(n,r)}o((a=a.apply(s,[])).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 tn(this,arguments,(function(){var n,r,o,s,i,a,c,l,h;return Qt(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=Zt(e),u.label=2;case 2:return[4,en(o.next())];case 3:if((s=u.sent()).done)return[3,12];if(i=s.value,t&&0===r)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),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,en(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 on))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]),s&&!s.done&&(h=o.return)?[4,en(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 Jt("Unrecognized type byte: "+Yt(e));r=this.lookU32(),t=this.decodeExtension(r,4)}this.complete();for(var o=this.stack;o.length>0;){var s=o[o.length-1];if(0===s.type){if(s.array[s.position]=t,s.position++,s.position!==s.size)continue e;o.pop(),t=s.array}else{if(1===s.type){if("string"!=(i=typeof t)&&"number"!==i)throw new Jt("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new Jt("The key __proto__ is not allowed");s.key=t,s.type=2;continue e}if(s.map[s.key]=t,s.readCount++,s.readCount!==s.size){s.key=null,s.type=1;continue e}o.pop(),t=s.map}}return t}var i},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 Jt("Unrecognized array type byte: "+Yt(e))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new Jt("Max length exceeded: map length ("+e+") > maxMapLengthLength ("+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 Jt("Max length exceeded: array length ("+e+") > maxArrayLength ("+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 Jt("Max length exceeded: UTF-8 byte length ("+e+") > maxStrLength ("+this.maxStrLength+")");if(this.bytes.byteLengthjt?function(e,t,n){var r=e.subarray(t,t+n);return Ht.decode(r)}(this.bytes,o,e):Ot(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 Jt("Max length exceeded: bin length ("+e+") > maxBinLength ("+this.maxBinLength+")");if(!this.hasRemaining(e+t))throw sn;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 Jt("Max length exceeded: ext length ("+e+") > maxExtLength ("+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=At(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 ln{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+i+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+i,o+i+a):n.subarray(o+i,o+i+a)),o=o+i+a}return t}}const hn=new Uint8Array([145,Ge.Ping]);class un{constructor(e){this.name="messagepack",this.version=1,this.transferFormat=Ye.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new Xt(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=Ze.instance);const r=ln.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 Ge.Invocation:return this._writeInvocation(e);case Ge.StreamInvocation:return this._writeStreamInvocation(e);case Ge.StreamItem:return this._writeStreamItem(e);case Ge.Completion:return this._writeCompletion(e);case Ge.Ping:return ln.write(hn);case Ge.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 Ge.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case Ge.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case Ge.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case Ge.Ping:return this._createPingMessage(n);case Ge.Close:return this._createCloseMessage(n);default:return t.log(Ke.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:Ge.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:Ge.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:Ge.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:Ge.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:Ge.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:Ge.Completion}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([Ge.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([Ge.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),ln.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([Ge.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([Ge.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),ln.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([Ge.StreamItem,e.headers||{},e.invocationId,e.item]);return ln.write(t.slice())}_writeCompletion(e){const t=e.error?this._errorResult:e.result?this._nonVoidResult:this._voidResult;let n;switch(t){case this._errorResult:n=this._encoder.encode([Ge.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([Ge.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([Ge.Completion,e.headers||{},e.invocationId,t,e.result])}return ln.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([Ge.CancelInvocation,e.headers||{},e.invocationId]);return ln.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}let dn=!1;async function pn(){let e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),dn||(dn=!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 fn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,gn=fn?fn.decode.bind(fn):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("")},mn=Math.pow(2,32),yn=Math.pow(2,21)-1;function wn(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function vn(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function bn(e,t){const n=vn(e,t+4);if(n>yn)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*mn+vn(e,t)}class _n{constructor(e){this.batchData=e;const t=new In(e);this.arrayRangeReader=new kn(e),this.arrayBuilderSegmentReader=new Tn(e),this.diffReader=new En(e),this.editReader=new Sn(e,t),this.frameReader=new Cn(e,t)}updatedComponents(){return wn(this.batchData,this.batchData.length-20)}referenceFrames(){return wn(this.batchData,this.batchData.length-16)}disposedComponentIds(){return wn(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return wn(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return wn(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return wn(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return bn(this.batchData,n)}}class En{constructor(e){this.batchDataUint8=e}componentId(e){return wn(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class Sn{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return wn(this.batchDataUint8,e)}siblingIndex(e){return wn(this.batchDataUint8,e+4)}newTreeIndex(e){return wn(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return wn(this.batchDataUint8,e+8)}removedAttributeName(e){const t=wn(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class Cn{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return wn(this.batchDataUint8,e)}subtreeLength(e){return wn(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=wn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return wn(this.batchDataUint8,e+8)}elementName(e){const t=wn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=wn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=wn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=wn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=wn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return bn(this.batchDataUint8,e+12)}}class In{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=wn(e,e.length-4)}readString(e){if(-1===e)return null;{const n=wn(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const s=e[t+o];if(n|=(127&s)<this.nextBatchId)return this.fatalError?(this.logger.log(xn.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(xn.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(xn.Debug,`Applying batch ${e}.`),function(e,t){const n=pe[e];if(!n)throw new Error(`There is no browser renderer with ID ${e}.`);const r=t.arrayRangeReader,o=t.updatedComponents(),s=r.values(o),i=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()}] ${xn[e]}: ${t}`;switch(e){case xn.Critical:case xn.Error:console.error(n);break;case xn.Warning:console.warn(n);break;case xn.Information:console.info(n);break;default:console.log(n)}}}}class Un{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!==Qe.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!==Qe.Connected)return!1;const t=await e.invoke("StartCircuit",we.getBaseURI(),we.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=g.get(e);if(t)return g.delete(e),t}(e);if(t)return O(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=O(n,!0),o=q(r);return Array.from(n.childNodes).forEach((e=>o.push(e))),e[L]=r,t&&(e[M]=t,O(t)),O(e)}(this.components[n].start,this.components[n].end);throw new Error(`Invalid sequence number or identifier '${e}'.`)}}const An={configureSignalR:e=>{},logLevel:xn.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class Nn{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 $e.reconnect()||this.rejected()}catch(e){this.logger.log(xn.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 $n{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const r=this.document.getElementById($n.MaxRetriesId);r&&(r.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add($n.ShowClassName)}update(e){const t=this.document.getElementById($n.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add($n.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add($n.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add($n.RejectedClassName)}removeClasses(){this.dialog.classList.remove($n.ShowClassName,$n.HideClassName,$n.FailedClassName,$n.RejectedClassName)}}$n.ShowClassName="components-reconnect-show",$n.HideClassName="components-reconnect-hide",$n.FailedClassName="components-reconnect-failed",$n.RejectedClassName="components-reconnect-rejected",$n.MaxRetriesId="components-reconnect-max-retries",$n.CurrentAttemptId="components-reconnect-current-attempt";class Bn{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||$e.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new $n(t,e.maxRetries,document):new Nn(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new Ln(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class Ln{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;tLn.MaximumFirstRetryInterval?Ln.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(xn.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise((t=>setTimeout(t,e)))}}Ln.MaximumFirstRetryInterval=3e3;const Mn=/^\s*Blazor-Component-State:(?[a-zA-Z0-9\+\/=]+)$/;function On(e){var t;if(e.nodeType===Node.COMMENT_NODE){const n=e.textContent||"",r=Mn.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 jn(e,t){const n=e.currentElement;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const r=Hn.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:s,parameterDefinitions:i,parameterValues:a,prerenderId:c}=e;if("webassembly"===r){if(!o)throw new Error("assembly must be defined when using a descriptor.");if(!s)throw new Error("typeName must be defined when using a descriptor.");if(c){const e=Wn(c,n);if(!e)throw new Error(`Could not find an end component comment for '${t}'`);return{type:r,assembly:o,typeName:s,parameterDefinitions:i&&atob(i),parameterValues:a&&atob(a),start:t,prerenderId:c,end:e}}return{type:r,assembly:o,typeName:s,parameterDefinitions:i&&atob(i),parameterValues:a&&atob(a),start:t}}}(r,n,e);case"server":return function(e,t,n){const{type:r,descriptor:o,sequence:s,prerenderId:i}=e;if("server"===r){if(!o)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===s)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(s))throw new Error(`Error parsing the sequence '${s}' for component '${JSON.stringify(e)}'`);if(i){const e=Wn(i,n);if(!e)throw new Error(`Could not find an end component comment for '${t}'`);return{type:r,sequence:s,descriptor:o,start:t,prerenderId:i,end:e}}return{type:r,sequence:s,descriptor:o,start:t}}}(r,n,e)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}function Wn(e,t){for(;t.next()&&t.currentElement;){const n=t.currentElement;if(n.nodeType!==Node.COMMENT_NODE)continue;if(!n.textContent)continue;const r=Hn.exec(n.textContent),o=r&&r[1];if(o)return zn(o,e),n}}function zn(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 Jn{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:s,afterStarted:i}=o;return i&&e.afterStartedCallbacks.push(i),s?s(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await I,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let Xn=!1,Yn=!1;async function Gn(e){if(Yn)throw new Error("Blazor has already started.");Yn=!0;const t=function(e){const t={...An,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...An.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 Kn;return await r.importInitializersAsync(n,[e]),r}(t),r=new Pn(t.logLevel);$e.reconnect=async e=>{if(Xn)return!1;const n=e||await Qn(t,r,i);return await i.reconnect(n)?(t.reconnectionHandler.onConnectionUp(),!0):(r.log(xn.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)},$e.defaultReconnectionHandler=new Bn(r),t.reconnectionHandler=t.reconnectionHandler||$e.defaultReconnectionHandler,r.log(xn.Information,"Starting up Blazor server-side application.");const o=function(e,t){return function(e){const t=Fn(e,"server"),n=[];for(let e=0;ee.sequence-t.sequence))}(e)}(document),s=On(document),i=new Un(o,s||""),a=await Qn(t,r,i);if(!await i.startCircuit(a))return void r.log(xn.Error,"Failed to start the circuit.");let c=!1;const l=()=>{if(!c){const e=new FormData,t=i.circuitId;e.append("circuitId",t),c=navigator.sendBeacon("_blazor/disconnect",e)}};$e.disconnect=l,window.addEventListener("unload",l,{capture:!1,once:!0}),r.log(xn.Information,"Blazor server-side application started."),n.invokeAfterStartedCallbacks($e)}async function Qn(t,n,r){var o,s;const i=new un;i.name="blazorpack";const a=(new Rt).withUrl("_blazor").withHubProtocol(i);t.configureSignalR(a);const c=a.build();$e._internal.navigationManager.listenForNavigationEvents(((e,t)=>c.send("OnLocationChanged",e,t))),c.on("JS.AttachComponent",((e,t)=>function(e,t,n,r){let o=pe[0];o||(o=pe[0]=new ae(0)),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=Dn.getOrCreate(n);c.on("JS.RenderBatch",((e,t)=>{n.log(xn.Debug,`Received render batch with id ${e} and ${t.byteLength} bytes.`),l.processBatch(e,t,c)})),c.onclose((e=>!Xn&&t.reconnectionHandler.onConnectionDown(t.reconnectionOptions,e))),c.on("JS.Error",(e=>{Xn=!0,Zn(c,e,n),pn()})),$e._internal.forceCloseConnection=()=>c.stop(),$e._internal.sendJSDataStream=(e,t,n)=>function(e,t,n,r){setTimeout((async()=>{let o=5,s=(new Date).valueOf();try{const i=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-s;s=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)}(c,e,t,n);try{await c.start()}catch(e){if(Zn(c,e,n),"FailedToNegotiateWithServerError"===e.errorType)throw e;pn(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===Xe.WebSockets))?n.log(xn.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===Xe.WebSockets))?n.log(xn.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===Xe.LongPolling))&&n.log(xn.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===(s=null===(o=c.connection)||void 0===o?void 0:o.features)||void 0===s?void 0:s.inherentKeepAlive)&&n.log(xn.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 Zn(e,t,n){n.log(xn.Error,t),e&&e.stop()}$e.start=Gn,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&Gn()})(); \ 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",s="__byte[]";class i{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 i(window)};c[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=document.baseURI+e.substr(2)),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 i(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{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 s=D(r),i=o.invokeDotNetFromJS(e,t,n,s);return i?m(i):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++,s=new Promise(((e,t)=>{a[o]={resolve:e,reject:t}}));try{const s=D(r);v().beginInvokeDotNetFromJS(o,e,t,n,s)}catch(e){b(o,!1,e)}return s}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){let 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 s=new Promise((e=>{e(E(t,o).apply(null,m(n)))}));e&&s.then((t=>v().endInvokeJSFromDotNet(e,!0,D([e,!0,T(t,r)]))),(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),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(s)){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){var t;if(r.has(e))this._streamPromise=null===(t=r.get(e))||void 0===t?void 0:t.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={[s]: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 s=new Map,i=new Map,a=[];function c(e){return s.get(e)}function l(e){const t=s.get(e);return(null==t?void 0:t.browserEventName)||e}function h(e,t){e.forEach((e=>s.set(e,t)))}function u(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}return{value:function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t)?!!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","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),s=new b(o,m[t]);return await s.setParameters(n),s}};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","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),s=o.getHandler(t);if(s)this.eventInfoStore.update(s.eventHandlerId,n);else{const s={element:e,eventName:t,eventHandlerId:n,renderingComponentId:r};this.eventInfoStore.add(s),o.setHandler(t,s)}}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,i.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(),s=null,i=!1;const a=x.hasOwnProperty(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)&&R.hasOwnProperty(u)&&h.disabled))){if(!i){const n=c(e);s=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},i=!0}D.hasOwnProperty(t.type)&&t.preventDefault(),I(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},s)}p.stopPropagation(e)&&(l=!0),p.preventDefault(e)&&t.preventDefault()}r=a||l?void 0:n.shift()}var h,u}getEventHandlerInfosForElement(e,t){return e.hasOwnProperty(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),this.countByEventName.hasOwnProperty(e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=x.hasOwnProperty(e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(this.infosByEventHandlerId.hasOwnProperty(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(this.countByEventName.hasOwnProperty(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 this.handlers.hasOwnProperty(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 $=G("_blazorLogicalChildren"),B=G("_blazorLogicalParent"),L=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 $ in e||(e[$]=[]),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(j(r))throw new Error("Not implemented: moving existing logical children");const o=J(t);if(n0;)H(n,0)}const r=n;r.parentNode.removeChild(r)}function j(e){return e[B]||null}function W(e,t){return J(e)[t]}function z(e){var t=V(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function J(e){return e[$]}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=t.moveToBeforeMarker=document.createComment("marker"),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 s=r;for(;s;){const e=s.nextSibling;if(n.insertBefore(s,t),s===o)break;s=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(j(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,j(t))}}}function Y(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=K(e);if(t)return t.previousSibling;{const t=j(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&&t.hasOwnProperty("__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_",se="stopPropagation_";class ie{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;ebe(!1))))},enableNavigationInterception:function(){fe=!0},navigateTo:we,getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href};function we(e,t,n=!1){const r=Ee(e),o=t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n};!o.forceLoad&&Ce(r)?ve(r,!1,o.replaceHistoryEntry):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,o.replaceHistoryEntry)}function ve(e,t,n){pe=!0,n?history.replaceState(null,"",e):history.pushState(null,"",e),be(t)}async function be(e){me&&await me(location.href,e)}let _e;function Ee(e){return _e=_e||document.createElement("a"),_e.href=e,_e.href}function Se(e,t){return e?e.tagName===t?e:Se(e.parentElement,t):null}function Ce(e){const t=(n=document.baseURI).substr(0,n.lastIndexOf("/")+1);var n;return e.startsWith(t)}const Ie={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())}},ke={init:function(e,t,n,r=50){const o=xe(t);(o||document.documentElement).style.overflowAnchor="none";const s=document.createRange();h(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const i=new IntersectionObserver((function(r){r.forEach((r=>{var o;if(!r.isIntersecting)return;s.setStartAfter(t),s.setEndBefore(n);const i=s.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,i,a):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,i,a)}))}),{root:o,rootMargin:`${r}px`});i.observe(t),i.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)),i.unobserve(e),i.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)}Te[e._id]={intersectionObserver:i,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const t=Te[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete Te[e._id])}},Te={};function xe(e){return e?"visible"!==getComputedStyle(e).overflowY?e:xe(e.parentElement):null}const De={getAndRemoveExistingTitle:function(){var e;const t=document.getElementsByTagName("title");if(0===t.length)return null;let n=null;for(let r=t.length-1;r>=0;r--){const o=t[r],s=o.previousSibling;s instanceof Comment&&null!==j(s)||(null===n&&(n=o.textContent),null===(e=o.parentNode)||void 0===e||e.removeChild(o))}return n}},Re={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 s=Pe(e,t),i=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(s.blob)})),a=await new Promise((function(e){var t;const s=Math.min(1,r/i.width),a=Math.min(1,o/i.height),c=Math.min(s,a),l=document.createElement("canvas");l.width=Math.round(i.width*c),l.height=Math.round(i.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(i,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:s.lastModified,name:s.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||s.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return Pe(e,t).blob}};function Pe(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.`);return n}async function Ue(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 Ae=new Map,Ne={navigateTo:we,registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(s.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=i.get(t.browserEventName);n?n.push(e):i.set(t.browserEventName,[e]),a.forEach((n=>n(e,t.browserEventName)))}s.set(e,t)},rootComponents:w,_internal:{navigationManager:ye,domWrapper:Ie,Virtualize:ke,PageTitle:De,InputFile:Re,getJSDataStreamChunk:Ue,receiveDotNetDataStream:function(t,n,r,o){let s=Ae.get(t);if(!s){const n=new ReadableStream({start(e){Ae.set(t,e),s=e}});e.jsCallDispatcher.supplyDotNetStream(t,n)}o?(s.error(o),Ae.delete(t)):0===r?(s.close(),Ae.delete(t)):s.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=Ne;const $e=[0,2e3,1e4,3e4,null];class Be{constructor(e){this._retryDelays=void 0!==e?[...e,null]:$e}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class Le extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class Me extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class Oe extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class Fe extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class He extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class je extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class We extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class ze extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}class Je{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""}}var Ve,Ke,Xe,Ye,Ge;!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"}(Ve||(Ve={}));class Qe{constructor(){}log(e,t){}}Qe.instance=new Qe;class Ze{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 et{static get isBrowser(){return"object"==typeof window}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isNode(){return!this.isBrowser&&!this.isWebWorker}}function tt(e,t){let n="";return nt(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 nt(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function rt(e,t,n,r,o,s,i){let a={};if(o){const e=await o();e&&(a={Authorization:`Bearer ${e}`})}const[c,l]=it();a[c]=l,e.log(Ve.Trace,`(${t} transport) sending data. ${tt(s,i.logMessageContent)}.`);const h=nt(s)?"arraybuffer":"text",u=await n.post(r,{content:s,headers:{...a,...i.headers},responseType:h,timeout:i.timeout,withCredentials:i.withCredentials});e.log(Ve.Trace,`(${t} transport) request complete. Response status: ${u.statusCode}.`)}class ot{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 st{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${Ve[e]}: ${t}`;switch(e){case Ve.Critical:case Ve.Error:this.out.error(n);break;case Ve.Warning:this.out.warn(n);break;case Ve.Information:this.out.info(n);break;default:this.out.log(n)}}}}function it(){let e="X-SignalR-User-Agent";return et.isNode&&(e="User-Agent"),[e,at("0.0.0-DEV_BUILD",ct(),et.isNode?"NodeJS":"Browser",lt())]}function at(e,t,n,r){let o="Microsoft SignalR/";const s=e.split(".");return o+=`${s[0]}.${s[1]}`,o+=` (${e}; `,o+=t&&""!==t?`${t}; `:"Unknown OS; ",o+=`${n}`,o+=r?`; ${r}`:"; Unknown Runtime Version",o+=")",o}function ct(){if(!et.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function lt(){if(et.isNode)return process.versions.node}function ht(e){return e.stack?e.stack:e.message?e.message:`${e}`}class ut 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 Oe;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 Oe});let r,o=null;if(e.timeout){const r=e.timeout;o=setTimeout((()=>{t.abort(),this._logger.log(Ve.Warning,"Timeout from HTTP request."),n=new Me}),r)}try{r=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:!0===e.withCredentials?"include":"same-origin",headers:{"Content-Type":"text/plain;charset=UTF-8","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(Ve.Warning,`Error from HTTP request. ${e}.`),e}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!r.ok){const e=await dt(r,"text");throw new Le(e||r.statusText,r.status)}const s=dt(r,e.responseType),i=await s;return new Je(r.status,r.statusText,i)}getCookieString(e){return""}}function dt(e,t){let n;switch(t){case"arraybuffer":n=e.arrayBuffer();break;case"text":n=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`);default:n=e.text()}return n}class pt extends qe{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Oe):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"),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 Oe)}),e.timeout&&(r.timeout=e.timeout),r.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),r.status>=200&&r.status<300?t(new Je(r.status,r.statusText,r.response||r.responseText)):n(new Le(r.response||r.responseText||r.statusText,r.status))},r.onerror=()=>{this._logger.log(Ve.Warning,`Error from HTTP request. ${r.status}: ${r.statusText}.`),n(new Le(r.statusText,r.status))},r.ontimeout=()=>{this._logger.log(Ve.Warning,"Timeout from HTTP request."),n(new Me)},r.send(e.content||"")})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class ft extends qe{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new ut(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new pt(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Oe):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)}}class gt{}gt.Authorization="Authorization",gt.Cookie="Cookie",function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(Ke||(Ke={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Xe||(Xe={}));class mt{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 yt{constructor(e,t,n,r){this._httpClient=e,this._accessTokenFactory=t,this._logger=n,this._pollAbort=new mt,this._options=r,this._running=!1,this.onreceive=null,this.onclose=null}get pollAborted(){return this._pollAbort.aborted}async connect(e,t){if(Ze.isRequired(e,"url"),Ze.isRequired(t,"transferFormat"),Ze.isIn(t,Xe,"transferFormat"),this._url=e,this._logger.log(Ve.Trace,"(LongPolling transport) Connecting."),t===Xe.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]=it(),o={[n]:r,...this._options.headers},s={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===Xe.Binary&&(s.responseType="arraybuffer");const i=await this._getAccessToken();this._updateHeaderToken(s,i);const a=`${e}&_=${Date.now()}`;this._logger.log(Ve.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,s);200!==c.statusCode?(this._logger.log(Ve.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new Le(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,s)}async _getAccessToken(){return this._accessTokenFactory?await this._accessTokenFactory():null}_updateHeaderToken(e,t){e.headers||(e.headers={}),t?e.headers[gt.Authorization]=`Bearer ${t}`:e.headers[gt.Authorization]&&delete e.headers[gt.Authorization]}async _poll(e,t){try{for(;this._running;){const n=await this._getAccessToken();this._updateHeaderToken(t,n);try{const n=`${e}&_=${Date.now()}`;this._logger.log(Ve.Trace,`(LongPolling transport) polling: ${n}.`);const r=await this._httpClient.get(n,t);204===r.statusCode?(this._logger.log(Ve.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==r.statusCode?(this._logger.log(Ve.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this._closeError=new Le(r.statusText||"",r.statusCode),this._running=!1):r.content?(this._logger.log(Ve.Trace,`(LongPolling transport) data received. ${tt(r.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this._logger.log(Ve.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof Me?this._logger.log(Ve.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(Ve.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}}finally{this._logger.log(Ve.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?rt(this._logger,"LongPolling",this._httpClient,this._url,this._accessTokenFactory,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(Ve.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(Ve.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=it();e[t]=n;const r={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials},o=await this._getAccessToken();this._updateHeaderToken(r,o),await this._httpClient.delete(this._url,r),this._logger.log(Ve.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(Ve.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(Ve.Trace,e),this.onclose(this._closeError)}}}class wt{constructor(e,t,n,r){this._httpClient=e,this._accessTokenFactory=t,this._logger=n,this._options=r,this.onreceive=null,this.onclose=null}async connect(e,t){if(Ze.isRequired(e,"url"),Ze.isRequired(t,"transferFormat"),Ze.isIn(t,Xe,"transferFormat"),this._logger.log(Ve.Trace,"(SSE transport) Connecting."),this._url=e,this._accessTokenFactory){const t=await this._accessTokenFactory();t&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(t)}`)}return new Promise(((n,r)=>{let o,s=!1;if(t===Xe.Text){if(et.isBrowser||et.isWebWorker)o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const t=this._httpClient.getCookieString(e),n={};n.Cookie=t;const[r,s]=it();n[r]=s,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(Ve.Trace,`(SSE transport) data received. ${tt(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},o.onerror=e=>{s?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(Ve.Information,`SSE connected to ${this._url}`),this._eventSource=o,s=!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?rt(this._logger,"SSE",this._httpClient,this._url,this._accessTokenFactory,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 vt{constructor(e,t,n,r,o,s){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=r,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=s}async connect(e,t){if(Ze.isRequired(e,"url"),Ze.isRequired(t,"transferFormat"),Ze.isIn(t,Xe,"transferFormat"),this._logger.log(Ve.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory){const t=await this._accessTokenFactory();t&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(t)}`)}return new Promise(((n,r)=>{let o;e=e.replace(/^http/,"ws"),this._httpClient.getCookieString(e);let s=!1;o||(o=new this._webSocketConstructor(e)),t===Xe.Binary&&(o.binaryType="arraybuffer"),o.onopen=t=>{this._logger.log(Ve.Information,`WebSocket connected to ${e}.`),this._webSocket=o,s=!0,n()},o.onerror=e=>{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"There was an error with the transport",this._logger.log(Ve.Information,`(WebSockets transport) ${t}.`)},o.onmessage=e=>{if(this._logger.log(Ve.Trace,`(WebSockets transport) data received. ${tt(e.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(e.data)}catch(e){return void this._close(e)}},o.onclose=e=>{if(s)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.",r(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(Ve.Trace,`(WebSockets transport) sending data. ${tt(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(Ve.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 bt{constructor(e,t={}){var n;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Ze.isRequired(e,"url"),this._logger=void 0===(n=t.logger)?new st(Ve.Information):null===n?Qe.instance:void 0!==n.log?n:new st(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=t.httpClient||new ft(this._logger),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Xe.Binary,Ze.isIn(e,Xe,"transferFormat"),this._logger.log(Ve.Debug,`Starting connection with transfer format '${Xe[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(Ve.Error,e),await this._stopPromise,Promise.reject(new Error(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(Ve.Error,e),Promise.reject(new Error(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 _t(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(Ve.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(Ve.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(Ve.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(Ve.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport!==Ke.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(Ke.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 Error("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}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 yt&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(Ve.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(Ve.Error,"Failed to start the connection: "+e),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(e)}}async _getNegotiationResponse(e){const t={};if(this._accessTokenFactory){const e=await this._accessTokenFactory();e&&(t[gt.Authorization]=`Bearer ${e}`)}const[n,r]=it();t[n]=r;const o=this._resolveNegotiateUrl(e);this._logger.log(Ve.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 Le&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(Ve.Error,t),Promise.reject(new We(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(Ve.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 s=[],i=n.availableTransports||[];let a=n;for(const n of i){const i=this._resolveTransportOrError(n,t,r);if(i instanceof Error)s.push(`${n.transport} failed:`),s.push(i);else if(this._isITransport(i)){if(this.transport=i,!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(Ve.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,s.push(new je(`${n.transport} failed: ${e}`,Ke[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(Ve.Debug,e),Promise.reject(new Error(e))}}}}return s.length>0?Promise.reject(new ze(`Unable to connect to the server with any of the available transports. ${s.join(" ")}`,s)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case Ke.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new vt(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Ke.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new wt(this._httpClient,this._accessTokenFactory,this._logger,this._options);case Ke.LongPolling:return new yt(this._httpClient,this._accessTokenFactory,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=Ke[e.transport];if(null==r)return this._logger.log(Ve.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(Ve.Debug,`Skipping transport '${Ke[r]}' because it was disabled by the client.`),new He(`'${Ke[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>Xe[e])).indexOf(n)>=0))return this._logger.log(Ve.Debug,`Skipping transport '${Ke[r]}' because it does not support the requested transfer format '${Xe[n]}'.`),new Error(`'${Ke[r]}' does not support ${Xe[n]}.`);if(r===Ke.WebSockets&&!this._options.WebSocket||r===Ke.ServerSentEvents&&!this._options.EventSource)return this._logger.log(Ve.Debug,`Skipping transport '${Ke[r]}' because it is not supported in your environment.'`),new Fe(`'${Ke[r]}' is not supported in your environment.`,r);this._logger.log(Ve.Debug,`Selecting transport '${Ke[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(Ve.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(Ve.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(Ve.Error,`Connection disconnected with error '${e}'.`):this._logger.log(Ve.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(Ve.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(Ve.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(Ve.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(!et.isBrowser||!window.document)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(Ve.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 _t{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Et,this._transportResult=new Et,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Et),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 Et;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):_t._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 Et{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class St{static write(e){return`${e}${St.RecordSeparator}`}static parse(e){if(e[e.length-1]!==St.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(St.RecordSeparator);return t.pop(),t}}St.RecordSeparatorCode=30,St.RecordSeparator=String.fromCharCode(St.RecordSeparatorCode);class Ct{writeHandshakeRequest(e){return St.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(nt(e)){const r=new Uint8Array(e),o=r.indexOf(St.RecordSeparatorCode);if(-1===o)throw new Error("Message is incomplete.");const s=o+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(r.slice(0,s))),n=r.byteLength>s?r.slice(s).buffer:null}else{const r=e,o=r.indexOf(St.RecordSeparator);if(-1===o)throw new Error("Message is incomplete.");const s=o+1;t=r.substring(0,s),n=r.length>s?r.substring(s):null}const r=St.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"}(Ye||(Ye={}));class It{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 ot(this,e)}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(Ge||(Ge={}));class kt{constructor(e,t,n,r){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(Ve.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://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},Ze.isRequired(e,"connection"),Ze.isRequired(t,"logger"),Ze.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=3e4,this.keepAliveIntervalInMilliseconds=15e3,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=r,this._handshakeProtocol=new Ct,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=Ge.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Ye.Ping})}static create(e,t,n,r){return new kt(e,t,n,r)}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!==Ge.Disconnected&&this._connectionState!==Ge.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!==Ge.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Ge.Connecting,this._logger.log(Ve.Debug,"Starting HubConnection.");try{await this._startInternal(),et.isBrowser&&document&&document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Ge.Connected,this._connectionStarted=!0,this._logger.log(Ve.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=Ge.Disconnected,this._logger.log(Ve.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(Ve.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(Ve.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError}catch(e){throw this._logger.log(Ve.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===Ge.Disconnected?(this._logger.log(Ve.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===Ge.Disconnecting?(this._logger.log(Ve.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=Ge.Disconnecting,this._logger.log(Ve.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(Ve.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 Error("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 s;const i=new It;return i.cancelCallback=()=>{const e=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],s.then((()=>this._sendWithProtocol(e)))},this._callbacks[o.invocationId]=(e,t)=>{t?i.error(t):e&&(e.type===Ye.Completion?e.error?i.error(new Error(e.error)):i.complete():i.next(e.item))},s=this._sendWithProtocol(o).catch((e=>{i.error(e),delete this._callbacks[o.invocationId]})),this._launchStreams(n,s),i}_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===Ye.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 Ye.Invocation:this._invokeClientMethod(e);break;case Ye.StreamItem:case Ye.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===Ye.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(Ve.Error,`Stream callback threw error: ${ht(e)}`)}}break}case Ye.Ping:break;case Ye.Close:{this._logger.log(Ve.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(Ve.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(Ve.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(Ve.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(Ve.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===Ge.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."))}_invokeClientMethod(e){const t=this._methods[e.target.toLowerCase()];if(t){try{t.forEach((t=>t.apply(this,e.arguments)))}catch(t){this._logger.log(Ve.Error,`A callback for the method ${e.target.toLowerCase()} threw error '${t}'.`)}if(e.invocationId){const e="Server requested a response, which is not supported in this version of the client.";this._logger.log(Ve.Error,e),this._stopPromise=this._stopInternal(new Error(e))}}else this._logger.log(Ve.Warning,`No client method with the name '${e.target}' found.`)}_connectionClosed(e){this._logger.log(Ve.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new Error("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===Ge.Disconnecting?this._completeClose(e):this._connectionState===Ge.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===Ge.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=Ge.Disconnected,this._connectionStarted=!1,et.isBrowser&&document&&document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Ve.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(Ve.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=Ge.Reconnecting,e?this._logger.log(Ve.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(Ve.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Ve.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==Ge.Reconnecting)return void this._logger.log(Ve.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==o;){if(this._logger.log(Ve.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!==Ge.Reconnecting)return void this._logger.log(Ve.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=Ge.Connected,this._logger.log(Ve.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(Ve.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(Ve.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==Ge.Reconnecting)return this._logger.log(Ve.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===Ge.Disconnecting&&this._completeClose());r=e instanceof Error?e:new Error(e.toString()),o=this._getNextRetryDelay(n++,Date.now()-t,r)}}this._logger.log(Ve.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(Ve.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(Ve.Error,`Stream 'error' callback called with '${e}' threw error: ${ht(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:Ye.Invocation}:{arguments:t,target:e,type:Ye.Invocation};{const n=this._invocationId;return this._invocationId++,0!==r.length?{arguments:t,invocationId:n.toString(),streamIds:r,target:e,type:Ye.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:Ye.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,s.push(h>>>10&1023|55296),h=56320|1023&h),s.push(h)}else s.push(a);s.length>=4096&&(i+=String.fromCharCode.apply(String,s),s.length=0)}return s.length>0&&(i+=String.fromCharCode.apply(String,s)),i}var Ot,Ft=At?new TextDecoder:null,Ht=At?"undefined"!=typeof process&&"force"!==process.env.TEXT_DECODER?200:0:Rt,jt=function(e,t){this.type=e,this.data=t},Wt=(Ot=function(e,t){return(Ot=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])})(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}Ot(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),zt=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 Wt(t,e),t}(Error),Jt={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 s=n/4294967296,i=4294967295&n;return o=new Uint8Array(8),(t=new DataView(o.buffer)).setUint32(0,r<<2|3&s),t.setUint32(4,i),o}return o=new Uint8Array(12),(t=new DataView(o.buffer)).setUint32(0,r),Pt(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:Ut(t,4),nsec:t.getUint32(0)};default:throw new zt("Unrecognized data size for timestamp (expected 4, 8, or 12): "+e.length)}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},qt=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Jt)}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 "+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: "+e+" bytes in UTF-8");this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>Bt){var t=Nt(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),Lt(e,this.bytes,this.pos),this.pos+=t}else t=Nt(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var r=e.length,o=n,s=0;s>6&31|192;else{if(i>=55296&&i<=56319&&s>12&15|224,t[o++]=i>>6&63|128):(t[o++]=i>>18&7|240,t[o++]=i>>12&63|128,t[o++]=i>>6&63|128)}t[o++]=63&i|128}else t[o++]=i}}(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: "+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: "+t);this.writeU8(198),this.writeU32(t)}var n=Vt(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: "+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=Mt(e,t,n),s=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(s,o),o},e}(),Gt=function(e,t){var n,r,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]1||a(e,t)}))})}function a(e,t){try{(n=o[e](t)).value instanceof Zt?Promise.resolve(n.value.v).then(c,l):h(s[0][2],n)}catch(e){h(s[0][3],e)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},tn=new DataView(new ArrayBuffer(0)),nn=new Uint8Array(tn.buffer),rn=function(){try{tn.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),on=new rn("Insufficient data"),sn=new Yt,an=function(){function e(e,t,n,r,o,s,i,a){void 0===e&&(e=qt.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=Rt),void 0===r&&(r=Rt),void 0===o&&(o=Rt),void 0===s&&(s=Rt),void 0===i&&(i=Rt),void 0===a&&(a=sn),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=r,this.maxArrayLength=o,this.maxMapLength=s,this.maxExtLength=i,this.keyDecoder=a,this.totalPos=0,this.pos=0,this.view=tn,this.bytes=nn,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=Vt(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=Vt(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=Vt(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 "+(t.byteLength-n)+" of "+t.byteLength+" byte(s) found at buffer["+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 Gt(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,s,i,a;return s=this,void 0,a=function(){var s,i,a,c,l,h,u,d;return Gt(this,(function(p){switch(p.label){case 0:s=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=Qt(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,s)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{i=this.doDecodeSync(),s=!0}catch(e){if(!(e instanceof rn))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(s){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,i]}throw h=(l=this).headByte,u=l.pos,d=l.totalPos,new RangeError("Insufficient data in parsing "+Xt(h)+" at "+d+" ("+u+" in the current buffer)")}}))},new((i=void 0)||(i=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 i?o:new i((function(e){e(o)}))).then(n,r)}o((a=a.apply(s,[])).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 en(this,arguments,(function(){var n,r,o,s,i,a,c,l,h;return Gt(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=Qt(e),u.label=2;case 2:return[4,Zt(o.next())];case 3:if((s=u.sent()).done)return[3,12];if(i=s.value,t&&0===r)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),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,Zt(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 rn))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]),s&&!s.done&&(h=o.return)?[4,Zt(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 zt("Unrecognized type byte: "+Xt(e));r=this.lookU32(),t=this.decodeExtension(r,4)}this.complete();for(var o=this.stack;o.length>0;){var s=o[o.length-1];if(0===s.type){if(s.array[s.position]=t,s.position++,s.position!==s.size)continue e;o.pop(),t=s.array}else{if(1===s.type){if("string"!=(i=typeof t)&&"number"!==i)throw new zt("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new zt("The key __proto__ is not allowed");s.key=t,s.type=2;continue e}if(s.map[s.key]=t,s.readCount++,s.readCount!==s.size){s.key=null,s.type=1;continue e}o.pop(),t=s.map}}return t}var i},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 zt("Unrecognized array type byte: "+Xt(e))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new zt("Max length exceeded: map length ("+e+") > maxMapLengthLength ("+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 zt("Max length exceeded: array length ("+e+") > maxArrayLength ("+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 zt("Max length exceeded: UTF-8 byte length ("+e+") > maxStrLength ("+this.maxStrLength+")");if(this.bytes.byteLengthHt?function(e,t,n){var r=e.subarray(t,t+n);return Ft.decode(r)}(this.bytes,o,e):Mt(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 zt("Max length exceeded: bin length ("+e+") > maxBinLength ("+this.maxBinLength+")");if(!this.hasRemaining(e+t))throw on;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 zt("Max length exceeded: ext length ("+e+") > maxExtLength ("+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=Ut(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 cn{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+i+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+i,o+i+a):n.subarray(o+i,o+i+a)),o=o+i+a}return t}}const ln=new Uint8Array([145,Ye.Ping]);class hn{constructor(e){this.name="messagepack",this.version=1,this.transferFormat=Xe.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new Kt(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new an(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=Qe.instance);const r=cn.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 Ye.Invocation:return this._writeInvocation(e);case Ye.StreamInvocation:return this._writeStreamInvocation(e);case Ye.StreamItem:return this._writeStreamItem(e);case Ye.Completion:return this._writeCompletion(e);case Ye.Ping:return cn.write(ln);case Ye.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 Ye.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case Ye.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case Ye.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case Ye.Ping:return this._createPingMessage(n);case Ye.Close:return this._createCloseMessage(n);default:return t.log(Ve.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:Ye.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:Ye.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:Ye.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:Ye.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:Ye.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:Ye.Completion}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([Ye.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([Ye.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),cn.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([Ye.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([Ye.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),cn.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([Ye.StreamItem,e.headers||{},e.invocationId,e.item]);return cn.write(t.slice())}_writeCompletion(e){const t=e.error?this._errorResult:e.result?this._nonVoidResult:this._voidResult;let n;switch(t){case this._errorResult:n=this._encoder.encode([Ye.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([Ye.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([Ye.Completion,e.headers||{},e.invocationId,t,e.result])}return cn.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([Ye.CancelInvocation,e.headers||{},e.invocationId]);return cn.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}let un=!1;async function dn(){let e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),un||(un=!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 pn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,fn=pn?pn.decode.bind(pn):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("")},gn=Math.pow(2,32),mn=Math.pow(2,21)-1;function yn(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function wn(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function vn(e,t){const n=wn(e,t+4);if(n>mn)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*gn+wn(e,t)}class bn{constructor(e){this.batchData=e;const t=new Cn(e);this.arrayRangeReader=new In(e),this.arrayBuilderSegmentReader=new kn(e),this.diffReader=new _n(e),this.editReader=new En(e,t),this.frameReader=new Sn(e,t)}updatedComponents(){return yn(this.batchData,this.batchData.length-20)}referenceFrames(){return yn(this.batchData,this.batchData.length-16)}disposedComponentIds(){return yn(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return yn(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return yn(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return yn(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return vn(this.batchData,n)}}class _n{constructor(e){this.batchDataUint8=e}componentId(e){return yn(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class En{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return yn(this.batchDataUint8,e)}siblingIndex(e){return yn(this.batchDataUint8,e+4)}newTreeIndex(e){return yn(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return yn(this.batchDataUint8,e+8)}removedAttributeName(e){const t=yn(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class Sn{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return yn(this.batchDataUint8,e)}subtreeLength(e){return yn(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=yn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return yn(this.batchDataUint8,e+8)}elementName(e){const t=yn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=yn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=yn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=yn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=yn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return vn(this.batchDataUint8,e+12)}}class Cn{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=yn(e,e.length-4)}readString(e){if(-1===e)return null;{const n=yn(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const s=e[t+o];if(n|=(127&s)<this.nextBatchId)return this.fatalError?(this.logger.log(Tn.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(Tn.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(Tn.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(),s=r.values(o),i=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()}] ${Tn[e]}: ${t}`;switch(e){case Tn.Critical:case Tn.Error:console.error(n);break;case Tn.Warning:console.warn(n);break;case Tn.Information:console.info(n);break;default:console.log(n)}}}}class Pn{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!==Ge.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!==Ge.Connected)return!1;const t=await e.invoke("StartCircuit",ye.getBaseURI(),ye.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[B]=r,t&&(e[L]=t,M(t)),M(e)}(this.components[n].start,this.components[n].end);throw new Error(`Invalid sequence number or identifier '${e}'.`)}}const Un={configureSignalR:e=>{},logLevel:Tn.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class An{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 Ne.reconnect()||this.rejected()}catch(e){this.logger.log(Tn.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 Nn{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const r=this.document.getElementById(Nn.MaxRetriesId);r&&(r.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(Nn.ShowClassName)}update(e){const t=this.document.getElementById(Nn.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Nn.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Nn.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Nn.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Nn.ShowClassName,Nn.HideClassName,Nn.FailedClassName,Nn.RejectedClassName)}}Nn.ShowClassName="components-reconnect-show",Nn.HideClassName="components-reconnect-hide",Nn.FailedClassName="components-reconnect-failed",Nn.RejectedClassName="components-reconnect-rejected",Nn.MaxRetriesId="components-reconnect-max-retries",Nn.CurrentAttemptId="components-reconnect-current-attempt";class $n{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||Ne.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new Nn(t,e.maxRetries,document):new An(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new Bn(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class Bn{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;tBn.MaximumFirstRetryInterval?Bn.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(Tn.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise((t=>setTimeout(t,e)))}}Bn.MaximumFirstRetryInterval=3e3;const Ln=/^\s*Blazor-Component-State:(?[a-zA-Z0-9\+\/=]+)$/;function Mn(e){var t;if(e.nodeType===Node.COMMENT_NODE){const n=e.textContent||"",r=Ln.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 Hn(e,t){const n=e.currentElement;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const r=Fn.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:s,parameterDefinitions:i,parameterValues:a,prerenderId:c}=e;if("webassembly"===r){if(!o)throw new Error("assembly must be defined when using a descriptor.");if(!s)throw new Error("typeName must be defined when using a descriptor.");if(c){const e=jn(c,n);if(!e)throw new Error(`Could not find an end component comment for '${t}'`);return{type:r,assembly:o,typeName:s,parameterDefinitions:i&&atob(i),parameterValues:a&&atob(a),start:t,prerenderId:c,end:e}}return{type:r,assembly:o,typeName:s,parameterDefinitions:i&&atob(i),parameterValues:a&&atob(a),start:t}}}(r,n,e);case"server":return function(e,t,n){const{type:r,descriptor:o,sequence:s,prerenderId:i}=e;if("server"===r){if(!o)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===s)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(s))throw new Error(`Error parsing the sequence '${s}' for component '${JSON.stringify(e)}'`);if(i){const e=jn(i,n);if(!e)throw new Error(`Could not find an end component comment for '${t}'`);return{type:r,sequence:s,descriptor:o,start:t,prerenderId:i,end:e}}return{type:r,sequence:s,descriptor:o,start:t}}}(r,n,e)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}function jn(e,t){for(;t.next()&&t.currentElement;){const n=t.currentElement;if(n.nodeType!==Node.COMMENT_NODE)continue;if(!n.textContent)continue;const r=Fn.exec(n.textContent),o=r&&r[1];if(o)return Wn(o,e),n}}function Wn(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 zn{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:s,afterStarted:i}=o;return i&&e.afterStartedCallbacks.push(i),s?s(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await C,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let Kn=!1,Xn=!1;async function Yn(e){if(Xn)throw new Error("Blazor has already started.");Xn=!0;const t=function(e){const t={...Un,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...Un.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 Vn;return await r.importInitializersAsync(n,[e]),r}(t),r=new Rn(t.logLevel);Ne.reconnect=async e=>{if(Kn)return!1;const n=e||await Gn(t,r,i);return await i.reconnect(n)?(t.reconnectionHandler.onConnectionUp(),!0):(r.log(Tn.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)},Ne.defaultReconnectionHandler=new $n(r),t.reconnectionHandler=t.reconnectionHandler||Ne.defaultReconnectionHandler,r.log(Tn.Information,"Starting up Blazor server-side application.");const o=function(e,t){return function(e){const t=On(e,"server"),n=[];for(let e=0;ee.sequence-t.sequence))}(e)}(document),s=Mn(document),i=new Pn(o,s||""),a=await Gn(t,r,i);if(!await i.startCircuit(a))return void r.log(Tn.Error,"Failed to start the circuit.");let c=!1;const l=()=>{if(!c){const e=new FormData,t=i.circuitId;e.append("circuitId",t),c=navigator.sendBeacon("_blazor/disconnect",e)}};Ne.disconnect=l,window.addEventListener("unload",l,{capture:!1,once:!0}),r.log(Tn.Information,"Blazor server-side application started."),n.invokeAfterStartedCallbacks(Ne)}async function Gn(t,n,r){var o,s;const i=new hn;i.name="blazorpack";const a=(new Dt).withUrl("_blazor").withHubProtocol(i);t.configureSignalR(a);const c=a.build();Ne._internal.navigationManager.listenForNavigationEvents(((e,t)=>c.send("OnLocationChanged",e,t))),c.on("JS.AttachComponent",((e,t)=>function(e,t,n,r){let o=de[0];o||(o=de[0]=new ie(0)),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=xn.getOrCreate(n);c.on("JS.RenderBatch",((e,t)=>{n.log(Tn.Debug,`Received render batch with id ${e} and ${t.byteLength} bytes.`),l.processBatch(e,t,c)})),c.onclose((e=>!Kn&&t.reconnectionHandler.onConnectionDown(t.reconnectionOptions,e))),c.on("JS.Error",(e=>{Kn=!0,Qn(c,e,n),dn()})),Ne._internal.forceCloseConnection=()=>c.stop(),Ne._internal.sendJSDataStream=(e,t,n)=>function(e,t,n,r){setTimeout((async()=>{let o=5,s=(new Date).valueOf();try{const i=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-s;s=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)}(c,e,t,n);try{await c.start()}catch(e){if(Qn(c,e,n),"FailedToNegotiateWithServerError"===e.errorType)throw e;dn(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===Ke.WebSockets))?n.log(Tn.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===Ke.WebSockets))?n.log(Tn.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===Ke.LongPolling))&&n.log(Tn.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===(s=null===(o=c.connection)||void 0===o?void 0:o.features)||void 0===s?void 0:s.inherentKeepAlive)&&n.log(Tn.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 Qn(e,t,n){n.log(Tn.Error,t),e&&e.stop()}Ne.start=Yn,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&Yn()})(); \ No newline at end of file diff --git a/src/Components/Web.JS/dist/Release/blazor.webview.js b/src/Components/Web.JS/dist/Release/blazor.webview.js index 14698f04ba8d..2dd0142e490c 100644 --- a/src/Components/Web.JS/dist/Release/blazor.webview.js +++ b/src/Components/Web.JS/dist/Release/blazor.webview.js @@ -1 +1 @@ -(()=>{"use strict";var e,t,n;!function(e){window.DotNet=e;const t=[],n=new Map,r=new Map,o="__jsObjectId",a="__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 i={},c={0:new s(window)};c[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=document.baseURI+e.substr(2)),import(e))));let l,u=1,d=1,f=null;function h(e){t.push(e)}function m(e){if(e&&"object"==typeof e){c[d]=new s(e);const t={[o]:d};return d++,t}throw new Error(`Cannot create a JSObjectReference from the value '${e}'.`)}function p(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=m(e);n.__jsObjectId=t.__jsObjectId}catch{throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return n}function b(e){return e?JSON.parse(e,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null}function v(e,t,n,r){const o=y();if(o.invokeDotNetFromJS){const a=T(r),s=o.invokeDotNetFromJS(e,t,n,a);return s?b(s):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeMethodAsync instead.")}function g(e,t,n,r){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const o=u++,a=new Promise(((e,t)=>{i[o]={resolve:e,reject:t}}));try{const a=T(r);y().beginInvokeDotNetFromJS(o,e,t,n,a)}catch(e){w(o,!1,e)}return a}function y(){if(null!==f)return f;throw new Error("No .NET call dispatcher has been set.")}function w(e,t,n){if(!i.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const r=i[e];delete i[e],t?r.resolve(n):r.reject(n)}function E(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function S(e,t){let 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 I(e){delete c[e]}e.attachDispatcher=function(e){f=e},e.attachReviver=h,e.invokeMethod=function(e,t,...n){return v(e,t,null,n)},e.invokeMethodAsync=function(e,t,...n){return g(e,t,null,n)},e.createJSObjectReference=m,e.createJSStreamReference=p,e.disposeJSObjectReference=function(e){const t=e&&e.__jsObjectId;"number"==typeof t&&I(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:S,disposeJSObjectReferenceById:I,invokeJSFromDotNet:(e,t,n,r)=>{const o=k(S(e,r).apply(null,b(t)),n);return null==o?null:T(o)},beginInvokeJSFromDotNet:(e,t,n,r,o)=>{const a=new Promise((e=>{e(S(t,o).apply(null,b(n)))}));e&&a.then((t=>y().endInvokeJSFromDotNet(e,!0,T([e,!0,k(t,r)]))),(t=>y().endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,E(t)]))))},endInvokeDotNetFromJS:(e,t,n)=>{const r=t?b(n):new Error(n);w(parseInt(e),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 A;n.resolve(t),r.set(e,n)}}};class C{constructor(e){this._id=e}invokeMethod(e,...t){return v(null,e,this._id,t)}invokeMethodAsync(e,...t){return g(null,e,this._id,t)}dispose(){g(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{__dotNetObject:this._id}}}e.DotNetObject=C,h((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(a)){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 D(t.__dotNetStream)}return t}));class D{constructor(e){var t;if(r.has(e))this._streamPromise=null===(t=r.get(e))||void 0===t?void 0:t.streamPromise,r.delete(e);else{const t=new A;r.set(e,t),this._streamPromise=t.streamPromise}}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class A{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function k(e,t){switch(t){case l.Default:return e;case l.JSObjectReference:return m(e);case l.JSStreamReference:return p(e);case l.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let R=0;function T(e){return R=0,JSON.stringify(e,N)}function N(e,t){if(t instanceof C)return t.serializeAsArg();if(t instanceof Uint8Array){f.sendByteArray(R,t);const e={[a]:R};return R++,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 r{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 r(e,t.value)}return null}}const o=new Map,a=new Map,s={createEventArgs:()=>({})},i=[];function c(e){return o.get(e)}function l(e){const t=o.get(e);return(null==t?void 0:t.browserEventName)||e}function u(e,t){e.forEach((e=>o.set(e,t)))}function d(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}return{value:function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t)?!!t.checked:t.value}}}),u(["copy","cut","paste"],s),u(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...f(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}}),u(["focus","blur","focusin","focusout"],s),u(["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};var t}}),u(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","dblclick"],{createEventArgs:e=>f(e)}),u(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno};var t}}),u(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total};var t}}),u(["touchcancel","touchend","touchmove","touchenter","touchleave","touchstart"],{createEventArgs:e=>{return{detail:(t=e).detail,touches:d(t.touches),targetTouches:d(t.targetTouches),changedTouches:d(t.changedTouches),ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),u(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...f(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}}),u(["wheel","mousewheel"],{createEventArgs:e=>{return{...f(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),u(["toggle"],s);const h=["date","datetime-local","month","time","week"],m=new Map;let p,b,v=0;const g={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const r="__bl-dynamic-root:"+(++v).toString();m.set(r,e);const o=await E().invokeMethodAsync("AddRootComponent",t,r),a=new w(o,b[t]);return await a.setParameters(n),a}};class y{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 w{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 y)}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 E().invokeMethodAsync("SetRootComponentParameters",this._componentId,r,t)}async dispose(){if(null!==this._componentId){await E().invokeMethodAsync("RemoveRootComponent",this._componentId),this._componentId=null;for(const e of this._jsEventCallbackWrappers.values())e.dispose()}}}function E(){if(!p)throw new Error("Dynamic root components have not been enabled in this application.");return p}const S=new Map;let I;const C=new Promise((e=>{I=e}));function D(e,t,n){return k(e,t.eventHandlerId,(()=>A(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function A(e){const t=S.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let k=(e,t,n)=>n();const R=x(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),T={submit:!0},N=x(["click","dblclick","mousedown","mousemove","mouseup"]);class _{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++_.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new O(this.onGlobalEvent.bind(this))}setListener(e,t,n,r){const o=this.getEventHandlerInfosForElement(e,!0),a=o.getHandler(t);if(a)this.eventInfoStore.update(a.eventHandlerId,n);else{const a={element:e,eventName:t,eventHandlerId:n,renderingComponentId:r};this.eventInfoStore.add(a),o.setHandler(t,a)}}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,a.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 o=n.shift(),a=null,s=!1;const i=R.hasOwnProperty(e);let l=!1;for(;o;){const f=o,h=this.getEventHandlerInfosForElement(f,!1);if(h){const n=h.getHandler(e);if(n&&(u=f,d=t.type,!((u instanceof HTMLButtonElement||u instanceof HTMLInputElement||u instanceof HTMLTextAreaElement||u instanceof HTMLSelectElement)&&N.hasOwnProperty(d)&&u.disabled))){if(!s){const n=c(e);a=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},s=!0}T.hasOwnProperty(t.type)&&t.preventDefault(),D(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:r.fromEvent(n.renderingComponentId,t)},a)}h.stopPropagation(e)&&(l=!0),h.preventDefault(e)&&t.preventDefault()}o=i||l?void 0:n.shift()}var u,d}getEventHandlerInfosForElement(e,t){return e.hasOwnProperty(this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new F:null}}_.nextEventDelegatorId=0;class O{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},i.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),this.countByEventName.hasOwnProperty(e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=R.hasOwnProperty(e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(this.infosByEventHandlerId.hasOwnProperty(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(this.countByEventName.hasOwnProperty(e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class F{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return this.handlers.hasOwnProperty(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 x(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const L=q("_blazorLogicalChildren"),P=q("_blazorLogicalParent"),j=q("_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 H(e,t){const n=document.createComment("!");return B(n,e,t),n}function B(e,t,n){const r=e;if(e instanceof Comment&&K(r)&&K(r).length>0)throw new Error("Not implemented: inserting non-empty logical container");if(J(r))throw new Error("Not implemented: moving existing logical children");const o=K(t);if(n0;)U(n,0)}const r=n;r.parentNode.removeChild(r)}function J(e){return e[P]||null}function $(e,t){return K(e)[t]}function z(e){var t=W(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function K(e){return e[L]}function V(e,t){const n=K(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=G(e.moveRangeStart)})),t.forEach((t=>{const r=t.moveToBeforeMarker=document.createComment("marker"),o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):Y(r,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd;let a=r;for(;a;){const e=a.nextSibling;if(n.insertBefore(a,t),a===o)break;a=e}n.removeChild(t)})),t.forEach((e=>{n[e.toSiblingIndex]=e.moveRangeStart}))}function W(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 X(e){const t=K(J(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function Y(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=X(t);n?n.parentNode.insertBefore(e,n):Y(e,J(t))}}}function G(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=X(e);if(t)return t.previousSibling;{const t=J(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:G(t)}}function q(e){return"function"==typeof Symbol?Symbol():e}function Z(e){return`_bl_${e}`}e.attachReviver(((e,t)=>t&&"object"==typeof t&&t.hasOwnProperty("__internalId")&&"string"==typeof t.__internalId?function(e){const t=`[${Z(e)}]`;return document.querySelector(t)}(t.__internalId):t));const Q="_blazorDeferredValue",ee=document.createElement("template"),te=document.createElementNS("http://www.w3.org/2000/svg","g"),ne={},re="__internal_",oe="preventDefault_",ae="stopPropagation_";class se{constructor(e){this.rootComponentIds=new Set,this.childComponentLocations={},this.eventDelegator=new _(e),this.eventDelegator.notifyAfterClick((e=>{if(!me)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;ewe(!1))))},enableNavigationInterception:function(){me=!0},navigateTo:ge,getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href};function ge(e,t,n=!1){const r=Se(e),o=t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n};!o.forceLoad&&Ce(r)?ye(r,!1,o.replaceHistoryEntry):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,o.replaceHistoryEntry)}function ye(e,t,n){he=!0,n?history.replaceState(null,"",e):history.pushState(null,"",e),we(t)}async function we(e){be&&await be(location.href,e)}let Ee;function Se(e){return Ee=Ee||document.createElement("a"),Ee.href=e,Ee.href}function Ie(e,t){return e?e.tagName===t?e:Ie(e.parentElement,t):null}function Ce(e){const t=(n=document.baseURI).substr(0,n.lastIndexOf("/")+1);var n;return e.startsWith(t)}const De={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())}},Ae={init:function(e,t,n,r=50){const o=Re(t);(o||document.documentElement).style.overflowAnchor="none";const a=document.createRange();u(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;a.setStartAfter(t),a.setEndBefore(n);const s=a.getBoundingClientRect().height,i=null===(o=r.rootBounds)||void 0===o?void 0:o.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,s,i):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,s,i)}))}),{root:o,rootMargin:`${r}px`});s.observe(t),s.observe(n);const i=l(t),c=l(n);function l(e){const t={attributes:!0},n=new MutationObserver(((n,r)=>{u(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 u(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)}ke[e._id]={intersectionObserver:s,mutationObserverBefore:i,mutationObserverAfter:c}},dispose:function(e){const t=ke[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete ke[e._id])}},ke={};function Re(e){return e?"visible"!==getComputedStyle(e).overflowY?e:Re(e.parentElement):null}const Te={getAndRemoveExistingTitle:function(){var e;const t=document.getElementsByTagName("title");if(0===t.length)return null;let n=null;for(let r=t.length-1;r>=0;r--){const o=t[r],a=o.previousSibling;a instanceof Comment&&null!==J(a)||(null===n&&(n=o.textContent),null===(e=o.parentNode)||void 0===e||e.removeChild(o))}return n}},Ne={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 a=_e(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(a.blob)})),i=await new Promise((function(e){var t;const a=Math.min(1,r/s.width),i=Math.min(1,o/s.height),c=Math.min(a,i),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:a.lastModified,name:a.name,size:(null==i?void 0:i.size)||0,contentType:n,blob:i||a.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return _e(e,t).blob}};function _e(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.`);return n}const Oe=new Map,Fe={navigateTo:ge,registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(o.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=a.get(t.browserEventName);n?n.push(e):a.set(t.browserEventName,[e]),i.forEach((n=>n(e,t.browserEventName)))}o.set(e,t)},rootComponents:g,_internal:{navigationManager:ve,domWrapper:De,Virtualize:Ae,PageTitle:Te,InputFile:Ne,getJSDataStreamChunk:async function(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)},receiveDotNetDataStream:function(t,n,r,o){let a=Oe.get(t);if(!a){const n=new ReadableStream({start(e){Oe.set(t,e),a=e}});e.jsCallDispatcher.supplyDotNetStream(t,n)}o?(a.error(o),Oe.delete(t)):0===r?(a.close(),Oe.delete(t)):a.enqueue(n.length===r?n:n.subarray(0,r))},attachWebRendererInterop:function(t,n,r,o){if(S.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);S.set(t,n),Object.keys(r).length>0&&function(t,n,r){if(p)throw new Error("Dynamic root components have already been enabled.");p=t,b=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])}}(A(t),r,o),I()}}};window.Blazor=Fe;let xe=!1;const Le="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Pe=Le?Le.decode.bind(Le):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("")},je=Math.pow(2,32),Me=Math.pow(2,21)-1;function He(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Be(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function Ue(e,t){const n=Be(e,t+4);if(n>Me)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*je+Be(e,t)}class Je{constructor(e){this.batchData=e;const t=new Ve(e);this.arrayRangeReader=new We(e),this.arrayBuilderSegmentReader=new Xe(e),this.diffReader=new $e(e),this.editReader=new ze(e,t),this.frameReader=new Ke(e,t)}updatedComponents(){return He(this.batchData,this.batchData.length-20)}referenceFrames(){return He(this.batchData,this.batchData.length-16)}disposedComponentIds(){return He(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return He(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return He(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return He(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return Ue(this.batchData,n)}}class $e{constructor(e){this.batchDataUint8=e}componentId(e){return He(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class ze{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return He(this.batchDataUint8,e)}siblingIndex(e){return He(this.batchDataUint8,e+4)}newTreeIndex(e){return He(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return He(this.batchDataUint8,e+8)}removedAttributeName(e){const t=He(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class Ke{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return He(this.batchDataUint8,e)}subtreeLength(e){return He(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=He(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return He(this.batchDataUint8,e+8)}elementName(e){const t=He(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=He(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=He(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=He(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=He(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return Ue(this.batchDataUint8,e+12)}}class Ve{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=He(e,e.length-4)}readString(e){if(-1===e)return null;{const n=He(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const a=e[t+o];if(n|=(127&a)<async 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:a,afterStarted:s}=o;return s&&e.afterStartedCallbacks.push(s),a?a(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await C,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let st=!1;async function it(){if(st)throw new Error("Blazor has already started.");st=!0;const t=await async function(){const e=await fetch("_framework/blazor.modules.json",{method:"GET",credentials:"include",cache:"no-cache"}),t=await e.json(),n=new at;return await n.importInitializersAsync(t,[]),n}();(function(){const t={AttachToDocument:(e,t)=>{!function(e,t,n){const r="::after";let o=!1;if(e.endsWith(r))e=e.slice(0,-r.length),o=!0;else if(e.endsWith("::before"))throw new Error("The '::before' selector is not supported.");const a=function(e){const t=m.get(e);if(t)return m.delete(e),t}(e)||document.querySelector(e);if(!a)throw new Error(`Could not find any element matching selector '${e}'.`);!function(e,t,n,r){let o=fe[0];o||(o=fe[0]=new se(0)),o.attachRootComponentToLogicalElement(n,t,r)}(0,M(a,!0),t,o)}(t,e)},RenderBatch:(e,t)=>{try{const n=ot(t);(function(e,t){const n=fe[0];if(!n)throw new Error("There is no browser renderer with ID 0.");const r=t.arrayRangeReader,o=t.updatedComponents(),a=r.values(o),s=r.count(o),i=t.referenceFrames(),c=r.values(i),l=t.diffReader;for(let e=0;e{Ge=!0,console.error(`${e}\n${t}`),async function(){let e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),xe||(xe=!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()}})))}()},BeginInvokeJS:e.jsCallDispatcher.beginInvokeJSFromDotNet,EndInvokeDotNet:e.jsCallDispatcher.endInvokeDotNetFromJS,SendByteArrayToJS:rt,Navigate:ve.navigateTo};window.external.receiveMessage((e=>{const n=function(e){if(Ge||!e||!e.startsWith(Ye))return null;const t=e.substring(Ye.length),[n,...r]=JSON.parse(t);return{messageType:n,args:r}}(e);if(n){if(!t.hasOwnProperty(n.messageType))throw new Error(`Unsupported IPC message type '${n.messageType}'`);t[n.messageType].apply(null,n.args)}}))})(),e.attachDispatcher({beginInvokeDotNetFromJS:Ze,endInvokeJSFromDotNet:Qe,sendByteArray:et}),ve.enableNavigationInterception(),ve.listenForNavigationEvents(tt),nt("AttachPage",ve.getBaseURI(),ve.getLocationHref()),await t.invokeAfterStartedCallbacks(Fe)}Fe.start=it,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&it()})(); \ No newline at end of file +(()=>{"use strict";var e,t,n;!function(e){window.DotNet=e;const t=[],n=new Map,r=new Map,o="__jsObjectId",a="__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 i={},c={0:new s(window)};c[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=document.baseURI+e.substr(2)),import(e))));let l,u=1,d=1,f=null;function h(e){t.push(e)}function p(e){if(e&&"object"==typeof e){c[d]=new s(e);const t={[o]:d};return d++,t}throw new Error(`Cannot create a JSObjectReference from the value '${e}'.`)}function m(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=p(e);n.__jsObjectId=t.__jsObjectId}catch{throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return n}function b(e){return e?JSON.parse(e,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null}function v(e,t,n,r){const o=y();if(o.invokeDotNetFromJS){const a=T(r),s=o.invokeDotNetFromJS(e,t,n,a);return s?b(s):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeMethodAsync instead.")}function g(e,t,n,r){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const o=u++,a=new Promise(((e,t)=>{i[o]={resolve:e,reject:t}}));try{const a=T(r);y().beginInvokeDotNetFromJS(o,e,t,n,a)}catch(e){w(o,!1,e)}return a}function y(){if(null!==f)return f;throw new Error("No .NET call dispatcher has been set.")}function w(e,t,n){if(!i.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const r=i[e];delete i[e],t?r.resolve(n):r.reject(n)}function E(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function S(e,t){let 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 I(e){delete c[e]}e.attachDispatcher=function(e){f=e},e.attachReviver=h,e.invokeMethod=function(e,t,...n){return v(e,t,null,n)},e.invokeMethodAsync=function(e,t,...n){return g(e,t,null,n)},e.createJSObjectReference=p,e.createJSStreamReference=m,e.disposeJSObjectReference=function(e){const t=e&&e.__jsObjectId;"number"==typeof t&&I(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:S,disposeJSObjectReferenceById:I,invokeJSFromDotNet:(e,t,n,r)=>{const o=k(S(e,r).apply(null,b(t)),n);return null==o?null:T(o)},beginInvokeJSFromDotNet:(e,t,n,r,o)=>{const a=new Promise((e=>{e(S(t,o).apply(null,b(n)))}));e&&a.then((t=>y().endInvokeJSFromDotNet(e,!0,T([e,!0,k(t,r)]))),(t=>y().endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,E(t)]))))},endInvokeDotNetFromJS:(e,t,n)=>{const r=t?b(n):new Error(n);w(parseInt(e),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 A;n.resolve(t),r.set(e,n)}}};class C{constructor(e){this._id=e}invokeMethod(e,...t){return v(null,e,this._id,t)}invokeMethodAsync(e,...t){return g(null,e,this._id,t)}dispose(){g(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{__dotNetObject:this._id}}}e.DotNetObject=C,h((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(a)){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 D(t.__dotNetStream)}return t}));class D{constructor(e){var t;if(r.has(e))this._streamPromise=null===(t=r.get(e))||void 0===t?void 0:t.streamPromise,r.delete(e);else{const t=new A;r.set(e,t),this._streamPromise=t.streamPromise}}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class A{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function k(e,t){switch(t){case l.Default:return e;case l.JSObjectReference:return p(e);case l.JSStreamReference:return m(e);case l.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let R=0;function T(e){return R=0,JSON.stringify(e,N)}function N(e,t){if(t instanceof C)return t.serializeAsArg();if(t instanceof Uint8Array){f.sendByteArray(R,t);const e={[a]:R};return R++,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 r{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 r(e,t.value)}return null}}const o=new Map,a=new Map,s=[];function i(e){return o.get(e)}function c(e){const t=o.get(e);return(null==t?void 0:t.browserEventName)||e}function l(e,t){e.forEach((e=>o.set(e,t)))}function u(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}return{value:function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t)?!!t.checked:t.value}}}),l(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),l(["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}}),l(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),l(["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}}),l(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","dblclick"],{createEventArgs:e=>d(e)}),l(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno,type:t.type};var t}}),l(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total,type:t.type};var t}}),l(["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}}),l(["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}}),l(["wheel","mousewheel"],{createEventArgs:e=>{return{...d(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),l(["toggle"],{createEventArgs:()=>({})});const f=["date","datetime-local","month","time","week"],h=new Map;let p,m,b=0;const v={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const r="__bl-dynamic-root:"+(++b).toString();h.set(r,e);const o=await w().invokeMethodAsync("AddRootComponent",t,r),a=new y(o,m[t]);return await a.setParameters(n),a}};class g{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 y{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 g)}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 w().invokeMethodAsync("SetRootComponentParameters",this._componentId,r,t)}async dispose(){if(null!==this._componentId){await w().invokeMethodAsync("RemoveRootComponent",this._componentId),this._componentId=null;for(const e of this._jsEventCallbackWrappers.values())e.dispose()}}}function w(){if(!p)throw new Error("Dynamic root components have not been enabled in this application.");return p}const E=new Map;let S;const I=new Promise((e=>{S=e}));function C(e,t,n){return A(e,t.eventHandlerId,(()=>D(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function D(e){const t=E.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let A=(e,t,n)=>n();const k=F(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),R={submit:!0},T=F(["click","dblclick","mousedown","mousemove","mouseup"]);class N{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++N.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new _(this.onGlobalEvent.bind(this))}setListener(e,t,n,r){const o=this.getEventHandlerInfosForElement(e,!0),a=o.getHandler(t);if(a)this.eventInfoStore.update(a.eventHandlerId,n);else{const a={element:e,eventName:t,eventHandlerId:n,renderingComponentId:r};this.eventInfoStore.add(a),o.setHandler(t,a)}}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,a.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 o=n.shift(),a=null,s=!1;const c=k.hasOwnProperty(e);let l=!1;for(;o;){const f=o,h=this.getEventHandlerInfosForElement(f,!1);if(h){const n=h.getHandler(e);if(n&&(u=f,d=t.type,!((u instanceof HTMLButtonElement||u instanceof HTMLInputElement||u instanceof HTMLTextAreaElement||u instanceof HTMLSelectElement)&&T.hasOwnProperty(d)&&u.disabled))){if(!s){const n=i(e);a=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},s=!0}R.hasOwnProperty(t.type)&&t.preventDefault(),C(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:r.fromEvent(n.renderingComponentId,t)},a)}h.stopPropagation(e)&&(l=!0),h.preventDefault(e)&&t.preventDefault()}o=c||l?void 0:n.shift()}var u,d}getEventHandlerInfosForElement(e,t){return e.hasOwnProperty(this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new O:null}}N.nextEventDelegatorId=0;class _{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},s.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=c(e),this.countByEventName.hasOwnProperty(e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=k.hasOwnProperty(e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(this.infosByEventHandlerId.hasOwnProperty(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=c(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(this.countByEventName.hasOwnProperty(e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class O{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return this.handlers.hasOwnProperty(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 F(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const x=G("_blazorLogicalChildren"),L=G("_blazorLogicalParent"),P=G("_blazorLogicalEnd");function j(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return x in e||(e[x]=[]),e}function M(e,t){const n=document.createComment("!");return H(n,e,t),n}function H(e,t,n){const r=e;if(e instanceof Comment&&z(r)&&z(r).length>0)throw new Error("Not implemented: inserting non-empty logical container");if(U(r))throw new Error("Not implemented: moving existing logical children");const o=z(t);if(n0;)B(n,0)}const r=n;r.parentNode.removeChild(r)}function U(e){return e[L]||null}function J(e,t){return z(e)[t]}function $(e){var t=V(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function z(e){return e[x]}function K(e,t){const n=z(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=Y(e.moveRangeStart)})),t.forEach((t=>{const r=t.moveToBeforeMarker=document.createComment("marker"),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 a=r;for(;a;){const e=a.nextSibling;if(n.insertBefore(a,t),a===o)break;a=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 W(e){const t=z(U(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=W(t);n?n.parentNode.insertBefore(e,n):X(e,U(t))}}}function Y(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=W(e);if(t)return t.previousSibling;{const t=U(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&&t.hasOwnProperty("__internalId")&&"string"==typeof t.__internalId?function(e){const t=`[${q(e)}]`;return document.querySelector(t)}(t.__internalId):t));const Z="_blazorDeferredValue",Q=document.createElement("template"),ee=document.createElementNS("http://www.w3.org/2000/svg","g"),te={},ne="__internal_",re="preventDefault_",oe="stopPropagation_";class ae{constructor(e){this.rootComponentIds=new Set,this.childComponentLocations={},this.eventDelegator=new N(e),this.eventDelegator.notifyAfterClick((e=>{if(!he)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;eye(!1))))},enableNavigationInterception:function(){he=!0},navigateTo:ve,getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href};function ve(e,t,n=!1){const r=Ee(e),o=t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n};!o.forceLoad&&Ie(r)?ge(r,!1,o.replaceHistoryEntry):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,o.replaceHistoryEntry)}function ge(e,t,n){fe=!0,n?history.replaceState(null,"",e):history.pushState(null,"",e),ye(t)}async function ye(e){me&&await me(location.href,e)}let we;function Ee(e){return we=we||document.createElement("a"),we.href=e,we.href}function Se(e,t){return e?e.tagName===t?e:Se(e.parentElement,t):null}function Ie(e){const t=(n=document.baseURI).substr(0,n.lastIndexOf("/")+1);var n;return e.startsWith(t)}const Ce={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())}},De={init:function(e,t,n,r=50){const o=ke(t);(o||document.documentElement).style.overflowAnchor="none";const a=document.createRange();u(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;a.setStartAfter(t),a.setEndBefore(n);const s=a.getBoundingClientRect().height,i=null===(o=r.rootBounds)||void 0===o?void 0:o.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,s,i):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,s,i)}))}),{root:o,rootMargin:`${r}px`});s.observe(t),s.observe(n);const i=l(t),c=l(n);function l(e){const t={attributes:!0},n=new MutationObserver(((n,r)=>{u(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 u(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)}Ae[e._id]={intersectionObserver:s,mutationObserverBefore:i,mutationObserverAfter:c}},dispose:function(e){const t=Ae[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete Ae[e._id])}},Ae={};function ke(e){return e?"visible"!==getComputedStyle(e).overflowY?e:ke(e.parentElement):null}const Re={getAndRemoveExistingTitle:function(){var e;const t=document.getElementsByTagName("title");if(0===t.length)return null;let n=null;for(let r=t.length-1;r>=0;r--){const o=t[r],a=o.previousSibling;a instanceof Comment&&null!==U(a)||(null===n&&(n=o.textContent),null===(e=o.parentNode)||void 0===e||e.removeChild(o))}return n}},Te={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 a=Ne(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(a.blob)})),i=await new Promise((function(e){var t;const a=Math.min(1,r/s.width),i=Math.min(1,o/s.height),c=Math.min(a,i),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:a.lastModified,name:a.name,size:(null==i?void 0:i.size)||0,contentType:n,blob:i||a.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return Ne(e,t).blob}};function Ne(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.`);return n}const _e=new Map,Oe={navigateTo:ve,registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(o.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=a.get(t.browserEventName);n?n.push(e):a.set(t.browserEventName,[e]),s.forEach((n=>n(e,t.browserEventName)))}o.set(e,t)},rootComponents:v,_internal:{navigationManager:be,domWrapper:Ce,Virtualize:De,PageTitle:Re,InputFile:Te,getJSDataStreamChunk:async function(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)},receiveDotNetDataStream:function(t,n,r,o){let a=_e.get(t);if(!a){const n=new ReadableStream({start(e){_e.set(t,e),a=e}});e.jsCallDispatcher.supplyDotNetStream(t,n)}o?(a.error(o),_e.delete(t)):0===r?(a.close(),_e.delete(t)):a.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(p)throw new Error("Dynamic root components have already been enabled.");p=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])}}(D(t),r,o),S()}}};window.Blazor=Oe;let Fe=!1;const xe="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Le=xe?xe.decode.bind(xe):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("")},Pe=Math.pow(2,32),je=Math.pow(2,21)-1;function Me(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function He(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function Be(e,t){const n=He(e,t+4);if(n>je)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Pe+He(e,t)}class Ue{constructor(e){this.batchData=e;const t=new Ke(e);this.arrayRangeReader=new Ve(e),this.arrayBuilderSegmentReader=new We(e),this.diffReader=new Je(e),this.editReader=new $e(e,t),this.frameReader=new ze(e,t)}updatedComponents(){return Me(this.batchData,this.batchData.length-20)}referenceFrames(){return Me(this.batchData,this.batchData.length-16)}disposedComponentIds(){return Me(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return Me(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return Me(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return Me(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return Be(this.batchData,n)}}class Je{constructor(e){this.batchDataUint8=e}componentId(e){return Me(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class $e{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return Me(this.batchDataUint8,e)}siblingIndex(e){return Me(this.batchDataUint8,e+4)}newTreeIndex(e){return Me(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return Me(this.batchDataUint8,e+8)}removedAttributeName(e){const t=Me(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class ze{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return Me(this.batchDataUint8,e)}subtreeLength(e){return Me(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=Me(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return Me(this.batchDataUint8,e+8)}elementName(e){const t=Me(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=Me(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=Me(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=Me(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=Me(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return Be(this.batchDataUint8,e+12)}}class Ke{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=Me(e,e.length-4)}readString(e){if(-1===e)return null;{const n=Me(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const a=e[t+o];if(n|=(127&a)<async 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:a,afterStarted:s}=o;return s&&e.afterStartedCallbacks.push(s),a?a(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await I,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let at=!1;async function st(){if(at)throw new Error("Blazor has already started.");at=!0;const t=await async function(){const e=await fetch("_framework/blazor.modules.json",{method:"GET",credentials:"include",cache:"no-cache"}),t=await e.json(),n=new ot;return await n.importInitializersAsync(t,[]),n}();(function(){const t={AttachToDocument:(e,t)=>{!function(e,t,n){const r="::after";let o=!1;if(e.endsWith(r))e=e.slice(0,-r.length),o=!0;else if(e.endsWith("::before"))throw new Error("The '::before' selector is not supported.");const a=function(e){const t=h.get(e);if(t)return h.delete(e),t}(e)||document.querySelector(e);if(!a)throw new Error(`Could not find any element matching selector '${e}'.`);!function(e,t,n,r){let o=de[0];o||(o=de[0]=new ae(0)),o.attachRootComponentToLogicalElement(n,t,r)}(0,j(a,!0),t,o)}(t,e)},RenderBatch:(e,t)=>{try{const n=rt(t);(function(e,t){const n=de[0];if(!n)throw new Error("There is no browser renderer with ID 0.");const r=t.arrayRangeReader,o=t.updatedComponents(),a=r.values(o),s=r.count(o),i=t.referenceFrames(),c=r.values(i),l=t.diffReader;for(let e=0;e{Ye=!0,console.error(`${e}\n${t}`),async function(){let e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),Fe||(Fe=!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()}})))}()},BeginInvokeJS:e.jsCallDispatcher.beginInvokeJSFromDotNet,EndInvokeDotNet:e.jsCallDispatcher.endInvokeDotNetFromJS,SendByteArrayToJS:nt,Navigate:be.navigateTo};window.external.receiveMessage((e=>{const n=function(e){if(Ye||!e||!e.startsWith(Xe))return null;const t=e.substring(Xe.length),[n,...r]=JSON.parse(t);return{messageType:n,args:r}}(e);if(n){if(!t.hasOwnProperty(n.messageType))throw new Error(`Unsupported IPC message type '${n.messageType}'`);t[n.messageType].apply(null,n.args)}}))})(),e.attachDispatcher({beginInvokeDotNetFromJS:qe,endInvokeJSFromDotNet:Ze,sendByteArray:Qe}),be.enableNavigationInterception(),be.listenForNavigationEvents(et),tt("AttachPage",be.getBaseURI(),be.getLocationHref()),await t.invokeAfterStartedCallbacks(Oe)}Oe.start=st,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&st()})(); \ No newline at end of file diff --git a/src/Components/Web.JS/src/Rendering/Events/EventTypes.ts b/src/Components/Web.JS/src/Rendering/Events/EventTypes.ts index b6aee755f345..60834fe65938 100644 --- a/src/Components/Web.JS/src/Rendering/Events/EventTypes.ts +++ b/src/Components/Web.JS/src/Rendering/Events/EventTypes.ts @@ -60,13 +60,17 @@ registerBuiltInEventType(['input', 'change'], { createEventArgs: parseChangeEvent }); -registerBuiltInEventType(['copy', 'cut', 'paste'], createBlankEventArgsOptions); +registerBuiltInEventType(['copy', 'cut', 'paste'], { + createEventArgs: e => parseClipboardEvent(e as ClipboardEvent) +}); registerBuiltInEventType(['drag', 'dragend', 'dragenter', 'dragleave', 'dragover', 'dragstart', 'drop'], { createEventArgs: e => parseDragEvent(e as DragEvent) }); -registerBuiltInEventType(['focus', 'blur', 'focusin', 'focusout'], createBlankEventArgsOptions); +registerBuiltInEventType(['focus', 'blur', 'focusin', 'focusout'], { + createEventArgs: e => parseFocusEvent(e as FocusEvent) +}); registerBuiltInEventType(['keydown', 'keyup', 'keypress'], { createEventArgs: e => parseKeyboardEvent(e as KeyboardEvent) @@ -154,11 +158,24 @@ function parseTouchEvent(event: TouchEvent): TouchEventArgs { }; } +function parseFocusEvent(event: FocusEvent): FocusEventArgs { + return { + type: event.type + }; +} + +function parseClipboardEvent(event: ClipboardEvent): ClipboardEventArgs { + return { + type: event.type + }; +} + function parseProgressEvent(event: ProgressEvent): ProgressEventArgs { return { lengthComputable: event.lengthComputable, loaded: event.loaded, total: event.total, + type: event.type, }; } @@ -168,6 +185,7 @@ function parseErrorEvent(event: ErrorEvent): ErrorEventArgs { filename: event.filename, lineno: event.lineno, colno: event.colno, + type: event.type, }; } @@ -181,6 +199,7 @@ function parseKeyboardEvent(event: KeyboardEvent): KeyboardEventArgs { shiftKey: event.shiftKey, altKey: event.altKey, metaKey: event.metaKey, + type: event.type, }; } @@ -232,6 +251,7 @@ function parseMouseEvent(event: MouseEvent): MouseEventArgs { shiftKey: event.shiftKey, altKey: event.altKey, metaKey: event.metaKey, + type: event.type, }; } @@ -313,6 +333,7 @@ interface ErrorEventArgs { filename: string; lineno: number; colno: number; + type: string; // omitting 'error' here since we'd have to serialize it, and it's not clear we will want to // do that. https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent @@ -327,6 +348,7 @@ interface KeyboardEventArgs { shiftKey: boolean; altKey: boolean; metaKey: boolean; + type: string; } interface MouseEventArgs { @@ -345,6 +367,7 @@ interface MouseEventArgs { shiftKey: boolean; altKey: boolean; metaKey: boolean; + type: string; } interface PointerEventArgs extends MouseEventArgs { @@ -362,6 +385,7 @@ interface ProgressEventArgs { lengthComputable: boolean; loaded: number; total: number; + type: string; } interface TouchEventArgs { @@ -392,3 +416,11 @@ interface WheelEventArgs extends MouseEventArgs { deltaZ: number; deltaMode: number; } + +interface FocusEventArgs { + type: string; +} + +interface ClipboardEventArgs { + type: string; +} diff --git a/src/Components/Web/test/WebEventData/MouseEventArgsReaderTest.cs b/src/Components/Web/test/WebEventData/MouseEventArgsReaderTest.cs index 73ae4a4edba1..d838fe0d9bff 100644 --- a/src/Components/Web/test/WebEventData/MouseEventArgsReaderTest.cs +++ b/src/Components/Web/test/WebEventData/MouseEventArgsReaderTest.cs @@ -29,6 +29,7 @@ public void Read_Works() ScreenX = 0.1, ScreenY = 4.4, ShiftKey = false, + Type = "type", }; var jsonElement = GetJsonElement(args); diff --git a/src/Components/WebAssembly/Authentication.Msal/src/Interop/package.json b/src/Components/WebAssembly/Authentication.Msal/src/Interop/package.json index d9c39e2b1117..f3195a5a347c 100644 --- a/src/Components/WebAssembly/Authentication.Msal/src/Interop/package.json +++ b/src/Components/WebAssembly/Authentication.Msal/src/Interop/package.json @@ -27,5 +27,8 @@ }, "dependencies": { "@azure/msal-browser": "^2.16.1" + }, + "resolutions": { + "ansi-regex": "5.0.1" } } diff --git a/src/Components/WebAssembly/Authentication.Msal/src/Interop/yarn.lock b/src/Components/WebAssembly/Authentication.Msal/src/Interop/yarn.lock index 3cfc09e1ea68..51b9f4e1bfde 100644 --- a/src/Components/WebAssembly/Authentication.Msal/src/Interop/yarn.lock +++ b/src/Components/WebAssembly/Authentication.Msal/src/Interop/yarn.lock @@ -1242,10 +1242,10 @@ ansi-colors@^4.1.1: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== -ansi-regex@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" - integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== +ansi-regex@5.0.1, ansi-regex@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^3.2.1: version "3.2.1" diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/src/Interop/package.json b/src/Components/WebAssembly/WebAssembly.Authentication/src/Interop/package.json index fc38247b296c..09ce7e5b8b90 100644 --- a/src/Components/WebAssembly/WebAssembly.Authentication/src/Interop/package.json +++ b/src/Components/WebAssembly/WebAssembly.Authentication/src/Interop/package.json @@ -27,5 +27,8 @@ }, "dependencies": { "oidc-client": "^1.11.5" + }, + "resolutions": { + "ansi-regex": "5.0.1" } } diff --git a/src/Components/WebAssembly/WebAssembly.Authentication/src/Interop/yarn.lock b/src/Components/WebAssembly/WebAssembly.Authentication/src/Interop/yarn.lock index bc904b485c80..6c69bb84ab52 100644 --- a/src/Components/WebAssembly/WebAssembly.Authentication/src/Interop/yarn.lock +++ b/src/Components/WebAssembly/WebAssembly.Authentication/src/Interop/yarn.lock @@ -1228,10 +1228,10 @@ ansi-colors@^4.1.1: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== -ansi-regex@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" - integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== +ansi-regex@5.0.1, ansi-regex@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^3.2.1: version "3.2.1" diff --git a/src/Components/test/E2ETest/Tests/EventTest.cs b/src/Components/test/E2ETest/Tests/EventTest.cs index 2afaecd3b0f7..390bdcc09061 100644 --- a/src/Components/test/E2ETest/Tests/EventTest.cs +++ b/src/Components/test/E2ETest/Tests/EventTest.cs @@ -41,13 +41,13 @@ public void FocusEvents_CanTrigger() // Focus the target, verify onfocusin is fired input.Click(); - Browser.Equal("onfocus,onfocusin,", () => output.Text); + Browser.Equal("focus,focusin,", () => output.Text); // Focus something else, verify onfocusout is also fired var other = Browser.Exists(By.Id("other")); other.Click(); - Browser.Equal("onfocus,onfocusin,onblur,onfocusout,", () => output.Text); + Browser.Equal("focus,focusin,blur,focusout,", () => output.Text); } [Fact] @@ -79,7 +79,7 @@ public void MouseOverAndMouseOut_CanTrigger() .MoveToElement(other); actions.Perform(); - Browser.Equal("onmouseover,onmouseout,", () => output.Text); + Browser.Equal("mouseover,mouseout,", () => output.Text); } [Fact] @@ -98,7 +98,7 @@ public void MouseMove_CanTrigger() .MoveToElement(input, 10, 10); actions.Perform(); - Browser.Contains("onmousemove,", () => output.Text); + Browser.Contains("mousemove,", () => output.Text); } [Fact] @@ -117,12 +117,12 @@ public void MouseDownAndMouseUp_CanTrigger() var actions = new Actions(Browser).ClickAndHold(input); actions.Perform(); - Browser.Equal("onmousedown,", () => output.Text); + Browser.Equal("mousedown,", () => output.Text); actions = new Actions(Browser).Release(input); actions.Perform(); - Browser.Equal("onmousedown,onmouseup,", () => output.Text); + Browser.Equal("mousedown,mouseup,", () => output.Text); } @@ -156,7 +156,7 @@ public void PointerDown_CanTrigger() var actions = new Actions(Browser).ClickAndHold(input); actions.Perform(); - Browser.Equal("onpointerdown", () => output.Text); + Browser.Equal("pointerdown,", () => output.Text); } [Fact] @@ -174,10 +174,11 @@ public void DragDrop_CanTrigger() actions.Perform(); // drop doesn't seem to trigger in Selenium. But it's sufficient to determine "any" drag event works - Browser.Equal("ondragstart,", () => output.Text); + Browser.Equal("dragstart,", () => output.Text); } - [Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/32373")] + [Fact] + [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/32373")] public void TouchEvent_CanTrigger() { Browser.MountTestComponent(); @@ -190,7 +191,7 @@ public void TouchEvent_CanTrigger() var actions = new TouchActions(Browser).SingleTap(input); actions.Perform(); - Browser.Equal("touchstarttouchend,", () => output.Text); + Browser.Equal("touchstart,touchend,", () => output.Text); } [Fact] diff --git a/src/Components/test/E2ETest/Tests/JSRootComponentsTest.cs b/src/Components/test/E2ETest/Tests/JSRootComponentsTest.cs index c1c1764c5c48..c4e4b29bfd65 100644 --- a/src/Components/test/E2ETest/Tests/JSRootComponentsTest.cs +++ b/src/Components/test/E2ETest/Tests/JSRootComponentsTest.cs @@ -36,6 +36,7 @@ protected override void InitializeAsyncCore() [InlineData(false, true)] [InlineData(true, false)] [InlineData(true, true)] + [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/38613")] public void CanAddAndDisposeRootComponents(bool intoBlazorUi, bool attachShadowRoot) { var message = app.FindElement(By.Id("message")); diff --git a/src/Components/test/E2ETest/package.json b/src/Components/test/E2ETest/package.json index 37d04b1293e2..5ae1fd7c9c0d 100644 --- a/src/Components/test/E2ETest/package.json +++ b/src/Components/test/E2ETest/package.json @@ -19,5 +19,8 @@ "@types/node": "^13.1.7", "ts-node": "^8.6.2", "typescript": "^3.7.5" + }, + "resolutions": { + "lodash": ">=4.17.21" } } diff --git a/src/Components/test/E2ETest/yarn.lock b/src/Components/test/E2ETest/yarn.lock index 2002aa6b8825..55b89cd5cc35 100644 --- a/src/Components/test/E2ETest/yarn.lock +++ b/src/Components/test/E2ETest/yarn.lock @@ -330,15 +330,10 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash@^4.16.6: - version "4.17.15" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" - integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== - -lodash@^4.17.14: - version "4.17.14" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" - integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== +lodash@>=4.17.21, lodash@^4.16.6, lodash@^4.17.14: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== lowercase-keys@^2.0.0: version "2.0.0" diff --git a/src/Components/test/testassets/BasicTestApp/FocusEventComponent.razor b/src/Components/test/testassets/BasicTestApp/FocusEventComponent.razor index 3628a6ed7980..fa4009252d73 100644 --- a/src/Components/test/testassets/BasicTestApp/FocusEventComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/FocusEventComponent.razor @@ -2,8 +2,8 @@

Focus and activation

-

- Input: +

+ Input:

Output: @message @@ -33,24 +33,9 @@ bool buttonReceivedFocusOut; string message; - void OnFocus(FocusEventArgs e) + void OnFocusEvent(FocusEventArgs e) { - message += "onfocus,"; - } - - void OnBlur(FocusEventArgs e) - { - message += "onblur,"; - } - - void OnFocusIn(FocusEventArgs e) - { - message += "onfocusin,"; - } - - void OnFocusOut(FocusEventArgs e) - { - message += "onfocusout,"; + message += $"{e.Type},"; } void Clear() diff --git a/src/Components/test/testassets/BasicTestApp/KeyPressEventComponent.razor b/src/Components/test/testassets/BasicTestApp/KeyPressEventComponent.razor index 43db51d66bdc..9bcea598706e 100644 --- a/src/Components/test/testassets/BasicTestApp/KeyPressEventComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/KeyPressEventComponent.razor @@ -15,5 +15,10 @@ Type here: { Console.WriteLine(JsonSerializer.Serialize(eventArgs)); keysPressed.Add(eventArgs.Key); + + if (eventArgs.Type != "keypress") + { + throw new ArgumentException($"Expected 'keypress' event type, got {eventArgs.Type}"); + } } } diff --git a/src/Components/test/testassets/BasicTestApp/MouseEventComponent.razor b/src/Components/test/testassets/BasicTestApp/MouseEventComponent.razor index d529d3094568..d23aee7f48d3 100644 --- a/src/Components/test/testassets/BasicTestApp/MouseEventComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/MouseEventComponent.razor @@ -7,20 +7,20 @@ Output: @message

- Mouseover: + Mouseover:

- Mousemove city! + Mousemove city!

- Mousedown: + Mousedown:

- Pointerdown: + Pointerdown:

-

Drag Me
-
Drop Target
+
Drag Me
+
Drop Target

@@ -40,52 +40,22 @@ string message; - void OnMouseOver(MouseEventArgs e) + void OnMouseEvent(MouseEventArgs e) { DumpEvent(e); - message += "onmouseover,"; + message += $"{e.Type},"; } - void OnMouseOut(MouseEventArgs e) + void OnPointerEvent(PointerEventArgs e) { DumpEvent(e); - message += "onmouseout,"; + message += $"{e.Type},"; } - void OnMouseMove(MouseEventArgs e) + void OnDragEvent(DragEventArgs e) { DumpEvent(e); - message += "onmousemove,"; - } - - void OnMouseDown(MouseEventArgs e) - { - DumpEvent(e); - message += "onmousedown,"; - } - - void OnMouseUp(MouseEventArgs e) - { - DumpEvent(e); - message += "onmouseup,"; - } - - void OnPointerDown(PointerEventArgs e) - { - DumpEvent(e); - message += "onpointerdown"; - } - - void OnDragStart(DragEventArgs e) - { - DumpEvent(e); - message += "ondragstart,"; - } - - void OnDrop(DragEventArgs e) - { - DumpEvent(e); - message += "ondrop,"; + message += $"{e.Type},"; } void OnPolymorphicEvent(EventArgs e) diff --git a/src/Components/test/testassets/BasicTestApp/TouchEventComponent.razor b/src/Components/test/testassets/BasicTestApp/TouchEventComponent.razor index 1d3489203c7d..12a6f0ed2e55 100644 --- a/src/Components/test/testassets/BasicTestApp/TouchEventComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/TouchEventComponent.razor @@ -28,7 +28,7 @@ void OnTouch(TouchEventArgs e) { - message += e.Type; + message += $"{e.Type},"; Console.WriteLine(JsonSerializer.Serialize(e)); StateHasChanged(); } diff --git a/src/Framework/test/TargetingPackTests.cs b/src/Framework/test/TargetingPackTests.cs index fd244b466367..4d61b765af67 100644 --- a/src/Framework/test/TargetingPackTests.cs +++ b/src/Framework/test/TargetingPackTests.cs @@ -109,22 +109,17 @@ public void RefAssemblyReferencesHaveExpectedAssemblyVersions() Assert.All(dlls, path => { - // Skip netstandard2.0 System.IO.Pipelines assembly. References have old versions. - var filename = Path.GetFileName(path); - if (!string.Equals("System.IO.Pipelines.dll", filename, StringComparison.OrdinalIgnoreCase)) - { - using var fileStream = File.OpenRead(path); - using var peReader = new PEReader(fileStream, PEStreamOptions.Default); - var reader = peReader.GetMetadataReader(MetadataReaderOptions.Default); + using var fileStream = File.OpenRead(path); + using var peReader = new PEReader(fileStream, PEStreamOptions.Default); + var reader = peReader.GetMetadataReader(MetadataReaderOptions.Default); - Assert.All(reader.AssemblyReferences, handle => - { - var reference = reader.GetAssemblyReference(handle); - var result = 0 == reference.Version.Revision; + Assert.All(reader.AssemblyReferences, handle => + { + var reference = reader.GetAssemblyReference(handle); + var result = (0 == reference.Version.Revision && 0 == reference.Version.Build); - Assert.True(result, $"In {filename}, {reference.GetAssemblyName()} has unexpected version {reference.Version}."); - }); - } + Assert.True(result, $"In {Path.GetFileName(path)}, {reference.GetAssemblyName()} has unexpected version {reference.Version}."); + }); }); } diff --git a/src/Identity/test/Identity.FunctionalTests/Microsoft.AspNetCore.Identity.FunctionalTests.csproj b/src/Identity/test/Identity.FunctionalTests/Microsoft.AspNetCore.Identity.FunctionalTests.csproj index 2aff8567ca1f..305d812df71e 100644 --- a/src/Identity/test/Identity.FunctionalTests/Microsoft.AspNetCore.Identity.FunctionalTests.csproj +++ b/src/Identity/test/Identity.FunctionalTests/Microsoft.AspNetCore.Identity.FunctionalTests.csproj @@ -25,6 +25,7 @@ + diff --git a/src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs b/src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs index a2e05657d697..30e791259528 100644 --- a/src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs +++ b/src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs @@ -17,6 +17,7 @@ namespace Microsoft.AspNetCore.Identity.Test { + [SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/38542", Queues="OSX.1015.Amd64.Open;OSX.1015.Amd64")] //slow public class IdentityUIScriptsTest : IDisposable { private readonly ITestOutputHelper _output; diff --git a/src/Identity/test/Identity.Test/Microsoft.AspNetCore.Identity.Test.csproj b/src/Identity/test/Identity.Test/Microsoft.AspNetCore.Identity.Test.csproj index 3feb3cc80a2b..215827d7bedd 100644 --- a/src/Identity/test/Identity.Test/Microsoft.AspNetCore.Identity.Test.csproj +++ b/src/Identity/test/Identity.Test/Microsoft.AspNetCore.Identity.Test.csproj @@ -10,6 +10,7 @@ + diff --git a/src/Installers/Windows/Wix.targets b/src/Installers/Windows/Wix.targets index 3da4205a0b32..a4f8ba7fef40 100644 --- a/src/Installers/Windows/Wix.targets +++ b/src/Installers/Windows/Wix.targets @@ -22,7 +22,7 @@ $(ProductName) - Microsoft.$(ProductNameShort)_$(Platform)_$(Lang),v$(PackageVersion) + Microsoft.$(ProductNameShort)_$(Platform)_$(Lang),v$(_GeneratedPackageVersion) $(DefineConstants);DepProviderKey=$(DepProviderKey) diff --git a/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/DotNetDispatcher.cs b/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/DotNetDispatcher.cs index 593ef5000861..45ae14bb6b77 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/DotNetDispatcher.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/DotNetDispatcher.cs @@ -306,7 +306,10 @@ public static void EndInvokeJS(JSRuntime jsRuntime, string arguments) var success = reader.GetBoolean(); reader.Read(); - jsRuntime.EndInvokeJS(taskId, success, ref reader); + if (!jsRuntime.EndInvokeJS(taskId, success, ref reader)) + { + return; + } if (!reader.Read() || reader.TokenType != JsonTokenType.EndArray) { diff --git a/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs b/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs index ba4f00bc99bd..ef97f05dded5 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs @@ -225,13 +225,13 @@ protected internal virtual Task ReadJSDataAsStreamAsync(IJSStreamReferen } [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2072:RequiresUnreferencedCode", Justification = "We enforce trimmer attributes for JSON deserialized types on InvokeAsync.")] - internal void EndInvokeJS(long taskId, bool succeeded, ref Utf8JsonReader jsonReader) + internal bool EndInvokeJS(long taskId, bool succeeded, ref Utf8JsonReader jsonReader) { if (!_pendingTasks.TryRemove(taskId, out var tcs)) { // We should simply return if we can't find an id for the invocation. // This likely means that the method that initiated the call defined a timeout and stopped waiting. - return; + return false; } CleanupTasksAndRegistrations(taskId); @@ -251,11 +251,14 @@ internal void EndInvokeJS(long taskId, bool succeeded, ref Utf8JsonReader jsonRe var exceptionText = jsonReader.GetString() ?? string.Empty; TaskGenericsUtil.SetTaskCompletionSourceException(tcs, new JSException(exceptionText)); } + + return true; } catch (Exception exception) { var message = $"An exception occurred executing JS interop: {exception.Message}. See InnerException for more details."; TaskGenericsUtil.SetTaskCompletionSourceException(tcs, new JSException(message, exception)); + return false; } } diff --git a/src/JSInterop/Microsoft.JSInterop/test/Infrastructure/DotNetDispatcherTest.cs b/src/JSInterop/Microsoft.JSInterop/test/Infrastructure/DotNetDispatcherTest.cs index 021f5cd5f24e..58ed212f6a34 100644 --- a/src/JSInterop/Microsoft.JSInterop/test/Infrastructure/DotNetDispatcherTest.cs +++ b/src/JSInterop/Microsoft.JSInterop/test/Infrastructure/DotNetDispatcherTest.cs @@ -263,7 +263,7 @@ public void CannotUseDotNetObjectRefAfterReleaseDotNetObject() } [Fact] - public void EndInvoke_WithSuccessValue() + public void EndInvokeJS_WithSuccessValue() { // Arrange var jsRuntime = new TestJSRuntime(); @@ -282,7 +282,7 @@ public void EndInvoke_WithSuccessValue() } [Fact] - public async Task EndInvoke_WithErrorString() + public async Task EndInvokeJS_WithErrorString() { // Arrange var jsRuntime = new TestJSRuntime(); @@ -299,7 +299,7 @@ public async Task EndInvoke_WithErrorString() } [Fact] - public async Task EndInvoke_WithNullError() + public async Task EndInvokeJS_WithNullError() { // Arrange var jsRuntime = new TestJSRuntime(); @@ -314,6 +314,129 @@ public async Task EndInvoke_WithNullError() Assert.Empty(ex.Message); } + [Fact] + public void EndInvokeJS_DoesNotThrowJSONExceptionIfTaskCancelled() + { + // Arrange + var jsRuntime = new TestJSRuntime(); + var testDTO = new TestDTO { StringVal = "Hello", IntVal = 4 }; + var cts = new CancellationTokenSource(); + var argsJson = JsonSerializer.Serialize(new object[] { jsRuntime.LastInvocationAsyncHandle, true, testDTO }, jsRuntime.JsonSerializerOptions); + + // Act + var task = jsRuntime.InvokeAsync("unimportant", cts.Token); + + cts.Cancel(); + + DotNetDispatcher.EndInvokeJS(jsRuntime, argsJson); + + // Assert + Assert.False(task.IsCompletedSuccessfully); + Assert.True(task.IsCanceled); + } + + [Fact] + public void EndInvokeJS_ThrowsIfJsonIsEmptyString() + { + // Arrange + var jsRuntime = new TestJSRuntime(); + var task = jsRuntime.InvokeAsync("somemethod"); + + // Act & Assert + Assert.ThrowsAny(() => DotNetDispatcher.EndInvokeJS(jsRuntime, "")); + } + + [Fact] + public void EndInvokeJS_ThrowsIfJsonIsNotArray() + { + // Arrange + var jsRuntime = new TestJSRuntime(); + var task = jsRuntime.InvokeAsync("somemethod"); + + // Act & Assert + Assert.ThrowsAny(() => DotNetDispatcher.EndInvokeJS(jsRuntime, $"{{\"key\": \"{jsRuntime.LastInvocationAsyncHandle}\"}}")); + } + + [Fact] + public void EndInvokeJS_ThrowsIfJsonArrayIsInComplete() + { + // Arrange + var jsRuntime = new TestJSRuntime(); + var task = jsRuntime.InvokeAsync("somemethod"); + + // Act & Assert + Assert.ThrowsAny(() => DotNetDispatcher.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, false")); + } + + [Fact] + public void EndInvokeJS_ThrowsIfJsonArrayHasMoreThan3Arguments() + { + // Arrange + var jsRuntime = new TestJSRuntime(); + var task = jsRuntime.InvokeAsync("somemethod"); + + // Act & Assert + Assert.ThrowsAny(() => DotNetDispatcher.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, false, \"Hello\", 5]")); + } + + [Fact] + public void EndInvokeJS_DoesNotThrowJSONExceptionIfTaskCancelled_WithMoreThan3Arguments() + { + // Arrange + var jsRuntime = new TestJSRuntime(); + var cts = new CancellationTokenSource(); + + // Act + var task = jsRuntime.InvokeAsync("unimportant", cts.Token); + + cts.Cancel(); + + DotNetDispatcher.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, false, \"Hello\", 5]"); + + // Assert + Assert.False(task.IsCompletedSuccessfully); + Assert.True(task.IsCanceled); + } + + [Fact] + public void EndInvokeJS_Works() + { + // Arrange + var jsRuntime = new TestJSRuntime(); + var task = jsRuntime.InvokeAsync("somemethod"); + + // Act + DotNetDispatcher.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, true, {{\"intVal\": 7}}]"); + + // Assert + Assert.True(task.IsCompletedSuccessfully); + Assert.Equal(7, task.Result.IntVal); + } + + [Fact] + public void EndInvokeJS_WithArrayValue() + { + var jsRuntime = new TestJSRuntime(); + var task = jsRuntime.InvokeAsync("somemethod"); + + DotNetDispatcher.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, true, [1, 2, 3]]"); + + Assert.True(task.IsCompletedSuccessfully); + Assert.Equal(new[] { 1, 2, 3 }, task.Result); + } + + [Fact] + public void EndInvokeJS_WithNullValue() + { + var jsRuntime = new TestJSRuntime(); + var task = jsRuntime.InvokeAsync("somemethod"); + + DotNetDispatcher.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, true, null]"); + + Assert.True(task.IsCompletedSuccessfully); + Assert.Null(task.Result); + } + [Fact] public void CanInvokeInstanceMethodWithParams() { @@ -652,66 +775,6 @@ public void ParseArguments_Throws_WithIncorrectDotNetObjectRefUsage() Assert.Equal($"In call to '{method}', parameter of type '{nameof(TestDTO)}' at index 2 must be declared as type 'DotNetObjectRef' to receive the incoming value.", ex.Message); } - [Fact] - public void EndInvokeJS_ThrowsIfJsonIsEmptyString() - { - Assert.ThrowsAny(() => DotNetDispatcher.EndInvokeJS(new TestJSRuntime(), "")); - } - - [Fact] - public void EndInvokeJS_ThrowsIfJsonIsNotArray() - { - Assert.ThrowsAny(() => DotNetDispatcher.EndInvokeJS(new TestJSRuntime(), "{\"key\": \"value\"}")); - } - - [Fact] - public void EndInvokeJS_ThrowsIfJsonArrayIsInComplete() - { - Assert.ThrowsAny(() => DotNetDispatcher.EndInvokeJS(new TestJSRuntime(), "[7, false")); - } - - [Fact] - public void EndInvokeJS_ThrowsIfJsonArrayHasMoreThan3Arguments() - { - Assert.ThrowsAny(() => DotNetDispatcher.EndInvokeJS(new TestJSRuntime(), "[7, false, \"Hello\", 5]")); - } - - [Fact] - public void EndInvokeJS_Works() - { - var jsRuntime = new TestJSRuntime(); - var task = jsRuntime.InvokeAsync("somemethod"); - - DotNetDispatcher.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, true, {{\"intVal\": 7}}]"); - - Assert.True(task.IsCompletedSuccessfully); - Assert.Equal(7, task.Result.IntVal); - } - - [Fact] - public void EndInvokeJS_WithArrayValue() - { - var jsRuntime = new TestJSRuntime(); - var task = jsRuntime.InvokeAsync("somemethod"); - - DotNetDispatcher.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, true, [1, 2, 3]]"); - - Assert.True(task.IsCompletedSuccessfully); - Assert.Equal(new[] { 1, 2, 3 }, task.Result); - } - - [Fact] - public void EndInvokeJS_WithNullValue() - { - var jsRuntime = new TestJSRuntime(); - var task = jsRuntime.InvokeAsync("somemethod"); - - DotNetDispatcher.EndInvokeJS(jsRuntime, $"[{jsRuntime.LastInvocationAsyncHandle}, true, null]"); - - Assert.True(task.IsCompletedSuccessfully); - Assert.Null(task.Result); - } - [Fact] public void ReceiveByteArray_Works() { diff --git a/src/Mvc/Mvc.Razor/src/PublicAPI.Unshipped.txt b/src/Mvc/Mvc.Razor/src/PublicAPI.Unshipped.txt index 7dc5c58110bf..5b615e3dde8c 100644 --- a/src/Mvc/Mvc.Razor/src/PublicAPI.Unshipped.txt +++ b/src/Mvc/Mvc.Razor/src/PublicAPI.Unshipped.txt @@ -1 +1,3 @@ #nullable enable +*REMOVED*Microsoft.AspNetCore.Mvc.Razor.RazorPage.Model.get -> TModel? +Microsoft.AspNetCore.Mvc.Razor.RazorPage.Model.get -> TModel diff --git a/src/Mvc/Mvc.Razor/src/RazorPageOfT.cs b/src/Mvc/Mvc.Razor/src/RazorPageOfT.cs index eb1151617773..cc0ae56e1f1f 100644 --- a/src/Mvc/Mvc.Razor/src/RazorPageOfT.cs +++ b/src/Mvc/Mvc.Razor/src/RazorPageOfT.cs @@ -15,13 +15,12 @@ public abstract class RazorPage : RazorPage ///

/// Gets the Model property of the property. /// - public TModel? Model => ViewData == null ? default(TModel) : ViewData.Model; + public TModel Model => ViewData.Model; /// /// Gets or sets the dictionary for view data. /// [RazorInject] public ViewDataDictionary ViewData { get; set; } = default!; - } } diff --git a/src/Mvc/Mvc.ViewFeatures/src/PublicAPI.Unshipped.txt b/src/Mvc/Mvc.ViewFeatures/src/PublicAPI.Unshipped.txt index 7dc5c58110bf..73d4cbd64fd1 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/PublicAPI.Unshipped.txt +++ b/src/Mvc/Mvc.ViewFeatures/src/PublicAPI.Unshipped.txt @@ -1 +1,3 @@ #nullable enable +*REMOVED*Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary.Model.get -> TModel? +Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary.Model.get -> TModel diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryOfT.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryOfT.cs index 3640fdea0281..9933bfe667d5 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryOfT.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryOfT.cs @@ -86,16 +86,10 @@ internal ViewDataDictionary(IModelMetadataProvider metadataProvider) } /// - public new TModel? Model + public new TModel Model { - get - { - return (base.Model == null) ? default(TModel) : (TModel)base.Model; - } - set - { - base.Model = value; - } + get => (base.Model is null) ? default! : (TModel)base.Model; + set => base.Model = value; } } } diff --git a/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj b/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj index b70a060cae94..4b7fc1860a66 100644 --- a/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj +++ b/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj @@ -44,6 +44,7 @@ + diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj index 1cfeade584f8..60ef47172209 100644 --- a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj +++ b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj @@ -42,7 +42,8 @@ - + + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Views/Shared/Error.cshtml b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Views/Shared/Error.cshtml index 10cf32b713d0..a1e04783c67a 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Views/Shared/Error.cshtml +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Views/Shared/Error.cshtml @@ -6,10 +6,10 @@

Error.

An error occurred while processing your request.

-@if (Model?.ShowRequestId ?? false) +@if (Model.ShowRequestId) {

- Request ID: @Model?.RequestId + Request ID: @Model.RequestId

} diff --git a/src/ProjectTemplates/test/GrpcTemplateTest.cs b/src/ProjectTemplates/test/GrpcTemplateTest.cs index 76db82c03550..585ac0bfb457 100644 --- a/src/ProjectTemplates/test/GrpcTemplateTest.cs +++ b/src/ProjectTemplates/test/GrpcTemplateTest.cs @@ -35,7 +35,7 @@ public ITestOutputHelper Output } [ConditionalFact] - [SkipOnHelix("Not supported queues", Queues = "Windows.7.Amd64;Windows.7.Amd64.Open;Windows.81.Amd64.Open;All.OSX;" + HelixConstants.Windows10Arm64 + HelixConstants.DebianArm64)] + [SkipOnHelix("Not supported queues", Queues = "All.OSX;" + HelixConstants.Windows10Arm64 + HelixConstants.DebianArm64)] [SkipOnAlpine("https://github.com/grpc/grpc/issues/18338")] public async Task GrpcTemplate() { diff --git a/src/ProjectTemplates/test/ProjectTemplates.Tests.csproj b/src/ProjectTemplates/test/ProjectTemplates.Tests.csproj index e760ba8ad34d..8a9e1fa661cd 100644 --- a/src/ProjectTemplates/test/ProjectTemplates.Tests.csproj +++ b/src/ProjectTemplates/test/ProjectTemplates.Tests.csproj @@ -46,6 +46,7 @@ + false true diff --git a/src/Security/test/AuthSamples.FunctionalTests/AuthSamples.FunctionalTests.csproj b/src/Security/test/AuthSamples.FunctionalTests/AuthSamples.FunctionalTests.csproj index 1a1b73d13b17..799b9a910945 100644 --- a/src/Security/test/AuthSamples.FunctionalTests/AuthSamples.FunctionalTests.csproj +++ b/src/Security/test/AuthSamples.FunctionalTests/AuthSamples.FunctionalTests.csproj @@ -28,5 +28,6 @@ + diff --git a/src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj b/src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj index 4871a525d7ec..1292ac7a3aa4 100644 --- a/src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj +++ b/src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj @@ -56,6 +56,9 @@ true + + true +
diff --git a/src/Servers/IIS/IntegrationTesting.IIS/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj b/src/Servers/IIS/IntegrationTesting.IIS/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj index a9c1aa371c27..c97ee26fab2e 100644 --- a/src/Servers/IIS/IntegrationTesting.IIS/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj +++ b/src/Servers/IIS/IntegrationTesting.IIS/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj @@ -60,6 +60,7 @@ +
diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1Connection.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1Connection.cs index ba6b7d2b74d0..85abc8bb64e6 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1Connection.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1Connection.cs @@ -603,7 +603,22 @@ private void ValidateNonOriginHostHeader(string hostText) if (!_absoluteRequestTarget.IsDefaultPort || hostText != _absoluteRequestTarget.Authority + ":" + _absoluteRequestTarget.Port.ToString(CultureInfo.InvariantCulture)) { - KestrelBadHttpRequestException.Throw(RequestRejectionReason.InvalidHostHeader, hostText); + // Superseded by RFC 7230, but notable for back-compat. + // https://datatracker.ietf.org/doc/html/rfc2616/#section-5.2 + // 1. If Request-URI is an absoluteURI, the host is part of the + // Request-URI. Any Host header field value in the request MUST be + // ignored. + // We don't want to leave the invalid value for the app to accidentally consume, + // replace it with the value from the request line. + if (_context.ServiceContext.ServerOptions.EnableInsecureAbsoluteFormHostOverride) + { + hostText = _absoluteRequestTarget.Authority + ":" + _absoluteRequestTarget.Port.ToString(CultureInfo.InvariantCulture); + HttpRequestHeaders.HeaderHost = hostText; + } + else + { + KestrelBadHttpRequestException.Throw(RequestRejectionReason.InvalidHostHeader, hostText); + } } } } diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs index a9e10b912dc1..2f54decb91b6 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs @@ -977,6 +977,8 @@ private Task DecodeHeadersAsync(bool endHeaders, in ReadOnlySequence paylo if (endHeaders) { + _currentHeadersStream.OnHeadersComplete(); + StartStream(); ResetRequestHeaderParsingState(); } diff --git a/src/Servers/Kestrel/Core/src/Internal/Http3/Http3Connection.cs b/src/Servers/Kestrel/Core/src/Internal/Http3/Http3Connection.cs index 3452bd52d7a0..3d601eff2a2a 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http3/Http3Connection.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http3/Http3Connection.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http3 { internal class Http3Connection : IHttp3StreamLifetimeHandler, IRequestProcessor { - private static readonly object StreamPersistentStateKey = new object(); + internal static readonly object StreamPersistentStateKey = new object(); // Internal for unit testing internal readonly Dictionary _streams = new Dictionary(); diff --git a/src/Servers/Kestrel/Core/src/Internal/Http3/Http3Stream.cs b/src/Servers/Kestrel/Core/src/Internal/Http3/Http3Stream.cs index ea69197bc27e..c1086dc02a85 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http3/Http3Stream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http3/Http3Stream.cs @@ -662,6 +662,8 @@ private async Task ProcessHeadersFrameAsync(IHttpApplication InputRemaining = HttpRequestHeaders.ContentLength; + OnHeadersComplete(); + // If the stream is complete after receiving the headers then run OnEndStreamReceived. // If there is a bad content length then this will throw before the request delegate is called. if (isCompleted) diff --git a/src/Servers/Kestrel/Core/src/KestrelServerOptions.cs b/src/Servers/Kestrel/Core/src/KestrelServerOptions.cs index 1befec5ce398..cf930c744cbb 100644 --- a/src/Servers/Kestrel/Core/src/KestrelServerOptions.cs +++ b/src/Servers/Kestrel/Core/src/KestrelServerOptions.cs @@ -36,6 +36,21 @@ public class KestrelServerOptions private Func _responseHeaderEncodingSelector = DefaultHeaderEncodingSelector; + private bool? _enableInsecureAbsoluteFormHostOverride; + internal bool EnableInsecureAbsoluteFormHostOverride + { + get + { + if (!_enableInsecureAbsoluteFormHostOverride.HasValue) + { + _enableInsecureAbsoluteFormHostOverride = + AppContext.TryGetSwitch("Microsoft.AspNetCore.Server.Kestrel.EnableInsecureAbsoluteFormHostOverride", out var enabled) && enabled; + } + return _enableInsecureAbsoluteFormHostOverride.Value; + } + set => _enableInsecureAbsoluteFormHostOverride = value; + } + // The following two lists configure the endpoints that Kestrel should listen to. If both lists are empty, the "urls" config setting (e.g. UseUrls) is used. internal List CodeBackedListenOptions { get; } = new List(); internal List ConfigurationBackedListenOptions { get; } = new List(); diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/BadHttpRequestTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/BadHttpRequestTests.cs index fffb7b89eb1b..386bed6621fd 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/BadHttpRequestTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/BadHttpRequestTests.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.TestTransport; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Primitives; using Moq; using Xunit; using BadHttpRequestException = Microsoft.AspNetCore.Http.BadHttpRequestException; @@ -137,6 +138,30 @@ public Task BadRequestIfHostHeaderDoesNotMatchRequestTarget(string requestTarget CoreStrings.FormatBadRequest_InvalidHostHeader_Detail(host.Trim())); } + [Fact] + public async Task CanOptOutOfBadRequestIfHostHeaderDoesNotMatchRequestTarget() + { + var receivedHost = StringValues.Empty; + await using var server = new TestServer(context => + { + receivedHost = context.Request.Headers.Host; + return Task.CompletedTask; + }, new TestServiceContext(LoggerFactory) + { + ServerOptions = new KestrelServerOptions() + { + EnableInsecureAbsoluteFormHostOverride = true, + } + }); + using var client = server.CreateConnection(); + + await client.SendAll($"GET http://www.foo.com/api/data HTTP/1.1\r\nHost: www.foo.comConnection: keep-alive\r\n\r\n"); + + await client.Receive("HTTP/1.1 200 OK"); + + Assert.Equal("www.foo.com:80", receivedHost); + } + [Fact] public Task BadRequestFor10BadHostHeaderFormat() { diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs index 3016d57237f5..6a9656d9f730 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Net.Http; using System.Net.Http.HPack; +using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -211,6 +212,73 @@ await ExpectAsync(Http2FrameType.HEADERS, await StopConnectionAsync(expectedLastStreamId: 3, ignoreNonGoAwayFrames: false); } + [Fact] + public async Task RequestHeaderStringReuse_MultipleStreams_KnownHeaderClearedIfNotReused() + { + const BindingFlags privateFlags = BindingFlags.NonPublic | BindingFlags.Instance; + + IEnumerable> requestHeaders1 = new[] + { + new KeyValuePair(HeaderNames.Method, "GET"), + new KeyValuePair(HeaderNames.Path, "/hello"), + new KeyValuePair(HeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.Authority, "localhost:80"), + new KeyValuePair(HeaderNames.ContentType, "application/json") + }; + + // Note: No content-type + IEnumerable> requestHeaders2 = new[] + { + new KeyValuePair(HeaderNames.Method, "GET"), + new KeyValuePair(HeaderNames.Path, "/hello"), + new KeyValuePair(HeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.Authority, "localhost:80") + }; + + await InitializeConnectionAsync(_noopApplication); + + await StartStreamAsync(1, requestHeaders1, endStream: true); + + await ExpectAsync(Http2FrameType.HEADERS, + withLength: 36, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), + withStreamId: 1); + + // TriggerTick will trigger the stream to be returned to the pool so we can assert it + TriggerTick(_serviceContext.MockSystemClock.UtcNow); + + // Stream has been returned to the pool + Assert.Equal(1, _connection.StreamPool.Count); + Assert.True(_connection.StreamPool.TryPeek(out var stream1)); + + // Hacky but required because header references is private. + var headerReferences1 = typeof(HttpRequestHeaders).GetField("_headers", privateFlags).GetValue(stream1.RequestHeaders); + var contentTypeValue1 = (StringValues)headerReferences1.GetType().GetField("_ContentType").GetValue(headerReferences1); + + await StartStreamAsync(3, requestHeaders2, endStream: true); + + await ExpectAsync(Http2FrameType.HEADERS, + withLength: 6, + withFlags: (byte)(Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM), + withStreamId: 3); + + // TriggerTick will trigger the stream to be returned to the pool so we can assert it + TriggerTick(_serviceContext.MockSystemClock.UtcNow); + + // Stream has been returned to the pool + Assert.Equal(1, _connection.StreamPool.Count); + Assert.True(_connection.StreamPool.TryPeek(out var stream2)); + + // Hacky but required because header references is private. + var headerReferences2 = typeof(HttpRequestHeaders).GetField("_headers", privateFlags).GetValue(stream2.RequestHeaders); + var contentTypeValue2 = (StringValues)headerReferences2.GetType().GetField("_ContentType").GetValue(headerReferences2); + + Assert.Equal("application/json", contentTypeValue1); + Assert.Equal(StringValues.Empty, contentTypeValue2); + + await StopConnectionAsync(expectedLastStreamId: 3, ignoreNonGoAwayFrames: false); + } + private class ResponseTrailersWrapper : IHeaderDictionary { readonly IHeaderDictionary _innerHeaders; diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3ConnectionTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3ConnectionTests.cs index ead3a1656bdc..b83f3b64deb4 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3ConnectionTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3ConnectionTests.cs @@ -6,14 +6,18 @@ using System.Collections.Generic; using System.Globalization; using System.Net.Http; +using System.Reflection; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using Microsoft.AspNetCore.Connections; +using Microsoft.AspNetCore.Connections.Features; using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http3; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; using Xunit; using Http3SettingType = Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http3.Http3SettingType; @@ -334,6 +338,49 @@ public async Task StreamPool_MultipleStreamsInSequence_PooledStreamReused() Assert.Same(streamContext1, streamContext2); } + [Fact] + public async Task RequestHeaderStringReuse_MultipleStreams_KnownHeaderClearedIfNotReused() + { + const BindingFlags privateFlags = BindingFlags.NonPublic | BindingFlags.Instance; + + KeyValuePair[] requestHeaders1 = new[] + { + new KeyValuePair(HeaderNames.Method, "GET"), + new KeyValuePair(HeaderNames.Path, "/hello"), + new KeyValuePair(HeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.Authority, "localhost:80"), + new KeyValuePair(HeaderNames.ContentType, "application/json") + }; + + // Note: No content-type + KeyValuePair[] requestHeaders2 = new[] + { + new KeyValuePair(HeaderNames.Method, "GET"), + new KeyValuePair(HeaderNames.Path, "/hello"), + new KeyValuePair(HeaderNames.Scheme, "http"), + new KeyValuePair(HeaderNames.Authority, "localhost:80") + }; + + await Http3Api.InitializeConnectionAsync(_echoApplication); + + var streamContext1 = await MakeRequestAsync(0, requestHeaders1, sendData: true, waitForServerDispose: true); + var http3Stream1 = (Http3Stream)streamContext1.Features.Get().State[Http3Connection.StreamPersistentStateKey]; + + // Hacky but required because header references is private. + var headerReferences1 = typeof(HttpRequestHeaders).GetField("_headers", privateFlags).GetValue(http3Stream1.RequestHeaders); + var contentTypeValue1 = (StringValues)headerReferences1.GetType().GetField("_ContentType").GetValue(headerReferences1); + + var streamContext2 = await MakeRequestAsync(1, requestHeaders2, sendData: true, waitForServerDispose: true); + var http3Stream2 = (Http3Stream)streamContext2.Features.Get().State[Http3Connection.StreamPersistentStateKey]; + + // Hacky but required because header references is private. + var headerReferences2 = typeof(HttpRequestHeaders).GetField("_headers", privateFlags).GetValue(http3Stream2.RequestHeaders); + var contentTypeValue2 = (StringValues)headerReferences1.GetType().GetField("_ContentType").GetValue(headerReferences2); + + Assert.Equal("application/json", contentTypeValue1); + Assert.Equal(StringValues.Empty, contentTypeValue2); + } + [Theory] [InlineData(10)] [InlineData(100)] diff --git a/src/Shared/E2ETesting/selenium-config.json b/src/Shared/E2ETesting/selenium-config.json index 53df445b060c..e91ae1ff3f40 100644 --- a/src/Shared/E2ETesting/selenium-config.json +++ b/src/Shared/E2ETesting/selenium-config.json @@ -1,7 +1,7 @@ { "drivers": { "chrome": { - "version" : "95.0.4638.17" + "version" : "97.0.4692.71" } }, "ignoreExtraDrivers": true diff --git a/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/LongPollingTransportTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/LongPollingTransportTest.java index 4effdf8a6d48..85e1fd870ec6 100644 --- a/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/LongPollingTransportTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/LongPollingTransportTest.java @@ -71,7 +71,7 @@ public void StatusCode204StopsLongPollingTriggersOnClosed() { assertFalse(onClosedRan.get()); transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait(); - assertTrue(block.blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(block.blockingAwait(30, TimeUnit.SECONDS)); assertTrue(onClosedRan.get()); assertFalse(transport.isActive()); } @@ -100,7 +100,7 @@ public void LongPollingFailsWhenReceivingUnexpectedErrorCode() { }); transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait(); - assertTrue(blocker.blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(blocker.blockingAwait(30, TimeUnit.SECONDS)); assertFalse(transport.isActive()); assertTrue(onClosedRan.get()); } @@ -126,7 +126,6 @@ public void CanSetAndTriggerOnReceive() { assertTrue(onReceivedRan.get()); } - @Disabled("https://github.com/dotnet/aspnetcore/issues/34563") @Test public void LongPollingTransportOnReceiveGetsCalled() { AtomicInteger requestCount = new AtomicInteger(); @@ -158,7 +157,7 @@ public void LongPollingTransportOnReceiveGetsCalled() { transport.setOnClose((error) -> {}); transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait(); - assertTrue(block.blockingAwait(1,TimeUnit.SECONDS)); + assertTrue(block.blockingAwait(30,TimeUnit.SECONDS)); assertTrue(onReceiveCalled.get()); assertEquals("TEST", message.get()); } @@ -203,7 +202,7 @@ public void LongPollingTransportOnReceiveGetsCalledMultipleTimes() { transport.setOnClose((error) -> {}); transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait(); - assertTrue(blocker.blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(blocker.blockingAwait(30, TimeUnit.SECONDS)); assertTrue(onReceiveCalled.get()); assertEquals("FIRSTSECONDTHIRD", message.get()); } @@ -219,7 +218,7 @@ public void LongPollingTransportSendsHeaders() { requestCount.incrementAndGet(); return Single.just(new HttpResponse(200, "", TestUtils.emptyByteBuffer)); } - assertTrue(close.blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(close.blockingAwait(30, TimeUnit.SECONDS)); return Single.just(new HttpResponse(204, "", TestUtils.emptyByteBuffer)); }).on("POST", (req) -> { assertFalse(req.getHeaders().isEmpty()); @@ -234,7 +233,7 @@ public void LongPollingTransportSendsHeaders() { transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait(); ByteBuffer sendBuffer = TestUtils.stringToByteBuffer("TEST"); - assertTrue(transport.send(sendBuffer).blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(transport.send(sendBuffer).blockingAwait(30, TimeUnit.SECONDS)); close.onComplete(); assertEquals(headerValue.get(), "VALUE"); } @@ -250,7 +249,7 @@ public void LongPollingTransportSetsAuthorizationHeader() { requestCount.incrementAndGet(); return Single.just(new HttpResponse(200, "", TestUtils.emptyByteBuffer)); } - assertTrue(close.blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(close.blockingAwait(30, TimeUnit.SECONDS)); return Single.just(new HttpResponse(204, "", TestUtils.emptyByteBuffer)); }) .on("POST", (req) -> { @@ -266,7 +265,7 @@ public void LongPollingTransportSetsAuthorizationHeader() { transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait(); ByteBuffer sendBuffer = TestUtils.stringToByteBuffer("TEST"); - assertTrue(transport.send(sendBuffer).blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(transport.send(sendBuffer).blockingAwait(30, TimeUnit.SECONDS)); assertEquals(headerValue.get(), "Bearer TOKEN"); close.onComplete(); } @@ -285,7 +284,7 @@ public void LongPollingTransportRunsAccessTokenProviderEveryRequest() { } assertEquals("Bearer TOKEN1", req.getHeaders().get("Authorization")); secondGet.onComplete(); - assertTrue(close.blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(close.blockingAwait(30, TimeUnit.SECONDS)); return Single.just(new HttpResponse(204, "", TestUtils.emptyByteBuffer)); }) .on("POST", (req) -> { @@ -301,9 +300,9 @@ public void LongPollingTransportRunsAccessTokenProviderEveryRequest() { transport.setOnClose((error) -> {}); transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait(); - secondGet.blockingAwait(1, TimeUnit.SECONDS); + secondGet.blockingAwait(30, TimeUnit.SECONDS); ByteBuffer sendBuffer = TestUtils.stringToByteBuffer("TEST"); - assertTrue(transport.send(sendBuffer).blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(transport.send(sendBuffer).blockingAwait(30, TimeUnit.SECONDS)); assertEquals("Bearer TOKEN2", headerValue.get()); close.onComplete(); } @@ -336,12 +335,12 @@ public void After204StopDoesNotTriggerOnCloseAgain() { assertFalse(onClosedRan.get()); transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait(); - assertTrue(block.blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(block.blockingAwait(30, TimeUnit.SECONDS)); assertEquals(1, onCloseCount.get()); assertTrue(onClosedRan.get()); assertFalse(transport.isActive()); - assertTrue(transport.stop().blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(transport.stop().blockingAwait(30, TimeUnit.SECONDS)); assertEquals(1, onCloseCount.get()); } @@ -355,7 +354,7 @@ public void StoppingTransportRunsCloseHandlersOnce() { firstPoll.set(false); return Single.just(new HttpResponse(200, "", TestUtils.emptyByteBuffer)); } else { - assertTrue(block.blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(block.blockingAwait(30, TimeUnit.SECONDS)); return Single.just(new HttpResponse(204, "", TestUtils.emptyByteBuffer)); } }) @@ -374,7 +373,7 @@ public void StoppingTransportRunsCloseHandlersOnce() { assertEquals(0, onCloseCount.get()); transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait(); - assertTrue(transport.stop().blockingAwait(1, TimeUnit.SECONDS)); + assertTrue(transport.stop().blockingAwait(30, TimeUnit.SECONDS)); assertEquals(1, onCloseCount.get()); assertFalse(transport.isActive()); } diff --git a/src/SignalR/clients/ts/common/package.json b/src/SignalR/clients/ts/common/package.json index 4ad34ff2d94e..34f9eaa675e3 100644 --- a/src/SignalR/clients/ts/common/package.json +++ b/src/SignalR/clients/ts/common/package.json @@ -20,7 +20,7 @@ "eslint-plugin-jsdoc": "^33.0.0", "inspectpack": "^4.6.1", "jest": "^26.6.3", - "jest-junit": "^12.0.0", + "jest-junit": "^13.0.0", "rimraf": "^3.0.2", "terser": "^5.6.0", "terser-webpack-plugin": "^5.1.1", @@ -30,5 +30,9 @@ "webpack": "^5.24.1", "webpack-cli": "^4.5.0" }, - "dependencies": {} + "dependencies": {}, + "resolutions": { + "ansi-regex": "5.0.1", + "set-value": ">=4.0.1" + } } diff --git a/src/SignalR/clients/ts/common/yarn.lock b/src/SignalR/clients/ts/common/yarn.lock index 9be47194da51..5f7e6ed679e1 100644 --- a/src/SignalR/clients/ts/common/yarn.lock +++ b/src/SignalR/clients/ts/common/yarn.lock @@ -1014,15 +1014,10 @@ ansi-escapes@^4.2.1: dependencies: type-fest "^0.21.3" -ansi-regex@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" - integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== - -ansi-regex@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" - integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== +ansi-regex@5.0.1, ansi-regex@^5.0.0, ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^3.2.1: version "3.2.1" @@ -2565,7 +2560,7 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== -is-plain-object@^2.0.3, is-plain-object@^2.0.4: +is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== @@ -2577,6 +2572,11 @@ is-potential-custom-element-name@^1.0.0: resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== +is-primitive@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-3.0.1.tgz#98c4db1abff185485a657fc2905052b940524d05" + integrity sha512-GljRxhWvlCNRfZyORiH77FwdFwGcMO620o37EOYC0ORWdq+WYNVqW0w2Juzew4M+L81l6/QS3t5gkkihyRqv9w== + is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -2827,14 +2827,14 @@ jest-jasmine2@^26.6.3: pretty-format "^26.6.2" throat "^5.0.0" -jest-junit@^12.0.0: - version "12.0.0" - resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-12.0.0.tgz#3ebd4a6a84b50c4ab18323a8f7d9cceb9d845df6" - integrity sha512-+8K35LlboWiPuCnXSyiid7rFdxNlpCWWM20WEYe6IZH6psfUWKZmSpSRQ5tk0C0cBeDsvsnIzcef5mYhyJsbug== +jest-junit@^13.0.0: + version "13.0.0" + resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-13.0.0.tgz#479be347457aad98ae8a5983a23d7c3ec526c9a3" + integrity sha512-JSHR+Dhb32FGJaiKkqsB7AR3OqWKtldLd6ZH2+FJ8D4tsweb8Id8zEVReU4+OlrRO1ZluqJLQEETm+Q6/KilBg== dependencies: mkdirp "^1.0.4" - strip-ansi "^5.2.0" - uuid "^3.3.3" + strip-ansi "^6.0.1" + uuid "^8.3.2" xml "^1.0.1" jest-leak-detector@^26.6.2: @@ -4044,15 +4044,13 @@ set-blocking@^2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= -set-value@^2.0.0, set-value@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" - integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== +set-value@>=4.0.1, set-value@^2.0.0, set-value@^2.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-4.1.0.tgz#aa433662d87081b75ad88a4743bd450f044e7d09" + integrity sha512-zTEg4HL0RwVrqcWs3ztF+x1vkxfm0lP+MQQFPiMJTKVceBwEV0A569Ou8l9IYQG8jOZdMVI1hGsc0tmeD2o/Lw== dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.3" - split-string "^3.0.1" + is-plain-object "^2.0.4" + is-primitive "^3.0.1" shallow-clone@^3.0.0: version "3.0.1" @@ -4214,7 +4212,7 @@ spdx-license-ids@^3.0.0: resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz#e9c18a410e5ed7e12442a549fbd8afa767038d65" integrity sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ== -split-string@^3.0.1, split-string@^3.0.2: +split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== @@ -4285,13 +4283,6 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -strip-ansi@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" - integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== - dependencies: - ansi-regex "^4.1.0" - strip-ansi@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" @@ -4299,6 +4290,13 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" +strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-bom@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" @@ -4629,12 +4627,12 @@ util-deprecate@~1.0.1: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= -uuid@^3.3.2, uuid@^3.3.3: +uuid@^3.3.2: version "3.4.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -uuid@^8.3.0: +uuid@^8.3.0, uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== diff --git a/src/SignalR/clients/ts/signalr/package.json b/src/SignalR/clients/ts/signalr/package.json index 486a57114678..d259ff9d180a 100644 --- a/src/SignalR/clients/ts/signalr/package.json +++ b/src/SignalR/clients/ts/signalr/package.json @@ -59,5 +59,8 @@ "fetch-cookie": "^0.11.0", "node-fetch": "^2.6.1", "ws": "^7.4.5" + }, + "resolutions": { + "ansi-regex": "5.0.1" } } diff --git a/src/SignalR/clients/ts/signalr/src/HttpConnection.ts b/src/SignalR/clients/ts/signalr/src/HttpConnection.ts index aef719f33a4e..91dcd1536770 100644 --- a/src/SignalR/clients/ts/signalr/src/HttpConnection.ts +++ b/src/SignalR/clients/ts/signalr/src/HttpConnection.ts @@ -533,7 +533,7 @@ export class HttpConnection implements IConnection { return url; } - if (!Platform.isBrowser || !window.document) { + if (!Platform.isBrowser) { throw new Error(`Cannot resolve '${url}'.`); } diff --git a/src/SignalR/clients/ts/signalr/src/HubConnection.ts b/src/SignalR/clients/ts/signalr/src/HubConnection.ts index cd8071de4898..3f1363374c79 100644 --- a/src/SignalR/clients/ts/signalr/src/HubConnection.ts +++ b/src/SignalR/clients/ts/signalr/src/HubConnection.ts @@ -180,10 +180,8 @@ export class HubConnection { await this._startInternal(); if (Platform.isBrowser) { - if (document) { - // Log when the browser freezes the tab so users know why their connection unexpectedly stopped working - document.addEventListener("freeze", this._freezeEventListener); - } + // Log when the browser freezes the tab so users know why their connection unexpectedly stopped working + window.document.addEventListener("freeze", this._freezeEventListener); } this._connectionState = HubConnectionState.Connected; @@ -734,9 +732,7 @@ export class HubConnection { this._connectionStarted = false; if (Platform.isBrowser) { - if (document) { - document.removeEventListener("freeze", this._freezeEventListener); - } + window.document.removeEventListener("freeze", this._freezeEventListener); } try { diff --git a/src/SignalR/clients/ts/signalr/src/Utils.ts b/src/SignalR/clients/ts/signalr/src/Utils.ts index 389c3f67cf41..90eb0cc59ced 100644 --- a/src/SignalR/clients/ts/signalr/src/Utils.ts +++ b/src/SignalR/clients/ts/signalr/src/Utils.ts @@ -35,16 +35,25 @@ export class Arg { /** @private */ export class Platform { + // react-native has a window but no document so we should check both public static get isBrowser(): boolean { - return typeof window === "object"; + return typeof window === "object" && typeof window.document === "object"; } + // WebWorkers don't have a window object so the isBrowser check would fail public static get isWebWorker(): boolean { return typeof self === "object" && "importScripts" in self; } + // react-native has a window but no document + static get isReactNative(): boolean { + return typeof window === "object" && typeof window.document === "undefined"; + } + + // Node apps shouldn't have a window object, but WebWorkers don't either + // so we need to check for both WebWorker and window public static get isNode(): boolean { - return !this.isBrowser && !this.isWebWorker; + return !this.isBrowser && !this.isWebWorker && !this.isReactNative; } } diff --git a/src/SignalR/clients/ts/signalr/yarn.lock b/src/SignalR/clients/ts/signalr/yarn.lock index ce09ece17c09..28dfa36b5d81 100644 --- a/src/SignalR/clients/ts/signalr/yarn.lock +++ b/src/SignalR/clients/ts/signalr/yarn.lock @@ -79,10 +79,10 @@ abort-controller@^3.0.0: dependencies: event-target-shim "^5.0.0" -ansi-regex@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" - integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== +ansi-regex@5.0.1, ansi-regex@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" diff --git a/src/SignalR/server/Core/src/HubConnectionContext.cs b/src/SignalR/server/Core/src/HubConnectionContext.cs index 7fbb82c81047..4653cef02757 100644 --- a/src/SignalR/server/Core/src/HubConnectionContext.cs +++ b/src/SignalR/server/Core/src/HubConnectionContext.cs @@ -670,7 +670,7 @@ private void CheckClientTimeout() if (_receivedMessageElapsedTicks >= _clientTimeoutInterval) { - Log.ClientTimeout(_logger, TimeSpan.FromTicks(_clientTimeoutInterval)); + Log.ClientTimeout(_logger, TimeSpan.FromMilliseconds(_clientTimeoutInterval)); AbortAllowReconnect(); } } diff --git a/src/Testing/src/xunit/HelixConstants.cs b/src/Testing/src/xunit/HelixConstants.cs index 68e09365e717..8ec6a086a7a0 100644 --- a/src/Testing/src/xunit/HelixConstants.cs +++ b/src/Testing/src/xunit/HelixConstants.cs @@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Testing public static class HelixConstants { public const string Windows10Arm64 = "Windows.10.Arm64v8.Open;"; - public const string DebianArm64 = "Debian.9.Arm64.Open;"; + public const string DebianArm64 = "Debian.11.Arm64.Open;"; public const string RedhatAmd64 = "Redhat.7.Amd64.Open;"; } } diff --git a/src/Tools/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.targets b/src/Tools/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.targets index af590565c619..f3640745069e 100644 --- a/src/Tools/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.targets +++ b/src/Tools/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.targets @@ -84,6 +84,7 @@ + <_Files Remove="@(_Files)" /> <_Files Include="@(OpenApiReference -> '%(OutputPath)')" - Condition="$([System.IO.File]::Exists('%(OpenApiReference.OutputPath)'))"> - $([System.IO.Path]::GetExtension('%(OpenApiReference.OutputPath)')) - + Condition="$([System.IO.File]::Exists('%(OpenApiReference.OutputPath)'))" /> <_Directories Remove="@(_Directories)" /> <_Directories Include="@(OpenApiReference -> '%(OutputPath)')" Condition="Exists('%(OpenApiReference.OutputPath)') AND ! $([System.IO.File]::Exists('%(OpenApiReference.OutputPath)'))" /> + + + + <_Files SourceDocument="%(OriginalItemSpec)" RemoveMetadata="OriginalItemSpec" /> + <_Directories SourceDocument="%(OriginalItemSpec)" RemoveMetadata="OriginalItemSpec" /> + + - %(_Files.FullPath) - + Condition="'%(_Files.Extension)' == '.ts' OR '%(_Files.Extension)' == '.tsx'" /> - %(OpenApiReference.FullPath) - + Condition="'$(DefaultLanguageSourceExtension)' != '.ts' AND '%(_Files.Extension)' == '$(DefaultLanguageSourceExtension)'" /> + - - - %(_Directories.FullPath) - + + + <_TypeScriptCompileItemsFromDirectories>@(_Directories -> '%(Identity)/**/*.ts;%(Identity)/**/*.tsx') + <_CompileItemsFromDirectories>@(_Directories -> '%(Identity)/**/*$(DefaultLanguageSourceExtension)') + - + + + - %(_Directories.FullPath) - + Condition="'$(DefaultLanguageSourceExtension)' != '.ts'" /> - + <_Files Remove="@(_Files)" /> <_Directories Remove="@(_Directories)" /> + + + <_TypeScriptCompileItemsFromDirectories /> + <_CompileItemsFromDirectories /> + diff --git a/src/Tools/Extensions.ApiDescription.Client/test/Microsoft.Extensions.ApiDescription.Client.Tests.csproj b/src/Tools/Extensions.ApiDescription.Client/test/Microsoft.Extensions.ApiDescription.Client.Tests.csproj index db09c31bee67..1ccce0e63658 100644 --- a/src/Tools/Extensions.ApiDescription.Client/test/Microsoft.Extensions.ApiDescription.Client.Tests.csproj +++ b/src/Tools/Extensions.ApiDescription.Client/test/Microsoft.Extensions.ApiDescription.Client.Tests.csproj @@ -1,5 +1,4 @@  - $(DefaultNetCoreTargetFramework) $(DefaultItemExcludes);TestProjects\**\* @@ -7,15 +6,20 @@ - - - + + <_Parameter1>TargetFramework + <_Parameter2>$(TargetFramework) + - - + + + - - - + + + + + diff --git a/src/Tools/Extensions.ApiDescription.Client/test/TargetTest.cs b/src/Tools/Extensions.ApiDescription.Client/test/TargetTest.cs new file mode 100644 index 000000000000..4de0605a76f5 --- /dev/null +++ b/src/Tools/Extensions.ApiDescription.Client/test/TargetTest.cs @@ -0,0 +1,503 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.IO; +using System.Linq; +using System.Reflection; +using Microsoft.AspNetCore.Internal; +using Microsoft.Extensions.CommandLineUtils; +using Microsoft.Extensions.Tools.Internal; +using Xunit.Abstractions; + +namespace Microsoft.Extensions.ApiDescription.Client; + +public class TargetTest : IDisposable +{ + private static Assembly _assembly = typeof(TargetTest).Assembly; + private static string _assemblyLocation = Path.GetDirectoryName(_assembly.Location); + private static string _targetFramework = _assembly.GetCustomAttributes() + .Single(m => m.Key == "TargetFramework") + .Value; + + private ITestOutputHelper _output; + private TemporaryDirectory _temporaryDirectory; + + public TargetTest(ITestOutputHelper output) + { + _output = output; + _temporaryDirectory = new TemporaryDirectory(); + + var build = _temporaryDirectory.SubDir("build"); + var files = _temporaryDirectory.SubDir("files"); + var tasks = _temporaryDirectory.SubDir("tasks").SubDir("netstandard2.0"); + _temporaryDirectory.Create(); + + // Populate temporary build folder. + var directory = new DirectoryInfo(Path.Combine(_assemblyLocation, "build")); + foreach (var file in directory.GetFiles()) + { + file.CopyTo(Path.Combine(build.Root, file.Name), overwrite: true); + } + directory = new DirectoryInfo(Path.Combine(_assemblyLocation, "TestProjects", "build")); + foreach (var file in directory.GetFiles()) + { + file.CopyTo(Path.Combine(build.Root, file.Name), overwrite: true); + } + + // Populate temporary files folder. + directory = new DirectoryInfo(Path.Combine(_assemblyLocation, "TestProjects", "files")); + foreach (var file in directory.GetFiles()) + { + file.CopyTo(Path.Combine(files.Root, file.Name), overwrite: true); + } + + // Populate temporary tasks folder. + directory = new DirectoryInfo(_assemblyLocation); + foreach (var file in directory.GetFiles("Microsoft.Extensions.ApiDescription.Client.???")) + { + file.CopyTo(Path.Combine(tasks.Root, file.Name), overwrite: true); + } + } + + [Fact] + public async Task AddsExpectedItems() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json", + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.Contains($"Compile: {Path.Combine("obj", "azureMonitorClient.cs")}", process.Output); + Assert.Contains($"FileWrites: {Path.Combine("obj", "azureMonitorClient.cs")}", process.Output); + Assert.DoesNotContain("TypeScriptCompile:", process.Output); + } + + [Fact] + public async Task AddsExpectedItems_WithCodeGenerator() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json", + CodeGenerator = "NSwagTypeScript", + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.DoesNotContain(" Compile:", process.Output); + Assert.Contains($"FileWrites: {Path.Combine("obj", "azureMonitorClient.ts")}", process.Output); + Assert.Contains($"TypeScriptCompile: {Path.Combine("obj", "azureMonitorClient.ts")}", process.Output); + } + + [Fact] + public async Task AddsExpectedItems_WithMultipleFiles() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json;files/NSwag.json;files/swashbuckle.json", + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.Contains($"Compile: {Path.Combine("obj", "azureMonitorClient.cs")}", process.Output); + Assert.Contains($"Compile: {Path.Combine("obj", "NSwagClient.cs")}", process.Output); + Assert.Contains($"Compile: {Path.Combine("obj", "swashbuckleClient.cs")}", process.Output); + Assert.Contains($"FileWrites: {Path.Combine("obj", "azureMonitorClient.cs")}", process.Output); + Assert.Contains($"FileWrites: {Path.Combine("obj", "NSwagClient.cs")}", process.Output); + Assert.Contains($"FileWrites: {Path.Combine("obj", "swashbuckleClient.cs")}", process.Output); + Assert.DoesNotContain("TypeScriptCompile:", process.Output); + } + + [Fact] + public async Task AddsExpectedItems_WithMultipleFilesFromGenerator() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json", + CodeGenerator = "CustomCSharp", + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.Contains($"Compile: {Path.Combine("obj", "azureMonitorClient.cs", "Generated1.cs")}", process.Output); + Assert.Contains($"Compile: {Path.Combine("obj", "azureMonitorClient.cs", "Generated2.cs")}", process.Output); + Assert.Contains( + $"FileWrites: {Path.Combine("obj", "azureMonitorClient.cs", "Generated1.cs")}", + process.Output); + Assert.Contains( + $"FileWrites: {Path.Combine("obj", "azureMonitorClient.cs", "Generated2.cs")}", + process.Output); + Assert.DoesNotContain("TypeScriptCompile:", process.Output); + } + + [Fact] + public async Task ExecutesGeneratorTarget() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithItem(new TemporaryOpenApiProject.ItemSpec { + Include = "files/azureMonitor.json", + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.Contains( + "GenerateNSwagCSharp " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "azureMonitor.json")} " + + "Class: 'test.azureMonitorClient' FirstForGenerator: 'true' " + + $"Options: '' OutputPath: '{Path.Combine("obj", "azureMonitorClient.cs")}'", + process.Output); + } + + [Fact] + public async Task ExecutesGeneratorTarget_WithOpenApiGenerateCodeOptions() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithProperty("OpenApiGenerateCodeOptions", "--an-option") + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json", + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.Contains( + "GenerateNSwagCSharp " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "azureMonitor.json")} " + + "Class: 'test.azureMonitorClient' FirstForGenerator: 'true' " + + $"Options: '--an-option' OutputPath: '{Path.Combine("obj", "azureMonitorClient.cs")}'", + process.Output); + } + + [Fact] + public async Task ExecutesGeneratorTarget_WithOpenApiCodeDirectory() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithProperty("OpenApiCodeDirectory", "generated") + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json", + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.Contains( + "GenerateNSwagCSharp " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "azureMonitor.json")} " + + "Class: 'test.azureMonitorClient' FirstForGenerator: 'true' " + + $"Options: '' OutputPath: '{Path.Combine("generated", "azureMonitorClient.cs")}'", + process.Output); + } + + [Fact] + public async Task ExecutesGeneratorTarget_WithClassName() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json", + ClassName = "AzureMonitor" + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + + // Note ClassName does **not** override OutputPath. + Assert.Contains( + "GenerateNSwagCSharp " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "azureMonitor.json")} " + + "Class: 'test.AzureMonitor' FirstForGenerator: 'true' " + + $"Options: '' OutputPath: '{Path.Combine("obj", "azureMonitorClient.cs")}'", + process.Output); + } + + [Fact] + public async Task ExecutesGeneratorTarget_WithCodeGenerator() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithItem(new TemporaryOpenApiProject.ItemSpec { + Include = "files/azureMonitor.json", + CodeGenerator="NSwagTypeScript" + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.Contains( + "GenerateNSwagTypeScript " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "azureMonitor.json")} " + + "Class: 'test.azureMonitorClient' FirstForGenerator: 'true' " + + $"Options: '' OutputPath: '{Path.Combine("obj", "azureMonitorClient.ts")}'", + process.Output); + } + + [Fact] + public async Task ExecutesGeneratorTarget_WithNamespace() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json", + Namespace = "SomeNamespace" + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.Contains( + "GenerateNSwagCSharp " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "azureMonitor.json")} " + + "Class: 'SomeNamespace.azureMonitorClient' FirstForGenerator: 'true' " + + $"Options: '' OutputPath: '{Path.Combine("obj", "azureMonitorClient.cs")}'", + process.Output); + } + + [Fact] + public async Task ExecutesGeneratorTarget_WithOptions() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithItem(new TemporaryOpenApiProject.ItemSpec { + Include = "files/azureMonitor.json", + Options="--an-option" + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.Contains( + "GenerateNSwagCSharp " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "azureMonitor.json")} " + + "Class: 'test.azureMonitorClient' FirstForGenerator: 'true' " + + $"Options: '--an-option' OutputPath: '{Path.Combine("obj", "azureMonitorClient.cs")}'", + process.Output); + } + + [Fact] + public async Task ExecutesGeneratorTarget_WithOutputPath() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json", + OutputPath = "Custom.cs" + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + + // Note OutputPath also overrides ClassName. + Assert.Contains( + "GenerateNSwagCSharp " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "azureMonitor.json")} " + + "Class: 'test.Custom' FirstForGenerator: 'true' " + + $"Options: '' OutputPath: '{Path.Combine("obj", "Custom.cs")}'", + process.Output); + } + + [Fact] + public async Task ExecutesGeneratorTarget_WithMultipleFiles() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json;files/NSwag.json;files/swashbuckle.json", + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.Contains( + "GenerateNSwagCSharp " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "azureMonitor.json")} " + + "Class: 'test.azureMonitorClient' FirstForGenerator: 'true' " + + $"Options: '' OutputPath: '{Path.Combine("obj", "azureMonitorClient.cs")}'", + process.Output); + Assert.Contains( + "GenerateNSwagCSharp " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "NSwag.json")} " + + "Class: 'test.NSwagClient' FirstForGenerator: 'false' " + + $"Options: '' OutputPath: '{Path.Combine("obj", "NSwagClient.cs")}'", + process.Output); + Assert.Contains( + "GenerateNSwagCSharp " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "swashbuckle.json")} " + + "Class: 'test.swashbuckleClient' FirstForGenerator: 'false' " + + $"Options: '' OutputPath: '{Path.Combine("obj", "swashbuckleClient.cs")}'", + process.Output); + } + + [Fact] + public async Task ExecutesGeneratorTarget_WithMultipleGenerators() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json", + }) + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json", + CodeGenerator = "NSwagTypeScript" + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.Contains( + "GenerateNSwagCSharp " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "azureMonitor.json")} " + + "Class: 'test.azureMonitorClient' FirstForGenerator: 'true' " + + $"Options: '' OutputPath: '{Path.Combine("obj", "azureMonitorClient.cs")}'", + process.Output); + Assert.Contains( + "GenerateNSwagTypeScript " + + $"{Path.Combine(_temporaryDirectory.Root, "files", "azureMonitor.json")} " + + "Class: 'test.azureMonitorClient' FirstForGenerator: 'true' " + + $"Options: '' OutputPath: '{Path.Combine("obj", "azureMonitorClient.ts")}'", + process.Output); + } + + [Fact] + public async Task SkipsGeneratorTarget_InSubsequentBuilds() + { + // Arrange + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithProperty("OpenApiGenerateCodeOnBuild", "false") + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json", + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + // Act 1 + using var firstProcess = await RunBuild(); + + // Assert 1 aka Guards + Assert.Equal(0, firstProcess.ExitCode); + Assert.Empty(firstProcess.Error); + + // Act 2 + using var secondProcess = await RunBuild(); + + // Assert 2 + Assert.Equal(0, secondProcess.ExitCode); + Assert.Empty(secondProcess.Error); + Assert.DoesNotContain("GenerateNSwagCSharp ", secondProcess.Output); + + // Act 3 + using var thirdProcess = await RunBuild(); + + // Assert 2 + Assert.Equal(0, thirdProcess.ExitCode); + Assert.Empty(thirdProcess.Error); + Assert.DoesNotContain("GenerateNSwagCSharp ", thirdProcess.Output); + } + + [Fact] + public async Task SkipsGeneratorTarget_WithOpenApiGenerateCodeOnBuild() + { + var project = new TemporaryOpenApiProject("test", _temporaryDirectory, "Microsoft.NET.Sdk") + .WithTargetFrameworks(_targetFramework) + .WithProperty("OpenApiGenerateCodeOnBuild", "false") + .WithItem(new TemporaryOpenApiProject.ItemSpec + { + Include = "files/azureMonitor.json", + }); + _temporaryDirectory.WithCSharpProject(project); + project.Create(); + + using var process = await RunBuild(); + + Assert.Equal(0, process.ExitCode); + Assert.Empty(process.Error); + Assert.DoesNotContain("GenerateNSwagCSharp ", process.Output); + } + + public void Dispose() + { + _temporaryDirectory.Dispose(); + } + + private async Task RunBuild() + { + var process = ProcessEx.Run( + _output, + _temporaryDirectory.Root, + DotNetMuxer.MuxerPathOrDefault(), + "build"); + await process.Exited; + + return process; + } +} diff --git a/src/Tools/Extensions.ApiDescription.Client/test/TemporaryOpenApiProject.cs b/src/Tools/Extensions.ApiDescription.Client/test/TemporaryOpenApiProject.cs new file mode 100644 index 000000000000..5e6739779928 --- /dev/null +++ b/src/Tools/Extensions.ApiDescription.Client/test/TemporaryOpenApiProject.cs @@ -0,0 +1,88 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Text; + +namespace Microsoft.Extensions.Tools.Internal; + +public class TemporaryOpenApiProject : TemporaryCSharpProject +{ + public TemporaryOpenApiProject(string name, TemporaryDirectory directory, string sdk) + : base(name, directory, sdk) + { + } + + protected override string Template => +@" + + + + {0} + + + {1} + + + + + + + + + + + +"; + + protected override void AddAdditionalAttributes(StringBuilder sb, TemporaryCSharpProject.ItemSpec item) + { + var openApiItem = item as ItemSpec; + if (openApiItem.ClassName != null) + { + sb.Append(" ClassName=\"").Append(openApiItem.ClassName).Append('"'); + } + + if (openApiItem.CodeGenerator != null) + { + sb.Append(" CodeGenerator=\"").Append(openApiItem.CodeGenerator).Append('"'); + } + + if (openApiItem.Namespace != null) + { + sb.Append(" Namespace=\"").Append(openApiItem.Namespace).Append('"'); + } + + if (openApiItem.Options != null) + { + sb.Append(" Options=\"").Append(openApiItem.Options).Append('"'); + } + + if (openApiItem.OutputPath != null) + { + sb.Append(" OutputPath=\"").Append(openApiItem.OutputPath).Append('"'); + } + } + + public new class ItemSpec : TemporaryCSharpProject.ItemSpec + { + public ItemSpec() : base() + { + Name = "OpenApiReference"; + } + + // Metadata specific to OpenApiReference items. + public string ClassName { get; set; } + + public string CodeGenerator { get; set; } + + public string Namespace { get; set; } + + public string Options { get; set; } + + public string OutputPath { get; set; } + } +} diff --git a/src/Tools/Extensions.ApiDescription.Client/test/TestProjects/ConsoleClient/ConsoleClient.csproj b/src/Tools/Extensions.ApiDescription.Client/test/TestProjects/ConsoleClient/ConsoleClient.csproj deleted file mode 100644 index 18c332c188eb..000000000000 --- a/src/Tools/Extensions.ApiDescription.Client/test/TestProjects/ConsoleClient/ConsoleClient.csproj +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Exe - $(DefaultNetCoreTargetFramework) - true - - - - - - - - - - - - <_Files Include="../../Microsoft.Extensions.ApiDescription.Client.*" - Exclude="../../Microsoft.Extensions.ApiDescription.Client.Tests.*" /> - - - - - - - - diff --git a/src/Tools/Extensions.ApiDescription.Client/test/TestProjects/ConsoleClient/Program.cs b/src/Tools/Extensions.ApiDescription.Client/test/TestProjects/ConsoleClient/Program.cs deleted file mode 100644 index 73849cbd03bd..000000000000 --- a/src/Tools/Extensions.ApiDescription.Client/test/TestProjects/ConsoleClient/Program.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; - -namespace ConsoleClient -{ - class Program - { - static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - } - } -} diff --git a/src/Tools/Extensions.ApiDescription.Client/test/TestProjects/build/Fakes.targets b/src/Tools/Extensions.ApiDescription.Client/test/TestProjects/build/Fakes.targets index 78597f2ac60d..480fb5b57316 100644 --- a/src/Tools/Extensions.ApiDescription.Client/test/TestProjects/build/Fakes.targets +++ b/src/Tools/Extensions.ApiDescription.Client/test/TestProjects/build/Fakes.targets @@ -1,40 +1,52 @@ - + - - - + + + <_HeaderMetadata Include="Licensed to the .NET Foundation under one or more agreements." /> + <_HeaderMetadata Include="The .NET Foundation licenses this file to you under the MIT license." /> + + <_Metadata Include="__TargetName__" /> + <_Metadata Include="%(CurrentOpenApiReference.FullPath)" /> + <_Metadata Include="Class: '%(CurrentOpenApiReference.Namespace).%(CurrentOpenApiReference.ClassName)'" /> + <_Metadata Include="FirstForGenerator: '%(CurrentOpenApiReference.FirstForGenerator)'" /> + <_Metadata Include="Options: '%(CurrentOpenApiReference.Options)'" /> + <_Metadata Include="OutputPath: '%(CurrentOpenApiReference.OutputPath)'" /> + - <_Metadata>'%(CurrentOpenApiReference.FullPath)' - <_Metadata>$(_Metadata) Class: '%(CurrentOpenApiReference.Namespace).%(CurrentOpenApiReference.ClassName)' - <_Metadata>$(_Metadata) FirstForGenerator: '%(CurrentOpenApiReference.FirstForGenerator)' - <_Metadata>$(_Metadata) Options: '%(CurrentOpenApiReference.Options)' - <_Metadata>$(_Metadata) OutputPath: '%(CurrentOpenApiReference.OutputPath)' + <_Message>@(_Metadata, ' ') + <_Lines>@(_HeaderMetadata -> '// %(Identity)', '%0A') + + + + + - + + + - - - <_Metadata>'%(FullPath)' Class: '%(Namespace).%(ClassName)' - <_Metadata>$(_Metadata) FirstForGenerator: '%(FirstForGenerator)' Options: '%(Options)' - <_Metadata>$(_Metadata) OutputPath: '%(OutputPath)' - - - + + + - - - <_Metadata>'%(FullPath)' Class: '%(Namespace).%(ClassName)' - <_Metadata>$(_Metadata) FirstForGenerator: '%(FirstForGenerator)' Options: '%(Options)' - <_Metadata>$(_Metadata) OutputPath: '%(OutputPath)' - - - + + + + diff --git a/src/Tools/Shared/TestHelpers/TemporaryCSharpProject.cs b/src/Tools/Shared/TestHelpers/TemporaryCSharpProject.cs index fba5b400be5d..efc3e782bc5d 100644 --- a/src/Tools/Shared/TestHelpers/TemporaryCSharpProject.cs +++ b/src/Tools/Shared/TestHelpers/TemporaryCSharpProject.cs @@ -13,17 +13,6 @@ namespace Microsoft.Extensions.Tools.Internal { public class TemporaryCSharpProject { - private const string Template = - @" - - {0} - Exe - - - {1} - -"; - private readonly string _filename; private readonly TemporaryDirectory _directory; private readonly List _items = new List(); @@ -42,6 +31,17 @@ public TemporaryCSharpProject(string name, TemporaryDirectory directory, string public string Sdk { get; } + protected virtual string Template => +@" + + {0} + Exe + + + {1} + +"; + public TemporaryCSharpProject WithTargetFrameworks(params string[] tfms) { Debug.Assert(tfms.Length > 0); @@ -82,11 +82,16 @@ public TemporaryCSharpProject WithItem(ItemSpec item) if (item.Exclude != null) sb.Append(" Exclude=\"").Append(item.Exclude).Append('"'); if (item.Condition != null) sb.Append(" Exclude=\"").Append(item.Condition).Append('"'); if (!item.Watch) sb.Append(" Watch=\"false\" "); + AddAdditionalAttributes(sb, item); sb.Append(" />"); _items.Add(sb.ToString()); return this; } + protected virtual void AddAdditionalAttributes(StringBuilder sb, ItemSpec item) + { + } + public TemporaryCSharpProject WithProjectReference(TemporaryCSharpProject reference, bool watch = true) { if (ReferenceEquals(this, reference)) diff --git a/src/Tools/Shared/TestHelpers/TemporaryDirectory.cs b/src/Tools/Shared/TestHelpers/TemporaryDirectory.cs index 29f36839a038..639b816ee1fb 100644 --- a/src/Tools/Shared/TestHelpers/TemporaryDirectory.cs +++ b/src/Tools/Shared/TestHelpers/TemporaryDirectory.cs @@ -18,7 +18,7 @@ public class TemporaryDirectory : IDisposable public TemporaryDirectory() { - Root = Path.Combine(Path.GetTempPath(), "dotnet-tool-tests", Guid.NewGuid().ToString("N")); + Root = Path.Combine(ResolveLinks(Path.GetTempPath()), "dotnet-tool-tests", Guid.NewGuid().ToString("N")); } private TemporaryDirectory(string path, TemporaryDirectory parent) @@ -39,13 +39,12 @@ public TemporaryDirectory SubDir(string name) public TemporaryCSharpProject WithCSharpProject(string name, string sdk = "Microsoft.NET.Sdk") { var project = new TemporaryCSharpProject(name, this, sdk); - _projects.Add(project); - return project; + return WithCSharpProject(project); } - public TemporaryCSharpProject WithCSharpProject(string name, out TemporaryCSharpProject project, string sdk = "Microsoft.NET.Sdk") + public TemporaryCSharpProject WithCSharpProject(TemporaryCSharpProject project) { - project = WithCSharpProject(name, sdk); + _projects.Add(project); return project; } @@ -115,5 +114,35 @@ public void Dispose() Console.Error.WriteLine($"Test cleanup failed to delete '{Root}'"); } } + + private static string ResolveLinks(string path) + { + if (!Directory.Exists(path)) + { + return path; + } + + var info = new DirectoryInfo(path); + var segments = new List(); + while (true) + { + if (info.LinkTarget is not null) + { + // Found a link, use it until we reach root. Portions of resolved path may also be links. + info = new DirectoryInfo(info.LinkTarget); + } + + segments.Add(info.Name); + if (info.Parent is null) + { + break; + } + + info = info.Parent; + } + + segments.Reverse(); + return Path.Combine(segments.ToArray()); + } } } diff --git a/src/submodules/googletest b/src/submodules/googletest index 4848324c5ff3..6b74da4757a5 160000 --- a/src/submodules/googletest +++ b/src/submodules/googletest @@ -1 +1 @@ -Subproject commit 4848324c5ff3186a7f72a674f6760d0b8da585d7 +Subproject commit 6b74da4757a549563d7c37c8fae3e704662a043b diff --git a/src/submodules/spa-templates b/src/submodules/spa-templates index 55da9ce02068..9ae11cea16c8 160000 --- a/src/submodules/spa-templates +++ b/src/submodules/spa-templates @@ -1 +1 @@ -Subproject commit 55da9ce020682531efe3cac6b1dfa5ca4b8f97b0 +Subproject commit 9ae11cea16c84ce0d803c8a1ca69216d989d9815